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"
25 #define GET_CHTML10(X) ((chtml10_t *)(X))
27 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
28 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
29 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
30 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
31 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
32 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
33 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
34 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
35 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
36 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
37 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
38 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
39 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
40 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
41 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
42 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
43 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
44 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
45 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
46 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
47 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
48 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
49 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
50 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
51 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
52 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
53 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
54 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
55 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
56 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
57 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
58 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
59 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
60 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
61 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
62 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
63 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
64 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
65 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
66 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
67 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
68 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
69 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
70 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
71 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
72 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
73 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
74 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
75 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
76 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
77 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
78 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
79 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
80 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
81 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
82 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
83 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
84 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
85 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
86 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
87 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
88 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
89 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
90 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
91 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
92 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
94 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
96 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
97 static char *s_chtml10_text (void *pdoc, Node *node);
99 tag_handler chtml10_handler[] = {
102 s_chtml10_start_html_tag,
103 s_chtml10_end_html_tag,
107 s_chtml10_start_meta_tag,
108 s_chtml10_end_meta_tag,
112 s_chtml10_start_textarea_tag,
113 s_chtml10_end_textarea_tag,
117 s_chtml10_start_p_tag,
122 s_chtml10_start_pre_tag,
123 s_chtml10_end_pre_tag,
127 s_chtml10_start_ul_tag,
128 s_chtml10_end_ul_tag,
132 s_chtml10_start_li_tag,
133 s_chtml10_end_li_tag,
137 s_chtml10_start_ol_tag,
138 s_chtml10_end_ol_tag,
142 s_chtml10_start_h1_tag,
143 s_chtml10_end_h1_tag,
147 s_chtml10_start_h2_tag,
148 s_chtml10_end_h2_tag,
152 s_chtml10_start_h3_tag,
153 s_chtml10_end_h3_tag,
157 s_chtml10_start_h4_tag,
158 s_chtml10_end_h4_tag,
162 s_chtml10_start_h5_tag,
163 s_chtml10_end_h5_tag,
167 s_chtml10_start_h6_tag,
168 s_chtml10_end_h6_tag,
172 s_chtml10_start_head_tag,
173 s_chtml10_end_head_tag,
177 s_chtml10_start_title_tag,
178 s_chtml10_end_title_tag,
182 s_chtml10_start_base_tag,
183 s_chtml10_end_base_tag,
187 s_chtml10_start_body_tag,
188 s_chtml10_end_body_tag,
192 s_chtml10_start_a_tag,
197 s_chtml10_start_br_tag,
198 s_chtml10_end_br_tag,
207 s_chtml10_start_tr_tag,
208 s_chtml10_end_tr_tag,
222 s_chtml10_start_font_tag,
223 s_chtml10_end_font_tag,
227 s_chtml10_start_form_tag,
228 s_chtml10_end_form_tag,
232 s_chtml10_start_input_tag,
233 s_chtml10_end_input_tag,
237 s_chtml10_start_center_tag,
238 s_chtml10_end_center_tag,
242 s_chtml10_start_hr_tag,
243 s_chtml10_end_hr_tag,
247 s_chtml10_start_img_tag,
248 s_chtml10_end_img_tag,
252 s_chtml10_start_select_tag,
253 s_chtml10_end_select_tag,
257 s_chtml10_start_option_tag,
258 s_chtml10_end_option_tag,
262 s_chtml10_start_div_tag,
263 s_chtml10_end_div_tag,
267 s_chtml10_chxjif_tag,
312 s_chtml10_start_dt_tag,
313 s_chtml10_end_dt_tag,
327 s_chtml10_start_dl_tag,
328 s_chtml10_end_dl_tag,
332 s_chtml10_start_dd_tag,
333 s_chtml10_end_dd_tag,
339 * converts from CHTML5.0 to CHTML1.0.
341 * @param r [i] Requet_rec is appointed.
342 * @param spec [i] The result of the device specification processing which
343 * was done in advance is appointed.
344 * @param src [i] The character string before the converting is appointed.
345 * @return The character string after the converting is returned.
348 chxj_convert_chtml10(
354 chxjconvrule_entry *entryp,
365 DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
367 /*--------------------------------------------------------------------------*/
369 /*--------------------------------------------------------------------------*/
371 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
373 DBG(r, "i found qrcode xml");
374 DBG(r, "end chxj_convert_chtml10()");
377 DBG(r,"not found qrcode xml");
379 /*--------------------------------------------------------------------------*/
380 /* The CHTML structure is initialized. */
381 /*--------------------------------------------------------------------------*/
382 s_init_chtml10(&chtml10, &doc, r, spec);
383 chtml10.entryp = entryp;
384 chtml10.cookie = cookie;
386 if (IS_SJIS_STRING(GET_SPEC_CHARSET(spec))) {
387 ap_set_content_type(r, "text/html; charset=Windows-31J");
390 ap_set_content_type(r, "text/html; charset=UTF-8");
393 /*--------------------------------------------------------------------------*/
394 /* The character string of the input is analyzed. */
395 /*--------------------------------------------------------------------------*/
396 qs_init_malloc(&doc);
397 qs_init_root_node(&doc);
399 ss = apr_pcalloc(r->pool, srclen + 1);
400 memset(ss, 0, srclen + 1);
401 memcpy(ss, src, srclen);
404 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
407 qs_parse_string(&doc,ss, strlen(ss));
409 if (! chxj_buffered_write_init(r->pool, &doc.buf)) {
410 ERR(r, "failed: chxj_buffered_write_init()");
411 DBG(r, "end chxj_convert_chtml10()");
412 return apr_pstrdup(r->pool, ss);
415 /*--------------------------------------------------------------------------*/
416 /* It converts it from CHTML to CHTML. */
417 /*--------------------------------------------------------------------------*/
418 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
420 /*--------------------------------------------------------------------------*/
421 /* flush buffer AND terminate. */
422 /*--------------------------------------------------------------------------*/
423 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
424 dst = apr_pstrdup(r->pool, chtml10.out);
425 chxj_buffered_write_terminate(&doc.buf);
427 qs_all_free(&doc,QX_LOGMARK);
429 DBG(r, "end chxj_convert_chtml10()");
430 return apr_pstrdup(r->pool,ss);
433 if (strlen(dst) == 0) {
434 dst = apr_psprintf(r->pool, "\n");
436 *dstlen = strlen(dst);
439 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
442 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
449 * The CHTML structure is initialized.
451 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
452 * initialized is specified.
453 * @param doc [i] The Doc structure that should be set to the initialized
454 * HDML structure is specified.
455 * @param r [i] To use POOL, the pointer to request_rec is specified.
456 * @param spec [i] The pointer to the device_table
465 memset(doc, 0, sizeof(Doc));
466 memset(chtml10, 0, sizeof(chtml10_t));
470 chtml10->spec = spec;
471 chtml10->out = qs_alloc_zero_byte_string(r);
472 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
473 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
478 * It is a handler who processes the HTML tag.
480 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
481 * destination is specified.
482 * @param node [i] The HTML tag node is specified.
483 * @return The conversion result is returned.
486 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
492 chtml10 = GET_CHTML10(pdoc);
496 /*--------------------------------------------------------------------------*/
498 /*--------------------------------------------------------------------------*/
499 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
506 * It is a handler who processes the HTML tag.
508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
509 * destination is specified.
510 * @param node [i] The HTML tag node is specified.
511 * @return The conversion result is returned.
514 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
521 chtml10 = GET_CHTML10(pdoc);
525 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
532 * It is a handler who processes the META tag.
534 * @param pdoc [i/o] The pointer to the CHTML structure at the output
535 * destination is specified.
536 * @param node [i] The META tag node is specified.
537 * @return The conversion result is returned.
540 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
544 chtml10 = GET_CHTML10(pdoc);
553 * It is a handler who processes the META tag.
555 * @param pdoc [i/o] The pointer to the CHTML structure at the output
556 * destination is specified.
557 * @param node [i] The META tag node is specified.
558 * @return The conversion result is returned.
561 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
565 chtml10 = GET_CHTML10(pdoc);
572 * It is a handler who processes the HEAD tag.
574 * @param pdoc [i/o] The pointer to the CHTML structure at the output
575 * destination is specified.
576 * @param node [i] The HEAD tag node is specified.
577 * @return The conversion result is returned.
580 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
586 chtml10 = GET_CHTML10(pdoc);
590 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
597 * It is a handler who processes the HEAD tag.
599 * @param pdoc [i/o] The pointer to the CHTML structure at the output
600 * destination is specified.
601 * @param node [i] The HEAD tag node is specified.
602 * @return The conversion result is returned.
605 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
611 chtml10 = GET_CHTML10(pdoc);
615 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
622 * It is a handler who processes the OL tag.
624 * @param pdoc [i/o] The pointer to the CHTML structure at the output
625 * destination is specified.
626 * @param node [i] The OL tag node is specified.
627 * @return The conversion result is returned.
630 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
636 chtml10 = GET_CHTML10(pdoc);
640 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
647 * It is a handler who processes the OL tag.
649 * @param pdoc [i/o] The pointer to the CHTML structure at the output
650 * destination is specified.
651 * @param node [i] The OL tag node is specified.
652 * @return The conversion result is returned.
655 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
661 chtml10 = GET_CHTML10(pdoc);
665 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
672 * It is a handler who processes the UL tag.
674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
675 * destination is specified.
676 * @param node [i] The UL tag node is specified.
677 * @return The conversion result is returned.
680 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
686 chtml10 = GET_CHTML10(pdoc);
690 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
697 * It is a handler who processes the UL tag.
699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
700 * destination is specified.
701 * @param node [i] The UL tag node is specified.
702 * @return The conversion result is returned.
705 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
711 chtml10 = GET_CHTML10(pdoc);
715 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
722 * It is a handler who processes the LI tag.
724 * @param pdoc [i/o] The pointer to the CHTML structure at the output
725 * destination is specified.
726 * @param node [i] The LI tag node is specified.
727 * @return The conversion result is returned.
730 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
736 chtml10 = GET_CHTML10(pdoc);
740 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
747 * It is a handler who processes the LI tag.
749 * @param pdoc [i/o] The pointer to the CHTML structure at the output
750 * destination is specified.
751 * @param node [i] The LI tag node is specified.
752 * @return The conversion result is returned.
755 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
761 chtml10 = GET_CHTML10(pdoc);
765 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
772 * It is a handler who processes the H1 tag.
774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
775 * destination is specified.
776 * @param node [i] The H1 tag node is specified.
777 * @return The conversion result is returned.
780 s_chtml10_start_h1_tag(void *pdoc, Node *UNUSED(node))
786 chtml10 = GET_CHTML10(pdoc);
790 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
797 * It is a handler who processes the H1 tag.
799 * @param pdoc [i/o] The pointer to the CHTML structure at the output
800 * destination is specified.
801 * @param node [i] The H1 tag node is specified.
802 * @return The conversion result is returned.
805 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
811 chtml10 = GET_CHTML10(pdoc);
815 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
822 * It is a handler who processes the H2 tag.
824 * @param pdoc [i/o] The pointer to the CHTML structure at the output
825 * destination is specified.
826 * @param node [i] The H2 tag node is specified.
827 * @return The conversion result is returned.
830 s_chtml10_start_h2_tag(void *pdoc, Node *UNUSED(node))
836 chtml10 = GET_CHTML10(pdoc);
840 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
847 * It is a handler who processes the H2 tag.
849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
850 * destination is specified.
851 * @param node [i] The H2 tag node is specified.
852 * @return The conversion result is returned.
855 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
861 chtml10 = GET_CHTML10(pdoc);
865 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
872 * It is a handler who processes the H3 tag.
874 * @param pdoc [i/o] The pointer to the CHTML structure at the output
875 * destination is specified.
876 * @param node [i] The H3 tag node is specified.
877 * @return The conversion result is returned.
880 s_chtml10_start_h3_tag(void *pdoc, Node *UNUSED(node))
886 chtml10 = GET_CHTML10(pdoc);
890 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
897 * It is a handler who processes the H3 tag.
899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
900 * destination is specified.
901 * @param node [i] The H3 tag node is specified.
902 * @return The conversion result is returned.
905 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
911 chtml10 = GET_CHTML10(pdoc);
915 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
922 * It is a handler who processes the H4 tag.
924 * @param pdoc [i/o] The pointer to the CHTML structure at the output
925 * destination is specified.
926 * @param node [i] The H4 tag node is specified.
927 * @return The conversion result is returned.
930 s_chtml10_start_h4_tag(void *pdoc, Node *UNUSED(node))
936 chtml10 = GET_CHTML10(pdoc);
940 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
947 * It is a handler who processes the H4 tag.
949 * @param pdoc [i/o] The pointer to the CHTML structure at the output
950 * destination is specified.
951 * @param node [i] The H4 tag node is specified.
952 * @return The conversion result is returned.
955 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
961 chtml10 = GET_CHTML10(pdoc);
965 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
972 * It is a handler who processes the H5 tag.
974 * @param pdoc [i/o] The pointer to the CHTML structure at the output
975 * destination is specified.
976 * @param node [i] The H5 tag node is specified.
977 * @return The conversion result is returned.
980 s_chtml10_start_h5_tag(void *pdoc, Node *UNUSED(node))
986 chtml10 = GET_CHTML10(pdoc);
990 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
997 * It is a handler who processes the H5 tag.
999 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1000 * destination is specified.
1001 * @param node [i] The H5 tag node is specified.
1002 * @return The conversion result is returned.
1005 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1011 chtml10 = GET_CHTML10(pdoc);
1015 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
1017 return chtml10->out;
1022 * It is a handler who processes the H6 tag.
1024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1025 * destination is specified.
1026 * @param node [i] The H6 tag node is specified.
1027 * @return The conversion result is returned.
1030 s_chtml10_start_h6_tag(void *pdoc, Node *UNUSED(node))
1036 chtml10 = GET_CHTML10(pdoc);
1040 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1042 return chtml10->out;
1047 * It is a handler who processes the H6 tag.
1049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1050 * destination is specified.
1051 * @param node [i] The H6 tag node is specified.
1052 * @return The conversion result is returned.
1055 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1061 chtml10 = GET_CHTML10(pdoc);
1065 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1067 return chtml10->out;
1072 * It is a handler who processes the TITLE tag.
1074 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1075 * destination is specified.
1076 * @param node [i] The TITLE tag node is specified.
1077 * @return The conversion result is returned.
1080 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1086 chtml10 = GET_CHTML10(pdoc);
1090 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1092 return chtml10->out;
1097 * It is a handler who processes the TITLE tag.
1099 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1100 * destination is specified.
1101 * @param node [i] The TITLE tag node is specified.
1102 * @return The conversion result is returned.
1105 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1111 chtml10 = GET_CHTML10(pdoc);
1115 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1117 return chtml10->out;
1122 * It is a handler who processes the BASE tag.
1124 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1125 * destination is specified.
1126 * @param node [i] The BASE tag node is specified.
1127 * @return The conversion result is returned.
1130 s_chtml10_start_base_tag(void *pdoc, Node *node)
1137 chtml10 = GET_CHTML10(pdoc);
1142 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1144 /*--------------------------------------------------------------------------*/
1145 /* Get Attributes */
1146 /*--------------------------------------------------------------------------*/
1147 for (attr = qs_get_attr(doc,node);
1149 attr = qs_get_next_attr(doc,attr)) {
1153 name = qs_get_attr_name(doc,attr);
1154 value = qs_get_attr_value(doc,attr);
1156 if (STRCASEEQ('h','H',"href", name)) {
1157 chtml10->out = apr_pstrcat(r->pool,
1166 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1168 return chtml10->out;
1173 * It is a handler who processes the BASE tag.
1175 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1176 * destination is specified.
1177 * @param node [i] The BASE tag node is specified.
1178 * @return The conversion result is returned.
1181 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1183 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1185 return chtml10->out;
1190 * It is a handler who processes the BODY tag.
1192 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1193 * destination is specified.
1194 * @param node [i] The BODY tag node is specified.
1195 * @return The conversion result is returned.
1198 s_chtml10_start_body_tag(void *pdoc, Node *node)
1205 chtml10 = GET_CHTML10(pdoc);
1209 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1211 /*--------------------------------------------------------------------------*/
1212 /* Get Attributes */
1213 /*--------------------------------------------------------------------------*/
1214 for (attr = qs_get_attr(doc,node);
1216 attr = qs_get_next_attr(doc,attr)) {
1220 name = qs_get_attr_name(doc,attr);
1225 if (strcasecmp(name, "alink") == 0) {
1226 /*----------------------------------------------------------------------*/
1228 /*----------------------------------------------------------------------*/
1235 if (strcasecmp(name, "bgcolor") == 0) {
1236 /*----------------------------------------------------------------------*/
1238 /*----------------------------------------------------------------------*/
1245 if (strcasecmp(name, "text") == 0) {
1246 /*----------------------------------------------------------------------*/
1248 /*----------------------------------------------------------------------*/
1255 if (strcasecmp(name, "link") == 0) {
1256 /*----------------------------------------------------------------------*/
1258 /*----------------------------------------------------------------------*/
1265 if (strcasecmp(name, "vlink") == 0) {
1266 /*----------------------------------------------------------------------*/
1268 /*----------------------------------------------------------------------*/
1278 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1280 return chtml10->out;
1285 * It is a handler who processes the BODY tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The BODY tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1299 chtml10 = GET_CHTML10(pdoc);
1303 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1305 return chtml10->out;
1310 * It is a handler who processes the A tag.
1312 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1313 * destination is specified.
1314 * @param node [i] The A tag node is specified.
1315 * @return The conversion result is returned.
1318 s_chtml10_start_a_tag(void *pdoc, Node *node)
1325 chtml10 = GET_CHTML10(pdoc);
1329 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1331 /*--------------------------------------------------------------------------*/
1332 /* Get Attributes */
1333 /*--------------------------------------------------------------------------*/
1334 for (attr = qs_get_attr(doc,node);
1336 attr = qs_get_next_attr(doc,attr)) {
1341 name = qs_get_attr_name(doc,attr);
1342 value = qs_get_attr_value(doc,attr);
1347 if (strcasecmp(name, "name") == 0) {
1348 /*--------------------------------------------------------------------*/
1350 /*--------------------------------------------------------------------*/
1351 chtml10->out = apr_pstrcat(r->pool,
1362 if (strcasecmp(name, "href") == 0) {
1363 /*--------------------------------------------------------------------*/
1365 /*--------------------------------------------------------------------*/
1366 value = chxj_encoding_parameter(r, value);
1367 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1369 chtml10->out = apr_pstrcat(r->pool,
1380 if (strcasecmp(name, "accesskey") == 0) {
1381 /*--------------------------------------------------------------------*/
1383 /*--------------------------------------------------------------------*/
1384 chtml10->out = apr_pstrcat(r->pool,
1395 if (strcasecmp(name, "cti") == 0) {
1396 /*--------------------------------------------------------------------*/
1398 /*--------------------------------------------------------------------*/
1405 if (strcasecmp(name, "utn") == 0) {
1406 /*--------------------------------------------------------------------*/
1408 /*--------------------------------------------------------------------*/
1415 if (strcasecmp(name, "telbook") == 0) {
1416 /*--------------------------------------------------------------------*/
1418 /*--------------------------------------------------------------------*/
1425 if (strcasecmp(name, "kana") == 0) {
1426 /*--------------------------------------------------------------------*/
1428 /*--------------------------------------------------------------------*/
1435 if (strcasecmp(name, "email") == 0) {
1436 /*--------------------------------------------------------------------*/
1438 /*--------------------------------------------------------------------*/
1445 if (strcasecmp(name, "ista") == 0) {
1446 /*--------------------------------------------------------------------*/
1448 /*--------------------------------------------------------------------*/
1452 if (strcasecmp(name, "ilet") == 0) {
1453 /*--------------------------------------------------------------------*/
1455 /*--------------------------------------------------------------------*/
1459 if (strcasecmp(name, "iswf") == 0) {
1460 /*--------------------------------------------------------------------*/
1462 /*--------------------------------------------------------------------*/
1466 if (strcasecmp(name, "irst") == 0) {
1467 /*--------------------------------------------------------------------*/
1469 /*--------------------------------------------------------------------*/
1473 if (strcasecmp(name, "ijam") == 0) {
1474 /*--------------------------------------------------------------------*/
1476 /*--------------------------------------------------------------------*/
1486 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1488 return chtml10->out;
1493 * It is a handler who processes the A tag.
1495 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1496 * destination is specified.
1497 * @param node [i] The A tag node is specified.
1498 * @return The conversion result is returned.
1501 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1507 chtml10 = GET_CHTML10(pdoc);
1511 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1513 return chtml10->out;
1518 * It is a handler who processes the BR tag.
1520 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1521 * destination is specified.
1522 * @param node [i] The BR tag node is specified.
1523 * @return The conversion result is returned.
1526 s_chtml10_start_br_tag(void *pdoc, Node *UNUSED(node))
1532 chtml10 = GET_CHTML10(pdoc);
1536 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1538 return chtml10->out;
1543 * It is a handler who processes the BR tag.
1545 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1546 * destination is specified.
1547 * @param node [i] The BR tag node is specified.
1548 * @return The conversion result is returned.
1551 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1553 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1555 return chtml10->out;
1560 * It is a handler who processes the TR tag.
1562 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1563 * destination is specified.
1564 * @param node [i] The TR tag node is specified.
1565 * @return The conversion result is returned.
1568 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1570 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1572 return chtml10->out;
1577 * It is a handler who processes the TR tag.
1579 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1580 * destination is specified.
1581 * @param node [i] The TR tag node is specified.
1582 * @return The conversion result is returned.
1585 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1591 chtml10 = GET_CHTML10(pdoc);
1595 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1597 return chtml10->out;
1602 * It is a handler who processes the FONT tag.
1604 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1605 * destination is specified.
1606 * @param node [i] The FONT tag node is specified.
1607 * @return The conversion result is returned.
1610 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1612 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1616 return chtml10->out;
1621 * It is a handler who processes the FONT tag.
1623 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1624 * destination is specified.
1625 * @param node [i] The FONT tag node is specified.
1626 * @return The conversion result is returned.
1629 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1631 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1635 return chtml10->out;
1640 * It is a handler who processes the FORM tag.
1642 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1643 * destination is specified.
1644 * @param node [i] The FORM tag node is specified.
1645 * @return The conversion result is returned.
1648 s_chtml10_start_form_tag(void *pdoc, Node *node)
1655 chtml10 = GET_CHTML10(pdoc);
1659 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1661 /*--------------------------------------------------------------------------*/
1662 /* Get Attributes */
1663 /*--------------------------------------------------------------------------*/
1664 for (attr = qs_get_attr(doc,node);
1666 attr = qs_get_next_attr(doc,attr)) {
1670 name = qs_get_attr_name(doc,attr);
1671 value = qs_get_attr_value(doc,attr);
1676 if (strcasecmp(name, "action") == 0) {
1677 /*--------------------------------------------------------------------*/
1679 /*--------------------------------------------------------------------*/
1680 value = chxj_encoding_parameter(r, value);
1681 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1683 chtml10->out = apr_pstrcat(r->pool,
1694 if (strcasecmp(name, "method") == 0) {
1695 /*--------------------------------------------------------------------*/
1697 /*--------------------------------------------------------------------*/
1698 chtml10->out = apr_pstrcat(r->pool,
1709 if (strcasecmp(name, "utn") == 0) {
1710 /*--------------------------------------------------------------------*/
1712 /*--------------------------------------------------------------------*/
1722 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1724 return chtml10->out;
1729 * It is a handler who processes the FORM tag.
1731 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1732 * destination is specified.
1733 * @param node [i] The FORM tag node is specified.
1734 * @return The conversion result is returned.
1737 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1743 chtml10 = GET_CHTML10(pdoc);
1747 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1749 return chtml10->out;
1754 * It is a handler who processes the INPUT tag.
1756 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1757 * destination is specified.
1758 * @param node [i] The INPUT tag node is specified.
1759 * @return The conversion result is returned.
1762 s_chtml10_start_input_tag(void *pdoc, Node *node)
1776 chtml10 = GET_CHTML10(pdoc);
1789 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1791 /*--------------------------------------------------------------------------*/
1792 /* Get Attributes */
1793 /*--------------------------------------------------------------------------*/
1795 type = qs_get_type_attr(doc, node, r);
1796 name = qs_get_name_attr(doc, node, r);
1797 value = qs_get_value_attr(doc,node,r);
1798 istyle = qs_get_istyle_attr(doc,node,r);
1799 max_length = qs_get_maxlength_attr(doc,node,r);
1800 checked = qs_get_checked_attr(doc,node,r);
1801 accesskey = qs_get_accesskey_attr(doc, node, r);
1802 size = qs_get_size_attr(doc, node, r);
1805 chtml10->out = apr_pstrcat(r->pool,
1813 chtml10->out = apr_pstrcat(r->pool,
1821 chtml10->out = apr_pstrcat(r->pool,
1829 chtml10->out = apr_pstrcat(r->pool,
1837 chtml10->out = apr_pstrcat(r->pool,
1844 /*------------------------------------------------------------------------*/
1846 /*------------------------------------------------------------------------*/
1849 /*--------------------------------------------------------------------------*/
1850 /* The figure is default for the password. */
1851 /*--------------------------------------------------------------------------*/
1853 chtml10->out = apr_pstrcat(r->pool,
1861 chtml10->out = apr_pstrcat(r->pool,
1862 chtml10->out, " checked ", NULL);
1864 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1866 return chtml10->out;
1871 * It is a handler who processes the INPUT tag.
1873 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1874 * destination is specified.
1875 * @param node [i] The INPUT tag node is specified.
1876 * @return The conversion result is returned.
1879 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
1881 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1883 return chtml10->out;
1888 * It is a handler who processes the CENTER tag.
1890 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1891 * destination is specified.
1892 * @param node [i] The CENTER tag node is specified.
1893 * @return The conversion result is returned.
1896 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
1902 chtml10 = GET_CHTML10(pdoc);
1906 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1908 return chtml10->out;
1913 * It is a handler who processes the CENTER tag.
1915 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1916 * destination is specified.
1917 * @param node [i] The CENTER tag node is specified.
1918 * @return The conversion result is returned.
1921 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
1927 chtml10 = GET_CHTML10(pdoc);
1931 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1933 return chtml10->out;
1938 * It is a handler who processes the HR tag.
1940 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1941 * destination is specified.
1942 * @param node [i] The HR tag node is specified.
1943 * @return The conversion result is returned.
1946 s_chtml10_start_hr_tag(void *pdoc, Node *node)
1953 chtml10 = GET_CHTML10(pdoc);
1957 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1959 for (attr = qs_get_attr(doc,node);
1961 attr = qs_get_next_attr(doc,attr)) {
1966 name = qs_get_attr_name (doc,attr);
1967 value = qs_get_attr_value(doc,attr);
1972 if (strcasecmp(name, "align") == 0) {
1973 /*--------------------------------------------------------------------*/
1975 /*--------------------------------------------------------------------*/
1976 chtml10->out = apr_pstrcat(r->pool,
1978 " align=\"", value, "\" ", NULL);
1984 if (strcasecmp(name, "size") == 0) {
1985 /*--------------------------------------------------------------------*/
1987 /*--------------------------------------------------------------------*/
1988 chtml10->out = apr_pstrcat(r->pool,
1990 " size=\"", value, "\" ", NULL);
1996 if (strcasecmp(name, "width") == 0) {
1997 /*--------------------------------------------------------------------*/
1999 /*--------------------------------------------------------------------*/
2000 chtml10->out = apr_pstrcat(r->pool,
2002 " width=\"", value, "\" ", NULL);
2008 if (strcasecmp(name, "noshade") == 0) {
2009 /*--------------------------------------------------------------------*/
2011 /*--------------------------------------------------------------------*/
2012 chtml10->out = apr_pstrcat(r->pool,
2020 if (strcasecmp(name, "color") == 0) {
2021 /*--------------------------------------------------------------------*/
2023 /*--------------------------------------------------------------------*/
2033 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2035 return chtml10->out;
2040 * It is a handler who processes the HR tag.
2042 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2043 * destination is specified.
2044 * @param node [i] The HR tag node is specified.
2045 * @return The conversion result is returned.
2048 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2052 chtml10 = GET_CHTML10(pdoc);
2054 return chtml10->out;
2059 * It is a handler who processes the IMG tag.
2061 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2062 * destination is specified.
2063 * @param node [i] The IMG tag node is specified.
2064 * @return The conversion result is returned.
2067 s_chtml10_start_img_tag(void *pdoc, Node *node)
2073 #ifndef IMG_NOT_CONVERT_FILENAME
2077 chtml10 = GET_CHTML10(pdoc);
2078 #ifndef IMG_NOT_CONVERT_FILENAME
2079 spec = chtml10->spec;
2084 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
2087 /*--------------------------------------------------------------------------*/
2088 /* Get Attributes */
2089 /*--------------------------------------------------------------------------*/
2090 for (attr = qs_get_attr(doc,node);
2092 attr = qs_get_next_attr(doc,attr)) {
2097 name = qs_get_attr_name (doc,attr);
2098 value = qs_get_attr_value(doc,attr);
2103 if (strcasecmp(name, "src") == 0) {
2104 /*--------------------------------------------------------------------*/
2106 /*--------------------------------------------------------------------*/
2107 #ifdef IMG_NOT_CONVERT_FILENAME
2108 value = chxj_encoding_parameter(r, value);
2109 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2111 value = apr_psprintf(r->pool,
2114 (strchr(value, '?')) ? '&' : '?',
2115 CHXJ_COOKIE_NOUPDATE_PARAM);
2117 chtml10->out = apr_pstrcat(r->pool,
2118 chtml10->out, " src=\"",value,"\"", NULL);
2120 value = chxj_img_conv(r, spec, value);
2121 value = chxj_encoding_parameter(r, value);
2122 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2124 value = apr_psprintf(r->pool,
2127 (strchr(value, '?')) ? '&' : '?',
2128 CHXJ_COOKIE_NOUPDATE_PARAM);
2130 chtml10->out = apr_pstrcat(r->pool,
2131 chtml10->out, " src=\"",
2134 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2141 if (strcasecmp(name, "align" ) == 0) {
2142 /*--------------------------------------------------------------------*/
2144 /*--------------------------------------------------------------------*/
2145 /*--------------------------------------------------------------------*/
2147 /*--------------------------------------------------------------------*/
2148 chtml10->out = apr_pstrcat(r->pool,
2149 chtml10->out, " align=\"",value,"\"", NULL);
2152 if (strcasecmp(name, "alt" ) == 0) {
2153 /*--------------------------------------------------------------------*/
2155 /*--------------------------------------------------------------------*/
2156 chtml10->out = apr_pstrcat(r->pool,
2157 chtml10->out, " alt=\"",value,"\"", NULL);
2163 if (strcasecmp(name, "width" ) == 0) {
2164 /*--------------------------------------------------------------------*/
2166 /*--------------------------------------------------------------------*/
2167 chtml10->out = apr_pstrcat(r->pool,
2168 chtml10->out, " width=\"",value,"\"", NULL);
2174 if (strcasecmp(name, "height") == 0) {
2175 /*--------------------------------------------------------------------*/
2177 /*--------------------------------------------------------------------*/
2178 chtml10->out = apr_pstrcat(r->pool,
2179 chtml10->out, " height=\"",value,"\"", NULL);
2182 if (strcasecmp(name, "hspace") == 0) {
2183 /*--------------------------------------------------------------------*/
2185 /*--------------------------------------------------------------------*/
2186 chtml10->out = apr_pstrcat(r->pool,
2187 chtml10->out, " hspace=\"",value,"\"", NULL);
2193 if (strcasecmp(name, "vspace") == 0) {
2194 /*--------------------------------------------------------------------*/
2196 /*--------------------------------------------------------------------*/
2197 chtml10->out = apr_pstrcat(r->pool,
2198 chtml10->out, " vspace=\"",value,"\"", NULL);
2207 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2209 return chtml10->out;
2214 * It is a handler who processes the IMG tag.
2216 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2217 * destination is specified.
2218 * @param node [i] The IMG tag node is specified.
2219 * @return The conversion result is returned.
2222 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2226 chtml10 = GET_CHTML10(pdoc);
2228 return chtml10->out;
2233 * It is a handler who processes the SELECT tag.
2235 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2236 * destination is specified.
2237 * @param node [i] The SELECT tag node is specified.
2238 * @return The conversion result is returned.
2241 s_chtml10_start_select_tag(void *pdoc, Node *child)
2251 chtml10 = GET_CHTML10(pdoc);
2258 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2259 for (attr = qs_get_attr(doc,child);
2261 attr = qs_get_next_attr(doc,attr)) {
2265 nm = qs_get_attr_name (doc,attr);
2266 val = qs_get_attr_value(doc,attr);
2271 if (strcasecmp(nm, "size") == 0) {
2272 /*--------------------------------------------------------------------*/
2273 /* CHTML 1.0 version 2.0 */
2274 /*--------------------------------------------------------------------*/
2275 size = apr_pstrdup(r->pool, val);
2281 if (strcasecmp(nm, "name") == 0) {
2282 /*--------------------------------------------------------------------*/
2283 /* CHTML 1.0 version 2.0 */
2284 /*--------------------------------------------------------------------*/
2285 name = apr_pstrdup(r->pool, val);
2291 if (strcasecmp(nm, "multiple") == 0) {
2292 /*--------------------------------------------------------------------*/
2293 /* CHTML 1.0 version 2.0 */
2294 /*--------------------------------------------------------------------*/
2305 chtml10->out = apr_pstrcat(r->pool,
2313 chtml10->out = apr_pstrcat(r->pool,
2320 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2322 return chtml10->out;
2327 * It is a handler who processes the SELECT tag.
2329 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2330 * destination is specified.
2331 * @param node [i] The SELECT tag node is specified.
2332 * @return The conversion result is returned.
2335 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2341 chtml10 = GET_CHTML10(pdoc);
2345 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2347 return chtml10->out;
2352 * It is a handler who processes the OPTION tag.
2354 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2355 * destination is specified.
2356 * @param node [i] The OPTION tag node is specified.
2357 * @return The conversion result is returned.
2360 s_chtml10_start_option_tag(void *pdoc, Node *child)
2370 chtml10 = GET_CHTML10(pdoc);
2377 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2378 for (attr = qs_get_attr(doc,child);
2380 attr = qs_get_next_attr(doc,attr)) {
2384 nm = qs_get_attr_name (doc,attr);
2385 val = qs_get_attr_value(doc,attr);
2390 if (strcasecmp(nm, "selected") == 0) {
2391 /*--------------------------------------------------------------------*/
2392 /* CHTML 1.0 version 2.0 */
2393 /*--------------------------------------------------------------------*/
2394 selected = apr_pstrdup(r->pool, val);
2400 if (strcasecmp(nm, "value") == 0) {
2401 /*--------------------------------------------------------------------*/
2402 /* CHTML 1.0 version 2.0 */
2403 /*--------------------------------------------------------------------*/
2404 value = apr_pstrdup(r->pool, val);
2414 chtml10->out = apr_pstrcat(r->pool,
2421 chtml10->out = apr_pstrcat(r->pool,
2427 chtml10->out = apr_pstrcat(r->pool,
2432 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2434 return chtml10->out;
2439 * It is a handler who processes the OPTION tag.
2441 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2442 * destination is specified.
2443 * @param node [i] The OPTION tag node is specified.
2444 * @return The conversion result is returned.
2447 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2451 chtml10 = GET_CHTML10(pdoc);
2455 return chtml10->out;
2460 * It is a handler who processes the DIV tag.
2462 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2463 * destination is specified.
2464 * @param node [i] The DIV tag node is specified.
2465 * @return The conversion result is returned.
2468 s_chtml10_start_div_tag(void *pdoc, Node *child)
2476 chtml10 = GET_CHTML10(pdoc);
2482 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2483 for (attr = qs_get_attr(doc,child);
2485 attr = qs_get_next_attr(doc,attr)) {
2490 nm = qs_get_attr_name(doc,attr);
2491 val = qs_get_attr_value(doc,attr);
2493 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2494 /*----------------------------------------------------------------------*/
2495 /* CHTML 1.0 (W3C version 3.2) */
2496 /*----------------------------------------------------------------------*/
2497 align = apr_pstrdup(r->pool, val);
2502 chtml10->out = apr_pstrcat(r->pool,
2503 chtml10->out, " align=\"", align, "\"", NULL);
2505 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2507 return chtml10->out;
2512 * It is a handler who processes the DIV tag.
2514 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2515 * destination is specified.
2516 * @param node [i] The DIV tag node is specified.
2517 * @return The conversion result is returned.
2520 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2526 chtml10 = GET_CHTML10(pdoc);
2530 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2532 return chtml10->out;
2537 * It is a handler who processes the CHXJ:IF tag.
2539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2540 * destination is specified.
2541 * @param node [i] The CHXJ:IF tag node is specified.
2542 * @return The conversion result is returned.
2545 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2552 chtml10 = GET_CHTML10(pdoc);
2556 for (child = qs_get_child_node(doc, node);
2558 child = qs_get_next_node(doc, child)) {
2559 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2560 s_chtml10_chxjif_tag(chtml10, child);
2563 return chtml10->out;
2568 * It is a handler who processes the PRE tag.
2570 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2571 * destination is specified.
2572 * @param node [i] The PRE tag node is specified.
2573 * @return The conversion result is returned.
2576 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2582 chtml10 = GET_CHTML10(pdoc);
2586 chtml10->pre_flag++;
2587 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2589 return chtml10->out;
2594 * It is a handler who processes the PRE tag.
2596 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2597 * destination is specified.
2598 * @param node [i] The PRE tag node is specified.
2599 * @return The conversion result is returned.
2602 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2608 chtml10 = GET_CHTML10(pdoc);
2612 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2613 chtml10->pre_flag--;
2615 return chtml10->out;
2620 * It is a handler who processes the P tag.
2622 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2623 * destination is specified.
2624 * @param node [i] The P tag node is specified.
2625 * @return The conversion result is returned.
2628 s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
2634 chtml10 = GET_CHTML10(pdoc);
2638 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2640 return chtml10->out;
2645 * It is a handler who processes the P tag.
2647 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2648 * destination is specified.
2649 * @param node [i] The P tag node is specified.
2650 * @return The conversion result is returned.
2653 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2659 chtml10 = GET_CHTML10(pdoc);
2663 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2665 return chtml10->out;
2670 * It is a handler who processes the TEXTARE tag.
2672 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2673 * destination is specified.
2674 * @param node [i] The TEXTAREA tag node is specified.
2675 * @return The conversion result is returned.
2678 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2685 chtml10 = GET_CHTML10(pdoc);
2690 chtml10->textarea_flag++;
2691 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2693 for (attr = qs_get_attr(doc,node);
2695 attr = qs_get_next_attr(doc,attr)) {
2700 name = qs_get_attr_name (doc,attr);
2701 value = qs_get_attr_value(doc,attr);
2706 if (strcasecmp(name, "name") == 0) {
2707 chtml10->out = apr_pstrcat(r->pool,
2718 if (strcasecmp(name, "rows") == 0) {
2719 chtml10->out = apr_pstrcat(r->pool,
2730 if (strcasecmp(name, "cols") == 0) {
2731 chtml10->out = apr_pstrcat(r->pool,
2745 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2747 return chtml10->out;
2752 * It is a handler who processes the TEXTAREA tag.
2754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2755 * destination is specified.
2756 * @param node [i] The TEXTAREA tag node is specified.
2757 * @return The conversion result is returned.
2760 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2766 chtml10 = GET_CHTML10(pdoc);
2770 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2771 chtml10->textarea_flag--;
2773 return chtml10->out;
2778 s_chtml10_text(void *pdoc, Node *child)
2790 chtml10 = GET_CHTML10(pdoc);
2794 textval = qs_get_node_value(doc,child);
2795 textval = qs_trim_string(r->pool, textval);
2797 if (strlen(textval) == 0)
2798 return chtml10->out;
2800 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2801 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2803 tdst = qs_alloc_zero_byte_string(r);
2804 memset(one_byte, 0, sizeof(one_byte));
2807 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2808 if (is_sjis_kanji(textval[ii])) {
2809 one_byte[0] = textval[ii+0];
2810 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2811 one_byte[0] = textval[ii+1];
2812 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2816 if (chtml10->pre_flag) {
2817 one_byte[0] = textval[ii+0];
2818 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2821 if (chtml10->textarea_flag) {
2822 one_byte[0] = textval[ii+0];
2823 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2826 if (textval[ii] != '\r' && textval[ii] != '\n') {
2827 one_byte[0] = textval[ii+0];
2828 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2832 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2834 return chtml10->out;
2840 * It is a handler who processes the DL tag.
2842 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2843 * destination is specified.
2844 * @param node [i] The DL tag node is specified.
2845 * @return The conversion result is returned.
2848 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
2854 chtml10 = GET_CHTML10(pdoc);
2858 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<dl>", NULL);
2860 return chtml10->out;
2865 * It is a handler who processes the DLtag.
2867 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2868 * destination is specified.
2869 * @param node [i] The DL tag node is specified.
2870 * @return The conversion result is returned.
2873 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
2879 chtml10 = GET_CHTML10(pdoc);
2883 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</dl>\n", NULL);
2885 return chtml10->out;
2890 * It is a handler who processes the DT tag.
2892 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2893 * destination is specified.
2894 * @param node [i] The DT tag node is specified.
2895 * @return The conversion result is returned.
2898 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
2904 chtml10 = GET_CHTML10(pdoc);
2908 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<dt>", NULL);
2910 return chtml10->out;
2915 * It is a handler who processes the DT tag.
2917 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2918 * destination is specified.
2919 * @param node [i] The DT tag node is specified.
2920 * @return The conversion result is returned.
2923 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
2929 chtml10 = GET_CHTML10(pdoc);
2933 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\n", NULL);
2935 return chtml10->out;
2940 * It is a handler who processes the DD tag.
2942 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2943 * destination is specified.
2944 * @param node [i] The DD tag node is specified.
2945 * @return The conversion result is returned.
2948 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
2954 chtml10 = GET_CHTML10(pdoc);
2958 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<dd>", NULL);
2960 return chtml10->out;
2965 * It is a handler who processes the DD tag.
2967 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2968 * destination is specified.
2969 * @param node [i] The DD tag node is specified.
2970 * @return The conversion result is returned.
2973 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
2979 chtml10 = GET_CHTML10(pdoc);
2983 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\n", NULL);
2985 return chtml10->out;