2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_chtml10.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_cookie.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
28 #define GET_CHTML10(X) ((chtml10_t *)(X))
29 #define W_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
30 #define W_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
31 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
33 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
34 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
35 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
36 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
37 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
38 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
39 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
40 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
41 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
42 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
43 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
44 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
45 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
46 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
47 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
48 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
49 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
50 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
51 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
52 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
53 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
54 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
55 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
56 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
57 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
58 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
59 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
60 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
61 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
62 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
63 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
64 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
65 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
66 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
67 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
68 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
69 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
70 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
71 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
72 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
73 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
74 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
75 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
76 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
77 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
78 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
79 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
80 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
81 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
82 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
83 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
84 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
85 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
86 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
87 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
88 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
89 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
90 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
91 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
92 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
93 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
94 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
95 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
96 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
97 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
98 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
100 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
102 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
103 static char *s_chtml10_text (void *pdoc, Node *node);
105 tag_handler chtml10_handler[] = {
108 s_chtml10_start_html_tag,
109 s_chtml10_end_html_tag,
113 s_chtml10_start_meta_tag,
114 s_chtml10_end_meta_tag,
118 s_chtml10_start_textarea_tag,
119 s_chtml10_end_textarea_tag,
123 s_chtml10_start_p_tag,
128 s_chtml10_start_pre_tag,
129 s_chtml10_end_pre_tag,
133 s_chtml10_start_ul_tag,
134 s_chtml10_end_ul_tag,
138 s_chtml10_start_li_tag,
139 s_chtml10_end_li_tag,
143 s_chtml10_start_ol_tag,
144 s_chtml10_end_ol_tag,
148 s_chtml10_start_h1_tag,
149 s_chtml10_end_h1_tag,
153 s_chtml10_start_h2_tag,
154 s_chtml10_end_h2_tag,
158 s_chtml10_start_h3_tag,
159 s_chtml10_end_h3_tag,
163 s_chtml10_start_h4_tag,
164 s_chtml10_end_h4_tag,
168 s_chtml10_start_h5_tag,
169 s_chtml10_end_h5_tag,
173 s_chtml10_start_h6_tag,
174 s_chtml10_end_h6_tag,
178 s_chtml10_start_head_tag,
179 s_chtml10_end_head_tag,
183 s_chtml10_start_title_tag,
184 s_chtml10_end_title_tag,
188 s_chtml10_start_base_tag,
189 s_chtml10_end_base_tag,
193 s_chtml10_start_body_tag,
194 s_chtml10_end_body_tag,
198 s_chtml10_start_a_tag,
203 s_chtml10_start_br_tag,
204 s_chtml10_end_br_tag,
213 s_chtml10_start_tr_tag,
214 s_chtml10_end_tr_tag,
228 s_chtml10_start_font_tag,
229 s_chtml10_end_font_tag,
233 s_chtml10_start_form_tag,
234 s_chtml10_end_form_tag,
238 s_chtml10_start_input_tag,
239 s_chtml10_end_input_tag,
243 s_chtml10_start_center_tag,
244 s_chtml10_end_center_tag,
248 s_chtml10_start_hr_tag,
249 s_chtml10_end_hr_tag,
253 s_chtml10_start_img_tag,
254 s_chtml10_end_img_tag,
258 s_chtml10_start_select_tag,
259 s_chtml10_end_select_tag,
263 s_chtml10_start_option_tag,
264 s_chtml10_end_option_tag,
268 s_chtml10_start_div_tag,
269 s_chtml10_end_div_tag,
273 s_chtml10_chxjif_tag,
318 s_chtml10_start_dt_tag,
319 s_chtml10_end_dt_tag,
333 s_chtml10_start_dl_tag,
334 s_chtml10_end_dl_tag,
338 s_chtml10_start_dd_tag,
339 s_chtml10_end_dd_tag,
345 * converts from CHTML5.0 to CHTML1.0.
347 * @param r [i] Requet_rec is appointed.
348 * @param spec [i] The result of the device specification processing which
349 * was done in advance is appointed.
350 * @param src [i] The character string before the converting is appointed.
351 * @return The character string after the converting is returned.
354 chxj_convert_chtml10(
360 chxjconvrule_entry *entryp,
371 DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
373 /*--------------------------------------------------------------------------*/
375 /*--------------------------------------------------------------------------*/
377 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
379 DBG(r, "i found qrcode xml");
380 DBG(r, "end chxj_convert_chtml10()");
383 DBG(r,"not found qrcode xml");
385 /*--------------------------------------------------------------------------*/
386 /* The CHTML structure is initialized. */
387 /*--------------------------------------------------------------------------*/
388 s_init_chtml10(&chtml10, &doc, r, spec);
389 chtml10.entryp = entryp;
390 chtml10.cookie = cookie;
392 if (IS_SJIS_STRING(GET_SPEC_CHARSET(spec))) {
393 ap_set_content_type(r, "text/html; charset=Windows-31J");
396 ap_set_content_type(r, "text/html; charset=UTF-8");
399 /*--------------------------------------------------------------------------*/
400 /* The character string of the input is analyzed. */
401 /*--------------------------------------------------------------------------*/
402 qs_init_malloc(&doc);
403 qs_init_root_node(&doc);
405 ss = apr_pcalloc(r->pool, srclen + 1);
406 memset(ss, 0, srclen + 1);
407 memcpy(ss, src, srclen);
410 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
413 qs_parse_string(&doc,ss, strlen(ss));
415 if (! chxj_buffered_write_init(r->pool, &doc.buf)) {
416 ERR(r, "failed: chxj_buffered_write_init()");
417 DBG(r, "end chxj_convert_chtml10()");
418 return apr_pstrdup(r->pool, ss);
421 /*--------------------------------------------------------------------------*/
422 /* It converts it from CHTML to CHTML. */
423 /*--------------------------------------------------------------------------*/
424 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
426 /*--------------------------------------------------------------------------*/
427 /* flush buffer AND terminate. */
428 /*--------------------------------------------------------------------------*/
429 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
430 dst = apr_pstrdup(r->pool, chtml10.out);
431 chxj_buffered_write_terminate(&doc.buf);
433 qs_all_free(&doc,QX_LOGMARK);
435 DBG(r, "end chxj_convert_chtml10()");
436 return apr_pstrdup(r->pool,ss);
439 if (strlen(dst) == 0) {
440 dst = apr_psprintf(r->pool, "\n");
442 *dstlen = strlen(dst);
445 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
448 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
455 * The CHTML structure is initialized.
457 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
458 * initialized is specified.
459 * @param doc [i] The Doc structure that should be set to the initialized
460 * HDML structure is specified.
461 * @param r [i] To use POOL, the pointer to request_rec is specified.
462 * @param spec [i] The pointer to the device_table
471 memset(doc, 0, sizeof(Doc));
472 memset(chtml10, 0, sizeof(chtml10_t));
476 chtml10->spec = spec;
477 chtml10->out = qs_alloc_zero_byte_string(r);
478 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
479 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
484 * It is a handler who processes the HTML tag.
486 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
487 * destination is specified.
488 * @param node [i] The HTML tag node is specified.
489 * @return The conversion result is returned.
492 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
498 chtml10 = GET_CHTML10(pdoc);
502 /*--------------------------------------------------------------------------*/
504 /*--------------------------------------------------------------------------*/
508 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
516 * It is a handler who processes the HTML tag.
518 * @param pdoc [i/o] The pointer to the CHTML structure at the output
519 * destination is specified.
520 * @param node [i] The HTML tag node is specified.
521 * @return The conversion result is returned.
524 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
531 chtml10 = GET_CHTML10(pdoc);
538 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
546 * It is a handler who processes the META tag.
548 * @param pdoc [i/o] The pointer to the CHTML structure at the output
549 * destination is specified.
550 * @param node [i] The META tag node is specified.
551 * @return The conversion result is returned.
554 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
558 chtml10 = GET_CHTML10(pdoc);
567 * It is a handler who processes the META tag.
569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
570 * destination is specified.
571 * @param node [i] The META tag node is specified.
572 * @return The conversion result is returned.
575 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
579 chtml10 = GET_CHTML10(pdoc);
586 * It is a handler who processes the HEAD tag.
588 * @param pdoc [i/o] The pointer to the CHTML structure at the output
589 * destination is specified.
590 * @param node [i] The HEAD tag node is specified.
591 * @return The conversion result is returned.
594 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
599 chtml10 = GET_CHTML10(pdoc);
607 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
615 * It is a handler who processes the HEAD tag.
617 * @param pdoc [i/o] The pointer to the CHTML structure at the output
618 * destination is specified.
619 * @param node [i] The HEAD tag node is specified.
620 * @return The conversion result is returned.
623 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
628 chtml10 = GET_CHTML10(pdoc);
636 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
644 * It is a handler who processes the OL tag.
646 * @param pdoc [i/o] The pointer to the CHTML structure at the output
647 * destination is specified.
648 * @param node [i] The OL tag node is specified.
649 * @return The conversion result is returned.
652 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
657 chtml10 = GET_CHTML10(pdoc);
665 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
673 * It is a handler who processes the OL tag.
675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
676 * destination is specified.
677 * @param node [i] The OL tag node is specified.
678 * @return The conversion result is returned.
681 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
687 chtml10 = GET_CHTML10(pdoc);
694 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
702 * It is a handler who processes the UL tag.
704 * @param pdoc [i/o] The pointer to the CHTML structure at the output
705 * destination is specified.
706 * @param node [i] The UL tag node is specified.
707 * @return The conversion result is returned.
710 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
716 chtml10 = GET_CHTML10(pdoc);
723 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
731 * It is a handler who processes the UL tag.
733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
734 * destination is specified.
735 * @param node [i] The UL tag node is specified.
736 * @return The conversion result is returned.
739 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
745 chtml10 = GET_CHTML10(pdoc);
752 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
760 * It is a handler who processes the LI tag.
762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
763 * destination is specified.
764 * @param node [i] The LI tag node is specified.
765 * @return The conversion result is returned.
768 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
774 chtml10 = GET_CHTML10(pdoc);
781 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
789 * It is a handler who processes the LI tag.
791 * @param pdoc [i/o] The pointer to the CHTML structure at the output
792 * destination is specified.
793 * @param node [i] The LI tag node is specified.
794 * @return The conversion result is returned.
797 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
803 chtml10 = GET_CHTML10(pdoc);
810 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
818 * It is a handler who processes the H1 tag.
820 * @param pdoc [i/o] The pointer to the CHTML structure at the output
821 * destination is specified.
822 * @param node [i] The H1 tag node is specified.
823 * @return The conversion result is returned.
826 s_chtml10_start_h1_tag(void *pdoc, Node *UNUSED(node))
832 chtml10 = GET_CHTML10(pdoc);
839 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
847 * It is a handler who processes the H1 tag.
849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
850 * destination is specified.
851 * @param node [i] The H1 tag node is specified.
852 * @return The conversion result is returned.
855 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
861 chtml10 = GET_CHTML10(pdoc);
868 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
876 * It is a handler who processes the H2 tag.
878 * @param pdoc [i/o] The pointer to the CHTML structure at the output
879 * destination is specified.
880 * @param node [i] The H2 tag node is specified.
881 * @return The conversion result is returned.
884 s_chtml10_start_h2_tag(void *pdoc, Node *UNUSED(node))
890 chtml10 = GET_CHTML10(pdoc);
897 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
905 * It is a handler who processes the H2 tag.
907 * @param pdoc [i/o] The pointer to the CHTML structure at the output
908 * destination is specified.
909 * @param node [i] The H2 tag node is specified.
910 * @return The conversion result is returned.
913 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
919 chtml10 = GET_CHTML10(pdoc);
926 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
934 * It is a handler who processes the H3 tag.
936 * @param pdoc [i/o] The pointer to the CHTML structure at the output
937 * destination is specified.
938 * @param node [i] The H3 tag node is specified.
939 * @return The conversion result is returned.
942 s_chtml10_start_h3_tag(void *pdoc, Node *UNUSED(node))
948 chtml10 = GET_CHTML10(pdoc);
955 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
963 * It is a handler who processes the H3 tag.
965 * @param pdoc [i/o] The pointer to the CHTML structure at the output
966 * destination is specified.
967 * @param node [i] The H3 tag node is specified.
968 * @return The conversion result is returned.
971 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
977 chtml10 = GET_CHTML10(pdoc);
984 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
992 * It is a handler who processes the H4 tag.
994 * @param pdoc [i/o] The pointer to the CHTML structure at the output
995 * destination is specified.
996 * @param node [i] The H4 tag node is specified.
997 * @return The conversion result is returned.
1000 s_chtml10_start_h4_tag(void *pdoc, Node *UNUSED(node))
1006 chtml10 = GET_CHTML10(pdoc);
1013 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
1016 return chtml10->out;
1021 * It is a handler who processes the H4 tag.
1023 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1024 * destination is specified.
1025 * @param node [i] The H4 tag node is specified.
1026 * @return The conversion result is returned.
1029 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1035 chtml10 = GET_CHTML10(pdoc);
1042 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
1045 return chtml10->out;
1050 * It is a handler who processes the H5 tag.
1052 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1053 * destination is specified.
1054 * @param node [i] The H5 tag node is specified.
1055 * @return The conversion result is returned.
1058 s_chtml10_start_h5_tag(void *pdoc, Node *UNUSED(node))
1064 chtml10 = GET_CHTML10(pdoc);
1071 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
1074 return chtml10->out;
1079 * It is a handler who processes the H5 tag.
1081 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1082 * destination is specified.
1083 * @param node [i] The H5 tag node is specified.
1084 * @return The conversion result is returned.
1087 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1093 chtml10 = GET_CHTML10(pdoc);
1100 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
1103 return chtml10->out;
1108 * It is a handler who processes the H6 tag.
1110 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1111 * destination is specified.
1112 * @param node [i] The H6 tag node is specified.
1113 * @return The conversion result is returned.
1116 s_chtml10_start_h6_tag(void *pdoc, Node *UNUSED(node))
1122 chtml10 = GET_CHTML10(pdoc);
1129 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1132 return chtml10->out;
1137 * It is a handler who processes the H6 tag.
1139 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1140 * destination is specified.
1141 * @param node [i] The H6 tag node is specified.
1142 * @return The conversion result is returned.
1145 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1151 chtml10 = GET_CHTML10(pdoc);
1158 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1161 return chtml10->out;
1166 * It is a handler who processes the TITLE tag.
1168 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1169 * destination is specified.
1170 * @param node [i] The TITLE tag node is specified.
1171 * @return The conversion result is returned.
1174 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1180 chtml10 = GET_CHTML10(pdoc);
1187 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1190 return chtml10->out;
1195 * It is a handler who processes the TITLE tag.
1197 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1198 * destination is specified.
1199 * @param node [i] The TITLE tag node is specified.
1200 * @return The conversion result is returned.
1203 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1209 chtml10 = GET_CHTML10(pdoc);
1214 W_L("</title>\r\n");
1216 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1219 return chtml10->out;
1224 * It is a handler who processes the BASE tag.
1226 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1227 * destination is specified.
1228 * @param node [i] The BASE tag node is specified.
1229 * @return The conversion result is returned.
1232 s_chtml10_start_base_tag(void *pdoc, Node *node)
1239 chtml10 = GET_CHTML10(pdoc);
1247 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1250 /*--------------------------------------------------------------------------*/
1251 /* Get Attributes */
1252 /*--------------------------------------------------------------------------*/
1253 for (attr = qs_get_attr(doc,node);
1255 attr = qs_get_next_attr(doc,attr)) {
1259 name = qs_get_attr_name(doc,attr);
1260 value = qs_get_attr_value(doc,attr);
1262 if (STRCASEEQ('h','H',"href", name)) {
1268 chtml10->out = apr_pstrcat(r->pool,
1281 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1284 return chtml10->out;
1289 * It is a handler who processes the BASE tag.
1291 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1292 * destination is specified.
1293 * @param node [i] The BASE tag node is specified.
1294 * @return The conversion result is returned.
1297 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1299 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1301 return chtml10->out;
1306 * It is a handler who processes the BODY tag.
1308 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1309 * destination is specified.
1310 * @param node [i] The BODY tag node is specified.
1311 * @return The conversion result is returned.
1314 s_chtml10_start_body_tag(void *pdoc, Node *node)
1321 chtml10 = GET_CHTML10(pdoc);
1328 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1331 /*--------------------------------------------------------------------------*/
1332 /* Get Attributes */
1333 /*--------------------------------------------------------------------------*/
1334 for (attr = qs_get_attr(doc,node);
1336 attr = qs_get_next_attr(doc,attr)) {
1338 name = qs_get_attr_name(doc,attr);
1343 if (strcasecmp(name, "alink") == 0) {
1344 /*----------------------------------------------------------------------*/
1346 /*----------------------------------------------------------------------*/
1353 if (strcasecmp(name, "bgcolor") == 0) {
1354 /*----------------------------------------------------------------------*/
1356 /*----------------------------------------------------------------------*/
1363 if (strcasecmp(name, "text") == 0) {
1364 /*----------------------------------------------------------------------*/
1366 /*----------------------------------------------------------------------*/
1373 if (strcasecmp(name, "link") == 0) {
1374 /*----------------------------------------------------------------------*/
1376 /*----------------------------------------------------------------------*/
1383 if (strcasecmp(name, "vlink") == 0) {
1384 /*----------------------------------------------------------------------*/
1386 /*----------------------------------------------------------------------*/
1399 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1402 return chtml10->out;
1407 * It is a handler who processes the BODY tag.
1409 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1410 * destination is specified.
1411 * @param node [i] The BODY tag node is specified.
1412 * @return The conversion result is returned.
1415 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1421 chtml10 = GET_CHTML10(pdoc);
1428 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1431 return chtml10->out;
1436 * It is a handler who processes the A tag.
1438 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1439 * destination is specified.
1440 * @param node [i] The A tag node is specified.
1441 * @return The conversion result is returned.
1444 s_chtml10_start_a_tag(void *pdoc, Node *node)
1451 chtml10 = GET_CHTML10(pdoc);
1458 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1461 /*--------------------------------------------------------------------------*/
1462 /* Get Attributes */
1463 /*--------------------------------------------------------------------------*/
1464 for (attr = qs_get_attr(doc,node);
1466 attr = qs_get_next_attr(doc,attr)) {
1471 name = qs_get_attr_name(doc,attr);
1472 value = qs_get_attr_value(doc,attr);
1477 if (strcasecmp(name, "name") == 0) {
1478 /*--------------------------------------------------------------------*/
1480 /*--------------------------------------------------------------------*/
1486 chtml10->out = apr_pstrcat(r->pool,
1498 if (strcasecmp(name, "href") == 0) {
1499 /*--------------------------------------------------------------------*/
1501 /*--------------------------------------------------------------------*/
1502 value = chxj_encoding_parameter(r, value);
1503 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1510 chtml10->out = apr_pstrcat(r->pool,
1522 if (strcasecmp(name, "accesskey") == 0) {
1523 /*--------------------------------------------------------------------*/
1525 /*--------------------------------------------------------------------*/
1527 W_L(" accesskey=\"");
1531 chtml10->out = apr_pstrcat(r->pool,
1543 if (strcasecmp(name, "cti") == 0) {
1544 /*--------------------------------------------------------------------*/
1546 /*--------------------------------------------------------------------*/
1553 if (strcasecmp(name, "utn") == 0) {
1554 /*--------------------------------------------------------------------*/
1556 /*--------------------------------------------------------------------*/
1563 if (strcasecmp(name, "telbook") == 0) {
1564 /*--------------------------------------------------------------------*/
1566 /*--------------------------------------------------------------------*/
1573 if (strcasecmp(name, "kana") == 0) {
1574 /*--------------------------------------------------------------------*/
1576 /*--------------------------------------------------------------------*/
1583 if (strcasecmp(name, "email") == 0) {
1584 /*--------------------------------------------------------------------*/
1586 /*--------------------------------------------------------------------*/
1593 if (strcasecmp(name, "ista") == 0) {
1594 /*--------------------------------------------------------------------*/
1596 /*--------------------------------------------------------------------*/
1600 if (strcasecmp(name, "ilet") == 0) {
1601 /*--------------------------------------------------------------------*/
1603 /*--------------------------------------------------------------------*/
1607 if (strcasecmp(name, "iswf") == 0) {
1608 /*--------------------------------------------------------------------*/
1610 /*--------------------------------------------------------------------*/
1614 if (strcasecmp(name, "irst") == 0) {
1615 /*--------------------------------------------------------------------*/
1617 /*--------------------------------------------------------------------*/
1621 if (strcasecmp(name, "ijam") == 0) {
1622 /*--------------------------------------------------------------------*/
1624 /*--------------------------------------------------------------------*/
1637 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1640 return chtml10->out;
1645 * It is a handler who processes the A tag.
1647 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1648 * destination is specified.
1649 * @param node [i] The A tag node is specified.
1650 * @return The conversion result is returned.
1653 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1659 chtml10 = GET_CHTML10(pdoc);
1666 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1669 return chtml10->out;
1674 * It is a handler who processes the BR tag.
1676 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1677 * destination is specified.
1678 * @param node [i] The BR tag node is specified.
1679 * @return The conversion result is returned.
1682 s_chtml10_start_br_tag(void *pdoc, Node *UNUSED(node))
1688 chtml10 = GET_CHTML10(pdoc);
1695 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1698 return chtml10->out;
1703 * It is a handler who processes the BR tag.
1705 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1706 * destination is specified.
1707 * @param node [i] The BR tag node is specified.
1708 * @return The conversion result is returned.
1711 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1713 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1715 return chtml10->out;
1720 * It is a handler who processes the TR tag.
1722 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1723 * destination is specified.
1724 * @param node [i] The TR tag node is specified.
1725 * @return The conversion result is returned.
1728 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1730 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1732 return chtml10->out;
1737 * It is a handler who processes the TR tag.
1739 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1740 * destination is specified.
1741 * @param node [i] The TR tag node is specified.
1742 * @return The conversion result is returned.
1745 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1750 chtml10 = GET_CHTML10(pdoc);
1758 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1761 return chtml10->out;
1766 * It is a handler who processes the FONT tag.
1768 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1769 * destination is specified.
1770 * @param node [i] The FONT tag node is specified.
1771 * @return The conversion result is returned.
1774 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1776 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1780 return chtml10->out;
1785 * It is a handler who processes the FONT tag.
1787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1788 * destination is specified.
1789 * @param node [i] The FONT tag node is specified.
1790 * @return The conversion result is returned.
1793 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1795 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1799 return chtml10->out;
1804 * It is a handler who processes the FORM tag.
1806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1807 * destination is specified.
1808 * @param node [i] The FORM tag node is specified.
1809 * @return The conversion result is returned.
1812 s_chtml10_start_form_tag(void *pdoc, Node *node)
1819 chtml10 = GET_CHTML10(pdoc);
1826 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1829 /*--------------------------------------------------------------------------*/
1830 /* Get Attributes */
1831 /*--------------------------------------------------------------------------*/
1832 for (attr = qs_get_attr(doc,node);
1834 attr = qs_get_next_attr(doc,attr)) {
1838 name = qs_get_attr_name(doc,attr);
1839 value = qs_get_attr_value(doc,attr);
1844 if (strcasecmp(name, "action") == 0) {
1845 /*--------------------------------------------------------------------*/
1847 /*--------------------------------------------------------------------*/
1848 value = chxj_encoding_parameter(r, value);
1849 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1856 chtml10->out = apr_pstrcat(r->pool,
1868 if (strcasecmp(name, "method") == 0) {
1869 /*--------------------------------------------------------------------*/
1871 /*--------------------------------------------------------------------*/
1878 chtml10->out = apr_pstrcat(r->pool,
1890 if (strcasecmp(name, "utn") == 0) {
1891 /*--------------------------------------------------------------------*/
1893 /*--------------------------------------------------------------------*/
1906 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1909 return chtml10->out;
1914 * It is a handler who processes the FORM tag.
1916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1917 * destination is specified.
1918 * @param node [i] The FORM tag node is specified.
1919 * @return The conversion result is returned.
1922 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1928 chtml10 = GET_CHTML10(pdoc);
1935 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1938 return chtml10->out;
1943 * It is a handler who processes the INPUT tag.
1945 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1946 * destination is specified.
1947 * @param node [i] The INPUT tag node is specified.
1948 * @return The conversion result is returned.
1951 s_chtml10_start_input_tag(void *pdoc, Node *node)
1965 chtml10 = GET_CHTML10(pdoc);
1981 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1984 /*--------------------------------------------------------------------------*/
1985 /* Get Attributes */
1986 /*--------------------------------------------------------------------------*/
1988 type = qs_get_type_attr(doc, node, r);
1989 name = qs_get_name_attr(doc, node, r);
1990 value = qs_get_value_attr(doc,node,r);
1991 istyle = qs_get_istyle_attr(doc,node,r);
1992 max_length = qs_get_maxlength_attr(doc,node,r);
1993 checked = qs_get_checked_attr(doc,node,r);
1994 accesskey = qs_get_accesskey_attr(doc, node, r);
1995 size = qs_get_size_attr(doc, node, r);
2003 chtml10->out = apr_pstrcat(r->pool,
2018 chtml10->out = apr_pstrcat(r->pool,
2033 chtml10->out = apr_pstrcat(r->pool,
2048 chtml10->out = apr_pstrcat(r->pool,
2059 W_L(" accesskey=\"");
2063 chtml10->out = apr_pstrcat(r->pool,
2072 /*------------------------------------------------------------------------*/
2074 /*------------------------------------------------------------------------*/
2077 /*--------------------------------------------------------------------------*/
2078 /* The figure is default for the password. */
2079 /*--------------------------------------------------------------------------*/
2082 W_L(" maxlength=\"");
2086 chtml10->out = apr_pstrcat(r->pool,
2099 chtml10->out = apr_pstrcat(r->pool,
2100 chtml10->out, " checked ", NULL);
2107 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2110 return chtml10->out;
2115 * It is a handler who processes the INPUT tag.
2117 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2118 * destination is specified.
2119 * @param node [i] The INPUT tag node is specified.
2120 * @return The conversion result is returned.
2123 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2125 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2127 return chtml10->out;
2132 * It is a handler who processes the CENTER tag.
2134 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2135 * destination is specified.
2136 * @param node [i] The CENTER tag node is specified.
2137 * @return The conversion result is returned.
2140 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2146 chtml10 = GET_CHTML10(pdoc);
2153 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
2156 return chtml10->out;
2161 * It is a handler who processes the CENTER tag.
2163 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2164 * destination is specified.
2165 * @param node [i] The CENTER tag node is specified.
2166 * @return The conversion result is returned.
2169 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2175 chtml10 = GET_CHTML10(pdoc);
2182 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
2185 return chtml10->out;
2190 * It is a handler who processes the HR tag.
2192 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2193 * destination is specified.
2194 * @param node [i] The HR tag node is specified.
2195 * @return The conversion result is returned.
2198 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2205 chtml10 = GET_CHTML10(pdoc);
2209 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
2211 for (attr = qs_get_attr(doc,node);
2213 attr = qs_get_next_attr(doc,attr)) {
2218 name = qs_get_attr_name (doc,attr);
2219 value = qs_get_attr_value(doc,attr);
2224 if (strcasecmp(name, "align") == 0) {
2225 /*--------------------------------------------------------------------*/
2227 /*--------------------------------------------------------------------*/
2233 chtml10->out = apr_pstrcat(r->pool,
2235 " align=\"", value, "\" ", NULL);
2242 if (strcasecmp(name, "size") == 0) {
2243 /*--------------------------------------------------------------------*/
2245 /*--------------------------------------------------------------------*/
2251 chtml10->out = apr_pstrcat(r->pool,
2253 " size=\"", value, "\" ", NULL);
2260 if (strcasecmp(name, "width") == 0) {
2261 /*--------------------------------------------------------------------*/
2263 /*--------------------------------------------------------------------*/
2269 chtml10->out = apr_pstrcat(r->pool,
2271 " width=\"", value, "\" ", NULL);
2278 if (strcasecmp(name, "noshade") == 0) {
2279 /*--------------------------------------------------------------------*/
2281 /*--------------------------------------------------------------------*/
2285 chtml10->out = apr_pstrcat(r->pool,
2294 if (strcasecmp(name, "color") == 0) {
2295 /*--------------------------------------------------------------------*/
2297 /*--------------------------------------------------------------------*/
2310 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2313 return chtml10->out;
2318 * It is a handler who processes the HR tag.
2320 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2321 * destination is specified.
2322 * @param node [i] The HR tag node is specified.
2323 * @return The conversion result is returned.
2326 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2330 chtml10 = GET_CHTML10(pdoc);
2332 return chtml10->out;
2337 * It is a handler who processes the IMG tag.
2339 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2340 * destination is specified.
2341 * @param node [i] The IMG tag node is specified.
2342 * @return The conversion result is returned.
2345 s_chtml10_start_img_tag(void *pdoc, Node *node)
2351 #ifndef IMG_NOT_CONVERT_FILENAME
2355 chtml10 = GET_CHTML10(pdoc);
2356 #ifndef IMG_NOT_CONVERT_FILENAME
2357 spec = chtml10->spec;
2365 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
2369 /*--------------------------------------------------------------------------*/
2370 /* Get Attributes */
2371 /*--------------------------------------------------------------------------*/
2372 for (attr = qs_get_attr(doc,node);
2374 attr = qs_get_next_attr(doc,attr)) {
2379 name = qs_get_attr_name (doc,attr);
2380 value = qs_get_attr_value(doc,attr);
2385 if (strcasecmp(name, "src") == 0) {
2386 /*--------------------------------------------------------------------*/
2388 /*--------------------------------------------------------------------*/
2389 #ifdef IMG_NOT_CONVERT_FILENAME
2390 value = chxj_encoding_parameter(r, value);
2391 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2393 value = apr_psprintf(r->pool,
2396 (strchr(value, '?')) ? '&' : '?',
2397 CHXJ_COOKIE_NOUPDATE_PARAM);
2404 chtml10->out = apr_pstrcat(r->pool,
2405 chtml10->out, " src=\"",value,"\"", NULL);
2408 value = chxj_img_conv(r, spec, value);
2409 value = chxj_encoding_parameter(r, value);
2410 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2412 value = apr_psprintf(r->pool,
2415 (strchr(value, '?')) ? '&' : '?',
2416 CHXJ_COOKIE_NOUPDATE_PARAM);
2423 chtml10->out = apr_pstrcat(r->pool,
2424 chtml10->out, " src=\"",
2427 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2435 if (strcasecmp(name, "align" ) == 0) {
2436 /*--------------------------------------------------------------------*/
2438 /*--------------------------------------------------------------------*/
2439 /*--------------------------------------------------------------------*/
2441 /*--------------------------------------------------------------------*/
2447 chtml10->out = apr_pstrcat(r->pool,
2448 chtml10->out, " align=\"",value,"\"", NULL);
2452 if (strcasecmp(name, "alt" ) == 0) {
2453 /*--------------------------------------------------------------------*/
2455 /*--------------------------------------------------------------------*/
2461 chtml10->out = apr_pstrcat(r->pool,
2462 chtml10->out, " alt=\"",value,"\"", NULL);
2469 if (strcasecmp(name, "width" ) == 0) {
2470 /*--------------------------------------------------------------------*/
2472 /*--------------------------------------------------------------------*/
2478 chtml10->out = apr_pstrcat(r->pool,
2479 chtml10->out, " width=\"",value,"\"", NULL);
2486 if (strcasecmp(name, "height") == 0) {
2487 /*--------------------------------------------------------------------*/
2489 /*--------------------------------------------------------------------*/
2495 chtml10->out = apr_pstrcat(r->pool,
2496 chtml10->out, " height=\"",value,"\"", NULL);
2500 if (strcasecmp(name, "hspace") == 0) {
2501 /*--------------------------------------------------------------------*/
2503 /*--------------------------------------------------------------------*/
2509 chtml10->out = apr_pstrcat(r->pool,
2510 chtml10->out, " hspace=\"",value,"\"", NULL);
2517 if (strcasecmp(name, "vspace") == 0) {
2518 /*--------------------------------------------------------------------*/
2520 /*--------------------------------------------------------------------*/
2526 chtml10->out = apr_pstrcat(r->pool,
2527 chtml10->out, " vspace=\"",value,"\"", NULL);
2540 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2543 return chtml10->out;
2548 * It is a handler who processes the IMG tag.
2550 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2551 * destination is specified.
2552 * @param node [i] The IMG tag node is specified.
2553 * @return The conversion result is returned.
2556 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2560 chtml10 = GET_CHTML10(pdoc);
2562 return chtml10->out;
2567 * It is a handler who processes the SELECT tag.
2569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2570 * destination is specified.
2571 * @param node [i] The SELECT tag node is specified.
2572 * @return The conversion result is returned.
2575 s_chtml10_start_select_tag(void *pdoc, Node *child)
2585 chtml10 = GET_CHTML10(pdoc);
2592 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2593 for (attr = qs_get_attr(doc,child);
2595 attr = qs_get_next_attr(doc,attr)) {
2599 nm = qs_get_attr_name (doc,attr);
2600 val = qs_get_attr_value(doc,attr);
2605 if (strcasecmp(nm, "size") == 0) {
2606 /*--------------------------------------------------------------------*/
2607 /* CHTML 1.0 version 2.0 */
2608 /*--------------------------------------------------------------------*/
2609 size = apr_pstrdup(r->pool, val);
2615 if (strcasecmp(nm, "name") == 0) {
2616 /*--------------------------------------------------------------------*/
2617 /* CHTML 1.0 version 2.0 */
2618 /*--------------------------------------------------------------------*/
2619 name = apr_pstrdup(r->pool, val);
2625 if (strcasecmp(nm, "multiple") == 0) {
2626 /*--------------------------------------------------------------------*/
2627 /* CHTML 1.0 version 2.0 */
2628 /*--------------------------------------------------------------------*/
2644 chtml10->out = apr_pstrcat(r->pool,
2659 chtml10->out = apr_pstrcat(r->pool,
2671 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2674 return chtml10->out;
2679 * It is a handler who processes the SELECT tag.
2681 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The SELECT tag node is specified.
2684 * @return The conversion result is returned.
2687 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2693 chtml10 = GET_CHTML10(pdoc);
2700 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2703 return chtml10->out;
2708 * It is a handler who processes the OPTION tag.
2710 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2711 * destination is specified.
2712 * @param node [i] The OPTION tag node is specified.
2713 * @return The conversion result is returned.
2716 s_chtml10_start_option_tag(void *pdoc, Node *child)
2726 chtml10 = GET_CHTML10(pdoc);
2736 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2738 for (attr = qs_get_attr(doc,child);
2740 attr = qs_get_next_attr(doc,attr)) {
2744 nm = qs_get_attr_name (doc,attr);
2745 val = qs_get_attr_value(doc,attr);
2750 if (strcasecmp(nm, "selected") == 0) {
2751 /*--------------------------------------------------------------------*/
2752 /* CHTML 1.0 version 2.0 */
2753 /*--------------------------------------------------------------------*/
2754 selected = apr_pstrdup(r->pool, val);
2760 if (strcasecmp(nm, "value") == 0) {
2761 /*--------------------------------------------------------------------*/
2762 /* CHTML 1.0 version 2.0 */
2763 /*--------------------------------------------------------------------*/
2764 value = apr_pstrdup(r->pool, val);
2779 chtml10->out = apr_pstrcat(r->pool,
2791 chtml10->out = apr_pstrcat(r->pool,
2802 chtml10->out = apr_pstrcat(r->pool,
2812 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2815 return chtml10->out;
2820 * It is a handler who processes the OPTION tag.
2822 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2823 * destination is specified.
2824 * @param node [i] The OPTION tag node is specified.
2825 * @return The conversion result is returned.
2828 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2832 chtml10 = GET_CHTML10(pdoc);
2836 return chtml10->out;
2841 * It is a handler who processes the DIV tag.
2843 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2844 * destination is specified.
2845 * @param node [i] The DIV tag node is specified.
2846 * @return The conversion result is returned.
2849 s_chtml10_start_div_tag(void *pdoc, Node *child)
2857 chtml10 = GET_CHTML10(pdoc);
2863 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2864 for (attr = qs_get_attr(doc,child);
2866 attr = qs_get_next_attr(doc,attr)) {
2871 nm = qs_get_attr_name(doc,attr);
2872 val = qs_get_attr_value(doc,attr);
2874 if (STRCASEEQ('a','A',"align",nm)) {
2875 /*----------------------------------------------------------------------*/
2876 /* CHTML 1.0 (W3C version 3.2) */
2877 /*----------------------------------------------------------------------*/
2878 align = apr_pstrdup(r->pool, val);
2888 chtml10->out = apr_pstrcat(r->pool,
2889 chtml10->out, " align=\"", align, "\"", NULL);
2896 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2899 return chtml10->out;
2904 * It is a handler who processes the DIV tag.
2906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2907 * destination is specified.
2908 * @param node [i] The DIV tag node is specified.
2909 * @return The conversion result is returned.
2912 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2918 chtml10 = GET_CHTML10(pdoc);
2925 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2928 return chtml10->out;
2933 * It is a handler who processes the CHXJ:IF tag.
2935 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2936 * destination is specified.
2937 * @param node [i] The CHXJ:IF tag node is specified.
2938 * @return The conversion result is returned.
2941 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2948 chtml10 = GET_CHTML10(pdoc);
2952 for (child = qs_get_child_node(doc, node);
2954 child = qs_get_next_node(doc, child)) {
2958 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2960 s_chtml10_chxjif_tag(chtml10, child);
2963 return chtml10->out;
2968 * It is a handler who processes the PRE tag.
2970 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2971 * destination is specified.
2972 * @param node [i] The PRE tag node is specified.
2973 * @return The conversion result is returned.
2976 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2982 chtml10 = GET_CHTML10(pdoc);
2986 chtml10->pre_flag++;
2990 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2993 return chtml10->out;
2998 * It is a handler who processes the PRE tag.
3000 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3001 * destination is specified.
3002 * @param node [i] The PRE tag node is specified.
3003 * @return The conversion result is returned.
3006 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
3012 chtml10 = GET_CHTML10(pdoc);
3019 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
3021 chtml10->pre_flag--;
3023 return chtml10->out;
3028 * It is a handler who processes the P tag.
3030 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3031 * destination is specified.
3032 * @param node [i] The P tag node is specified.
3033 * @return The conversion result is returned.
3036 s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
3042 chtml10 = GET_CHTML10(pdoc);
3049 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
3052 return chtml10->out;
3057 * It is a handler who processes the P tag.
3059 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3060 * destination is specified.
3061 * @param node [i] The P tag node is specified.
3062 * @return The conversion result is returned.
3065 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
3071 chtml10 = GET_CHTML10(pdoc);
3078 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
3081 return chtml10->out;
3086 * It is a handler who processes the TEXTARE tag.
3088 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3089 * destination is specified.
3090 * @param node [i] The TEXTAREA tag node is specified.
3091 * @return The conversion result is returned.
3094 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
3101 chtml10 = GET_CHTML10(pdoc);
3106 chtml10->textarea_flag++;
3110 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
3113 for (attr = qs_get_attr(doc,node);
3115 attr = qs_get_next_attr(doc,attr)) {
3120 name = qs_get_attr_name (doc,attr);
3121 value = qs_get_attr_value(doc,attr);
3126 if (strcasecmp(name, "name") == 0) {
3132 chtml10->out = apr_pstrcat(r->pool,
3144 if (strcasecmp(name, "rows") == 0) {
3150 chtml10->out = apr_pstrcat(r->pool,
3162 if (strcasecmp(name, "cols") == 0) {
3168 chtml10->out = apr_pstrcat(r->pool,
3186 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
3189 return chtml10->out;
3194 * It is a handler who processes the TEXTAREA tag.
3196 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3197 * destination is specified.
3198 * @param node [i] The TEXTAREA tag node is specified.
3199 * @return The conversion result is returned.
3202 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3208 chtml10 = GET_CHTML10(pdoc);
3213 W_L("</textarea>\r\n");
3215 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
3217 chtml10->textarea_flag--;
3219 return chtml10->out;
3224 s_chtml10_text(void *pdoc, Node *child)
3236 chtml10 = GET_CHTML10(pdoc);
3240 textval = qs_get_node_value(doc,child);
3241 textval = qs_trim_string(r->pool, textval);
3243 if (strlen(textval) == 0)
3244 return chtml10->out;
3246 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3247 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3249 tdst = qs_alloc_zero_byte_string(r);
3250 memset(one_byte, 0, sizeof(one_byte));
3253 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3254 if (is_sjis_kanji(textval[ii])) {
3255 one_byte[0] = textval[ii+0];
3256 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3257 one_byte[0] = textval[ii+1];
3258 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3262 if (chtml10->pre_flag) {
3263 one_byte[0] = textval[ii+0];
3264 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3267 if (chtml10->textarea_flag) {
3268 one_byte[0] = textval[ii+0];
3269 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3272 if (textval[ii] != '\r' && textval[ii] != '\n') {
3273 one_byte[0] = textval[ii+0];
3274 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3281 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
3284 return chtml10->out;
3290 * It is a handler who processes the DL tag.
3292 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3293 * destination is specified.
3294 * @param node [i] The DL tag node is specified.
3295 * @return The conversion result is returned.
3298 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3304 chtml10 = GET_CHTML10(pdoc);
3311 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<dl>", NULL);
3314 return chtml10->out;
3319 * It is a handler who processes the DLtag.
3321 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3322 * destination is specified.
3323 * @param node [i] The DL tag node is specified.
3324 * @return The conversion result is returned.
3327 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3333 chtml10 = GET_CHTML10(pdoc);
3340 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</dl>\n", NULL);
3343 return chtml10->out;
3348 * It is a handler who processes the DT tag.
3350 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3351 * destination is specified.
3352 * @param node [i] The DT tag node is specified.
3353 * @return The conversion result is returned.
3356 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3362 chtml10 = GET_CHTML10(pdoc);
3369 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<dt>", NULL);
3372 return chtml10->out;
3377 * It is a handler who processes the DT tag.
3379 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3380 * destination is specified.
3381 * @param node [i] The DT tag node is specified.
3382 * @return The conversion result is returned.
3385 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3391 chtml10 = GET_CHTML10(pdoc);
3398 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\n", NULL);
3401 return chtml10->out;
3406 * It is a handler who processes the DD tag.
3408 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3409 * destination is specified.
3410 * @param node [i] The DD tag node is specified.
3411 * @return The conversion result is returned.
3414 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3420 chtml10 = GET_CHTML10(pdoc);
3427 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<dd>", NULL);
3430 return chtml10->out;
3435 * It is a handler who processes the DD tag.
3437 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3438 * destination is specified.
3439 * @param node [i] The DD tag node is specified.
3440 * @return The conversion result is returned.
3443 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3449 chtml10 = GET_CHTML10(pdoc);
3456 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\n", NULL);
3459 return chtml10->out;