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);
89 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
91 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
92 static char *s_chtml20_text_tag(void *pdoc, Node *node);
96 tag_handler chtml20_handler[] = {
99 s_chtml20_start_html_tag,
100 s_chtml20_end_html_tag,
104 s_chtml20_start_meta_tag,
105 s_chtml20_end_meta_tag,
109 s_chtml20_start_textarea_tag,
110 s_chtml20_end_textarea_tag,
114 s_chtml20_start_p_tag,
119 s_chtml20_start_pre_tag,
120 s_chtml20_end_pre_tag,
124 s_chtml20_start_ul_tag,
125 s_chtml20_end_ul_tag,
129 s_chtml20_start_li_tag,
130 s_chtml20_end_li_tag,
134 s_chtml20_start_ol_tag,
135 s_chtml20_end_ol_tag,
139 s_chtml20_start_h1_tag,
140 s_chtml20_end_h1_tag,
144 s_chtml20_start_h2_tag,
145 s_chtml20_end_h2_tag,
149 s_chtml20_start_h3_tag,
150 s_chtml20_end_h3_tag,
154 s_chtml20_start_h4_tag,
155 s_chtml20_end_h4_tag,
159 s_chtml20_start_h5_tag,
160 s_chtml20_end_h5_tag,
164 s_chtml20_start_h6_tag,
165 s_chtml20_end_h6_tag,
169 s_chtml20_start_head_tag,
170 s_chtml20_end_head_tag,
174 s_chtml20_start_title_tag,
175 s_chtml20_end_title_tag,
179 s_chtml20_start_base_tag,
180 s_chtml20_end_base_tag,
184 s_chtml20_start_body_tag,
185 s_chtml20_end_body_tag,
189 s_chtml20_start_a_tag,
194 s_chtml20_start_br_tag,
195 s_chtml20_end_br_tag,
204 s_chtml20_start_tr_tag,
205 s_chtml20_end_tr_tag,
219 s_chtml20_start_font_tag,
220 s_chtml20_end_font_tag,
224 s_chtml20_start_form_tag,
225 s_chtml20_end_form_tag,
229 s_chtml20_start_input_tag,
230 s_chtml20_end_input_tag,
234 s_chtml20_start_center_tag,
235 s_chtml20_end_center_tag,
239 s_chtml20_start_hr_tag,
240 s_chtml20_end_hr_tag,
244 s_chtml20_start_img_tag,
245 s_chtml20_end_img_tag,
249 s_chtml20_start_select_tag,
250 s_chtml20_end_select_tag,
254 s_chtml20_start_option_tag,
255 s_chtml20_end_option_tag,
259 s_chtml20_start_div_tag,
260 s_chtml20_end_div_tag,
264 s_chtml20_chxjif_tag,
325 * converts from CHTML5.0 to CHTML2.0.
327 * @param r [i] Requet_rec is appointed.
328 * @param spec [i] The result of the device specification processing which
329 * was done in advance is appointed.
330 * @param src [i] The character string before the converting is appointed.
331 * @return The character string after the converting is returned.
334 chxj_exchange_chtml20(
340 chxjconvrule_entry *entryp,
349 /*--------------------------------------------------------------------------*/
351 /*--------------------------------------------------------------------------*/
353 dst = chxj_qr_code_blob_handler(r, src, (size_t *)dstlen);
355 DBG(r,"i found qrcode xml");
358 DBG(r,"not found qrcode xml");
360 /*--------------------------------------------------------------------------*/
361 /* The CHTML structure is initialized. */
362 /*--------------------------------------------------------------------------*/
363 s_init_chtml20(&chtml20, &doc, r, spec);
366 chtml20.entryp = entryp;
367 chtml20.cookie = cookie;
369 if (IS_SJIS_STRING(GET_SPEC_CHARSET(spec))) {
370 ap_set_content_type(r, "text/html; charset=Windows-31J");
373 ap_set_content_type(r, "text/html; charset=UTF-8");
376 /*--------------------------------------------------------------------------*/
377 /* The character string of the input is analyzed. */
378 /*--------------------------------------------------------------------------*/
379 qs_init_malloc(&doc);
380 qs_init_root_node(&doc);
382 ss = apr_pcalloc(r->pool, srclen + 1);
383 memset(ss, 0, srclen + 1);
384 memcpy(ss, src, srclen);
387 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
390 qs_parse_string(&doc,ss, strlen(ss));
392 /*--------------------------------------------------------------------------*/
393 /* It converts it from CHTML to CHTML. */
394 /*--------------------------------------------------------------------------*/
395 chxj_node_exchange(spec,r,(void*)&chtml20, &doc, qs_get_root(&doc), 0);
398 qs_all_free(&doc,QX_LOGMARK);
401 return apr_pstrdup(r->pool,ss);
403 if (strlen(dst) == 0)
404 dst = apr_psprintf(r->pool, "\n");
406 *dstlen = strlen(dst);
409 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
416 * The CHTML structure is initialized.
418 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
419 * initialized is specified.
420 * @param doc [i] The Doc structure that should be set to the initialized
421 * HDML structure is specified.
422 * @param r [i] To use POOL, the pointer to request_rec is specified.
423 * @param spec [i] The pointer to the device_table
426 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
428 memset(doc, 0, sizeof(Doc));
429 memset(chtml20, 0, sizeof(chtml20_t));
433 chtml20->spec = spec;
434 chtml20->out = qs_alloc_zero_byte_string(r);
435 chtml20->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
437 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
442 * It is a handler who processes the HTML tag.
444 * @param pdoc [i/o] The pointer to the CHTML structure at the output
445 * destination is specified.
446 * @param node [i] The HTML tag node is specified.
447 * @return The conversion result is returned.
450 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
456 chtml20 = GET_CHTML20(pdoc);
460 /*--------------------------------------------------------------------------*/
462 /*--------------------------------------------------------------------------*/
463 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<html>\n", NULL);
470 * It is a handler who processes the HTML tag.
472 * @param pdoc [i/o] The pointer to the CHTML structure at the output
473 * destination is specified.
474 * @param node [i] The HTML tag node is specified.
475 * @return The conversion result is returned.
478 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
484 chtml20 = GET_CHTML20(pdoc);
488 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</html>\n", NULL);
495 * It is a handler who processes the META tag.
497 * @param pdoc [i/o] The pointer to the CHTML structure at the output
498 * destination is specified.
499 * @param node [i] The META tag node is specified.
500 * @return The conversion result is returned.
503 s_chtml20_start_meta_tag(void *pdoc, Node *node)
509 int content_type_flag;
512 chtml20 = GET_CHTML20(pdoc);
516 content_type_flag = 0;
519 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<meta", NULL);
521 /*--------------------------------------------------------------------------*/
523 /*--------------------------------------------------------------------------*/
524 for (attr = qs_get_attr(doc,node);
526 attr = qs_get_next_attr(doc,attr)) {
531 name = qs_get_attr_name(doc,attr);
532 value = qs_get_attr_value(doc,attr);
537 if (strcasecmp(name, "http-equiv") == 0) {
538 /*----------------------------------------------------------------------*/
540 /*----------------------------------------------------------------------*/
541 chtml20->out = apr_pstrcat(r->pool,
548 if (STRCASEEQ('c','C',"content-type",value))
549 content_type_flag = 1;
550 if (STRCASEEQ('r','R',"refresh", value))
557 if (strcasecmp(name, "content") == 0) {
558 if (content_type_flag) {
559 if (IS_SJIS_STRING(GET_SPEC_CHARSET(chtml20->spec))) {
560 chtml20->out = apr_pstrcat(r->pool,
565 "text/html; charset=Windows-31J",
570 chtml20->out = apr_pstrcat(r->pool,
575 "text/html; charset=UTF-8",
580 else if (refresh_flag) {
581 char* buf = apr_pstrdup(r->pool, value);
585 url = strchr(buf, ';');
587 sec = apr_pstrdup(r->pool, buf);
590 url = chxj_encoding_parameter(r, url);
591 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
592 chtml20->out = apr_pstrcat(r->pool,
605 chtml20->out = apr_pstrcat(r->pool,
622 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
629 * It is a handler who processes the META tag.
631 * @param pdoc [i/o] The pointer to the CHTML structure at the output
632 * destination is specified.
633 * @param node [i] The META tag node is specified.
634 * @return The conversion result is returned.
637 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
641 chtml20 = GET_CHTML20(pdoc);
648 * It is a handler who processes the HEAD tag.
650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
651 * destination is specified.
652 * @param node [i] The HEAD tag node is specified.
653 * @return The conversion result is returned.
656 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
662 chtml20 = GET_CHTML20(pdoc);
666 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<head>\r\n", NULL);
673 * It is a handler who processes the HEAD tag.
675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
676 * destination is specified.
677 * @param node [i] The HEAD tag node is specified.
678 * @return The conversion result is returned.
681 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
687 chtml20 = GET_CHTML20(pdoc);
691 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</head>\r\n", NULL);
698 * It is a handler who processes the TITLE tag.
700 * @param pdoc [i/o] The pointer to the CHTML structure at the output
701 * destination is specified.
702 * @param node [i] The TITLE tag node is specified.
703 * @return The conversion result is returned.
706 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
712 chtml20 = GET_CHTML20(pdoc);
716 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<title>", NULL);
723 * It is a handler who processes the TITLE tag.
725 * @param pdoc [i/o] The pointer to the CHTML structure at the output
726 * destination is specified.
727 * @param node [i] The TITLE tag node is specified.
728 * @return The conversion result is returned.
731 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
737 chtml20 = GET_CHTML20(pdoc);
741 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</title>\r\n", NULL);
748 * It is a handler who processes the BASE tag.
750 * @param pdoc [i/o] The pointer to the CHTML structure at the output
751 * destination is specified.
752 * @param node [i] The BASE tag node is specified.
753 * @return The conversion result is returned.
756 s_chtml20_start_base_tag(void *pdoc, Node *node)
763 chtml20 = GET_CHTML20(pdoc);
767 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<base", NULL);
769 /*--------------------------------------------------------------------------*/
771 /*--------------------------------------------------------------------------*/
772 for (attr = qs_get_attr(doc,node);
774 attr = qs_get_next_attr(doc,attr)) {
779 name = qs_get_attr_name(doc,attr);
780 value = qs_get_attr_value(doc,attr);
782 if ((*name == 'h' || *name == 'H')
783 && strcasecmp(name, "href") == 0) {
784 chtml20->out = apr_pstrcat(r->pool,
793 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >\r\n", NULL);
800 * It is a handler who processes the BASE tag.
802 * @param pdoc [i/o] The pointer to the CHTML structure at the output
803 * destination is specified.
804 * @param node [i] The BASE tag node is specified.
805 * @return The conversion result is returned.
808 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
814 chtml20 = GET_CHTML20(pdoc);
823 * It is a handler who processes the BODY tag.
825 * @param pdoc [i/o] The pointer to the CHTML structure at the output
826 * destination is specified.
827 * @param node [i] The BODY tag node is specified.
828 * @return The conversion result is returned.
831 s_chtml20_start_body_tag(void *pdoc, Node *node)
838 chtml20 = GET_CHTML20(pdoc);
842 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<body", NULL);
844 /*--------------------------------------------------------------------------*/
846 /*--------------------------------------------------------------------------*/
847 for (attr = qs_get_attr(doc,node);
849 attr = qs_get_next_attr(doc,attr)) {
853 name = qs_get_attr_name(doc,attr);
854 value = qs_get_attr_value(doc,attr);
859 if (strcasecmp(name, "bgcolor") == 0) {
860 /*----------------------------------------------------------------------*/
862 /*----------------------------------------------------------------------*/
863 chtml20->out = apr_pstrcat(r->pool,
874 if (strcasecmp(name, "text") == 0) {
875 /*----------------------------------------------------------------------*/
877 /*----------------------------------------------------------------------*/
878 chtml20->out = apr_pstrcat(r->pool,
889 if (strcasecmp(name, "link") == 0) {
890 /*----------------------------------------------------------------------*/
892 /*----------------------------------------------------------------------*/
893 chtml20->out = apr_pstrcat(r->pool,
904 if (strcasecmp(name, "alink") == 0) {
905 /*----------------------------------------------------------------------*/
907 /*----------------------------------------------------------------------*/
914 if (strcasecmp(name, "vlink") == 0) {
915 /*----------------------------------------------------------------------*/
917 /*----------------------------------------------------------------------*/
927 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
934 * It is a handler who processes the BODY tag.
936 * @param pdoc [i/o] The pointer to the CHTML structure at the output
937 * destination is specified.
938 * @param node [i] The BODY tag node is specified.
939 * @return The conversion result is returned.
942 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
948 chtml20 = GET_CHTML20(pdoc);
952 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</body>\r\n", NULL);
959 * It is a handler who processes the A tag.
961 * @param pdoc [i/o] The pointer to the CHTML structure at the output
962 * destination is specified.
963 * @param node [i] The A tag node is specified.
964 * @return The conversion result is returned.
967 s_chtml20_start_a_tag(void *pdoc, Node *node)
974 chtml20 = GET_CHTML20(pdoc);
978 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<a", NULL);
980 /*--------------------------------------------------------------------------*/
982 /*--------------------------------------------------------------------------*/
983 for (attr = qs_get_attr(doc,node);
985 attr = qs_get_next_attr(doc,attr)) {
990 name = qs_get_attr_name(doc,attr);
991 value = qs_get_attr_value(doc,attr);
996 if (strcasecmp(name, "name") == 0) {
997 /*--------------------------------------------------------------------*/
999 /*--------------------------------------------------------------------*/
1000 chtml20->out = apr_pstrcat(r->pool,
1011 if (strcasecmp(name, "href") == 0) {
1012 /*--------------------------------------------------------------------*/
1014 /*--------------------------------------------------------------------*/
1015 value = chxj_encoding_parameter(r, value);
1016 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1018 chtml20->out = apr_pstrcat(r->pool,
1029 if (strcasecmp(name, "accesskey") == 0) {
1030 /*--------------------------------------------------------------------*/
1032 /*--------------------------------------------------------------------*/
1033 chtml20->out = apr_pstrcat(r->pool,
1044 if (strcasecmp(name, "cti") == 0) {
1045 /*--------------------------------------------------------------------*/
1047 /*--------------------------------------------------------------------*/
1048 chtml20->out = apr_pstrcat(r->pool,
1059 if (strcasecmp(name, "ijam") == 0) {
1060 /*--------------------------------------------------------------------*/
1062 /*--------------------------------------------------------------------*/
1066 if (strcasecmp(name, "ista") == 0) {
1067 /*--------------------------------------------------------------------*/
1069 /*--------------------------------------------------------------------*/
1073 if (strcasecmp(name, "ilet") == 0) {
1074 /*--------------------------------------------------------------------*/
1076 /*--------------------------------------------------------------------*/
1080 if (strcasecmp(name, "iswf") == 0) {
1081 /*--------------------------------------------------------------------*/
1083 /*--------------------------------------------------------------------*/
1087 if (strcasecmp(name, "irst") == 0) {
1088 /*--------------------------------------------------------------------*/
1090 /*--------------------------------------------------------------------*/
1097 if (strcasecmp(name, "utn") == 0) {
1098 /*--------------------------------------------------------------------*/
1100 /*--------------------------------------------------------------------*/
1107 if (strcasecmp(name, "telbook") == 0) {
1108 /*--------------------------------------------------------------------*/
1110 /*--------------------------------------------------------------------*/
1117 if (strcasecmp(name, "kana") == 0) {
1118 /*--------------------------------------------------------------------*/
1120 /*--------------------------------------------------------------------*/
1127 if (strcasecmp(name, "email") == 0) {
1128 /*--------------------------------------------------------------------*/
1130 /*--------------------------------------------------------------------*/
1140 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1142 return chtml20->out;
1147 * It is a handler who processes the A tag.
1149 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1150 * destination is specified.
1151 * @param node [i] The A tag node is specified.
1152 * @return The conversion result is returned.
1155 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1161 chtml20 = GET_CHTML20(pdoc);
1165 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</a>", NULL);
1167 return chtml20->out;
1172 * It is a handler who processes the BR tag.
1174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1175 * destination is specified.
1176 * @param node [i] The BR tag node is specified.
1177 * @return The conversion result is returned.
1180 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1186 chtml20 = GET_CHTML20(pdoc);
1190 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
1192 return chtml20->out;
1197 * It is a handler who processes the BR tag.
1199 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1200 * destination is specified.
1201 * @param node [i] The BR tag node is specified.
1202 * @return The conversion result is returned.
1205 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1211 chtml20 = GET_CHTML20(pdoc);
1215 return chtml20->out;
1220 * It is a handler who processes the TR tag.
1222 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1223 * destination is specified.
1224 * @param node [i] The TR tag node is specified.
1225 * @return The conversion result is returned.
1228 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1234 chtml20 = GET_CHTML20(pdoc);
1238 return chtml20->out;
1243 * It is a handler who processes the TR tag.
1245 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1246 * destination is specified.
1247 * @param node [i] The TR tag node is specified.
1248 * @return The conversion result is returned.
1251 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1257 chtml20 = GET_CHTML20(pdoc);
1261 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
1263 return chtml20->out;
1268 * It is a handler who processes the FONT tag.
1270 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1271 * destination is specified.
1272 * @param node [i] The FONT tag node is specified.
1273 * @return The conversion result is returned.
1276 s_chtml20_start_font_tag(void *pdoc, Node *node)
1283 chtml20 = GET_CHTML20(pdoc);
1288 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<font", NULL);
1290 /*--------------------------------------------------------------------------*/
1291 /* Get Attributes */
1292 /*--------------------------------------------------------------------------*/
1293 for (attr = qs_get_attr(doc,node);
1295 attr = qs_get_next_attr(doc,attr)) {
1300 name = qs_get_attr_name(doc,attr);
1301 value = qs_get_attr_value(doc,attr);
1306 if (strcasecmp(name, "color") == 0) {
1307 chtml20->out = apr_pstrcat(r->pool,
1318 if (strcasecmp(name, "size") == 0) {
1319 /*--------------------------------------------------------------------*/
1321 /*--------------------------------------------------------------------*/
1331 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1333 return chtml20->out;
1338 * It is a handler who processes the FONT tag.
1340 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1341 * destination is specified.
1342 * @param node [i] The FONT tag node is specified.
1343 * @return The conversion result is returned.
1346 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1352 chtml20 = GET_CHTML20(pdoc);
1356 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</font>", NULL);
1358 return chtml20->out;
1363 * It is a handler who processes the FORM tag.
1365 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1366 * destination is specified.
1367 * @param node [i] The FORM tag node is specified.
1368 * @return The conversion result is returned.
1371 s_chtml20_start_form_tag(void *pdoc, Node *node)
1378 chtml20 = GET_CHTML20(pdoc);
1383 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<form", NULL);
1385 /*--------------------------------------------------------------------------*/
1386 /* Get Attributes */
1387 /*--------------------------------------------------------------------------*/
1388 for (attr = qs_get_attr(doc,node);
1390 attr = qs_get_next_attr(doc,attr)) {
1395 name = qs_get_attr_name(doc,attr);
1396 value = qs_get_attr_value(doc,attr);
1401 if (strcasecmp(name, "action") == 0) {
1402 /*--------------------------------------------------------------------*/
1404 /*--------------------------------------------------------------------*/
1405 value = chxj_encoding_parameter(r, value);
1406 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1408 chtml20->out = apr_pstrcat(r->pool,
1419 if (strcasecmp(name, "method") == 0) {
1420 /*--------------------------------------------------------------------*/
1422 /*--------------------------------------------------------------------*/
1423 chtml20->out = apr_pstrcat(r->pool,
1434 if (strcasecmp(name, "utn") == 0) {
1435 /*--------------------------------------------------------------------*/
1437 /*--------------------------------------------------------------------*/
1447 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
1449 return chtml20->out;
1454 * It is a handler who processes the FORM tag.
1456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1457 * destination is specified.
1458 * @param node [i] The FORM tag node is specified.
1459 * @return The conversion result is returned.
1462 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1468 chtml20 = GET_CHTML20(pdoc);
1472 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</form>", NULL);
1474 return chtml20->out;
1479 * It is a handler who processes the INPUT tag.
1481 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1482 * destination is specified.
1483 * @param node [i] The INPUT tag node is specified.
1484 * @return The conversion result is returned.
1487 s_chtml20_start_input_tag(void *pdoc, Node *node)
1492 char *max_length = NULL;
1496 char *istyle = NULL;
1498 char *checked = NULL;
1499 char *accesskey = NULL;
1501 chtml20 = GET_CHTML20(pdoc);
1506 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<input", NULL);
1508 /*--------------------------------------------------------------------------*/
1509 /* Get Attributes */
1510 /*--------------------------------------------------------------------------*/
1512 type = qs_get_type_attr(doc, node, r);
1513 name = qs_get_name_attr(doc, node, r);
1514 value = qs_get_value_attr(doc,node,r);
1515 istyle = qs_get_istyle_attr(doc,node,r);
1516 max_length = qs_get_maxlength_attr(doc,node,r);
1517 checked = qs_get_checked_attr(doc,node,r);
1518 accesskey = qs_get_accesskey_attr(doc, node, r);
1519 size = qs_get_size_attr(doc, node, r);
1522 chtml20->out = apr_pstrcat(r->pool,
1530 chtml20->out = apr_pstrcat(r->pool,
1538 chtml20->out = apr_pstrcat(r->pool,
1546 chtml20->out = apr_pstrcat(r->pool,
1554 chtml20->out = apr_pstrcat(r->pool,
1561 /*------------------------------------------------------------------------*/
1563 /*------------------------------------------------------------------------*/
1564 chtml20->out = apr_pstrcat(r->pool,
1570 /*--------------------------------------------------------------------------*/
1571 /* The figure is default for the password. */
1572 /*--------------------------------------------------------------------------*/
1574 if (chxj_chk_numeric(max_length) != 0)
1575 max_length = apr_psprintf(r->pool, "0");
1576 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1577 chtml20->out = apr_pstrcat(r->pool,
1579 apr_psprintf(r->pool,
1580 " maxlength=\"%d\"",
1581 chxj_atoi(max_length)*2),
1584 chtml20->out = apr_pstrcat(r->pool,
1586 apr_psprintf(r->pool,
1587 " maxlength=\"%d\"",
1588 chxj_atoi(max_length)),
1593 chtml20->out = apr_pstrcat(r->pool,
1598 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
1600 return chtml20->out;
1605 * It is a handler who processes the INPUT tag.
1607 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1608 * destination is specified.
1609 * @param node [i] The INPUT tag node is specified.
1610 * @return The conversion result is returned.
1613 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1619 chtml20 = GET_CHTML20(pdoc);
1623 return chtml20->out;
1628 * It is a handler who processes the CENTER tag.
1630 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1631 * destination is specified.
1632 * @param node [i] The CENTER tag node is specified.
1633 * @return The conversion result is returned.
1636 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1642 chtml20 = GET_CHTML20(pdoc);
1646 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<center>", NULL);
1648 return chtml20->out;
1653 * It is a handler who processes the CENTER tag.
1655 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1656 * destination is specified.
1657 * @param node [i] The CENTER tag node is specified.
1658 * @return The conversion result is returned.
1661 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1667 chtml20 = GET_CHTML20(pdoc);
1671 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</center>", NULL);
1673 return chtml20->out;
1678 * It is a handler who processes the UL tag.
1680 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1681 * destination is specified.
1682 * @param node [i] The UL tag node is specified.
1683 * @return The conversion result is returned.
1686 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1692 chtml20 = GET_CHTML20(pdoc);
1696 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<ul>", NULL);
1698 return chtml20->out;
1703 * It is a handler who processes the UL tag.
1705 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1706 * destination is specified.
1707 * @param node [i] The UL tag node is specified.
1708 * @return The conversion result is returned.
1711 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1717 chtml20 = GET_CHTML20(pdoc);
1721 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</ul>", NULL);
1723 return chtml20->out;
1728 * It is a handler who processes the OL tag.
1730 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1731 * destination is specified.
1732 * @param node [i] The OL tag node is specified.
1733 * @return The conversion result is returned.
1736 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1742 chtml20 = GET_CHTML20(pdoc);
1746 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<ol>", NULL);
1748 return chtml20->out;
1753 * It is a handler who processes the OL tag.
1755 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1756 * destination is specified.
1757 * @param node [i] The OL tag node is specified.
1758 * @return The conversion result is returned.
1761 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1767 chtml20 = GET_CHTML20(pdoc);
1771 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</ol>", NULL);
1773 return chtml20->out;
1778 * It is a handler who processes the LI tag.
1780 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1781 * destination is specified.
1782 * @param node [i] The LI tag node is specified.
1783 * @return The conversion result is returned.
1786 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1792 chtml20 = GET_CHTML20(pdoc);
1796 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<li>", NULL);
1798 return chtml20->out;
1803 * It is a handler who processes the LI tag.
1805 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1806 * destination is specified.
1807 * @param node [i] The LI tag node is specified.
1808 * @return The conversion result is returned.
1811 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1817 chtml20 = GET_CHTML20(pdoc);
1821 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</li>", NULL);
1823 return chtml20->out;
1828 * It is a handler who processes the HR tag.
1830 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1831 * destination is specified.
1832 * @param node [i] The HR tag node is specified.
1833 * @return The conversion result is returned.
1836 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1843 chtml20 = GET_CHTML20(pdoc);
1848 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<hr ", NULL);
1850 for (attr = qs_get_attr(doc,node);
1852 attr = qs_get_next_attr(doc,attr)) {
1857 name = qs_get_attr_name(doc,attr);
1858 value = qs_get_attr_value(doc,attr);
1863 if (strcasecmp(name, "align") == 0) {
1864 /*--------------------------------------------------------------------*/
1866 /*--------------------------------------------------------------------*/
1867 chtml20->out = apr_pstrcat(r->pool,
1878 if (strcasecmp(name, "size") == 0) {
1879 /*--------------------------------------------------------------------*/
1881 /*--------------------------------------------------------------------*/
1882 chtml20->out = apr_pstrcat(r->pool,
1893 if (strcasecmp(name, "width") == 0) {
1894 /*--------------------------------------------------------------------*/
1896 /*--------------------------------------------------------------------*/
1897 chtml20->out = apr_pstrcat(r->pool,
1908 if (strcasecmp(name, "noshade") == 0) {
1909 /*--------------------------------------------------------------------*/
1911 /*--------------------------------------------------------------------*/
1912 chtml20->out = apr_pstrcat(r->pool,
1921 if (strcasecmp(name, "color") == 0) {
1922 /*--------------------------------------------------------------------*/
1924 /*--------------------------------------------------------------------*/
1934 chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
1936 return chtml20->out;
1941 * It is a handler who processes the HR tag.
1943 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1944 * destination is specified.
1945 * @param node [i] The HR tag node is specified.
1946 * @return The conversion result is returned.
1949 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1955 chtml20 = GET_CHTML20(pdoc);
1959 return chtml20->out;
1964 * It is a handler who processes the IMG tag.
1966 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1967 * destination is specified.
1968 * @param node [i] The IMG tag node is specified.
1969 * @return The conversion result is returned.
1972 s_chtml20_start_img_tag(void *pdoc, Node *node)
1978 #ifndef IMG_NOT_CONVERT_FILENAME
1982 chtml20 = GET_CHTML20(pdoc);
1986 #ifndef IMG_NOT_CONVERT_FILENAME
1987 spec = chtml20->spec;
1990 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<img", NULL);
1993 /*-------------------------------------------------------------------------*/
1994 /* Get Attributes */
1995 /*-------------------------------------------------------------------------*/
1996 for (attr = qs_get_attr(doc,node);
1998 attr = qs_get_next_attr(doc,attr)) {
2003 name = qs_get_attr_name(doc,attr);
2004 value = qs_get_attr_value(doc,attr);
2009 if (strcasecmp(name, "src") == 0) {
2010 /*-------------------------------------------------------------------*/
2012 /*-------------------------------------------------------------------*/
2013 #ifdef IMG_NOT_CONVERT_FILENAME
2014 value = chxj_encoding_parameter(r, value);
2015 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2017 value = apr_psprintf(r->pool,
2020 (strchr(value, '?')) ? '&' : '?',
2021 CHXJ_COOKIE_NOUPDATE_PARAM);
2023 chtml20->out = apr_pstrcat(r->pool,
2030 value = chxj_img_conv(r, spec, value);
2031 value = chxj_encoding_parameter(r, value);
2032 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2034 value = apr_psprintf(r->pool,
2037 (strchr(value, '?')) ? '&' : '?',
2038 CHXJ_COOKIE_NOUPDATE_PARAM);
2041 chtml20->out = apr_pstrcat(r->pool,
2042 chtml20->out, " src=\"",
2046 chtml20->out = apr_pstrcat(r->pool,
2056 if (strcasecmp(name, "align" ) == 0) {
2057 /*--------------------------------------------------------------------*/
2059 /*--------------------------------------------------------------------*/
2060 chtml20->out = apr_pstrcat(r->pool,
2068 if (strcasecmp(name, "alt" ) == 0) {
2069 /*--------------------------------------------------------------------*/
2071 /*--------------------------------------------------------------------*/
2072 chtml20->out = apr_pstrcat(r->pool,
2080 if (strcasecmp(name, "align" ) == 0) {
2081 /*--------------------------------------------------------------------*/
2083 /*--------------------------------------------------------------------*/
2090 if (strcasecmp(name, "width" ) == 0) {
2091 /*--------------------------------------------------------------------*/
2093 /*--------------------------------------------------------------------*/
2094 chtml20->out = apr_pstrcat(r->pool,
2105 if (strcasecmp(name, "height") == 0) {
2106 /*--------------------------------------------------------------------*/
2108 /*--------------------------------------------------------------------*/
2109 chtml20->out = apr_pstrcat(r->pool,
2117 if (strcasecmp(name, "hspace") == 0) {
2118 /*--------------------------------------------------------------------*/
2120 /*--------------------------------------------------------------------*/
2121 chtml20->out = apr_pstrcat(r->pool,
2132 if (strcasecmp(name, "vspace") == 0) {
2133 /*--------------------------------------------------------------------*/
2135 /*--------------------------------------------------------------------*/
2136 chtml20->out = apr_pstrcat(r->pool,
2150 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
2152 return chtml20->out;
2157 * It is a handler who processes the IMG tag.
2159 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2160 * destination is specified.
2161 * @param node [i] The IMG tag node is specified.
2162 * @return The conversion result is returned.
2165 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2171 chtml20 = GET_CHTML20(pdoc);
2175 return chtml20->out;
2180 * It is a handler who processes the SELECT tag.
2182 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2183 * destination is specified.
2184 * @param node [i] The SELECT tag node is specified.
2185 * @return The conversion result is returned.
2188 s_chtml20_start_select_tag(void *pdoc, Node *child)
2195 chtml20 = GET_CHTML20(pdoc);
2202 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<select", NULL);
2204 for (attr = qs_get_attr(doc,child);
2206 attr = qs_get_next_attr(doc,attr)) {
2211 nm = qs_get_attr_name(doc,attr);
2212 val = qs_get_attr_value(doc,attr);
2217 if (strcasecmp(nm, "size") == 0) {
2218 /*--------------------------------------------------------------------*/
2219 /* CHTML 1.0 version 2.0 */
2220 /*--------------------------------------------------------------------*/
2221 size = apr_pstrdup(r->pool, val);
2227 if (strcasecmp(nm, "name") == 0) {
2228 /*--------------------------------------------------------------------*/
2229 /* CHTML 1.0 version 2.0 */
2230 /*--------------------------------------------------------------------*/
2231 name = apr_pstrdup(r->pool, val);
2237 if (strcasecmp(nm, "multiple") == 0) {
2238 /*--------------------------------------------------------------------*/
2239 /* CHTML 1.0 version 2.0 */
2240 /*--------------------------------------------------------------------*/
2251 chtml20->out = apr_pstrcat(r->pool,
2259 chtml20->out = apr_pstrcat(r->pool,
2266 chtml20->out = apr_pstrcat(r->pool,
2271 return chtml20->out;
2276 * It is a handler who processes the SELECT tag.
2278 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2279 * destination is specified.
2280 * @param node [i] The SELECT tag node is specified.
2281 * @return The conversion result is returned.
2284 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2290 chtml20 = GET_CHTML20(pdoc);
2294 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</select>\n", NULL);
2296 return chtml20->out;
2301 * It is a handler who processes the OPTION tag.
2303 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2304 * destination is specified.
2305 * @param node [i] The OPTION tag node is specified.
2306 * @return The conversion result is returned.
2309 s_chtml20_start_option_tag(void *pdoc, Node *child)
2316 chtml20 = GET_CHTML20(pdoc);
2320 char* selected = NULL;
2323 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<option", NULL);
2325 for (attr = qs_get_attr(doc,child);
2327 attr = qs_get_next_attr(doc,attr)) {
2332 nm = qs_get_attr_name(doc,attr);
2333 val = qs_get_attr_value(doc,attr);
2338 if (strcasecmp(nm, "selected") == 0) {
2339 /*--------------------------------------------------------------------*/
2340 /* CHTML 1.0 version 2.0 */
2341 /*--------------------------------------------------------------------*/
2342 selected = apr_pstrdup(r->pool, val);
2348 if (strcasecmp(nm, "value") == 0) {
2349 /*--------------------------------------------------------------------*/
2350 /* CHTML 1.0 version 2.0 */
2351 /*--------------------------------------------------------------------*/
2352 value = apr_pstrdup(r->pool, val);
2362 chtml20->out = apr_pstrcat(r->pool,
2369 chtml20->out = apr_pstrcat(r->pool,
2375 chtml20->out = apr_pstrcat(r->pool,
2380 chtml20->out = apr_pstrcat(r->pool,
2385 return chtml20->out;
2390 * It is a handler who processes the OPTION tag.
2392 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2393 * destination is specified.
2394 * @param node [i] The OPTION tag node is specified.
2395 * @return The conversion result is returned.
2398 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2404 chtml20 = GET_CHTML20(pdoc);
2410 return chtml20->out;
2415 * It is a handler who processes the DIV tag.
2417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2418 * destination is specified.
2419 * @param node [i] The DIV tag node is specified.
2420 * @return The conversion result is returned.
2423 s_chtml20_start_div_tag(void *pdoc, Node *child)
2430 chtml20 = GET_CHTML20(pdoc);
2437 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<div", NULL);
2439 for (attr = qs_get_attr(doc,child);
2441 attr = qs_get_next_attr(doc,attr)) {
2446 nm = qs_get_attr_name(doc,attr);
2447 val = qs_get_attr_value(doc,attr);
2449 if ((*nm == 'a'||*nm == 'A') && strcasecmp(nm, "align") == 0) {
2450 /*----------------------------------------------------------------------*/
2451 /* CHTML 1.0 (W3C version 3.2) */
2452 /*----------------------------------------------------------------------*/
2453 align = apr_pstrdup(r->pool, val);
2458 chtml20->out = apr_pstrcat(r->pool,
2465 chtml20->out = apr_pstrcat(r->pool,
2470 return chtml20->out;
2475 * It is a handler who processes the DIV tag.
2477 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2478 * destination is specified.
2479 * @param node [i] The DIV tag node is specified.
2480 * @return The conversion result is returned.
2483 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2489 chtml20 = GET_CHTML20(pdoc);
2493 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</div>\n", NULL);
2495 return chtml20->out;
2500 * It is a handler who processes the H1 tag.
2502 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2503 * destination is specified.
2504 * @param node [i] The H1 tag node is specified.
2505 * @return The conversion result is returned.
2508 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2514 chtml20 = GET_CHTML20(pdoc);
2518 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h1>\r\n", NULL);
2520 return chtml20->out;
2525 * It is a handler who processes the H1 tag.
2527 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2528 * destination is specified.
2529 * @param node [i] The H1 tag node is specified.
2530 * @return The conversion result is returned.
2533 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2539 chtml20 = GET_CHTML20(pdoc);
2543 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h1>\r\n", NULL);
2545 return chtml20->out;
2550 * It is a handler who processes the H2 tag.
2552 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2553 * destination is specified.
2554 * @param node [i] The H2 tag node is specified.
2555 * @return The conversion result is returned.
2558 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2564 chtml20 = GET_CHTML20(pdoc);
2568 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h2>\r\n", NULL);
2570 return chtml20->out;
2575 * It is a handler who processes the H2 tag.
2577 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2578 * destination is specified.
2579 * @param node [i] The H2 tag node is specified.
2580 * @return The conversion result is returned.
2583 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2589 chtml20 = GET_CHTML20(pdoc);
2593 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h2>\r\n", NULL);
2595 return chtml20->out;
2600 * It is a handler who processes the H3 tag.
2602 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2603 * destination is specified.
2604 * @param node [i] The H3 tag node is specified.
2605 * @return The conversion result is returned.
2608 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2614 chtml20 = GET_CHTML20(pdoc);
2618 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h3>\r\n", NULL);
2620 return chtml20->out;
2625 * It is a handler who processes the H3 tag.
2627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2628 * destination is specified.
2629 * @param node [i] The H3 tag node is specified.
2630 * @return The conversion result is returned.
2633 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2639 chtml20 = GET_CHTML20(pdoc);
2643 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h3>\r\n", NULL);
2645 return chtml20->out;
2650 * It is a handler who processes the H4 tag.
2652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2653 * destination is specified.
2654 * @param node [i] The H4 tag node is specified.
2655 * @return The conversion result is returned.
2658 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2664 chtml20 = GET_CHTML20(pdoc);
2668 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h4>\r\n", NULL);
2670 return chtml20->out;
2675 * It is a handler who processes the H4 tag.
2677 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2678 * destination is specified.
2679 * @param node [i] The H4 tag node is specified.
2680 * @return The conversion result is returned.
2683 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2689 chtml20 = GET_CHTML20(pdoc);
2693 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h4>\r\n", NULL);
2695 return chtml20->out;
2700 * It is a handler who processes the H5 tag.
2702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2703 * destination is specified.
2704 * @param node [i] The H5 tag node is specified.
2705 * @return The conversion result is returned.
2708 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2714 chtml20 = GET_CHTML20(pdoc);
2718 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h5>\r\n", NULL);
2720 return chtml20->out;
2725 * It is a handler who processes the H5 tag.
2727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2728 * destination is specified.
2729 * @param node [i] The H5 tag node is specified.
2730 * @return The conversion result is returned.
2733 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2739 chtml20 = GET_CHTML20(pdoc);
2743 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h5>\r\n", NULL);
2745 return chtml20->out;
2750 * It is a handler who processes the H6 tag.
2752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2753 * destination is specified.
2754 * @param node [i] The H6 tag node is specified.
2755 * @return The conversion result is returned.
2758 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2764 chtml20 = GET_CHTML20(pdoc);
2768 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<h6>\r\n", NULL);
2770 return chtml20->out;
2775 * It is a handler who processes the H6 tag.
2777 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2778 * destination is specified.
2779 * @param node [i] The H6 tag node is specified.
2780 * @return The conversion result is returned.
2783 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2789 chtml20 = GET_CHTML20(pdoc);
2793 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</h6>\r\n", NULL);
2795 return chtml20->out;
2800 * It is a handler who processes the PRE tag.
2802 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2803 * destination is specified.
2804 * @param node [i] The PRE tag node is specified.
2805 * @return The conversion result is returned.
2808 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2814 chtml20 = GET_CHTML20(pdoc);
2818 chtml20->pre_flag++;
2819 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<pre>", NULL);
2821 return chtml20->out;
2826 * It is a handler who processes the PRE tag.
2828 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2829 * destination is specified.
2830 * @param node [i] The PRE tag node is specified.
2831 * @return The conversion result is returned.
2834 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2840 chtml20 = GET_CHTML20(pdoc);
2844 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</pre>", NULL);
2845 chtml20->pre_flag--;
2847 return chtml20->out;
2852 * It is a handler who processes the P tag.
2854 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2855 * destination is specified.
2856 * @param node [i] The P tag node is specified.
2857 * @return The conversion result is returned.
2860 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2866 chtml20 = GET_CHTML20(pdoc);
2870 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<p>", NULL);
2872 return chtml20->out;
2877 * It is a handler who processes the P tag.
2879 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2880 * destination is specified.
2881 * @param node [i] The P tag node is specified.
2882 * @return The conversion result is returned.
2885 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2891 chtml20 = GET_CHTML20(pdoc);
2895 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</p>", NULL);
2897 return chtml20->out;
2902 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2909 chtml20 = GET_CHTML20(pdoc);
2913 for (child = qs_get_child_node(doc, node);
2915 child = qs_get_next_node(doc, child)) {
2917 chtml20->out = apr_pstrcat(r->pool, chtml20->out, child->otext, NULL);
2919 s_chtml20_chxjif_tag(pdoc, child);
2927 * It is a handler who processes the TEXTARE tag.
2929 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2930 * destination is specified.
2931 * @param node [i] The TEXTAREA tag node is specified.
2932 * @return The conversion result is returned.
2935 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2942 chtml20 = GET_CHTML20(pdoc);
2946 chtml20->textarea_flag++;
2947 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<textarea ", NULL);
2949 for (attr = qs_get_attr(doc,node);
2951 attr = qs_get_next_attr(doc,attr)) {
2956 name = qs_get_attr_name(doc,attr);
2957 value = qs_get_attr_value(doc,attr);
2962 if (strcasecmp(name, "name") == 0) {
2963 chtml20->out = apr_pstrcat(r->pool,
2974 if (strcasecmp(name, "rows") == 0) {
2975 chtml20->out = apr_pstrcat(r->pool,
2986 if (strcasecmp(name, "cols") == 0) {
2987 chtml20->out = apr_pstrcat(r->pool,
3001 chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
3003 return chtml20->out;
3008 * It is a handler who processes the TEXTAREA tag.
3010 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3011 * destination is specified.
3012 * @param node [i] The TEXTAREA tag node is specified.
3013 * @return The conversion result is returned.
3016 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3022 chtml20 = GET_CHTML20(pdoc);
3027 chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</textarea>\r\n", NULL);
3028 chtml20->textarea_flag--;
3030 return chtml20->out;
3035 s_chtml20_text_tag(void *pdoc, Node *child)
3047 chtml20 = GET_CHTML20(pdoc);
3051 textval = qs_get_node_value(doc,child);
3052 textval = qs_trim_string(r->pool, textval);
3053 if (strlen(textval) == 0)
3054 return chtml20->out;
3056 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3057 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3059 tdst = qs_alloc_zero_byte_string(r);
3060 memset(one_byte, 0, sizeof(one_byte));
3063 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3064 if (is_sjis_kanji(textval[ii])) {
3065 one_byte[0] = textval[ii+0];
3066 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3067 one_byte[0] = textval[ii+1];
3068 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3072 if (chtml20->pre_flag) {
3073 one_byte[0] = textval[ii+0];
3074 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3077 if (chtml20->textarea_flag) {
3078 one_byte[0] = textval[ii+0];
3079 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3082 if (textval[ii] != '\r' && textval[ii] != '\n') {
3083 one_byte[0] = textval[ii+0];
3084 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3087 chtml20->out = apr_pstrcat(r->pool, chtml20->out, tdst, NULL);
3089 return chtml20->out;