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.
18 #include "chxj_chtml20.h"
19 #include "chxj_hdml.h"
20 #include "chxj_str_util.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
26 #define GET_CHTML20(X) ((chtml20_t*)(X))
28 static char *s_chtml20_start_html_tag (void *pdoc, Node *node);
29 static char *s_chtml20_end_html_tag (void *pdoc, Node *node);
30 static char *s_chtml20_start_meta_tag (void *pdoc, Node *node);
31 static char *s_chtml20_end_meta_tag (void *pdoc, Node *node);
32 static char *s_chtml20_start_textarea_tag(void *pdoc, Node *node);
33 static char *s_chtml20_end_textarea_tag (void *pdoc, Node *node);
34 static char *s_chtml20_start_p_tag (void *pdoc, Node *node);
35 static char *s_chtml20_end_p_tag (void *pdoc, Node *node);
36 static char *s_chtml20_start_pre_tag (void *pdoc, Node *node);
37 static char *s_chtml20_end_pre_tag (void *pdoc, Node *node);
38 static char *s_chtml20_start_h1_tag (void *pdoc, Node *node);
39 static char *s_chtml20_end_h1_tag (void *pdoc, Node *node);
40 static char *s_chtml20_start_h2_tag (void *pdoc, Node *node);
41 static char *s_chtml20_end_h2_tag (void *pdoc, Node *node);
42 static char *s_chtml20_start_h3_tag (void *pdoc, Node *node);
43 static char *s_chtml20_end_h3_tag (void *pdoc, Node *node);
44 static char *s_chtml20_start_h4_tag (void *pdoc, Node *node);
45 static char *s_chtml20_end_h4_tag (void *pdoc, Node *node);
46 static char *s_chtml20_start_h5_tag (void *pdoc, Node *node);
47 static char *s_chtml20_end_h5_tag (void *pdoc, Node *node);
48 static char *s_chtml20_start_h6_tag (void *pdoc, Node *node);
49 static char *s_chtml20_end_h6_tag (void *pdoc, Node *node);
50 static char *s_chtml20_start_ul_tag (void *pdoc, Node *node);
51 static char *s_chtml20_end_ul_tag (void *pdoc, Node *node);
52 static char *s_chtml20_start_ol_tag (void *pdoc, Node *node);
53 static char *s_chtml20_end_ol_tag (void *pdoc, Node *node);
54 static char *s_chtml20_start_li_tag (void *pdoc, Node *node);
55 static char *s_chtml20_end_li_tag (void *pdoc, Node *node);
56 static char *s_chtml20_start_head_tag (void *pdoc, Node *node);
57 static char *s_chtml20_end_head_tag (void *pdoc, Node *node);
58 static char *s_chtml20_start_title_tag (void *pdoc, Node *node);
59 static char *s_chtml20_end_title_tag (void *pdoc, Node *node);
60 static char *s_chtml20_start_base_tag (void *pdoc, Node *node);
61 static char *s_chtml20_end_base_tag (void *pdoc, Node *node);
62 static char *s_chtml20_start_body_tag (void *pdoc, Node *node);
63 static char *s_chtml20_end_body_tag (void *pdoc, Node *node);
64 static char *s_chtml20_start_a_tag (void *pdoc, Node *node);
65 static char *s_chtml20_end_a_tag (void *pdoc, Node *node);
66 static char *s_chtml20_start_br_tag (void *pdoc, Node *node);
67 static char *s_chtml20_end_br_tag (void *pdoc, Node *node);
68 static char *s_chtml20_start_tr_tag (void *pdoc, Node *node);
69 static char *s_chtml20_end_tr_tag (void *pdoc, Node *node);
70 static char *s_chtml20_start_font_tag (void *pdoc, Node *node);
71 static char *s_chtml20_end_font_tag (void *pdoc, Node *node);
72 static char *s_chtml20_start_form_tag (void *pdoc, Node *node);
73 static char *s_chtml20_end_form_tag (void *pdoc, Node *node);
74 static char *s_chtml20_start_input_tag (void *pdoc, Node *node);
75 static char *s_chtml20_end_input_tag (void *pdoc, Node *node);
76 static char *s_chtml20_start_center_tag (void *pdoc, Node *node);
77 static char *s_chtml20_end_center_tag (void *pdoc, Node *node);
78 static char *s_chtml20_start_hr_tag (void *pdoc, Node *node);
79 static char *s_chtml20_end_hr_tag (void *pdoc, Node *node);
80 static char *s_chtml20_start_img_tag (void *pdoc, Node *node);
81 static char *s_chtml20_end_img_tag (void *pdoc, Node *node);
82 static char *s_chtml20_start_select_tag (void *pdoc, Node *node);
83 static char *s_chtml20_end_select_tag (void *pdoc, Node *node);
84 static char *s_chtml20_start_option_tag (void *pdoc, Node *node);
85 static char *s_chtml20_end_option_tag (void *pdoc, Node *node);
86 static char *s_chtml20_start_div_tag (void *pdoc, Node *node);
87 static char *s_chtml20_end_div_tag (void *pdoc, Node *node);
88 static char *s_chtml20_start_dl_tag (void *pdoc, Node *node);
89 static char *s_chtml20_end_dl_tag (void *pdoc, Node *node);
91 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
93 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
94 static char *s_chtml20_text_tag(void *pdoc, Node *node);
98 tag_handler chtml20_handler[] = {
101 s_chtml20_start_html_tag,
102 s_chtml20_end_html_tag,
106 s_chtml20_start_meta_tag,
107 s_chtml20_end_meta_tag,
111 s_chtml20_start_textarea_tag,
112 s_chtml20_end_textarea_tag,
116 s_chtml20_start_p_tag,
121 s_chtml20_start_pre_tag,
122 s_chtml20_end_pre_tag,
126 s_chtml20_start_ul_tag,
127 s_chtml20_end_ul_tag,
131 s_chtml20_start_li_tag,
132 s_chtml20_end_li_tag,
136 s_chtml20_start_ol_tag,
137 s_chtml20_end_ol_tag,
141 s_chtml20_start_h1_tag,
142 s_chtml20_end_h1_tag,
146 s_chtml20_start_h2_tag,
147 s_chtml20_end_h2_tag,
151 s_chtml20_start_h3_tag,
152 s_chtml20_end_h3_tag,
156 s_chtml20_start_h4_tag,
157 s_chtml20_end_h4_tag,
161 s_chtml20_start_h5_tag,
162 s_chtml20_end_h5_tag,
166 s_chtml20_start_h6_tag,
167 s_chtml20_end_h6_tag,
171 s_chtml20_start_head_tag,
172 s_chtml20_end_head_tag,
176 s_chtml20_start_title_tag,
177 s_chtml20_end_title_tag,
181 s_chtml20_start_base_tag,
182 s_chtml20_end_base_tag,
186 s_chtml20_start_body_tag,
187 s_chtml20_end_body_tag,
191 s_chtml20_start_a_tag,
196 s_chtml20_start_br_tag,
197 s_chtml20_end_br_tag,
206 s_chtml20_start_tr_tag,
207 s_chtml20_end_tr_tag,
221 s_chtml20_start_font_tag,
222 s_chtml20_end_font_tag,
226 s_chtml20_start_form_tag,
227 s_chtml20_end_form_tag,
231 s_chtml20_start_input_tag,
232 s_chtml20_end_input_tag,
236 s_chtml20_start_center_tag,
237 s_chtml20_end_center_tag,
241 s_chtml20_start_hr_tag,
242 s_chtml20_end_hr_tag,
246 s_chtml20_start_img_tag,
247 s_chtml20_end_img_tag,
251 s_chtml20_start_select_tag,
252 s_chtml20_end_select_tag,
256 s_chtml20_start_option_tag,
257 s_chtml20_end_option_tag,
261 s_chtml20_start_div_tag,
262 s_chtml20_end_div_tag,
266 s_chtml20_chxjif_tag,
326 s_chtml20_start_dl_tag,
327 s_chtml20_end_dl_tag,
337 * converts from CHTML5.0 to CHTML2.0.
339 * @param r [i] Requet_rec is appointed.
340 * @param spec [i] The result of the device specification processing which
341 * was done in advance is appointed.
342 * @param src [i] The character string before the converting is appointed.
343 * @return The character string after the converting is returned.
346 chxj_convert_chtml20(
352 chxjconvrule_entry *entryp,
361 /*--------------------------------------------------------------------------*/
363 /*--------------------------------------------------------------------------*/
365 dst = chxj_qr_code_blob_handler(r, src, (size_t *)dstlen);
367 DBG(r,"i found qrcode xml");
370 DBG(r,"not found qrcode xml");
372 /*--------------------------------------------------------------------------*/
373 /* The CHTML structure is initialized. */
374 /*--------------------------------------------------------------------------*/
375 s_init_chtml20(&chtml20, &doc, r, spec);
378 chtml20.entryp = entryp;
379 chtml20.cookie = cookie;
381 if (IS_SJIS_STRING(GET_SPEC_CHARSET(spec))) {
382 ap_set_content_type(r, "text/html; charset=Windows-31J");
385 ap_set_content_type(r, "text/html; charset=UTF-8");
388 /*--------------------------------------------------------------------------*/
389 /* The character string of the input is analyzed. */
390 /*--------------------------------------------------------------------------*/
391 qs_init_malloc(&doc);
392 qs_init_root_node(&doc);
394 ss = apr_pcalloc(r->pool, srclen + 1);
395 memset(ss, 0, srclen + 1);
396 memcpy(ss, src, srclen);
399 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
402 qs_parse_string(&doc,ss, strlen(ss));
404 /*--------------------------------------------------------------------------*/
405 /* It converts it from CHTML to CHTML. */
406 /*--------------------------------------------------------------------------*/
407 chxj_node_convert(spec,r,(void*)&chtml20, &doc, qs_get_root(&doc), 0);
410 qs_all_free(&doc,QX_LOGMARK);
413 return apr_pstrdup(r->pool,ss);
415 if (strlen(dst) == 0)
416 dst = apr_psprintf(r->pool, "\n");
418 *dstlen = strlen(dst);
421 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
428 * The CHTML structure is initialized.
430 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
431 * initialized is specified.
432 * @param doc [i] The Doc structure that should be set to the initialized
433 * HDML structure is specified.
434 * @param r [i] To use POOL, the pointer to request_rec is specified.
435 * @param spec [i] The pointer to the device_table
438 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
440 memset(doc, 0, sizeof(Doc));
441 memset(chtml20, 0, sizeof(chtml20_t));
445 chtml20->spec = spec;
446 chtml20->out = qs_alloc_zero_byte_string(r);
447 chtml20->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
449 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
454 * It is a handler who processes the HTML tag.
456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
457 * destination is specified.
458 * @param node [i] The HTML tag node is specified.
459 * @return The conversion result is returned.
462 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
468 chtml20 = GET_CHTML20(pdoc);
472 /*--------------------------------------------------------------------------*/
474 /*--------------------------------------------------------------------------*/
475 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<html>\n", NULL);
482 * It is a handler who processes the HTML tag.
484 * @param pdoc [i/o] The pointer to the CHTML structure at the output
485 * destination is specified.
486 * @param node [i] The HTML tag node is specified.
487 * @return The conversion result is returned.
490 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
496 chtml20 = GET_CHTML20(pdoc);
500 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</html>\n", NULL);
507 * It is a handler who processes the META tag.
509 * @param pdoc [i/o] The pointer to the CHTML structure at the output
510 * destination is specified.
511 * @param node [i] The META tag node is specified.
512 * @return The conversion result is returned.
515 s_chtml20_start_meta_tag(void *pdoc, Node *node)
521 int content_type_flag;
524 chtml20 = GET_CHTML20(pdoc);
528 content_type_flag = 0;
531 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<meta", NULL);
533 /*--------------------------------------------------------------------------*/
535 /*--------------------------------------------------------------------------*/
536 for (attr = qs_get_attr(doc,node);
538 attr = qs_get_next_attr(doc,attr)) {
543 name = qs_get_attr_name(doc,attr);
544 value = qs_get_attr_value(doc,attr);
549 if (strcasecmp(name, "http-equiv") == 0) {
550 /*----------------------------------------------------------------------*/
552 /*----------------------------------------------------------------------*/
553 chtml20->out = apr_pstrcat(r->pool,
560 if (STRCASEEQ('c','C',"content-type",value))
561 content_type_flag = 1;
562 if (STRCASEEQ('r','R',"refresh", value))
569 if (strcasecmp(name, "content") == 0) {
570 if (content_type_flag) {
571 if (IS_SJIS_STRING(GET_SPEC_CHARSET(chtml20->spec))) {
572 chtml20->out = apr_pstrcat(r->pool,
577 "text/html; charset=Windows-31J",
582 chtml20->out = apr_pstrcat(r->pool,
587 "text/html; charset=UTF-8",
592 else if (refresh_flag) {
593 char* buf = apr_pstrdup(r->pool, value);
597 url = strchr(buf, ';');
599 sec = apr_pstrdup(r->pool, buf);
602 url = chxj_encoding_parameter(r, url);
603 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
604 chtml20->out = apr_pstrcat(r->pool,
617 chtml20->out = apr_pstrcat(r->pool,
634 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
641 * It is a handler who processes the META tag.
643 * @param pdoc [i/o] The pointer to the CHTML structure at the output
644 * destination is specified.
645 * @param node [i] The META tag node is specified.
646 * @return The conversion result is returned.
649 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
653 chtml20 = GET_CHTML20(pdoc);
660 * It is a handler who processes the HEAD tag.
662 * @param pdoc [i/o] The pointer to the CHTML structure at the output
663 * destination is specified.
664 * @param node [i] The HEAD tag node is specified.
665 * @return The conversion result is returned.
668 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
674 chtml20 = GET_CHTML20(pdoc);
678 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<head>\r\n", NULL);
685 * It is a handler who processes the HEAD tag.
687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
688 * destination is specified.
689 * @param node [i] The HEAD tag node is specified.
690 * @return The conversion result is returned.
693 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
699 chtml20 = GET_CHTML20(pdoc);
703 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</head>\r\n", NULL);
710 * It is a handler who processes the TITLE tag.
712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
713 * destination is specified.
714 * @param node [i] The TITLE tag node is specified.
715 * @return The conversion result is returned.
718 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
724 chtml20 = GET_CHTML20(pdoc);
728 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<title>", NULL);
735 * It is a handler who processes the TITLE tag.
737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
738 * destination is specified.
739 * @param node [i] The TITLE tag node is specified.
740 * @return The conversion result is returned.
743 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
749 chtml20 = GET_CHTML20(pdoc);
753 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</title>\r\n", NULL);
760 * It is a handler who processes the BASE tag.
762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
763 * destination is specified.
764 * @param node [i] The BASE tag node is specified.
765 * @return The conversion result is returned.
768 s_chtml20_start_base_tag(void *pdoc, Node *node)
775 chtml20 = GET_CHTML20(pdoc);
779 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<base", NULL);
781 /*--------------------------------------------------------------------------*/
783 /*--------------------------------------------------------------------------*/
784 for (attr = qs_get_attr(doc,node);
786 attr = qs_get_next_attr(doc,attr)) {
791 name = qs_get_attr_name(doc,attr);
792 value = qs_get_attr_value(doc,attr);
794 if ((*name == 'h' || *name == 'H')
795 && strcasecmp(name, "href") == 0) {
796 chtml20->out = apr_pstrcat(r->pool,
805 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >\r\n", NULL);
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_end_base_tag(void *pdoc, Node *UNUSED(child))
826 chtml20 = GET_CHTML20(pdoc);
835 * It is a handler who processes the BODY tag.
837 * @param pdoc [i/o] The pointer to the CHTML structure at the output
838 * destination is specified.
839 * @param node [i] The BODY tag node is specified.
840 * @return The conversion result is returned.
843 s_chtml20_start_body_tag(void *pdoc, Node *node)
850 chtml20 = GET_CHTML20(pdoc);
854 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<body", NULL);
856 /*--------------------------------------------------------------------------*/
858 /*--------------------------------------------------------------------------*/
859 for (attr = qs_get_attr(doc,node);
861 attr = qs_get_next_attr(doc,attr)) {
865 name = qs_get_attr_name(doc,attr);
866 value = qs_get_attr_value(doc,attr);
871 if (strcasecmp(name, "bgcolor") == 0) {
872 /*----------------------------------------------------------------------*/
874 /*----------------------------------------------------------------------*/
875 chtml20->out = apr_pstrcat(r->pool,
886 if (strcasecmp(name, "text") == 0) {
887 /*----------------------------------------------------------------------*/
889 /*----------------------------------------------------------------------*/
890 chtml20->out = apr_pstrcat(r->pool,
901 if (strcasecmp(name, "link") == 0) {
902 /*----------------------------------------------------------------------*/
904 /*----------------------------------------------------------------------*/
905 chtml20->out = apr_pstrcat(r->pool,
916 if (strcasecmp(name, "alink") == 0) {
917 /*----------------------------------------------------------------------*/
919 /*----------------------------------------------------------------------*/
926 if (strcasecmp(name, "vlink") == 0) {
927 /*----------------------------------------------------------------------*/
929 /*----------------------------------------------------------------------*/
939 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
946 * It is a handler who processes the BODY tag.
948 * @param pdoc [i/o] The pointer to the CHTML structure at the output
949 * destination is specified.
950 * @param node [i] The BODY tag node is specified.
951 * @return The conversion result is returned.
954 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
960 chtml20 = GET_CHTML20(pdoc);
964 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</body>\r\n", NULL);
971 * It is a handler who processes the A tag.
973 * @param pdoc [i/o] The pointer to the CHTML structure at the output
974 * destination is specified.
975 * @param node [i] The A tag node is specified.
976 * @return The conversion result is returned.
979 s_chtml20_start_a_tag(void *pdoc, Node *node)
986 chtml20 = GET_CHTML20(pdoc);
990 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<a", NULL);
992 /*--------------------------------------------------------------------------*/
994 /*--------------------------------------------------------------------------*/
995 for (attr = qs_get_attr(doc,node);
997 attr = qs_get_next_attr(doc,attr)) {
1002 name = qs_get_attr_name(doc,attr);
1003 value = qs_get_attr_value(doc,attr);
1008 if (strcasecmp(name, "name") == 0) {
1009 /*--------------------------------------------------------------------*/
1011 /*--------------------------------------------------------------------*/
1012 chtml20->out = apr_pstrcat(r->pool,
1023 if (strcasecmp(name, "href") == 0) {
1024 /*--------------------------------------------------------------------*/
1026 /*--------------------------------------------------------------------*/
1027 value = chxj_encoding_parameter(r, value);
1028 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1030 chtml20->out = apr_pstrcat(r->pool,
1041 if (strcasecmp(name, "accesskey") == 0) {
1042 /*--------------------------------------------------------------------*/
1044 /*--------------------------------------------------------------------*/
1045 chtml20->out = apr_pstrcat(r->pool,
1056 if (strcasecmp(name, "cti") == 0) {
1057 /*--------------------------------------------------------------------*/
1059 /*--------------------------------------------------------------------*/
1060 chtml20->out = apr_pstrcat(r->pool,
1071 if (strcasecmp(name, "ijam") == 0) {
1072 /*--------------------------------------------------------------------*/
1074 /*--------------------------------------------------------------------*/
1078 if (strcasecmp(name, "ista") == 0) {
1079 /*--------------------------------------------------------------------*/
1081 /*--------------------------------------------------------------------*/
1085 if (strcasecmp(name, "ilet") == 0) {
1086 /*--------------------------------------------------------------------*/
1088 /*--------------------------------------------------------------------*/
1092 if (strcasecmp(name, "iswf") == 0) {
1093 /*--------------------------------------------------------------------*/
1095 /*--------------------------------------------------------------------*/
1099 if (strcasecmp(name, "irst") == 0) {
1100 /*--------------------------------------------------------------------*/
1102 /*--------------------------------------------------------------------*/
1109 if (strcasecmp(name, "utn") == 0) {
1110 /*--------------------------------------------------------------------*/
1112 /*--------------------------------------------------------------------*/
1119 if (strcasecmp(name, "telbook") == 0) {
1120 /*--------------------------------------------------------------------*/
1122 /*--------------------------------------------------------------------*/
1129 if (strcasecmp(name, "kana") == 0) {
1130 /*--------------------------------------------------------------------*/
1132 /*--------------------------------------------------------------------*/
1139 if (strcasecmp(name, "email") == 0) {
1140 /*--------------------------------------------------------------------*/
1142 /*--------------------------------------------------------------------*/
1152 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1154 return chtml20->out;
1159 * It is a handler who processes the A tag.
1161 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1162 * destination is specified.
1163 * @param node [i] The A tag node is specified.
1164 * @return The conversion result is returned.
1167 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1173 chtml20 = GET_CHTML20(pdoc);
1177 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</a>", NULL);
1179 return chtml20->out;
1184 * It is a handler who processes the BR tag.
1186 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1187 * destination is specified.
1188 * @param node [i] The BR tag node is specified.
1189 * @return The conversion result is returned.
1192 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1198 chtml20 = GET_CHTML20(pdoc);
1202 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
1204 return chtml20->out;
1209 * It is a handler who processes the BR tag.
1211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1212 * destination is specified.
1213 * @param node [i] The BR tag node is specified.
1214 * @return The conversion result is returned.
1217 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1223 chtml20 = GET_CHTML20(pdoc);
1227 return chtml20->out;
1232 * It is a handler who processes the TR tag.
1234 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1235 * destination is specified.
1236 * @param node [i] The TR tag node is specified.
1237 * @return The conversion result is returned.
1240 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1246 chtml20 = GET_CHTML20(pdoc);
1250 return chtml20->out;
1255 * It is a handler who processes the TR tag.
1257 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1258 * destination is specified.
1259 * @param node [i] The TR tag node is specified.
1260 * @return The conversion result is returned.
1263 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1269 chtml20 = GET_CHTML20(pdoc);
1273 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
1275 return chtml20->out;
1280 * It is a handler who processes the FONT tag.
1282 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1283 * destination is specified.
1284 * @param node [i] The FONT tag node is specified.
1285 * @return The conversion result is returned.
1288 s_chtml20_start_font_tag(void *pdoc, Node *node)
1295 chtml20 = GET_CHTML20(pdoc);
1300 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<font", NULL);
1302 /*--------------------------------------------------------------------------*/
1303 /* Get Attributes */
1304 /*--------------------------------------------------------------------------*/
1305 for (attr = qs_get_attr(doc,node);
1307 attr = qs_get_next_attr(doc,attr)) {
1312 name = qs_get_attr_name(doc,attr);
1313 value = qs_get_attr_value(doc,attr);
1318 if (strcasecmp(name, "color") == 0) {
1319 chtml20->out = apr_pstrcat(r->pool,
1330 if (strcasecmp(name, "size") == 0) {
1331 /*--------------------------------------------------------------------*/
1333 /*--------------------------------------------------------------------*/
1343 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1345 return chtml20->out;
1350 * It is a handler who processes the FONT tag.
1352 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1353 * destination is specified.
1354 * @param node [i] The FONT tag node is specified.
1355 * @return The conversion result is returned.
1358 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1364 chtml20 = GET_CHTML20(pdoc);
1368 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</font>", NULL);
1370 return chtml20->out;
1375 * It is a handler who processes the FORM tag.
1377 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1378 * destination is specified.
1379 * @param node [i] The FORM tag node is specified.
1380 * @return The conversion result is returned.
1383 s_chtml20_start_form_tag(void *pdoc, Node *node)
1390 chtml20 = GET_CHTML20(pdoc);
1395 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<form", NULL);
1397 /*--------------------------------------------------------------------------*/
1398 /* Get Attributes */
1399 /*--------------------------------------------------------------------------*/
1400 for (attr = qs_get_attr(doc,node);
1402 attr = qs_get_next_attr(doc,attr)) {
1407 name = qs_get_attr_name(doc,attr);
1408 value = qs_get_attr_value(doc,attr);
1413 if (strcasecmp(name, "action") == 0) {
1414 /*--------------------------------------------------------------------*/
1416 /*--------------------------------------------------------------------*/
1417 value = chxj_encoding_parameter(r, value);
1418 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1420 chtml20->out = apr_pstrcat(r->pool,
1431 if (strcasecmp(name, "method") == 0) {
1432 /*--------------------------------------------------------------------*/
1434 /*--------------------------------------------------------------------*/
1435 chtml20->out = apr_pstrcat(r->pool,
1446 if (strcasecmp(name, "utn") == 0) {
1447 /*--------------------------------------------------------------------*/
1449 /*--------------------------------------------------------------------*/
1459 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1461 return chtml20->out;
1466 * It is a handler who processes the FORM tag.
1468 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1469 * destination is specified.
1470 * @param node [i] The FORM tag node is specified.
1471 * @return The conversion result is returned.
1474 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1480 chtml20 = GET_CHTML20(pdoc);
1484 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</form>", NULL);
1486 return chtml20->out;
1491 * It is a handler who processes the INPUT tag.
1493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1494 * destination is specified.
1495 * @param node [i] The INPUT tag node is specified.
1496 * @return The conversion result is returned.
1499 s_chtml20_start_input_tag(void *pdoc, Node *node)
1504 char *max_length = NULL;
1508 char *istyle = NULL;
1510 char *checked = NULL;
1511 char *accesskey = NULL;
1513 chtml20 = GET_CHTML20(pdoc);
1518 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<input", NULL);
1520 /*--------------------------------------------------------------------------*/
1521 /* Get Attributes */
1522 /*--------------------------------------------------------------------------*/
1524 type = qs_get_type_attr(doc, node, r);
1525 name = qs_get_name_attr(doc, node, r);
1526 value = qs_get_value_attr(doc,node,r);
1527 istyle = qs_get_istyle_attr(doc,node,r);
1528 max_length = qs_get_maxlength_attr(doc,node,r);
1529 checked = qs_get_checked_attr(doc,node,r);
1530 accesskey = qs_get_accesskey_attr(doc, node, r);
1531 size = qs_get_size_attr(doc, node, r);
1534 chtml20->out = apr_pstrcat(r->pool,
1542 chtml20->out = apr_pstrcat(r->pool,
1550 chtml20->out = apr_pstrcat(r->pool,
1558 chtml20->out = apr_pstrcat(r->pool,
1566 chtml20->out = apr_pstrcat(r->pool,
1573 /*------------------------------------------------------------------------*/
1575 /*------------------------------------------------------------------------*/
1576 chtml20->out = apr_pstrcat(r->pool,
1582 /*--------------------------------------------------------------------------*/
1583 /* The figure is default for the password. */
1584 /*--------------------------------------------------------------------------*/
1586 if (chxj_chk_numeric(max_length) != 0)
1587 max_length = apr_psprintf(r->pool, "0");
1588 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1589 chtml20->out = apr_pstrcat(r->pool,
1591 apr_psprintf(r->pool,
1592 " maxlength=\"%d\"",
1593 chxj_atoi(max_length)*2),
1596 chtml20->out = apr_pstrcat(r->pool,
1598 apr_psprintf(r->pool,
1599 " maxlength=\"%d\"",
1600 chxj_atoi(max_length)),
1605 chtml20->out = apr_pstrcat(r->pool,
1610 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
1612 return chtml20->out;
1617 * It is a handler who processes the INPUT tag.
1619 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1620 * destination is specified.
1621 * @param node [i] The INPUT tag node is specified.
1622 * @return The conversion result is returned.
1625 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1631 chtml20 = GET_CHTML20(pdoc);
1635 return chtml20->out;
1640 * It is a handler who processes the CENTER tag.
1642 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1643 * destination is specified.
1644 * @param node [i] The CENTER tag node is specified.
1645 * @return The conversion result is returned.
1648 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1654 chtml20 = GET_CHTML20(pdoc);
1658 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<center>", NULL);
1660 return chtml20->out;
1665 * It is a handler who processes the CENTER tag.
1667 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1668 * destination is specified.
1669 * @param node [i] The CENTER tag node is specified.
1670 * @return The conversion result is returned.
1673 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1679 chtml20 = GET_CHTML20(pdoc);
1683 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</center>", NULL);
1685 return chtml20->out;
1690 * It is a handler who processes the UL tag.
1692 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1693 * destination is specified.
1694 * @param node [i] The UL tag node is specified.
1695 * @return The conversion result is returned.
1698 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1704 chtml20 = GET_CHTML20(pdoc);
1708 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<ul>", NULL);
1710 return chtml20->out;
1715 * It is a handler who processes the UL tag.
1717 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1718 * destination is specified.
1719 * @param node [i] The UL tag node is specified.
1720 * @return The conversion result is returned.
1723 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1729 chtml20 = GET_CHTML20(pdoc);
1733 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</ul>", NULL);
1735 return chtml20->out;
1740 * It is a handler who processes the OL tag.
1742 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1743 * destination is specified.
1744 * @param node [i] The OL tag node is specified.
1745 * @return The conversion result is returned.
1748 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1754 chtml20 = GET_CHTML20(pdoc);
1758 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<ol>", NULL);
1760 return chtml20->out;
1765 * It is a handler who processes the OL tag.
1767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1768 * destination is specified.
1769 * @param node [i] The OL tag node is specified.
1770 * @return The conversion result is returned.
1773 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1779 chtml20 = GET_CHTML20(pdoc);
1783 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</ol>", NULL);
1785 return chtml20->out;
1790 * It is a handler who processes the LI tag.
1792 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1793 * destination is specified.
1794 * @param node [i] The LI tag node is specified.
1795 * @return The conversion result is returned.
1798 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1804 chtml20 = GET_CHTML20(pdoc);
1808 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<li>", NULL);
1810 return chtml20->out;
1815 * It is a handler who processes the LI tag.
1817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1818 * destination is specified.
1819 * @param node [i] The LI tag node is specified.
1820 * @return The conversion result is returned.
1823 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1829 chtml20 = GET_CHTML20(pdoc);
1833 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</li>", NULL);
1835 return chtml20->out;
1840 * It is a handler who processes the HR tag.
1842 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1843 * destination is specified.
1844 * @param node [i] The HR tag node is specified.
1845 * @return The conversion result is returned.
1848 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1855 chtml20 = GET_CHTML20(pdoc);
1860 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<hr ", NULL);
1862 for (attr = qs_get_attr(doc,node);
1864 attr = qs_get_next_attr(doc,attr)) {
1869 name = qs_get_attr_name(doc,attr);
1870 value = qs_get_attr_value(doc,attr);
1875 if (strcasecmp(name, "align") == 0) {
1876 /*--------------------------------------------------------------------*/
1878 /*--------------------------------------------------------------------*/
1879 chtml20->out = apr_pstrcat(r->pool,
1890 if (strcasecmp(name, "size") == 0) {
1891 /*--------------------------------------------------------------------*/
1893 /*--------------------------------------------------------------------*/
1894 chtml20->out = apr_pstrcat(r->pool,
1905 if (strcasecmp(name, "width") == 0) {
1906 /*--------------------------------------------------------------------*/
1908 /*--------------------------------------------------------------------*/
1909 chtml20->out = apr_pstrcat(r->pool,
1920 if (strcasecmp(name, "noshade") == 0) {
1921 /*--------------------------------------------------------------------*/
1923 /*--------------------------------------------------------------------*/
1924 chtml20->out = apr_pstrcat(r->pool,
1933 if (strcasecmp(name, "color") == 0) {
1934 /*--------------------------------------------------------------------*/
1936 /*--------------------------------------------------------------------*/
1946 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
1948 return chtml20->out;
1953 * It is a handler who processes the HR tag.
1955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1956 * destination is specified.
1957 * @param node [i] The HR tag node is specified.
1958 * @return The conversion result is returned.
1961 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1967 chtml20 = GET_CHTML20(pdoc);
1971 return chtml20->out;
1976 * It is a handler who processes the IMG tag.
1978 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1979 * destination is specified.
1980 * @param node [i] The IMG tag node is specified.
1981 * @return The conversion result is returned.
1984 s_chtml20_start_img_tag(void *pdoc, Node *node)
1990 #ifndef IMG_NOT_CONVERT_FILENAME
1994 chtml20 = GET_CHTML20(pdoc);
1998 #ifndef IMG_NOT_CONVERT_FILENAME
1999 spec = chtml20->spec;
2002 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<img", NULL);
2005 /*-------------------------------------------------------------------------*/
2006 /* Get Attributes */
2007 /*-------------------------------------------------------------------------*/
2008 for (attr = qs_get_attr(doc,node);
2010 attr = qs_get_next_attr(doc,attr)) {
2015 name = qs_get_attr_name(doc,attr);
2016 value = qs_get_attr_value(doc,attr);
2021 if (strcasecmp(name, "src") == 0) {
2022 /*-------------------------------------------------------------------*/
2024 /*-------------------------------------------------------------------*/
2025 #ifdef IMG_NOT_CONVERT_FILENAME
2026 value = chxj_encoding_parameter(r, value);
2027 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2029 value = apr_psprintf(r->pool,
2032 (strchr(value, '?')) ? '&' : '?',
2033 CHXJ_COOKIE_NOUPDATE_PARAM);
2035 chtml20->out = apr_pstrcat(r->pool,
2042 value = chxj_img_conv(r, spec, value);
2043 value = chxj_encoding_parameter(r, value);
2044 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2046 value = apr_psprintf(r->pool,
2049 (strchr(value, '?')) ? '&' : '?',
2050 CHXJ_COOKIE_NOUPDATE_PARAM);
2053 chtml20->out = apr_pstrcat(r->pool,
2054 chtml20->out, " src=\"",
2058 chtml20->out = apr_pstrcat(r->pool,
2068 if (strcasecmp(name, "align" ) == 0) {
2069 /*--------------------------------------------------------------------*/
2071 /*--------------------------------------------------------------------*/
2072 chtml20->out = apr_pstrcat(r->pool,
2080 if (strcasecmp(name, "alt" ) == 0) {
2081 /*--------------------------------------------------------------------*/
2083 /*--------------------------------------------------------------------*/
2084 chtml20->out = apr_pstrcat(r->pool,
2092 if (strcasecmp(name, "align" ) == 0) {
2093 /*--------------------------------------------------------------------*/
2095 /*--------------------------------------------------------------------*/
2102 if (strcasecmp(name, "width" ) == 0) {
2103 /*--------------------------------------------------------------------*/
2105 /*--------------------------------------------------------------------*/
2106 chtml20->out = apr_pstrcat(r->pool,
2117 if (strcasecmp(name, "height") == 0) {
2118 /*--------------------------------------------------------------------*/
2120 /*--------------------------------------------------------------------*/
2121 chtml20->out = apr_pstrcat(r->pool,
2129 if (strcasecmp(name, "hspace") == 0) {
2130 /*--------------------------------------------------------------------*/
2132 /*--------------------------------------------------------------------*/
2133 chtml20->out = apr_pstrcat(r->pool,
2144 if (strcasecmp(name, "vspace") == 0) {
2145 /*--------------------------------------------------------------------*/
2147 /*--------------------------------------------------------------------*/
2148 chtml20->out = apr_pstrcat(r->pool,
2162 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
2164 return chtml20->out;
2169 * It is a handler who processes the IMG tag.
2171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2172 * destination is specified.
2173 * @param node [i] The IMG tag node is specified.
2174 * @return The conversion result is returned.
2177 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2183 chtml20 = GET_CHTML20(pdoc);
2187 return chtml20->out;
2192 * It is a handler who processes the SELECT tag.
2194 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2195 * destination is specified.
2196 * @param node [i] The SELECT tag node is specified.
2197 * @return The conversion result is returned.
2200 s_chtml20_start_select_tag(void *pdoc, Node *child)
2207 chtml20 = GET_CHTML20(pdoc);
2214 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<select", NULL);
2216 for (attr = qs_get_attr(doc,child);
2218 attr = qs_get_next_attr(doc,attr)) {
2223 nm = qs_get_attr_name(doc,attr);
2224 val = qs_get_attr_value(doc,attr);
2229 if (strcasecmp(nm, "size") == 0) {
2230 /*--------------------------------------------------------------------*/
2231 /* CHTML 1.0 version 2.0 */
2232 /*--------------------------------------------------------------------*/
2233 size = apr_pstrdup(r->pool, val);
2239 if (strcasecmp(nm, "name") == 0) {
2240 /*--------------------------------------------------------------------*/
2241 /* CHTML 1.0 version 2.0 */
2242 /*--------------------------------------------------------------------*/
2243 name = apr_pstrdup(r->pool, val);
2249 if (strcasecmp(nm, "multiple") == 0) {
2250 /*--------------------------------------------------------------------*/
2251 /* CHTML 1.0 version 2.0 */
2252 /*--------------------------------------------------------------------*/
2263 chtml20->out = apr_pstrcat(r->pool,
2271 chtml20->out = apr_pstrcat(r->pool,
2278 chtml20->out = apr_pstrcat(r->pool,
2283 return chtml20->out;
2288 * It is a handler who processes the SELECT tag.
2290 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2291 * destination is specified.
2292 * @param node [i] The SELECT tag node is specified.
2293 * @return The conversion result is returned.
2296 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2302 chtml20 = GET_CHTML20(pdoc);
2306 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</select>\n", NULL);
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_start_option_tag(void *pdoc, Node *child)
2328 chtml20 = GET_CHTML20(pdoc);
2332 char* selected = NULL;
2335 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<option", NULL);
2337 for (attr = qs_get_attr(doc,child);
2339 attr = qs_get_next_attr(doc,attr)) {
2344 nm = qs_get_attr_name(doc,attr);
2345 val = qs_get_attr_value(doc,attr);
2350 if (strcasecmp(nm, "selected") == 0) {
2351 /*--------------------------------------------------------------------*/
2352 /* CHTML 1.0 version 2.0 */
2353 /*--------------------------------------------------------------------*/
2354 selected = apr_pstrdup(r->pool, val);
2360 if (strcasecmp(nm, "value") == 0) {
2361 /*--------------------------------------------------------------------*/
2362 /* CHTML 1.0 version 2.0 */
2363 /*--------------------------------------------------------------------*/
2364 value = apr_pstrdup(r->pool, val);
2374 chtml20->out = apr_pstrcat(r->pool,
2381 chtml20->out = apr_pstrcat(r->pool,
2387 chtml20->out = apr_pstrcat(r->pool,
2392 chtml20->out = apr_pstrcat(r->pool,
2397 return chtml20->out;
2402 * It is a handler who processes the OPTION tag.
2404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2405 * destination is specified.
2406 * @param node [i] The OPTION tag node is specified.
2407 * @return The conversion result is returned.
2410 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2416 chtml20 = GET_CHTML20(pdoc);
2422 return chtml20->out;
2427 * It is a handler who processes the DIV tag.
2429 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2430 * destination is specified.
2431 * @param node [i] The DIV tag node is specified.
2432 * @return The conversion result is returned.
2435 s_chtml20_start_div_tag(void *pdoc, Node *child)
2442 chtml20 = GET_CHTML20(pdoc);
2449 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<div", NULL);
2451 for (attr = qs_get_attr(doc,child);
2453 attr = qs_get_next_attr(doc,attr)) {
2458 nm = qs_get_attr_name(doc,attr);
2459 val = qs_get_attr_value(doc,attr);
2461 if ((*nm == 'a'||*nm == 'A') && strcasecmp(nm, "align") == 0) {
2462 /*----------------------------------------------------------------------*/
2463 /* CHTML 1.0 (W3C version 3.2) */
2464 /*----------------------------------------------------------------------*/
2465 align = apr_pstrdup(r->pool, val);
2470 chtml20->out = apr_pstrcat(r->pool,
2477 chtml20->out = apr_pstrcat(r->pool,
2482 return chtml20->out;
2487 * It is a handler who processes the DIV tag.
2489 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2490 * destination is specified.
2491 * @param node [i] The DIV tag node is specified.
2492 * @return The conversion result is returned.
2495 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2501 chtml20 = GET_CHTML20(pdoc);
2505 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</div>\n", NULL);
2507 return chtml20->out;
2512 * It is a handler who processes the H1 tag.
2514 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2515 * destination is specified.
2516 * @param node [i] The H1 tag node is specified.
2517 * @return The conversion result is returned.
2520 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2526 chtml20 = GET_CHTML20(pdoc);
2530 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h1>\r\n", NULL);
2532 return chtml20->out;
2537 * It is a handler who processes the H1 tag.
2539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2540 * destination is specified.
2541 * @param node [i] The H1 tag node is specified.
2542 * @return The conversion result is returned.
2545 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2551 chtml20 = GET_CHTML20(pdoc);
2555 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h1>\r\n", NULL);
2557 return chtml20->out;
2562 * It is a handler who processes the H2 tag.
2564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2565 * destination is specified.
2566 * @param node [i] The H2 tag node is specified.
2567 * @return The conversion result is returned.
2570 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2576 chtml20 = GET_CHTML20(pdoc);
2580 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h2>\r\n", NULL);
2582 return chtml20->out;
2587 * It is a handler who processes the H2 tag.
2589 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2590 * destination is specified.
2591 * @param node [i] The H2 tag node is specified.
2592 * @return The conversion result is returned.
2595 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2601 chtml20 = GET_CHTML20(pdoc);
2605 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h2>\r\n", NULL);
2607 return chtml20->out;
2612 * It is a handler who processes the H3 tag.
2614 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2615 * destination is specified.
2616 * @param node [i] The H3 tag node is specified.
2617 * @return The conversion result is returned.
2620 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2626 chtml20 = GET_CHTML20(pdoc);
2630 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h3>\r\n", NULL);
2632 return chtml20->out;
2637 * It is a handler who processes the H3 tag.
2639 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2640 * destination is specified.
2641 * @param node [i] The H3 tag node is specified.
2642 * @return The conversion result is returned.
2645 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2651 chtml20 = GET_CHTML20(pdoc);
2655 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h3>\r\n", NULL);
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_start_h4_tag(void *pdoc, Node *UNUSED(node))
2676 chtml20 = GET_CHTML20(pdoc);
2680 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h4>\r\n", NULL);
2682 return chtml20->out;
2687 * It is a handler who processes the H4 tag.
2689 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2690 * destination is specified.
2691 * @param node [i] The H4 tag node is specified.
2692 * @return The conversion result is returned.
2695 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2701 chtml20 = GET_CHTML20(pdoc);
2705 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h4>\r\n", NULL);
2707 return chtml20->out;
2712 * It is a handler who processes the H5 tag.
2714 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2715 * destination is specified.
2716 * @param node [i] The H5 tag node is specified.
2717 * @return The conversion result is returned.
2720 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2726 chtml20 = GET_CHTML20(pdoc);
2730 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h5>\r\n", NULL);
2732 return chtml20->out;
2737 * It is a handler who processes the H5 tag.
2739 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2740 * destination is specified.
2741 * @param node [i] The H5 tag node is specified.
2742 * @return The conversion result is returned.
2745 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2751 chtml20 = GET_CHTML20(pdoc);
2755 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h5>\r\n", NULL);
2757 return chtml20->out;
2762 * It is a handler who processes the H6 tag.
2764 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2765 * destination is specified.
2766 * @param node [i] The H6 tag node is specified.
2767 * @return The conversion result is returned.
2770 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2776 chtml20 = GET_CHTML20(pdoc);
2780 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h6>\r\n", NULL);
2782 return chtml20->out;
2787 * It is a handler who processes the H6 tag.
2789 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2790 * destination is specified.
2791 * @param node [i] The H6 tag node is specified.
2792 * @return The conversion result is returned.
2795 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2801 chtml20 = GET_CHTML20(pdoc);
2805 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h6>\r\n", NULL);
2807 return chtml20->out;
2812 * It is a handler who processes the PRE tag.
2814 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2815 * destination is specified.
2816 * @param node [i] The PRE tag node is specified.
2817 * @return The conversion result is returned.
2820 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2826 chtml20 = GET_CHTML20(pdoc);
2830 chtml20->pre_flag++;
2831 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<pre>", NULL);
2833 return chtml20->out;
2838 * It is a handler who processes the PRE tag.
2840 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2841 * destination is specified.
2842 * @param node [i] The PRE tag node is specified.
2843 * @return The conversion result is returned.
2846 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2852 chtml20 = GET_CHTML20(pdoc);
2856 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</pre>", NULL);
2857 chtml20->pre_flag--;
2859 return chtml20->out;
2864 * It is a handler who processes the P tag.
2866 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2867 * destination is specified.
2868 * @param node [i] The P tag node is specified.
2869 * @return The conversion result is returned.
2872 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2878 chtml20 = GET_CHTML20(pdoc);
2882 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<p>", NULL);
2884 return chtml20->out;
2889 * It is a handler who processes the P tag.
2891 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2892 * destination is specified.
2893 * @param node [i] The P tag node is specified.
2894 * @return The conversion result is returned.
2897 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2903 chtml20 = GET_CHTML20(pdoc);
2907 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</p>", NULL);
2909 return chtml20->out;
2914 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2921 chtml20 = GET_CHTML20(pdoc);
2925 for (child = qs_get_child_node(doc, node);
2927 child = qs_get_next_node(doc, child)) {
2929 chtml20->out = apr_pstrcat(r->pool, chtml20->out, child->otext, NULL);
2931 s_chtml20_chxjif_tag(pdoc, child);
2939 * It is a handler who processes the TEXTARE tag.
2941 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2942 * destination is specified.
2943 * @param node [i] The TEXTAREA tag node is specified.
2944 * @return The conversion result is returned.
2947 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2954 chtml20 = GET_CHTML20(pdoc);
2958 chtml20->textarea_flag++;
2959 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<textarea ", NULL);
2961 for (attr = qs_get_attr(doc,node);
2963 attr = qs_get_next_attr(doc,attr)) {
2968 name = qs_get_attr_name(doc,attr);
2969 value = qs_get_attr_value(doc,attr);
2974 if (strcasecmp(name, "name") == 0) {
2975 chtml20->out = apr_pstrcat(r->pool,
2986 if (strcasecmp(name, "rows") == 0) {
2987 chtml20->out = apr_pstrcat(r->pool,
2998 if (strcasecmp(name, "cols") == 0) {
2999 chtml20->out = apr_pstrcat(r->pool,
3013 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
3015 return chtml20->out;
3020 * It is a handler who processes the TEXTAREA tag.
3022 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3023 * destination is specified.
3024 * @param node [i] The TEXTAREA tag node is specified.
3025 * @return The conversion result is returned.
3028 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3034 chtml20 = GET_CHTML20(pdoc);
3039 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</textarea>\r\n", NULL);
3040 chtml20->textarea_flag--;
3042 return chtml20->out;
3047 s_chtml20_text_tag(void *pdoc, Node *child)
3059 chtml20 = GET_CHTML20(pdoc);
3063 textval = qs_get_node_value(doc,child);
3064 textval = qs_trim_string(r->pool, textval);
3065 if (strlen(textval) == 0)
3066 return chtml20->out;
3068 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3069 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3071 tdst = qs_alloc_zero_byte_string(r);
3072 memset(one_byte, 0, sizeof(one_byte));
3075 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3076 if (is_sjis_kanji(textval[ii])) {
3077 one_byte[0] = textval[ii+0];
3078 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3079 one_byte[0] = textval[ii+1];
3080 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3084 if (chtml20->pre_flag) {
3085 one_byte[0] = textval[ii+0];
3086 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3089 if (chtml20->textarea_flag) {
3090 one_byte[0] = textval[ii+0];
3091 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3094 if (textval[ii] != '\r' && textval[ii] != '\n') {
3095 one_byte[0] = textval[ii+0];
3096 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3099 chtml20->out = apr_pstrcat(r->pool, chtml20->out, tdst, NULL);
3101 return chtml20->out;
3106 * It is a handler who processes the DL tag.
3108 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3109 * destination is specified.
3110 * @param node [i] The DL tag node is specified.
3111 * @return The conversion result is returned.
3114 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3120 chtml20 = GET_CHTML20(pdoc);
3124 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<dl>", NULL);
3126 return chtml20->out;
3131 * It is a handler who processes the DLtag.
3133 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3134 * destination is specified.
3135 * @param node [i] The DL tag node is specified.
3136 * @return The conversion result is returned.
3139 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3145 chtml20 = GET_CHTML20(pdoc);
3149 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</dl>\n", NULL);
3151 return chtml20->out;