2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. 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_chtml20.h"
18 #include "chxj_hdml.h"
19 #include "chxj_str_util.h"
20 #include "chxj_dump.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_qr_code.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
27 #define GET_CHTML20(X) ((chtml20_t*)(X))
28 #define W20_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
29 #define W20_V(X) do { chtml20->out = (X) ? BUFFERED_WRITE_VALUE(chtml20->out, &doc->buf, (X)) \
30 : BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, ""); } while(0)
32 static char *s_chtml20_start_html_tag (void *pdoc, Node *node);
33 static char *s_chtml20_end_html_tag (void *pdoc, Node *node);
34 static char *s_chtml20_start_meta_tag (void *pdoc, Node *node);
35 static char *s_chtml20_end_meta_tag (void *pdoc, Node *node);
36 static char *s_chtml20_start_textarea_tag(void *pdoc, Node *node);
37 static char *s_chtml20_end_textarea_tag (void *pdoc, Node *node);
38 static char *s_chtml20_start_p_tag (void *pdoc, Node *node);
39 static char *s_chtml20_end_p_tag (void *pdoc, Node *node);
40 static char *s_chtml20_start_pre_tag (void *pdoc, Node *node);
41 static char *s_chtml20_end_pre_tag (void *pdoc, Node *node);
42 static char *s_chtml20_start_h1_tag (void *pdoc, Node *node);
43 static char *s_chtml20_end_h1_tag (void *pdoc, Node *node);
44 static char *s_chtml20_start_h2_tag (void *pdoc, Node *node);
45 static char *s_chtml20_end_h2_tag (void *pdoc, Node *node);
46 static char *s_chtml20_start_h3_tag (void *pdoc, Node *node);
47 static char *s_chtml20_end_h3_tag (void *pdoc, Node *node);
48 static char *s_chtml20_start_h4_tag (void *pdoc, Node *node);
49 static char *s_chtml20_end_h4_tag (void *pdoc, Node *node);
50 static char *s_chtml20_start_h5_tag (void *pdoc, Node *node);
51 static char *s_chtml20_end_h5_tag (void *pdoc, Node *node);
52 static char *s_chtml20_start_h6_tag (void *pdoc, Node *node);
53 static char *s_chtml20_end_h6_tag (void *pdoc, Node *node);
54 static char *s_chtml20_start_ul_tag (void *pdoc, Node *node);
55 static char *s_chtml20_end_ul_tag (void *pdoc, Node *node);
56 static char *s_chtml20_start_ol_tag (void *pdoc, Node *node);
57 static char *s_chtml20_end_ol_tag (void *pdoc, Node *node);
58 static char *s_chtml20_start_li_tag (void *pdoc, Node *node);
59 static char *s_chtml20_end_li_tag (void *pdoc, Node *node);
60 static char *s_chtml20_start_head_tag (void *pdoc, Node *node);
61 static char *s_chtml20_end_head_tag (void *pdoc, Node *node);
62 static char *s_chtml20_start_title_tag (void *pdoc, Node *node);
63 static char *s_chtml20_end_title_tag (void *pdoc, Node *node);
64 static char *s_chtml20_start_base_tag (void *pdoc, Node *node);
65 static char *s_chtml20_end_base_tag (void *pdoc, Node *node);
66 static char *s_chtml20_start_body_tag (void *pdoc, Node *node);
67 static char *s_chtml20_end_body_tag (void *pdoc, Node *node);
68 static char *s_chtml20_start_a_tag (void *pdoc, Node *node);
69 static char *s_chtml20_end_a_tag (void *pdoc, Node *node);
70 static char *s_chtml20_start_br_tag (void *pdoc, Node *node);
71 static char *s_chtml20_end_br_tag (void *pdoc, Node *node);
72 static char *s_chtml20_start_tr_tag (void *pdoc, Node *node);
73 static char *s_chtml20_end_tr_tag (void *pdoc, Node *node);
74 static char *s_chtml20_start_font_tag (void *pdoc, Node *node);
75 static char *s_chtml20_end_font_tag (void *pdoc, Node *node);
76 static char *s_chtml20_start_form_tag (void *pdoc, Node *node);
77 static char *s_chtml20_end_form_tag (void *pdoc, Node *node);
78 static char *s_chtml20_start_input_tag (void *pdoc, Node *node);
79 static char *s_chtml20_end_input_tag (void *pdoc, Node *node);
80 static char *s_chtml20_start_center_tag (void *pdoc, Node *node);
81 static char *s_chtml20_end_center_tag (void *pdoc, Node *node);
82 static char *s_chtml20_start_hr_tag (void *pdoc, Node *node);
83 static char *s_chtml20_end_hr_tag (void *pdoc, Node *node);
84 static char *s_chtml20_start_img_tag (void *pdoc, Node *node);
85 static char *s_chtml20_end_img_tag (void *pdoc, Node *node);
86 static char *s_chtml20_start_select_tag (void *pdoc, Node *node);
87 static char *s_chtml20_end_select_tag (void *pdoc, Node *node);
88 static char *s_chtml20_start_option_tag (void *pdoc, Node *node);
89 static char *s_chtml20_end_option_tag (void *pdoc, Node *node);
90 static char *s_chtml20_start_div_tag (void *pdoc, Node *node);
91 static char *s_chtml20_end_div_tag (void *pdoc, Node *node);
93 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
95 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
97 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
98 static char *s_chtml20_text_tag(void *pdoc, Node *node);
101 tag_handler chtml20_handler[] = {
104 s_chtml20_start_html_tag,
105 s_chtml20_end_html_tag,
109 s_chtml20_start_meta_tag,
110 s_chtml20_end_meta_tag,
114 s_chtml20_start_textarea_tag,
115 s_chtml20_end_textarea_tag,
119 s_chtml20_start_p_tag,
124 s_chtml20_start_pre_tag,
125 s_chtml20_end_pre_tag,
129 s_chtml20_start_ul_tag,
130 s_chtml20_end_ul_tag,
134 s_chtml20_start_li_tag,
135 s_chtml20_end_li_tag,
139 s_chtml20_start_ol_tag,
140 s_chtml20_end_ol_tag,
144 s_chtml20_start_h1_tag,
145 s_chtml20_end_h1_tag,
149 s_chtml20_start_h2_tag,
150 s_chtml20_end_h2_tag,
154 s_chtml20_start_h3_tag,
155 s_chtml20_end_h3_tag,
159 s_chtml20_start_h4_tag,
160 s_chtml20_end_h4_tag,
164 s_chtml20_start_h5_tag,
165 s_chtml20_end_h5_tag,
169 s_chtml20_start_h6_tag,
170 s_chtml20_end_h6_tag,
174 s_chtml20_start_head_tag,
175 s_chtml20_end_head_tag,
179 s_chtml20_start_title_tag,
180 s_chtml20_end_title_tag,
184 s_chtml20_start_base_tag,
185 s_chtml20_end_base_tag,
189 s_chtml20_start_body_tag,
190 s_chtml20_end_body_tag,
194 s_chtml20_start_a_tag,
199 s_chtml20_start_br_tag,
200 s_chtml20_end_br_tag,
209 s_chtml20_start_tr_tag,
210 s_chtml20_end_tr_tag,
224 s_chtml20_start_font_tag,
225 s_chtml20_end_font_tag,
229 s_chtml20_start_form_tag,
230 s_chtml20_end_form_tag,
234 s_chtml20_start_input_tag,
235 s_chtml20_end_input_tag,
239 s_chtml20_start_center_tag,
240 s_chtml20_end_center_tag,
244 s_chtml20_start_hr_tag,
245 s_chtml20_end_hr_tag,
249 s_chtml20_start_img_tag,
250 s_chtml20_end_img_tag,
254 s_chtml20_start_select_tag,
255 s_chtml20_end_select_tag,
259 s_chtml20_start_option_tag,
260 s_chtml20_end_option_tag,
264 s_chtml20_start_div_tag,
265 s_chtml20_end_div_tag,
269 s_chtml20_chxjif_tag,
330 * converts from CHTML5.0 to CHTML2.0.
332 * @param r [i] Requet_rec is appointed.
333 * @param spec [i] The result of the device specification processing which
334 * was done in advance is appointed.
335 * @param src [i] The character string before the converting is appointed.
336 * @return The character string after the converting is returned.
339 chxj_exchange_chtml20(
345 chxjconvrule_entry *entryp,
354 /*--------------------------------------------------------------------------*/
356 /*--------------------------------------------------------------------------*/
358 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
360 DBG(r,"i found qrcode xml");
363 DBG(r,"not found qrcode xml");
365 /*--------------------------------------------------------------------------*/
366 /* The CHTML structure is initialized. */
367 /*--------------------------------------------------------------------------*/
368 s_init_chtml20(&chtml20, &doc, r, spec);
371 chtml20.entryp = entryp;
372 chtml20.cookie = cookie;
374 ap_set_content_type(r, "text/html; charset=Windows-31J");
376 /*--------------------------------------------------------------------------*/
377 /* The character string of the input is analyzed. */
378 /*--------------------------------------------------------------------------*/
379 qs_init_malloc(&doc);
380 qs_init_root_node(&doc);
382 ss = apr_pcalloc(r->pool, srclen + 1);
383 memset(ss, 0, srclen + 1);
384 memcpy(ss, src, srclen);
387 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
390 qs_parse_string(&doc,ss, strlen(ss));
392 chxj_buffered_write_init(r->pool, &doc.buf);
393 /*--------------------------------------------------------------------------*/
394 /* It converts it from CHTML to CHTML. */
395 /*--------------------------------------------------------------------------*/
396 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
397 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
398 dst = apr_pstrdup(r->pool, chtml20.out);
399 chxj_buffered_write_terminate(&doc.buf);
401 qs_all_free(&doc,QX_LOGMARK);
404 return apr_pstrdup(r->pool,ss);
407 if (strlen(dst) == 0) {
408 dst = apr_psprintf(r->pool, "\n");
411 *dstlen = strlen(dst);
414 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
421 * The CHTML structure is initialized.
423 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
424 * initialized is specified.
425 * @param doc [i] The Doc structure that should be set to the initialized
426 * HDML structure is specified.
427 * @param r [i] To use POOL, the pointer to request_rec is specified.
428 * @param spec [i] The pointer to the device_table
431 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
433 memset(doc, 0, sizeof(Doc));
434 memset(chtml20, 0, sizeof(chtml20_t));
438 chtml20->spec = spec;
439 chtml20->out = qs_alloc_zero_byte_string(r);
440 chtml20->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
442 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
447 * Corresponding EMOJI to a current character-code is retrieved.
448 * The substitution character string is stored in the rslt pointer if agreeing.
450 * @param chtml20 [i] The pointer to the CHTML structure is specified.
451 * @param txt [i] The character string to want to examine whether it is
452 * EMOJI is specified.
453 * @param rslt [o] The pointer to the pointer that stores the result is
455 * @return When corresponding EMOJI exists, it returns it excluding 0.
458 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
465 spec = chtml20->spec;
471 DBG(r,"spec is NULL");
473 for (ee = chtml20->conf->emoji;
477 if (ee->imode == NULL) {
478 DBG(r,"emoji->imode is NULL");
482 if (ee->imode->string != NULL
483 && strlen(ee->imode->string) > 0
484 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
485 if (spec == NULL || spec->emoji_type == NULL) {
486 *rslt = apr_palloc(r->pool, 3);
487 (*rslt)[0] = ee->imode->hex1byte & 0xff;
488 (*rslt)[1] = ee->imode->hex2byte & 0xff;
490 return strlen(ee->imode->string);
502 * It is a handler who processes the HTML tag.
504 * @param pdoc [i/o] The pointer to the CHTML structure at the output
505 * destination is specified.
506 * @param node [i] The HTML tag node is specified.
507 * @return The conversion result is returned.
510 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
516 chtml20 = GET_CHTML20(pdoc);
520 /*--------------------------------------------------------------------------*/
522 /*--------------------------------------------------------------------------*/
529 * It is a handler who processes the HTML tag.
531 * @param pdoc [i/o] The pointer to the CHTML structure at the output
532 * destination is specified.
533 * @param node [i] The HTML tag node is specified.
534 * @return The conversion result is returned.
537 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
543 chtml20 = GET_CHTML20(pdoc);
553 * It is a handler who processes the META tag.
555 * @param pdoc [i/o] The pointer to the CHTML structure at the output
556 * destination is specified.
557 * @param node [i] The META tag node is specified.
558 * @return The conversion result is returned.
561 s_chtml20_start_meta_tag(void *pdoc, Node *node)
567 int content_type_flag;
570 chtml20 = GET_CHTML20(pdoc);
574 content_type_flag = 0;
578 /*--------------------------------------------------------------------------*/
580 /*--------------------------------------------------------------------------*/
581 for (attr = qs_get_attr(doc,node);
583 attr = qs_get_next_attr(doc,attr)) {
588 name = qs_get_attr_name(doc,attr);
589 value = qs_get_attr_value(doc,attr);
594 if (strcasecmp(name, "http-equiv") == 0) {
595 /*----------------------------------------------------------------------*/
597 /*----------------------------------------------------------------------*/
598 W20_L(" http-equiv=\"");
601 if (STRCASEEQ('c','C',"content-type", value)) {
602 content_type_flag = 1;
604 if (STRCASEEQ('r','R',"refresh", value)) {
612 if (strcasecmp(name, "content") == 0) {
613 if (content_type_flag) {
616 W20_L("=\"text/html; charset=Windows-31J\"");
618 else if (refresh_flag) {
619 char *buf = apr_pstrdup(r->pool, value);
623 url = strchr(buf, ';');
625 sec = apr_pstrdup(r->pool, buf);
628 url = chxj_encoding_parameter(r, url);
629 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
659 * It is a handler who processes the META tag.
661 * @param pdoc [i/o] The pointer to the CHTML structure at the output
662 * destination is specified.
663 * @param node [i] The META tag node is specified.
664 * @return The conversion result is returned.
667 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
671 chtml20 = GET_CHTML20(pdoc);
678 * It is a handler who processes the HEAD tag.
680 * @param pdoc [i/o] The pointer to the CHTML structure at the output
681 * destination is specified.
682 * @param node [i] The HEAD tag node is specified.
683 * @return The conversion result is returned.
686 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
692 chtml20 = GET_CHTML20(pdoc);
702 * It is a handler who processes the HEAD tag.
704 * @param pdoc [i/o] The pointer to the CHTML structure at the output
705 * destination is specified.
706 * @param node [i] The HEAD tag node is specified.
707 * @return The conversion result is returned.
710 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
716 chtml20 = GET_CHTML20(pdoc);
720 W20_L("</head>\r\n");
726 * It is a handler who processes the TITLE tag.
728 * @param pdoc [i/o] The pointer to the CHTML structure at the output
729 * destination is specified.
730 * @param node [i] The TITLE tag node is specified.
731 * @return The conversion result is returned.
734 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
740 chtml20 = GET_CHTML20(pdoc);
750 * It is a handler who processes the TITLE tag.
752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
753 * destination is specified.
754 * @param node [i] The TITLE tag node is specified.
755 * @return The conversion result is returned.
758 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
764 chtml20 = GET_CHTML20(pdoc);
768 W20_L("</title>\r\n");
774 * It is a handler who processes the BASE tag.
776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
777 * destination is specified.
778 * @param node [i] The BASE tag node is specified.
779 * @return The conversion result is returned.
782 s_chtml20_start_base_tag(void *pdoc, Node *node)
789 chtml20 = GET_CHTML20(pdoc);
794 /*--------------------------------------------------------------------------*/
796 /*--------------------------------------------------------------------------*/
797 for (attr = qs_get_attr(doc,node);
799 attr = qs_get_next_attr(doc,attr)) {
804 name = qs_get_attr_name(doc,attr);
805 value = qs_get_attr_value(doc,attr);
807 if (STRCASEEQ('h','H',"href", name)) {
819 * It is a handler who processes the BASE tag.
821 * @param pdoc [i/o] The pointer to the CHTML structure at the output
822 * destination is specified.
823 * @param node [i] The BASE tag node is specified.
824 * @return The conversion result is returned.
827 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
833 chtml20 = GET_CHTML20(pdoc);
842 * It is a handler who processes the BODY tag.
844 * @param pdoc [i/o] The pointer to the CHTML structure at the output
845 * destination is specified.
846 * @param node [i] The BODY tag node is specified.
847 * @return The conversion result is returned.
850 s_chtml20_start_body_tag(void *pdoc, Node *node)
857 chtml20 = GET_CHTML20(pdoc);
862 /*--------------------------------------------------------------------------*/
864 /*--------------------------------------------------------------------------*/
865 for (attr = qs_get_attr(doc,node);
867 attr = qs_get_next_attr(doc,attr)) {
871 name = qs_get_attr_name(doc,attr);
872 value = qs_get_attr_value(doc,attr);
877 if (strcasecmp(name, "bgcolor") == 0) {
878 /*----------------------------------------------------------------------*/
880 /*----------------------------------------------------------------------*/
881 W20_L(" bgcolor=\"");
889 if (strcasecmp(name, "text") == 0) {
890 /*----------------------------------------------------------------------*/
892 /*----------------------------------------------------------------------*/
901 if (strcasecmp(name, "link") == 0) {
902 /*----------------------------------------------------------------------*/
904 /*----------------------------------------------------------------------*/
913 if (strcasecmp(name, "alink") == 0) {
914 /*----------------------------------------------------------------------*/
916 /*----------------------------------------------------------------------*/
923 if (strcasecmp(name, "vlink") == 0) {
924 /*----------------------------------------------------------------------*/
926 /*----------------------------------------------------------------------*/
941 * It is a handler who processes the BODY tag.
943 * @param pdoc [i/o] The pointer to the CHTML structure at the output
944 * destination is specified.
945 * @param node [i] The BODY tag node is specified.
946 * @return The conversion result is returned.
949 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
955 chtml20 = GET_CHTML20(pdoc);
959 W20_L("</body>\r\n");
965 * It is a handler who processes the A tag.
967 * @param pdoc [i/o] The pointer to the CHTML structure at the output
968 * destination is specified.
969 * @param node [i] The A tag node is specified.
970 * @return The conversion result is returned.
973 s_chtml20_start_a_tag(void *pdoc, Node *node)
980 chtml20 = GET_CHTML20(pdoc);
985 /*--------------------------------------------------------------------------*/
987 /*--------------------------------------------------------------------------*/
988 for (attr = qs_get_attr(doc,node);
990 attr = qs_get_next_attr(doc,attr)) {
995 name = qs_get_attr_name(doc,attr);
996 value = qs_get_attr_value(doc,attr);
1001 if (strcasecmp(name, "name") == 0) {
1002 /*--------------------------------------------------------------------*/
1004 /*--------------------------------------------------------------------*/
1013 if (strcasecmp(name, "href") == 0) {
1014 /*--------------------------------------------------------------------*/
1016 /*--------------------------------------------------------------------*/
1017 value = chxj_encoding_parameter(r, value);
1018 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1027 if (strcasecmp(name, "accesskey") == 0) {
1028 /*--------------------------------------------------------------------*/
1030 /*--------------------------------------------------------------------*/
1031 W20_L(" accesskey=\"");
1039 if (strcasecmp(name, "cti") == 0) {
1040 /*--------------------------------------------------------------------*/
1042 /*--------------------------------------------------------------------*/
1051 if (strcasecmp(name, "ijam") == 0) {
1052 /*--------------------------------------------------------------------*/
1054 /*--------------------------------------------------------------------*/
1058 if (strcasecmp(name, "ista") == 0) {
1059 /*--------------------------------------------------------------------*/
1061 /*--------------------------------------------------------------------*/
1065 if (strcasecmp(name, "ilet") == 0) {
1066 /*--------------------------------------------------------------------*/
1068 /*--------------------------------------------------------------------*/
1072 if (strcasecmp(name, "iswf") == 0) {
1073 /*--------------------------------------------------------------------*/
1075 /*--------------------------------------------------------------------*/
1079 if (strcasecmp(name, "irst") == 0) {
1080 /*--------------------------------------------------------------------*/
1082 /*--------------------------------------------------------------------*/
1089 if (strcasecmp(name, "utn") == 0) {
1090 /*--------------------------------------------------------------------*/
1092 /*--------------------------------------------------------------------*/
1099 if (strcasecmp(name, "telbook") == 0) {
1100 /*--------------------------------------------------------------------*/
1102 /*--------------------------------------------------------------------*/
1109 if (strcasecmp(name, "kana") == 0) {
1110 /*--------------------------------------------------------------------*/
1112 /*--------------------------------------------------------------------*/
1119 if (strcasecmp(name, "email") == 0) {
1120 /*--------------------------------------------------------------------*/
1122 /*--------------------------------------------------------------------*/
1132 return chtml20->out;
1137 * It is a handler who processes the A tag.
1139 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1140 * destination is specified.
1141 * @param node [i] The A tag node is specified.
1142 * @return The conversion result is returned.
1145 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1151 chtml20 = GET_CHTML20(pdoc);
1156 return chtml20->out;
1161 * It is a handler who processes the BR tag.
1163 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1164 * destination is specified.
1165 * @param node [i] The BR tag node is specified.
1166 * @return The conversion result is returned.
1169 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1175 chtml20 = GET_CHTML20(pdoc);
1180 return chtml20->out;
1185 * It is a handler who processes the BR tag.
1187 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1188 * destination is specified.
1189 * @param node [i] The BR tag node is specified.
1190 * @return The conversion result is returned.
1193 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1199 chtml20 = GET_CHTML20(pdoc);
1203 return chtml20->out;
1208 * It is a handler who processes the TR tag.
1210 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1211 * destination is specified.
1212 * @param node [i] The TR tag node is specified.
1213 * @return The conversion result is returned.
1216 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1222 chtml20 = GET_CHTML20(pdoc);
1226 return chtml20->out;
1231 * It is a handler who processes the TR tag.
1233 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1234 * destination is specified.
1235 * @param node [i] The TR tag node is specified.
1236 * @return The conversion result is returned.
1239 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1245 chtml20 = GET_CHTML20(pdoc);
1250 return chtml20->out;
1255 * It is a handler who processes the FONT tag.
1257 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1258 * destination is specified.
1259 * @param node [i] The FONT tag node is specified.
1260 * @return The conversion result is returned.
1263 s_chtml20_start_font_tag(void *pdoc, Node *node)
1270 chtml20 = GET_CHTML20(pdoc);
1276 /*--------------------------------------------------------------------------*/
1277 /* Get Attributes */
1278 /*--------------------------------------------------------------------------*/
1279 for (attr = qs_get_attr(doc,node);
1281 attr = qs_get_next_attr(doc,attr)) {
1286 name = qs_get_attr_name(doc,attr);
1287 value = qs_get_attr_value(doc,attr);
1292 if (strcasecmp(name, "color") == 0) {
1301 if (strcasecmp(name, "size") == 0) {
1302 /*--------------------------------------------------------------------*/
1304 /*--------------------------------------------------------------------*/
1314 return chtml20->out;
1319 * It is a handler who processes the FONT tag.
1321 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1322 * destination is specified.
1323 * @param node [i] The FONT tag node is specified.
1324 * @return The conversion result is returned.
1327 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1333 chtml20 = GET_CHTML20(pdoc);
1338 return chtml20->out;
1343 * It is a handler who processes the FORM tag.
1345 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1346 * destination is specified.
1347 * @param node [i] The FORM tag node is specified.
1348 * @return The conversion result is returned.
1351 s_chtml20_start_form_tag(void *pdoc, Node *node)
1358 chtml20 = GET_CHTML20(pdoc);
1363 /*--------------------------------------------------------------------------*/
1364 /* Get Attributes */
1365 /*--------------------------------------------------------------------------*/
1366 for (attr = qs_get_attr(doc,node);
1368 attr = qs_get_next_attr(doc,attr)) {
1373 name = qs_get_attr_name(doc,attr);
1374 value = qs_get_attr_value(doc,attr);
1379 if (strcasecmp(name, "action") == 0) {
1380 /*--------------------------------------------------------------------*/
1382 /*--------------------------------------------------------------------*/
1383 value = chxj_encoding_parameter(r, value);
1384 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1386 W20_L(" action=\"");
1394 if (strcasecmp(name, "method") == 0) {
1395 /*--------------------------------------------------------------------*/
1397 /*--------------------------------------------------------------------*/
1398 W20_L(" method=\"");
1406 if (strcasecmp(name, "utn") == 0) {
1407 /*--------------------------------------------------------------------*/
1409 /*--------------------------------------------------------------------*/
1419 return chtml20->out;
1424 * It is a handler who processes the FORM tag.
1426 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1427 * destination is specified.
1428 * @param node [i] The FORM tag node is specified.
1429 * @return The conversion result is returned.
1432 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1438 chtml20 = GET_CHTML20(pdoc);
1443 return chtml20->out;
1448 * It is a handler who processes the INPUT tag.
1450 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1451 * destination is specified.
1452 * @param node [i] The INPUT tag node is specified.
1453 * @return The conversion result is returned.
1456 s_chtml20_start_input_tag(void *pdoc, Node *node)
1461 char *max_length = NULL;
1465 char *istyle = NULL;
1467 char *checked = NULL;
1468 char *accesskey = NULL;
1470 chtml20 = GET_CHTML20(pdoc);
1476 /*--------------------------------------------------------------------------*/
1477 /* Get Attributes */
1478 /*--------------------------------------------------------------------------*/
1480 type = qs_get_type_attr(doc, node, r);
1481 name = qs_get_name_attr(doc, node, r);
1482 value = qs_get_value_attr(doc,node,r);
1483 istyle = qs_get_istyle_attr(doc,node,r);
1484 max_length = qs_get_maxlength_attr(doc,node,r);
1485 checked = qs_get_checked_attr(doc,node,r);
1486 accesskey = qs_get_accesskey_attr(doc, node, r);
1487 size = qs_get_size_attr(doc, node, r);
1514 W20_L(" accesskey=\"");
1520 /*------------------------------------------------------------------------*/
1522 /*------------------------------------------------------------------------*/
1523 W20_L(" istyle=\"");
1528 /*--------------------------------------------------------------------------*/
1529 /* The figure is default for the password. */
1530 /*--------------------------------------------------------------------------*/
1532 if (chxj_chk_numeric(max_length) != 0)
1533 max_length = apr_psprintf(doc->buf.pool, "0");
1534 if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
1535 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1539 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1548 return chtml20->out;
1553 * It is a handler who processes the INPUT tag.
1555 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1556 * destination is specified.
1557 * @param node [i] The INPUT tag node is specified.
1558 * @return The conversion result is returned.
1561 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1567 chtml20 = GET_CHTML20(pdoc);
1571 return chtml20->out;
1576 * It is a handler who processes the CENTER tag.
1578 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1579 * destination is specified.
1580 * @param node [i] The CENTER tag node is specified.
1581 * @return The conversion result is returned.
1584 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1590 chtml20 = GET_CHTML20(pdoc);
1595 return chtml20->out;
1600 * It is a handler who processes the CENTER tag.
1602 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1603 * destination is specified.
1604 * @param node [i] The CENTER tag node is specified.
1605 * @return The conversion result is returned.
1608 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1614 chtml20 = GET_CHTML20(pdoc);
1619 return chtml20->out;
1624 * It is a handler who processes the UL tag.
1626 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1627 * destination is specified.
1628 * @param node [i] The UL tag node is specified.
1629 * @return The conversion result is returned.
1632 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1638 chtml20 = GET_CHTML20(pdoc);
1643 return chtml20->out;
1648 * It is a handler who processes the UL tag.
1650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1651 * destination is specified.
1652 * @param node [i] The UL tag node is specified.
1653 * @return The conversion result is returned.
1656 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1662 chtml20 = GET_CHTML20(pdoc);
1667 return chtml20->out;
1672 * It is a handler who processes the OL tag.
1674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1675 * destination is specified.
1676 * @param node [i] The OL tag node is specified.
1677 * @return The conversion result is returned.
1680 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1686 chtml20 = GET_CHTML20(pdoc);
1691 return chtml20->out;
1696 * It is a handler who processes the OL tag.
1698 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1699 * destination is specified.
1700 * @param node [i] The OL tag node is specified.
1701 * @return The conversion result is returned.
1704 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1710 chtml20 = GET_CHTML20(pdoc);
1715 return chtml20->out;
1720 * It is a handler who processes the LI tag.
1722 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1723 * destination is specified.
1724 * @param node [i] The LI tag node is specified.
1725 * @return The conversion result is returned.
1728 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1734 chtml20 = GET_CHTML20(pdoc);
1739 return chtml20->out;
1744 * It is a handler who processes the LI tag.
1746 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1747 * destination is specified.
1748 * @param node [i] The LI tag node is specified.
1749 * @return The conversion result is returned.
1752 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1758 chtml20 = GET_CHTML20(pdoc);
1763 return chtml20->out;
1768 * It is a handler who processes the HR tag.
1770 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1771 * destination is specified.
1772 * @param node [i] The HR tag node is specified.
1773 * @return The conversion result is returned.
1776 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1783 chtml20 = GET_CHTML20(pdoc);
1789 for (attr = qs_get_attr(doc,node);
1791 attr = qs_get_next_attr(doc,attr)) {
1796 name = qs_get_attr_name(doc,attr);
1797 value = qs_get_attr_value(doc,attr);
1802 if (strcasecmp(name, "align") == 0) {
1803 /*--------------------------------------------------------------------*/
1805 /*--------------------------------------------------------------------*/
1814 if (strcasecmp(name, "size") == 0) {
1815 /*--------------------------------------------------------------------*/
1817 /*--------------------------------------------------------------------*/
1826 if (strcasecmp(name, "width") == 0) {
1827 /*--------------------------------------------------------------------*/
1829 /*--------------------------------------------------------------------*/
1838 if (strcasecmp(name, "noshade") == 0) {
1839 /*--------------------------------------------------------------------*/
1841 /*--------------------------------------------------------------------*/
1848 if (strcasecmp(name, "color") == 0) {
1849 /*--------------------------------------------------------------------*/
1851 /*--------------------------------------------------------------------*/
1861 return chtml20->out;
1866 * It is a handler who processes the HR tag.
1868 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1869 * destination is specified.
1870 * @param node [i] The HR tag node is specified.
1871 * @return The conversion result is returned.
1874 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1880 chtml20 = GET_CHTML20(pdoc);
1884 return chtml20->out;
1889 * It is a handler who processes the IMG tag.
1891 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1892 * destination is specified.
1893 * @param node [i] The IMG tag node is specified.
1894 * @return The conversion result is returned.
1897 s_chtml20_start_img_tag(void *pdoc, Node *node)
1903 #ifndef IMG_NOT_CONVERT_FILENAME
1907 chtml20 = GET_CHTML20(pdoc);
1911 #ifndef IMG_NOT_CONVERT_FILENAME
1912 spec = chtml20->spec;
1916 /*-------------------------------------------------------------------------*/
1917 /* Get Attributes */
1918 /*-------------------------------------------------------------------------*/
1919 for (attr = qs_get_attr(doc,node);
1921 attr = qs_get_next_attr(doc,attr)) {
1926 name = qs_get_attr_name(doc,attr);
1927 value = qs_get_attr_value(doc,attr);
1932 if (strcasecmp(name, "src") == 0) {
1933 /*-------------------------------------------------------------------*/
1935 /*-------------------------------------------------------------------*/
1936 #ifdef IMG_NOT_CONVERT_FILENAME
1937 value = chxj_encoding_parameter(r, value);
1938 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1940 value = apr_psprintf(doc->buf.pool,
1943 (strchr(value, '?')) ? '&' : '?',
1944 CHXJ_COOKIE_NOUPDATE_PARAM);
1950 value = chxj_img_conv(r, spec, value);
1951 value = chxj_encoding_parameter(r, value);
1952 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1954 value = apr_psprintf(doc->buf.pool,
1957 (strchr(value, '?')) ? '&' : '?',
1958 CHXJ_COOKIE_NOUPDATE_PARAM);
1969 if (strcasecmp(name, "align" ) == 0) {
1970 /*--------------------------------------------------------------------*/
1972 /*--------------------------------------------------------------------*/
1978 if (strcasecmp(name, "alt" ) == 0) {
1979 /*--------------------------------------------------------------------*/
1981 /*--------------------------------------------------------------------*/
1987 if (strcasecmp(name, "align" ) == 0) {
1988 /*--------------------------------------------------------------------*/
1990 /*--------------------------------------------------------------------*/
1997 if (strcasecmp(name, "width" ) == 0) {
1998 /*--------------------------------------------------------------------*/
2000 /*--------------------------------------------------------------------*/
2009 if (strcasecmp(name, "height") == 0) {
2010 /*--------------------------------------------------------------------*/
2012 /*--------------------------------------------------------------------*/
2013 W20_L(" height=\"");
2018 if (strcasecmp(name, "hspace") == 0) {
2019 /*--------------------------------------------------------------------*/
2021 /*--------------------------------------------------------------------*/
2022 W20_L(" hspace=\"");
2030 if (strcasecmp(name, "vspace") == 0) {
2031 /*--------------------------------------------------------------------*/
2033 /*--------------------------------------------------------------------*/
2034 W20_L(" vspace=\"");
2045 return chtml20->out;
2050 * It is a handler who processes the IMG tag.
2052 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2053 * destination is specified.
2054 * @param node [i] The IMG tag node is specified.
2055 * @return The conversion result is returned.
2058 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2064 chtml20 = GET_CHTML20(pdoc);
2068 return chtml20->out;
2073 * It is a handler who processes the SELECT tag.
2075 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2076 * destination is specified.
2077 * @param node [i] The SELECT tag node is specified.
2078 * @return The conversion result is returned.
2081 s_chtml20_start_select_tag(void *pdoc, Node *child)
2088 chtml20 = GET_CHTML20(pdoc);
2096 for (attr = qs_get_attr(doc,child);
2098 attr = qs_get_next_attr(doc,attr)) {
2103 nm = qs_get_attr_name(doc,attr);
2104 val = qs_get_attr_value(doc,attr);
2109 if (strcasecmp(nm, "size") == 0) {
2110 /*--------------------------------------------------------------------*/
2111 /* CHTML 1.0 version 2.0 */
2112 /*--------------------------------------------------------------------*/
2113 size = apr_pstrdup(doc->buf.pool, val);
2119 if (strcasecmp(nm, "name") == 0) {
2120 /*--------------------------------------------------------------------*/
2121 /* CHTML 1.0 version 2.0 */
2122 /*--------------------------------------------------------------------*/
2123 name = apr_pstrdup(doc->buf.pool, val);
2129 if (strcasecmp(nm, "multiple") == 0) {
2130 /*--------------------------------------------------------------------*/
2131 /* CHTML 1.0 version 2.0 */
2132 /*--------------------------------------------------------------------*/
2155 return chtml20->out;
2160 * It is a handler who processes the SELECT tag.
2162 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2163 * destination is specified.
2164 * @param node [i] The SELECT tag node is specified.
2165 * @return The conversion result is returned.
2168 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2174 chtml20 = GET_CHTML20(pdoc);
2178 W20_L("</select>\r\n");
2179 return chtml20->out;
2184 * It is a handler who processes the OPTION tag.
2186 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2187 * destination is specified.
2188 * @param node [i] The OPTION tag node is specified.
2189 * @return The conversion result is returned.
2192 s_chtml20_start_option_tag(void *pdoc, Node *child)
2199 chtml20 = GET_CHTML20(pdoc);
2203 char *selected = NULL;
2207 for (attr = qs_get_attr(doc,child);
2209 attr = qs_get_next_attr(doc,attr)) {
2214 nm = qs_get_attr_name(doc,attr);
2215 val = qs_get_attr_value(doc,attr);
2220 if (strcasecmp(nm, "selected") == 0) {
2221 /*--------------------------------------------------------------------*/
2222 /* CHTML 1.0 version 2.0 */
2223 /*--------------------------------------------------------------------*/
2224 selected = apr_pstrdup(doc->buf.pool, val);
2230 if (strcasecmp(nm, "value") == 0) {
2231 /*--------------------------------------------------------------------*/
2232 /* CHTML 1.0 version 2.0 */
2233 /*--------------------------------------------------------------------*/
2234 value = apr_pstrdup(doc->buf.pool, val);
2249 W20_L(" value=\"\"");
2253 W20_L(" selected ");
2256 return chtml20->out;
2261 * It is a handler who processes the OPTION tag.
2263 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2264 * destination is specified.
2265 * @param node [i] The OPTION tag node is specified.
2266 * @return The conversion result is returned.
2269 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2275 chtml20 = GET_CHTML20(pdoc);
2281 return chtml20->out;
2286 * It is a handler who processes the DIV tag.
2288 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2289 * destination is specified.
2290 * @param node [i] The DIV tag node is specified.
2291 * @return The conversion result is returned.
2294 s_chtml20_start_div_tag(void *pdoc, Node *child)
2301 chtml20 = GET_CHTML20(pdoc);
2309 for (attr = qs_get_attr(doc,child);
2311 attr = qs_get_next_attr(doc,attr)) {
2316 nm = qs_get_attr_name(doc,attr);
2317 val = qs_get_attr_value(doc,attr);
2319 if (STRCASEEQ('a','A', "align", nm)) {
2320 /*----------------------------------------------------------------------*/
2321 /* CHTML 1.0 (W3C version 3.2) */
2322 /*----------------------------------------------------------------------*/
2323 align = apr_pstrdup(doc->buf.pool, val);
2334 return chtml20->out;
2339 * It is a handler who processes the DIV tag.
2341 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2342 * destination is specified.
2343 * @param node [i] The DIV tag node is specified.
2344 * @return The conversion result is returned.
2347 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2353 chtml20 = GET_CHTML20(pdoc);
2357 W20_L("</div>\r\n");
2358 return chtml20->out;
2363 * It is a handler who processes the H1 tag.
2365 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2366 * destination is specified.
2367 * @param node [i] The H1 tag node is specified.
2368 * @return The conversion result is returned.
2371 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2377 chtml20 = GET_CHTML20(pdoc);
2382 return chtml20->out;
2387 * It is a handler who processes the H1 tag.
2389 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2390 * destination is specified.
2391 * @param node [i] The H1 tag node is specified.
2392 * @return The conversion result is returned.
2395 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2401 chtml20 = GET_CHTML20(pdoc);
2406 return chtml20->out;
2411 * It is a handler who processes the H2 tag.
2413 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2414 * destination is specified.
2415 * @param node [i] The H2 tag node is specified.
2416 * @return The conversion result is returned.
2419 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2425 chtml20 = GET_CHTML20(pdoc);
2430 return chtml20->out;
2435 * It is a handler who processes the H2 tag.
2437 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2438 * destination is specified.
2439 * @param node [i] The H2 tag node is specified.
2440 * @return The conversion result is returned.
2443 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2449 chtml20 = GET_CHTML20(pdoc);
2454 return chtml20->out;
2459 * It is a handler who processes the H3 tag.
2461 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2462 * destination is specified.
2463 * @param node [i] The H3 tag node is specified.
2464 * @return The conversion result is returned.
2467 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2473 chtml20 = GET_CHTML20(pdoc);
2478 return chtml20->out;
2483 * It is a handler who processes the H3 tag.
2485 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2486 * destination is specified.
2487 * @param node [i] The H3 tag node is specified.
2488 * @return The conversion result is returned.
2491 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2497 chtml20 = GET_CHTML20(pdoc);
2502 return chtml20->out;
2507 * It is a handler who processes the H4 tag.
2509 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2510 * destination is specified.
2511 * @param node [i] The H4 tag node is specified.
2512 * @return The conversion result is returned.
2515 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2521 chtml20 = GET_CHTML20(pdoc);
2526 return chtml20->out;
2531 * It is a handler who processes the H4 tag.
2533 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2534 * destination is specified.
2535 * @param node [i] The H4 tag node is specified.
2536 * @return The conversion result is returned.
2539 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2545 chtml20 = GET_CHTML20(pdoc);
2550 return chtml20->out;
2555 * It is a handler who processes the H5 tag.
2557 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2558 * destination is specified.
2559 * @param node [i] The H5 tag node is specified.
2560 * @return The conversion result is returned.
2563 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2569 chtml20 = GET_CHTML20(pdoc);
2574 return chtml20->out;
2579 * It is a handler who processes the H5 tag.
2581 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2582 * destination is specified.
2583 * @param node [i] The H5 tag node is specified.
2584 * @return The conversion result is returned.
2587 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2593 chtml20 = GET_CHTML20(pdoc);
2598 return chtml20->out;
2603 * It is a handler who processes the H6 tag.
2605 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2606 * destination is specified.
2607 * @param node [i] The H6 tag node is specified.
2608 * @return The conversion result is returned.
2611 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2617 chtml20 = GET_CHTML20(pdoc);
2622 return chtml20->out;
2627 * It is a handler who processes the H6 tag.
2629 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2630 * destination is specified.
2631 * @param node [i] The H6 tag node is specified.
2632 * @return The conversion result is returned.
2635 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2641 chtml20 = GET_CHTML20(pdoc);
2646 return chtml20->out;
2651 * It is a handler who processes the PRE tag.
2653 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2654 * destination is specified.
2655 * @param node [i] The PRE tag node is specified.
2656 * @return The conversion result is returned.
2659 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2665 chtml20 = GET_CHTML20(pdoc);
2669 chtml20->pre_flag++;
2671 return chtml20->out;
2676 * It is a handler who processes the PRE tag.
2678 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2679 * destination is specified.
2680 * @param node [i] The PRE tag node is specified.
2681 * @return The conversion result is returned.
2684 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2690 chtml20 = GET_CHTML20(pdoc);
2695 chtml20->pre_flag--;
2697 return chtml20->out;
2702 * It is a handler who processes the P tag.
2704 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2705 * destination is specified.
2706 * @param node [i] The P tag node is specified.
2707 * @return The conversion result is returned.
2710 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2716 chtml20 = GET_CHTML20(pdoc);
2721 return chtml20->out;
2726 * It is a handler who processes the P tag.
2728 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2729 * destination is specified.
2730 * @param node [i] The P tag node is specified.
2731 * @return The conversion result is returned.
2734 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2740 chtml20 = GET_CHTML20(pdoc);
2745 return chtml20->out;
2750 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2757 chtml20 = GET_CHTML20(pdoc);
2761 for (child = qs_get_child_node(doc, node);
2763 child = qs_get_next_node(doc, child)) {
2765 W20_V(child->otext);
2766 s_chtml20_chxjif_tag(pdoc, child);
2774 * It is a handler who processes the TEXTARE tag.
2776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2777 * destination is specified.
2778 * @param node [i] The TEXTAREA tag node is specified.
2779 * @return The conversion result is returned.
2782 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2789 chtml20 = GET_CHTML20(pdoc);
2793 chtml20->textarea_flag++;
2794 W20_L("<textarea ");
2795 for (attr = qs_get_attr(doc,node);
2797 attr = qs_get_next_attr(doc,attr)) {
2802 name = qs_get_attr_name(doc,attr);
2803 value = qs_get_attr_value(doc,attr);
2808 if (strcasecmp(name, "name") == 0) {
2817 if (strcasecmp(name, "rows") == 0) {
2826 if (strcasecmp(name, "cols") == 0) {
2838 return chtml20->out;
2843 * It is a handler who processes the TEXTAREA tag.
2845 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2846 * destination is specified.
2847 * @param node [i] The TEXTAREA tag node is specified.
2848 * @return The conversion result is returned.
2851 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2857 chtml20 = GET_CHTML20(pdoc);
2861 W20_L("</textarea>\r\n");
2862 chtml20->textarea_flag--;
2864 return chtml20->out;
2869 s_chtml20_text_tag(void *pdoc, Node *child)
2881 chtml20 = GET_CHTML20(pdoc);
2885 textval = qs_get_node_value(doc,child);
2886 textval = qs_trim_string(chtml20->doc->r, textval);
2887 if (strlen(textval) == 0)
2888 return chtml20->out;
2890 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2891 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2893 tdst = qs_alloc_zero_byte_string(r);
2894 memset(one_byte, 0, sizeof(one_byte));
2897 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2899 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
2901 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2905 if (is_sjis_kanji(textval[ii])) {
2906 one_byte[0] = textval[ii+0];
2907 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2908 one_byte[0] = textval[ii+1];
2909 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2913 if (chtml20->pre_flag) {
2914 one_byte[0] = textval[ii+0];
2915 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2918 if (chtml20->textarea_flag) {
2919 one_byte[0] = textval[ii+0];
2920 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2923 if (textval[ii] != '\r' && textval[ii] != '\n') {
2924 one_byte[0] = textval[ii+0];
2925 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2929 return chtml20->out;