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_chtml30.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_CHTML30(X) ((chtml30_t *)(X))
28 static char *s_chtml30_start_html_tag (void *pdoc, Node *node);
29 static char *s_chtml30_end_html_tag (void *pdoc, Node *node);
30 static char *s_chtml30_start_meta_tag (void *pdoc, Node *node);
31 static char *s_chtml30_end_meta_tag (void *pdoc, Node *node);
32 static char *s_chtml30_start_textarea_tag (void *pdoc, Node *node);
33 static char *s_chtml30_end_textarea_tag (void *pdoc, Node *node);
34 static char *s_chtml30_start_p_tag (void *pdoc, Node *node);
35 static char *s_chtml30_end_p_tag (void *pdoc, Node *node);
36 static char *s_chtml30_start_pre_tag (void *pdoc, Node *node);
37 static char *s_chtml30_end_pre_tag (void *pdoc, Node *node);
38 static char *s_chtml30_start_h1_tag (void *pdoc, Node *node);
39 static char *s_chtml30_end_h1_tag (void *pdoc, Node *node);
40 static char *s_chtml30_start_h2_tag (void *pdoc, Node *node);
41 static char *s_chtml30_end_h2_tag (void *pdoc, Node *node);
42 static char *s_chtml30_start_h3_tag (void *pdoc, Node *node);
43 static char *s_chtml30_end_h3_tag (void *pdoc, Node *node);
44 static char *s_chtml30_start_h4_tag (void *pdoc, Node *node);
45 static char *s_chtml30_end_h4_tag (void *pdoc, Node *node);
46 static char *s_chtml30_start_h5_tag (void *pdoc, Node *node);
47 static char *s_chtml30_end_h5_tag (void *pdoc, Node *node);
48 static char *s_chtml30_start_h6_tag (void *pdoc, Node *node);
49 static char *s_chtml30_end_h6_tag (void *pdoc, Node *node);
50 static char *s_chtml30_start_ul_tag (void *pdoc, Node *node);
51 static char *s_chtml30_end_ul_tag (void *pdoc, Node *node);
52 static char *s_chtml30_start_ol_tag (void *pdoc, Node *node);
53 static char *s_chtml30_end_ol_tag (void *pdoc, Node *node);
54 static char *s_chtml30_start_li_tag (void *pdoc, Node *node);
55 static char *s_chtml30_end_li_tag (void *pdoc, Node *node);
56 static char *s_chtml30_start_head_tag (void *pdoc, Node *node);
57 static char *s_chtml30_end_head_tag (void *pdoc, Node *node);
58 static char *s_chtml30_start_title_tag (void *pdoc, Node *node);
59 static char *s_chtml30_end_title_tag (void *pdoc, Node *node);
60 static char *s_chtml30_start_base_tag (void *pdoc, Node *node);
61 static char *s_chtml30_end_base_tag (void *pdoc, Node *node);
62 static char *s_chtml30_start_body_tag (void *pdoc, Node *node);
63 static char *s_chtml30_end_body_tag (void *pdoc, Node *node);
64 static char *s_chtml30_start_a_tag (void *pdoc, Node *node);
65 static char *s_chtml30_end_a_tag (void *pdoc, Node *node);
66 static char *s_chtml30_start_br_tag (void *pdoc, Node *node);
67 static char *s_chtml30_end_br_tag (void *pdoc, Node *node);
68 static char *s_chtml30_start_tr_tag (void *pdoc, Node *node);
69 static char *s_chtml30_end_tr_tag (void *pdoc, Node *node);
70 static char *s_chtml30_start_font_tag (void *pdoc, Node *node);
71 static char *s_chtml30_end_font_tag (void *pdoc, Node *node);
72 static char *s_chtml30_start_form_tag (void *pdoc, Node *node);
73 static char *s_chtml30_end_form_tag (void *pdoc, Node *node);
74 static char *s_chtml30_start_input_tag (void *pdoc, Node *node);
75 static char *s_chtml30_end_input_tag (void *pdoc, Node *node);
76 static char *s_chtml30_start_center_tag (void *pdoc, Node *node);
77 static char *s_chtml30_end_center_tag (void *pdoc, Node *node);
78 static char *s_chtml30_start_hr_tag (void *pdoc, Node *node);
79 static char *s_chtml30_end_hr_tag (void *pdoc, Node *node);
80 static char *s_chtml30_start_img_tag (void *pdoc, Node *node);
81 static char *s_chtml30_end_img_tag (void *pdoc, Node *node);
82 static char *s_chtml30_start_select_tag (void *pdoc, Node *node);
83 static char *s_chtml30_end_select_tag (void *pdoc, Node *node);
84 static char *s_chtml30_start_option_tag (void *pdoc, Node *node);
85 static char *s_chtml30_end_option_tag (void *pdoc, Node *node);
86 static char *s_chtml30_start_div_tag (void *pdoc, Node *node);
87 static char *s_chtml30_end_div_tag (void *pdoc, Node *node);
88 static char *s_chtml30_chxjif_tag (void *pdoc, Node *node);
89 static char *s_chtml30_text_tag (void *pdoc, Node *node);
91 static void s_init_chtml30(chtml30_t *chtml, Doc *doc, request_rec *r, device_table *spec);
93 tag_handler chtml30_handler[] = {
96 s_chtml30_start_html_tag,
97 s_chtml30_end_html_tag,
101 s_chtml30_start_meta_tag,
102 s_chtml30_end_meta_tag,
106 s_chtml30_start_textarea_tag,
107 s_chtml30_end_textarea_tag,
111 s_chtml30_start_p_tag,
116 s_chtml30_start_pre_tag,
117 s_chtml30_end_pre_tag,
121 s_chtml30_start_ul_tag,
122 s_chtml30_end_ul_tag,
126 s_chtml30_start_li_tag,
127 s_chtml30_end_li_tag,
131 s_chtml30_start_ol_tag,
132 s_chtml30_end_ol_tag,
136 s_chtml30_start_h1_tag,
137 s_chtml30_end_h1_tag,
141 s_chtml30_start_h2_tag,
142 s_chtml30_end_h2_tag,
146 s_chtml30_start_h3_tag,
147 s_chtml30_end_h3_tag,
151 s_chtml30_start_h4_tag,
152 s_chtml30_end_h4_tag,
156 s_chtml30_start_h5_tag,
157 s_chtml30_end_h5_tag,
161 s_chtml30_start_h6_tag,
162 s_chtml30_end_h6_tag,
166 s_chtml30_start_head_tag,
167 s_chtml30_end_head_tag,
171 s_chtml30_start_title_tag,
172 s_chtml30_end_title_tag,
176 s_chtml30_start_base_tag,
177 s_chtml30_end_base_tag,
181 s_chtml30_start_body_tag,
182 s_chtml30_end_body_tag,
186 s_chtml30_start_a_tag,
191 s_chtml30_start_br_tag,
192 s_chtml30_end_br_tag,
201 s_chtml30_start_tr_tag,
202 s_chtml30_end_tr_tag,
216 s_chtml30_start_font_tag,
217 s_chtml30_end_font_tag,
221 s_chtml30_start_form_tag,
222 s_chtml30_end_form_tag,
226 s_chtml30_start_input_tag,
227 s_chtml30_end_input_tag,
231 s_chtml30_start_center_tag,
232 s_chtml30_end_center_tag,
236 s_chtml30_start_hr_tag,
237 s_chtml30_end_hr_tag,
241 s_chtml30_start_img_tag,
242 s_chtml30_end_img_tag,
246 s_chtml30_start_select_tag,
247 s_chtml30_end_select_tag,
251 s_chtml30_start_option_tag,
252 s_chtml30_end_option_tag,
256 s_chtml30_start_div_tag,
257 s_chtml30_end_div_tag,
261 s_chtml30_chxjif_tag,
323 * converts from CHTML5.0 to CHTML3.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_convert_chtml30(
338 chxjconvrule_entry *entryp,
348 /*--------------------------------------------------------------------------*/
350 /*--------------------------------------------------------------------------*/
352 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
354 DBG(r,"i found qrcode xml");
357 DBG(r,"not found qrcode xml");
359 /*--------------------------------------------------------------------------*/
360 /* The CHTML structure is initialized. */
361 /*--------------------------------------------------------------------------*/
362 s_init_chtml30(&chtml30, &doc, r, spec);
364 chtml30.entryp = entryp;
365 chtml30.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 -> CHTML3.0", ss, srclen);
388 qs_parse_string(&doc,ss, strlen(ss));
390 /*--------------------------------------------------------------------------*/
391 /* It converts it from CHTML to CHTML. */
392 /*--------------------------------------------------------------------------*/
393 chxj_node_convert(spec,r,(void*)&chtml30, &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("[src] CHTML -> CHTML3.0", dst, *dstlen);
415 * The CHTML structure is initialized.
417 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
418 * initialized is specified.
419 * @param doc [i] The Doc structure that should be set to the initialized
420 * HDML structure is specified.
421 * @param r [i] To use POOL, the pointer to request_rec is specified.
422 * @param spec [i] The pointer to the device_table
425 s_init_chtml30(chtml30_t *chtml30, Doc *doc, request_rec *r, device_table *spec)
427 memset(doc, 0, sizeof(Doc));
428 memset(chtml30, 0, sizeof(chtml30_t));
432 chtml30->spec = spec;
433 chtml30->out = qs_alloc_zero_byte_string(r);
434 chtml30->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
435 chtml30->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_chtml30_start_html_tag(void *pdoc, Node *UNUSED(node))
454 chtml30 = GET_CHTML30(pdoc);
458 /*--------------------------------------------------------------------------*/
460 /*--------------------------------------------------------------------------*/
461 chtml30->out = apr_pstrcat(r->pool, chtml30->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_chtml30_end_html_tag(void *pdoc, Node *UNUSED(child))
482 chtml30 = GET_CHTML30(pdoc);
486 chtml30->out = apr_pstrcat(r->pool, chtml30->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_chtml30_start_meta_tag(void *pdoc, Node *node)
507 int content_type_flag;
510 chtml30 = GET_CHTML30(pdoc);
514 content_type_flag = 0;
517 chtml30->out = apr_pstrcat(r->pool, chtml30->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 chtml30->out = apr_pstrcat(r->pool,
546 if (STRCASEEQ('c','C',"content-type", value))
547 content_type_flag = 1;
549 if (STRCASEEQ('r','R',"refresh", value))
556 if (strcasecmp(name, "content") == 0) {
557 if (content_type_flag) {
558 if (IS_SJIS_STRING(GET_SPEC_CHARSET(chtml30->spec))) {
559 chtml30->out = apr_pstrcat(r->pool,
564 "text/html; charset=Windows-31J",
569 chtml30->out = apr_pstrcat(r->pool,
574 "text/html; charset=UTF-8",
585 buf = apr_pstrdup(r->pool, value);
587 url = strchr(buf, ';');
589 sec = apr_pstrdup(r->pool, buf);
592 url = chxj_encoding_parameter(r, url);
593 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
594 chtml30->out = apr_pstrcat(r->pool,
607 chtml30->out = apr_pstrcat(r->pool,
624 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
631 * It is a handler who processes the META tag.
633 * @param pdoc [i/o] The pointer to the CHTML structure at the output
634 * destination is specified.
635 * @param node [i] The META tag node is specified.
636 * @return The conversion result is returned.
639 s_chtml30_end_meta_tag(void *pdoc, Node *UNUSED(child))
643 chtml30 = GET_CHTML30(pdoc);
650 * It is a handler who processes the HEAD tag.
652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
653 * destination is specified.
654 * @param node [i] The HEAD tag node is specified.
655 * @return The conversion result is returned.
658 s_chtml30_start_head_tag(void *pdoc, Node *UNUSED(node))
664 chtml30 = GET_CHTML30(pdoc);
668 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<head>\r\n", NULL);
675 * It is a handler who processes the HEAD tag.
677 * @param pdoc [i/o] The pointer to the CHTML structure at the output
678 * destination is specified.
679 * @param node [i] The HEAD tag node is specified.
680 * @return The conversion result is returned.
683 s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node))
689 chtml30 = GET_CHTML30(pdoc);
693 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</head>\r\n", NULL);
700 * It is a handler who processes the TITLE tag.
702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
703 * destination is specified.
704 * @param node [i] The TITLE tag node is specified.
705 * @return The conversion result is returned.
708 s_chtml30_start_title_tag(void *pdoc, Node *UNUSED(node))
714 chtml30 = GET_CHTML30(pdoc);
718 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<title>", NULL);
725 * It is a handler who processes the TITLE tag.
727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
728 * destination is specified.
729 * @param node [i] The TITLE tag node is specified.
730 * @return The conversion result is returned.
733 s_chtml30_end_title_tag(void *pdoc, Node *UNUSED(child))
739 chtml30 = GET_CHTML30(pdoc);
743 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</title>\r\n", NULL);
750 * It is a handler who processes the BASE tag.
752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
753 * destination is specified.
754 * @param node [i] The BASE tag node is specified.
755 * @return The conversion result is returned.
758 s_chtml30_start_base_tag(void *pdoc, Node *node)
765 chtml30 = GET_CHTML30(pdoc);
769 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<base", NULL);
771 /*--------------------------------------------------------------------------*/
773 /*--------------------------------------------------------------------------*/
774 for (attr = qs_get_attr(doc,node);
776 attr = qs_get_next_attr(doc,attr)) {
781 name = qs_get_attr_name(doc,attr);
782 value = qs_get_attr_value(doc,attr);
784 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
785 chtml30->out = apr_pstrcat(r->pool,
794 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >\r\n", NULL);
801 * It is a handler who processes the BASE tag.
803 * @param pdoc [i/o] The pointer to the CHTML structure at the output
804 * destination is specified.
805 * @param node [i] The BASE tag node is specified.
806 * @return The conversion result is returned.
809 s_chtml30_end_base_tag(void *pdoc, Node *UNUSED(child))
813 chtml30 = GET_CHTML30(pdoc);
820 * It is a handler who processes the BODY tag.
822 * @param pdoc [i/o] The pointer to the CHTML structure at the output
823 * destination is specified.
824 * @param node [i] The BODY tag node is specified.
825 * @return The conversion result is returned.
828 s_chtml30_start_body_tag(void *pdoc, Node *node)
835 chtml30 = GET_CHTML30(pdoc);
839 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<body", NULL);
841 /*--------------------------------------------------------------------------*/
843 /*--------------------------------------------------------------------------*/
844 for (attr = qs_get_attr(doc,node);
846 attr = qs_get_next_attr(doc,attr)) {
850 name = qs_get_attr_name(doc,attr);
851 value = qs_get_attr_value(doc,attr);
853 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
854 /*----------------------------------------------------------------------*/
856 /*----------------------------------------------------------------------*/
857 chtml30->out = apr_pstrcat(r->pool,
865 if (strcasecmp(name, "text") == 0) {
866 /*----------------------------------------------------------------------*/
868 /*----------------------------------------------------------------------*/
869 chtml30->out = apr_pstrcat(r->pool,
877 if (strcasecmp(name, "link") == 0) {
878 /*----------------------------------------------------------------------*/
880 /*----------------------------------------------------------------------*/
881 chtml30->out = apr_pstrcat(r->pool,
889 if (strcasecmp(name, "alink") == 0) {
890 /*----------------------------------------------------------------------*/
892 /*----------------------------------------------------------------------*/
896 if (strcasecmp(name, "vlink") == 0) {
897 /*----------------------------------------------------------------------*/
899 /*----------------------------------------------------------------------*/
904 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
911 * It is a handler who processes the BODY tag.
913 * @param pdoc [i/o] The pointer to the CHTML structure at the output
914 * destination is specified.
915 * @param node [i] The BODY tag node is specified.
916 * @return The conversion result is returned.
919 s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child))
925 chtml30 = GET_CHTML30(pdoc);
929 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</body>\r\n", NULL);
936 * It is a handler who processes the A tag.
938 * @param pdoc [i/o] The pointer to the CHTML structure at the output
939 * destination is specified.
940 * @param node [i] The A tag node is specified.
941 * @return The conversion result is returned.
944 s_chtml30_start_a_tag(void *pdoc, Node *node)
951 chtml30 = GET_CHTML30(pdoc);
955 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<a", NULL);
957 /*--------------------------------------------------------------------------*/
959 /*--------------------------------------------------------------------------*/
960 for (attr = qs_get_attr(doc,node);
962 attr = qs_get_next_attr(doc,attr)) {
967 name = qs_get_attr_name(doc,attr);
968 value = qs_get_attr_value(doc,attr);
970 if (strcasecmp(name, "name") == 0) {
971 /*----------------------------------------------------------------------*/
973 /*----------------------------------------------------------------------*/
974 chtml30->out = apr_pstrcat(r->pool,
982 if (strcasecmp(name, "href") == 0) {
983 /*----------------------------------------------------------------------*/
985 /*----------------------------------------------------------------------*/
986 value = chxj_encoding_parameter(r, value);
987 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
988 chtml30->out = apr_pstrcat(r->pool,
996 if (strcasecmp(name, "accesskey") == 0) {
997 /*----------------------------------------------------------------------*/
999 /*----------------------------------------------------------------------*/
1000 chtml30->out = apr_pstrcat(r->pool,
1008 if (strcasecmp(name, "cti") == 0) {
1009 /*----------------------------------------------------------------------*/
1011 /*----------------------------------------------------------------------*/
1012 chtml30->out = apr_pstrcat(r->pool,
1020 if (strcasecmp(name, "ijam") == 0) {
1021 /*----------------------------------------------------------------------*/
1023 /*----------------------------------------------------------------------*/
1027 if (strcasecmp(name, "utn") == 0) {
1028 /*----------------------------------------------------------------------*/
1030 /* It is special only for CHTML. */
1031 /*----------------------------------------------------------------------*/
1032 chtml30->out = apr_pstrcat(r->pool,
1038 if (strcasecmp(name, "telbook") == 0) {
1039 /*----------------------------------------------------------------------*/
1041 /*----------------------------------------------------------------------*/
1045 if (strcasecmp(name, "kana") == 0) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1052 if (strcasecmp(name, "email") == 0) {
1053 /*----------------------------------------------------------------------*/
1055 /*----------------------------------------------------------------------*/
1059 if (strcasecmp(name, "ista") == 0) {
1060 /*----------------------------------------------------------------------*/
1062 /*----------------------------------------------------------------------*/
1066 if (strcasecmp(name, "ilet") == 0) {
1067 /*----------------------------------------------------------------------*/
1069 /*----------------------------------------------------------------------*/
1073 if (strcasecmp(name, "iswf") == 0) {
1074 /*----------------------------------------------------------------------*/
1076 /*----------------------------------------------------------------------*/
1080 if (strcasecmp(name, "irst") == 0) {
1081 /*----------------------------------------------------------------------*/
1083 /*----------------------------------------------------------------------*/
1088 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1090 return chtml30->out;
1095 * It is a handler who processes the A tag.
1097 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1098 * destination is specified.
1099 * @param node [i] The A tag node is specified.
1100 * @return The conversion result is returned.
1103 s_chtml30_end_a_tag(void *pdoc, Node *UNUSED(child))
1109 chtml30 = GET_CHTML30(pdoc);
1113 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</a>", NULL);
1115 return chtml30->out;
1120 * It is a handler who processes the BR tag.
1122 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1123 * destination is specified.
1124 * @param node [i] The BR tag node is specified.
1125 * @return The conversion result is returned.
1128 s_chtml30_start_br_tag(void *pdoc, Node *UNUSED(node))
1134 chtml30 = GET_CHTML30(pdoc);
1138 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1140 return chtml30->out;
1145 * It is a handler who processes the BR tag.
1147 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1148 * destination is specified.
1149 * @param node [i] The BR tag node is specified.
1150 * @return The conversion result is returned.
1153 s_chtml30_end_br_tag(void *pdoc, Node *UNUSED(child))
1157 chtml30 = GET_CHTML30(pdoc);
1159 return chtml30->out;
1164 * It is a handler who processes the TR tag.
1166 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1167 * destination is specified.
1168 * @param node [i] The TR tag node is specified.
1169 * @return The conversion result is returned.
1172 s_chtml30_start_tr_tag(void *pdoc, Node *UNUSED(node))
1176 chtml30 = GET_CHTML30(pdoc);
1178 return chtml30->out;
1183 * It is a handler who processes the TR tag.
1185 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1186 * destination is specified.
1187 * @param node [i] The TR tag node is specified.
1188 * @return The conversion result is returned.
1191 s_chtml30_end_tr_tag(void *pdoc, Node *UNUSED(child))
1197 chtml30 = GET_CHTML30(pdoc);
1201 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1203 return chtml30->out;
1208 * It is a handler who processes the FONT tag.
1210 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1211 * destination is specified.
1212 * @param node [i] The FONT tag node is specified.
1213 * @return The conversion result is returned.
1216 s_chtml30_start_font_tag(void *pdoc, Node *node)
1223 chtml30 = GET_CHTML30(pdoc);
1227 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<font", NULL);
1229 /*--------------------------------------------------------------------------*/
1230 /* Get Attributes */
1231 /*--------------------------------------------------------------------------*/
1232 for (attr = qs_get_attr(doc,node);
1234 attr = qs_get_next_attr(doc,attr)) {
1239 name = qs_get_attr_name(doc,attr);
1240 value = qs_get_attr_value(doc,attr);
1242 if (strcasecmp(name, "color") == 0) {
1243 chtml30->out = apr_pstrcat(r->pool,
1251 if (strcasecmp(name, "size") == 0) {
1252 /*----------------------------------------------------------------------*/
1254 /*----------------------------------------------------------------------*/
1259 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1261 return chtml30->out;
1266 * It is a handler who processes the FONT tag.
1268 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1269 * destination is specified.
1270 * @param node [i] The FONT tag node is specified.
1271 * @return The conversion result is returned.
1274 s_chtml30_end_font_tag(void *pdoc, Node *UNUSED(child))
1280 chtml30 = GET_CHTML30(pdoc);
1284 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</font>", NULL);
1286 return chtml30->out;
1291 * It is a handler who processes the FORM tag.
1293 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1294 * destination is specified.
1295 * @param node [i] The FORM tag node is specified.
1296 * @return The conversion result is returned.
1299 s_chtml30_start_form_tag(void *pdoc, Node *node)
1306 chtml30 = GET_CHTML30(pdoc);
1310 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<form", NULL);
1312 /*--------------------------------------------------------------------------*/
1313 /* Get Attributes */
1314 /*--------------------------------------------------------------------------*/
1315 for (attr = qs_get_attr(doc,node);
1317 attr = qs_get_next_attr(doc,attr)) {
1322 name = qs_get_attr_name(doc,attr);
1323 value = qs_get_attr_value(doc,attr);
1325 if (strcasecmp(name, "action") == 0) {
1326 /*----------------------------------------------------------------------*/
1328 /*----------------------------------------------------------------------*/
1329 value = chxj_encoding_parameter(r, value);
1330 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1331 chtml30->out = apr_pstrcat(r->pool,
1339 if (strcasecmp(name, "method") == 0) {
1340 /*----------------------------------------------------------------------*/
1342 /*----------------------------------------------------------------------*/
1343 chtml30->out = apr_pstrcat(r->pool,
1351 if (strcasecmp(name, "utn") == 0) {
1352 /*----------------------------------------------------------------------*/
1354 /* It is special only for CHTML. */
1355 /*----------------------------------------------------------------------*/
1356 chtml30->out = apr_pstrcat(r->pool,
1362 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1364 return chtml30->out;
1369 * It is a handler who processes the FORM tag.
1371 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1372 * destination is specified.
1373 * @param node [i] The FORM tag node is specified.
1374 * @return The conversion result is returned.
1377 s_chtml30_end_form_tag(void *pdoc, Node *UNUSED(child))
1383 chtml30 = GET_CHTML30(pdoc);
1387 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</form>", NULL);
1389 return chtml30->out;
1394 * It is a handler who processes the INPUT tag.
1396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1397 * destination is specified.
1398 * @param node [i] The INPUT tag node is specified.
1399 * @return The conversion result is returned.
1402 s_chtml30_start_input_tag(void *pdoc, Node *node)
1407 char *max_length = NULL;
1411 char *istyle = NULL;
1413 char *checked = NULL;
1414 char *accesskey = NULL;
1416 chtml30 = GET_CHTML30(pdoc);
1421 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<input", NULL);
1423 /*--------------------------------------------------------------------------*/
1424 /* Get Attributes */
1425 /*--------------------------------------------------------------------------*/
1427 type = qs_get_type_attr(doc, node, r);
1428 name = qs_get_name_attr(doc, node, r);
1429 value = qs_get_value_attr(doc,node,r);
1430 istyle = qs_get_istyle_attr(doc,node,r);
1431 max_length = qs_get_maxlength_attr(doc,node,r);
1432 checked = qs_get_checked_attr(doc,node,r);
1433 accesskey = qs_get_accesskey_attr(doc, node, r);
1434 size = qs_get_size_attr(doc, node, r);
1437 chtml30->out = apr_pstrcat(r->pool,
1445 chtml30->out = apr_pstrcat(r->pool,
1452 chtml30->out = apr_pstrcat(r->pool,
1460 chtml30->out = apr_pstrcat(r->pool,
1468 chtml30->out = apr_pstrcat(r->pool,
1475 /*------------------------------------------------------------------------*/
1477 /*------------------------------------------------------------------------*/
1478 chtml30->out = apr_pstrcat(r->pool,
1484 /*--------------------------------------------------------------------------*/
1485 /* The figure is default for the password. */
1486 /*--------------------------------------------------------------------------*/
1488 if (chxj_chk_numeric(max_length) != 0)
1489 max_length = apr_psprintf(r->pool, "0");
1491 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1492 chtml30->out = apr_pstrcat(r->pool,
1494 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2),
1497 chtml30->out = apr_pstrcat(r->pool,
1499 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)),
1504 chtml30->out = apr_pstrcat(r->pool,
1505 chtml30->out, " checked ", NULL);
1507 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1509 return chtml30->out;
1514 * It is a handler who processes the INPUT tag.
1516 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1517 * destination is specified.
1518 * @param node [i] The INPUT tag node is specified.
1519 * @return The conversion result is returned.
1522 s_chtml30_end_input_tag(void *pdoc, Node *UNUSED(child))
1526 chtml30 = GET_CHTML30(pdoc);
1528 return chtml30->out;
1533 * It is a handler who processes the CENTER tag.
1535 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1536 * destination is specified.
1537 * @param node [i] The CENTER tag node is specified.
1538 * @return The conversion result is returned.
1541 s_chtml30_start_center_tag(void *pdoc, Node *UNUSED(node))
1547 chtml30 = GET_CHTML30(pdoc);
1551 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<center>", NULL);
1553 return chtml30->out;
1558 * It is a handler who processes the CENTER tag.
1560 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1561 * destination is specified.
1562 * @param node [i] The CENTER tag node is specified.
1563 * @return The conversion result is returned.
1566 s_chtml30_end_center_tag(void *pdoc, Node *UNUSED(child))
1572 chtml30 = GET_CHTML30(pdoc);
1576 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</center>", NULL);
1578 return chtml30->out;
1583 * It is a handler who processes the HR tag.
1585 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1586 * destination is specified.
1587 * @param node [i] The HR tag node is specified.
1588 * @return The conversion result is returned.
1591 s_chtml30_start_hr_tag(void *pdoc, Node *node)
1598 chtml30 = GET_CHTML30(pdoc);
1602 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<hr ", NULL);
1604 for (attr = qs_get_attr(doc,node);
1606 attr = qs_get_next_attr(doc,attr)) {
1607 char *name = qs_get_attr_name(doc,attr);
1608 char *value = qs_get_attr_value(doc,attr);
1609 if (strcasecmp(name, "align") == 0) {
1610 /*----------------------------------------------------------------------*/
1612 /*----------------------------------------------------------------------*/
1613 chtml30->out = apr_pstrcat(r->pool,
1615 " align=\"", value, "\" ", NULL);
1618 if (strcasecmp(name, "size") == 0) {
1619 /*----------------------------------------------------------------------*/
1621 /*----------------------------------------------------------------------*/
1622 chtml30->out = apr_pstrcat(r->pool,
1624 " size=\"", value, "\" ", NULL);
1627 if (strcasecmp(name, "width") == 0) {
1628 /*----------------------------------------------------------------------*/
1630 /*----------------------------------------------------------------------*/
1631 chtml30->out = apr_pstrcat(r->pool,
1633 " width=\"", value, "\" ", NULL);
1636 if (strcasecmp(name, "noshade") == 0) {
1637 /*----------------------------------------------------------------------*/
1639 /*----------------------------------------------------------------------*/
1640 chtml30->out = apr_pstrcat(r->pool,
1645 if (strcasecmp(name, "color") == 0) {
1646 /*----------------------------------------------------------------------*/
1648 /*----------------------------------------------------------------------*/
1652 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1654 return chtml30->out;
1659 * It is a handler who processes the HR tag.
1661 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1662 * destination is specified.
1663 * @param node [i] The HR tag node is specified.
1664 * @return The conversion result is returned.
1667 s_chtml30_end_hr_tag(void *pdoc, Node *UNUSED(child))
1671 chtml30 = GET_CHTML30(pdoc);
1673 return chtml30->out;
1678 * It is a handler who processes the IMG tag.
1680 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1681 * destination is specified.
1682 * @param node [i] The IMG tag node is specified.
1683 * @return The conversion result is returned.
1686 s_chtml30_start_img_tag(void *pdoc, Node *node)
1688 #ifndef IMG_NOT_CONVERT_FILENAME
1696 chtml30 = GET_CHTML30(pdoc);
1699 #ifndef IMG_NOT_CONVERT_FILENAME
1700 spec = chtml30->spec;
1703 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<img", NULL);
1706 /*--------------------------------------------------------------------------*/
1707 /* Get Attributes */
1708 /*--------------------------------------------------------------------------*/
1709 for (attr = qs_get_attr(doc,node);
1711 attr = qs_get_next_attr(doc,attr)) {
1712 char *name = qs_get_attr_name(doc,attr);
1713 char *value = qs_get_attr_value(doc,attr);
1715 if (strcasecmp(name, "src") == 0) {
1716 /*----------------------------------------------------------------------*/
1718 /*----------------------------------------------------------------------*/
1719 #ifdef IMG_NOT_CONVERT_FILENAME
1720 value = chxj_encoding_parameter(r, value);
1721 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1723 value = apr_psprintf(r->pool,
1726 (strchr(value, '?')) ? '&' : '?',
1727 CHXJ_COOKIE_NOUPDATE_PARAM);
1730 chtml30->out = apr_pstrcat(r->pool,
1731 chtml30->out, " src=\"",value,"\"", NULL);
1733 value = chxj_img_conv(r,spec,value);
1734 value = chxj_encoding_parameter(r, value);
1735 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1737 value = apr_psprintf(r->pool,
1740 (strchr(value, '?')) ? '&' : '?',
1741 CHXJ_COOKIE_NOUPDATE_PARAM);
1744 chtml30->out = apr_pstrcat(r->pool,
1745 chtml30->out, " src=\"",
1748 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "\"", NULL);
1752 if (strcasecmp(name, "align" ) == 0) {
1753 /*----------------------------------------------------------------------*/
1755 /*----------------------------------------------------------------------*/
1756 chtml30->out = apr_pstrcat(r->pool,
1757 chtml30->out, " align=\"",value,"\"", NULL);
1760 if (strcasecmp(name, "width" ) == 0) {
1761 /*----------------------------------------------------------------------*/
1763 /*----------------------------------------------------------------------*/
1764 chtml30->out = apr_pstrcat(r->pool,
1765 chtml30->out, " width=\"",value,"\"", NULL);
1768 if (strcasecmp(name, "height") == 0) {
1769 /*----------------------------------------------------------------------*/
1771 /*----------------------------------------------------------------------*/
1772 chtml30->out = apr_pstrcat(r->pool,
1773 chtml30->out, " height=\"",value,"\"", NULL);
1776 if (strcasecmp(name, "hspace") == 0) {
1777 /*----------------------------------------------------------------------*/
1779 /*----------------------------------------------------------------------*/
1780 chtml30->out = apr_pstrcat(r->pool,
1781 chtml30->out, " hspace=\"",value,"\"", NULL);
1784 if (strcasecmp(name, "vspace") == 0) {
1785 /*----------------------------------------------------------------------*/
1787 /*----------------------------------------------------------------------*/
1788 chtml30->out = apr_pstrcat(r->pool,
1789 chtml30->out, " vspace=\"",value,"\"", NULL);
1792 if (strcasecmp(name, "alt" ) == 0) {
1793 /*----------------------------------------------------------------------*/
1795 /*----------------------------------------------------------------------*/
1796 chtml30->out = apr_pstrcat(r->pool,
1797 chtml30->out, " alt=\"",value,"\"", NULL);
1800 if (strcasecmp(name, "align" ) == 0) {
1801 /*----------------------------------------------------------------------*/
1803 /*----------------------------------------------------------------------*/
1808 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1810 return chtml30->out;
1815 * It is a handler who processes the IMG tag.
1817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1818 * destination is specified.
1819 * @param node [i] The IMG tag node is specified.
1820 * @return The conversion result is returned.
1823 s_chtml30_end_img_tag(void *pdoc, Node *UNUSED(child))
1827 chtml30 = GET_CHTML30(pdoc);
1829 return chtml30->out;
1834 * It is a handler who processes the SELECT tag.
1836 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1837 * destination is specified.
1838 * @param node [i] The SELECT tag node is specified.
1839 * @return The conversion result is returned.
1842 s_chtml30_start_select_tag(void *pdoc, Node *child)
1851 chtml30 = GET_CHTML30(pdoc);
1857 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<select", NULL);
1858 for (attr = qs_get_attr(doc,child);
1860 attr = qs_get_next_attr(doc,attr)) {
1861 char *nm = qs_get_attr_name(doc,attr);
1862 char *val = qs_get_attr_value(doc,attr);
1864 if (strcasecmp(nm, "size") == 0) {
1865 /*----------------------------------------------------------------------*/
1866 /* CHTML 1.0 version 2.0 */
1867 /*----------------------------------------------------------------------*/
1868 size = apr_pstrdup(r->pool, val);
1871 if (strcasecmp(nm, "name") == 0) {
1872 /*----------------------------------------------------------------------*/
1873 /* CHTML 1.0 version 2.0 */
1874 /*----------------------------------------------------------------------*/
1875 name = apr_pstrdup(r->pool, val);
1878 if (strcasecmp(nm, "multiple") == 0) {
1879 /*----------------------------------------------------------------------*/
1880 /* CHTML 1.0 version 2.0 */
1881 /*----------------------------------------------------------------------*/
1887 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " size=\"",size,"\"", NULL);
1890 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",name,"\"", NULL);
1892 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\n", NULL);
1894 return chtml30->out;
1899 * It is a handler who processes the SELECT tag.
1901 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1902 * destination is specified.
1903 * @param node [i] The SELECT tag node is specified.
1904 * @return The conversion result is returned.
1907 s_chtml30_end_select_tag(void *pdoc, Node *UNUSED(child))
1913 chtml30 = GET_CHTML30(pdoc);
1917 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</select>\n", NULL);
1919 return chtml30->out;
1924 * It is a handler who processes the OPTION tag.
1926 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1927 * destination is specified.
1928 * @param node [i] The OPTION tag node is specified.
1929 * @return The conversion result is returned.
1932 s_chtml30_start_option_tag(void *pdoc, Node *child)
1941 chtml30 = GET_CHTML30(pdoc);
1947 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<option", NULL);
1948 for (attr = qs_get_attr(doc,child);
1950 attr = qs_get_next_attr(doc,attr)) {
1951 char *nm = qs_get_attr_name(doc,attr);
1952 char *val = qs_get_attr_value(doc,attr);
1954 if (strcasecmp(nm, "selected") == 0) {
1955 /*----------------------------------------------------------------------*/
1956 /* CHTML 1.0 version 2.0 */
1957 /*----------------------------------------------------------------------*/
1958 selected = apr_pstrdup(r->pool, val);
1961 if (strcasecmp(nm, "value") == 0) {
1962 /*----------------------------------------------------------------------*/
1963 /* CHTML 1.0 version 2.0 */
1964 /*----------------------------------------------------------------------*/
1965 value = apr_pstrdup(r->pool, val);
1970 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"",value,"\"", NULL);
1972 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"\"", NULL);
1975 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " selected ", NULL);
1977 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1979 return chtml30->out;
1984 * It is a handler who processes the OPTION tag.
1986 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1987 * destination is specified.
1988 * @param node [i] The OPTION tag node is specified.
1989 * @return The conversion result is returned.
1992 s_chtml30_end_option_tag(void *pdoc, Node *UNUSED(child))
1996 chtml30 = GET_CHTML30(pdoc);
2000 return chtml30->out;
2005 * It is a handler who processes the DIV tag.
2007 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2008 * destination is specified.
2009 * @param node [i] The DIV tag node is specified.
2010 * @return The conversion result is returned.
2013 s_chtml30_start_div_tag(void *pdoc, Node *child)
2021 chtml30 = GET_CHTML30(pdoc);
2027 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<div", NULL);
2028 for (attr = qs_get_attr(doc,child);
2030 attr = qs_get_next_attr(doc,attr)) {
2031 char *nm = qs_get_attr_name(doc,attr);
2032 char *val = qs_get_attr_value(doc,attr);
2034 if (strcasecmp(nm, "align") == 0) {
2035 /*----------------------------------------------------------------------*/
2036 /* CHTML 1.0 (W3C version 3.2) */
2037 /*----------------------------------------------------------------------*/
2038 align = apr_pstrdup(r->pool, val);
2043 chtml30->out = apr_pstrcat(r->pool,
2044 chtml30->out, " align=\"", align, "\"", NULL);
2046 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
2048 return chtml30->out;
2053 * It is a handler who processes the DIV tag.
2055 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2056 * destination is specified.
2057 * @param node [i] The DIV tag node is specified.
2058 * @return The conversion result is returned.
2061 s_chtml30_end_div_tag(void *pdoc, Node *UNUSED(node))
2067 chtml30 = GET_CHTML30(pdoc);
2071 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</div>\n", NULL);
2073 return chtml30->out;
2078 * It is a handler who processes the UL tag.
2080 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2081 * destination is specified.
2082 * @param node [i] The UL tag node is specified.
2083 * @return The conversion result is returned.
2086 s_chtml30_start_ul_tag(void *pdoc, Node *UNUSED(node))
2092 chtml30 = GET_CHTML30(pdoc);
2096 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ul>", NULL);
2098 return chtml30->out;
2103 * It is a handler who processes the UL tag.
2105 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2106 * destination is specified.
2107 * @param node [i] The UL tag node is specified.
2108 * @return The conversion result is returned.
2111 s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
2117 chtml30 = GET_CHTML30(pdoc);
2121 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ul>", NULL);
2123 return chtml30->out;
2128 * It is a handler who processes the PRE tag.
2130 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2131 * destination is specified.
2132 * @param node [i] The PRE tag node is specified.
2133 * @return The conversion result is returned.
2136 s_chtml30_start_pre_tag(void *pdoc, Node *UNUSED(node))
2142 chtml30 = GET_CHTML30(pdoc);
2146 chtml30->pre_flag++;
2147 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<pre>", NULL);
2149 return chtml30->out;
2154 * It is a handler who processes the PRE tag.
2156 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2157 * destination is specified.
2158 * @param node [i] The PRE tag node is specified.
2159 * @return The conversion result is returned.
2162 s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
2168 chtml30 = GET_CHTML30(pdoc);
2172 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</pre>", NULL);
2173 chtml30->pre_flag--;
2175 return chtml30->out;
2180 * It is a handler who processes the P tag.
2182 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2183 * destination is specified.
2184 * @param node [i] The P tag node is specified.
2185 * @return The conversion result is returned.
2188 s_chtml30_start_p_tag(void *pdoc, Node *UNUSED(node))
2194 chtml30 = GET_CHTML30(pdoc);
2198 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<p>", NULL);
2200 return chtml30->out;
2205 * It is a handler who processes the P tag.
2207 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2208 * destination is specified.
2209 * @param node [i] The P tag node is specified.
2210 * @return The conversion result is returned.
2213 s_chtml30_end_p_tag(void *pdoc, Node *UNUSED(child))
2219 chtml30 = GET_CHTML30(pdoc);
2223 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</p>", NULL);
2225 return chtml30->out;
2230 * It is a handler who processes the OL tag.
2232 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2233 * destination is specified.
2234 * @param node [i] The OL tag node is specified.
2235 * @return The conversion result is returned.
2238 s_chtml30_start_ol_tag(void *pdoc, Node *UNUSED(node))
2244 chtml30 = GET_CHTML30(pdoc);
2248 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ol>", NULL);
2250 return chtml30->out;
2255 * It is a handler who processes the OL tag.
2257 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2258 * destination is specified.
2259 * @param node [i] The OL tag node is specified.
2260 * @return The conversion result is returned.
2263 s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
2269 chtml30 = GET_CHTML30(pdoc);
2273 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ol>", NULL);
2275 return chtml30->out;
2280 * It is a handler who processes the LI tag.
2282 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2283 * destination is specified.
2284 * @param node [i] The LI tag node is specified.
2285 * @return The conversion result is returned.
2288 s_chtml30_start_li_tag(void *pdoc, Node *UNUSED(node))
2294 chtml30 = GET_CHTML30(pdoc);
2298 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<li>", NULL);
2300 return chtml30->out;
2305 * It is a handler who processes the LI tag.
2307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2308 * destination is specified.
2309 * @param node [i] The LI tag node is specified.
2310 * @return The conversion result is returned.
2313 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
2319 chtml30 = GET_CHTML30(pdoc);
2323 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</li>", NULL);
2325 return chtml30->out;
2330 * It is a handler who processes the H1 tag.
2332 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2333 * destination is specified.
2334 * @param node [i] The H1 tag node is specified.
2335 * @return The conversion result is returned.
2338 s_chtml30_start_h1_tag(void *pdoc, Node *UNUSED(node))
2344 chtml30 = GET_CHTML30(pdoc);
2348 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h1>\r\n", NULL);
2350 return chtml30->out;
2355 * It is a handler who processes the H1 tag.
2357 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2358 * destination is specified.
2359 * @param node [i] The H1 tag node is specified.
2360 * @return The conversion result is returned.
2363 s_chtml30_end_h1_tag(void *pdoc, Node *UNUSED(child))
2369 chtml30 = GET_CHTML30(pdoc);
2373 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h1>\r\n", NULL);
2375 return chtml30->out;
2380 * It is a handler who processes the H2 tag.
2382 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2383 * destination is specified.
2384 * @param node [i] The H2 tag node is specified.
2385 * @return The conversion result is returned.
2388 s_chtml30_start_h2_tag(void *pdoc, Node *UNUSED(node))
2394 chtml30 = GET_CHTML30(pdoc);
2398 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h2>\r\n", NULL);
2400 return chtml30->out;
2405 * It is a handler who processes the H2 tag.
2407 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2408 * destination is specified.
2409 * @param node [i] The H2 tag node is specified.
2410 * @return The conversion result is returned.
2413 s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child))
2419 chtml30 = GET_CHTML30(pdoc);
2423 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h2>\r\n", NULL);
2425 return chtml30->out;
2430 * It is a handler who processes the H3 tag.
2432 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2433 * destination is specified.
2434 * @param node [i] The H3 tag node is specified.
2435 * @return The conversion result is returned.
2438 s_chtml30_start_h3_tag(void *pdoc, Node *UNUSED(node))
2444 chtml30 = GET_CHTML30(pdoc);
2448 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h3>\r\n", NULL);
2450 return chtml30->out;
2455 * It is a handler who processes the H3 tag.
2457 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2458 * destination is specified.
2459 * @param node [i] The H3 tag node is specified.
2460 * @return The conversion result is returned.
2463 s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
2469 chtml30 = GET_CHTML30(pdoc);
2473 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h3>\r\n", NULL);
2475 return chtml30->out;
2480 * It is a handler who processes the H4 tag.
2482 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2483 * destination is specified.
2484 * @param node [i] The H4 tag node is specified.
2485 * @return The conversion result is returned.
2488 s_chtml30_start_h4_tag(void *pdoc, Node *UNUSED(node))
2494 chtml30 = GET_CHTML30(pdoc);
2498 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h4>\r\n", NULL);
2500 return chtml30->out;
2505 * It is a handler who processes the H4 tag.
2507 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2508 * destination is specified.
2509 * @param node [i] The H4 tag node is specified.
2510 * @return The conversion result is returned.
2513 s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child))
2519 chtml30 = GET_CHTML30(pdoc);
2523 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h4>\r\n", NULL);
2525 return chtml30->out;
2530 * It is a handler who processes the H5 tag.
2532 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2533 * destination is specified.
2534 * @param node [i] The H5 tag node is specified.
2535 * @return The conversion result is returned.
2538 s_chtml30_start_h5_tag(void *pdoc, Node *UNUSED(node))
2544 chtml30 = GET_CHTML30(pdoc);
2548 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h5>\r\n", NULL);
2550 return chtml30->out;
2555 * It is a handler who processes the H5 tag.
2557 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2558 * destination is specified.
2559 * @param node [i] The H5 tag node is specified.
2560 * @return The conversion result is returned.
2563 s_chtml30_end_h5_tag(void *pdoc, Node *UNUSED(child))
2569 chtml30 = GET_CHTML30(pdoc);
2573 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h5>\r\n", NULL);
2575 return chtml30->out;
2580 * It is a handler who processes the H6 tag.
2582 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2583 * destination is specified.
2584 * @param node [i] The H6 tag node is specified.
2585 * @return The conversion result is returned.
2588 s_chtml30_start_h6_tag(void *pdoc, Node *UNUSED(node))
2594 chtml30 = GET_CHTML30(pdoc);
2598 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h6>\r\n", NULL);
2600 return chtml30->out;
2605 * It is a handler who processes the H6 tag.
2607 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2608 * destination is specified.
2609 * @param node [i] The H6 tag node is specified.
2610 * @return The conversion result is returned.
2613 s_chtml30_end_h6_tag(void *pdoc, Node *UNUSED(child))
2619 chtml30 = GET_CHTML30(pdoc);
2623 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h6>\r\n", NULL);
2625 return chtml30->out;
2630 * It is a handler who processes the TEXTARE tag.
2632 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2633 * destination is specified.
2634 * @param node [i] The TEXTAREA tag node is specified.
2635 * @return The conversion result is returned.
2638 s_chtml30_start_textarea_tag(void *pdoc, Node *node)
2645 chtml30 = GET_CHTML30(pdoc);
2649 chtml30->textarea_flag++;
2650 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<textarea ", NULL);
2652 for (attr = qs_get_attr(doc,node);
2654 attr = qs_get_next_attr(doc,attr)) {
2656 char *name = qs_get_attr_name(doc,attr);
2657 char *value = qs_get_attr_value(doc,attr);
2659 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2660 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",value,"\"", NULL);
2663 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2664 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " rows=\"",value,"\"", NULL);
2667 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2668 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " cols=\"",value,"\"", NULL);
2672 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
2674 return chtml30->out;
2679 * It is a handler who processes the TEXTAREA tag.
2681 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The TEXTAREA tag node is specified.
2684 * @return The conversion result is returned.
2687 s_chtml30_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2693 chtml30 = GET_CHTML30(pdoc);
2697 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</textarea>\r\n", NULL);
2698 chtml30->textarea_flag--;
2700 return chtml30->out;
2705 s_chtml30_chxjif_tag(void *pdoc, Node *node)
2712 chtml30 = GET_CHTML30(pdoc);
2716 for (child = qs_get_child_node(doc, node);
2718 child = qs_get_next_node(doc, child)) {
2719 chtml30->out = apr_pstrcat(r->pool, chtml30->out, child->otext, NULL);
2720 s_chtml30_chxjif_tag(chtml30, child);
2727 s_chtml30_text_tag(void *pdoc, Node *child)
2740 chtml30 = GET_CHTML30(pdoc);
2744 textval = qs_get_node_value(doc,child);
2745 textval = qs_trim_string(r->pool, textval);
2746 if (strlen(textval) == 0)
2747 return chtml30->out;
2749 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2750 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2752 tdst = qs_alloc_zero_byte_string(r);
2753 memset(one_byte, 0, sizeof(one_byte));
2756 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2757 if (is_sjis_kanji(textval[ii])) {
2758 one_byte[0] = textval[ii+0];
2759 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2760 one_byte[0] = textval[ii+1];
2761 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2764 else if (chtml30->pre_flag) {
2765 one_byte[0] = textval[ii+0];
2766 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2768 else if (chtml30->textarea_flag) {
2769 one_byte[0] = textval[ii+0];
2770 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2772 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2773 one_byte[0] = textval[ii+0];
2774 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2777 chtml30->out = apr_pstrcat(r->pool, chtml30->out, tdst, NULL);
2779 return chtml30->out;