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 /*--------------------------------------------------------------------*/
2033 if (value && (STRCASEEQ('t','T',"top", value) ||
2034 STRCASEEQ('m','M',"middle",value) ||
2035 STRCASEEQ('b','B',"bottom",value) ||
2036 STRCASEEQ('l','L',"left", value) ||
2037 STRCASEEQ('r','R',"right", value))) {
2043 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2044 /*--------------------------------------------------------------------*/
2046 /*--------------------------------------------------------------------*/
2055 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2056 /*--------------------------------------------------------------------*/
2058 /*--------------------------------------------------------------------*/
2067 if (strcasecmp(name, "height") == 0 && value && *value) {
2068 /*--------------------------------------------------------------------*/
2070 /*--------------------------------------------------------------------*/
2075 else if (strcasecmp(name, "hspace") == 0 && value && *value) {
2076 /*--------------------------------------------------------------------*/
2078 /*--------------------------------------------------------------------*/
2087 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2088 /*--------------------------------------------------------------------*/
2090 /*--------------------------------------------------------------------*/
2102 return chtml20->out;
2107 * It is a handler who processes the IMG tag.
2109 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2110 * destination is specified.
2111 * @param node [i] The IMG tag node is specified.
2112 * @return The conversion result is returned.
2115 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2121 chtml20 = GET_CHTML20(pdoc);
2125 return chtml20->out;
2130 * It is a handler who processes the SELECT tag.
2132 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2133 * destination is specified.
2134 * @param node [i] The SELECT tag node is specified.
2135 * @return The conversion result is returned.
2138 s_chtml20_start_select_tag(void *pdoc, Node *child)
2145 chtml20 = GET_CHTML20(pdoc);
2153 for (attr = qs_get_attr(doc,child);
2155 attr = qs_get_next_attr(doc,attr)) {
2160 nm = qs_get_attr_name(doc,attr);
2161 val = qs_get_attr_value(doc,attr);
2166 if (strcasecmp(nm, "size") == 0) {
2167 /*--------------------------------------------------------------------*/
2168 /* CHTML 1.0 version 2.0 */
2169 /*--------------------------------------------------------------------*/
2170 size = apr_pstrdup(doc->buf.pool, val);
2176 if (strcasecmp(nm, "name") == 0) {
2177 /*--------------------------------------------------------------------*/
2178 /* CHTML 1.0 version 2.0 */
2179 /*--------------------------------------------------------------------*/
2180 name = apr_pstrdup(doc->buf.pool, val);
2186 if (strcasecmp(nm, "multiple") == 0) {
2187 /*--------------------------------------------------------------------*/
2188 /* CHTML 1.0 version 2.0 */
2189 /*--------------------------------------------------------------------*/
2212 return chtml20->out;
2217 * It is a handler who processes the SELECT tag.
2219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2220 * destination is specified.
2221 * @param node [i] The SELECT tag node is specified.
2222 * @return The conversion result is returned.
2225 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2231 chtml20 = GET_CHTML20(pdoc);
2235 W_L("</select>\r\n");
2236 return chtml20->out;
2241 * It is a handler who processes the OPTION tag.
2243 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2244 * destination is specified.
2245 * @param node [i] The OPTION tag node is specified.
2246 * @return The conversion result is returned.
2249 s_chtml20_start_option_tag(void *pdoc, Node *child)
2256 chtml20 = GET_CHTML20(pdoc);
2260 char *selected = NULL;
2264 for (attr = qs_get_attr(doc,child);
2266 attr = qs_get_next_attr(doc,attr)) {
2271 nm = qs_get_attr_name(doc,attr);
2272 val = qs_get_attr_value(doc,attr);
2277 if (strcasecmp(nm, "selected") == 0) {
2278 /*--------------------------------------------------------------------*/
2279 /* CHTML 1.0 version 2.0 */
2280 /*--------------------------------------------------------------------*/
2281 selected = apr_pstrdup(doc->buf.pool, val);
2287 if (strcasecmp(nm, "value") == 0) {
2288 /*--------------------------------------------------------------------*/
2289 /* CHTML 1.0 version 2.0 */
2290 /*--------------------------------------------------------------------*/
2291 value = apr_pstrdup(doc->buf.pool, val);
2313 return chtml20->out;
2318 * It is a handler who processes the OPTION tag.
2320 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2321 * destination is specified.
2322 * @param node [i] The OPTION tag node is specified.
2323 * @return The conversion result is returned.
2326 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2332 chtml20 = GET_CHTML20(pdoc);
2338 return chtml20->out;
2343 * It is a handler who processes the DIV tag.
2345 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2346 * destination is specified.
2347 * @param node [i] The DIV tag node is specified.
2348 * @return The conversion result is returned.
2351 s_chtml20_start_div_tag(void *pdoc, Node *child)
2358 chtml20 = GET_CHTML20(pdoc);
2366 for (attr = qs_get_attr(doc,child);
2368 attr = qs_get_next_attr(doc,attr)) {
2373 nm = qs_get_attr_name(doc,attr);
2374 val = qs_get_attr_value(doc,attr);
2376 if (STRCASEEQ('a','A', "align", nm)) {
2377 /*----------------------------------------------------------------------*/
2378 /* CHTML 1.0 (W3C version 3.2) */
2379 /*----------------------------------------------------------------------*/
2380 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2381 align = apr_pstrdup(doc->buf.pool, val);
2393 return chtml20->out;
2398 * It is a handler who processes the DIV tag.
2400 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2401 * destination is specified.
2402 * @param node [i] The DIV tag node is specified.
2403 * @return The conversion result is returned.
2406 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2412 chtml20 = GET_CHTML20(pdoc);
2417 return chtml20->out;
2422 * It is a handler who processes the H1 tag.
2424 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2425 * destination is specified.
2426 * @param node [i] The H1 tag node is specified.
2427 * @return The conversion result is returned.
2430 s_chtml20_start_h1_tag(void *pdoc, Node *node)
2437 chtml20 = GET_CHTML20(pdoc);
2442 for (attr = qs_get_attr(doc,node);
2444 attr = qs_get_next_attr(doc,attr)) {
2447 name = qs_get_attr_name(doc,attr);
2448 value = qs_get_attr_value(doc,attr);
2449 if (STRCASEEQ('a','A',"align", name)) {
2450 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2459 return chtml20->out;
2464 * It is a handler who processes the H1 tag.
2466 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2467 * destination is specified.
2468 * @param node [i] The H1 tag node is specified.
2469 * @return The conversion result is returned.
2472 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2478 chtml20 = GET_CHTML20(pdoc);
2483 return chtml20->out;
2488 * It is a handler who processes the H2 tag.
2490 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2491 * destination is specified.
2492 * @param node [i] The H2 tag node is specified.
2493 * @return The conversion result is returned.
2496 s_chtml20_start_h2_tag(void *pdoc, Node *node)
2503 chtml20 = GET_CHTML20(pdoc);
2508 for (attr = qs_get_attr(doc,node);
2510 attr = qs_get_next_attr(doc,attr)) {
2513 name = qs_get_attr_name(doc,attr);
2514 value = qs_get_attr_value(doc,attr);
2515 if (STRCASEEQ('a','A',"align", name)) {
2516 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2525 return chtml20->out;
2530 * It is a handler who processes the H2 tag.
2532 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2533 * destination is specified.
2534 * @param node [i] The H2 tag node is specified.
2535 * @return The conversion result is returned.
2538 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2544 chtml20 = GET_CHTML20(pdoc);
2549 return chtml20->out;
2554 * It is a handler who processes the H3 tag.
2556 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2557 * destination is specified.
2558 * @param node [i] The H3 tag node is specified.
2559 * @return The conversion result is returned.
2562 s_chtml20_start_h3_tag(void *pdoc, Node *node)
2569 chtml20 = GET_CHTML20(pdoc);
2574 for (attr = qs_get_attr(doc,node);
2576 attr = qs_get_next_attr(doc,attr)) {
2579 name = qs_get_attr_name(doc,attr);
2580 value = qs_get_attr_value(doc,attr);
2581 if (STRCASEEQ('a','A',"align", name)) {
2582 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2591 return chtml20->out;
2596 * It is a handler who processes the H3 tag.
2598 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2599 * destination is specified.
2600 * @param node [i] The H3 tag node is specified.
2601 * @return The conversion result is returned.
2604 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2610 chtml20 = GET_CHTML20(pdoc);
2615 return chtml20->out;
2620 * It is a handler who processes the H4 tag.
2622 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2623 * destination is specified.
2624 * @param node [i] The H4 tag node is specified.
2625 * @return The conversion result is returned.
2628 s_chtml20_start_h4_tag(void *pdoc, Node *node)
2635 chtml20 = GET_CHTML20(pdoc);
2640 for (attr = qs_get_attr(doc,node);
2642 attr = qs_get_next_attr(doc,attr)) {
2645 name = qs_get_attr_name(doc,attr);
2646 value = qs_get_attr_value(doc,attr);
2647 if (STRCASEEQ('a','A',"align", name)) {
2648 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2657 return chtml20->out;
2662 * It is a handler who processes the H4 tag.
2664 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2665 * destination is specified.
2666 * @param node [i] The H4 tag node is specified.
2667 * @return The conversion result is returned.
2670 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2676 chtml20 = GET_CHTML20(pdoc);
2681 return chtml20->out;
2686 * It is a handler who processes the H5 tag.
2688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2689 * destination is specified.
2690 * @param node [i] The H5 tag node is specified.
2691 * @return The conversion result is returned.
2694 s_chtml20_start_h5_tag(void *pdoc, Node *node)
2701 chtml20 = GET_CHTML20(pdoc);
2706 for (attr = qs_get_attr(doc,node);
2708 attr = qs_get_next_attr(doc,attr)) {
2711 name = qs_get_attr_name(doc,attr);
2712 value = qs_get_attr_value(doc,attr);
2713 if (STRCASEEQ('a','A',"align", name)) {
2714 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2723 return chtml20->out;
2728 * It is a handler who processes the H5 tag.
2730 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2731 * destination is specified.
2732 * @param node [i] The H5 tag node is specified.
2733 * @return The conversion result is returned.
2736 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2742 chtml20 = GET_CHTML20(pdoc);
2747 return chtml20->out;
2752 * It is a handler who processes the H6 tag.
2754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2755 * destination is specified.
2756 * @param node [i] The H6 tag node is specified.
2757 * @return The conversion result is returned.
2760 s_chtml20_start_h6_tag(void *pdoc, Node *node)
2767 chtml20 = GET_CHTML20(pdoc);
2772 for (attr = qs_get_attr(doc,node);
2774 attr = qs_get_next_attr(doc,attr)) {
2777 name = qs_get_attr_name(doc,attr);
2778 value = qs_get_attr_value(doc,attr);
2779 if (STRCASEEQ('a','A',"align", name)) {
2780 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2789 return chtml20->out;
2794 * It is a handler who processes the H6 tag.
2796 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2797 * destination is specified.
2798 * @param node [i] The H6 tag node is specified.
2799 * @return The conversion result is returned.
2802 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2808 chtml20 = GET_CHTML20(pdoc);
2813 return chtml20->out;
2818 * It is a handler who processes the PRE tag.
2820 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2821 * destination is specified.
2822 * @param node [i] The PRE tag node is specified.
2823 * @return The conversion result is returned.
2826 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2832 chtml20 = GET_CHTML20(pdoc);
2836 chtml20->pre_flag++;
2838 return chtml20->out;
2843 * It is a handler who processes the PRE tag.
2845 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2846 * destination is specified.
2847 * @param node [i] The PRE tag node is specified.
2848 * @return The conversion result is returned.
2851 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2857 chtml20 = GET_CHTML20(pdoc);
2862 chtml20->pre_flag--;
2864 return chtml20->out;
2869 * It is a handler who processes the P tag.
2871 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2872 * destination is specified.
2873 * @param node [i] The P tag node is specified.
2874 * @return The conversion result is returned.
2877 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2883 chtml20 = GET_CHTML20(pdoc);
2888 return chtml20->out;
2893 * It is a handler who processes the P tag.
2895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2896 * destination is specified.
2897 * @param node [i] The P tag node is specified.
2898 * @return The conversion result is returned.
2901 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2907 chtml20 = GET_CHTML20(pdoc);
2912 return chtml20->out;
2917 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2924 chtml20 = GET_CHTML20(pdoc);
2928 for (child = qs_get_child_node(doc, node);
2930 child = qs_get_next_node(doc, child)) {
2933 s_chtml20_chxjif_tag(pdoc, child);
2941 * It is a handler who processes the TEXTARE tag.
2943 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2944 * destination is specified.
2945 * @param node [i] The TEXTAREA tag node is specified.
2946 * @return The conversion result is returned.
2949 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2956 chtml20 = GET_CHTML20(pdoc);
2960 chtml20->textarea_flag++;
2962 for (attr = qs_get_attr(doc,node);
2964 attr = qs_get_next_attr(doc,attr)) {
2969 name = qs_get_attr_name(doc,attr);
2970 value = qs_get_attr_value(doc,attr);
2975 if (strcasecmp(name, "name") == 0) {
2984 if (strcasecmp(name, "rows") == 0) {
2993 if (strcasecmp(name, "cols") == 0) {
3005 return chtml20->out;
3010 * It is a handler who processes the TEXTAREA tag.
3012 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3013 * destination is specified.
3014 * @param node [i] The TEXTAREA tag node is specified.
3015 * @return The conversion result is returned.
3018 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3024 chtml20 = GET_CHTML20(pdoc);
3028 W_L("</textarea>\r\n");
3029 chtml20->textarea_flag--;
3031 return chtml20->out;
3036 s_chtml20_text_tag(void *pdoc, Node *child)
3048 chtml20 = GET_CHTML20(pdoc);
3052 textval = qs_get_node_value(doc,child);
3053 textval = qs_trim_string(doc->buf.pool, textval);
3054 if (strlen(textval) == 0)
3055 return chtml20->out;
3057 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3058 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3060 tdst = qs_alloc_zero_byte_string(r);
3061 memset(one_byte, 0, sizeof(one_byte));
3064 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3066 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
3068 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3072 if (is_sjis_kanji(textval[ii])) {
3073 one_byte[0] = textval[ii+0];
3074 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3075 one_byte[0] = textval[ii+1];
3076 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3080 if (chtml20->pre_flag) {
3081 one_byte[0] = textval[ii+0];
3082 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3085 if (chtml20->textarea_flag) {
3086 one_byte[0] = textval[ii+0];
3087 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3090 if (textval[ii] != '\r' && textval[ii] != '\n') {
3091 one_byte[0] = textval[ii+0];
3092 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3096 return chtml20->out;
3101 * It is a handler who processes the BLOCKQUOTE tag.
3103 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3104 * destination is specified.
3105 * @param node [i] The BLOCKQUOTE tag node is specified.
3106 * @return The conversion result is returned.
3109 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3113 chtml20 = GET_CHTML20(pdoc);
3115 W_L("<blockquote>");
3116 return chtml20->out;
3121 * It is a handler who processes the BLOCKQUOTE tag.
3123 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3124 * destination is specified.
3125 * @param node [i] The BLOCKQUOTE tag node is specified.
3126 * @return The conversion result is returned.
3129 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3134 chtml20 = GET_CHTML20(pdoc);
3136 W_L("</blockquote>");
3137 return chtml20->out;
3142 * It is a handler who processes the DIR tag.
3144 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3145 * destination is specified.
3146 * @param node [i] The DIR tag node is specified.
3147 * @return The conversion result is returned.
3150 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3154 chtml20 = GET_CHTML20(pdoc);
3157 return chtml20->out;
3162 * It is a handler who processes the DIR tag.
3164 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3165 * destination is specified.
3166 * @param node [i] The DIR tag node is specified.
3167 * @return The conversion result is returned.
3170 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3175 chtml20 = GET_CHTML20(pdoc);
3178 return chtml20->out;
3183 * It is a handler who processes the DL tag.
3185 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3186 * destination is specified.
3187 * @param node [i] The DL tag node is specified.
3188 * @return The conversion result is returned.
3191 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3195 chtml20 = GET_CHTML20(pdoc);
3198 return chtml20->out;
3203 * It is a handler who processes the DL tag.
3205 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3206 * destination is specified.
3207 * @param node [i] The DL tag node is specified.
3208 * @return The conversion result is returned.
3211 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3215 chtml20 = GET_CHTML20(pdoc);
3218 return chtml20->out;
3223 * It is a handter who processes the DT tag.
3225 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3226 * destination is specified.
3227 * @param node [i] The DT tag node is specified.
3228 * @return The conversion result is returned.
3231 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3235 chtml20 = GET_CHTML20(pdoc);
3238 return chtml20->out;
3243 * It is a handter who processes the DT tag.
3245 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3246 * destination is specified.
3247 * @param node [i] The DT tag node is specified.
3248 * @return The conversion result is returned.
3251 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3254 chtml20 = GET_CHTML20(pdoc);
3255 return chtml20->out;
3260 * It is a handder who processes the DD tag.
3262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3263 * destination is specified.
3264 * @param node [i] The DD tag node is specified.
3265 * @return The conversion result is returned.
3268 s_chtml20_start_dd_tag(void *pdoc, Node *UNUSED(child))
3272 chtml20 = GET_CHTML20(pdoc);
3275 return chtml20->out;
3280 * It is a handder who processes the DD tag.
3282 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3283 * destination is specified.
3284 * @param node [i] The DD tag node is specified.
3285 * @return The conversion result is returned.
3288 s_chtml20_end_dd_tag(void *pdoc, Node *UNUSED(child))
3291 chtml20 = GET_CHTML20(pdoc);
3292 return chtml20->out;