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);
88 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
90 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
91 static char *s_chtml10_text (void *pdoc, Node *node);
93 tag_handler chtml10_handler[] = {
96 s_chtml10_start_html_tag,
97 s_chtml10_end_html_tag,
101 s_chtml10_start_meta_tag,
102 s_chtml10_end_meta_tag,
106 s_chtml10_start_textarea_tag,
107 s_chtml10_end_textarea_tag,
111 s_chtml10_start_p_tag,
116 s_chtml10_start_pre_tag,
117 s_chtml10_end_pre_tag,
121 s_chtml10_start_ul_tag,
122 s_chtml10_end_ul_tag,
126 s_chtml10_start_li_tag,
127 s_chtml10_end_li_tag,
131 s_chtml10_start_ol_tag,
132 s_chtml10_end_ol_tag,
136 s_chtml10_start_h1_tag,
137 s_chtml10_end_h1_tag,
141 s_chtml10_start_h2_tag,
142 s_chtml10_end_h2_tag,
146 s_chtml10_start_h3_tag,
147 s_chtml10_end_h3_tag,
151 s_chtml10_start_h4_tag,
152 s_chtml10_end_h4_tag,
156 s_chtml10_start_h5_tag,
157 s_chtml10_end_h5_tag,
161 s_chtml10_start_h6_tag,
162 s_chtml10_end_h6_tag,
166 s_chtml10_start_head_tag,
167 s_chtml10_end_head_tag,
171 s_chtml10_start_title_tag,
172 s_chtml10_end_title_tag,
176 s_chtml10_start_base_tag,
177 s_chtml10_end_base_tag,
181 s_chtml10_start_body_tag,
182 s_chtml10_end_body_tag,
186 s_chtml10_start_a_tag,
191 s_chtml10_start_br_tag,
192 s_chtml10_end_br_tag,
201 s_chtml10_start_tr_tag,
202 s_chtml10_end_tr_tag,
216 s_chtml10_start_font_tag,
217 s_chtml10_end_font_tag,
221 s_chtml10_start_form_tag,
222 s_chtml10_end_form_tag,
226 s_chtml10_start_input_tag,
227 s_chtml10_end_input_tag,
231 s_chtml10_start_center_tag,
232 s_chtml10_end_center_tag,
236 s_chtml10_start_hr_tag,
237 s_chtml10_end_hr_tag,
241 s_chtml10_start_img_tag,
242 s_chtml10_end_img_tag,
246 s_chtml10_start_select_tag,
247 s_chtml10_end_select_tag,
251 s_chtml10_start_option_tag,
252 s_chtml10_end_option_tag,
256 s_chtml10_start_div_tag,
257 s_chtml10_end_div_tag,
261 s_chtml10_chxjif_tag,
323 * converts from CHTML5.0 to CHTML1.0.
325 * @param r [i] Requet_rec is appointed.
326 * @param spec [i] The result of the device specification processing which
327 * was done in advance is appointed.
328 * @param src [i] The character string before the converting is appointed.
329 * @return The character string after the converting is returned.
332 chxj_exchange_chtml10(
338 chxjconvrule_entry *entryp,
349 DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
351 /*--------------------------------------------------------------------------*/
353 /*--------------------------------------------------------------------------*/
355 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
357 DBG(r,"i found qrcode xml");
360 DBG(r,"not found qrcode xml");
362 /*--------------------------------------------------------------------------*/
363 /* The CHTML structure is initialized. */
364 /*--------------------------------------------------------------------------*/
365 s_init_chtml10(&chtml10, &doc, r, spec);
366 chtml10.entryp = entryp;
367 chtml10.cookie = cookie;
369 if (IS_SJIS_STRING(GET_SPEC_CHARSET(spec))) {
370 ap_set_content_type(r, "text/html; charset=Windows-31J");
373 ap_set_content_type(r, "text/html; charset=UTF-8");
376 /*--------------------------------------------------------------------------*/
377 /* The character string of the input is analyzed. */
378 /*--------------------------------------------------------------------------*/
379 qs_init_malloc(&doc);
380 qs_init_root_node(&doc);
382 ss = apr_pcalloc(r->pool, srclen + 1);
383 memset(ss, 0, srclen + 1);
384 memcpy(ss, src, srclen);
387 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
390 qs_parse_string(&doc,ss, strlen(ss));
392 /*--------------------------------------------------------------------------*/
393 /* It converts it from CHTML to CHTML. */
394 /*--------------------------------------------------------------------------*/
395 chxj_node_exchange(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
399 qs_all_free(&doc,QX_LOGMARK);
402 return apr_pstrdup(r->pool,ss);
404 if (strlen(dst) == 0) {
405 dst = apr_psprintf(r->pool, "\n");
407 *dstlen = strlen(dst);
410 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
413 DBG(r, "end chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
420 * The CHTML structure is initialized.
422 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
423 * initialized is specified.
424 * @param doc [i] The Doc structure that should be set to the initialized
425 * HDML structure is specified.
426 * @param r [i] To use POOL, the pointer to request_rec is specified.
427 * @param spec [i] The pointer to the device_table
436 memset(doc, 0, sizeof(Doc));
437 memset(chtml10, 0, sizeof(chtml10_t));
441 chtml10->spec = spec;
442 chtml10->out = qs_alloc_zero_byte_string(r);
443 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
444 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
449 * It is a handler who processes the HTML tag.
451 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
452 * destination is specified.
453 * @param node [i] The HTML tag node is specified.
454 * @return The conversion result is returned.
457 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
463 chtml10 = GET_CHTML10(pdoc);
467 /*--------------------------------------------------------------------------*/
469 /*--------------------------------------------------------------------------*/
470 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
477 * It is a handler who processes the HTML tag.
479 * @param pdoc [i/o] The pointer to the CHTML structure at the output
480 * destination is specified.
481 * @param node [i] The HTML tag node is specified.
482 * @return The conversion result is returned.
485 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
492 chtml10 = GET_CHTML10(pdoc);
496 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
503 * It is a handler who processes the META tag.
505 * @param pdoc [i/o] The pointer to the CHTML structure at the output
506 * destination is specified.
507 * @param node [i] The META tag node is specified.
508 * @return The conversion result is returned.
511 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
515 chtml10 = GET_CHTML10(pdoc);
524 * It is a handler who processes the META tag.
526 * @param pdoc [i/o] The pointer to the CHTML structure at the output
527 * destination is specified.
528 * @param node [i] The META tag node is specified.
529 * @return The conversion result is returned.
532 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
536 chtml10 = GET_CHTML10(pdoc);
543 * It is a handler who processes the HEAD tag.
545 * @param pdoc [i/o] The pointer to the CHTML structure at the output
546 * destination is specified.
547 * @param node [i] The HEAD tag node is specified.
548 * @return The conversion result is returned.
551 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
557 chtml10 = GET_CHTML10(pdoc);
561 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
568 * It is a handler who processes the HEAD tag.
570 * @param pdoc [i/o] The pointer to the CHTML structure at the output
571 * destination is specified.
572 * @param node [i] The HEAD tag node is specified.
573 * @return The conversion result is returned.
576 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
582 chtml10 = GET_CHTML10(pdoc);
586 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
593 * It is a handler who processes the OL tag.
595 * @param pdoc [i/o] The pointer to the CHTML structure at the output
596 * destination is specified.
597 * @param node [i] The OL tag node is specified.
598 * @return The conversion result is returned.
601 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
607 chtml10 = GET_CHTML10(pdoc);
611 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
618 * It is a handler who processes the OL tag.
620 * @param pdoc [i/o] The pointer to the CHTML structure at the output
621 * destination is specified.
622 * @param node [i] The OL tag node is specified.
623 * @return The conversion result is returned.
626 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
632 chtml10 = GET_CHTML10(pdoc);
636 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
643 * It is a handler who processes the UL tag.
645 * @param pdoc [i/o] The pointer to the CHTML structure at the output
646 * destination is specified.
647 * @param node [i] The UL tag node is specified.
648 * @return The conversion result is returned.
651 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
657 chtml10 = GET_CHTML10(pdoc);
661 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
668 * It is a handler who processes the UL tag.
670 * @param pdoc [i/o] The pointer to the CHTML structure at the output
671 * destination is specified.
672 * @param node [i] The UL tag node is specified.
673 * @return The conversion result is returned.
676 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
682 chtml10 = GET_CHTML10(pdoc);
686 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
693 * It is a handler who processes the LI tag.
695 * @param pdoc [i/o] The pointer to the CHTML structure at the output
696 * destination is specified.
697 * @param node [i] The LI tag node is specified.
698 * @return The conversion result is returned.
701 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
707 chtml10 = GET_CHTML10(pdoc);
711 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
718 * It is a handler who processes the LI tag.
720 * @param pdoc [i/o] The pointer to the CHTML structure at the output
721 * destination is specified.
722 * @param node [i] The LI tag node is specified.
723 * @return The conversion result is returned.
726 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
732 chtml10 = GET_CHTML10(pdoc);
736 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
743 * It is a handler who processes the H1 tag.
745 * @param pdoc [i/o] The pointer to the CHTML structure at the output
746 * destination is specified.
747 * @param node [i] The H1 tag node is specified.
748 * @return The conversion result is returned.
751 s_chtml10_start_h1_tag(void *pdoc, Node *UNUSED(node))
757 chtml10 = GET_CHTML10(pdoc);
761 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
768 * It is a handler who processes the H1 tag.
770 * @param pdoc [i/o] The pointer to the CHTML structure at the output
771 * destination is specified.
772 * @param node [i] The H1 tag node is specified.
773 * @return The conversion result is returned.
776 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
782 chtml10 = GET_CHTML10(pdoc);
786 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
793 * It is a handler who processes the H2 tag.
795 * @param pdoc [i/o] The pointer to the CHTML structure at the output
796 * destination is specified.
797 * @param node [i] The H2 tag node is specified.
798 * @return The conversion result is returned.
801 s_chtml10_start_h2_tag(void *pdoc, Node *UNUSED(node))
807 chtml10 = GET_CHTML10(pdoc);
811 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
818 * It is a handler who processes the H2 tag.
820 * @param pdoc [i/o] The pointer to the CHTML structure at the output
821 * destination is specified.
822 * @param node [i] The H2 tag node is specified.
823 * @return The conversion result is returned.
826 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
832 chtml10 = GET_CHTML10(pdoc);
836 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
843 * It is a handler who processes the H3 tag.
845 * @param pdoc [i/o] The pointer to the CHTML structure at the output
846 * destination is specified.
847 * @param node [i] The H3 tag node is specified.
848 * @return The conversion result is returned.
851 s_chtml10_start_h3_tag(void *pdoc, Node *UNUSED(node))
857 chtml10 = GET_CHTML10(pdoc);
861 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
868 * It is a handler who processes the H3 tag.
870 * @param pdoc [i/o] The pointer to the CHTML structure at the output
871 * destination is specified.
872 * @param node [i] The H3 tag node is specified.
873 * @return The conversion result is returned.
876 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
882 chtml10 = GET_CHTML10(pdoc);
886 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
893 * It is a handler who processes the H4 tag.
895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
896 * destination is specified.
897 * @param node [i] The H4 tag node is specified.
898 * @return The conversion result is returned.
901 s_chtml10_start_h4_tag(void *pdoc, Node *UNUSED(node))
907 chtml10 = GET_CHTML10(pdoc);
911 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
918 * It is a handler who processes the H4 tag.
920 * @param pdoc [i/o] The pointer to the CHTML structure at the output
921 * destination is specified.
922 * @param node [i] The H4 tag node is specified.
923 * @return The conversion result is returned.
926 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
932 chtml10 = GET_CHTML10(pdoc);
936 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
943 * It is a handler who processes the H5 tag.
945 * @param pdoc [i/o] The pointer to the CHTML structure at the output
946 * destination is specified.
947 * @param node [i] The H5 tag node is specified.
948 * @return The conversion result is returned.
951 s_chtml10_start_h5_tag(void *pdoc, Node *UNUSED(node))
957 chtml10 = GET_CHTML10(pdoc);
961 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
968 * It is a handler who processes the H5 tag.
970 * @param pdoc [i/o] The pointer to the CHTML structure at the output
971 * destination is specified.
972 * @param node [i] The H5 tag node is specified.
973 * @return The conversion result is returned.
976 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
982 chtml10 = GET_CHTML10(pdoc);
986 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
993 * It is a handler who processes the H6 tag.
995 * @param pdoc [i/o] The pointer to the CHTML structure at the output
996 * destination is specified.
997 * @param node [i] The H6 tag node is specified.
998 * @return The conversion result is returned.
1001 s_chtml10_start_h6_tag(void *pdoc, Node *UNUSED(node))
1007 chtml10 = GET_CHTML10(pdoc);
1011 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1013 return chtml10->out;
1018 * It is a handler who processes the H6 tag.
1020 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1021 * destination is specified.
1022 * @param node [i] The H6 tag node is specified.
1023 * @return The conversion result is returned.
1026 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1032 chtml10 = GET_CHTML10(pdoc);
1036 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1038 return chtml10->out;
1043 * It is a handler who processes the TITLE tag.
1045 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1046 * destination is specified.
1047 * @param node [i] The TITLE tag node is specified.
1048 * @return The conversion result is returned.
1051 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1057 chtml10 = GET_CHTML10(pdoc);
1061 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1063 return chtml10->out;
1068 * It is a handler who processes the TITLE tag.
1070 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1071 * destination is specified.
1072 * @param node [i] The TITLE tag node is specified.
1073 * @return The conversion result is returned.
1076 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1082 chtml10 = GET_CHTML10(pdoc);
1086 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1088 return chtml10->out;
1093 * It is a handler who processes the BASE tag.
1095 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1096 * destination is specified.
1097 * @param node [i] The BASE tag node is specified.
1098 * @return The conversion result is returned.
1101 s_chtml10_start_base_tag(void *pdoc, Node *node)
1108 chtml10 = GET_CHTML10(pdoc);
1113 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1115 /*--------------------------------------------------------------------------*/
1116 /* Get Attributes */
1117 /*--------------------------------------------------------------------------*/
1118 for (attr = qs_get_attr(doc,node);
1120 attr = qs_get_next_attr(doc,attr)) {
1124 name = qs_get_attr_name(doc,attr);
1125 value = qs_get_attr_value(doc,attr);
1127 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1128 chtml10->out = apr_pstrcat(r->pool,
1137 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1139 return chtml10->out;
1144 * It is a handler who processes the BASE tag.
1146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1147 * destination is specified.
1148 * @param node [i] The BASE tag node is specified.
1149 * @return The conversion result is returned.
1152 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1154 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1156 return chtml10->out;
1161 * It is a handler who processes the BODY tag.
1163 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1164 * destination is specified.
1165 * @param node [i] The BODY tag node is specified.
1166 * @return The conversion result is returned.
1169 s_chtml10_start_body_tag(void *pdoc, Node *node)
1176 chtml10 = GET_CHTML10(pdoc);
1180 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1182 /*--------------------------------------------------------------------------*/
1183 /* Get Attributes */
1184 /*--------------------------------------------------------------------------*/
1185 for (attr = qs_get_attr(doc,node);
1187 attr = qs_get_next_attr(doc,attr)) {
1191 name = qs_get_attr_name(doc,attr);
1196 if (strcasecmp(name, "alink") == 0) {
1197 /*----------------------------------------------------------------------*/
1199 /*----------------------------------------------------------------------*/
1206 if (strcasecmp(name, "bgcolor") == 0) {
1207 /*----------------------------------------------------------------------*/
1209 /*----------------------------------------------------------------------*/
1216 if (strcasecmp(name, "text") == 0) {
1217 /*----------------------------------------------------------------------*/
1219 /*----------------------------------------------------------------------*/
1226 if (strcasecmp(name, "link") == 0) {
1227 /*----------------------------------------------------------------------*/
1229 /*----------------------------------------------------------------------*/
1236 if (strcasecmp(name, "vlink") == 0) {
1237 /*----------------------------------------------------------------------*/
1239 /*----------------------------------------------------------------------*/
1249 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1251 return chtml10->out;
1256 * It is a handler who processes the BODY tag.
1258 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1259 * destination is specified.
1260 * @param node [i] The BODY tag node is specified.
1261 * @return The conversion result is returned.
1264 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1270 chtml10 = GET_CHTML10(pdoc);
1274 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1276 return chtml10->out;
1281 * It is a handler who processes the A tag.
1283 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1284 * destination is specified.
1285 * @param node [i] The A tag node is specified.
1286 * @return The conversion result is returned.
1289 s_chtml10_start_a_tag(void *pdoc, Node *node)
1296 chtml10 = GET_CHTML10(pdoc);
1300 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1302 /*--------------------------------------------------------------------------*/
1303 /* Get Attributes */
1304 /*--------------------------------------------------------------------------*/
1305 for (attr = qs_get_attr(doc,node);
1307 attr = qs_get_next_attr(doc,attr)) {
1312 name = qs_get_attr_name(doc,attr);
1313 value = qs_get_attr_value(doc,attr);
1318 if (strcasecmp(name, "name") == 0) {
1319 /*--------------------------------------------------------------------*/
1321 /*--------------------------------------------------------------------*/
1322 chtml10->out = apr_pstrcat(r->pool,
1333 if (strcasecmp(name, "href") == 0) {
1334 /*--------------------------------------------------------------------*/
1336 /*--------------------------------------------------------------------*/
1337 value = chxj_encoding_parameter(r, value);
1338 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1340 chtml10->out = apr_pstrcat(r->pool,
1351 if (strcasecmp(name, "accesskey") == 0) {
1352 /*--------------------------------------------------------------------*/
1354 /*--------------------------------------------------------------------*/
1355 chtml10->out = apr_pstrcat(r->pool,
1366 if (strcasecmp(name, "cti") == 0) {
1367 /*--------------------------------------------------------------------*/
1369 /*--------------------------------------------------------------------*/
1376 if (strcasecmp(name, "utn") == 0) {
1377 /*--------------------------------------------------------------------*/
1379 /*--------------------------------------------------------------------*/
1386 if (strcasecmp(name, "telbook") == 0) {
1387 /*--------------------------------------------------------------------*/
1389 /*--------------------------------------------------------------------*/
1396 if (strcasecmp(name, "kana") == 0) {
1397 /*--------------------------------------------------------------------*/
1399 /*--------------------------------------------------------------------*/
1406 if (strcasecmp(name, "email") == 0) {
1407 /*--------------------------------------------------------------------*/
1409 /*--------------------------------------------------------------------*/
1416 if (strcasecmp(name, "ista") == 0) {
1417 /*--------------------------------------------------------------------*/
1419 /*--------------------------------------------------------------------*/
1423 if (strcasecmp(name, "ilet") == 0) {
1424 /*--------------------------------------------------------------------*/
1426 /*--------------------------------------------------------------------*/
1430 if (strcasecmp(name, "iswf") == 0) {
1431 /*--------------------------------------------------------------------*/
1433 /*--------------------------------------------------------------------*/
1437 if (strcasecmp(name, "irst") == 0) {
1438 /*--------------------------------------------------------------------*/
1440 /*--------------------------------------------------------------------*/
1444 if (strcasecmp(name, "ijam") == 0) {
1445 /*--------------------------------------------------------------------*/
1447 /*--------------------------------------------------------------------*/
1457 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1459 return chtml10->out;
1464 * It is a handler who processes the A tag.
1466 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1467 * destination is specified.
1468 * @param node [i] The A tag node is specified.
1469 * @return The conversion result is returned.
1472 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1478 chtml10 = GET_CHTML10(pdoc);
1482 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1484 return chtml10->out;
1489 * It is a handler who processes the BR tag.
1491 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1492 * destination is specified.
1493 * @param node [i] The BR tag node is specified.
1494 * @return The conversion result is returned.
1497 s_chtml10_start_br_tag(void *pdoc, Node *UNUSED(node))
1503 chtml10 = GET_CHTML10(pdoc);
1507 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1509 return chtml10->out;
1514 * It is a handler who processes the BR tag.
1516 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1517 * destination is specified.
1518 * @param node [i] The BR tag node is specified.
1519 * @return The conversion result is returned.
1522 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1524 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1526 return chtml10->out;
1531 * It is a handler who processes the TR tag.
1533 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1534 * destination is specified.
1535 * @param node [i] The TR tag node is specified.
1536 * @return The conversion result is returned.
1539 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1541 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1543 return chtml10->out;
1548 * It is a handler who processes the TR tag.
1550 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1551 * destination is specified.
1552 * @param node [i] The TR tag node is specified.
1553 * @return The conversion result is returned.
1556 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1562 chtml10 = GET_CHTML10(pdoc);
1566 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1568 return chtml10->out;
1573 * It is a handler who processes the FONT tag.
1575 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1576 * destination is specified.
1577 * @param node [i] The FONT tag node is specified.
1578 * @return The conversion result is returned.
1581 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1583 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1587 return chtml10->out;
1592 * It is a handler who processes the FONT tag.
1594 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1595 * destination is specified.
1596 * @param node [i] The FONT tag node is specified.
1597 * @return The conversion result is returned.
1600 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1602 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1606 return chtml10->out;
1611 * It is a handler who processes the FORM tag.
1613 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1614 * destination is specified.
1615 * @param node [i] The FORM tag node is specified.
1616 * @return The conversion result is returned.
1619 s_chtml10_start_form_tag(void *pdoc, Node *node)
1626 chtml10 = GET_CHTML10(pdoc);
1630 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1632 /*--------------------------------------------------------------------------*/
1633 /* Get Attributes */
1634 /*--------------------------------------------------------------------------*/
1635 for (attr = qs_get_attr(doc,node);
1637 attr = qs_get_next_attr(doc,attr)) {
1641 name = qs_get_attr_name(doc,attr);
1642 value = qs_get_attr_value(doc,attr);
1647 if (strcasecmp(name, "action") == 0) {
1648 /*--------------------------------------------------------------------*/
1650 /*--------------------------------------------------------------------*/
1651 value = chxj_encoding_parameter(r, value);
1652 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1654 chtml10->out = apr_pstrcat(r->pool,
1665 if (strcasecmp(name, "method") == 0) {
1666 /*--------------------------------------------------------------------*/
1668 /*--------------------------------------------------------------------*/
1669 chtml10->out = apr_pstrcat(r->pool,
1680 if (strcasecmp(name, "utn") == 0) {
1681 /*--------------------------------------------------------------------*/
1683 /*--------------------------------------------------------------------*/
1693 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1695 return chtml10->out;
1700 * It is a handler who processes the FORM tag.
1702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1703 * destination is specified.
1704 * @param node [i] The FORM tag node is specified.
1705 * @return The conversion result is returned.
1708 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1714 chtml10 = GET_CHTML10(pdoc);
1718 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1720 return chtml10->out;
1725 * It is a handler who processes the INPUT tag.
1727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1728 * destination is specified.
1729 * @param node [i] The INPUT tag node is specified.
1730 * @return The conversion result is returned.
1733 s_chtml10_start_input_tag(void *pdoc, Node *node)
1747 chtml10 = GET_CHTML10(pdoc);
1760 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1762 /*--------------------------------------------------------------------------*/
1763 /* Get Attributes */
1764 /*--------------------------------------------------------------------------*/
1766 type = qs_get_type_attr(doc, node, r);
1767 name = qs_get_name_attr(doc, node, r);
1768 value = qs_get_value_attr(doc,node,r);
1769 istyle = qs_get_istyle_attr(doc,node,r);
1770 max_length = qs_get_maxlength_attr(doc,node,r);
1771 checked = qs_get_checked_attr(doc,node,r);
1772 accesskey = qs_get_accesskey_attr(doc, node, r);
1773 size = qs_get_size_attr(doc, node, r);
1776 chtml10->out = apr_pstrcat(r->pool,
1784 chtml10->out = apr_pstrcat(r->pool,
1792 chtml10->out = apr_pstrcat(r->pool,
1800 chtml10->out = apr_pstrcat(r->pool,
1808 chtml10->out = apr_pstrcat(r->pool,
1815 /*------------------------------------------------------------------------*/
1817 /*------------------------------------------------------------------------*/
1820 /*--------------------------------------------------------------------------*/
1821 /* The figure is default for the password. */
1822 /*--------------------------------------------------------------------------*/
1824 chtml10->out = apr_pstrcat(r->pool,
1832 chtml10->out = apr_pstrcat(r->pool,
1833 chtml10->out, " checked ", NULL);
1835 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1837 return chtml10->out;
1842 * It is a handler who processes the INPUT tag.
1844 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1845 * destination is specified.
1846 * @param node [i] The INPUT tag node is specified.
1847 * @return The conversion result is returned.
1850 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
1852 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1854 return chtml10->out;
1859 * It is a handler who processes the CENTER tag.
1861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1862 * destination is specified.
1863 * @param node [i] The CENTER tag node is specified.
1864 * @return The conversion result is returned.
1867 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
1873 chtml10 = GET_CHTML10(pdoc);
1877 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1879 return chtml10->out;
1884 * It is a handler who processes the CENTER tag.
1886 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1887 * destination is specified.
1888 * @param node [i] The CENTER tag node is specified.
1889 * @return The conversion result is returned.
1892 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
1898 chtml10 = GET_CHTML10(pdoc);
1902 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1904 return chtml10->out;
1909 * It is a handler who processes the HR tag.
1911 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1912 * destination is specified.
1913 * @param node [i] The HR tag node is specified.
1914 * @return The conversion result is returned.
1917 s_chtml10_start_hr_tag(void *pdoc, Node *node)
1924 chtml10 = GET_CHTML10(pdoc);
1928 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1930 for (attr = qs_get_attr(doc,node);
1932 attr = qs_get_next_attr(doc,attr)) {
1937 name = qs_get_attr_name (doc,attr);
1938 value = qs_get_attr_value(doc,attr);
1943 if (strcasecmp(name, "align") == 0) {
1944 /*--------------------------------------------------------------------*/
1946 /*--------------------------------------------------------------------*/
1947 chtml10->out = apr_pstrcat(r->pool,
1949 " align=\"", value, "\" ", NULL);
1955 if (strcasecmp(name, "size") == 0) {
1956 /*--------------------------------------------------------------------*/
1958 /*--------------------------------------------------------------------*/
1959 chtml10->out = apr_pstrcat(r->pool,
1961 " size=\"", value, "\" ", NULL);
1967 if (strcasecmp(name, "width") == 0) {
1968 /*--------------------------------------------------------------------*/
1970 /*--------------------------------------------------------------------*/
1971 chtml10->out = apr_pstrcat(r->pool,
1973 " width=\"", value, "\" ", NULL);
1979 if (strcasecmp(name, "noshade") == 0) {
1980 /*--------------------------------------------------------------------*/
1982 /*--------------------------------------------------------------------*/
1983 chtml10->out = apr_pstrcat(r->pool,
1991 if (strcasecmp(name, "color") == 0) {
1992 /*--------------------------------------------------------------------*/
1994 /*--------------------------------------------------------------------*/
2004 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2006 return chtml10->out;
2011 * It is a handler who processes the HR tag.
2013 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2014 * destination is specified.
2015 * @param node [i] The HR tag node is specified.
2016 * @return The conversion result is returned.
2019 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2023 chtml10 = GET_CHTML10(pdoc);
2025 return chtml10->out;
2030 * It is a handler who processes the IMG tag.
2032 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2033 * destination is specified.
2034 * @param node [i] The IMG tag node is specified.
2035 * @return The conversion result is returned.
2038 s_chtml10_start_img_tag(void *pdoc, Node *node)
2044 #ifndef IMG_NOT_CONVERT_FILENAME
2048 chtml10 = GET_CHTML10(pdoc);
2049 #ifndef IMG_NOT_CONVERT_FILENAME
2050 spec = chtml10->spec;
2055 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
2058 /*--------------------------------------------------------------------------*/
2059 /* Get Attributes */
2060 /*--------------------------------------------------------------------------*/
2061 for (attr = qs_get_attr(doc,node);
2063 attr = qs_get_next_attr(doc,attr)) {
2068 name = qs_get_attr_name (doc,attr);
2069 value = qs_get_attr_value(doc,attr);
2074 if (strcasecmp(name, "src") == 0) {
2075 /*--------------------------------------------------------------------*/
2077 /*--------------------------------------------------------------------*/
2078 #ifdef IMG_NOT_CONVERT_FILENAME
2079 value = chxj_encoding_parameter(r, value);
2080 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2082 value = apr_psprintf(r->pool,
2085 (strchr(value, '?')) ? '&' : '?',
2086 CHXJ_COOKIE_NOUPDATE_PARAM);
2088 chtml10->out = apr_pstrcat(r->pool,
2089 chtml10->out, " src=\"",value,"\"", NULL);
2091 value = chxj_img_conv(r, spec, value);
2092 value = chxj_encoding_parameter(r, value);
2093 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2095 value = apr_psprintf(r->pool,
2098 (strchr(value, '?')) ? '&' : '?',
2099 CHXJ_COOKIE_NOUPDATE_PARAM);
2101 chtml10->out = apr_pstrcat(r->pool,
2102 chtml10->out, " src=\"",
2105 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2112 if (strcasecmp(name, "align" ) == 0) {
2113 /*--------------------------------------------------------------------*/
2115 /*--------------------------------------------------------------------*/
2116 /*--------------------------------------------------------------------*/
2118 /*--------------------------------------------------------------------*/
2119 chtml10->out = apr_pstrcat(r->pool,
2120 chtml10->out, " align=\"",value,"\"", NULL);
2123 if (strcasecmp(name, "alt" ) == 0) {
2124 /*--------------------------------------------------------------------*/
2126 /*--------------------------------------------------------------------*/
2127 chtml10->out = apr_pstrcat(r->pool,
2128 chtml10->out, " alt=\"",value,"\"", NULL);
2134 if (strcasecmp(name, "width" ) == 0) {
2135 /*--------------------------------------------------------------------*/
2137 /*--------------------------------------------------------------------*/
2138 chtml10->out = apr_pstrcat(r->pool,
2139 chtml10->out, " width=\"",value,"\"", NULL);
2145 if (strcasecmp(name, "height") == 0) {
2146 /*--------------------------------------------------------------------*/
2148 /*--------------------------------------------------------------------*/
2149 chtml10->out = apr_pstrcat(r->pool,
2150 chtml10->out, " height=\"",value,"\"", NULL);
2153 if (strcasecmp(name, "hspace") == 0) {
2154 /*--------------------------------------------------------------------*/
2156 /*--------------------------------------------------------------------*/
2157 chtml10->out = apr_pstrcat(r->pool,
2158 chtml10->out, " hspace=\"",value,"\"", NULL);
2164 if (strcasecmp(name, "vspace") == 0) {
2165 /*--------------------------------------------------------------------*/
2167 /*--------------------------------------------------------------------*/
2168 chtml10->out = apr_pstrcat(r->pool,
2169 chtml10->out, " vspace=\"",value,"\"", NULL);
2178 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2180 return chtml10->out;
2185 * It is a handler who processes the IMG tag.
2187 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2188 * destination is specified.
2189 * @param node [i] The IMG tag node is specified.
2190 * @return The conversion result is returned.
2193 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2197 chtml10 = GET_CHTML10(pdoc);
2199 return chtml10->out;
2204 * It is a handler who processes the SELECT tag.
2206 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2207 * destination is specified.
2208 * @param node [i] The SELECT tag node is specified.
2209 * @return The conversion result is returned.
2212 s_chtml10_start_select_tag(void *pdoc, Node *child)
2222 chtml10 = GET_CHTML10(pdoc);
2229 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2230 for (attr = qs_get_attr(doc,child);
2232 attr = qs_get_next_attr(doc,attr)) {
2236 nm = qs_get_attr_name (doc,attr);
2237 val = qs_get_attr_value(doc,attr);
2242 if (strcasecmp(nm, "size") == 0) {
2243 /*--------------------------------------------------------------------*/
2244 /* CHTML 1.0 version 2.0 */
2245 /*--------------------------------------------------------------------*/
2246 size = apr_pstrdup(r->pool, val);
2252 if (strcasecmp(nm, "name") == 0) {
2253 /*--------------------------------------------------------------------*/
2254 /* CHTML 1.0 version 2.0 */
2255 /*--------------------------------------------------------------------*/
2256 name = apr_pstrdup(r->pool, val);
2262 if (strcasecmp(nm, "multiple") == 0) {
2263 /*--------------------------------------------------------------------*/
2264 /* CHTML 1.0 version 2.0 */
2265 /*--------------------------------------------------------------------*/
2276 chtml10->out = apr_pstrcat(r->pool,
2284 chtml10->out = apr_pstrcat(r->pool,
2291 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2293 return chtml10->out;
2298 * It is a handler who processes the SELECT tag.
2300 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2301 * destination is specified.
2302 * @param node [i] The SELECT tag node is specified.
2303 * @return The conversion result is returned.
2306 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2312 chtml10 = GET_CHTML10(pdoc);
2316 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2318 return chtml10->out;
2323 * It is a handler who processes the OPTION tag.
2325 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2326 * destination is specified.
2327 * @param node [i] The OPTION tag node is specified.
2328 * @return The conversion result is returned.
2331 s_chtml10_start_option_tag(void *pdoc, Node *child)
2341 chtml10 = GET_CHTML10(pdoc);
2348 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2349 for (attr = qs_get_attr(doc,child);
2351 attr = qs_get_next_attr(doc,attr)) {
2355 nm = qs_get_attr_name (doc,attr);
2356 val = qs_get_attr_value(doc,attr);
2361 if (strcasecmp(nm, "selected") == 0) {
2362 /*--------------------------------------------------------------------*/
2363 /* CHTML 1.0 version 2.0 */
2364 /*--------------------------------------------------------------------*/
2365 selected = apr_pstrdup(r->pool, val);
2371 if (strcasecmp(nm, "value") == 0) {
2372 /*--------------------------------------------------------------------*/
2373 /* CHTML 1.0 version 2.0 */
2374 /*--------------------------------------------------------------------*/
2375 value = apr_pstrdup(r->pool, val);
2385 chtml10->out = apr_pstrcat(r->pool,
2392 chtml10->out = apr_pstrcat(r->pool,
2398 chtml10->out = apr_pstrcat(r->pool,
2403 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2405 return chtml10->out;
2410 * It is a handler who processes the OPTION tag.
2412 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2413 * destination is specified.
2414 * @param node [i] The OPTION tag node is specified.
2415 * @return The conversion result is returned.
2418 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2422 chtml10 = GET_CHTML10(pdoc);
2426 return chtml10->out;
2431 * It is a handler who processes the DIV tag.
2433 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2434 * destination is specified.
2435 * @param node [i] The DIV tag node is specified.
2436 * @return The conversion result is returned.
2439 s_chtml10_start_div_tag(void *pdoc, Node *child)
2447 chtml10 = GET_CHTML10(pdoc);
2453 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2454 for (attr = qs_get_attr(doc,child);
2456 attr = qs_get_next_attr(doc,attr)) {
2461 nm = qs_get_attr_name(doc,attr);
2462 val = qs_get_attr_value(doc,attr);
2464 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2465 /*----------------------------------------------------------------------*/
2466 /* CHTML 1.0 (W3C version 3.2) */
2467 /*----------------------------------------------------------------------*/
2468 align = apr_pstrdup(r->pool, val);
2473 chtml10->out = apr_pstrcat(r->pool,
2474 chtml10->out, " align=\"", align, "\"", NULL);
2476 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2478 return chtml10->out;
2483 * It is a handler who processes the DIV tag.
2485 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2486 * destination is specified.
2487 * @param node [i] The DIV tag node is specified.
2488 * @return The conversion result is returned.
2491 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2497 chtml10 = GET_CHTML10(pdoc);
2501 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2503 return chtml10->out;
2508 * It is a handler who processes the CHXJ:IF tag.
2510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2511 * destination is specified.
2512 * @param node [i] The CHXJ:IF tag node is specified.
2513 * @return The conversion result is returned.
2516 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2523 chtml10 = GET_CHTML10(pdoc);
2527 for (child = qs_get_child_node(doc, node);
2529 child = qs_get_next_node(doc, child)) {
2530 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2531 s_chtml10_chxjif_tag(chtml10, child);
2534 return chtml10->out;
2539 * It is a handler who processes the PRE tag.
2541 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2542 * destination is specified.
2543 * @param node [i] The PRE tag node is specified.
2544 * @return The conversion result is returned.
2547 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2553 chtml10 = GET_CHTML10(pdoc);
2557 chtml10->pre_flag++;
2558 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2560 return chtml10->out;
2565 * It is a handler who processes the PRE tag.
2567 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2568 * destination is specified.
2569 * @param node [i] The PRE tag node is specified.
2570 * @return The conversion result is returned.
2573 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2579 chtml10 = GET_CHTML10(pdoc);
2583 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2584 chtml10->pre_flag--;
2586 return chtml10->out;
2591 * It is a handler who processes the P tag.
2593 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2594 * destination is specified.
2595 * @param node [i] The P tag node is specified.
2596 * @return The conversion result is returned.
2599 s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
2605 chtml10 = GET_CHTML10(pdoc);
2609 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2611 return chtml10->out;
2616 * It is a handler who processes the P tag.
2618 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2619 * destination is specified.
2620 * @param node [i] The P tag node is specified.
2621 * @return The conversion result is returned.
2624 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2630 chtml10 = GET_CHTML10(pdoc);
2634 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2636 return chtml10->out;
2641 * It is a handler who processes the TEXTARE tag.
2643 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2644 * destination is specified.
2645 * @param node [i] The TEXTAREA tag node is specified.
2646 * @return The conversion result is returned.
2649 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2656 chtml10 = GET_CHTML10(pdoc);
2661 chtml10->textarea_flag++;
2662 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2664 for (attr = qs_get_attr(doc,node);
2666 attr = qs_get_next_attr(doc,attr)) {
2671 name = qs_get_attr_name (doc,attr);
2672 value = qs_get_attr_value(doc,attr);
2677 if (strcasecmp(name, "name") == 0) {
2678 chtml10->out = apr_pstrcat(r->pool,
2689 if (strcasecmp(name, "rows") == 0) {
2690 chtml10->out = apr_pstrcat(r->pool,
2701 if (strcasecmp(name, "cols") == 0) {
2702 chtml10->out = apr_pstrcat(r->pool,
2716 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2718 return chtml10->out;
2723 * It is a handler who processes the TEXTAREA tag.
2725 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2726 * destination is specified.
2727 * @param node [i] The TEXTAREA tag node is specified.
2728 * @return The conversion result is returned.
2731 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2737 chtml10 = GET_CHTML10(pdoc);
2741 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2742 chtml10->textarea_flag--;
2744 return chtml10->out;
2749 s_chtml10_text(void *pdoc, Node *child)
2761 chtml10 = GET_CHTML10(pdoc);
2765 textval = qs_get_node_value(doc,child);
2766 textval = qs_trim_string(r->pool, textval);
2768 if (strlen(textval) == 0)
2769 return chtml10->out;
2771 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2772 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2774 tdst = qs_alloc_zero_byte_string(r);
2775 memset(one_byte, 0, sizeof(one_byte));
2778 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2779 if (is_sjis_kanji(textval[ii])) {
2780 one_byte[0] = textval[ii+0];
2781 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2782 one_byte[0] = textval[ii+1];
2783 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2787 if (chtml10->pre_flag) {
2788 one_byte[0] = textval[ii+0];
2789 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2792 if (chtml10->textarea_flag) {
2793 one_byte[0] = textval[ii+0];
2794 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2797 if (textval[ii] != '\r' && textval[ii] != '\n') {
2798 one_byte[0] = textval[ii+0];
2799 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2803 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2805 return chtml10->out;