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 W_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
29 #define W_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 W_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 W_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);
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 /*----------------------------------------------------------------------*/
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 W_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);
1456 if (strcasecmp(name, "method") == 0) {
1457 /*--------------------------------------------------------------------*/
1459 /*--------------------------------------------------------------------*/
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 W_L(" accesskey=\"");
1582 /*------------------------------------------------------------------------*/
1584 /*------------------------------------------------------------------------*/
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 /*--------------------------------------------------------------------*/
1860 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1870 if (strcasecmp(name, "size") == 0) {
1871 /*--------------------------------------------------------------------*/
1873 /*--------------------------------------------------------------------*/
1874 if (value && value[0] != '\0') {
1884 if (strcasecmp(name, "width") == 0) {
1885 /*--------------------------------------------------------------------*/
1887 /*--------------------------------------------------------------------*/
1888 if (value && value[0] != '\0') {
1898 if (strcasecmp(name, "noshade") == 0) {
1899 /*--------------------------------------------------------------------*/
1901 /*--------------------------------------------------------------------*/
1908 if (strcasecmp(name, "color") == 0) {
1909 /*--------------------------------------------------------------------*/
1911 /*--------------------------------------------------------------------*/
1921 return chtml20->out;
1926 * It is a handler who processes the HR tag.
1928 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1929 * destination is specified.
1930 * @param node [i] The HR tag node is specified.
1931 * @return The conversion result is returned.
1934 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1940 chtml20 = GET_CHTML20(pdoc);
1944 return chtml20->out;
1949 * It is a handler who processes the IMG tag.
1951 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1952 * destination is specified.
1953 * @param node [i] The IMG tag node is specified.
1954 * @return The conversion result is returned.
1957 s_chtml20_start_img_tag(void *pdoc, Node *node)
1963 #ifndef IMG_NOT_CONVERT_FILENAME
1967 chtml20 = GET_CHTML20(pdoc);
1971 #ifndef IMG_NOT_CONVERT_FILENAME
1972 spec = chtml20->spec;
1976 /*-------------------------------------------------------------------------*/
1977 /* Get Attributes */
1978 /*-------------------------------------------------------------------------*/
1979 for (attr = qs_get_attr(doc,node);
1981 attr = qs_get_next_attr(doc,attr)) {
1986 name = qs_get_attr_name(doc,attr);
1987 value = qs_get_attr_value(doc,attr);
1992 if (strcasecmp(name, "src") == 0) {
1993 /*-------------------------------------------------------------------*/
1995 /*-------------------------------------------------------------------*/
1996 #ifdef IMG_NOT_CONVERT_FILENAME
1997 value = chxj_encoding_parameter(r, value);
1998 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2000 value = apr_psprintf(doc->buf.pool,
2003 (strchr(value, '?')) ? '&' : '?',
2004 CHXJ_COOKIE_NOUPDATE_PARAM);
2010 value = chxj_img_conv(r, spec, value);
2011 value = chxj_encoding_parameter(r, value);
2012 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2014 value = apr_psprintf(doc->buf.pool,
2017 (strchr(value, '?')) ? '&' : '?',
2018 CHXJ_COOKIE_NOUPDATE_PARAM);
2029 if (strcasecmp(name, "align" ) == 0) {
2030 /*--------------------------------------------------------------------*/
2032 /*--------------------------------------------------------------------*/
2038 if (strcasecmp(name, "alt" ) == 0) {
2039 /*--------------------------------------------------------------------*/
2041 /*--------------------------------------------------------------------*/
2047 if (strcasecmp(name, "align" ) == 0) {
2048 /*--------------------------------------------------------------------*/
2050 /*--------------------------------------------------------------------*/
2057 if (strcasecmp(name, "width" ) == 0) {
2058 /*--------------------------------------------------------------------*/
2060 /*--------------------------------------------------------------------*/
2069 if (strcasecmp(name, "height") == 0) {
2070 /*--------------------------------------------------------------------*/
2072 /*--------------------------------------------------------------------*/
2078 if (strcasecmp(name, "hspace") == 0) {
2079 /*--------------------------------------------------------------------*/
2081 /*--------------------------------------------------------------------*/
2090 if (strcasecmp(name, "vspace") == 0) {
2091 /*--------------------------------------------------------------------*/
2093 /*--------------------------------------------------------------------*/
2105 return chtml20->out;
2110 * It is a handler who processes the IMG tag.
2112 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2113 * destination is specified.
2114 * @param node [i] The IMG tag node is specified.
2115 * @return The conversion result is returned.
2118 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2124 chtml20 = GET_CHTML20(pdoc);
2128 return chtml20->out;
2133 * It is a handler who processes the SELECT tag.
2135 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2136 * destination is specified.
2137 * @param node [i] The SELECT tag node is specified.
2138 * @return The conversion result is returned.
2141 s_chtml20_start_select_tag(void *pdoc, Node *child)
2148 chtml20 = GET_CHTML20(pdoc);
2156 for (attr = qs_get_attr(doc,child);
2158 attr = qs_get_next_attr(doc,attr)) {
2163 nm = qs_get_attr_name(doc,attr);
2164 val = qs_get_attr_value(doc,attr);
2169 if (strcasecmp(nm, "size") == 0) {
2170 /*--------------------------------------------------------------------*/
2171 /* CHTML 1.0 version 2.0 */
2172 /*--------------------------------------------------------------------*/
2173 size = apr_pstrdup(doc->buf.pool, val);
2179 if (strcasecmp(nm, "name") == 0) {
2180 /*--------------------------------------------------------------------*/
2181 /* CHTML 1.0 version 2.0 */
2182 /*--------------------------------------------------------------------*/
2183 name = apr_pstrdup(doc->buf.pool, val);
2189 if (strcasecmp(nm, "multiple") == 0) {
2190 /*--------------------------------------------------------------------*/
2191 /* CHTML 1.0 version 2.0 */
2192 /*--------------------------------------------------------------------*/
2215 return chtml20->out;
2220 * It is a handler who processes the SELECT tag.
2222 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2223 * destination is specified.
2224 * @param node [i] The SELECT tag node is specified.
2225 * @return The conversion result is returned.
2228 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2234 chtml20 = GET_CHTML20(pdoc);
2238 W_L("</select>\r\n");
2239 return chtml20->out;
2244 * It is a handler who processes the OPTION tag.
2246 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2247 * destination is specified.
2248 * @param node [i] The OPTION tag node is specified.
2249 * @return The conversion result is returned.
2252 s_chtml20_start_option_tag(void *pdoc, Node *child)
2259 chtml20 = GET_CHTML20(pdoc);
2263 char *selected = NULL;
2267 for (attr = qs_get_attr(doc,child);
2269 attr = qs_get_next_attr(doc,attr)) {
2274 nm = qs_get_attr_name(doc,attr);
2275 val = qs_get_attr_value(doc,attr);
2280 if (strcasecmp(nm, "selected") == 0) {
2281 /*--------------------------------------------------------------------*/
2282 /* CHTML 1.0 version 2.0 */
2283 /*--------------------------------------------------------------------*/
2284 selected = apr_pstrdup(doc->buf.pool, val);
2290 if (strcasecmp(nm, "value") == 0) {
2291 /*--------------------------------------------------------------------*/
2292 /* CHTML 1.0 version 2.0 */
2293 /*--------------------------------------------------------------------*/
2294 value = apr_pstrdup(doc->buf.pool, val);
2316 return chtml20->out;
2321 * It is a handler who processes the OPTION tag.
2323 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2324 * destination is specified.
2325 * @param node [i] The OPTION tag node is specified.
2326 * @return The conversion result is returned.
2329 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2335 chtml20 = GET_CHTML20(pdoc);
2341 return chtml20->out;
2346 * It is a handler who processes the DIV tag.
2348 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2349 * destination is specified.
2350 * @param node [i] The DIV tag node is specified.
2351 * @return The conversion result is returned.
2354 s_chtml20_start_div_tag(void *pdoc, Node *child)
2361 chtml20 = GET_CHTML20(pdoc);
2369 for (attr = qs_get_attr(doc,child);
2371 attr = qs_get_next_attr(doc,attr)) {
2376 nm = qs_get_attr_name(doc,attr);
2377 val = qs_get_attr_value(doc,attr);
2379 if (STRCASEEQ('a','A', "align", nm)) {
2380 /*----------------------------------------------------------------------*/
2381 /* CHTML 1.0 (W3C version 3.2) */
2382 /*----------------------------------------------------------------------*/
2383 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2384 align = apr_pstrdup(doc->buf.pool, val);
2396 return chtml20->out;
2401 * It is a handler who processes the DIV tag.
2403 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2404 * destination is specified.
2405 * @param node [i] The DIV tag node is specified.
2406 * @return The conversion result is returned.
2409 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2415 chtml20 = GET_CHTML20(pdoc);
2420 return chtml20->out;
2425 * It is a handler who processes the H1 tag.
2427 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2428 * destination is specified.
2429 * @param node [i] The H1 tag node is specified.
2430 * @return The conversion result is returned.
2433 s_chtml20_start_h1_tag(void *pdoc, Node *node)
2440 chtml20 = GET_CHTML20(pdoc);
2445 for (attr = qs_get_attr(doc,node);
2447 attr = qs_get_next_attr(doc,attr)) {
2450 name = qs_get_attr_name(doc,attr);
2451 value = qs_get_attr_value(doc,attr);
2452 if (STRCASEEQ('a','A',"align", name)) {
2453 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2462 return chtml20->out;
2467 * It is a handler who processes the H1 tag.
2469 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2470 * destination is specified.
2471 * @param node [i] The H1 tag node is specified.
2472 * @return The conversion result is returned.
2475 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
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_start_h2_tag(void *pdoc, Node *node)
2506 chtml20 = GET_CHTML20(pdoc);
2511 for (attr = qs_get_attr(doc,node);
2513 attr = qs_get_next_attr(doc,attr)) {
2516 name = qs_get_attr_name(doc,attr);
2517 value = qs_get_attr_value(doc,attr);
2518 if (STRCASEEQ('a','A',"align", name)) {
2519 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2528 return chtml20->out;
2533 * It is a handler who processes the H2 tag.
2535 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2536 * destination is specified.
2537 * @param node [i] The H2 tag node is specified.
2538 * @return The conversion result is returned.
2541 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2547 chtml20 = GET_CHTML20(pdoc);
2552 return chtml20->out;
2557 * It is a handler who processes the H3 tag.
2559 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2560 * destination is specified.
2561 * @param node [i] The H3 tag node is specified.
2562 * @return The conversion result is returned.
2565 s_chtml20_start_h3_tag(void *pdoc, Node *node)
2572 chtml20 = GET_CHTML20(pdoc);
2577 for (attr = qs_get_attr(doc,node);
2579 attr = qs_get_next_attr(doc,attr)) {
2582 name = qs_get_attr_name(doc,attr);
2583 value = qs_get_attr_value(doc,attr);
2584 if (STRCASEEQ('a','A',"align", name)) {
2585 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2594 return chtml20->out;
2599 * It is a handler who processes the H3 tag.
2601 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2602 * destination is specified.
2603 * @param node [i] The H3 tag node is specified.
2604 * @return The conversion result is returned.
2607 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2613 chtml20 = GET_CHTML20(pdoc);
2618 return chtml20->out;
2623 * It is a handler who processes the H4 tag.
2625 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2626 * destination is specified.
2627 * @param node [i] The H4 tag node is specified.
2628 * @return The conversion result is returned.
2631 s_chtml20_start_h4_tag(void *pdoc, Node *node)
2638 chtml20 = GET_CHTML20(pdoc);
2643 for (attr = qs_get_attr(doc,node);
2645 attr = qs_get_next_attr(doc,attr)) {
2648 name = qs_get_attr_name(doc,attr);
2649 value = qs_get_attr_value(doc,attr);
2650 if (STRCASEEQ('a','A',"align", name)) {
2651 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2660 return chtml20->out;
2665 * It is a handler who processes the H4 tag.
2667 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2668 * destination is specified.
2669 * @param node [i] The H4 tag node is specified.
2670 * @return The conversion result is returned.
2673 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2679 chtml20 = GET_CHTML20(pdoc);
2684 return chtml20->out;
2689 * It is a handler who processes the H5 tag.
2691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2692 * destination is specified.
2693 * @param node [i] The H5 tag node is specified.
2694 * @return The conversion result is returned.
2697 s_chtml20_start_h5_tag(void *pdoc, Node *node)
2704 chtml20 = GET_CHTML20(pdoc);
2709 for (attr = qs_get_attr(doc,node);
2711 attr = qs_get_next_attr(doc,attr)) {
2714 name = qs_get_attr_name(doc,attr);
2715 value = qs_get_attr_value(doc,attr);
2716 if (STRCASEEQ('a','A',"align", name)) {
2717 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2726 return chtml20->out;
2731 * It is a handler who processes the H5 tag.
2733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2734 * destination is specified.
2735 * @param node [i] The H5 tag node is specified.
2736 * @return The conversion result is returned.
2739 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2745 chtml20 = GET_CHTML20(pdoc);
2750 return chtml20->out;
2755 * It is a handler who processes the H6 tag.
2757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2758 * destination is specified.
2759 * @param node [i] The H6 tag node is specified.
2760 * @return The conversion result is returned.
2763 s_chtml20_start_h6_tag(void *pdoc, Node *node)
2770 chtml20 = GET_CHTML20(pdoc);
2775 for (attr = qs_get_attr(doc,node);
2777 attr = qs_get_next_attr(doc,attr)) {
2780 name = qs_get_attr_name(doc,attr);
2781 value = qs_get_attr_value(doc,attr);
2782 if (STRCASEEQ('a','A',"align", name)) {
2783 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2792 return chtml20->out;
2797 * It is a handler who processes the H6 tag.
2799 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2800 * destination is specified.
2801 * @param node [i] The H6 tag node is specified.
2802 * @return The conversion result is returned.
2805 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2811 chtml20 = GET_CHTML20(pdoc);
2816 return chtml20->out;
2821 * It is a handler who processes the PRE tag.
2823 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2824 * destination is specified.
2825 * @param node [i] The PRE tag node is specified.
2826 * @return The conversion result is returned.
2829 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2835 chtml20 = GET_CHTML20(pdoc);
2839 chtml20->pre_flag++;
2841 return chtml20->out;
2846 * It is a handler who processes the PRE tag.
2848 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2849 * destination is specified.
2850 * @param node [i] The PRE tag node is specified.
2851 * @return The conversion result is returned.
2854 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2860 chtml20 = GET_CHTML20(pdoc);
2865 chtml20->pre_flag--;
2867 return chtml20->out;
2872 * It is a handler who processes the P tag.
2874 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2875 * destination is specified.
2876 * @param node [i] The P tag node is specified.
2877 * @return The conversion result is returned.
2880 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2886 chtml20 = GET_CHTML20(pdoc);
2891 return chtml20->out;
2896 * It is a handler who processes the P tag.
2898 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2899 * destination is specified.
2900 * @param node [i] The P tag node is specified.
2901 * @return The conversion result is returned.
2904 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2910 chtml20 = GET_CHTML20(pdoc);
2915 return chtml20->out;
2920 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2927 chtml20 = GET_CHTML20(pdoc);
2931 for (child = qs_get_child_node(doc, node);
2933 child = qs_get_next_node(doc, child)) {
2936 s_chtml20_chxjif_tag(pdoc, child);
2944 * It is a handler who processes the TEXTARE tag.
2946 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2947 * destination is specified.
2948 * @param node [i] The TEXTAREA tag node is specified.
2949 * @return The conversion result is returned.
2952 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2959 chtml20 = GET_CHTML20(pdoc);
2963 chtml20->textarea_flag++;
2965 for (attr = qs_get_attr(doc,node);
2967 attr = qs_get_next_attr(doc,attr)) {
2972 name = qs_get_attr_name(doc,attr);
2973 value = qs_get_attr_value(doc,attr);
2978 if (strcasecmp(name, "name") == 0) {
2987 if (strcasecmp(name, "rows") == 0) {
2996 if (strcasecmp(name, "cols") == 0) {
3008 return chtml20->out;
3013 * It is a handler who processes the TEXTAREA tag.
3015 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3016 * destination is specified.
3017 * @param node [i] The TEXTAREA tag node is specified.
3018 * @return The conversion result is returned.
3021 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3027 chtml20 = GET_CHTML20(pdoc);
3031 W_L("</textarea>\r\n");
3032 chtml20->textarea_flag--;
3034 return chtml20->out;
3039 s_chtml20_text_tag(void *pdoc, Node *child)
3051 chtml20 = GET_CHTML20(pdoc);
3055 textval = qs_get_node_value(doc,child);
3056 textval = qs_trim_string(doc->buf.pool, textval);
3057 if (strlen(textval) == 0)
3058 return chtml20->out;
3060 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3061 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3063 tdst = qs_alloc_zero_byte_string(r);
3064 memset(one_byte, 0, sizeof(one_byte));
3067 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3069 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
3071 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3075 if (is_sjis_kanji(textval[ii])) {
3076 one_byte[0] = textval[ii+0];
3077 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3078 one_byte[0] = textval[ii+1];
3079 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3083 if (chtml20->pre_flag) {
3084 one_byte[0] = textval[ii+0];
3085 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3088 if (chtml20->textarea_flag) {
3089 one_byte[0] = textval[ii+0];
3090 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3093 if (textval[ii] != '\r' && textval[ii] != '\n') {
3094 one_byte[0] = textval[ii+0];
3095 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3099 return chtml20->out;
3104 * It is a handler who processes the BLOCKQUOTE tag.
3106 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3107 * destination is specified.
3108 * @param node [i] The BLOCKQUOTE tag node is specified.
3109 * @return The conversion result is returned.
3112 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3116 chtml20 = GET_CHTML20(pdoc);
3118 W_L("<blockquote>");
3119 return chtml20->out;
3124 * It is a handler who processes the BLOCKQUOTE tag.
3126 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3127 * destination is specified.
3128 * @param node [i] The BLOCKQUOTE tag node is specified.
3129 * @return The conversion result is returned.
3132 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3137 chtml20 = GET_CHTML20(pdoc);
3139 W_L("</blockquote>");
3140 return chtml20->out;
3145 * It is a handler who processes the DIR tag.
3147 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3148 * destination is specified.
3149 * @param node [i] The DIR tag node is specified.
3150 * @return The conversion result is returned.
3153 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3157 chtml20 = GET_CHTML20(pdoc);
3160 return chtml20->out;
3165 * It is a handler who processes the DIR tag.
3167 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3168 * destination is specified.
3169 * @param node [i] The DIR tag node is specified.
3170 * @return The conversion result is returned.
3173 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3178 chtml20 = GET_CHTML20(pdoc);
3181 return chtml20->out;
3186 * It is a handler who processes the DL tag.
3188 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3189 * destination is specified.
3190 * @param node [i] The DL tag node is specified.
3191 * @return The conversion result is returned.
3194 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3198 chtml20 = GET_CHTML20(pdoc);
3201 return chtml20->out;
3206 * It is a handler who processes the DL tag.
3208 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3209 * destination is specified.
3210 * @param node [i] The DL tag node is specified.
3211 * @return The conversion result is returned.
3214 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3218 chtml20 = GET_CHTML20(pdoc);
3221 return chtml20->out;
3226 * It is a handter who processes the DT tag.
3228 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3229 * destination is specified.
3230 * @param node [i] The DT tag node is specified.
3231 * @return The conversion result is returned.
3234 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3238 chtml20 = GET_CHTML20(pdoc);
3241 return chtml20->out;
3246 * It is a handter who processes the DT tag.
3248 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3249 * destination is specified.
3250 * @param node [i] The DT tag node is specified.
3251 * @return The conversion result is returned.
3254 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3257 chtml20 = GET_CHTML20(pdoc);
3258 return chtml20->out;
3263 * It is a handder who processes the DD tag.
3265 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3266 * destination is specified.
3267 * @param node [i] The DD tag node is specified.
3268 * @return The conversion result is returned.
3271 s_chtml20_start_dd_tag(void *pdoc, Node *UNUSED(child))
3275 chtml20 = GET_CHTML20(pdoc);
3278 return chtml20->out;
3283 * It is a handder who processes the DD tag.
3285 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3286 * destination is specified.
3287 * @param node [i] The DD tag node is specified.
3288 * @return The conversion result is returned.
3291 s_chtml20_end_dd_tag(void *pdoc, Node *UNUSED(child))
3294 chtml20 = GET_CHTML20(pdoc);
3295 return chtml20->out;