2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_chtml20.h"
18 #include "chxj_hdml.h"
19 #include "chxj_str_util.h"
20 #include "chxj_dump.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_qr_code.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
27 #define GET_CHTML20(X) ((chtml20_t*)(X))
28 #define W20_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
29 #define W20_V(X) do { chtml20->out = (X) ? BUFFERED_WRITE_VALUE(chtml20->out, &doc->buf, (X)) \
30 : BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, ""); } while(0)
32 static char *s_chtml20_start_html_tag (void *pdoc, Node *node);
33 static char *s_chtml20_end_html_tag (void *pdoc, Node *node);
34 static char *s_chtml20_start_meta_tag (void *pdoc, Node *node);
35 static char *s_chtml20_end_meta_tag (void *pdoc, Node *node);
36 static char *s_chtml20_start_textarea_tag(void *pdoc, Node *node);
37 static char *s_chtml20_end_textarea_tag (void *pdoc, Node *node);
38 static char *s_chtml20_start_p_tag (void *pdoc, Node *node);
39 static char *s_chtml20_end_p_tag (void *pdoc, Node *node);
40 static char *s_chtml20_start_pre_tag (void *pdoc, Node *node);
41 static char *s_chtml20_end_pre_tag (void *pdoc, Node *node);
42 static char *s_chtml20_start_h1_tag (void *pdoc, Node *node);
43 static char *s_chtml20_end_h1_tag (void *pdoc, Node *node);
44 static char *s_chtml20_start_h2_tag (void *pdoc, Node *node);
45 static char *s_chtml20_end_h2_tag (void *pdoc, Node *node);
46 static char *s_chtml20_start_h3_tag (void *pdoc, Node *node);
47 static char *s_chtml20_end_h3_tag (void *pdoc, Node *node);
48 static char *s_chtml20_start_h4_tag (void *pdoc, Node *node);
49 static char *s_chtml20_end_h4_tag (void *pdoc, Node *node);
50 static char *s_chtml20_start_h5_tag (void *pdoc, Node *node);
51 static char *s_chtml20_end_h5_tag (void *pdoc, Node *node);
52 static char *s_chtml20_start_h6_tag (void *pdoc, Node *node);
53 static char *s_chtml20_end_h6_tag (void *pdoc, Node *node);
54 static char *s_chtml20_start_ul_tag (void *pdoc, Node *node);
55 static char *s_chtml20_end_ul_tag (void *pdoc, Node *node);
56 static char *s_chtml20_start_ol_tag (void *pdoc, Node *node);
57 static char *s_chtml20_end_ol_tag (void *pdoc, Node *node);
58 static char *s_chtml20_start_li_tag (void *pdoc, Node *node);
59 static char *s_chtml20_end_li_tag (void *pdoc, Node *node);
60 static char *s_chtml20_start_head_tag (void *pdoc, Node *node);
61 static char *s_chtml20_end_head_tag (void *pdoc, Node *node);
62 static char *s_chtml20_start_title_tag (void *pdoc, Node *node);
63 static char *s_chtml20_end_title_tag (void *pdoc, Node *node);
64 static char *s_chtml20_start_base_tag (void *pdoc, Node *node);
65 static char *s_chtml20_end_base_tag (void *pdoc, Node *node);
66 static char *s_chtml20_start_body_tag (void *pdoc, Node *node);
67 static char *s_chtml20_end_body_tag (void *pdoc, Node *node);
68 static char *s_chtml20_start_a_tag (void *pdoc, Node *node);
69 static char *s_chtml20_end_a_tag (void *pdoc, Node *node);
70 static char *s_chtml20_start_br_tag (void *pdoc, Node *node);
71 static char *s_chtml20_end_br_tag (void *pdoc, Node *node);
72 static char *s_chtml20_start_tr_tag (void *pdoc, Node *node);
73 static char *s_chtml20_end_tr_tag (void *pdoc, Node *node);
74 static char *s_chtml20_start_font_tag (void *pdoc, Node *node);
75 static char *s_chtml20_end_font_tag (void *pdoc, Node *node);
76 static char *s_chtml20_start_form_tag (void *pdoc, Node *node);
77 static char *s_chtml20_end_form_tag (void *pdoc, Node *node);
78 static char *s_chtml20_start_input_tag (void *pdoc, Node *node);
79 static char *s_chtml20_end_input_tag (void *pdoc, Node *node);
80 static char *s_chtml20_start_center_tag (void *pdoc, Node *node);
81 static char *s_chtml20_end_center_tag (void *pdoc, Node *node);
82 static char *s_chtml20_start_hr_tag (void *pdoc, Node *node);
83 static char *s_chtml20_end_hr_tag (void *pdoc, Node *node);
84 static char *s_chtml20_start_img_tag (void *pdoc, Node *node);
85 static char *s_chtml20_end_img_tag (void *pdoc, Node *node);
86 static char *s_chtml20_start_select_tag (void *pdoc, Node *node);
87 static char *s_chtml20_end_select_tag (void *pdoc, Node *node);
88 static char *s_chtml20_start_option_tag (void *pdoc, Node *node);
89 static char *s_chtml20_end_option_tag (void *pdoc, Node *node);
90 static char *s_chtml20_start_div_tag (void *pdoc, Node *node);
91 static char *s_chtml20_end_div_tag (void *pdoc, Node *node);
92 static char *s_chtml20_start_blockquote_tag(void *pdoc, Node *node);
93 static char *s_chtml20_end_blockquote_tag (void *pdoc, Node *node);
94 static char *s_chtml20_start_dir_tag (void *pdoc, Node *node);
95 static char *s_chtml20_end_dir_tag (void *pdoc, Node *node);
96 static char *s_chtml20_start_dl_tag (void *pdoc, Node *node);
97 static char *s_chtml20_end_dl_tag (void *pdoc, Node *node);
98 static char *s_chtml20_start_dt_tag (void *pdoc, Node *node);
99 static char *s_chtml20_end_dt_tag (void *pdoc, Node *node);
101 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
103 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
105 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
106 static char *s_chtml20_text_tag(void *pdoc, Node *node);
109 tag_handler chtml20_handler[] = {
112 s_chtml20_start_html_tag,
113 s_chtml20_end_html_tag,
117 s_chtml20_start_meta_tag,
118 s_chtml20_end_meta_tag,
122 s_chtml20_start_textarea_tag,
123 s_chtml20_end_textarea_tag,
127 s_chtml20_start_p_tag,
132 s_chtml20_start_pre_tag,
133 s_chtml20_end_pre_tag,
137 s_chtml20_start_ul_tag,
138 s_chtml20_end_ul_tag,
142 s_chtml20_start_li_tag,
143 s_chtml20_end_li_tag,
147 s_chtml20_start_ol_tag,
148 s_chtml20_end_ol_tag,
152 s_chtml20_start_h1_tag,
153 s_chtml20_end_h1_tag,
157 s_chtml20_start_h2_tag,
158 s_chtml20_end_h2_tag,
162 s_chtml20_start_h3_tag,
163 s_chtml20_end_h3_tag,
167 s_chtml20_start_h4_tag,
168 s_chtml20_end_h4_tag,
172 s_chtml20_start_h5_tag,
173 s_chtml20_end_h5_tag,
177 s_chtml20_start_h6_tag,
178 s_chtml20_end_h6_tag,
182 s_chtml20_start_head_tag,
183 s_chtml20_end_head_tag,
187 s_chtml20_start_title_tag,
188 s_chtml20_end_title_tag,
192 s_chtml20_start_base_tag,
193 s_chtml20_end_base_tag,
197 s_chtml20_start_body_tag,
198 s_chtml20_end_body_tag,
202 s_chtml20_start_a_tag,
207 s_chtml20_start_br_tag,
208 s_chtml20_end_br_tag,
217 s_chtml20_start_tr_tag,
218 s_chtml20_end_tr_tag,
232 s_chtml20_start_font_tag,
233 s_chtml20_end_font_tag,
237 s_chtml20_start_form_tag,
238 s_chtml20_end_form_tag,
242 s_chtml20_start_input_tag,
243 s_chtml20_end_input_tag,
247 s_chtml20_start_center_tag,
248 s_chtml20_end_center_tag,
252 s_chtml20_start_hr_tag,
253 s_chtml20_end_hr_tag,
257 s_chtml20_start_img_tag,
258 s_chtml20_end_img_tag,
262 s_chtml20_start_select_tag,
263 s_chtml20_end_select_tag,
267 s_chtml20_start_option_tag,
268 s_chtml20_end_option_tag,
272 s_chtml20_start_div_tag,
273 s_chtml20_end_div_tag,
277 s_chtml20_chxjif_tag,
322 s_chtml20_start_dt_tag,
323 s_chtml20_end_dt_tag,
337 s_chtml20_start_blockquote_tag,
338 s_chtml20_end_blockquote_tag,
342 s_chtml20_start_dir_tag,
343 s_chtml20_end_dir_tag,
347 s_chtml20_start_dl_tag,
348 s_chtml20_end_dl_tag,
368 * converts from CHTML5.0 to CHTML2.0.
370 * @param r [i] Requet_rec is appointed.
371 * @param spec [i] The result of the device specification processing which
372 * was done in advance is appointed.
373 * @param src [i] The character string before the converting is appointed.
374 * @return The character string after the converting is returned.
377 chxj_exchange_chtml20(
383 chxjconvrule_entry *entryp,
392 /*--------------------------------------------------------------------------*/
394 /*--------------------------------------------------------------------------*/
396 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
398 DBG(r,"i found qrcode xml");
401 DBG(r,"not found qrcode xml");
403 /*--------------------------------------------------------------------------*/
404 /* The CHTML structure is initialized. */
405 /*--------------------------------------------------------------------------*/
406 s_init_chtml20(&chtml20, &doc, r, spec);
409 chtml20.entryp = entryp;
410 chtml20.cookie = cookie;
412 chxj_set_content_type(r, "text/html; charset=Windows-31J");
414 /*--------------------------------------------------------------------------*/
415 /* The character string of the input is analyzed. */
416 /*--------------------------------------------------------------------------*/
417 qs_init_malloc(&doc);
418 qs_init_root_node(&doc);
420 ss = apr_pcalloc(r->pool, srclen + 1);
421 memset(ss, 0, srclen + 1);
422 memcpy(ss, src, srclen);
425 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
428 qs_parse_string(&doc,ss, strlen(ss));
430 chxj_buffered_write_init(r->pool, &doc.buf);
431 /*--------------------------------------------------------------------------*/
432 /* It converts it from CHTML to CHTML. */
433 /*--------------------------------------------------------------------------*/
434 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
435 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
436 dst = apr_pstrdup(r->pool, chtml20.out);
437 chxj_buffered_write_terminate(&doc.buf);
439 qs_all_free(&doc,QX_LOGMARK);
442 return apr_pstrdup(r->pool,ss);
445 if (strlen(dst) == 0) {
446 dst = apr_psprintf(r->pool, "\n");
449 *dstlen = strlen(dst);
452 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
459 * The CHTML structure is initialized.
461 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
462 * initialized is specified.
463 * @param doc [i] The Doc structure that should be set to the initialized
464 * HDML structure is specified.
465 * @param r [i] To use POOL, the pointer to request_rec is specified.
466 * @param spec [i] The pointer to the device_table
469 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
471 memset(doc, 0, sizeof(Doc));
472 memset(chtml20, 0, sizeof(chtml20_t));
476 chtml20->spec = spec;
477 chtml20->out = qs_alloc_zero_byte_string(r);
478 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
480 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
485 * Corresponding EMOJI to a current character-code is retrieved.
486 * The substitution character string is stored in the rslt pointer if agreeing.
488 * @param chtml20 [i] The pointer to the CHTML structure is specified.
489 * @param txt [i] The character string to want to examine whether it is
490 * EMOJI is specified.
491 * @param rslt [o] The pointer to the pointer that stores the result is
493 * @return When corresponding EMOJI exists, it returns it excluding 0.
496 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
503 spec = chtml20->spec;
509 DBG(r,"spec is NULL");
511 for (ee = chtml20->conf->emoji;
515 if (ee->imode == NULL) {
516 DBG(r,"emoji->imode is NULL");
520 if (ee->imode->string != NULL
521 && strlen(ee->imode->string) > 0
522 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
523 if (spec == NULL || spec->emoji_type == NULL) {
524 *rslt = apr_palloc(r->pool, 3);
525 (*rslt)[0] = ee->imode->hex1byte & 0xff;
526 (*rslt)[1] = ee->imode->hex2byte & 0xff;
528 return strlen(ee->imode->string);
540 * It is a handler who processes the HTML tag.
542 * @param pdoc [i/o] The pointer to the CHTML structure at the output
543 * destination is specified.
544 * @param node [i] The HTML tag node is specified.
545 * @return The conversion result is returned.
548 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
554 chtml20 = GET_CHTML20(pdoc);
558 /*--------------------------------------------------------------------------*/
560 /*--------------------------------------------------------------------------*/
567 * It is a handler who processes the HTML tag.
569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
570 * destination is specified.
571 * @param node [i] The HTML tag node is specified.
572 * @return The conversion result is returned.
575 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
581 chtml20 = GET_CHTML20(pdoc);
591 * It is a handler who processes the META tag.
593 * @param pdoc [i/o] The pointer to the CHTML structure at the output
594 * destination is specified.
595 * @param node [i] The META tag node is specified.
596 * @return The conversion result is returned.
599 s_chtml20_start_meta_tag(void *pdoc, Node *node)
605 int content_type_flag;
608 chtml20 = GET_CHTML20(pdoc);
612 content_type_flag = 0;
616 /*--------------------------------------------------------------------------*/
618 /*--------------------------------------------------------------------------*/
619 for (attr = qs_get_attr(doc,node);
621 attr = qs_get_next_attr(doc,attr)) {
626 name = qs_get_attr_name(doc,attr);
627 value = qs_get_attr_value(doc,attr);
632 if (strcasecmp(name, "http-equiv") == 0) {
633 /*----------------------------------------------------------------------*/
635 /*----------------------------------------------------------------------*/
636 W20_L(" http-equiv=\"");
639 if (STRCASEEQ('c','C',"content-type", value)) {
640 content_type_flag = 1;
642 if (STRCASEEQ('r','R',"refresh", value)) {
650 if (strcasecmp(name, "content") == 0) {
651 if (content_type_flag) {
654 W20_L("=\"text/html; charset=Windows-31J\"");
656 else if (refresh_flag) {
657 char *buf = apr_pstrdup(r->pool, value);
661 url = strchr(buf, ';');
663 sec = apr_pstrdup(r->pool, buf);
666 url = chxj_encoding_parameter(r, url);
667 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
697 * It is a handler who processes the META tag.
699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
700 * destination is specified.
701 * @param node [i] The META tag node is specified.
702 * @return The conversion result is returned.
705 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
709 chtml20 = GET_CHTML20(pdoc);
716 * It is a handler who processes the HEAD tag.
718 * @param pdoc [i/o] The pointer to the CHTML structure at the output
719 * destination is specified.
720 * @param node [i] The HEAD tag node is specified.
721 * @return The conversion result is returned.
724 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
730 chtml20 = GET_CHTML20(pdoc);
740 * It is a handler who processes the HEAD tag.
742 * @param pdoc [i/o] The pointer to the CHTML structure at the output
743 * destination is specified.
744 * @param node [i] The HEAD tag node is specified.
745 * @return The conversion result is returned.
748 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
754 chtml20 = GET_CHTML20(pdoc);
764 * It is a handler who processes the TITLE tag.
766 * @param pdoc [i/o] The pointer to the CHTML structure at the output
767 * destination is specified.
768 * @param node [i] The TITLE tag node is specified.
769 * @return The conversion result is returned.
772 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
778 chtml20 = GET_CHTML20(pdoc);
788 * It is a handler who processes the TITLE tag.
790 * @param pdoc [i/o] The pointer to the CHTML structure at the output
791 * destination is specified.
792 * @param node [i] The TITLE tag node is specified.
793 * @return The conversion result is returned.
796 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
802 chtml20 = GET_CHTML20(pdoc);
806 W20_L("</title>\r\n");
812 * It is a handler who processes the BASE tag.
814 * @param pdoc [i/o] The pointer to the CHTML structure at the output
815 * destination is specified.
816 * @param node [i] The BASE tag node is specified.
817 * @return The conversion result is returned.
820 s_chtml20_start_base_tag(void *pdoc, Node *node)
827 chtml20 = GET_CHTML20(pdoc);
832 /*--------------------------------------------------------------------------*/
834 /*--------------------------------------------------------------------------*/
835 for (attr = qs_get_attr(doc,node);
837 attr = qs_get_next_attr(doc,attr)) {
842 name = qs_get_attr_name(doc,attr);
843 value = qs_get_attr_value(doc,attr);
845 if (STRCASEEQ('h','H',"href", name)) {
857 * It is a handler who processes the BASE tag.
859 * @param pdoc [i/o] The pointer to the CHTML structure at the output
860 * destination is specified.
861 * @param node [i] The BASE tag node is specified.
862 * @return The conversion result is returned.
865 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
871 chtml20 = GET_CHTML20(pdoc);
880 * It is a handler who processes the BODY tag.
882 * @param pdoc [i/o] The pointer to the CHTML structure at the output
883 * destination is specified.
884 * @param node [i] The BODY tag node is specified.
885 * @return The conversion result is returned.
888 s_chtml20_start_body_tag(void *pdoc, Node *node)
895 chtml20 = GET_CHTML20(pdoc);
900 /*--------------------------------------------------------------------------*/
902 /*--------------------------------------------------------------------------*/
903 for (attr = qs_get_attr(doc,node);
905 attr = qs_get_next_attr(doc,attr)) {
909 name = qs_get_attr_name(doc,attr);
910 value = qs_get_attr_value(doc,attr);
915 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
916 /*----------------------------------------------------------------------*/
918 /*----------------------------------------------------------------------*/
919 W20_L(" bgcolor=\"");
927 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
928 /*----------------------------------------------------------------------*/
930 /*----------------------------------------------------------------------*/
939 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
940 /*----------------------------------------------------------------------*/
942 /*----------------------------------------------------------------------*/
951 if (strcasecmp(name, "alink") == 0) {
952 /*----------------------------------------------------------------------*/
954 /*----------------------------------------------------------------------*/
961 if (strcasecmp(name, "vlink") == 0) {
962 /*----------------------------------------------------------------------*/
964 /*----------------------------------------------------------------------*/
979 * It is a handler who processes the BODY tag.
981 * @param pdoc [i/o] The pointer to the CHTML structure at the output
982 * destination is specified.
983 * @param node [i] The BODY tag node is specified.
984 * @return The conversion result is returned.
987 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
993 chtml20 = GET_CHTML20(pdoc);
1003 * It is a handler who processes the A tag.
1005 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1006 * destination is specified.
1007 * @param node [i] The A tag node is specified.
1008 * @return The conversion result is returned.
1011 s_chtml20_start_a_tag(void *pdoc, Node *node)
1018 chtml20 = GET_CHTML20(pdoc);
1023 /*--------------------------------------------------------------------------*/
1024 /* Get Attributes */
1025 /*--------------------------------------------------------------------------*/
1026 for (attr = qs_get_attr(doc,node);
1028 attr = qs_get_next_attr(doc,attr)) {
1033 name = qs_get_attr_name(doc,attr);
1034 value = qs_get_attr_value(doc,attr);
1039 if (strcasecmp(name, "name") == 0) {
1040 /*--------------------------------------------------------------------*/
1042 /*--------------------------------------------------------------------*/
1051 if (strcasecmp(name, "href") == 0) {
1052 /*--------------------------------------------------------------------*/
1054 /*--------------------------------------------------------------------*/
1055 value = chxj_encoding_parameter(r, value);
1056 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1065 if (strcasecmp(name, "accesskey") == 0) {
1066 /*--------------------------------------------------------------------*/
1068 /*--------------------------------------------------------------------*/
1069 W20_L(" accesskey=\"");
1077 if (strcasecmp(name, "cti") == 0) {
1078 /*--------------------------------------------------------------------*/
1080 /*--------------------------------------------------------------------*/
1089 if (strcasecmp(name, "ijam") == 0) {
1090 /*--------------------------------------------------------------------*/
1092 /*--------------------------------------------------------------------*/
1096 if (strcasecmp(name, "ista") == 0) {
1097 /*--------------------------------------------------------------------*/
1099 /*--------------------------------------------------------------------*/
1103 if (strcasecmp(name, "ilet") == 0) {
1104 /*--------------------------------------------------------------------*/
1106 /*--------------------------------------------------------------------*/
1110 if (strcasecmp(name, "iswf") == 0) {
1111 /*--------------------------------------------------------------------*/
1113 /*--------------------------------------------------------------------*/
1117 if (strcasecmp(name, "irst") == 0) {
1118 /*--------------------------------------------------------------------*/
1120 /*--------------------------------------------------------------------*/
1127 if (strcasecmp(name, "utn") == 0) {
1128 /*--------------------------------------------------------------------*/
1130 /*--------------------------------------------------------------------*/
1137 if (strcasecmp(name, "telbook") == 0) {
1138 /*--------------------------------------------------------------------*/
1140 /*--------------------------------------------------------------------*/
1147 if (strcasecmp(name, "kana") == 0) {
1148 /*--------------------------------------------------------------------*/
1150 /*--------------------------------------------------------------------*/
1157 if (strcasecmp(name, "email") == 0) {
1158 /*--------------------------------------------------------------------*/
1160 /*--------------------------------------------------------------------*/
1170 return chtml20->out;
1175 * It is a handler who processes the A tag.
1177 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1178 * destination is specified.
1179 * @param node [i] The A tag node is specified.
1180 * @return The conversion result is returned.
1183 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1189 chtml20 = GET_CHTML20(pdoc);
1194 return chtml20->out;
1199 * It is a handler who processes the BR tag.
1201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1202 * destination is specified.
1203 * @param node [i] The BR tag node is specified.
1204 * @return The conversion result is returned.
1207 s_chtml20_start_br_tag(void *pdoc, Node *node)
1214 chtml20 = GET_CHTML20(pdoc);
1219 /*--------------------------------------------------------------------------*/
1220 /* Get Attributes */
1221 /*--------------------------------------------------------------------------*/
1222 for (attr = qs_get_attr(doc,node);
1224 attr = qs_get_next_attr(doc,attr)) {
1228 name = qs_get_attr_name(doc,attr);
1229 value = qs_get_attr_value(doc,attr);
1231 if (STRCASEEQ('c','C',"clear",name)) {
1232 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1240 return chtml20->out;
1245 * It is a handler who processes the BR tag.
1247 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1248 * destination is specified.
1249 * @param node [i] The BR tag node is specified.
1250 * @return The conversion result is returned.
1253 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1259 chtml20 = GET_CHTML20(pdoc);
1263 return chtml20->out;
1268 * It is a handler who processes the TR tag.
1270 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1271 * destination is specified.
1272 * @param node [i] The TR tag node is specified.
1273 * @return The conversion result is returned.
1276 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1282 chtml20 = GET_CHTML20(pdoc);
1286 return chtml20->out;
1291 * It is a handler who processes the TR tag.
1293 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1294 * destination is specified.
1295 * @param node [i] The TR tag node is specified.
1296 * @return The conversion result is returned.
1299 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1305 chtml20 = GET_CHTML20(pdoc);
1310 return chtml20->out;
1315 * It is a handler who processes the FONT tag.
1317 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1318 * destination is specified.
1319 * @param node [i] The FONT tag node is specified.
1320 * @return The conversion result is returned.
1323 s_chtml20_start_font_tag(void *pdoc, Node *node)
1330 chtml20 = GET_CHTML20(pdoc);
1336 /*--------------------------------------------------------------------------*/
1337 /* Get Attributes */
1338 /*--------------------------------------------------------------------------*/
1339 for (attr = qs_get_attr(doc,node);
1341 attr = qs_get_next_attr(doc,attr)) {
1346 name = qs_get_attr_name(doc,attr);
1347 value = qs_get_attr_value(doc,attr);
1352 if (strcasecmp(name, "color") == 0) {
1361 if (strcasecmp(name, "size") == 0) {
1362 /*--------------------------------------------------------------------*/
1364 /*--------------------------------------------------------------------*/
1374 return chtml20->out;
1379 * It is a handler who processes the FONT tag.
1381 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1382 * destination is specified.
1383 * @param node [i] The FONT tag node is specified.
1384 * @return The conversion result is returned.
1387 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1393 chtml20 = GET_CHTML20(pdoc);
1398 return chtml20->out;
1403 * It is a handler who processes the FORM tag.
1405 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1406 * destination is specified.
1407 * @param node [i] The FORM tag node is specified.
1408 * @return The conversion result is returned.
1411 s_chtml20_start_form_tag(void *pdoc, Node *node)
1418 chtml20 = GET_CHTML20(pdoc);
1423 /*--------------------------------------------------------------------------*/
1424 /* Get Attributes */
1425 /*--------------------------------------------------------------------------*/
1426 for (attr = qs_get_attr(doc,node);
1428 attr = qs_get_next_attr(doc,attr)) {
1433 name = qs_get_attr_name(doc,attr);
1434 value = qs_get_attr_value(doc,attr);
1439 if (strcasecmp(name, "action") == 0) {
1440 /*--------------------------------------------------------------------*/
1442 /*--------------------------------------------------------------------*/
1443 value = chxj_encoding_parameter(r, value);
1444 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1446 W20_L(" action=\"");
1454 if (strcasecmp(name, "method") == 0) {
1455 /*--------------------------------------------------------------------*/
1457 /*--------------------------------------------------------------------*/
1458 W20_L(" method=\"");
1466 if (strcasecmp(name, "utn") == 0) {
1467 /*--------------------------------------------------------------------*/
1469 /*--------------------------------------------------------------------*/
1479 return chtml20->out;
1484 * It is a handler who processes the FORM tag.
1486 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1487 * destination is specified.
1488 * @param node [i] The FORM tag node is specified.
1489 * @return The conversion result is returned.
1492 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1498 chtml20 = GET_CHTML20(pdoc);
1503 return chtml20->out;
1508 * It is a handler who processes the INPUT tag.
1510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1511 * destination is specified.
1512 * @param node [i] The INPUT tag node is specified.
1513 * @return The conversion result is returned.
1516 s_chtml20_start_input_tag(void *pdoc, Node *node)
1521 char *max_length = NULL;
1525 char *istyle = NULL;
1527 char *checked = NULL;
1528 char *accesskey = NULL;
1530 chtml20 = GET_CHTML20(pdoc);
1536 /*--------------------------------------------------------------------------*/
1537 /* Get Attributes */
1538 /*--------------------------------------------------------------------------*/
1540 type = qs_get_type_attr(doc, node, r);
1541 name = qs_get_name_attr(doc, node, r);
1542 value = qs_get_value_attr(doc,node,r);
1543 istyle = qs_get_istyle_attr(doc,node,r);
1544 max_length = qs_get_maxlength_attr(doc,node,r);
1545 checked = qs_get_checked_attr(doc,node,r);
1546 accesskey = qs_get_accesskey_attr(doc, node, r);
1547 size = qs_get_size_attr(doc, node, r);
1574 W20_L(" accesskey=\"");
1580 /*------------------------------------------------------------------------*/
1582 /*------------------------------------------------------------------------*/
1583 W20_L(" istyle=\"");
1588 /*--------------------------------------------------------------------------*/
1589 /* The figure is default for the password. */
1590 /*--------------------------------------------------------------------------*/
1592 if (chxj_chk_numeric(max_length) != 0)
1593 max_length = apr_psprintf(doc->buf.pool, "0");
1594 if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
1595 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1599 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1608 return chtml20->out;
1613 * It is a handler who processes the INPUT tag.
1615 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1616 * destination is specified.
1617 * @param node [i] The INPUT tag node is specified.
1618 * @return The conversion result is returned.
1621 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1627 chtml20 = GET_CHTML20(pdoc);
1631 return chtml20->out;
1636 * It is a handler who processes the CENTER tag.
1638 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1639 * destination is specified.
1640 * @param node [i] The CENTER tag node is specified.
1641 * @return The conversion result is returned.
1644 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1650 chtml20 = GET_CHTML20(pdoc);
1655 return chtml20->out;
1660 * It is a handler who processes the CENTER tag.
1662 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1663 * destination is specified.
1664 * @param node [i] The CENTER tag node is specified.
1665 * @return The conversion result is returned.
1668 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1674 chtml20 = GET_CHTML20(pdoc);
1679 return chtml20->out;
1684 * It is a handler who processes the UL tag.
1686 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1687 * destination is specified.
1688 * @param node [i] The UL tag node is specified.
1689 * @return The conversion result is returned.
1692 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1698 chtml20 = GET_CHTML20(pdoc);
1703 return chtml20->out;
1708 * It is a handler who processes the UL tag.
1710 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1711 * destination is specified.
1712 * @param node [i] The UL tag node is specified.
1713 * @return The conversion result is returned.
1716 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1722 chtml20 = GET_CHTML20(pdoc);
1727 return chtml20->out;
1732 * It is a handler who processes the OL tag.
1734 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1735 * destination is specified.
1736 * @param node [i] The OL tag node is specified.
1737 * @return The conversion result is returned.
1740 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1746 chtml20 = GET_CHTML20(pdoc);
1751 return chtml20->out;
1756 * It is a handler who processes the OL tag.
1758 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1759 * destination is specified.
1760 * @param node [i] The OL tag node is specified.
1761 * @return The conversion result is returned.
1764 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1770 chtml20 = GET_CHTML20(pdoc);
1775 return chtml20->out;
1780 * It is a handler who processes the LI tag.
1782 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1783 * destination is specified.
1784 * @param node [i] The LI tag node is specified.
1785 * @return The conversion result is returned.
1788 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1794 chtml20 = GET_CHTML20(pdoc);
1799 return chtml20->out;
1804 * It is a handler who processes the LI tag.
1806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1807 * destination is specified.
1808 * @param node [i] The LI tag node is specified.
1809 * @return The conversion result is returned.
1812 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1814 chtml20_t *chtml20 = GET_CHTML20(pdoc);
1815 return chtml20->out;
1820 * It is a handler who processes the HR tag.
1822 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1823 * destination is specified.
1824 * @param node [i] The HR tag node is specified.
1825 * @return The conversion result is returned.
1828 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1835 chtml20 = GET_CHTML20(pdoc);
1841 for (attr = qs_get_attr(doc,node);
1843 attr = qs_get_next_attr(doc,attr)) {
1848 name = qs_get_attr_name(doc,attr);
1849 value = qs_get_attr_value(doc,attr);
1854 if (strcasecmp(name, "align") == 0) {
1855 /*--------------------------------------------------------------------*/
1857 /*--------------------------------------------------------------------*/
1866 if (strcasecmp(name, "size") == 0) {
1867 /*--------------------------------------------------------------------*/
1869 /*--------------------------------------------------------------------*/
1878 if (strcasecmp(name, "width") == 0) {
1879 /*--------------------------------------------------------------------*/
1881 /*--------------------------------------------------------------------*/
1890 if (strcasecmp(name, "noshade") == 0) {
1891 /*--------------------------------------------------------------------*/
1893 /*--------------------------------------------------------------------*/
1900 if (strcasecmp(name, "color") == 0) {
1901 /*--------------------------------------------------------------------*/
1903 /*--------------------------------------------------------------------*/
1913 return chtml20->out;
1918 * It is a handler who processes the HR tag.
1920 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1921 * destination is specified.
1922 * @param node [i] The HR tag node is specified.
1923 * @return The conversion result is returned.
1926 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1932 chtml20 = GET_CHTML20(pdoc);
1936 return chtml20->out;
1941 * It is a handler who processes the IMG tag.
1943 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1944 * destination is specified.
1945 * @param node [i] The IMG tag node is specified.
1946 * @return The conversion result is returned.
1949 s_chtml20_start_img_tag(void *pdoc, Node *node)
1955 #ifndef IMG_NOT_CONVERT_FILENAME
1959 chtml20 = GET_CHTML20(pdoc);
1963 #ifndef IMG_NOT_CONVERT_FILENAME
1964 spec = chtml20->spec;
1968 /*-------------------------------------------------------------------------*/
1969 /* Get Attributes */
1970 /*-------------------------------------------------------------------------*/
1971 for (attr = qs_get_attr(doc,node);
1973 attr = qs_get_next_attr(doc,attr)) {
1978 name = qs_get_attr_name(doc,attr);
1979 value = qs_get_attr_value(doc,attr);
1984 if (strcasecmp(name, "src") == 0) {
1985 /*-------------------------------------------------------------------*/
1987 /*-------------------------------------------------------------------*/
1988 #ifdef IMG_NOT_CONVERT_FILENAME
1989 value = chxj_encoding_parameter(r, value);
1990 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1992 value = apr_psprintf(doc->buf.pool,
1995 (strchr(value, '?')) ? '&' : '?',
1996 CHXJ_COOKIE_NOUPDATE_PARAM);
2002 value = chxj_img_conv(r, spec, value);
2003 value = chxj_encoding_parameter(r, value);
2004 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2006 value = apr_psprintf(doc->buf.pool,
2009 (strchr(value, '?')) ? '&' : '?',
2010 CHXJ_COOKIE_NOUPDATE_PARAM);
2021 if (strcasecmp(name, "align" ) == 0) {
2022 /*--------------------------------------------------------------------*/
2024 /*--------------------------------------------------------------------*/
2030 if (strcasecmp(name, "alt" ) == 0) {
2031 /*--------------------------------------------------------------------*/
2033 /*--------------------------------------------------------------------*/
2039 if (strcasecmp(name, "align" ) == 0) {
2040 /*--------------------------------------------------------------------*/
2042 /*--------------------------------------------------------------------*/
2049 if (strcasecmp(name, "width" ) == 0) {
2050 /*--------------------------------------------------------------------*/
2052 /*--------------------------------------------------------------------*/
2061 if (strcasecmp(name, "height") == 0) {
2062 /*--------------------------------------------------------------------*/
2064 /*--------------------------------------------------------------------*/
2065 W20_L(" height=\"");
2070 if (strcasecmp(name, "hspace") == 0) {
2071 /*--------------------------------------------------------------------*/
2073 /*--------------------------------------------------------------------*/
2074 W20_L(" hspace=\"");
2082 if (strcasecmp(name, "vspace") == 0) {
2083 /*--------------------------------------------------------------------*/
2085 /*--------------------------------------------------------------------*/
2086 W20_L(" vspace=\"");
2097 return chtml20->out;
2102 * It is a handler who processes the IMG tag.
2104 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2105 * destination is specified.
2106 * @param node [i] The IMG tag node is specified.
2107 * @return The conversion result is returned.
2110 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2116 chtml20 = GET_CHTML20(pdoc);
2120 return chtml20->out;
2125 * It is a handler who processes the SELECT tag.
2127 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2128 * destination is specified.
2129 * @param node [i] The SELECT tag node is specified.
2130 * @return The conversion result is returned.
2133 s_chtml20_start_select_tag(void *pdoc, Node *child)
2140 chtml20 = GET_CHTML20(pdoc);
2148 for (attr = qs_get_attr(doc,child);
2150 attr = qs_get_next_attr(doc,attr)) {
2155 nm = qs_get_attr_name(doc,attr);
2156 val = qs_get_attr_value(doc,attr);
2161 if (strcasecmp(nm, "size") == 0) {
2162 /*--------------------------------------------------------------------*/
2163 /* CHTML 1.0 version 2.0 */
2164 /*--------------------------------------------------------------------*/
2165 size = apr_pstrdup(doc->buf.pool, val);
2171 if (strcasecmp(nm, "name") == 0) {
2172 /*--------------------------------------------------------------------*/
2173 /* CHTML 1.0 version 2.0 */
2174 /*--------------------------------------------------------------------*/
2175 name = apr_pstrdup(doc->buf.pool, val);
2181 if (strcasecmp(nm, "multiple") == 0) {
2182 /*--------------------------------------------------------------------*/
2183 /* CHTML 1.0 version 2.0 */
2184 /*--------------------------------------------------------------------*/
2207 return chtml20->out;
2212 * It is a handler who processes the SELECT tag.
2214 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2215 * destination is specified.
2216 * @param node [i] The SELECT tag node is specified.
2217 * @return The conversion result is returned.
2220 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2226 chtml20 = GET_CHTML20(pdoc);
2230 W20_L("</select>\r\n");
2231 return chtml20->out;
2236 * It is a handler who processes the OPTION tag.
2238 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2239 * destination is specified.
2240 * @param node [i] The OPTION tag node is specified.
2241 * @return The conversion result is returned.
2244 s_chtml20_start_option_tag(void *pdoc, Node *child)
2251 chtml20 = GET_CHTML20(pdoc);
2255 char *selected = NULL;
2259 for (attr = qs_get_attr(doc,child);
2261 attr = qs_get_next_attr(doc,attr)) {
2266 nm = qs_get_attr_name(doc,attr);
2267 val = qs_get_attr_value(doc,attr);
2272 if (strcasecmp(nm, "selected") == 0) {
2273 /*--------------------------------------------------------------------*/
2274 /* CHTML 1.0 version 2.0 */
2275 /*--------------------------------------------------------------------*/
2276 selected = apr_pstrdup(doc->buf.pool, val);
2282 if (strcasecmp(nm, "value") == 0) {
2283 /*--------------------------------------------------------------------*/
2284 /* CHTML 1.0 version 2.0 */
2285 /*--------------------------------------------------------------------*/
2286 value = apr_pstrdup(doc->buf.pool, val);
2301 W20_L(" value=\"\"");
2305 W20_L(" selected ");
2308 return chtml20->out;
2313 * It is a handler who processes the OPTION tag.
2315 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2316 * destination is specified.
2317 * @param node [i] The OPTION tag node is specified.
2318 * @return The conversion result is returned.
2321 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2327 chtml20 = GET_CHTML20(pdoc);
2333 return chtml20->out;
2338 * It is a handler who processes the DIV tag.
2340 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2341 * destination is specified.
2342 * @param node [i] The DIV tag node is specified.
2343 * @return The conversion result is returned.
2346 s_chtml20_start_div_tag(void *pdoc, Node *child)
2353 chtml20 = GET_CHTML20(pdoc);
2361 for (attr = qs_get_attr(doc,child);
2363 attr = qs_get_next_attr(doc,attr)) {
2368 nm = qs_get_attr_name(doc,attr);
2369 val = qs_get_attr_value(doc,attr);
2371 if (STRCASEEQ('a','A', "align", nm)) {
2372 /*----------------------------------------------------------------------*/
2373 /* CHTML 1.0 (W3C version 3.2) */
2374 /*----------------------------------------------------------------------*/
2375 align = apr_pstrdup(doc->buf.pool, val);
2386 return chtml20->out;
2391 * It is a handler who processes the DIV tag.
2393 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2394 * destination is specified.
2395 * @param node [i] The DIV tag node is specified.
2396 * @return The conversion result is returned.
2399 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2405 chtml20 = GET_CHTML20(pdoc);
2409 W20_L("</div>\r\n");
2410 return chtml20->out;
2415 * It is a handler who processes the H1 tag.
2417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2418 * destination is specified.
2419 * @param node [i] The H1 tag node is specified.
2420 * @return The conversion result is returned.
2423 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2429 chtml20 = GET_CHTML20(pdoc);
2434 return chtml20->out;
2439 * It is a handler who processes the H1 tag.
2441 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2442 * destination is specified.
2443 * @param node [i] The H1 tag node is specified.
2444 * @return The conversion result is returned.
2447 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2453 chtml20 = GET_CHTML20(pdoc);
2458 return chtml20->out;
2463 * It is a handler who processes the H2 tag.
2465 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2466 * destination is specified.
2467 * @param node [i] The H2 tag node is specified.
2468 * @return The conversion result is returned.
2471 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2477 chtml20 = GET_CHTML20(pdoc);
2482 return chtml20->out;
2487 * It is a handler who processes the H2 tag.
2489 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2490 * destination is specified.
2491 * @param node [i] The H2 tag node is specified.
2492 * @return The conversion result is returned.
2495 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2501 chtml20 = GET_CHTML20(pdoc);
2506 return chtml20->out;
2511 * It is a handler who processes the H3 tag.
2513 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2514 * destination is specified.
2515 * @param node [i] The H3 tag node is specified.
2516 * @return The conversion result is returned.
2519 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2525 chtml20 = GET_CHTML20(pdoc);
2530 return chtml20->out;
2535 * It is a handler who processes the H3 tag.
2537 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2538 * destination is specified.
2539 * @param node [i] The H3 tag node is specified.
2540 * @return The conversion result is returned.
2543 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2549 chtml20 = GET_CHTML20(pdoc);
2554 return chtml20->out;
2559 * It is a handler who processes the H4 tag.
2561 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2562 * destination is specified.
2563 * @param node [i] The H4 tag node is specified.
2564 * @return The conversion result is returned.
2567 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2573 chtml20 = GET_CHTML20(pdoc);
2578 return chtml20->out;
2583 * It is a handler who processes the H4 tag.
2585 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2586 * destination is specified.
2587 * @param node [i] The H4 tag node is specified.
2588 * @return The conversion result is returned.
2591 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2597 chtml20 = GET_CHTML20(pdoc);
2602 return chtml20->out;
2607 * It is a handler who processes the H5 tag.
2609 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2610 * destination is specified.
2611 * @param node [i] The H5 tag node is specified.
2612 * @return The conversion result is returned.
2615 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2621 chtml20 = GET_CHTML20(pdoc);
2626 return chtml20->out;
2631 * It is a handler who processes the H5 tag.
2633 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2634 * destination is specified.
2635 * @param node [i] The H5 tag node is specified.
2636 * @return The conversion result is returned.
2639 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2645 chtml20 = GET_CHTML20(pdoc);
2650 return chtml20->out;
2655 * It is a handler who processes the H6 tag.
2657 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2658 * destination is specified.
2659 * @param node [i] The H6 tag node is specified.
2660 * @return The conversion result is returned.
2663 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2669 chtml20 = GET_CHTML20(pdoc);
2674 return chtml20->out;
2679 * It is a handler who processes the H6 tag.
2681 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The H6 tag node is specified.
2684 * @return The conversion result is returned.
2687 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2693 chtml20 = GET_CHTML20(pdoc);
2698 return chtml20->out;
2703 * It is a handler who processes the PRE tag.
2705 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2706 * destination is specified.
2707 * @param node [i] The PRE tag node is specified.
2708 * @return The conversion result is returned.
2711 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2717 chtml20 = GET_CHTML20(pdoc);
2721 chtml20->pre_flag++;
2723 return chtml20->out;
2728 * It is a handler who processes the PRE tag.
2730 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2731 * destination is specified.
2732 * @param node [i] The PRE tag node is specified.
2733 * @return The conversion result is returned.
2736 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2742 chtml20 = GET_CHTML20(pdoc);
2747 chtml20->pre_flag--;
2749 return chtml20->out;
2754 * It is a handler who processes the P tag.
2756 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2757 * destination is specified.
2758 * @param node [i] The P tag node is specified.
2759 * @return The conversion result is returned.
2762 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2768 chtml20 = GET_CHTML20(pdoc);
2773 return chtml20->out;
2778 * It is a handler who processes the P tag.
2780 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2781 * destination is specified.
2782 * @param node [i] The P tag node is specified.
2783 * @return The conversion result is returned.
2786 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2792 chtml20 = GET_CHTML20(pdoc);
2797 return chtml20->out;
2802 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2809 chtml20 = GET_CHTML20(pdoc);
2813 for (child = qs_get_child_node(doc, node);
2815 child = qs_get_next_node(doc, child)) {
2817 W20_V(child->otext);
2818 s_chtml20_chxjif_tag(pdoc, child);
2826 * It is a handler who processes the TEXTARE tag.
2828 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2829 * destination is specified.
2830 * @param node [i] The TEXTAREA tag node is specified.
2831 * @return The conversion result is returned.
2834 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2841 chtml20 = GET_CHTML20(pdoc);
2845 chtml20->textarea_flag++;
2846 W20_L("<textarea ");
2847 for (attr = qs_get_attr(doc,node);
2849 attr = qs_get_next_attr(doc,attr)) {
2854 name = qs_get_attr_name(doc,attr);
2855 value = qs_get_attr_value(doc,attr);
2860 if (strcasecmp(name, "name") == 0) {
2869 if (strcasecmp(name, "rows") == 0) {
2878 if (strcasecmp(name, "cols") == 0) {
2890 return chtml20->out;
2895 * It is a handler who processes the TEXTAREA tag.
2897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2898 * destination is specified.
2899 * @param node [i] The TEXTAREA tag node is specified.
2900 * @return The conversion result is returned.
2903 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2909 chtml20 = GET_CHTML20(pdoc);
2913 W20_L("</textarea>\r\n");
2914 chtml20->textarea_flag--;
2916 return chtml20->out;
2921 s_chtml20_text_tag(void *pdoc, Node *child)
2933 chtml20 = GET_CHTML20(pdoc);
2937 textval = qs_get_node_value(doc,child);
2938 textval = qs_trim_string(doc->buf.pool, textval);
2939 if (strlen(textval) == 0)
2940 return chtml20->out;
2942 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2943 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2945 tdst = qs_alloc_zero_byte_string(r);
2946 memset(one_byte, 0, sizeof(one_byte));
2949 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2951 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
2953 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2957 if (is_sjis_kanji(textval[ii])) {
2958 one_byte[0] = textval[ii+0];
2959 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2960 one_byte[0] = textval[ii+1];
2961 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2965 if (chtml20->pre_flag) {
2966 one_byte[0] = textval[ii+0];
2967 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2970 if (chtml20->textarea_flag) {
2971 one_byte[0] = textval[ii+0];
2972 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2975 if (textval[ii] != '\r' && textval[ii] != '\n') {
2976 one_byte[0] = textval[ii+0];
2977 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2981 return chtml20->out;
2986 * It is a handler who processes the BLOCKQUOTE tag.
2988 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2989 * destination is specified.
2990 * @param node [i] The BLOCKQUOTE tag node is specified.
2991 * @return The conversion result is returned.
2994 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2998 chtml20 = GET_CHTML20(pdoc);
3000 W20_L("<blockquote>");
3001 return chtml20->out;
3006 * It is a handler who processes the BLOCKQUOTE tag.
3008 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3009 * destination is specified.
3010 * @param node [i] The BLOCKQUOTE tag node is specified.
3011 * @return The conversion result is returned.
3014 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3019 chtml20 = GET_CHTML20(pdoc);
3021 W20_L("</blockquote>");
3022 return chtml20->out;
3027 * It is a handler who processes the DIR tag.
3029 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3030 * destination is specified.
3031 * @param node [i] The DIR tag node is specified.
3032 * @return The conversion result is returned.
3035 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3039 chtml20 = GET_CHTML20(pdoc);
3042 return chtml20->out;
3047 * It is a handler who processes the DIR tag.
3049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3050 * destination is specified.
3051 * @param node [i] The DIR tag node is specified.
3052 * @return The conversion result is returned.
3055 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3060 chtml20 = GET_CHTML20(pdoc);
3063 return chtml20->out;
3068 * It is a handler who processes the DL tag.
3070 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3071 * destination is specified.
3072 * @param node [i] The DL tag node is specified.
3073 * @return The conversion result is returned.
3076 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3080 chtml20 = GET_CHTML20(pdoc);
3083 return chtml20->out;
3088 * It is a handler who processes the DL tag.
3090 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3091 * destination is specified.
3092 * @param node [i] The DL tag node is specified.
3093 * @return The conversion result is returned.
3096 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3100 chtml20 = GET_CHTML20(pdoc);
3103 return chtml20->out;
3108 * It is a handter who processes the DT tag.
3110 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3111 * destination is specified.
3112 * @param node [i] The DT tag node is specified.
3113 * @return The conversion result is returned.
3116 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3120 chtml20 = GET_CHTML20(pdoc);
3123 return chtml20->out;
3128 * It is a handter who processes the DT tag.
3130 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3131 * destination is specified.
3132 * @param node [i] The DT tag node is specified.
3133 * @return The conversion result is returned.
3136 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3139 chtml20 = GET_CHTML20(pdoc);
3140 return chtml20->out;