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);
1552 type = qs_trim_string(doc->buf.pool, type);
1553 if (type && (STRCASEEQ('t','T',"text", type) ||
1554 STRCASEEQ('p','P',"password",type) ||
1555 STRCASEEQ('c','C',"checkbox",type) ||
1556 STRCASEEQ('r','R',"radio", type) ||
1557 STRCASEEQ('h','H',"hidden", type) ||
1558 STRCASEEQ('s','S',"submit", type) ||
1559 STRCASEEQ('r','R',"reset", type))) {
1566 if (size && *size) {
1572 if (name && *name) {
1578 if (value && *value) {
1584 if (accesskey && *accesskey) {
1585 W_L(" accesskey=\"");
1591 /*------------------------------------------------------------------------*/
1593 /*------------------------------------------------------------------------*/
1594 if (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4') {
1601 /*--------------------------------------------------------------------------*/
1602 /* The figure is default for the password. */
1603 /*--------------------------------------------------------------------------*/
1604 if (max_length && *max_length) {
1605 if (chxj_chk_numeric(max_length) != 0) {
1606 max_length = apr_psprintf(doc->buf.pool, "0");
1608 if (istyle && *istyle == '1') {
1609 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1613 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1622 return chtml20->out;
1627 * It is a handler who processes the INPUT tag.
1629 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1630 * destination is specified.
1631 * @param node [i] The INPUT tag node is specified.
1632 * @return The conversion result is returned.
1635 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1641 chtml20 = GET_CHTML20(pdoc);
1645 return chtml20->out;
1650 * It is a handler who processes the CENTER tag.
1652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1653 * destination is specified.
1654 * @param node [i] The CENTER tag node is specified.
1655 * @return The conversion result is returned.
1658 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1664 chtml20 = GET_CHTML20(pdoc);
1669 return chtml20->out;
1674 * It is a handler who processes the CENTER tag.
1676 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1677 * destination is specified.
1678 * @param node [i] The CENTER tag node is specified.
1679 * @return The conversion result is returned.
1682 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1688 chtml20 = GET_CHTML20(pdoc);
1693 return chtml20->out;
1698 * It is a handler who processes the UL tag.
1700 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1701 * destination is specified.
1702 * @param node [i] The UL tag node is specified.
1703 * @return The conversion result is returned.
1706 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1712 chtml20 = GET_CHTML20(pdoc);
1717 return chtml20->out;
1722 * It is a handler who processes the UL tag.
1724 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1725 * destination is specified.
1726 * @param node [i] The UL tag node is specified.
1727 * @return The conversion result is returned.
1730 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1736 chtml20 = GET_CHTML20(pdoc);
1741 return chtml20->out;
1746 * It is a handler who processes the OL tag.
1748 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1749 * destination is specified.
1750 * @param node [i] The OL tag node is specified.
1751 * @return The conversion result is returned.
1754 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1760 chtml20 = GET_CHTML20(pdoc);
1765 return chtml20->out;
1770 * It is a handler who processes the OL tag.
1772 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1773 * destination is specified.
1774 * @param node [i] The OL tag node is specified.
1775 * @return The conversion result is returned.
1778 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1784 chtml20 = GET_CHTML20(pdoc);
1789 return chtml20->out;
1794 * It is a handler who processes the LI tag.
1796 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1797 * destination is specified.
1798 * @param node [i] The LI tag node is specified.
1799 * @return The conversion result is returned.
1802 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1808 chtml20 = GET_CHTML20(pdoc);
1813 return chtml20->out;
1818 * It is a handler who processes the LI tag.
1820 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1821 * destination is specified.
1822 * @param node [i] The LI tag node is specified.
1823 * @return The conversion result is returned.
1826 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1828 chtml20_t *chtml20 = GET_CHTML20(pdoc);
1829 return chtml20->out;
1834 * It is a handler who processes the HR tag.
1836 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1837 * destination is specified.
1838 * @param node [i] The HR tag node is specified.
1839 * @return The conversion result is returned.
1842 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1849 chtml20 = GET_CHTML20(pdoc);
1855 for (attr = qs_get_attr(doc,node);
1857 attr = qs_get_next_attr(doc,attr)) {
1862 name = qs_get_attr_name(doc,attr);
1863 value = qs_get_attr_value(doc,attr);
1868 if (strcasecmp(name, "align") == 0) {
1869 /*--------------------------------------------------------------------*/
1871 /*--------------------------------------------------------------------*/
1872 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1882 if (strcasecmp(name, "size") == 0) {
1883 /*--------------------------------------------------------------------*/
1885 /*--------------------------------------------------------------------*/
1886 if (value && value[0] != '\0') {
1896 if (strcasecmp(name, "width") == 0) {
1897 /*--------------------------------------------------------------------*/
1899 /*--------------------------------------------------------------------*/
1900 if (value && value[0] != '\0') {
1910 if (strcasecmp(name, "noshade") == 0) {
1911 /*--------------------------------------------------------------------*/
1913 /*--------------------------------------------------------------------*/
1920 if (strcasecmp(name, "color") == 0) {
1921 /*--------------------------------------------------------------------*/
1923 /*--------------------------------------------------------------------*/
1933 return chtml20->out;
1938 * It is a handler who processes the HR tag.
1940 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1941 * destination is specified.
1942 * @param node [i] The HR tag node is specified.
1943 * @return The conversion result is returned.
1946 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1952 chtml20 = GET_CHTML20(pdoc);
1956 return chtml20->out;
1961 * It is a handler who processes the IMG tag.
1963 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1964 * destination is specified.
1965 * @param node [i] The IMG tag node is specified.
1966 * @return The conversion result is returned.
1969 s_chtml20_start_img_tag(void *pdoc, Node *node)
1975 #ifndef IMG_NOT_CONVERT_FILENAME
1979 chtml20 = GET_CHTML20(pdoc);
1983 #ifndef IMG_NOT_CONVERT_FILENAME
1984 spec = chtml20->spec;
1988 /*-------------------------------------------------------------------------*/
1989 /* Get Attributes */
1990 /*-------------------------------------------------------------------------*/
1991 for (attr = qs_get_attr(doc,node);
1993 attr = qs_get_next_attr(doc,attr)) {
1998 name = qs_get_attr_name(doc,attr);
1999 value = qs_get_attr_value(doc,attr);
2004 if (strcasecmp(name, "src") == 0) {
2005 /*-------------------------------------------------------------------*/
2007 /*-------------------------------------------------------------------*/
2008 #ifdef IMG_NOT_CONVERT_FILENAME
2009 value = chxj_encoding_parameter(r, value);
2010 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2012 value = apr_psprintf(doc->buf.pool,
2015 (strchr(value, '?')) ? '&' : '?',
2016 CHXJ_COOKIE_NOUPDATE_PARAM);
2022 value = chxj_img_conv(r, spec, value);
2023 value = chxj_encoding_parameter(r, value);
2024 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2026 value = apr_psprintf(doc->buf.pool,
2029 (strchr(value, '?')) ? '&' : '?',
2030 CHXJ_COOKIE_NOUPDATE_PARAM);
2041 if (strcasecmp(name, "align" ) == 0) {
2042 /*--------------------------------------------------------------------*/
2044 /*--------------------------------------------------------------------*/
2045 if (value && (STRCASEEQ('t','T',"top", value) ||
2046 STRCASEEQ('m','M',"middle",value) ||
2047 STRCASEEQ('b','B',"bottom",value) ||
2048 STRCASEEQ('l','L',"left", value) ||
2049 STRCASEEQ('r','R',"right", value))) {
2055 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2056 /*--------------------------------------------------------------------*/
2058 /*--------------------------------------------------------------------*/
2067 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2068 /*--------------------------------------------------------------------*/
2070 /*--------------------------------------------------------------------*/
2079 if (strcasecmp(name, "height") == 0 && value && *value) {
2080 /*--------------------------------------------------------------------*/
2082 /*--------------------------------------------------------------------*/
2087 else if (strcasecmp(name, "hspace") == 0 && value && *value) {
2088 /*--------------------------------------------------------------------*/
2090 /*--------------------------------------------------------------------*/
2099 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2100 /*--------------------------------------------------------------------*/
2102 /*--------------------------------------------------------------------*/
2114 return chtml20->out;
2119 * It is a handler who processes the IMG tag.
2121 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2122 * destination is specified.
2123 * @param node [i] The IMG tag node is specified.
2124 * @return The conversion result is returned.
2127 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2133 chtml20 = GET_CHTML20(pdoc);
2137 return chtml20->out;
2142 * It is a handler who processes the SELECT tag.
2144 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2145 * destination is specified.
2146 * @param node [i] The SELECT tag node is specified.
2147 * @return The conversion result is returned.
2150 s_chtml20_start_select_tag(void *pdoc, Node *child)
2157 chtml20 = GET_CHTML20(pdoc);
2165 for (attr = qs_get_attr(doc,child);
2167 attr = qs_get_next_attr(doc,attr)) {
2172 nm = qs_get_attr_name(doc,attr);
2173 val = qs_get_attr_value(doc,attr);
2178 if (strcasecmp(nm, "size") == 0) {
2179 /*--------------------------------------------------------------------*/
2180 /* CHTML 1.0 version 2.0 */
2181 /*--------------------------------------------------------------------*/
2182 size = apr_pstrdup(doc->buf.pool, val);
2188 if (strcasecmp(nm, "name") == 0) {
2189 /*--------------------------------------------------------------------*/
2190 /* CHTML 1.0 version 2.0 */
2191 /*--------------------------------------------------------------------*/
2192 name = apr_pstrdup(doc->buf.pool, val);
2198 if (strcasecmp(nm, "multiple") == 0) {
2199 /*--------------------------------------------------------------------*/
2200 /* CHTML 1.0 version 2.0 */
2201 /*--------------------------------------------------------------------*/
2224 return chtml20->out;
2229 * It is a handler who processes the SELECT tag.
2231 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2232 * destination is specified.
2233 * @param node [i] The SELECT tag node is specified.
2234 * @return The conversion result is returned.
2237 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2243 chtml20 = GET_CHTML20(pdoc);
2247 W_L("</select>\r\n");
2248 return chtml20->out;
2253 * It is a handler who processes the OPTION tag.
2255 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2256 * destination is specified.
2257 * @param node [i] The OPTION tag node is specified.
2258 * @return The conversion result is returned.
2261 s_chtml20_start_option_tag(void *pdoc, Node *child)
2268 chtml20 = GET_CHTML20(pdoc);
2272 char *selected = NULL;
2276 for (attr = qs_get_attr(doc,child);
2278 attr = qs_get_next_attr(doc,attr)) {
2283 nm = qs_get_attr_name(doc,attr);
2284 val = qs_get_attr_value(doc,attr);
2289 if (strcasecmp(nm, "selected") == 0) {
2290 /*--------------------------------------------------------------------*/
2291 /* CHTML 1.0 version 2.0 */
2292 /*--------------------------------------------------------------------*/
2293 selected = apr_pstrdup(doc->buf.pool, val);
2299 if (strcasecmp(nm, "value") == 0) {
2300 /*--------------------------------------------------------------------*/
2301 /* CHTML 1.0 version 2.0 */
2302 /*--------------------------------------------------------------------*/
2303 value = apr_pstrdup(doc->buf.pool, val);
2325 return chtml20->out;
2330 * It is a handler who processes the OPTION tag.
2332 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2333 * destination is specified.
2334 * @param node [i] The OPTION tag node is specified.
2335 * @return The conversion result is returned.
2338 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2344 chtml20 = GET_CHTML20(pdoc);
2350 return chtml20->out;
2355 * It is a handler who processes the DIV tag.
2357 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2358 * destination is specified.
2359 * @param node [i] The DIV tag node is specified.
2360 * @return The conversion result is returned.
2363 s_chtml20_start_div_tag(void *pdoc, Node *child)
2370 chtml20 = GET_CHTML20(pdoc);
2378 for (attr = qs_get_attr(doc,child);
2380 attr = qs_get_next_attr(doc,attr)) {
2385 nm = qs_get_attr_name(doc,attr);
2386 val = qs_get_attr_value(doc,attr);
2388 if (STRCASEEQ('a','A', "align", nm)) {
2389 /*----------------------------------------------------------------------*/
2390 /* CHTML 1.0 (W3C version 3.2) */
2391 /*----------------------------------------------------------------------*/
2392 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2393 align = apr_pstrdup(doc->buf.pool, val);
2405 return chtml20->out;
2410 * It is a handler who processes the DIV tag.
2412 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2413 * destination is specified.
2414 * @param node [i] The DIV tag node is specified.
2415 * @return The conversion result is returned.
2418 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2424 chtml20 = GET_CHTML20(pdoc);
2429 return chtml20->out;
2434 * It is a handler who processes the H1 tag.
2436 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2437 * destination is specified.
2438 * @param node [i] The H1 tag node is specified.
2439 * @return The conversion result is returned.
2442 s_chtml20_start_h1_tag(void *pdoc, Node *node)
2449 chtml20 = GET_CHTML20(pdoc);
2454 for (attr = qs_get_attr(doc,node);
2456 attr = qs_get_next_attr(doc,attr)) {
2459 name = qs_get_attr_name(doc,attr);
2460 value = qs_get_attr_value(doc,attr);
2461 if (STRCASEEQ('a','A',"align", name)) {
2462 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2471 return chtml20->out;
2476 * It is a handler who processes the H1 tag.
2478 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2479 * destination is specified.
2480 * @param node [i] The H1 tag node is specified.
2481 * @return The conversion result is returned.
2484 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2490 chtml20 = GET_CHTML20(pdoc);
2495 return chtml20->out;
2500 * It is a handler who processes the H2 tag.
2502 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2503 * destination is specified.
2504 * @param node [i] The H2 tag node is specified.
2505 * @return The conversion result is returned.
2508 s_chtml20_start_h2_tag(void *pdoc, Node *node)
2515 chtml20 = GET_CHTML20(pdoc);
2520 for (attr = qs_get_attr(doc,node);
2522 attr = qs_get_next_attr(doc,attr)) {
2525 name = qs_get_attr_name(doc,attr);
2526 value = qs_get_attr_value(doc,attr);
2527 if (STRCASEEQ('a','A',"align", name)) {
2528 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2537 return chtml20->out;
2542 * It is a handler who processes the H2 tag.
2544 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2545 * destination is specified.
2546 * @param node [i] The H2 tag node is specified.
2547 * @return The conversion result is returned.
2550 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2556 chtml20 = GET_CHTML20(pdoc);
2561 return chtml20->out;
2566 * It is a handler who processes the H3 tag.
2568 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2569 * destination is specified.
2570 * @param node [i] The H3 tag node is specified.
2571 * @return The conversion result is returned.
2574 s_chtml20_start_h3_tag(void *pdoc, Node *node)
2581 chtml20 = GET_CHTML20(pdoc);
2586 for (attr = qs_get_attr(doc,node);
2588 attr = qs_get_next_attr(doc,attr)) {
2591 name = qs_get_attr_name(doc,attr);
2592 value = qs_get_attr_value(doc,attr);
2593 if (STRCASEEQ('a','A',"align", name)) {
2594 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2603 return chtml20->out;
2608 * It is a handler who processes the H3 tag.
2610 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2611 * destination is specified.
2612 * @param node [i] The H3 tag node is specified.
2613 * @return The conversion result is returned.
2616 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2622 chtml20 = GET_CHTML20(pdoc);
2627 return chtml20->out;
2632 * It is a handler who processes the H4 tag.
2634 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2635 * destination is specified.
2636 * @param node [i] The H4 tag node is specified.
2637 * @return The conversion result is returned.
2640 s_chtml20_start_h4_tag(void *pdoc, Node *node)
2647 chtml20 = GET_CHTML20(pdoc);
2652 for (attr = qs_get_attr(doc,node);
2654 attr = qs_get_next_attr(doc,attr)) {
2657 name = qs_get_attr_name(doc,attr);
2658 value = qs_get_attr_value(doc,attr);
2659 if (STRCASEEQ('a','A',"align", name)) {
2660 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2669 return chtml20->out;
2674 * It is a handler who processes the H4 tag.
2676 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2677 * destination is specified.
2678 * @param node [i] The H4 tag node is specified.
2679 * @return The conversion result is returned.
2682 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2688 chtml20 = GET_CHTML20(pdoc);
2693 return chtml20->out;
2698 * It is a handler who processes the H5 tag.
2700 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2701 * destination is specified.
2702 * @param node [i] The H5 tag node is specified.
2703 * @return The conversion result is returned.
2706 s_chtml20_start_h5_tag(void *pdoc, Node *node)
2713 chtml20 = GET_CHTML20(pdoc);
2718 for (attr = qs_get_attr(doc,node);
2720 attr = qs_get_next_attr(doc,attr)) {
2723 name = qs_get_attr_name(doc,attr);
2724 value = qs_get_attr_value(doc,attr);
2725 if (STRCASEEQ('a','A',"align", name)) {
2726 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2735 return chtml20->out;
2740 * It is a handler who processes the H5 tag.
2742 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2743 * destination is specified.
2744 * @param node [i] The H5 tag node is specified.
2745 * @return The conversion result is returned.
2748 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2754 chtml20 = GET_CHTML20(pdoc);
2759 return chtml20->out;
2764 * It is a handler who processes the H6 tag.
2766 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2767 * destination is specified.
2768 * @param node [i] The H6 tag node is specified.
2769 * @return The conversion result is returned.
2772 s_chtml20_start_h6_tag(void *pdoc, Node *node)
2779 chtml20 = GET_CHTML20(pdoc);
2784 for (attr = qs_get_attr(doc,node);
2786 attr = qs_get_next_attr(doc,attr)) {
2789 name = qs_get_attr_name(doc,attr);
2790 value = qs_get_attr_value(doc,attr);
2791 if (STRCASEEQ('a','A',"align", name)) {
2792 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2801 return chtml20->out;
2806 * It is a handler who processes the H6 tag.
2808 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2809 * destination is specified.
2810 * @param node [i] The H6 tag node is specified.
2811 * @return The conversion result is returned.
2814 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2820 chtml20 = GET_CHTML20(pdoc);
2825 return chtml20->out;
2830 * It is a handler who processes the PRE tag.
2832 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2833 * destination is specified.
2834 * @param node [i] The PRE tag node is specified.
2835 * @return The conversion result is returned.
2838 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2844 chtml20 = GET_CHTML20(pdoc);
2848 chtml20->pre_flag++;
2850 return chtml20->out;
2855 * It is a handler who processes the PRE tag.
2857 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2858 * destination is specified.
2859 * @param node [i] The PRE tag node is specified.
2860 * @return The conversion result is returned.
2863 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2869 chtml20 = GET_CHTML20(pdoc);
2874 chtml20->pre_flag--;
2876 return chtml20->out;
2881 * It is a handler who processes the P tag.
2883 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2884 * destination is specified.
2885 * @param node [i] The P tag node is specified.
2886 * @return The conversion result is returned.
2889 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2895 chtml20 = GET_CHTML20(pdoc);
2900 return chtml20->out;
2905 * It is a handler who processes the P tag.
2907 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2908 * destination is specified.
2909 * @param node [i] The P tag node is specified.
2910 * @return The conversion result is returned.
2913 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2919 chtml20 = GET_CHTML20(pdoc);
2924 return chtml20->out;
2929 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2936 chtml20 = GET_CHTML20(pdoc);
2940 for (child = qs_get_child_node(doc, node);
2942 child = qs_get_next_node(doc, child)) {
2945 s_chtml20_chxjif_tag(pdoc, child);
2953 * It is a handler who processes the TEXTARE tag.
2955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2956 * destination is specified.
2957 * @param node [i] The TEXTAREA tag node is specified.
2958 * @return The conversion result is returned.
2961 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2968 chtml20 = GET_CHTML20(pdoc);
2972 chtml20->textarea_flag++;
2974 for (attr = qs_get_attr(doc,node);
2976 attr = qs_get_next_attr(doc,attr)) {
2981 name = qs_get_attr_name(doc,attr);
2982 value = qs_get_attr_value(doc,attr);
2987 if (strcasecmp(name, "name") == 0) {
2996 if (strcasecmp(name, "rows") == 0) {
3005 if (strcasecmp(name, "cols") == 0) {
3017 return chtml20->out;
3022 * It is a handler who processes the TEXTAREA tag.
3024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3025 * destination is specified.
3026 * @param node [i] The TEXTAREA tag node is specified.
3027 * @return The conversion result is returned.
3030 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3036 chtml20 = GET_CHTML20(pdoc);
3040 W_L("</textarea>\r\n");
3041 chtml20->textarea_flag--;
3043 return chtml20->out;
3048 s_chtml20_text_tag(void *pdoc, Node *child)
3060 chtml20 = GET_CHTML20(pdoc);
3064 textval = qs_get_node_value(doc,child);
3065 textval = qs_trim_string(doc->buf.pool, textval);
3066 if (strlen(textval) == 0)
3067 return chtml20->out;
3069 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3070 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3072 tdst = qs_alloc_zero_byte_string(r);
3073 memset(one_byte, 0, sizeof(one_byte));
3076 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3078 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
3080 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3084 if (is_sjis_kanji(textval[ii])) {
3085 one_byte[0] = textval[ii+0];
3086 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3087 one_byte[0] = textval[ii+1];
3088 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3092 if (chtml20->pre_flag) {
3093 one_byte[0] = textval[ii+0];
3094 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3097 if (chtml20->textarea_flag) {
3098 one_byte[0] = textval[ii+0];
3099 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3102 if (textval[ii] != '\r' && textval[ii] != '\n') {
3103 one_byte[0] = textval[ii+0];
3104 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3108 return chtml20->out;
3113 * It is a handler who processes the BLOCKQUOTE tag.
3115 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3116 * destination is specified.
3117 * @param node [i] The BLOCKQUOTE tag node is specified.
3118 * @return The conversion result is returned.
3121 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3125 chtml20 = GET_CHTML20(pdoc);
3127 W_L("<blockquote>");
3128 return chtml20->out;
3133 * It is a handler who processes the BLOCKQUOTE tag.
3135 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3136 * destination is specified.
3137 * @param node [i] The BLOCKQUOTE tag node is specified.
3138 * @return The conversion result is returned.
3141 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3146 chtml20 = GET_CHTML20(pdoc);
3148 W_L("</blockquote>");
3149 return chtml20->out;
3154 * It is a handler who processes the DIR tag.
3156 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3157 * destination is specified.
3158 * @param node [i] The DIR tag node is specified.
3159 * @return The conversion result is returned.
3162 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3166 chtml20 = GET_CHTML20(pdoc);
3169 return chtml20->out;
3174 * It is a handler who processes the DIR tag.
3176 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3177 * destination is specified.
3178 * @param node [i] The DIR tag node is specified.
3179 * @return The conversion result is returned.
3182 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3187 chtml20 = GET_CHTML20(pdoc);
3190 return chtml20->out;
3195 * It is a handler who processes the DL tag.
3197 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3198 * destination is specified.
3199 * @param node [i] The DL tag node is specified.
3200 * @return The conversion result is returned.
3203 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3207 chtml20 = GET_CHTML20(pdoc);
3210 return chtml20->out;
3215 * It is a handler who processes the DL tag.
3217 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3218 * destination is specified.
3219 * @param node [i] The DL tag node is specified.
3220 * @return The conversion result is returned.
3223 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3227 chtml20 = GET_CHTML20(pdoc);
3230 return chtml20->out;
3235 * It is a handter who processes the DT tag.
3237 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3238 * destination is specified.
3239 * @param node [i] The DT tag node is specified.
3240 * @return The conversion result is returned.
3243 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3247 chtml20 = GET_CHTML20(pdoc);
3250 return chtml20->out;
3255 * It is a handter who processes the DT tag.
3257 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3258 * destination is specified.
3259 * @param node [i] The DT tag node is specified.
3260 * @return The conversion result is returned.
3263 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3266 chtml20 = GET_CHTML20(pdoc);
3267 return chtml20->out;
3272 * It is a handder who processes the DD tag.
3274 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3275 * destination is specified.
3276 * @param node [i] The DD tag node is specified.
3277 * @return The conversion result is returned.
3280 s_chtml20_start_dd_tag(void *pdoc, Node *UNUSED(child))
3284 chtml20 = GET_CHTML20(pdoc);
3287 return chtml20->out;
3292 * It is a handder who processes the DD tag.
3294 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3295 * destination is specified.
3296 * @param node [i] The DD tag node is specified.
3297 * @return The conversion result is returned.
3300 s_chtml20_end_dd_tag(void *pdoc, Node *UNUSED(child))
3303 chtml20 = GET_CHTML20(pdoc);
3304 return chtml20->out;