2 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_chtml10.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_cookie.h"
24 #define GET_CHTML10(X) ((chtml10_t*)(X))
26 static char* s_chtml10_start_html_tag (void* pdoc, Node* node);
27 static char* s_chtml10_end_html_tag (void* pdoc, Node* node);
28 static char* s_chtml10_start_meta_tag (void* pdoc, Node* node);
29 static char* s_chtml10_end_meta_tag (void* pdoc, Node* node);
30 static char* s_chtml10_start_textarea_tag (void* pdoc, Node* node);
31 static char* s_chtml10_end_textarea_tag (void* pdoc, Node* node);
32 static char* s_chtml10_start_p_tag (void* pdoc, Node* node);
33 static char* s_chtml10_end_p_tag (void* pdoc, Node* node);
34 static char* s_chtml10_start_pre_tag (void* pdoc, Node* node);
35 static char* s_chtml10_end_pre_tag (void* pdoc, Node* node);
36 static char* s_chtml10_start_ul_tag (void* pdoc, Node* node);
37 static char* s_chtml10_end_ul_tag (void* pdoc, Node* node);
38 static char* s_chtml10_start_li_tag (void* pdoc, Node* node);
39 static char* s_chtml10_end_li_tag (void* pdoc, Node* node);
40 static char* s_chtml10_start_ol_tag (void* pdoc, Node* node);
41 static char* s_chtml10_end_ol_tag (void* pdoc, Node* node);
42 static char* s_chtml10_start_h1_tag (void* pdoc, Node* node);
43 static char* s_chtml10_end_h1_tag (void* pdoc, Node* node);
44 static char* s_chtml10_start_h2_tag (void* pdoc, Node* node);
45 static char* s_chtml10_end_h2_tag (void* pdoc, Node* node);
46 static char* s_chtml10_start_h3_tag (void* pdoc, Node* node);
47 static char* s_chtml10_end_h3_tag (void* pdoc, Node* node);
48 static char* s_chtml10_start_h4_tag (void* pdoc, Node* node);
49 static char* s_chtml10_end_h4_tag (void* pdoc, Node* node);
50 static char* s_chtml10_start_h5_tag (void* pdoc, Node* node);
51 static char* s_chtml10_end_h5_tag (void* pdoc, Node* node);
52 static char* s_chtml10_start_h6_tag (void* pdoc, Node* node);
53 static char* s_chtml10_end_h6_tag (void* pdoc, Node* node);
54 static char* s_chtml10_start_head_tag (void* pdoc, Node* node);
55 static char* s_chtml10_end_head_tag (void* pdoc, Node* node);
56 static char* s_chtml10_start_title_tag (void* pdoc, Node* node);
57 static char* s_chtml10_end_title_tag (void* pdoc, Node* node);
58 static char* s_chtml10_start_base_tag (void* pdoc, Node* node);
59 static char* s_chtml10_end_base_tag (void* pdoc, Node* node);
60 static char* s_chtml10_start_body_tag (void* pdoc, Node* node);
61 static char* s_chtml10_end_body_tag (void* pdoc, Node* node);
62 static char* s_chtml10_start_a_tag (void* pdoc, Node* node);
63 static char* s_chtml10_end_a_tag (void* pdoc, Node* node);
64 static char* s_chtml10_start_br_tag (void* pdoc, Node* node);
65 static char* s_chtml10_end_br_tag (void* pdoc, Node* node);
66 static char* s_chtml10_start_tr_tag (void* pdoc, Node* node);
67 static char* s_chtml10_end_tr_tag (void* pdoc, Node* node);
68 static char* s_chtml10_start_font_tag (void* pdoc, Node* node);
69 static char* s_chtml10_end_font_tag (void* pdoc, Node* node);
70 static char* s_chtml10_start_input_tag (void* pdoc, Node* node);
71 static char* s_chtml10_end_input_tag (void* pdoc, Node* node);
72 static char* s_chtml10_start_form_tag (void* pdoc, Node* node);
73 static char* s_chtml10_end_form_tag (void* pdoc, Node* node);
74 static char* s_chtml10_start_center_tag (void* pdoc, Node* node);
75 static char* s_chtml10_end_center_tag (void* pdoc, Node* node);
76 static char* s_chtml10_start_hr_tag (void* pdoc, Node* node);
77 static char* s_chtml10_end_hr_tag (void* pdoc, Node* node);
78 static char* s_chtml10_start_img_tag (void* pdoc, Node* node);
79 static char* s_chtml10_end_img_tag (void* pdoc, Node* node);
80 static char* s_chtml10_start_select_tag (void* pdoc, Node* node);
81 static char* s_chtml10_end_select_tag (void* pdoc, Node* node);
82 static char* s_chtml10_start_option_tag (void* pdoc, Node* node);
83 static char* s_chtml10_end_option_tag (void* pdoc, Node* node);
84 static char* s_chtml10_start_div_tag (void* pdoc, Node* node);
85 static char* s_chtml10_end_div_tag (void* pdoc, Node* node);
87 static void s_init_chtml10(chtml10_t* chtml, Doc* doc, request_rec* r, device_table* spec);
89 static int s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
90 static char* s_chtml10_chxjif_tag (void* pdoc, Node* node);
91 static char* s_chtml10_text (void* pdoc, Node* node);
93 tag_handler chtml10_handler[] = {
96 s_chtml10_start_html_tag,
97 s_chtml10_end_html_tag,
101 s_chtml10_start_meta_tag,
102 s_chtml10_end_meta_tag,
106 s_chtml10_start_textarea_tag,
107 s_chtml10_end_textarea_tag,
111 s_chtml10_start_p_tag,
116 s_chtml10_start_pre_tag,
117 s_chtml10_end_pre_tag,
121 s_chtml10_start_ul_tag,
122 s_chtml10_end_ul_tag,
126 s_chtml10_start_li_tag,
127 s_chtml10_end_li_tag,
131 s_chtml10_start_ol_tag,
132 s_chtml10_end_ol_tag,
136 s_chtml10_start_h1_tag,
137 s_chtml10_end_h1_tag,
141 s_chtml10_start_h2_tag,
142 s_chtml10_end_h2_tag,
146 s_chtml10_start_h3_tag,
147 s_chtml10_end_h3_tag,
151 s_chtml10_start_h4_tag,
152 s_chtml10_end_h4_tag,
156 s_chtml10_start_h5_tag,
157 s_chtml10_end_h5_tag,
161 s_chtml10_start_h6_tag,
162 s_chtml10_end_h6_tag,
166 s_chtml10_start_head_tag,
167 s_chtml10_end_head_tag,
171 s_chtml10_start_title_tag,
172 s_chtml10_end_title_tag,
176 s_chtml10_start_base_tag,
177 s_chtml10_end_base_tag,
181 s_chtml10_start_body_tag,
182 s_chtml10_end_body_tag,
186 s_chtml10_start_a_tag,
191 s_chtml10_start_br_tag,
192 s_chtml10_end_br_tag,
201 s_chtml10_start_tr_tag,
202 s_chtml10_end_tr_tag,
216 s_chtml10_start_font_tag,
217 s_chtml10_end_font_tag,
221 s_chtml10_start_form_tag,
222 s_chtml10_end_form_tag,
226 s_chtml10_start_input_tag,
227 s_chtml10_end_input_tag,
231 s_chtml10_start_center_tag,
232 s_chtml10_end_center_tag,
236 s_chtml10_start_hr_tag,
237 s_chtml10_end_hr_tag,
241 s_chtml10_start_img_tag,
242 s_chtml10_end_img_tag,
246 s_chtml10_start_select_tag,
247 s_chtml10_end_select_tag,
251 s_chtml10_start_option_tag,
252 s_chtml10_end_option_tag,
256 s_chtml10_start_div_tag,
257 s_chtml10_end_div_tag,
261 s_chtml10_chxjif_tag,
303 * converts from CHTML5.0 to CHTML1.0.
305 * @param r [i] Requet_rec is appointed.
306 * @param spec [i] The result of the device specification processing which
307 * was done in advance is appointed.
308 * @param src [i] The character string before the converting is appointed.
309 * @return The character string after the converting is returned.
312 chxj_exchange_chtml10(
318 chxjconvrule_entry* entryp,
319 const char* cookie_id
329 DBG1(r, "start chxj_exchange_chtml10() cookie_id=[%s]", cookie_id);
331 /*--------------------------------------------------------------------------*/
333 /*--------------------------------------------------------------------------*/
335 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
337 DBG(r,"i found qrcode xml");
340 DBG(r,"not found qrcode xml");
342 /*--------------------------------------------------------------------------*/
343 /* The CHTML structure is initialized. */
344 /*--------------------------------------------------------------------------*/
345 s_init_chtml10(&chtml10, &doc, r, spec);
346 chtml10.entryp = entryp;
347 chtml10.cookie_id = (char*)cookie_id;
349 ap_set_content_type(r, "text/html; charset=Windows-31J");
351 /*--------------------------------------------------------------------------*/
352 /* The character string of the input is analyzed. */
353 /*--------------------------------------------------------------------------*/
354 qs_init_malloc(&doc);
355 qs_init_root_node(&doc);
357 ss = apr_pcalloc(r->pool, srclen + 1);
358 memset(ss, 0, srclen + 1);
359 memcpy(ss, src, srclen);
362 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
365 qs_parse_string(&doc,ss, strlen(ss));
367 /*--------------------------------------------------------------------------*/
368 /* It converts it from CHTML to CHTML. */
369 /*--------------------------------------------------------------------------*/
370 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
374 qs_all_free(&doc,QX_LOGMARK);
377 return apr_pstrdup(r->pool,ss);
379 if (strlen(dst) == 0) {
380 dst = apr_psprintf(r->pool, "\n");
382 *dstlen = strlen(dst);
385 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
388 DBG1(r, "end chxj_exchange_chtml10() cookie_id=[%s]", cookie_id);
395 * The CHTML structure is initialized.
397 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
398 * initialized is specified.
399 * @param doc [i] The Doc structure that should be set to the initialized
400 * HDML structure is specified.
401 * @param r [i] To use POOL, the pointer to request_rec is specified.
402 * @param spec [i] The pointer to the device_table
411 memset(doc, 0, sizeof(Doc));
412 memset(chtml10, 0, sizeof(chtml10_t));
416 chtml10->spec = spec;
417 chtml10->out = qs_alloc_zero_byte_string(r);
418 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
419 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
424 * Corresponding EMOJI to a current character-code is retrieved.
425 * The substitution character string is stored in the rslt pointer if agreeing.
427 * @param chtml10 [i] The pointer to the CHTML structure is specified.
428 * @param txt [i] The character string to want to examine whether it is
429 * EMOJI is specified.
430 * @param rslt [o] The pointer to the pointer that stores the result is
432 * @return When corresponding EMOJI exists, it returns it excluding 0.
435 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
442 spec = chtml10->spec;
448 DBG(r,"spec is NULL");
451 for (ee = chtml10->conf->emoji;
456 DBG(r,"emoji->imode is NULL");
460 if (ee->imode->string
462 && strlen(ee->imode->string) > 0
463 && *ee->imode->string == *txt
464 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
465 if (!spec || !spec->emoji_type) {
466 *rslt = apr_palloc(r->pool, 3);
467 (*rslt)[0] = ee->imode->hex1byte & 0xff;
468 (*rslt)[1] = ee->imode->hex2byte & 0xff;
470 return strlen(ee->imode->string);
481 * It is a handler who processes the HTML tag.
483 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
484 * destination is specified.
485 * @param node [i] The HTML tag node is specified.
486 * @return The conversion result is returned.
489 s_chtml10_start_html_tag(void* pdoc, Node* node)
495 chtml10 = GET_CHTML10(pdoc);
499 /*--------------------------------------------------------------------------*/
501 /*--------------------------------------------------------------------------*/
502 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
509 * It is a handler who processes the HTML tag.
511 * @param pdoc [i/o] The pointer to the CHTML structure at the output
512 * destination is specified.
513 * @param node [i] The HTML tag node is specified.
514 * @return The conversion result is returned.
517 s_chtml10_end_html_tag(void* pdoc, Node* child)
524 chtml10 = GET_CHTML10(pdoc);
528 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
535 * It is a handler who processes the META tag.
537 * @param pdoc [i/o] The pointer to the CHTML structure at the output
538 * destination is specified.
539 * @param node [i] The META tag node is specified.
540 * @return The conversion result is returned.
543 s_chtml10_start_meta_tag(void* pdoc, Node* node)
547 chtml10 = GET_CHTML10(pdoc);
556 * It is a handler who processes the META tag.
558 * @param pdoc [i/o] The pointer to the CHTML structure at the output
559 * destination is specified.
560 * @param node [i] The META tag node is specified.
561 * @return The conversion result is returned.
564 s_chtml10_end_meta_tag(void* pdoc, Node* child)
568 chtml10 = GET_CHTML10(pdoc);
575 * It is a handler who processes the HEAD tag.
577 * @param pdoc [i/o] The pointer to the CHTML structure at the output
578 * destination is specified.
579 * @param node [i] The HEAD tag node is specified.
580 * @return The conversion result is returned.
583 s_chtml10_start_head_tag(void* pdoc, Node* node)
589 chtml10 = GET_CHTML10(pdoc);
593 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
600 * It is a handler who processes the HEAD tag.
602 * @param pdoc [i/o] The pointer to the CHTML structure at the output
603 * destination is specified.
604 * @param node [i] The HEAD tag node is specified.
605 * @return The conversion result is returned.
608 s_chtml10_end_head_tag(void* pdoc, Node* child)
614 chtml10 = GET_CHTML10(pdoc);
618 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
625 * It is a handler who processes the OL tag.
627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
628 * destination is specified.
629 * @param node [i] The OL tag node is specified.
630 * @return The conversion result is returned.
633 s_chtml10_start_ol_tag(void* pdoc, Node* node)
639 chtml10 = GET_CHTML10(pdoc);
643 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
650 * It is a handler who processes the OL tag.
652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
653 * destination is specified.
654 * @param node [i] The OL tag node is specified.
655 * @return The conversion result is returned.
658 s_chtml10_end_ol_tag(void* pdoc, Node* child)
664 chtml10 = GET_CHTML10(pdoc);
668 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
675 * It is a handler who processes the UL tag.
677 * @param pdoc [i/o] The pointer to the CHTML structure at the output
678 * destination is specified.
679 * @param node [i] The UL tag node is specified.
680 * @return The conversion result is returned.
683 s_chtml10_start_ul_tag(void* pdoc, Node* node)
689 chtml10 = GET_CHTML10(pdoc);
693 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
700 * It is a handler who processes the UL tag.
702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
703 * destination is specified.
704 * @param node [i] The UL tag node is specified.
705 * @return The conversion result is returned.
708 s_chtml10_end_ul_tag(void* pdoc, Node* child)
714 chtml10 = GET_CHTML10(pdoc);
718 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
725 * It is a handler who processes the LI tag.
727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
728 * destination is specified.
729 * @param node [i] The LI tag node is specified.
730 * @return The conversion result is returned.
733 s_chtml10_start_li_tag(void* pdoc, Node* node)
739 chtml10 = GET_CHTML10(pdoc);
743 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
750 * It is a handler who processes the LI tag.
752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
753 * destination is specified.
754 * @param node [i] The LI tag node is specified.
755 * @return The conversion result is returned.
758 s_chtml10_end_li_tag(void* pdoc, Node* child)
764 chtml10 = GET_CHTML10(pdoc);
768 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
775 * It is a handler who processes the H1 tag.
777 * @param pdoc [i/o] The pointer to the CHTML structure at the output
778 * destination is specified.
779 * @param node [i] The H1 tag node is specified.
780 * @return The conversion result is returned.
783 s_chtml10_start_h1_tag(void* pdoc, Node* node)
789 chtml10 = GET_CHTML10(pdoc);
793 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
800 * It is a handler who processes the H1 tag.
802 * @param pdoc [i/o] The pointer to the CHTML structure at the output
803 * destination is specified.
804 * @param node [i] The H1 tag node is specified.
805 * @return The conversion result is returned.
808 s_chtml10_end_h1_tag(void* pdoc, Node* child)
814 chtml10 = GET_CHTML10(pdoc);
818 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
825 * It is a handler who processes the H2 tag.
827 * @param pdoc [i/o] The pointer to the CHTML structure at the output
828 * destination is specified.
829 * @param node [i] The H2 tag node is specified.
830 * @return The conversion result is returned.
833 s_chtml10_start_h2_tag(void* pdoc, Node* node)
839 chtml10 = GET_CHTML10(pdoc);
843 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
850 * It is a handler who processes the H2 tag.
852 * @param pdoc [i/o] The pointer to the CHTML structure at the output
853 * destination is specified.
854 * @param node [i] The H2 tag node is specified.
855 * @return The conversion result is returned.
858 s_chtml10_end_h2_tag(void* pdoc, Node* child)
864 chtml10 = GET_CHTML10(pdoc);
868 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
875 * It is a handler who processes the H3 tag.
877 * @param pdoc [i/o] The pointer to the CHTML structure at the output
878 * destination is specified.
879 * @param node [i] The H3 tag node is specified.
880 * @return The conversion result is returned.
883 s_chtml10_start_h3_tag(void* pdoc, Node* node)
889 chtml10 = GET_CHTML10(pdoc);
893 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
900 * It is a handler who processes the H3 tag.
902 * @param pdoc [i/o] The pointer to the CHTML structure at the output
903 * destination is specified.
904 * @param node [i] The H3 tag node is specified.
905 * @return The conversion result is returned.
908 s_chtml10_end_h3_tag(void* pdoc, Node* child)
914 chtml10 = GET_CHTML10(pdoc);
918 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
925 * It is a handler who processes the H4 tag.
927 * @param pdoc [i/o] The pointer to the CHTML structure at the output
928 * destination is specified.
929 * @param node [i] The H4 tag node is specified.
930 * @return The conversion result is returned.
933 s_chtml10_start_h4_tag(void* pdoc, Node* node)
939 chtml10 = GET_CHTML10(pdoc);
943 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
950 * It is a handler who processes the H4 tag.
952 * @param pdoc [i/o] The pointer to the CHTML structure at the output
953 * destination is specified.
954 * @param node [i] The H4 tag node is specified.
955 * @return The conversion result is returned.
958 s_chtml10_end_h4_tag(void* pdoc, Node* child)
964 chtml10 = GET_CHTML10(pdoc);
968 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
975 * It is a handler who processes the H5 tag.
977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
978 * destination is specified.
979 * @param node [i] The H5 tag node is specified.
980 * @return The conversion result is returned.
983 s_chtml10_start_h5_tag(void* pdoc, Node* node)
989 chtml10 = GET_CHTML10(pdoc);
993 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
1000 * It is a handler who processes the H5 tag.
1002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The H5 tag node is specified.
1005 * @return The conversion result is returned.
1008 s_chtml10_end_h5_tag(void* pdoc, Node* child)
1014 chtml10 = GET_CHTML10(pdoc);
1018 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
1020 return chtml10->out;
1025 * It is a handler who processes the H6 tag.
1027 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1028 * destination is specified.
1029 * @param node [i] The H6 tag node is specified.
1030 * @return The conversion result is returned.
1033 s_chtml10_start_h6_tag(void* pdoc, Node* node)
1039 chtml10 = GET_CHTML10(pdoc);
1043 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1045 return chtml10->out;
1050 * It is a handler who processes the H6 tag.
1052 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1053 * destination is specified.
1054 * @param node [i] The H6 tag node is specified.
1055 * @return The conversion result is returned.
1058 s_chtml10_end_h6_tag(void* pdoc, Node* child)
1064 chtml10 = GET_CHTML10(pdoc);
1068 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1070 return chtml10->out;
1075 * It is a handler who processes the TITLE tag.
1077 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1078 * destination is specified.
1079 * @param node [i] The TITLE tag node is specified.
1080 * @return The conversion result is returned.
1083 s_chtml10_start_title_tag(void* pdoc, Node* node)
1089 chtml10 = GET_CHTML10(pdoc);
1093 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1095 return chtml10->out;
1100 * It is a handler who processes the TITLE tag.
1102 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1103 * destination is specified.
1104 * @param node [i] The TITLE tag node is specified.
1105 * @return The conversion result is returned.
1108 s_chtml10_end_title_tag(void* pdoc, Node* child)
1114 chtml10 = GET_CHTML10(pdoc);
1118 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1120 return chtml10->out;
1125 * It is a handler who processes the BASE tag.
1127 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1128 * destination is specified.
1129 * @param node [i] The BASE tag node is specified.
1130 * @return The conversion result is returned.
1133 s_chtml10_start_base_tag(void* pdoc, Node* node)
1140 chtml10 = GET_CHTML10(pdoc);
1145 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1147 /*--------------------------------------------------------------------------*/
1148 /* Get Attributes */
1149 /*--------------------------------------------------------------------------*/
1150 for (attr = qs_get_attr(doc,node);
1152 attr = qs_get_next_attr(doc,attr)) {
1153 char* name = qs_get_attr_name(doc,attr);
1154 char* value = qs_get_attr_value(doc,attr);
1155 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1156 chtml10->out = apr_pstrcat(r->pool,
1165 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1167 return chtml10->out;
1172 * It is a handler who processes the BASE tag.
1174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1175 * destination is specified.
1176 * @param node [i] The BASE tag node is specified.
1177 * @return The conversion result is returned.
1180 s_chtml10_end_base_tag(void* pdoc, Node* child)
1182 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1184 return chtml10->out;
1189 * It is a handler who processes the BODY tag.
1191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1192 * destination is specified.
1193 * @param node [i] The BODY tag node is specified.
1194 * @return The conversion result is returned.
1197 s_chtml10_start_body_tag(void* pdoc, Node* node)
1204 chtml10 = GET_CHTML10(pdoc);
1208 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1210 /*--------------------------------------------------------------------------*/
1211 /* Get Attributes */
1212 /*--------------------------------------------------------------------------*/
1213 for (attr = qs_get_attr(doc,node);
1215 attr = qs_get_next_attr(doc,attr)) {
1216 char* name = qs_get_attr_name(doc,attr);
1218 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
1219 /*----------------------------------------------------------------------*/
1221 /*----------------------------------------------------------------------*/
1225 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
1226 /*----------------------------------------------------------------------*/
1228 /*----------------------------------------------------------------------*/
1232 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
1233 /*----------------------------------------------------------------------*/
1235 /*----------------------------------------------------------------------*/
1239 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
1240 /*----------------------------------------------------------------------*/
1242 /*----------------------------------------------------------------------*/
1246 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
1247 /*----------------------------------------------------------------------*/
1249 /*----------------------------------------------------------------------*/
1253 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1255 return chtml10->out;
1260 * It is a handler who processes the BODY tag.
1262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1263 * destination is specified.
1264 * @param node [i] The BODY tag node is specified.
1265 * @return The conversion result is returned.
1268 s_chtml10_end_body_tag(void* pdoc, Node* child)
1274 chtml10 = GET_CHTML10(pdoc);
1278 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1280 return chtml10->out;
1285 * It is a handler who processes the A tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The A tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml10_start_a_tag(void* pdoc, Node* node)
1300 chtml10 = GET_CHTML10(pdoc);
1304 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1306 /*--------------------------------------------------------------------------*/
1307 /* Get Attributes */
1308 /*--------------------------------------------------------------------------*/
1309 for (attr = qs_get_attr(doc,node);
1311 attr = qs_get_next_attr(doc,attr)) {
1312 char* name = qs_get_attr_name(doc,attr);
1313 char* value = qs_get_attr_value(doc,attr);
1315 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1316 /*----------------------------------------------------------------------*/
1318 /*----------------------------------------------------------------------*/
1319 chtml10->out = apr_pstrcat(r->pool,
1327 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1328 /*----------------------------------------------------------------------*/
1330 /*----------------------------------------------------------------------*/
1331 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
1333 chtml10->out = apr_pstrcat(r->pool,
1341 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1342 /*----------------------------------------------------------------------*/
1344 /*----------------------------------------------------------------------*/
1345 chtml10->out = apr_pstrcat(r->pool,
1353 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
1354 /*----------------------------------------------------------------------*/
1356 /*----------------------------------------------------------------------*/
1360 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
1361 /*----------------------------------------------------------------------*/
1363 /*----------------------------------------------------------------------*/
1367 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1368 /*----------------------------------------------------------------------*/
1370 /*----------------------------------------------------------------------*/
1374 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1375 /*----------------------------------------------------------------------*/
1377 /*----------------------------------------------------------------------*/
1381 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1382 /*----------------------------------------------------------------------*/
1384 /*----------------------------------------------------------------------*/
1388 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1389 /*----------------------------------------------------------------------*/
1391 /*----------------------------------------------------------------------*/
1395 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1396 /*----------------------------------------------------------------------*/
1398 /*----------------------------------------------------------------------*/
1402 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1403 /*----------------------------------------------------------------------*/
1405 /*----------------------------------------------------------------------*/
1409 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1410 /*----------------------------------------------------------------------*/
1412 /*----------------------------------------------------------------------*/
1416 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1417 /*----------------------------------------------------------------------*/
1419 /*----------------------------------------------------------------------*/
1424 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1426 return chtml10->out;
1431 * It is a handler who processes the A tag.
1433 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1434 * destination is specified.
1435 * @param node [i] The A tag node is specified.
1436 * @return The conversion result is returned.
1439 s_chtml10_end_a_tag(void* pdoc, Node* child)
1445 chtml10 = GET_CHTML10(pdoc);
1449 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1451 return chtml10->out;
1456 * It is a handler who processes the BR tag.
1458 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1459 * destination is specified.
1460 * @param node [i] The BR tag node is specified.
1461 * @return The conversion result is returned.
1464 s_chtml10_start_br_tag(void* pdoc, Node* node)
1470 chtml10 = GET_CHTML10(pdoc);
1474 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1476 return chtml10->out;
1481 * It is a handler who processes the BR tag.
1483 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1484 * destination is specified.
1485 * @param node [i] The BR tag node is specified.
1486 * @return The conversion result is returned.
1489 s_chtml10_end_br_tag(void* pdoc, Node* child)
1491 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1493 return chtml10->out;
1498 * It is a handler who processes the TR tag.
1500 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1501 * destination is specified.
1502 * @param node [i] The TR tag node is specified.
1503 * @return The conversion result is returned.
1506 s_chtml10_start_tr_tag(void* pdoc, Node* node)
1508 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1510 return chtml10->out;
1515 * It is a handler who processes the TR tag.
1517 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1518 * destination is specified.
1519 * @param node [i] The TR tag node is specified.
1520 * @return The conversion result is returned.
1523 s_chtml10_end_tr_tag(void* pdoc, Node* child)
1529 chtml10 = GET_CHTML10(pdoc);
1533 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1535 return chtml10->out;
1540 * It is a handler who processes the FONT tag.
1542 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1543 * destination is specified.
1544 * @param node [i] The FONT tag node is specified.
1545 * @return The conversion result is returned.
1548 s_chtml10_start_font_tag(void* pdoc, Node* node)
1550 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1554 return chtml10->out;
1559 * It is a handler who processes the FONT tag.
1561 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1562 * destination is specified.
1563 * @param node [i] The FONT tag node is specified.
1564 * @return The conversion result is returned.
1567 s_chtml10_end_font_tag(void* pdoc, Node* child)
1569 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1573 return chtml10->out;
1578 * It is a handler who processes the FORM tag.
1580 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1581 * destination is specified.
1582 * @param node [i] The FORM tag node is specified.
1583 * @return The conversion result is returned.
1586 s_chtml10_start_form_tag(void* pdoc, Node* node)
1593 chtml10 = GET_CHTML10(pdoc);
1597 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1599 /*--------------------------------------------------------------------------*/
1600 /* Get Attributes */
1601 /*--------------------------------------------------------------------------*/
1602 for (attr = qs_get_attr(doc,node);
1604 attr = qs_get_next_attr(doc,attr)) {
1605 char* name = qs_get_attr_name(doc,attr);
1606 char* value = qs_get_attr_value(doc,attr);
1607 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1608 /*----------------------------------------------------------------------*/
1610 /*----------------------------------------------------------------------*/
1611 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
1613 chtml10->out = apr_pstrcat(r->pool,
1621 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "method") == 0) {
1622 /*----------------------------------------------------------------------*/
1624 /*----------------------------------------------------------------------*/
1625 chtml10->out = apr_pstrcat(r->pool,
1633 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1634 /*----------------------------------------------------------------------*/
1636 /*----------------------------------------------------------------------*/
1641 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1643 return chtml10->out;
1648 * It is a handler who processes the FORM tag.
1650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1651 * destination is specified.
1652 * @param node [i] The FORM tag node is specified.
1653 * @return The conversion result is returned.
1656 s_chtml10_end_form_tag(void* pdoc, Node* child)
1662 chtml10 = GET_CHTML10(pdoc);
1666 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1668 return chtml10->out;
1673 * It is a handler who processes the INPUT tag.
1675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1676 * destination is specified.
1677 * @param node [i] The INPUT tag node is specified.
1678 * @return The conversion result is returned.
1681 s_chtml10_start_input_tag(void* pdoc, Node* node)
1695 chtml10 = GET_CHTML10(pdoc);
1708 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1710 /*--------------------------------------------------------------------------*/
1711 /* Get Attributes */
1712 /*--------------------------------------------------------------------------*/
1714 type = qs_get_type_attr(doc, node, r);
1715 name = qs_get_name_attr(doc, node, r);
1716 value = qs_get_value_attr(doc,node,r);
1717 istyle = qs_get_istyle_attr(doc,node,r);
1718 max_length = qs_get_maxlength_attr(doc,node,r);
1719 checked = qs_get_checked_attr(doc,node,r);
1720 accesskey = qs_get_accesskey_attr(doc, node, r);
1721 size = qs_get_size_attr(doc, node, r);
1724 chtml10->out = apr_pstrcat(r->pool,
1732 chtml10->out = apr_pstrcat(r->pool,
1740 chtml10->out = apr_pstrcat(r->pool,
1748 chtml10->out = apr_pstrcat(r->pool,
1756 chtml10->out = apr_pstrcat(r->pool,
1763 /*------------------------------------------------------------------------*/
1765 /*------------------------------------------------------------------------*/
1768 /*--------------------------------------------------------------------------*/
1769 /* The figure is default for the password. */
1770 /*--------------------------------------------------------------------------*/
1772 chtml10->out = apr_pstrcat(r->pool,
1780 chtml10->out = apr_pstrcat(r->pool,
1781 chtml10->out, " checked ", NULL);
1783 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1785 return chtml10->out;
1790 * It is a handler who processes the INPUT tag.
1792 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1793 * destination is specified.
1794 * @param node [i] The INPUT tag node is specified.
1795 * @return The conversion result is returned.
1798 s_chtml10_end_input_tag(void* pdoc, Node* child)
1800 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1802 return chtml10->out;
1807 * It is a handler who processes the CENTER tag.
1809 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1810 * destination is specified.
1811 * @param node [i] The CENTER tag node is specified.
1812 * @return The conversion result is returned.
1815 s_chtml10_start_center_tag(void* pdoc, Node* node)
1821 chtml10 = GET_CHTML10(pdoc);
1825 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1827 return chtml10->out;
1832 * It is a handler who processes the CENTER tag.
1834 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1835 * destination is specified.
1836 * @param node [i] The CENTER tag node is specified.
1837 * @return The conversion result is returned.
1840 s_chtml10_end_center_tag(void* pdoc, Node* child)
1846 chtml10 = GET_CHTML10(pdoc);
1850 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1852 return chtml10->out;
1857 * It is a handler who processes the HR tag.
1859 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1860 * destination is specified.
1861 * @param node [i] The HR tag node is specified.
1862 * @return The conversion result is returned.
1865 s_chtml10_start_hr_tag(void* pdoc, Node* node)
1872 chtml10 = GET_CHTML10(pdoc);
1876 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1878 for (attr = qs_get_attr(doc,node);
1880 attr = qs_get_next_attr(doc,attr)) {
1884 name = qs_get_attr_name (doc,attr);
1885 value = qs_get_attr_value(doc,attr);
1887 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
1888 /*----------------------------------------------------------------------*/
1890 /*----------------------------------------------------------------------*/
1891 chtml10->out = apr_pstrcat(r->pool,
1893 " align=\"", value, "\" ", NULL);
1896 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1897 /*----------------------------------------------------------------------*/
1899 /*----------------------------------------------------------------------*/
1900 chtml10->out = apr_pstrcat(r->pool,
1902 " size=\"", value, "\" ", NULL);
1905 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
1906 /*----------------------------------------------------------------------*/
1908 /*----------------------------------------------------------------------*/
1909 chtml10->out = apr_pstrcat(r->pool,
1911 " width=\"", value, "\" ", NULL);
1914 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
1915 /*----------------------------------------------------------------------*/
1917 /*----------------------------------------------------------------------*/
1918 chtml10->out = apr_pstrcat(r->pool,
1923 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1924 /*----------------------------------------------------------------------*/
1926 /*----------------------------------------------------------------------*/
1931 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1933 return chtml10->out;
1938 * It is a handler who processes the HR tag.
1940 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1941 * destination is specified.
1942 * @param node [i] The HR tag node is specified.
1943 * @return The conversion result is returned.
1946 s_chtml10_end_hr_tag(void* pdoc, Node* child)
1950 chtml10 = GET_CHTML10(pdoc);
1952 return chtml10->out;
1957 * It is a handler who processes the IMG tag.
1959 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1960 * destination is specified.
1961 * @param node [i] The IMG tag node is specified.
1962 * @return The conversion result is returned.
1965 s_chtml10_start_img_tag(void* pdoc, Node* node)
1971 #ifndef IMG_NOT_CONVERT_FILENAME
1972 device_table_t* spec;
1975 chtml10 = GET_CHTML10(pdoc);
1976 #ifndef IMG_NOT_CONVERT_FILENAME
1977 spec = chtml10->spec;
1982 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
1985 /*--------------------------------------------------------------------------*/
1986 /* Get Attributes */
1987 /*--------------------------------------------------------------------------*/
1988 for (attr = qs_get_attr(doc,node);
1990 attr = qs_get_next_attr(doc,attr)) {
1994 name = qs_get_attr_name (doc,attr);
1995 value = qs_get_attr_value(doc,attr);
1997 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
1998 /*----------------------------------------------------------------------*/
2000 /*----------------------------------------------------------------------*/
2001 #ifdef IMG_NOT_CONVERT_FILENAME
2002 chtml10->out = apr_pstrcat(r->pool,
2003 chtml10->out, " src=\"",value,"\"", NULL);
2005 chtml10->out = apr_pstrcat(r->pool,
2006 chtml10->out, " src=\"",
2007 chxj_img_conv(r, spec, value), NULL);
2008 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2012 if (*name == 'a' || *name == 'A') {
2013 if (strcasecmp(name, "align" ) == 0) {
2014 /*--------------------------------------------------------------------*/
2016 /*--------------------------------------------------------------------*/
2017 /*--------------------------------------------------------------------*/
2019 /*--------------------------------------------------------------------*/
2020 chtml10->out = apr_pstrcat(r->pool,
2021 chtml10->out, " align=\"",value,"\"", NULL);
2024 if (strcasecmp(name, "alt" ) == 0) {
2025 /*--------------------------------------------------------------------*/
2027 /*--------------------------------------------------------------------*/
2028 chtml10->out = apr_pstrcat(r->pool,
2029 chtml10->out, " alt=\"",value,"\"", NULL);
2033 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2034 /*----------------------------------------------------------------------*/
2036 /*----------------------------------------------------------------------*/
2037 chtml10->out = apr_pstrcat(r->pool,
2038 chtml10->out, " width=\"",value,"\"", NULL);
2041 if (*name == 'h' || *name == 'H') {
2042 if (strcasecmp(name, "height") == 0) {
2043 /*--------------------------------------------------------------------*/
2045 /*--------------------------------------------------------------------*/
2046 chtml10->out = apr_pstrcat(r->pool,
2047 chtml10->out, " height=\"",value,"\"", NULL);
2050 if (strcasecmp(name, "hspace") == 0) {
2051 /*--------------------------------------------------------------------*/
2053 /*--------------------------------------------------------------------*/
2054 chtml10->out = apr_pstrcat(r->pool,
2055 chtml10->out, " hspace=\"",value,"\"", NULL);
2059 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2060 /*----------------------------------------------------------------------*/
2062 /*----------------------------------------------------------------------*/
2063 chtml10->out = apr_pstrcat(r->pool,
2064 chtml10->out, " vspace=\"",value,"\"", NULL);
2068 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2070 return chtml10->out;
2075 * It is a handler who processes the IMG tag.
2077 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2078 * destination is specified.
2079 * @param node [i] The IMG tag node is specified.
2080 * @return The conversion result is returned.
2083 s_chtml10_end_img_tag(void* pdoc, Node* child)
2087 chtml10 = GET_CHTML10(pdoc);
2089 return chtml10->out;
2094 * It is a handler who processes the SELECT tag.
2096 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2097 * destination is specified.
2098 * @param node [i] The SELECT tag node is specified.
2099 * @return The conversion result is returned.
2102 s_chtml10_start_select_tag(void* pdoc, Node* child)
2112 chtml10 = GET_CHTML10(pdoc);
2119 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2120 for (attr = qs_get_attr(doc,child);
2122 attr = qs_get_next_attr(doc,attr)) {
2126 nm = qs_get_attr_name (doc,attr);
2127 val = qs_get_attr_value(doc,attr);
2129 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "size") == 0) {
2130 /*----------------------------------------------------------------------*/
2131 /* CHTML 1.0 version 2.0 */
2132 /*----------------------------------------------------------------------*/
2133 size = apr_pstrdup(r->pool, val);
2136 if ((*nm == 'n' || *nm == 'N') && strcasecmp(nm, "name") == 0) {
2137 /*----------------------------------------------------------------------*/
2138 /* CHTML 1.0 version 2.0 */
2139 /*----------------------------------------------------------------------*/
2140 name = apr_pstrdup(r->pool, val);
2143 if ((*nm == 'm' || *nm == 'M') && strcasecmp(nm, "multiple") == 0) {
2144 /*----------------------------------------------------------------------*/
2145 /* CHTML 1.0 version 2.0 */
2146 /*----------------------------------------------------------------------*/
2152 chtml10->out = apr_pstrcat(r->pool,
2160 chtml10->out = apr_pstrcat(r->pool,
2167 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2169 return chtml10->out;
2174 * It is a handler who processes the SELECT tag.
2176 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2177 * destination is specified.
2178 * @param node [i] The SELECT tag node is specified.
2179 * @return The conversion result is returned.
2182 s_chtml10_end_select_tag(void* pdoc, Node* child)
2188 chtml10 = GET_CHTML10(pdoc);
2192 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2194 return chtml10->out;
2199 * It is a handler who processes the OPTION tag.
2201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2202 * destination is specified.
2203 * @param node [i] The OPTION tag node is specified.
2204 * @return The conversion result is returned.
2207 s_chtml10_start_option_tag(void* pdoc, Node* child)
2217 chtml10 = GET_CHTML10(pdoc);
2224 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2225 for (attr = qs_get_attr(doc,child);
2227 attr = qs_get_next_attr(doc,attr)) {
2231 nm = qs_get_attr_name (doc,attr);
2232 val = qs_get_attr_value(doc,attr);
2234 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
2235 /*----------------------------------------------------------------------*/
2236 /* CHTML 1.0 version 2.0 */
2237 /*----------------------------------------------------------------------*/
2238 selected = apr_pstrdup(r->pool, val);
2241 if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
2242 /*----------------------------------------------------------------------*/
2243 /* CHTML 1.0 version 2.0 */
2244 /*----------------------------------------------------------------------*/
2245 value = apr_pstrdup(r->pool, val);
2250 chtml10->out = apr_pstrcat(r->pool,
2257 chtml10->out = apr_pstrcat(r->pool,
2263 chtml10->out = apr_pstrcat(r->pool,
2268 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2270 return chtml10->out;
2275 * It is a handler who processes the OPTION tag.
2277 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2278 * destination is specified.
2279 * @param node [i] The OPTION tag node is specified.
2280 * @return The conversion result is returned.
2283 s_chtml10_end_option_tag(void* pdoc, Node* child)
2287 chtml10 = GET_CHTML10(pdoc);
2291 return chtml10->out;
2296 * It is a handler who processes the DIV tag.
2298 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2299 * destination is specified.
2300 * @param node [i] The DIV tag node is specified.
2301 * @return The conversion result is returned.
2304 s_chtml10_start_div_tag(void* pdoc, Node* child)
2313 chtml10 = GET_CHTML10(pdoc);
2319 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2320 for (attr = qs_get_attr(doc,child);
2322 attr = qs_get_next_attr(doc,attr)) {
2326 nm = qs_get_attr_name(doc,attr);
2327 val = qs_get_attr_value(doc,attr);
2329 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2330 /*----------------------------------------------------------------------*/
2331 /* CHTML 1.0 (W3C version 3.2) */
2332 /*----------------------------------------------------------------------*/
2333 align = apr_pstrdup(r->pool, val);
2338 chtml10->out = apr_pstrcat(r->pool,
2339 chtml10->out, " align=\"", align, "\"", NULL);
2341 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2343 return chtml10->out;
2348 * It is a handler who processes the DIV tag.
2350 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2351 * destination is specified.
2352 * @param node [i] The DIV tag node is specified.
2353 * @return The conversion result is returned.
2356 s_chtml10_end_div_tag(void* pdoc, Node* child)
2362 chtml10 = GET_CHTML10(pdoc);
2366 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2368 return chtml10->out;
2373 * It is a handler who processes the CHXJ:IF tag.
2375 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2376 * destination is specified.
2377 * @param node [i] The CHXJ:IF tag node is specified.
2378 * @return The conversion result is returned.
2381 s_chtml10_chxjif_tag(void* pdoc, Node* node)
2388 chtml10 = GET_CHTML10(pdoc);
2392 for (child = qs_get_child_node(doc, node);
2394 child = qs_get_next_node(doc, child)) {
2395 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2396 s_chtml10_chxjif_tag(chtml10, child);
2399 return chtml10->out;
2404 * It is a handler who processes the PRE tag.
2406 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2407 * destination is specified.
2408 * @param node [i] The PRE tag node is specified.
2409 * @return The conversion result is returned.
2412 s_chtml10_start_pre_tag(void* pdoc, Node* node)
2418 chtml10 = GET_CHTML10(pdoc);
2422 chtml10->pre_flag++;
2423 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2425 return chtml10->out;
2430 * It is a handler who processes the PRE tag.
2432 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2433 * destination is specified.
2434 * @param node [i] The PRE tag node is specified.
2435 * @return The conversion result is returned.
2438 s_chtml10_end_pre_tag(void* pdoc, Node* child)
2444 chtml10 = GET_CHTML10(pdoc);
2448 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2449 chtml10->pre_flag--;
2451 return chtml10->out;
2456 * It is a handler who processes the P tag.
2458 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2459 * destination is specified.
2460 * @param node [i] The P tag node is specified.
2461 * @return The conversion result is returned.
2464 s_chtml10_start_p_tag(void* pdoc, Node* node)
2470 chtml10 = GET_CHTML10(pdoc);
2474 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2476 return chtml10->out;
2481 * It is a handler who processes the P tag.
2483 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2484 * destination is specified.
2485 * @param node [i] The P tag node is specified.
2486 * @return The conversion result is returned.
2489 s_chtml10_end_p_tag(void* pdoc, Node* child)
2495 chtml10 = GET_CHTML10(pdoc);
2499 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2501 return chtml10->out;
2506 * It is a handler who processes the TEXTARE tag.
2508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2509 * destination is specified.
2510 * @param node [i] The TEXTAREA tag node is specified.
2511 * @return The conversion result is returned.
2514 s_chtml10_start_textarea_tag(void* pdoc, Node* node)
2521 chtml10 = GET_CHTML10(pdoc);
2526 chtml10->textarea_flag++;
2527 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2529 for (attr = qs_get_attr(doc,node);
2531 attr = qs_get_next_attr(doc,attr)) {
2536 name = qs_get_attr_name (doc,attr);
2537 value = qs_get_attr_value(doc,attr);
2539 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2540 chtml10->out = apr_pstrcat(r->pool,
2548 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2549 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " rows=\"",value,"\"", NULL);
2552 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2553 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " cols=\"",value,"\"", NULL);
2557 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2559 return chtml10->out;
2563 * It is a handler who processes the TEXTAREA tag.
2565 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2566 * destination is specified.
2567 * @param node [i] The TEXTAREA tag node is specified.
2568 * @return The conversion result is returned.
2571 s_chtml10_end_textarea_tag(void* pdoc, Node* child)
2577 chtml10 = GET_CHTML10(pdoc);
2581 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2582 chtml10->textarea_flag--;
2584 return chtml10->out;
2589 s_chtml10_text(void* pdoc, Node* child)
2601 chtml10 = GET_CHTML10(pdoc);
2605 textval = qs_get_node_value(doc,child);
2606 textval = qs_trim_string(r, textval);
2607 if (strlen(textval) == 0)
2608 return chtml10->out;
2610 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2611 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2613 tdst = qs_alloc_zero_byte_string(r);
2614 memset(one_byte, 0, sizeof(one_byte));
2617 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2619 int rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2621 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2626 if (is_sjis_kanji(textval[ii])) {
2627 one_byte[0] = textval[ii+0];
2628 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2629 one_byte[0] = textval[ii+1];
2630 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2634 if (chtml10->pre_flag) {
2635 one_byte[0] = textval[ii+0];
2636 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2639 if (chtml10->textarea_flag) {
2640 one_byte[0] = textval[ii+0];
2641 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2644 if (textval[ii] != '\r' && textval[ii] != '\n') {
2645 one_byte[0] = textval[ii+0];
2646 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2649 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2651 return chtml10->out;