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"
25 #define GET_CHTML20(X) ((chtml20_t*)(X))
27 static char *s_chtml20_start_html_tag (void *pdoc, Node *node);
28 static char *s_chtml20_end_html_tag (void *pdoc, Node *node);
29 static char *s_chtml20_start_meta_tag (void *pdoc, Node *node);
30 static char *s_chtml20_end_meta_tag (void *pdoc, Node *node);
31 static char *s_chtml20_start_textarea_tag(void *pdoc, Node *node);
32 static char *s_chtml20_end_textarea_tag (void *pdoc, Node *node);
33 static char *s_chtml20_start_p_tag (void *pdoc, Node *node);
34 static char *s_chtml20_end_p_tag (void *pdoc, Node *node);
35 static char *s_chtml20_start_pre_tag (void *pdoc, Node *node);
36 static char *s_chtml20_end_pre_tag (void *pdoc, Node *node);
37 static char *s_chtml20_start_h1_tag (void *pdoc, Node *node);
38 static char *s_chtml20_end_h1_tag (void *pdoc, Node *node);
39 static char *s_chtml20_start_h2_tag (void *pdoc, Node *node);
40 static char *s_chtml20_end_h2_tag (void *pdoc, Node *node);
41 static char *s_chtml20_start_h3_tag (void *pdoc, Node *node);
42 static char *s_chtml20_end_h3_tag (void *pdoc, Node *node);
43 static char *s_chtml20_start_h4_tag (void *pdoc, Node *node);
44 static char *s_chtml20_end_h4_tag (void *pdoc, Node *node);
45 static char *s_chtml20_start_h5_tag (void *pdoc, Node *node);
46 static char *s_chtml20_end_h5_tag (void *pdoc, Node *node);
47 static char *s_chtml20_start_h6_tag (void *pdoc, Node *node);
48 static char *s_chtml20_end_h6_tag (void *pdoc, Node *node);
49 static char *s_chtml20_start_ul_tag (void *pdoc, Node *node);
50 static char *s_chtml20_end_ul_tag (void *pdoc, Node *node);
51 static char *s_chtml20_start_ol_tag (void *pdoc, Node *node);
52 static char *s_chtml20_end_ol_tag (void *pdoc, Node *node);
53 static char *s_chtml20_start_li_tag (void *pdoc, Node *node);
54 static char *s_chtml20_end_li_tag (void *pdoc, Node *node);
55 static char *s_chtml20_start_head_tag (void *pdoc, Node *node);
56 static char *s_chtml20_end_head_tag (void *pdoc, Node *node);
57 static char *s_chtml20_start_title_tag (void *pdoc, Node *node);
58 static char *s_chtml20_end_title_tag (void *pdoc, Node *node);
59 static char *s_chtml20_start_base_tag (void *pdoc, Node *node);
60 static char *s_chtml20_end_base_tag (void *pdoc, Node *node);
61 static char *s_chtml20_start_body_tag (void *pdoc, Node *node);
62 static char *s_chtml20_end_body_tag (void *pdoc, Node *node);
63 static char *s_chtml20_start_a_tag (void *pdoc, Node *node);
64 static char *s_chtml20_end_a_tag (void *pdoc, Node *node);
65 static char *s_chtml20_start_br_tag (void *pdoc, Node *node);
66 static char *s_chtml20_end_br_tag (void *pdoc, Node *node);
67 static char *s_chtml20_start_tr_tag (void *pdoc, Node *node);
68 static char *s_chtml20_end_tr_tag (void *pdoc, Node *node);
69 static char *s_chtml20_start_font_tag (void *pdoc, Node *node);
70 static char *s_chtml20_end_font_tag (void *pdoc, Node *node);
71 static char *s_chtml20_start_form_tag (void *pdoc, Node *node);
72 static char *s_chtml20_end_form_tag (void *pdoc, Node *node);
73 static char *s_chtml20_start_input_tag (void *pdoc, Node *node);
74 static char *s_chtml20_end_input_tag (void *pdoc, Node *node);
75 static char *s_chtml20_start_center_tag (void *pdoc, Node *node);
76 static char *s_chtml20_end_center_tag (void *pdoc, Node *node);
77 static char *s_chtml20_start_hr_tag (void *pdoc, Node *node);
78 static char *s_chtml20_end_hr_tag (void *pdoc, Node *node);
79 static char *s_chtml20_start_img_tag (void *pdoc, Node *node);
80 static char *s_chtml20_end_img_tag (void *pdoc, Node *node);
81 static char *s_chtml20_start_select_tag (void *pdoc, Node *node);
82 static char *s_chtml20_end_select_tag (void *pdoc, Node *node);
83 static char *s_chtml20_start_option_tag (void *pdoc, Node *node);
84 static char *s_chtml20_end_option_tag (void *pdoc, Node *node);
85 static char *s_chtml20_start_div_tag (void *pdoc, Node *node);
86 static char *s_chtml20_end_div_tag (void *pdoc, Node *node);
88 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
90 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
91 static char *s_chtml20_text_tag(void *pdoc, Node *node);
94 tag_handler chtml20_handler[] = {
97 s_chtml20_start_html_tag,
98 s_chtml20_end_html_tag,
102 s_chtml20_start_meta_tag,
103 s_chtml20_end_meta_tag,
107 s_chtml20_start_textarea_tag,
108 s_chtml20_end_textarea_tag,
112 s_chtml20_start_p_tag,
117 s_chtml20_start_pre_tag,
118 s_chtml20_end_pre_tag,
122 s_chtml20_start_ul_tag,
123 s_chtml20_end_ul_tag,
127 s_chtml20_start_li_tag,
128 s_chtml20_end_li_tag,
132 s_chtml20_start_ol_tag,
133 s_chtml20_end_ol_tag,
137 s_chtml20_start_h1_tag,
138 s_chtml20_end_h1_tag,
142 s_chtml20_start_h2_tag,
143 s_chtml20_end_h2_tag,
147 s_chtml20_start_h3_tag,
148 s_chtml20_end_h3_tag,
152 s_chtml20_start_h4_tag,
153 s_chtml20_end_h4_tag,
157 s_chtml20_start_h5_tag,
158 s_chtml20_end_h5_tag,
162 s_chtml20_start_h6_tag,
163 s_chtml20_end_h6_tag,
167 s_chtml20_start_head_tag,
168 s_chtml20_end_head_tag,
172 s_chtml20_start_title_tag,
173 s_chtml20_end_title_tag,
177 s_chtml20_start_base_tag,
178 s_chtml20_end_base_tag,
182 s_chtml20_start_body_tag,
183 s_chtml20_end_body_tag,
187 s_chtml20_start_a_tag,
192 s_chtml20_start_br_tag,
193 s_chtml20_end_br_tag,
202 s_chtml20_start_tr_tag,
203 s_chtml20_end_tr_tag,
217 s_chtml20_start_font_tag,
218 s_chtml20_end_font_tag,
222 s_chtml20_start_form_tag,
223 s_chtml20_end_form_tag,
227 s_chtml20_start_input_tag,
228 s_chtml20_end_input_tag,
232 s_chtml20_start_center_tag,
233 s_chtml20_end_center_tag,
237 s_chtml20_start_hr_tag,
238 s_chtml20_end_hr_tag,
242 s_chtml20_start_img_tag,
243 s_chtml20_end_img_tag,
247 s_chtml20_start_select_tag,
248 s_chtml20_end_select_tag,
252 s_chtml20_start_option_tag,
253 s_chtml20_end_option_tag,
257 s_chtml20_start_div_tag,
258 s_chtml20_end_div_tag,
262 s_chtml20_chxjif_tag,
323 * converts from CHTML5.0 to CHTML2.0.
325 * @param r [i] Requet_rec is appointed.
326 * @param spec [i] The result of the device specification processing which
327 * was done in advance is appointed.
328 * @param src [i] The character string before the converting is appointed.
329 * @return The character string after the converting is returned.
332 chxj_exchange_chtml20(
338 chxjconvrule_entry *entryp,
347 /*--------------------------------------------------------------------------*/
349 /*--------------------------------------------------------------------------*/
351 dst = chxj_qr_code_blob_handler(r, src, (size_t *)dstlen);
353 DBG(r,"i found qrcode xml");
356 DBG(r,"not found qrcode xml");
358 /*--------------------------------------------------------------------------*/
359 /* The CHTML structure is initialized. */
360 /*--------------------------------------------------------------------------*/
361 s_init_chtml20(&chtml20, &doc, r, spec);
364 chtml20.entryp = entryp;
365 chtml20.cookie = cookie;
367 if (IS_SJIS_STRING(GET_SPEC_CHARSET(spec))) {
368 ap_set_content_type(r, "text/html; charset=Windows-31J");
371 ap_set_content_type(r, "text/html; charset=UTF-8");
374 /*--------------------------------------------------------------------------*/
375 /* The character string of the input is analyzed. */
376 /*--------------------------------------------------------------------------*/
377 qs_init_malloc(&doc);
378 qs_init_root_node(&doc);
380 ss = apr_pcalloc(r->pool, srclen + 1);
381 memset(ss, 0, srclen + 1);
382 memcpy(ss, src, srclen);
385 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
388 qs_parse_string(&doc,ss, strlen(ss));
390 /*--------------------------------------------------------------------------*/
391 /* It converts it from CHTML to CHTML. */
392 /*--------------------------------------------------------------------------*/
393 chxj_node_exchange(spec,r,(void*)&chtml20, &doc, qs_get_root(&doc), 0);
396 qs_all_free(&doc,QX_LOGMARK);
399 return apr_pstrdup(r->pool,ss);
401 if (strlen(dst) == 0)
402 dst = apr_psprintf(r->pool, "\n");
404 *dstlen = strlen(dst);
407 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
414 * The CHTML structure is initialized.
416 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
417 * initialized is specified.
418 * @param doc [i] The Doc structure that should be set to the initialized
419 * HDML structure is specified.
420 * @param r [i] To use POOL, the pointer to request_rec is specified.
421 * @param spec [i] The pointer to the device_table
424 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
426 memset(doc, 0, sizeof(Doc));
427 memset(chtml20, 0, sizeof(chtml20_t));
431 chtml20->spec = spec;
432 chtml20->out = qs_alloc_zero_byte_string(r);
433 chtml20->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
435 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
440 * It is a handler who processes the HTML tag.
442 * @param pdoc [i/o] The pointer to the CHTML structure at the output
443 * destination is specified.
444 * @param node [i] The HTML tag node is specified.
445 * @return The conversion result is returned.
448 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
454 chtml20 = GET_CHTML20(pdoc);
458 /*--------------------------------------------------------------------------*/
460 /*--------------------------------------------------------------------------*/
461 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<html>\n", NULL);
468 * It is a handler who processes the HTML tag.
470 * @param pdoc [i/o] The pointer to the CHTML structure at the output
471 * destination is specified.
472 * @param node [i] The HTML tag node is specified.
473 * @return The conversion result is returned.
476 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
482 chtml20 = GET_CHTML20(pdoc);
486 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</html>\n", NULL);
493 * It is a handler who processes the META tag.
495 * @param pdoc [i/o] The pointer to the CHTML structure at the output
496 * destination is specified.
497 * @param node [i] The META tag node is specified.
498 * @return The conversion result is returned.
501 s_chtml20_start_meta_tag(void *pdoc, Node *node)
507 int content_type_flag;
510 chtml20 = GET_CHTML20(pdoc);
514 content_type_flag = 0;
517 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<meta", NULL);
519 /*--------------------------------------------------------------------------*/
521 /*--------------------------------------------------------------------------*/
522 for (attr = qs_get_attr(doc,node);
524 attr = qs_get_next_attr(doc,attr)) {
529 name = qs_get_attr_name(doc,attr);
530 value = qs_get_attr_value(doc,attr);
535 if (strcasecmp(name, "http-equiv") == 0) {
536 /*----------------------------------------------------------------------*/
538 /*----------------------------------------------------------------------*/
539 chtml20->out = apr_pstrcat(r->pool,
546 if ((*value == 'c' || *value == 'C')
547 && strcasecmp(value, "content-type") == 0)
548 content_type_flag = 1;
549 if ((*value == 'r' || *value == 'R')
550 && strcasecmp(value, "refresh") == 0)
557 if (strcasecmp(name, "content") == 0) {
558 if (content_type_flag) {
559 chtml20->out = apr_pstrcat(r->pool,
564 "text/html; charset=Windows-31J",
570 char* buf = apr_pstrdup(r->pool, value);
574 url = strchr(buf, ';');
576 sec = apr_pstrdup(r->pool, buf);
579 url = chxj_encoding_parameter(r, url);
580 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
581 chtml20->out = apr_pstrcat(r->pool,
594 chtml20->out = apr_pstrcat(r->pool,
611 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
618 * It is a handler who processes the META tag.
620 * @param pdoc [i/o] The pointer to the CHTML structure at the output
621 * destination is specified.
622 * @param node [i] The META tag node is specified.
623 * @return The conversion result is returned.
626 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
630 chtml20 = GET_CHTML20(pdoc);
637 * It is a handler who processes the HEAD tag.
639 * @param pdoc [i/o] The pointer to the CHTML structure at the output
640 * destination is specified.
641 * @param node [i] The HEAD tag node is specified.
642 * @return The conversion result is returned.
645 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
651 chtml20 = GET_CHTML20(pdoc);
655 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<head>\r\n", NULL);
662 * It is a handler who processes the HEAD tag.
664 * @param pdoc [i/o] The pointer to the CHTML structure at the output
665 * destination is specified.
666 * @param node [i] The HEAD tag node is specified.
667 * @return The conversion result is returned.
670 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
676 chtml20 = GET_CHTML20(pdoc);
680 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</head>\r\n", NULL);
687 * It is a handler who processes the TITLE tag.
689 * @param pdoc [i/o] The pointer to the CHTML structure at the output
690 * destination is specified.
691 * @param node [i] The TITLE tag node is specified.
692 * @return The conversion result is returned.
695 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
701 chtml20 = GET_CHTML20(pdoc);
705 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<title>", NULL);
712 * It is a handler who processes the TITLE tag.
714 * @param pdoc [i/o] The pointer to the CHTML structure at the output
715 * destination is specified.
716 * @param node [i] The TITLE tag node is specified.
717 * @return The conversion result is returned.
720 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
726 chtml20 = GET_CHTML20(pdoc);
730 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</title>\r\n", NULL);
737 * It is a handler who processes the BASE tag.
739 * @param pdoc [i/o] The pointer to the CHTML structure at the output
740 * destination is specified.
741 * @param node [i] The BASE tag node is specified.
742 * @return The conversion result is returned.
745 s_chtml20_start_base_tag(void *pdoc, Node *node)
752 chtml20 = GET_CHTML20(pdoc);
756 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<base", NULL);
758 /*--------------------------------------------------------------------------*/
760 /*--------------------------------------------------------------------------*/
761 for (attr = qs_get_attr(doc,node);
763 attr = qs_get_next_attr(doc,attr)) {
768 name = qs_get_attr_name(doc,attr);
769 value = qs_get_attr_value(doc,attr);
771 if ((*name == 'h' || *name == 'H')
772 && strcasecmp(name, "href") == 0) {
773 chtml20->out = apr_pstrcat(r->pool,
782 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >\r\n", NULL);
789 * It is a handler who processes the BASE tag.
791 * @param pdoc [i/o] The pointer to the CHTML structure at the output
792 * destination is specified.
793 * @param node [i] The BASE tag node is specified.
794 * @return The conversion result is returned.
797 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
803 chtml20 = GET_CHTML20(pdoc);
812 * It is a handler who processes the BODY tag.
814 * @param pdoc [i/o] The pointer to the CHTML structure at the output
815 * destination is specified.
816 * @param node [i] The BODY tag node is specified.
817 * @return The conversion result is returned.
820 s_chtml20_start_body_tag(void *pdoc, Node *node)
827 chtml20 = GET_CHTML20(pdoc);
831 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<body", NULL);
833 /*--------------------------------------------------------------------------*/
835 /*--------------------------------------------------------------------------*/
836 for (attr = qs_get_attr(doc,node);
838 attr = qs_get_next_attr(doc,attr)) {
842 name = qs_get_attr_name(doc,attr);
843 value = qs_get_attr_value(doc,attr);
848 if (strcasecmp(name, "bgcolor") == 0) {
849 /*----------------------------------------------------------------------*/
851 /*----------------------------------------------------------------------*/
852 chtml20->out = apr_pstrcat(r->pool,
863 if (strcasecmp(name, "text") == 0) {
864 /*----------------------------------------------------------------------*/
866 /*----------------------------------------------------------------------*/
867 chtml20->out = apr_pstrcat(r->pool,
878 if (strcasecmp(name, "link") == 0) {
879 /*----------------------------------------------------------------------*/
881 /*----------------------------------------------------------------------*/
882 chtml20->out = apr_pstrcat(r->pool,
893 if (strcasecmp(name, "alink") == 0) {
894 /*----------------------------------------------------------------------*/
896 /*----------------------------------------------------------------------*/
903 if (strcasecmp(name, "vlink") == 0) {
904 /*----------------------------------------------------------------------*/
906 /*----------------------------------------------------------------------*/
916 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
923 * It is a handler who processes the BODY tag.
925 * @param pdoc [i/o] The pointer to the CHTML structure at the output
926 * destination is specified.
927 * @param node [i] The BODY tag node is specified.
928 * @return The conversion result is returned.
931 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
937 chtml20 = GET_CHTML20(pdoc);
941 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</body>\r\n", NULL);
948 * It is a handler who processes the A tag.
950 * @param pdoc [i/o] The pointer to the CHTML structure at the output
951 * destination is specified.
952 * @param node [i] The A tag node is specified.
953 * @return The conversion result is returned.
956 s_chtml20_start_a_tag(void *pdoc, Node *node)
963 chtml20 = GET_CHTML20(pdoc);
967 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<a", NULL);
969 /*--------------------------------------------------------------------------*/
971 /*--------------------------------------------------------------------------*/
972 for (attr = qs_get_attr(doc,node);
974 attr = qs_get_next_attr(doc,attr)) {
979 name = qs_get_attr_name(doc,attr);
980 value = qs_get_attr_value(doc,attr);
985 if (strcasecmp(name, "name") == 0) {
986 /*--------------------------------------------------------------------*/
988 /*--------------------------------------------------------------------*/
989 chtml20->out = apr_pstrcat(r->pool,
1000 if (strcasecmp(name, "href") == 0) {
1001 /*--------------------------------------------------------------------*/
1003 /*--------------------------------------------------------------------*/
1004 value = chxj_encoding_parameter(r, value);
1005 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1007 chtml20->out = apr_pstrcat(r->pool,
1018 if (strcasecmp(name, "accesskey") == 0) {
1019 /*--------------------------------------------------------------------*/
1021 /*--------------------------------------------------------------------*/
1022 chtml20->out = apr_pstrcat(r->pool,
1033 if (strcasecmp(name, "cti") == 0) {
1034 /*--------------------------------------------------------------------*/
1036 /*--------------------------------------------------------------------*/
1037 chtml20->out = apr_pstrcat(r->pool,
1048 if (strcasecmp(name, "ijam") == 0) {
1049 /*--------------------------------------------------------------------*/
1051 /*--------------------------------------------------------------------*/
1055 if (strcasecmp(name, "ista") == 0) {
1056 /*--------------------------------------------------------------------*/
1058 /*--------------------------------------------------------------------*/
1062 if (strcasecmp(name, "ilet") == 0) {
1063 /*--------------------------------------------------------------------*/
1065 /*--------------------------------------------------------------------*/
1069 if (strcasecmp(name, "iswf") == 0) {
1070 /*--------------------------------------------------------------------*/
1072 /*--------------------------------------------------------------------*/
1076 if (strcasecmp(name, "irst") == 0) {
1077 /*--------------------------------------------------------------------*/
1079 /*--------------------------------------------------------------------*/
1086 if (strcasecmp(name, "utn") == 0) {
1087 /*--------------------------------------------------------------------*/
1089 /*--------------------------------------------------------------------*/
1096 if (strcasecmp(name, "telbook") == 0) {
1097 /*--------------------------------------------------------------------*/
1099 /*--------------------------------------------------------------------*/
1106 if (strcasecmp(name, "kana") == 0) {
1107 /*--------------------------------------------------------------------*/
1109 /*--------------------------------------------------------------------*/
1116 if (strcasecmp(name, "email") == 0) {
1117 /*--------------------------------------------------------------------*/
1119 /*--------------------------------------------------------------------*/
1129 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1131 return chtml20->out;
1136 * It is a handler who processes the A tag.
1138 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1139 * destination is specified.
1140 * @param node [i] The A tag node is specified.
1141 * @return The conversion result is returned.
1144 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1150 chtml20 = GET_CHTML20(pdoc);
1154 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</a>", NULL);
1156 return chtml20->out;
1161 * It is a handler who processes the BR tag.
1163 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1164 * destination is specified.
1165 * @param node [i] The BR tag node is specified.
1166 * @return The conversion result is returned.
1169 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1175 chtml20 = GET_CHTML20(pdoc);
1179 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
1181 return chtml20->out;
1186 * It is a handler who processes the BR tag.
1188 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1189 * destination is specified.
1190 * @param node [i] The BR tag node is specified.
1191 * @return The conversion result is returned.
1194 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1200 chtml20 = GET_CHTML20(pdoc);
1204 return chtml20->out;
1209 * It is a handler who processes the TR tag.
1211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1212 * destination is specified.
1213 * @param node [i] The TR tag node is specified.
1214 * @return The conversion result is returned.
1217 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1223 chtml20 = GET_CHTML20(pdoc);
1227 return chtml20->out;
1232 * It is a handler who processes the TR tag.
1234 * @param chtml20 [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_end_tr_tag(void *pdoc, Node *UNUSED(child))
1246 chtml20 = GET_CHTML20(pdoc);
1250 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
1252 return chtml20->out;
1257 * It is a handler who processes the FONT tag.
1259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1260 * destination is specified.
1261 * @param node [i] The FONT tag node is specified.
1262 * @return The conversion result is returned.
1265 s_chtml20_start_font_tag(void *pdoc, Node *node)
1272 chtml20 = GET_CHTML20(pdoc);
1277 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<font", NULL);
1279 /*--------------------------------------------------------------------------*/
1280 /* Get Attributes */
1281 /*--------------------------------------------------------------------------*/
1282 for (attr = qs_get_attr(doc,node);
1284 attr = qs_get_next_attr(doc,attr)) {
1289 name = qs_get_attr_name(doc,attr);
1290 value = qs_get_attr_value(doc,attr);
1295 if (strcasecmp(name, "color") == 0) {
1296 chtml20->out = apr_pstrcat(r->pool,
1307 if (strcasecmp(name, "size") == 0) {
1308 /*--------------------------------------------------------------------*/
1310 /*--------------------------------------------------------------------*/
1320 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1322 return chtml20->out;
1327 * It is a handler who processes the FONT tag.
1329 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1330 * destination is specified.
1331 * @param node [i] The FONT tag node is specified.
1332 * @return The conversion result is returned.
1335 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1341 chtml20 = GET_CHTML20(pdoc);
1345 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</font>", NULL);
1347 return chtml20->out;
1352 * It is a handler who processes the FORM tag.
1354 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1355 * destination is specified.
1356 * @param node [i] The FORM tag node is specified.
1357 * @return The conversion result is returned.
1360 s_chtml20_start_form_tag(void *pdoc, Node *node)
1367 chtml20 = GET_CHTML20(pdoc);
1372 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<form", NULL);
1374 /*--------------------------------------------------------------------------*/
1375 /* Get Attributes */
1376 /*--------------------------------------------------------------------------*/
1377 for (attr = qs_get_attr(doc,node);
1379 attr = qs_get_next_attr(doc,attr)) {
1384 name = qs_get_attr_name(doc,attr);
1385 value = qs_get_attr_value(doc,attr);
1390 if (strcasecmp(name, "action") == 0) {
1391 /*--------------------------------------------------------------------*/
1393 /*--------------------------------------------------------------------*/
1394 value = chxj_encoding_parameter(r, value);
1395 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1397 chtml20->out = apr_pstrcat(r->pool,
1408 if (strcasecmp(name, "method") == 0) {
1409 /*--------------------------------------------------------------------*/
1411 /*--------------------------------------------------------------------*/
1412 chtml20->out = apr_pstrcat(r->pool,
1423 if (strcasecmp(name, "utn") == 0) {
1424 /*--------------------------------------------------------------------*/
1426 /*--------------------------------------------------------------------*/
1436 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1438 return chtml20->out;
1443 * It is a handler who processes the FORM tag.
1445 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1446 * destination is specified.
1447 * @param node [i] The FORM tag node is specified.
1448 * @return The conversion result is returned.
1451 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1457 chtml20 = GET_CHTML20(pdoc);
1461 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</form>", NULL);
1463 return chtml20->out;
1468 * It is a handler who processes the INPUT tag.
1470 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1471 * destination is specified.
1472 * @param node [i] The INPUT tag node is specified.
1473 * @return The conversion result is returned.
1476 s_chtml20_start_input_tag(void *pdoc, Node *node)
1481 char *max_length = NULL;
1485 char *istyle = NULL;
1487 char *checked = NULL;
1488 char *accesskey = NULL;
1490 chtml20 = GET_CHTML20(pdoc);
1495 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<input", NULL);
1497 /*--------------------------------------------------------------------------*/
1498 /* Get Attributes */
1499 /*--------------------------------------------------------------------------*/
1501 type = qs_get_type_attr(doc, node, r);
1502 name = qs_get_name_attr(doc, node, r);
1503 value = qs_get_value_attr(doc,node,r);
1504 istyle = qs_get_istyle_attr(doc,node,r);
1505 max_length = qs_get_maxlength_attr(doc,node,r);
1506 checked = qs_get_checked_attr(doc,node,r);
1507 accesskey = qs_get_accesskey_attr(doc, node, r);
1508 size = qs_get_size_attr(doc, node, r);
1511 chtml20->out = apr_pstrcat(r->pool,
1519 chtml20->out = apr_pstrcat(r->pool,
1527 chtml20->out = apr_pstrcat(r->pool,
1535 chtml20->out = apr_pstrcat(r->pool,
1543 chtml20->out = apr_pstrcat(r->pool,
1550 /*------------------------------------------------------------------------*/
1552 /*------------------------------------------------------------------------*/
1553 chtml20->out = apr_pstrcat(r->pool,
1559 /*--------------------------------------------------------------------------*/
1560 /* The figure is default for the password. */
1561 /*--------------------------------------------------------------------------*/
1563 if (chxj_chk_numeric(max_length) != 0)
1564 max_length = apr_psprintf(r->pool, "0");
1565 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1566 chtml20->out = apr_pstrcat(r->pool,
1568 apr_psprintf(r->pool,
1569 " maxlength=\"%d\"",
1570 chxj_atoi(max_length)*2),
1573 chtml20->out = apr_pstrcat(r->pool,
1575 apr_psprintf(r->pool,
1576 " maxlength=\"%d\"",
1577 chxj_atoi(max_length)),
1582 chtml20->out = apr_pstrcat(r->pool,
1587 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
1589 return chtml20->out;
1594 * It is a handler who processes the INPUT tag.
1596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1597 * destination is specified.
1598 * @param node [i] The INPUT tag node is specified.
1599 * @return The conversion result is returned.
1602 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1608 chtml20 = GET_CHTML20(pdoc);
1612 return chtml20->out;
1617 * It is a handler who processes the CENTER tag.
1619 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1620 * destination is specified.
1621 * @param node [i] The CENTER tag node is specified.
1622 * @return The conversion result is returned.
1625 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1631 chtml20 = GET_CHTML20(pdoc);
1635 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<center>", NULL);
1637 return chtml20->out;
1642 * It is a handler who processes the CENTER tag.
1644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1645 * destination is specified.
1646 * @param node [i] The CENTER tag node is specified.
1647 * @return The conversion result is returned.
1650 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1656 chtml20 = GET_CHTML20(pdoc);
1660 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</center>", NULL);
1662 return chtml20->out;
1667 * It is a handler who processes the UL tag.
1669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1670 * destination is specified.
1671 * @param node [i] The UL tag node is specified.
1672 * @return The conversion result is returned.
1675 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1681 chtml20 = GET_CHTML20(pdoc);
1685 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<ul>", NULL);
1687 return chtml20->out;
1692 * It is a handler who processes the UL tag.
1694 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1695 * destination is specified.
1696 * @param node [i] The UL tag node is specified.
1697 * @return The conversion result is returned.
1700 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1706 chtml20 = GET_CHTML20(pdoc);
1710 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</ul>", NULL);
1712 return chtml20->out;
1717 * It is a handler who processes the OL tag.
1719 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1720 * destination is specified.
1721 * @param node [i] The OL tag node is specified.
1722 * @return The conversion result is returned.
1725 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1731 chtml20 = GET_CHTML20(pdoc);
1735 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<ol>", NULL);
1737 return chtml20->out;
1742 * It is a handler who processes the OL tag.
1744 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1745 * destination is specified.
1746 * @param node [i] The OL tag node is specified.
1747 * @return The conversion result is returned.
1750 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1756 chtml20 = GET_CHTML20(pdoc);
1760 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</ol>", NULL);
1762 return chtml20->out;
1767 * It is a handler who processes the LI tag.
1769 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1770 * destination is specified.
1771 * @param node [i] The LI tag node is specified.
1772 * @return The conversion result is returned.
1775 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1781 chtml20 = GET_CHTML20(pdoc);
1785 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<li>", NULL);
1787 return chtml20->out;
1792 * It is a handler who processes the LI tag.
1794 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1795 * destination is specified.
1796 * @param node [i] The LI tag node is specified.
1797 * @return The conversion result is returned.
1800 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1806 chtml20 = GET_CHTML20(pdoc);
1810 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</li>", NULL);
1812 return chtml20->out;
1817 * It is a handler who processes the HR tag.
1819 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1820 * destination is specified.
1821 * @param node [i] The HR tag node is specified.
1822 * @return The conversion result is returned.
1825 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1832 chtml20 = GET_CHTML20(pdoc);
1837 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<hr ", NULL);
1839 for (attr = qs_get_attr(doc,node);
1841 attr = qs_get_next_attr(doc,attr)) {
1846 name = qs_get_attr_name(doc,attr);
1847 value = qs_get_attr_value(doc,attr);
1852 if (strcasecmp(name, "align") == 0) {
1853 /*--------------------------------------------------------------------*/
1855 /*--------------------------------------------------------------------*/
1856 chtml20->out = apr_pstrcat(r->pool,
1867 if (strcasecmp(name, "size") == 0) {
1868 /*--------------------------------------------------------------------*/
1870 /*--------------------------------------------------------------------*/
1871 chtml20->out = apr_pstrcat(r->pool,
1882 if (strcasecmp(name, "width") == 0) {
1883 /*--------------------------------------------------------------------*/
1885 /*--------------------------------------------------------------------*/
1886 chtml20->out = apr_pstrcat(r->pool,
1897 if (strcasecmp(name, "noshade") == 0) {
1898 /*--------------------------------------------------------------------*/
1900 /*--------------------------------------------------------------------*/
1901 chtml20->out = apr_pstrcat(r->pool,
1910 if (strcasecmp(name, "color") == 0) {
1911 /*--------------------------------------------------------------------*/
1913 /*--------------------------------------------------------------------*/
1923 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
1925 return chtml20->out;
1930 * It is a handler who processes the HR tag.
1932 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1933 * destination is specified.
1934 * @param node [i] The HR tag node is specified.
1935 * @return The conversion result is returned.
1938 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1944 chtml20 = GET_CHTML20(pdoc);
1948 return chtml20->out;
1953 * It is a handler who processes the IMG tag.
1955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1956 * destination is specified.
1957 * @param node [i] The IMG tag node is specified.
1958 * @return The conversion result is returned.
1961 s_chtml20_start_img_tag(void *pdoc, Node *node)
1967 #ifndef IMG_NOT_CONVERT_FILENAME
1971 chtml20 = GET_CHTML20(pdoc);
1975 #ifndef IMG_NOT_CONVERT_FILENAME
1976 spec = chtml20->spec;
1979 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<img", NULL);
1982 /*-------------------------------------------------------------------------*/
1983 /* Get Attributes */
1984 /*-------------------------------------------------------------------------*/
1985 for (attr = qs_get_attr(doc,node);
1987 attr = qs_get_next_attr(doc,attr)) {
1992 name = qs_get_attr_name(doc,attr);
1993 value = qs_get_attr_value(doc,attr);
1998 if (strcasecmp(name, "src") == 0) {
1999 /*-------------------------------------------------------------------*/
2001 /*-------------------------------------------------------------------*/
2002 #ifdef IMG_NOT_CONVERT_FILENAME
2003 value = chxj_encoding_parameter(r, value);
2004 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2006 value = apr_psprintf(r->pool,
2009 (strchr(value, '?')) ? '&' : '?',
2010 CHXJ_COOKIE_NOUPDATE_PARAM);
2012 chtml20->out = apr_pstrcat(r->pool,
2019 value = chxj_img_conv(r, spec, value);
2020 value = chxj_encoding_parameter(r, value);
2021 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2023 value = apr_psprintf(r->pool,
2026 (strchr(value, '?')) ? '&' : '?',
2027 CHXJ_COOKIE_NOUPDATE_PARAM);
2030 chtml20->out = apr_pstrcat(r->pool,
2031 chtml20->out, " src=\"",
2035 chtml20->out = apr_pstrcat(r->pool,
2045 if (strcasecmp(name, "align" ) == 0) {
2046 /*--------------------------------------------------------------------*/
2048 /*--------------------------------------------------------------------*/
2049 chtml20->out = apr_pstrcat(r->pool,
2057 if (strcasecmp(name, "alt" ) == 0) {
2058 /*--------------------------------------------------------------------*/
2060 /*--------------------------------------------------------------------*/
2061 chtml20->out = apr_pstrcat(r->pool,
2069 if (strcasecmp(name, "align" ) == 0) {
2070 /*--------------------------------------------------------------------*/
2072 /*--------------------------------------------------------------------*/
2079 if (strcasecmp(name, "width" ) == 0) {
2080 /*--------------------------------------------------------------------*/
2082 /*--------------------------------------------------------------------*/
2083 chtml20->out = apr_pstrcat(r->pool,
2094 if (strcasecmp(name, "height") == 0) {
2095 /*--------------------------------------------------------------------*/
2097 /*--------------------------------------------------------------------*/
2098 chtml20->out = apr_pstrcat(r->pool,
2106 if (strcasecmp(name, "hspace") == 0) {
2107 /*--------------------------------------------------------------------*/
2109 /*--------------------------------------------------------------------*/
2110 chtml20->out = apr_pstrcat(r->pool,
2121 if (strcasecmp(name, "vspace") == 0) {
2122 /*--------------------------------------------------------------------*/
2124 /*--------------------------------------------------------------------*/
2125 chtml20->out = apr_pstrcat(r->pool,
2139 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
2141 return chtml20->out;
2146 * It is a handler who processes the IMG tag.
2148 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2149 * destination is specified.
2150 * @param node [i] The IMG tag node is specified.
2151 * @return The conversion result is returned.
2154 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2160 chtml20 = GET_CHTML20(pdoc);
2164 return chtml20->out;
2169 * It is a handler who processes the SELECT tag.
2171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2172 * destination is specified.
2173 * @param node [i] The SELECT tag node is specified.
2174 * @return The conversion result is returned.
2177 s_chtml20_start_select_tag(void *pdoc, Node *child)
2184 chtml20 = GET_CHTML20(pdoc);
2191 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<select", NULL);
2193 for (attr = qs_get_attr(doc,child);
2195 attr = qs_get_next_attr(doc,attr)) {
2200 nm = qs_get_attr_name(doc,attr);
2201 val = qs_get_attr_value(doc,attr);
2206 if (strcasecmp(nm, "size") == 0) {
2207 /*--------------------------------------------------------------------*/
2208 /* CHTML 1.0 version 2.0 */
2209 /*--------------------------------------------------------------------*/
2210 size = apr_pstrdup(r->pool, val);
2216 if (strcasecmp(nm, "name") == 0) {
2217 /*--------------------------------------------------------------------*/
2218 /* CHTML 1.0 version 2.0 */
2219 /*--------------------------------------------------------------------*/
2220 name = apr_pstrdup(r->pool, val);
2226 if (strcasecmp(nm, "multiple") == 0) {
2227 /*--------------------------------------------------------------------*/
2228 /* CHTML 1.0 version 2.0 */
2229 /*--------------------------------------------------------------------*/
2240 chtml20->out = apr_pstrcat(r->pool,
2248 chtml20->out = apr_pstrcat(r->pool,
2255 chtml20->out = apr_pstrcat(r->pool,
2260 return chtml20->out;
2265 * It is a handler who processes the SELECT tag.
2267 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2268 * destination is specified.
2269 * @param node [i] The SELECT tag node is specified.
2270 * @return The conversion result is returned.
2273 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2279 chtml20 = GET_CHTML20(pdoc);
2283 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</select>\n", NULL);
2285 return chtml20->out;
2290 * It is a handler who processes the OPTION tag.
2292 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2293 * destination is specified.
2294 * @param node [i] The OPTION tag node is specified.
2295 * @return The conversion result is returned.
2298 s_chtml20_start_option_tag(void *pdoc, Node *child)
2305 chtml20 = GET_CHTML20(pdoc);
2309 char* selected = NULL;
2312 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<option", NULL);
2314 for (attr = qs_get_attr(doc,child);
2316 attr = qs_get_next_attr(doc,attr)) {
2321 nm = qs_get_attr_name(doc,attr);
2322 val = qs_get_attr_value(doc,attr);
2327 if (strcasecmp(nm, "selected") == 0) {
2328 /*--------------------------------------------------------------------*/
2329 /* CHTML 1.0 version 2.0 */
2330 /*--------------------------------------------------------------------*/
2331 selected = apr_pstrdup(r->pool, val);
2337 if (strcasecmp(nm, "value") == 0) {
2338 /*--------------------------------------------------------------------*/
2339 /* CHTML 1.0 version 2.0 */
2340 /*--------------------------------------------------------------------*/
2341 value = apr_pstrdup(r->pool, val);
2351 chtml20->out = apr_pstrcat(r->pool,
2358 chtml20->out = apr_pstrcat(r->pool,
2364 chtml20->out = apr_pstrcat(r->pool,
2369 chtml20->out = apr_pstrcat(r->pool,
2374 return chtml20->out;
2379 * It is a handler who processes the OPTION tag.
2381 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2382 * destination is specified.
2383 * @param node [i] The OPTION tag node is specified.
2384 * @return The conversion result is returned.
2387 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2393 chtml20 = GET_CHTML20(pdoc);
2399 return chtml20->out;
2404 * It is a handler who processes the DIV tag.
2406 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2407 * destination is specified.
2408 * @param node [i] The DIV tag node is specified.
2409 * @return The conversion result is returned.
2412 s_chtml20_start_div_tag(void *pdoc, Node *child)
2419 chtml20 = GET_CHTML20(pdoc);
2426 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<div", NULL);
2428 for (attr = qs_get_attr(doc,child);
2430 attr = qs_get_next_attr(doc,attr)) {
2435 nm = qs_get_attr_name(doc,attr);
2436 val = qs_get_attr_value(doc,attr);
2438 if ((*nm == 'a'||*nm == 'A') && strcasecmp(nm, "align") == 0) {
2439 /*----------------------------------------------------------------------*/
2440 /* CHTML 1.0 (W3C version 3.2) */
2441 /*----------------------------------------------------------------------*/
2442 align = apr_pstrdup(r->pool, val);
2447 chtml20->out = apr_pstrcat(r->pool,
2454 chtml20->out = apr_pstrcat(r->pool,
2459 return chtml20->out;
2464 * It is a handler who processes the DIV tag.
2466 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2467 * destination is specified.
2468 * @param node [i] The DIV tag node is specified.
2469 * @return The conversion result is returned.
2472 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2478 chtml20 = GET_CHTML20(pdoc);
2482 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</div>\n", NULL);
2484 return chtml20->out;
2489 * It is a handler who processes the H1 tag.
2491 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2492 * destination is specified.
2493 * @param node [i] The H1 tag node is specified.
2494 * @return The conversion result is returned.
2497 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2503 chtml20 = GET_CHTML20(pdoc);
2507 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h1>\r\n", NULL);
2509 return chtml20->out;
2514 * It is a handler who processes the H1 tag.
2516 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2517 * destination is specified.
2518 * @param node [i] The H1 tag node is specified.
2519 * @return The conversion result is returned.
2522 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2528 chtml20 = GET_CHTML20(pdoc);
2532 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h1>\r\n", NULL);
2534 return chtml20->out;
2539 * It is a handler who processes the H2 tag.
2541 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2542 * destination is specified.
2543 * @param node [i] The H2 tag node is specified.
2544 * @return The conversion result is returned.
2547 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2553 chtml20 = GET_CHTML20(pdoc);
2557 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h2>\r\n", NULL);
2559 return chtml20->out;
2564 * It is a handler who processes the H2 tag.
2566 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2567 * destination is specified.
2568 * @param node [i] The H2 tag node is specified.
2569 * @return The conversion result is returned.
2572 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2578 chtml20 = GET_CHTML20(pdoc);
2582 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h2>\r\n", NULL);
2584 return chtml20->out;
2589 * It is a handler who processes the H3 tag.
2591 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2592 * destination is specified.
2593 * @param node [i] The H3 tag node is specified.
2594 * @return The conversion result is returned.
2597 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2603 chtml20 = GET_CHTML20(pdoc);
2607 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h3>\r\n", NULL);
2609 return chtml20->out;
2614 * It is a handler who processes the H3 tag.
2616 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2617 * destination is specified.
2618 * @param node [i] The H3 tag node is specified.
2619 * @return The conversion result is returned.
2622 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2628 chtml20 = GET_CHTML20(pdoc);
2632 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h3>\r\n", NULL);
2634 return chtml20->out;
2639 * It is a handler who processes the H4 tag.
2641 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2642 * destination is specified.
2643 * @param node [i] The H4 tag node is specified.
2644 * @return The conversion result is returned.
2647 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2653 chtml20 = GET_CHTML20(pdoc);
2657 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h4>\r\n", NULL);
2659 return chtml20->out;
2664 * It is a handler who processes the H4 tag.
2666 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2667 * destination is specified.
2668 * @param node [i] The H4 tag node is specified.
2669 * @return The conversion result is returned.
2672 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2678 chtml20 = GET_CHTML20(pdoc);
2682 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h4>\r\n", NULL);
2684 return chtml20->out;
2689 * It is a handler who processes the H5 tag.
2691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2692 * destination is specified.
2693 * @param node [i] The H5 tag node is specified.
2694 * @return The conversion result is returned.
2697 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2703 chtml20 = GET_CHTML20(pdoc);
2707 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h5>\r\n", NULL);
2709 return chtml20->out;
2714 * It is a handler who processes the H5 tag.
2716 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2717 * destination is specified.
2718 * @param node [i] The H5 tag node is specified.
2719 * @return The conversion result is returned.
2722 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2728 chtml20 = GET_CHTML20(pdoc);
2732 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h5>\r\n", NULL);
2734 return chtml20->out;
2739 * It is a handler who processes the H6 tag.
2741 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2742 * destination is specified.
2743 * @param node [i] The H6 tag node is specified.
2744 * @return The conversion result is returned.
2747 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2753 chtml20 = GET_CHTML20(pdoc);
2757 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h6>\r\n", NULL);
2759 return chtml20->out;
2764 * It is a handler who processes the H6 tag.
2766 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2767 * destination is specified.
2768 * @param node [i] The H6 tag node is specified.
2769 * @return The conversion result is returned.
2772 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2778 chtml20 = GET_CHTML20(pdoc);
2782 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h6>\r\n", NULL);
2784 return chtml20->out;
2789 * It is a handler who processes the PRE tag.
2791 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2792 * destination is specified.
2793 * @param node [i] The PRE tag node is specified.
2794 * @return The conversion result is returned.
2797 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2803 chtml20 = GET_CHTML20(pdoc);
2807 chtml20->pre_flag++;
2808 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<pre>", NULL);
2810 return chtml20->out;
2815 * It is a handler who processes the PRE tag.
2817 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2818 * destination is specified.
2819 * @param node [i] The PRE tag node is specified.
2820 * @return The conversion result is returned.
2823 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2829 chtml20 = GET_CHTML20(pdoc);
2833 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</pre>", NULL);
2834 chtml20->pre_flag--;
2836 return chtml20->out;
2841 * It is a handler who processes the P tag.
2843 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2844 * destination is specified.
2845 * @param node [i] The P tag node is specified.
2846 * @return The conversion result is returned.
2849 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2855 chtml20 = GET_CHTML20(pdoc);
2859 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<p>", NULL);
2861 return chtml20->out;
2866 * It is a handler who processes the P tag.
2868 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2869 * destination is specified.
2870 * @param node [i] The P tag node is specified.
2871 * @return The conversion result is returned.
2874 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2880 chtml20 = GET_CHTML20(pdoc);
2884 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</p>", NULL);
2886 return chtml20->out;
2891 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2898 chtml20 = GET_CHTML20(pdoc);
2902 for (child = qs_get_child_node(doc, node);
2904 child = qs_get_next_node(doc, child)) {
2906 chtml20->out = apr_pstrcat(r->pool, chtml20->out, child->otext, NULL);
2908 s_chtml20_chxjif_tag(pdoc, child);
2916 * It is a handler who processes the TEXTARE tag.
2918 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2919 * destination is specified.
2920 * @param node [i] The TEXTAREA tag node is specified.
2921 * @return The conversion result is returned.
2924 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2931 chtml20 = GET_CHTML20(pdoc);
2935 chtml20->textarea_flag++;
2936 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<textarea ", NULL);
2938 for (attr = qs_get_attr(doc,node);
2940 attr = qs_get_next_attr(doc,attr)) {
2945 name = qs_get_attr_name(doc,attr);
2946 value = qs_get_attr_value(doc,attr);
2951 if (strcasecmp(name, "name") == 0) {
2952 chtml20->out = apr_pstrcat(r->pool,
2963 if (strcasecmp(name, "rows") == 0) {
2964 chtml20->out = apr_pstrcat(r->pool,
2975 if (strcasecmp(name, "cols") == 0) {
2976 chtml20->out = apr_pstrcat(r->pool,
2990 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
2992 return chtml20->out;
2997 * It is a handler who processes the TEXTAREA tag.
2999 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3000 * destination is specified.
3001 * @param node [i] The TEXTAREA tag node is specified.
3002 * @return The conversion result is returned.
3005 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3011 chtml20 = GET_CHTML20(pdoc);
3016 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</textarea>\r\n", NULL);
3017 chtml20->textarea_flag--;
3019 return chtml20->out;
3024 s_chtml20_text_tag(void *pdoc, Node *child)
3036 chtml20 = GET_CHTML20(pdoc);
3040 textval = qs_get_node_value(doc,child);
3041 textval = qs_trim_string(chtml20->doc->r, textval);
3042 if (strlen(textval) == 0)
3043 return chtml20->out;
3045 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3046 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3048 tdst = qs_alloc_zero_byte_string(r);
3049 memset(one_byte, 0, sizeof(one_byte));
3052 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3053 if (is_sjis_kanji(textval[ii])) {
3054 one_byte[0] = textval[ii+0];
3055 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3056 one_byte[0] = textval[ii+1];
3057 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3061 if (chtml20->pre_flag) {
3062 one_byte[0] = textval[ii+0];
3063 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3066 if (chtml20->textarea_flag) {
3067 one_byte[0] = textval[ii+0];
3068 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3071 if (textval[ii] != '\r' && textval[ii] != '\n') {
3072 one_byte[0] = textval[ii+0];
3073 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3076 chtml20->out = apr_pstrcat(r->pool, chtml20->out, tdst, NULL);
3078 return chtml20->out;