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);
92 static char *s_chtml20_start_blockquote_tag(void *pdoc, Node *node);
93 static char *s_chtml20_end_blockquote_tag (void *pdoc, Node *node);
94 static char *s_chtml20_start_dir_tag (void *pdoc, Node *node);
95 static char *s_chtml20_end_dir_tag (void *pdoc, Node *node);
96 static char *s_chtml20_start_dl_tag (void *pdoc, Node *node);
97 static char *s_chtml20_end_dl_tag (void *pdoc, Node *node);
98 static char *s_chtml20_start_dt_tag (void *pdoc, Node *node);
99 static char *s_chtml20_end_dt_tag (void *pdoc, Node *node);
100 static char *s_chtml20_start_dd_tag (void *pdoc, Node *node);
101 static char *s_chtml20_end_dd_tag (void *pdoc, Node *node);
103 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
105 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
107 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
108 static char *s_chtml20_text_tag(void *pdoc, Node *node);
111 tag_handler chtml20_handler[] = {
114 s_chtml20_start_html_tag,
115 s_chtml20_end_html_tag,
119 s_chtml20_start_meta_tag,
120 s_chtml20_end_meta_tag,
124 s_chtml20_start_textarea_tag,
125 s_chtml20_end_textarea_tag,
129 s_chtml20_start_p_tag,
134 s_chtml20_start_pre_tag,
135 s_chtml20_end_pre_tag,
139 s_chtml20_start_ul_tag,
140 s_chtml20_end_ul_tag,
144 s_chtml20_start_li_tag,
145 s_chtml20_end_li_tag,
149 s_chtml20_start_ol_tag,
150 s_chtml20_end_ol_tag,
154 s_chtml20_start_h1_tag,
155 s_chtml20_end_h1_tag,
159 s_chtml20_start_h2_tag,
160 s_chtml20_end_h2_tag,
164 s_chtml20_start_h3_tag,
165 s_chtml20_end_h3_tag,
169 s_chtml20_start_h4_tag,
170 s_chtml20_end_h4_tag,
174 s_chtml20_start_h5_tag,
175 s_chtml20_end_h5_tag,
179 s_chtml20_start_h6_tag,
180 s_chtml20_end_h6_tag,
184 s_chtml20_start_head_tag,
185 s_chtml20_end_head_tag,
189 s_chtml20_start_title_tag,
190 s_chtml20_end_title_tag,
194 s_chtml20_start_base_tag,
195 s_chtml20_end_base_tag,
199 s_chtml20_start_body_tag,
200 s_chtml20_end_body_tag,
204 s_chtml20_start_a_tag,
209 s_chtml20_start_br_tag,
210 s_chtml20_end_br_tag,
219 s_chtml20_start_tr_tag,
220 s_chtml20_end_tr_tag,
234 s_chtml20_start_font_tag,
235 s_chtml20_end_font_tag,
239 s_chtml20_start_form_tag,
240 s_chtml20_end_form_tag,
244 s_chtml20_start_input_tag,
245 s_chtml20_end_input_tag,
249 s_chtml20_start_center_tag,
250 s_chtml20_end_center_tag,
254 s_chtml20_start_hr_tag,
255 s_chtml20_end_hr_tag,
259 s_chtml20_start_img_tag,
260 s_chtml20_end_img_tag,
264 s_chtml20_start_select_tag,
265 s_chtml20_end_select_tag,
269 s_chtml20_start_option_tag,
270 s_chtml20_end_option_tag,
274 s_chtml20_start_div_tag,
275 s_chtml20_end_div_tag,
279 s_chtml20_chxjif_tag,
324 s_chtml20_start_dt_tag,
325 s_chtml20_end_dt_tag,
339 s_chtml20_start_blockquote_tag,
340 s_chtml20_end_blockquote_tag,
344 s_chtml20_start_dir_tag,
345 s_chtml20_end_dir_tag,
349 s_chtml20_start_dl_tag,
350 s_chtml20_end_dl_tag,
354 s_chtml20_start_dd_tag,
355 s_chtml20_end_dd_tag,
370 * converts from CHTML5.0 to CHTML2.0.
372 * @param r [i] Requet_rec is appointed.
373 * @param spec [i] The result of the device specification processing which
374 * was done in advance is appointed.
375 * @param src [i] The character string before the converting is appointed.
376 * @return The character string after the converting is returned.
379 chxj_exchange_chtml20(
385 chxjconvrule_entry *entryp,
394 /*--------------------------------------------------------------------------*/
396 /*--------------------------------------------------------------------------*/
398 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
400 DBG(r,"i found qrcode xml");
403 DBG(r,"not found qrcode xml");
405 /*--------------------------------------------------------------------------*/
406 /* The CHTML structure is initialized. */
407 /*--------------------------------------------------------------------------*/
408 s_init_chtml20(&chtml20, &doc, r, spec);
411 chtml20.entryp = entryp;
412 chtml20.cookie = cookie;
414 chxj_set_content_type(r, "text/html; charset=Windows-31J");
416 /*--------------------------------------------------------------------------*/
417 /* The character string of the input is analyzed. */
418 /*--------------------------------------------------------------------------*/
419 qs_init_malloc(&doc);
420 qs_init_root_node(&doc);
422 ss = apr_pcalloc(r->pool, srclen + 1);
423 memset(ss, 0, srclen + 1);
424 memcpy(ss, src, srclen);
427 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
430 qs_parse_string(&doc,ss, strlen(ss));
432 chxj_buffered_write_init(r->pool, &doc.buf);
433 /*--------------------------------------------------------------------------*/
434 /* It converts it from CHTML to CHTML. */
435 /*--------------------------------------------------------------------------*/
436 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
437 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
438 dst = apr_pstrdup(r->pool, chtml20.out);
439 chxj_buffered_write_terminate(&doc.buf);
441 qs_all_free(&doc,QX_LOGMARK);
444 return apr_pstrdup(r->pool,ss);
447 if (strlen(dst) == 0) {
448 dst = apr_psprintf(r->pool, "\n");
451 *dstlen = strlen(dst);
454 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
461 * The CHTML structure is initialized.
463 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
464 * initialized is specified.
465 * @param doc [i] The Doc structure that should be set to the initialized
466 * HDML structure is specified.
467 * @param r [i] To use POOL, the pointer to request_rec is specified.
468 * @param spec [i] The pointer to the device_table
471 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
473 memset(doc, 0, sizeof(Doc));
474 memset(chtml20, 0, sizeof(chtml20_t));
478 chtml20->spec = spec;
479 chtml20->out = qs_alloc_zero_byte_string(r);
480 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
482 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
487 * Corresponding EMOJI to a current character-code is retrieved.
488 * The substitution character string is stored in the rslt pointer if agreeing.
490 * @param chtml20 [i] The pointer to the CHTML structure is specified.
491 * @param txt [i] The character string to want to examine whether it is
492 * EMOJI is specified.
493 * @param rslt [o] The pointer to the pointer that stores the result is
495 * @return When corresponding EMOJI exists, it returns it excluding 0.
498 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
505 spec = chtml20->spec;
511 DBG(r,"spec is NULL");
513 for (ee = chtml20->conf->emoji;
517 if (ee->imode == NULL) {
518 DBG(r,"emoji->imode is NULL");
522 if (ee->imode->string != NULL
523 && strlen(ee->imode->string) > 0
524 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
525 if (spec == NULL || spec->emoji_type == NULL) {
526 *rslt = apr_palloc(r->pool, 3);
527 (*rslt)[0] = ee->imode->hex1byte & 0xff;
528 (*rslt)[1] = ee->imode->hex2byte & 0xff;
530 return strlen(ee->imode->string);
542 * It is a handler who processes the HTML tag.
544 * @param pdoc [i/o] The pointer to the CHTML structure at the output
545 * destination is specified.
546 * @param node [i] The HTML tag node is specified.
547 * @return The conversion result is returned.
550 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
556 chtml20 = GET_CHTML20(pdoc);
560 /*--------------------------------------------------------------------------*/
562 /*--------------------------------------------------------------------------*/
569 * It is a handler who processes the HTML tag.
571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
572 * destination is specified.
573 * @param node [i] The HTML tag node is specified.
574 * @return The conversion result is returned.
577 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
583 chtml20 = GET_CHTML20(pdoc);
593 * It is a handler who processes the META tag.
595 * @param pdoc [i/o] The pointer to the CHTML structure at the output
596 * destination is specified.
597 * @param node [i] The META tag node is specified.
598 * @return The conversion result is returned.
601 s_chtml20_start_meta_tag(void *pdoc, Node *node)
607 int content_type_flag;
610 chtml20 = GET_CHTML20(pdoc);
614 content_type_flag = 0;
618 /*--------------------------------------------------------------------------*/
620 /*--------------------------------------------------------------------------*/
621 for (attr = qs_get_attr(doc,node);
623 attr = qs_get_next_attr(doc,attr)) {
628 name = qs_get_attr_name(doc,attr);
629 value = qs_get_attr_value(doc,attr);
634 if (strcasecmp(name, "http-equiv") == 0) {
635 /*----------------------------------------------------------------------*/
637 /*----------------------------------------------------------------------*/
638 W20_L(" http-equiv=\"");
641 if (STRCASEEQ('c','C',"content-type", value)) {
642 content_type_flag = 1;
644 if (STRCASEEQ('r','R',"refresh", value)) {
652 if (strcasecmp(name, "content") == 0) {
653 if (content_type_flag) {
656 W20_L("=\"text/html; charset=Windows-31J\"");
658 else if (refresh_flag) {
659 char *buf = apr_pstrdup(r->pool, value);
663 url = strchr(buf, ';');
665 sec = apr_pstrdup(r->pool, buf);
668 url = chxj_encoding_parameter(r, url);
669 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
699 * It is a handler who processes the META tag.
701 * @param pdoc [i/o] The pointer to the CHTML structure at the output
702 * destination is specified.
703 * @param node [i] The META tag node is specified.
704 * @return The conversion result is returned.
707 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
711 chtml20 = GET_CHTML20(pdoc);
718 * It is a handler who processes the HEAD tag.
720 * @param pdoc [i/o] The pointer to the CHTML structure at the output
721 * destination is specified.
722 * @param node [i] The HEAD tag node is specified.
723 * @return The conversion result is returned.
726 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
732 chtml20 = GET_CHTML20(pdoc);
742 * It is a handler who processes the HEAD tag.
744 * @param pdoc [i/o] The pointer to the CHTML structure at the output
745 * destination is specified.
746 * @param node [i] The HEAD tag node is specified.
747 * @return The conversion result is returned.
750 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
756 chtml20 = GET_CHTML20(pdoc);
766 * It is a handler who processes the TITLE tag.
768 * @param pdoc [i/o] The pointer to the CHTML structure at the output
769 * destination is specified.
770 * @param node [i] The TITLE tag node is specified.
771 * @return The conversion result is returned.
774 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
780 chtml20 = GET_CHTML20(pdoc);
790 * It is a handler who processes the TITLE tag.
792 * @param pdoc [i/o] The pointer to the CHTML structure at the output
793 * destination is specified.
794 * @param node [i] The TITLE tag node is specified.
795 * @return The conversion result is returned.
798 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
804 chtml20 = GET_CHTML20(pdoc);
808 W20_L("</title>\r\n");
814 * It is a handler who processes the BASE tag.
816 * @param pdoc [i/o] The pointer to the CHTML structure at the output
817 * destination is specified.
818 * @param node [i] The BASE tag node is specified.
819 * @return The conversion result is returned.
822 s_chtml20_start_base_tag(void *pdoc, Node *node)
829 chtml20 = GET_CHTML20(pdoc);
834 /*--------------------------------------------------------------------------*/
836 /*--------------------------------------------------------------------------*/
837 for (attr = qs_get_attr(doc,node);
839 attr = qs_get_next_attr(doc,attr)) {
844 name = qs_get_attr_name(doc,attr);
845 value = qs_get_attr_value(doc,attr);
847 if (STRCASEEQ('h','H',"href", name)) {
859 * It is a handler who processes the BASE tag.
861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
862 * destination is specified.
863 * @param node [i] The BASE tag node is specified.
864 * @return The conversion result is returned.
867 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
873 chtml20 = GET_CHTML20(pdoc);
882 * It is a handler who processes the BODY tag.
884 * @param pdoc [i/o] The pointer to the CHTML structure at the output
885 * destination is specified.
886 * @param node [i] The BODY tag node is specified.
887 * @return The conversion result is returned.
890 s_chtml20_start_body_tag(void *pdoc, Node *node)
897 chtml20 = GET_CHTML20(pdoc);
902 /*--------------------------------------------------------------------------*/
904 /*--------------------------------------------------------------------------*/
905 for (attr = qs_get_attr(doc,node);
907 attr = qs_get_next_attr(doc,attr)) {
911 name = qs_get_attr_name(doc,attr);
912 value = qs_get_attr_value(doc,attr);
917 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
918 /*----------------------------------------------------------------------*/
920 /*----------------------------------------------------------------------*/
921 W20_L(" bgcolor=\"");
929 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
930 /*----------------------------------------------------------------------*/
932 /*----------------------------------------------------------------------*/
941 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
942 /*----------------------------------------------------------------------*/
944 /*----------------------------------------------------------------------*/
953 if (strcasecmp(name, "alink") == 0) {
954 /*----------------------------------------------------------------------*/
956 /*----------------------------------------------------------------------*/
963 if (strcasecmp(name, "vlink") == 0) {
964 /*----------------------------------------------------------------------*/
966 /*----------------------------------------------------------------------*/
981 * It is a handler who processes the BODY tag.
983 * @param pdoc [i/o] The pointer to the CHTML structure at the output
984 * destination is specified.
985 * @param node [i] The BODY tag node is specified.
986 * @return The conversion result is returned.
989 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
995 chtml20 = GET_CHTML20(pdoc);
1000 return chtml20->out;
1005 * It is a handler who processes the A tag.
1007 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1008 * destination is specified.
1009 * @param node [i] The A tag node is specified.
1010 * @return The conversion result is returned.
1013 s_chtml20_start_a_tag(void *pdoc, Node *node)
1020 chtml20 = GET_CHTML20(pdoc);
1025 /*--------------------------------------------------------------------------*/
1026 /* Get Attributes */
1027 /*--------------------------------------------------------------------------*/
1028 for (attr = qs_get_attr(doc,node);
1030 attr = qs_get_next_attr(doc,attr)) {
1035 name = qs_get_attr_name(doc,attr);
1036 value = qs_get_attr_value(doc,attr);
1041 if (strcasecmp(name, "name") == 0) {
1042 /*--------------------------------------------------------------------*/
1044 /*--------------------------------------------------------------------*/
1053 if (strcasecmp(name, "href") == 0) {
1054 /*--------------------------------------------------------------------*/
1056 /*--------------------------------------------------------------------*/
1057 value = chxj_encoding_parameter(r, value);
1058 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1067 if (strcasecmp(name, "accesskey") == 0) {
1068 /*--------------------------------------------------------------------*/
1070 /*--------------------------------------------------------------------*/
1071 W20_L(" accesskey=\"");
1079 if (strcasecmp(name, "cti") == 0) {
1080 /*--------------------------------------------------------------------*/
1082 /*--------------------------------------------------------------------*/
1091 if (strcasecmp(name, "ijam") == 0) {
1092 /*--------------------------------------------------------------------*/
1094 /*--------------------------------------------------------------------*/
1098 if (strcasecmp(name, "ista") == 0) {
1099 /*--------------------------------------------------------------------*/
1101 /*--------------------------------------------------------------------*/
1105 if (strcasecmp(name, "ilet") == 0) {
1106 /*--------------------------------------------------------------------*/
1108 /*--------------------------------------------------------------------*/
1112 if (strcasecmp(name, "iswf") == 0) {
1113 /*--------------------------------------------------------------------*/
1115 /*--------------------------------------------------------------------*/
1119 if (strcasecmp(name, "irst") == 0) {
1120 /*--------------------------------------------------------------------*/
1122 /*--------------------------------------------------------------------*/
1129 if (strcasecmp(name, "utn") == 0) {
1130 /*--------------------------------------------------------------------*/
1132 /*--------------------------------------------------------------------*/
1139 if (strcasecmp(name, "telbook") == 0) {
1140 /*--------------------------------------------------------------------*/
1142 /*--------------------------------------------------------------------*/
1149 if (strcasecmp(name, "kana") == 0) {
1150 /*--------------------------------------------------------------------*/
1152 /*--------------------------------------------------------------------*/
1159 if (strcasecmp(name, "email") == 0) {
1160 /*--------------------------------------------------------------------*/
1162 /*--------------------------------------------------------------------*/
1172 return chtml20->out;
1177 * It is a handler who processes the A tag.
1179 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1180 * destination is specified.
1181 * @param node [i] The A tag node is specified.
1182 * @return The conversion result is returned.
1185 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1191 chtml20 = GET_CHTML20(pdoc);
1196 return chtml20->out;
1201 * It is a handler who processes the BR tag.
1203 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1204 * destination is specified.
1205 * @param node [i] The BR tag node is specified.
1206 * @return The conversion result is returned.
1209 s_chtml20_start_br_tag(void *pdoc, Node *node)
1216 chtml20 = GET_CHTML20(pdoc);
1221 /*--------------------------------------------------------------------------*/
1222 /* Get Attributes */
1223 /*--------------------------------------------------------------------------*/
1224 for (attr = qs_get_attr(doc,node);
1226 attr = qs_get_next_attr(doc,attr)) {
1230 name = qs_get_attr_name(doc,attr);
1231 value = qs_get_attr_value(doc,attr);
1233 if (STRCASEEQ('c','C',"clear",name)) {
1234 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1242 return chtml20->out;
1247 * It is a handler who processes the BR tag.
1249 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1250 * destination is specified.
1251 * @param node [i] The BR tag node is specified.
1252 * @return The conversion result is returned.
1255 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1261 chtml20 = GET_CHTML20(pdoc);
1265 return chtml20->out;
1270 * It is a handler who processes the TR tag.
1272 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1273 * destination is specified.
1274 * @param node [i] The TR tag node is specified.
1275 * @return The conversion result is returned.
1278 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1284 chtml20 = GET_CHTML20(pdoc);
1288 return chtml20->out;
1293 * It is a handler who processes the TR tag.
1295 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1296 * destination is specified.
1297 * @param node [i] The TR tag node is specified.
1298 * @return The conversion result is returned.
1301 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1307 chtml20 = GET_CHTML20(pdoc);
1312 return chtml20->out;
1317 * It is a handler who processes the FONT tag.
1319 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1320 * destination is specified.
1321 * @param node [i] The FONT tag node is specified.
1322 * @return The conversion result is returned.
1325 s_chtml20_start_font_tag(void *pdoc, Node *node)
1332 chtml20 = GET_CHTML20(pdoc);
1338 /*--------------------------------------------------------------------------*/
1339 /* Get Attributes */
1340 /*--------------------------------------------------------------------------*/
1341 for (attr = qs_get_attr(doc,node);
1343 attr = qs_get_next_attr(doc,attr)) {
1348 name = qs_get_attr_name(doc,attr);
1349 value = qs_get_attr_value(doc,attr);
1354 if (strcasecmp(name, "color") == 0) {
1363 if (strcasecmp(name, "size") == 0) {
1364 /*--------------------------------------------------------------------*/
1366 /*--------------------------------------------------------------------*/
1376 return chtml20->out;
1381 * It is a handler who processes the FONT tag.
1383 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1384 * destination is specified.
1385 * @param node [i] The FONT tag node is specified.
1386 * @return The conversion result is returned.
1389 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1395 chtml20 = GET_CHTML20(pdoc);
1400 return chtml20->out;
1405 * It is a handler who processes the FORM tag.
1407 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1408 * destination is specified.
1409 * @param node [i] The FORM tag node is specified.
1410 * @return The conversion result is returned.
1413 s_chtml20_start_form_tag(void *pdoc, Node *node)
1420 chtml20 = GET_CHTML20(pdoc);
1425 /*--------------------------------------------------------------------------*/
1426 /* Get Attributes */
1427 /*--------------------------------------------------------------------------*/
1428 for (attr = qs_get_attr(doc,node);
1430 attr = qs_get_next_attr(doc,attr)) {
1435 name = qs_get_attr_name(doc,attr);
1436 value = qs_get_attr_value(doc,attr);
1441 if (strcasecmp(name, "action") == 0) {
1442 /*--------------------------------------------------------------------*/
1444 /*--------------------------------------------------------------------*/
1445 value = chxj_encoding_parameter(r, value);
1446 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1448 W20_L(" action=\"");
1456 if (strcasecmp(name, "method") == 0) {
1457 /*--------------------------------------------------------------------*/
1459 /*--------------------------------------------------------------------*/
1460 W20_L(" method=\"");
1468 if (strcasecmp(name, "utn") == 0) {
1469 /*--------------------------------------------------------------------*/
1471 /*--------------------------------------------------------------------*/
1481 return chtml20->out;
1486 * It is a handler who processes the FORM tag.
1488 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1489 * destination is specified.
1490 * @param node [i] The FORM tag node is specified.
1491 * @return The conversion result is returned.
1494 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1500 chtml20 = GET_CHTML20(pdoc);
1505 return chtml20->out;
1510 * It is a handler who processes the INPUT tag.
1512 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1513 * destination is specified.
1514 * @param node [i] The INPUT tag node is specified.
1515 * @return The conversion result is returned.
1518 s_chtml20_start_input_tag(void *pdoc, Node *node)
1523 char *max_length = NULL;
1527 char *istyle = NULL;
1529 char *checked = NULL;
1530 char *accesskey = NULL;
1532 chtml20 = GET_CHTML20(pdoc);
1538 /*--------------------------------------------------------------------------*/
1539 /* Get Attributes */
1540 /*--------------------------------------------------------------------------*/
1542 type = qs_get_type_attr(doc, node, r);
1543 name = qs_get_name_attr(doc, node, r);
1544 value = qs_get_value_attr(doc,node,r);
1545 istyle = qs_get_istyle_attr(doc,node,r);
1546 max_length = qs_get_maxlength_attr(doc,node,r);
1547 checked = qs_get_checked_attr(doc,node,r);
1548 accesskey = qs_get_accesskey_attr(doc, node, r);
1549 size = qs_get_size_attr(doc, node, r);
1576 W20_L(" accesskey=\"");
1582 /*------------------------------------------------------------------------*/
1584 /*------------------------------------------------------------------------*/
1585 W20_L(" istyle=\"");
1590 /*--------------------------------------------------------------------------*/
1591 /* The figure is default for the password. */
1592 /*--------------------------------------------------------------------------*/
1594 if (chxj_chk_numeric(max_length) != 0)
1595 max_length = apr_psprintf(doc->buf.pool, "0");
1596 if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
1597 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1601 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1610 return chtml20->out;
1615 * It is a handler who processes the INPUT tag.
1617 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1618 * destination is specified.
1619 * @param node [i] The INPUT tag node is specified.
1620 * @return The conversion result is returned.
1623 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1629 chtml20 = GET_CHTML20(pdoc);
1633 return chtml20->out;
1638 * It is a handler who processes the CENTER tag.
1640 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1641 * destination is specified.
1642 * @param node [i] The CENTER tag node is specified.
1643 * @return The conversion result is returned.
1646 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1652 chtml20 = GET_CHTML20(pdoc);
1657 return chtml20->out;
1662 * It is a handler who processes the CENTER tag.
1664 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1665 * destination is specified.
1666 * @param node [i] The CENTER tag node is specified.
1667 * @return The conversion result is returned.
1670 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1676 chtml20 = GET_CHTML20(pdoc);
1681 return chtml20->out;
1686 * It is a handler who processes the UL tag.
1688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1689 * destination is specified.
1690 * @param node [i] The UL tag node is specified.
1691 * @return The conversion result is returned.
1694 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1700 chtml20 = GET_CHTML20(pdoc);
1705 return chtml20->out;
1710 * It is a handler who processes the UL tag.
1712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1713 * destination is specified.
1714 * @param node [i] The UL tag node is specified.
1715 * @return The conversion result is returned.
1718 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1724 chtml20 = GET_CHTML20(pdoc);
1729 return chtml20->out;
1734 * It is a handler who processes the OL tag.
1736 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1737 * destination is specified.
1738 * @param node [i] The OL tag node is specified.
1739 * @return The conversion result is returned.
1742 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1748 chtml20 = GET_CHTML20(pdoc);
1753 return chtml20->out;
1758 * It is a handler who processes the OL tag.
1760 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1761 * destination is specified.
1762 * @param node [i] The OL tag node is specified.
1763 * @return The conversion result is returned.
1766 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1772 chtml20 = GET_CHTML20(pdoc);
1777 return chtml20->out;
1782 * It is a handler who processes the LI tag.
1784 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1785 * destination is specified.
1786 * @param node [i] The LI tag node is specified.
1787 * @return The conversion result is returned.
1790 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1796 chtml20 = GET_CHTML20(pdoc);
1801 return chtml20->out;
1806 * It is a handler who processes the LI tag.
1808 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1809 * destination is specified.
1810 * @param node [i] The LI tag node is specified.
1811 * @return The conversion result is returned.
1814 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1816 chtml20_t *chtml20 = GET_CHTML20(pdoc);
1817 return chtml20->out;
1822 * It is a handler who processes the HR tag.
1824 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1825 * destination is specified.
1826 * @param node [i] The HR tag node is specified.
1827 * @return The conversion result is returned.
1830 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1837 chtml20 = GET_CHTML20(pdoc);
1843 for (attr = qs_get_attr(doc,node);
1845 attr = qs_get_next_attr(doc,attr)) {
1850 name = qs_get_attr_name(doc,attr);
1851 value = qs_get_attr_value(doc,attr);
1856 if (strcasecmp(name, "align") == 0) {
1857 /*--------------------------------------------------------------------*/
1859 /*--------------------------------------------------------------------*/
1868 if (strcasecmp(name, "size") == 0) {
1869 /*--------------------------------------------------------------------*/
1871 /*--------------------------------------------------------------------*/
1880 if (strcasecmp(name, "width") == 0) {
1881 /*--------------------------------------------------------------------*/
1883 /*--------------------------------------------------------------------*/
1892 if (strcasecmp(name, "noshade") == 0) {
1893 /*--------------------------------------------------------------------*/
1895 /*--------------------------------------------------------------------*/
1902 if (strcasecmp(name, "color") == 0) {
1903 /*--------------------------------------------------------------------*/
1905 /*--------------------------------------------------------------------*/
1915 return chtml20->out;
1920 * It is a handler who processes the HR tag.
1922 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1923 * destination is specified.
1924 * @param node [i] The HR tag node is specified.
1925 * @return The conversion result is returned.
1928 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1934 chtml20 = GET_CHTML20(pdoc);
1938 return chtml20->out;
1943 * It is a handler who processes the IMG tag.
1945 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1946 * destination is specified.
1947 * @param node [i] The IMG tag node is specified.
1948 * @return The conversion result is returned.
1951 s_chtml20_start_img_tag(void *pdoc, Node *node)
1957 #ifndef IMG_NOT_CONVERT_FILENAME
1961 chtml20 = GET_CHTML20(pdoc);
1965 #ifndef IMG_NOT_CONVERT_FILENAME
1966 spec = chtml20->spec;
1970 /*-------------------------------------------------------------------------*/
1971 /* Get Attributes */
1972 /*-------------------------------------------------------------------------*/
1973 for (attr = qs_get_attr(doc,node);
1975 attr = qs_get_next_attr(doc,attr)) {
1980 name = qs_get_attr_name(doc,attr);
1981 value = qs_get_attr_value(doc,attr);
1986 if (strcasecmp(name, "src") == 0) {
1987 /*-------------------------------------------------------------------*/
1989 /*-------------------------------------------------------------------*/
1990 #ifdef IMG_NOT_CONVERT_FILENAME
1991 value = chxj_encoding_parameter(r, value);
1992 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1994 value = apr_psprintf(doc->buf.pool,
1997 (strchr(value, '?')) ? '&' : '?',
1998 CHXJ_COOKIE_NOUPDATE_PARAM);
2004 value = chxj_img_conv(r, spec, value);
2005 value = chxj_encoding_parameter(r, value);
2006 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2008 value = apr_psprintf(doc->buf.pool,
2011 (strchr(value, '?')) ? '&' : '?',
2012 CHXJ_COOKIE_NOUPDATE_PARAM);
2023 if (strcasecmp(name, "align" ) == 0) {
2024 /*--------------------------------------------------------------------*/
2026 /*--------------------------------------------------------------------*/
2032 if (strcasecmp(name, "alt" ) == 0) {
2033 /*--------------------------------------------------------------------*/
2035 /*--------------------------------------------------------------------*/
2041 if (strcasecmp(name, "align" ) == 0) {
2042 /*--------------------------------------------------------------------*/
2044 /*--------------------------------------------------------------------*/
2051 if (strcasecmp(name, "width" ) == 0) {
2052 /*--------------------------------------------------------------------*/
2054 /*--------------------------------------------------------------------*/
2063 if (strcasecmp(name, "height") == 0) {
2064 /*--------------------------------------------------------------------*/
2066 /*--------------------------------------------------------------------*/
2067 W20_L(" height=\"");
2072 if (strcasecmp(name, "hspace") == 0) {
2073 /*--------------------------------------------------------------------*/
2075 /*--------------------------------------------------------------------*/
2076 W20_L(" hspace=\"");
2084 if (strcasecmp(name, "vspace") == 0) {
2085 /*--------------------------------------------------------------------*/
2087 /*--------------------------------------------------------------------*/
2088 W20_L(" vspace=\"");
2099 return chtml20->out;
2104 * It is a handler who processes the IMG tag.
2106 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2107 * destination is specified.
2108 * @param node [i] The IMG tag node is specified.
2109 * @return The conversion result is returned.
2112 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2118 chtml20 = GET_CHTML20(pdoc);
2122 return chtml20->out;
2127 * It is a handler who processes the SELECT tag.
2129 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2130 * destination is specified.
2131 * @param node [i] The SELECT tag node is specified.
2132 * @return The conversion result is returned.
2135 s_chtml20_start_select_tag(void *pdoc, Node *child)
2142 chtml20 = GET_CHTML20(pdoc);
2150 for (attr = qs_get_attr(doc,child);
2152 attr = qs_get_next_attr(doc,attr)) {
2157 nm = qs_get_attr_name(doc,attr);
2158 val = qs_get_attr_value(doc,attr);
2163 if (strcasecmp(nm, "size") == 0) {
2164 /*--------------------------------------------------------------------*/
2165 /* CHTML 1.0 version 2.0 */
2166 /*--------------------------------------------------------------------*/
2167 size = apr_pstrdup(doc->buf.pool, val);
2173 if (strcasecmp(nm, "name") == 0) {
2174 /*--------------------------------------------------------------------*/
2175 /* CHTML 1.0 version 2.0 */
2176 /*--------------------------------------------------------------------*/
2177 name = apr_pstrdup(doc->buf.pool, val);
2183 if (strcasecmp(nm, "multiple") == 0) {
2184 /*--------------------------------------------------------------------*/
2185 /* CHTML 1.0 version 2.0 */
2186 /*--------------------------------------------------------------------*/
2209 return chtml20->out;
2214 * It is a handler who processes the SELECT tag.
2216 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2217 * destination is specified.
2218 * @param node [i] The SELECT tag node is specified.
2219 * @return The conversion result is returned.
2222 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2228 chtml20 = GET_CHTML20(pdoc);
2232 W20_L("</select>\r\n");
2233 return chtml20->out;
2238 * It is a handler who processes the OPTION tag.
2240 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2241 * destination is specified.
2242 * @param node [i] The OPTION tag node is specified.
2243 * @return The conversion result is returned.
2246 s_chtml20_start_option_tag(void *pdoc, Node *child)
2253 chtml20 = GET_CHTML20(pdoc);
2257 char *selected = NULL;
2261 for (attr = qs_get_attr(doc,child);
2263 attr = qs_get_next_attr(doc,attr)) {
2268 nm = qs_get_attr_name(doc,attr);
2269 val = qs_get_attr_value(doc,attr);
2274 if (strcasecmp(nm, "selected") == 0) {
2275 /*--------------------------------------------------------------------*/
2276 /* CHTML 1.0 version 2.0 */
2277 /*--------------------------------------------------------------------*/
2278 selected = apr_pstrdup(doc->buf.pool, val);
2284 if (strcasecmp(nm, "value") == 0) {
2285 /*--------------------------------------------------------------------*/
2286 /* CHTML 1.0 version 2.0 */
2287 /*--------------------------------------------------------------------*/
2288 value = apr_pstrdup(doc->buf.pool, val);
2303 W20_L(" value=\"\"");
2307 W20_L(" selected ");
2310 return chtml20->out;
2315 * It is a handler who processes the OPTION tag.
2317 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2318 * destination is specified.
2319 * @param node [i] The OPTION tag node is specified.
2320 * @return The conversion result is returned.
2323 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2329 chtml20 = GET_CHTML20(pdoc);
2335 return chtml20->out;
2340 * It is a handler who processes the DIV tag.
2342 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2343 * destination is specified.
2344 * @param node [i] The DIV tag node is specified.
2345 * @return The conversion result is returned.
2348 s_chtml20_start_div_tag(void *pdoc, Node *child)
2355 chtml20 = GET_CHTML20(pdoc);
2363 for (attr = qs_get_attr(doc,child);
2365 attr = qs_get_next_attr(doc,attr)) {
2370 nm = qs_get_attr_name(doc,attr);
2371 val = qs_get_attr_value(doc,attr);
2373 if (STRCASEEQ('a','A', "align", nm)) {
2374 /*----------------------------------------------------------------------*/
2375 /* CHTML 1.0 (W3C version 3.2) */
2376 /*----------------------------------------------------------------------*/
2377 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2378 align = apr_pstrdup(doc->buf.pool, val);
2390 return chtml20->out;
2395 * It is a handler who processes the DIV tag.
2397 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2398 * destination is specified.
2399 * @param node [i] The DIV tag node is specified.
2400 * @return The conversion result is returned.
2403 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2409 chtml20 = GET_CHTML20(pdoc);
2414 return chtml20->out;
2419 * It is a handler who processes the H1 tag.
2421 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2422 * destination is specified.
2423 * @param node [i] The H1 tag node is specified.
2424 * @return The conversion result is returned.
2427 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2433 chtml20 = GET_CHTML20(pdoc);
2438 return chtml20->out;
2443 * It is a handler who processes the H1 tag.
2445 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2446 * destination is specified.
2447 * @param node [i] The H1 tag node is specified.
2448 * @return The conversion result is returned.
2451 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2457 chtml20 = GET_CHTML20(pdoc);
2462 return chtml20->out;
2467 * It is a handler who processes the H2 tag.
2469 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2470 * destination is specified.
2471 * @param node [i] The H2 tag node is specified.
2472 * @return The conversion result is returned.
2475 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2481 chtml20 = GET_CHTML20(pdoc);
2486 return chtml20->out;
2491 * It is a handler who processes the H2 tag.
2493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2494 * destination is specified.
2495 * @param node [i] The H2 tag node is specified.
2496 * @return The conversion result is returned.
2499 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2505 chtml20 = GET_CHTML20(pdoc);
2510 return chtml20->out;
2515 * It is a handler who processes the H3 tag.
2517 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2518 * destination is specified.
2519 * @param node [i] The H3 tag node is specified.
2520 * @return The conversion result is returned.
2523 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2529 chtml20 = GET_CHTML20(pdoc);
2534 return chtml20->out;
2539 * It is a handler who processes the H3 tag.
2541 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2542 * destination is specified.
2543 * @param node [i] The H3 tag node is specified.
2544 * @return The conversion result is returned.
2547 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2553 chtml20 = GET_CHTML20(pdoc);
2558 return chtml20->out;
2563 * It is a handler who processes the H4 tag.
2565 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2566 * destination is specified.
2567 * @param node [i] The H4 tag node is specified.
2568 * @return The conversion result is returned.
2571 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2577 chtml20 = GET_CHTML20(pdoc);
2582 return chtml20->out;
2587 * It is a handler who processes the H4 tag.
2589 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2590 * destination is specified.
2591 * @param node [i] The H4 tag node is specified.
2592 * @return The conversion result is returned.
2595 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2601 chtml20 = GET_CHTML20(pdoc);
2606 return chtml20->out;
2611 * It is a handler who processes the H5 tag.
2613 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2614 * destination is specified.
2615 * @param node [i] The H5 tag node is specified.
2616 * @return The conversion result is returned.
2619 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2625 chtml20 = GET_CHTML20(pdoc);
2630 return chtml20->out;
2635 * It is a handler who processes the H5 tag.
2637 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2638 * destination is specified.
2639 * @param node [i] The H5 tag node is specified.
2640 * @return The conversion result is returned.
2643 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2649 chtml20 = GET_CHTML20(pdoc);
2654 return chtml20->out;
2659 * It is a handler who processes the H6 tag.
2661 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2662 * destination is specified.
2663 * @param node [i] The H6 tag node is specified.
2664 * @return The conversion result is returned.
2667 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2673 chtml20 = GET_CHTML20(pdoc);
2678 return chtml20->out;
2683 * It is a handler who processes the H6 tag.
2685 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2686 * destination is specified.
2687 * @param node [i] The H6 tag node is specified.
2688 * @return The conversion result is returned.
2691 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2697 chtml20 = GET_CHTML20(pdoc);
2702 return chtml20->out;
2707 * It is a handler who processes the PRE tag.
2709 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2710 * destination is specified.
2711 * @param node [i] The PRE tag node is specified.
2712 * @return The conversion result is returned.
2715 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2721 chtml20 = GET_CHTML20(pdoc);
2725 chtml20->pre_flag++;
2727 return chtml20->out;
2732 * It is a handler who processes the PRE tag.
2734 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2735 * destination is specified.
2736 * @param node [i] The PRE tag node is specified.
2737 * @return The conversion result is returned.
2740 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2746 chtml20 = GET_CHTML20(pdoc);
2751 chtml20->pre_flag--;
2753 return chtml20->out;
2758 * It is a handler who processes the P tag.
2760 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2761 * destination is specified.
2762 * @param node [i] The P tag node is specified.
2763 * @return The conversion result is returned.
2766 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2772 chtml20 = GET_CHTML20(pdoc);
2777 return chtml20->out;
2782 * It is a handler who processes the P tag.
2784 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2785 * destination is specified.
2786 * @param node [i] The P tag node is specified.
2787 * @return The conversion result is returned.
2790 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2796 chtml20 = GET_CHTML20(pdoc);
2801 return chtml20->out;
2806 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2813 chtml20 = GET_CHTML20(pdoc);
2817 for (child = qs_get_child_node(doc, node);
2819 child = qs_get_next_node(doc, child)) {
2821 W20_V(child->otext);
2822 s_chtml20_chxjif_tag(pdoc, child);
2830 * It is a handler who processes the TEXTARE tag.
2832 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2833 * destination is specified.
2834 * @param node [i] The TEXTAREA tag node is specified.
2835 * @return The conversion result is returned.
2838 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2845 chtml20 = GET_CHTML20(pdoc);
2849 chtml20->textarea_flag++;
2850 W20_L("<textarea ");
2851 for (attr = qs_get_attr(doc,node);
2853 attr = qs_get_next_attr(doc,attr)) {
2858 name = qs_get_attr_name(doc,attr);
2859 value = qs_get_attr_value(doc,attr);
2864 if (strcasecmp(name, "name") == 0) {
2873 if (strcasecmp(name, "rows") == 0) {
2882 if (strcasecmp(name, "cols") == 0) {
2894 return chtml20->out;
2899 * It is a handler who processes the TEXTAREA tag.
2901 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2902 * destination is specified.
2903 * @param node [i] The TEXTAREA tag node is specified.
2904 * @return The conversion result is returned.
2907 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2913 chtml20 = GET_CHTML20(pdoc);
2917 W20_L("</textarea>\r\n");
2918 chtml20->textarea_flag--;
2920 return chtml20->out;
2925 s_chtml20_text_tag(void *pdoc, Node *child)
2937 chtml20 = GET_CHTML20(pdoc);
2941 textval = qs_get_node_value(doc,child);
2942 textval = qs_trim_string(doc->buf.pool, textval);
2943 if (strlen(textval) == 0)
2944 return chtml20->out;
2946 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2947 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2949 tdst = qs_alloc_zero_byte_string(r);
2950 memset(one_byte, 0, sizeof(one_byte));
2953 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2955 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
2957 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2961 if (is_sjis_kanji(textval[ii])) {
2962 one_byte[0] = textval[ii+0];
2963 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2964 one_byte[0] = textval[ii+1];
2965 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2969 if (chtml20->pre_flag) {
2970 one_byte[0] = textval[ii+0];
2971 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2974 if (chtml20->textarea_flag) {
2975 one_byte[0] = textval[ii+0];
2976 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2979 if (textval[ii] != '\r' && textval[ii] != '\n') {
2980 one_byte[0] = textval[ii+0];
2981 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2985 return chtml20->out;
2990 * It is a handler who processes the BLOCKQUOTE tag.
2992 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2993 * destination is specified.
2994 * @param node [i] The BLOCKQUOTE tag node is specified.
2995 * @return The conversion result is returned.
2998 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3002 chtml20 = GET_CHTML20(pdoc);
3004 W20_L("<blockquote>");
3005 return chtml20->out;
3010 * It is a handler who processes the BLOCKQUOTE tag.
3012 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3013 * destination is specified.
3014 * @param node [i] The BLOCKQUOTE tag node is specified.
3015 * @return The conversion result is returned.
3018 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3023 chtml20 = GET_CHTML20(pdoc);
3025 W20_L("</blockquote>");
3026 return chtml20->out;
3031 * It is a handler who processes the DIR tag.
3033 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3034 * destination is specified.
3035 * @param node [i] The DIR tag node is specified.
3036 * @return The conversion result is returned.
3039 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3043 chtml20 = GET_CHTML20(pdoc);
3046 return chtml20->out;
3051 * It is a handler who processes the DIR tag.
3053 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3054 * destination is specified.
3055 * @param node [i] The DIR tag node is specified.
3056 * @return The conversion result is returned.
3059 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3064 chtml20 = GET_CHTML20(pdoc);
3067 return chtml20->out;
3072 * It is a handler who processes the DL tag.
3074 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3075 * destination is specified.
3076 * @param node [i] The DL tag node is specified.
3077 * @return The conversion result is returned.
3080 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3084 chtml20 = GET_CHTML20(pdoc);
3087 return chtml20->out;
3092 * It is a handler who processes the DL tag.
3094 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3095 * destination is specified.
3096 * @param node [i] The DL tag node is specified.
3097 * @return The conversion result is returned.
3100 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3104 chtml20 = GET_CHTML20(pdoc);
3107 return chtml20->out;
3112 * It is a handter who processes the DT tag.
3114 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3115 * destination is specified.
3116 * @param node [i] The DT tag node is specified.
3117 * @return The conversion result is returned.
3120 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3124 chtml20 = GET_CHTML20(pdoc);
3127 return chtml20->out;
3132 * It is a handter who processes the DT tag.
3134 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3135 * destination is specified.
3136 * @param node [i] The DT tag node is specified.
3137 * @return The conversion result is returned.
3140 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3143 chtml20 = GET_CHTML20(pdoc);
3144 return chtml20->out;
3149 * It is a handder who processes the DD tag.
3151 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3152 * destination is specified.
3153 * @param node [i] The DD tag node is specified.
3154 * @return The conversion result is returned.
3157 s_chtml20_start_dd_tag(void *pdoc, Node *UNUSED(child))
3161 chtml20 = GET_CHTML20(pdoc);
3164 return chtml20->out;
3169 * It is a handder who processes the DD tag.
3171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3172 * destination is specified.
3173 * @param node [i] The DD tag node is specified.
3174 * @return The conversion result is returned.
3177 s_chtml20_end_dd_tag(void *pdoc, Node *UNUSED(child))
3180 chtml20 = GET_CHTML20(pdoc);
3181 return chtml20->out;