2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_chtml10.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_cookie.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
28 #define GET_CHTML10(X) ((chtml10_t *)(X))
31 #define W_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml10->conf); W_V(nlcode); } while (0)
38 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
39 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
40 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
41 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
42 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
43 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
44 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
45 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
46 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
47 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
48 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
49 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
50 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
51 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
52 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
53 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
54 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
55 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
56 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
57 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
58 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
59 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
60 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
61 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
62 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
63 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
64 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
65 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
66 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
67 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
68 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
69 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
70 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
71 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
72 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
73 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
74 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
75 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
76 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
77 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
78 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
79 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
80 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
81 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
82 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
83 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
84 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
85 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
86 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
87 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
88 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
89 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
90 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
91 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
92 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
93 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
94 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
95 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
96 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
97 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
98 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
99 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
100 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
101 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
102 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
103 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
104 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
105 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
106 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
107 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
108 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
109 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
110 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
111 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
112 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
113 static char *s_chtml10_newline_mark (void *pdoc, Node *node);
115 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
117 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
118 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
119 static char *s_chtml10_text (void *pdoc, Node *node);
121 tag_handler chtml10_handler[] = {
124 s_chtml10_start_html_tag,
125 s_chtml10_end_html_tag,
129 s_chtml10_start_meta_tag,
130 s_chtml10_end_meta_tag,
134 s_chtml10_start_textarea_tag,
135 s_chtml10_end_textarea_tag,
139 s_chtml10_start_p_tag,
144 s_chtml10_start_pre_tag,
145 s_chtml10_end_pre_tag,
149 s_chtml10_start_ul_tag,
150 s_chtml10_end_ul_tag,
154 s_chtml10_start_li_tag,
155 s_chtml10_end_li_tag,
159 s_chtml10_start_ol_tag,
160 s_chtml10_end_ol_tag,
164 s_chtml10_start_h1_tag,
165 s_chtml10_end_h1_tag,
169 s_chtml10_start_h2_tag,
170 s_chtml10_end_h2_tag,
174 s_chtml10_start_h3_tag,
175 s_chtml10_end_h3_tag,
179 s_chtml10_start_h4_tag,
180 s_chtml10_end_h4_tag,
184 s_chtml10_start_h5_tag,
185 s_chtml10_end_h5_tag,
189 s_chtml10_start_h6_tag,
190 s_chtml10_end_h6_tag,
194 s_chtml10_start_head_tag,
195 s_chtml10_end_head_tag,
199 s_chtml10_start_title_tag,
200 s_chtml10_end_title_tag,
204 s_chtml10_start_base_tag,
205 s_chtml10_end_base_tag,
209 s_chtml10_start_body_tag,
210 s_chtml10_end_body_tag,
214 s_chtml10_start_a_tag,
219 s_chtml10_start_br_tag,
220 s_chtml10_end_br_tag,
229 s_chtml10_start_tr_tag,
230 s_chtml10_end_tr_tag,
244 s_chtml10_start_font_tag,
245 s_chtml10_end_font_tag,
249 s_chtml10_start_form_tag,
250 s_chtml10_end_form_tag,
254 s_chtml10_start_input_tag,
255 s_chtml10_end_input_tag,
259 s_chtml10_start_center_tag,
260 s_chtml10_end_center_tag,
264 s_chtml10_start_hr_tag,
265 s_chtml10_end_hr_tag,
269 s_chtml10_start_img_tag,
270 s_chtml10_end_img_tag,
274 s_chtml10_start_select_tag,
275 s_chtml10_end_select_tag,
279 s_chtml10_start_option_tag,
280 s_chtml10_end_option_tag,
284 s_chtml10_start_div_tag,
285 s_chtml10_end_div_tag,
289 s_chtml10_chxjif_tag,
334 s_chtml10_start_dt_tag,
335 s_chtml10_end_dt_tag,
349 s_chtml10_start_blockquote_tag,
350 s_chtml10_end_blockquote_tag,
354 s_chtml10_start_dir_tag,
355 s_chtml10_end_dir_tag,
359 s_chtml10_start_dl_tag,
360 s_chtml10_end_dl_tag,
364 s_chtml10_start_dd_tag,
365 s_chtml10_end_dd_tag,
369 s_chtml10_start_menu_tag,
370 s_chtml10_end_menu_tag,
374 s_chtml10_start_plaintext_tag,
375 s_chtml10_end_plaintext_tag,
389 s_chtml10_newline_mark,
396 * converts from CHTML5.0 to CHTML1.0.
398 * @param r [i] Requet_rec is appointed.
399 * @param spec [i] The result of the device specification processing which
400 * was done in advance is appointed.
401 * @param src [i] The character string before the converting is appointed.
402 * @return The character string after the converting is returned.
405 chxj_convert_chtml10(
411 chxjconvrule_entry *entryp,
424 DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
426 /*--------------------------------------------------------------------------*/
428 /*--------------------------------------------------------------------------*/
430 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
432 DBG(r,"i found qrcode xml");
435 DBG(r,"not found qrcode xml");
437 /*--------------------------------------------------------------------------*/
438 /* The CHTML structure is initialized. */
439 /*--------------------------------------------------------------------------*/
440 s_init_chtml10(&chtml10, &doc, r, spec);
441 chtml10.entryp = entryp;
442 chtml10.cookie = cookie;
444 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
446 /*--------------------------------------------------------------------------*/
447 /* The character string of the input is analyzed. */
448 /*--------------------------------------------------------------------------*/
449 qs_init_malloc(&doc);
450 qs_init_root_node(&doc);
452 ss = apr_pcalloc(r->pool, srclen + 1);
453 memset(ss, 0, srclen + 1);
454 memcpy(ss, src, srclen);
457 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
460 qs_parse_string(&doc,ss, strlen(ss));
462 chxj_buffered_write_init(r->pool, &doc.buf);
463 /*--------------------------------------------------------------------------*/
464 /* It converts it from CHTML to CHTML. */
465 /*--------------------------------------------------------------------------*/
466 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
467 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
468 dst = apr_pstrdup(r->pool, chtml10.out);
469 chxj_buffered_write_terminate(&doc.buf);
471 qs_all_free(&doc,QX_LOGMARK);
474 return apr_pstrdup(r->pool,ss);
477 if (strlen(dst) == 0) {
478 dst = apr_psprintf(r->pool, "\n");
480 *dstlen = strlen(dst);
483 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
486 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
493 * The CHTML structure is initialized.
495 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
496 * initialized is specified.
497 * @param doc [i] The Doc structure that should be set to the initialized
498 * HDML structure is specified.
499 * @param r [i] To use POOL, the pointer to request_rec is specified.
500 * @param spec [i] The pointer to the device_table
509 memset(doc, 0, sizeof(Doc));
510 memset(chtml10, 0, sizeof(chtml10_t));
514 chtml10->spec = spec;
515 chtml10->out = qs_alloc_zero_byte_string(r->pool);
516 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
517 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
522 * Corresponding EMOJI to a current character-code is retrieved.
523 * The substitution character string is stored in the rslt pointer if agreeing.
525 * @param chtml10 [i] The pointer to the CHTML structure is specified.
526 * @param txt [i] The character string to want to examine whether it is
527 * EMOJI is specified.
528 * @param rslt [o] The pointer to the pointer that stores the result is
530 * @return When corresponding EMOJI exists, it returns it excluding 0.
533 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
540 spec = chtml10->spec;
546 DBG(r,"spec is NULL");
549 for (ee = chtml10->conf->emoji;
554 DBG(r,"emoji->imode is NULL");
558 if (ee->imode->string
560 && strlen(ee->imode->string) > 0
561 && *ee->imode->string == *txt
562 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
563 if (!spec || !spec->emoji_type) {
564 *rslt = apr_palloc(r->pool, 3);
565 (*rslt)[0] = ee->imode->hex1byte & 0xff;
566 (*rslt)[1] = ee->imode->hex2byte & 0xff;
568 return strlen(ee->imode->string);
579 * It is a handler who processes the HTML tag.
581 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
582 * destination is specified.
583 * @param node [i] The HTML tag node is specified.
584 * @return The conversion result is returned.
587 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
593 chtml10 = GET_CHTML10(pdoc);
597 /*--------------------------------------------------------------------------*/
599 /*--------------------------------------------------------------------------*/
606 * It is a handler who processes the HTML tag.
608 * @param pdoc [i/o] The pointer to the CHTML structure at the output
609 * destination is specified.
610 * @param node [i] The HTML tag node is specified.
611 * @return The conversion result is returned.
614 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
621 chtml10 = GET_CHTML10(pdoc);
631 * It is a handler who processes the META tag.
633 * @param pdoc [i/o] The pointer to the CHTML structure at the output
634 * destination is specified.
635 * @param node [i] The META tag node is specified.
636 * @return The conversion result is returned.
639 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
641 chtml10_t *chtml10 = GET_CHTML10(pdoc);
650 * It is a handler who processes the META tag.
652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
653 * destination is specified.
654 * @param node [i] The META tag node is specified.
655 * @return The conversion result is returned.
658 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
660 chtml10_t *chtml10 = GET_CHTML10(pdoc);
667 * It is a handler who processes the HEAD tag.
669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
670 * destination is specified.
671 * @param node [i] The HEAD tag node is specified.
672 * @return The conversion result is returned.
675 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
681 chtml10 = GET_CHTML10(pdoc);
692 * It is a handler who processes the HEAD tag.
694 * @param pdoc [i/o] The pointer to the CHTML structure at the output
695 * destination is specified.
696 * @param node [i] The HEAD tag node is specified.
697 * @return The conversion result is returned.
700 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
706 chtml10 = GET_CHTML10(pdoc);
717 * It is a handler who processes the OL tag.
719 * @param pdoc [i/o] The pointer to the CHTML structure at the output
720 * destination is specified.
721 * @param node [i] The OL tag node is specified.
722 * @return The conversion result is returned.
725 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
731 chtml10 = GET_CHTML10(pdoc);
742 * It is a handler who processes the OL tag.
744 * @param pdoc [i/o] The pointer to the CHTML structure at the output
745 * destination is specified.
746 * @param node [i] The OL tag node is specified.
747 * @return The conversion result is returned.
750 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
756 chtml10 = GET_CHTML10(pdoc);
767 * It is a handler who processes the UL tag.
769 * @param pdoc [i/o] The pointer to the CHTML structure at the output
770 * destination is specified.
771 * @param node [i] The UL tag node is specified.
772 * @return The conversion result is returned.
775 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
781 chtml10 = GET_CHTML10(pdoc);
792 * It is a handler who processes the UL tag.
794 * @param pdoc [i/o] The pointer to the CHTML structure at the output
795 * destination is specified.
796 * @param node [i] The UL tag node is specified.
797 * @return The conversion result is returned.
800 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
806 chtml10 = GET_CHTML10(pdoc);
817 * It is a handler who processes the LI tag.
819 * @param pdoc [i/o] The pointer to the CHTML structure at the output
820 * destination is specified.
821 * @param node [i] The LI tag node is specified.
822 * @return The conversion result is returned.
825 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
831 chtml10 = GET_CHTML10(pdoc);
842 * It is a handler who processes the LI tag.
844 * @param pdoc [i/o] The pointer to the CHTML structure at the output
845 * destination is specified.
846 * @param node [i] The LI tag node is specified.
847 * @return The conversion result is returned.
850 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
852 chtml10_t *chtml10 = GET_CHTML10(pdoc);
858 * It is a handler who processes the H1 tag.
860 * @param pdoc [i/o] The pointer to the CHTML structure at the output
861 * destination is specified.
862 * @param node [i] The H1 tag node is specified.
863 * @return The conversion result is returned.
866 s_chtml10_start_h1_tag(void *pdoc, Node *node)
873 chtml10 = GET_CHTML10(pdoc);
878 for (attr = qs_get_attr(doc,node);
880 attr = qs_get_next_attr(doc,attr)) {
881 char *name = qs_get_attr_name(doc,attr);
882 char *value = qs_get_attr_value(doc,attr);
883 if (STRCASEEQ('a','A',"align", name)) {
884 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
899 * It is a handler who processes the H1 tag.
901 * @param pdoc [i/o] The pointer to the CHTML structure at the output
902 * destination is specified.
903 * @param node [i] The H1 tag node is specified.
904 * @return The conversion result is returned.
907 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
913 chtml10 = GET_CHTML10(pdoc);
924 * It is a handler who processes the H2 tag.
926 * @param pdoc [i/o] The pointer to the CHTML structure at the output
927 * destination is specified.
928 * @param node [i] The H2 tag node is specified.
929 * @return The conversion result is returned.
932 s_chtml10_start_h2_tag(void *pdoc, Node *node)
938 chtml10 = GET_CHTML10(pdoc);
942 for (attr = qs_get_attr(doc,node);
944 attr = qs_get_next_attr(doc,attr)) {
945 char *name = qs_get_attr_name(doc,attr);
946 char *value = qs_get_attr_value(doc,attr);
947 if (STRCASEEQ('a','A',"align", name)) {
948 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
963 * It is a handler who processes the H2 tag.
965 * @param pdoc [i/o] The pointer to the CHTML structure at the output
966 * destination is specified.
967 * @param node [i] The H2 tag node is specified.
968 * @return The conversion result is returned.
971 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
977 chtml10 = GET_CHTML10(pdoc);
988 * It is a handler who processes the H3 tag.
990 * @param pdoc [i/o] The pointer to the CHTML structure at the output
991 * destination is specified.
992 * @param node [i] The H3 tag node is specified.
993 * @return The conversion result is returned.
996 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1003 chtml10 = GET_CHTML10(pdoc);
1008 for (attr = qs_get_attr(doc,node);
1010 attr = qs_get_next_attr(doc,attr)) {
1011 char *name = qs_get_attr_name(doc,attr);
1012 char *value = qs_get_attr_value(doc,attr);
1013 if (STRCASEEQ('a','A',"align", name)) {
1014 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1024 return chtml10->out;
1029 * It is a handler who processes the H3 tag.
1031 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1032 * destination is specified.
1033 * @param node [i] The H3 tag node is specified.
1034 * @return The conversion result is returned.
1037 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1043 chtml10 = GET_CHTML10(pdoc);
1049 return chtml10->out;
1054 * It is a handler who processes the H4 tag.
1056 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1057 * destination is specified.
1058 * @param node [i] The H4 tag node is specified.
1059 * @return The conversion result is returned.
1062 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1068 chtml10 = GET_CHTML10(pdoc);
1072 for (attr = qs_get_attr(doc,node);
1074 attr = qs_get_next_attr(doc,attr)) {
1075 char *name = qs_get_attr_name(doc,attr);
1076 char *value = qs_get_attr_value(doc,attr);
1077 if (STRCASEEQ('a','A',"align", name)) {
1078 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1088 return chtml10->out;
1093 * It is a handler who processes the H4 tag.
1095 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1096 * destination is specified.
1097 * @param node [i] The H4 tag node is specified.
1098 * @return The conversion result is returned.
1101 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1106 chtml10 = GET_CHTML10(pdoc);
1111 return chtml10->out;
1116 * It is a handler who processes the H5 tag.
1118 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1119 * destination is specified.
1120 * @param node [i] The H5 tag node is specified.
1121 * @return The conversion result is returned.
1124 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1131 chtml10 = GET_CHTML10(pdoc);
1136 for (attr = qs_get_attr(doc,node);
1138 attr = qs_get_next_attr(doc,attr)) {
1139 char *name = qs_get_attr_name(doc,attr);
1140 char *value = qs_get_attr_value(doc,attr);
1141 if (STRCASEEQ('a','A',"align", name)) {
1142 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1152 return chtml10->out;
1157 * It is a handler who processes the H5 tag.
1159 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1160 * destination is specified.
1161 * @param node [i] The H5 tag node is specified.
1162 * @return The conversion result is returned.
1165 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1170 chtml10 = GET_CHTML10(pdoc);
1175 return chtml10->out;
1180 * It is a handler who processes the H6 tag.
1182 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1183 * destination is specified.
1184 * @param node [i] The H6 tag node is specified.
1185 * @return The conversion result is returned.
1188 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1194 chtml10 = GET_CHTML10(pdoc);
1198 for (attr = qs_get_attr(doc,node);
1200 attr = qs_get_next_attr(doc,attr)) {
1201 char *name = qs_get_attr_name(doc,attr);
1202 char *value = qs_get_attr_value(doc,attr);
1203 if (STRCASEEQ('a','A',"align", name)) {
1204 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1214 return chtml10->out;
1219 * It is a handler who processes the H6 tag.
1221 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1222 * destination is specified.
1223 * @param node [i] The H6 tag node is specified.
1224 * @return The conversion result is returned.
1227 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1232 chtml10 = GET_CHTML10(pdoc);
1237 return chtml10->out;
1242 * It is a handler who processes the TITLE tag.
1244 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1245 * destination is specified.
1246 * @param node [i] The TITLE tag node is specified.
1247 * @return The conversion result is returned.
1250 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1255 chtml10 = GET_CHTML10(pdoc);
1260 return chtml10->out;
1265 * It is a handler who processes the TITLE tag.
1267 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1268 * destination is specified.
1269 * @param node [i] The TITLE tag node is specified.
1270 * @return The conversion result is returned.
1273 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1278 chtml10 = GET_CHTML10(pdoc);
1283 return chtml10->out;
1288 * It is a handler who processes the BASE tag.
1290 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1291 * destination is specified.
1292 * @param node [i] The BASE tag node is specified.
1293 * @return The conversion result is returned.
1296 s_chtml10_start_base_tag(void *pdoc, Node *node)
1302 chtml10 = GET_CHTML10(pdoc);
1306 /*--------------------------------------------------------------------------*/
1307 /* Get Attributes */
1308 /*--------------------------------------------------------------------------*/
1309 for (attr = qs_get_attr(doc,node);
1311 attr = qs_get_next_attr(doc,attr)) {
1312 char *name = qs_get_attr_name(doc,attr);
1313 char *value = qs_get_attr_value(doc,attr);
1314 if (STRCASEEQ('h','H',"href", name)) {
1323 return chtml10->out;
1328 * It is a handler who processes the BASE tag.
1330 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1331 * destination is specified.
1332 * @param node [i] The BASE tag node is specified.
1333 * @return The conversion result is returned.
1336 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1338 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1340 return chtml10->out;
1345 * It is a handler who processes the BODY tag.
1347 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1348 * destination is specified.
1349 * @param node [i] The BODY tag node is specified.
1350 * @return The conversion result is returned.
1353 s_chtml10_start_body_tag(void *pdoc, Node *node)
1359 chtml10 = GET_CHTML10(pdoc);
1363 /*--------------------------------------------------------------------------*/
1364 /* Get Attributes */
1365 /*--------------------------------------------------------------------------*/
1366 for (attr = qs_get_attr(doc,node);
1368 attr = qs_get_next_attr(doc,attr)) {
1369 char *name = qs_get_attr_name(doc,attr);
1373 if (strcasecmp(name, "alink") == 0) {
1374 /*----------------------------------------------------------------------*/
1376 /*----------------------------------------------------------------------*/
1383 if (strcasecmp(name, "bgcolor") == 0) {
1384 /*----------------------------------------------------------------------*/
1386 /*----------------------------------------------------------------------*/
1393 if (strcasecmp(name, "text") == 0) {
1394 /*----------------------------------------------------------------------*/
1396 /*----------------------------------------------------------------------*/
1403 if (strcasecmp(name, "link") == 0) {
1404 /*----------------------------------------------------------------------*/
1406 /*----------------------------------------------------------------------*/
1413 if (strcasecmp(name, "vlink") == 0) {
1414 /*----------------------------------------------------------------------*/
1416 /*----------------------------------------------------------------------*/
1428 return chtml10->out;
1433 * It is a handler who processes the BODY tag.
1435 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1436 * destination is specified.
1437 * @param node [i] The BODY tag node is specified.
1438 * @return The conversion result is returned.
1441 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1446 chtml10 = GET_CHTML10(pdoc);
1451 return chtml10->out;
1456 * It is a handler who processes the A tag.
1458 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1459 * destination is specified.
1460 * @param node [i] The A tag node is specified.
1461 * @return The conversion result is returned.
1464 s_chtml10_start_a_tag(void *pdoc, Node *node)
1471 chtml10 = GET_CHTML10(pdoc);
1477 /*--------------------------------------------------------------------------*/
1478 /* Get Attributes */
1479 /*--------------------------------------------------------------------------*/
1480 for (attr = qs_get_attr(doc,node);
1482 attr = qs_get_next_attr(doc,attr)) {
1483 char *name = qs_get_attr_name(doc,attr);
1484 char *value = qs_get_attr_value(doc,attr);
1488 if (strcasecmp(name, "name") == 0) {
1489 /*--------------------------------------------------------------------*/
1491 /*--------------------------------------------------------------------*/
1500 if (strcasecmp(name, "href") == 0) {
1501 /*--------------------------------------------------------------------*/
1503 /*--------------------------------------------------------------------*/
1504 value = chxj_encoding_parameter(r, value);
1505 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "telto:")) {
1506 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1516 if (strcasecmp(name, "accesskey") == 0) {
1517 /*--------------------------------------------------------------------*/
1519 /*--------------------------------------------------------------------*/
1520 W_L(" accesskey=\"");
1528 if (strcasecmp(name, "cti") == 0) {
1529 /*--------------------------------------------------------------------*/
1531 /*--------------------------------------------------------------------*/
1538 if (strcasecmp(name, "utn") == 0) {
1539 /*--------------------------------------------------------------------*/
1541 /*--------------------------------------------------------------------*/
1548 if (strcasecmp(name, "telbook") == 0) {
1549 /*--------------------------------------------------------------------*/
1551 /*--------------------------------------------------------------------*/
1558 if (strcasecmp(name, "kana") == 0) {
1559 /*--------------------------------------------------------------------*/
1561 /*--------------------------------------------------------------------*/
1568 if (strcasecmp(name, "email") == 0) {
1569 /*--------------------------------------------------------------------*/
1571 /*--------------------------------------------------------------------*/
1578 if (strcasecmp(name, "ista") == 0) {
1579 /*--------------------------------------------------------------------*/
1581 /*--------------------------------------------------------------------*/
1585 if (strcasecmp(name, "ilet") == 0) {
1586 /*--------------------------------------------------------------------*/
1588 /*--------------------------------------------------------------------*/
1592 if (strcasecmp(name, "iswf") == 0) {
1593 /*--------------------------------------------------------------------*/
1595 /*--------------------------------------------------------------------*/
1599 if (strcasecmp(name, "irst") == 0) {
1600 /*--------------------------------------------------------------------*/
1602 /*--------------------------------------------------------------------*/
1606 if (strcasecmp(name, "ijam") == 0) {
1607 /*--------------------------------------------------------------------*/
1609 /*--------------------------------------------------------------------*/
1620 return chtml10->out;
1625 * It is a handler who processes the A tag.
1627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1628 * destination is specified.
1629 * @param node [i] The A tag node is specified.
1630 * @return The conversion result is returned.
1633 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1639 chtml10 = GET_CHTML10(pdoc);
1645 return chtml10->out;
1650 * It is a handler who processes the BR tag.
1652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1653 * destination is specified.
1654 * @param node [i] The BR tag node is specified.
1655 * @return The conversion result is returned.
1658 s_chtml10_start_br_tag(void *pdoc, Node *node)
1665 chtml10 = GET_CHTML10(pdoc);
1671 /*--------------------------------------------------------------------------*/
1672 /* Get Attributes */
1673 /*--------------------------------------------------------------------------*/
1674 for (attr = qs_get_attr(doc,node);
1676 attr = qs_get_next_attr(doc,attr)) {
1677 char *name = qs_get_attr_name(doc,attr);
1678 char *value = qs_get_attr_value(doc,attr);
1679 if (STRCASEEQ('c','C',"clear",name)) {
1680 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1689 return chtml10->out;
1694 * It is a handler who processes the BR tag.
1696 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1697 * destination is specified.
1698 * @param node [i] The BR tag node is specified.
1699 * @return The conversion result is returned.
1702 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1704 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1706 return chtml10->out;
1711 * It is a handler who processes the TR tag.
1713 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1714 * destination is specified.
1715 * @param node [i] The TR tag node is specified.
1716 * @return The conversion result is returned.
1719 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1721 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1723 return chtml10->out;
1728 * It is a handler who processes the TR tag.
1730 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1731 * destination is specified.
1732 * @param node [i] The TR tag node is specified.
1733 * @return The conversion result is returned.
1736 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1742 chtml10 = GET_CHTML10(pdoc);
1748 return chtml10->out;
1753 * It is a handler who processes the FONT tag.
1755 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1756 * destination is specified.
1757 * @param node [i] The FONT tag node is specified.
1758 * @return The conversion result is returned.
1761 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1763 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1767 return chtml10->out;
1772 * It is a handler who processes the FONT tag.
1774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1775 * destination is specified.
1776 * @param node [i] The FONT tag node is specified.
1777 * @return The conversion result is returned.
1780 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1782 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1786 return chtml10->out;
1791 * It is a handler who processes the FORM tag.
1793 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1794 * destination is specified.
1795 * @param node [i] The FORM tag node is specified.
1796 * @return The conversion result is returned.
1799 s_chtml10_start_form_tag(void *pdoc, Node *node)
1805 char *new_hidden_tag = NULL;
1806 char *attr_value = NULL;
1807 char *attr_method = NULL;
1809 chtml10 = GET_CHTML10(pdoc);
1814 /*--------------------------------------------------------------------------*/
1815 /* Get Attributes */
1816 /*--------------------------------------------------------------------------*/
1817 for (attr = qs_get_attr(doc,node);
1819 attr = qs_get_next_attr(doc,attr)) {
1820 char *name = qs_get_attr_name(doc,attr);
1821 char *value = qs_get_attr_value(doc,attr);
1825 if (strcasecmp(name, "action") == 0) {
1826 /*--------------------------------------------------------------------*/
1828 /*--------------------------------------------------------------------*/
1829 attr_value = chxj_encoding_parameter(r, value);
1830 attr_value = chxj_add_cookie_parameter(r, attr_value, chtml10->cookie);
1836 if (strcasecmp(name, "method") == 0) {
1837 /*--------------------------------------------------------------------*/
1839 /*--------------------------------------------------------------------*/
1840 attr_method = apr_pstrdup(doc->pool, value);
1846 if (strcasecmp(name, "utn") == 0) {
1847 /*--------------------------------------------------------------------*/
1849 /*--------------------------------------------------------------------*/
1859 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1864 char *new_query_string = NULL;
1865 q = strchr(attr_value, '?');
1867 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_value, 0, post_flag, &new_query_string, CHXJ_TRUE);
1868 if (new_hidden_tag) {
1874 if (new_query_string) {
1876 W_V(new_query_string);
1886 if (new_hidden_tag) {
1887 W_V(new_hidden_tag);
1890 return chtml10->out;
1895 * It is a handler who processes the FORM tag.
1897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1898 * destination is specified.
1899 * @param node [i] The FORM tag node is specified.
1900 * @return The conversion result is returned.
1903 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1909 chtml10 = GET_CHTML10(pdoc);
1915 return chtml10->out;
1920 * It is a handler who processes the INPUT tag.
1922 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1923 * destination is specified.
1924 * @param node [i] The INPUT tag node is specified.
1925 * @return The conversion result is returned.
1928 s_chtml10_start_input_tag(void *pdoc, Node *node)
1942 chtml10 = GET_CHTML10(pdoc);
1957 /*--------------------------------------------------------------------------*/
1958 /* Get Attributes */
1959 /*--------------------------------------------------------------------------*/
1961 type = qs_get_type_attr(doc, node, doc->buf.pool);
1962 name = qs_get_name_attr(doc, node, doc->buf.pool);
1963 value = qs_get_value_attr(doc,node,doc->buf.pool);
1964 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1965 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1966 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
1967 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1968 size = qs_get_size_attr(doc, node, doc->buf.pool);
1971 type = qs_trim_string(doc->buf.pool, type);
1972 if (type && (STRCASEEQ('t','T',"text", type) ||
1973 STRCASEEQ('p','P',"password",type) ||
1974 STRCASEEQ('c','C',"checkbox",type) ||
1975 STRCASEEQ('r','R',"radio", type) ||
1976 STRCASEEQ('h','H',"hidden", type) ||
1977 STRCASEEQ('s','S',"submit", type) ||
1978 STRCASEEQ('r','R',"reset", type))) {
1985 if (size && *size != 0) {
1991 if (name && *name != 0) {
1997 if (value && *value != 0) {
1999 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2003 if (accesskey && *accesskey != 0) {
2004 W_L(" accesskey=\"");
2010 /*------------------------------------------------------------------------*/
2012 /*------------------------------------------------------------------------*/
2015 /*--------------------------------------------------------------------------*/
2016 /* The figure is default for the password. */
2017 /*--------------------------------------------------------------------------*/
2018 if (max_length && *max_length != 0) {
2019 W_L(" maxlength=\"");
2029 return chtml10->out;
2034 * It is a handler who processes the INPUT tag.
2036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2037 * destination is specified.
2038 * @param node [i] The INPUT tag node is specified.
2039 * @return The conversion result is returned.
2042 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2044 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2046 return chtml10->out;
2051 * It is a handler who processes the CENTER tag.
2053 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2054 * destination is specified.
2055 * @param node [i] The CENTER tag node is specified.
2056 * @return The conversion result is returned.
2059 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2065 chtml10 = GET_CHTML10(pdoc);
2071 return chtml10->out;
2076 * It is a handler who processes the CENTER tag.
2078 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2079 * destination is specified.
2080 * @param node [i] The CENTER tag node is specified.
2081 * @return The conversion result is returned.
2084 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2090 chtml10 = GET_CHTML10(pdoc);
2096 return chtml10->out;
2101 * It is a handler who processes the HR tag.
2103 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2104 * destination is specified.
2105 * @param node [i] The HR tag node is specified.
2106 * @return The conversion result is returned.
2109 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2116 chtml10 = GET_CHTML10(pdoc);
2122 for (attr = qs_get_attr(doc,node);
2124 attr = qs_get_next_attr(doc,attr)) {
2125 char *name = qs_get_attr_name (doc,attr);
2126 char *value = qs_get_attr_value(doc,attr);
2130 if (strcasecmp(name, "align") == 0) {
2131 /*--------------------------------------------------------------------*/
2133 /*--------------------------------------------------------------------*/
2134 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2144 if (strcasecmp(name, "size") == 0) {
2145 /*--------------------------------------------------------------------*/
2147 /*--------------------------------------------------------------------*/
2148 if (value && value[0] != '\0') {
2158 if (strcasecmp(name, "width") == 0) {
2159 /*--------------------------------------------------------------------*/
2161 /*--------------------------------------------------------------------*/
2162 if (value && value[0] != '\0') {
2172 if (strcasecmp(name, "noshade") == 0) {
2173 /*--------------------------------------------------------------------*/
2175 /*--------------------------------------------------------------------*/
2182 if (strcasecmp(name, "color") == 0) {
2183 /*--------------------------------------------------------------------*/
2185 /*--------------------------------------------------------------------*/
2195 return chtml10->out;
2200 * It is a handler who processes the HR tag.
2202 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2203 * destination is specified.
2204 * @param node [i] The HR tag node is specified.
2205 * @return The conversion result is returned.
2208 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2210 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2213 return chtml10->out;
2218 * It is a handler who processes the IMG tag.
2220 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2221 * destination is specified.
2222 * @param node [i] The IMG tag node is specified.
2223 * @return The conversion result is returned.
2226 s_chtml10_start_img_tag(void *pdoc, Node *node)
2232 #ifndef IMG_NOT_CONVERT_FILENAME
2236 chtml10 = GET_CHTML10(pdoc);
2237 #ifndef IMG_NOT_CONVERT_FILENAME
2238 spec = chtml10->spec;
2244 /*--------------------------------------------------------------------------*/
2245 /* Get Attributes */
2246 /*--------------------------------------------------------------------------*/
2247 for (attr = qs_get_attr(doc,node);
2249 attr = qs_get_next_attr(doc,attr)) {
2250 char *name = qs_get_attr_name (doc,attr);
2251 char *value = qs_get_attr_value(doc,attr);
2255 if (strcasecmp(name, "src") == 0) {
2256 /*--------------------------------------------------------------------*/
2258 /*--------------------------------------------------------------------*/
2259 #ifdef IMG_NOT_CONVERT_FILENAME
2260 value = chxj_encoding_parameter(r, value);
2261 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2262 value = chxj_add_cookie_no_update_parameter(r, value);
2267 value = chxj_img_conv(r, spec, value);
2268 value = chxj_encoding_parameter(r, value);
2269 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2270 value = chxj_add_cookie_no_update_parameter(r, value);
2280 if (strcasecmp(name, "align" ) == 0) {
2281 /*--------------------------------------------------------------------*/
2283 /*--------------------------------------------------------------------*/
2284 /*--------------------------------------------------------------------*/
2286 /*--------------------------------------------------------------------*/
2288 if (STRCASEEQ('t','T',"top", value) ||
2289 STRCASEEQ('m','M',"middle",value) ||
2290 STRCASEEQ('b','B',"bottom",value) ||
2291 STRCASEEQ('l','L',"left", value) ||
2292 STRCASEEQ('r','R',"right", value)) {
2297 else if (STRCASEEQ('c','C',"center", value)) {
2304 else if (strcasecmp(name, "alt" ) == 0) {
2305 /*--------------------------------------------------------------------*/
2307 /*--------------------------------------------------------------------*/
2308 if (value && value[0] != '\0') {
2318 if (strcasecmp(name, "width" ) == 0) {
2319 /*--------------------------------------------------------------------*/
2321 /*--------------------------------------------------------------------*/
2322 if (value && value[0] != '\0') {
2332 if (strcasecmp(name, "height") == 0) {
2333 /*--------------------------------------------------------------------*/
2335 /*--------------------------------------------------------------------*/
2336 if (value && value[0] != '\0') {
2343 if (strcasecmp(name, "hspace") == 0) {
2344 /*--------------------------------------------------------------------*/
2346 /*--------------------------------------------------------------------*/
2347 if (value && value[0] != '\0') {
2357 if (strcasecmp(name, "vspace") == 0) {
2358 /*--------------------------------------------------------------------*/
2360 /*--------------------------------------------------------------------*/
2361 if (value && value[0] != '\0') {
2375 return chtml10->out;
2380 * It is a handler who processes the IMG tag.
2382 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2383 * destination is specified.
2384 * @param node [i] The IMG tag node is specified.
2385 * @return The conversion result is returned.
2388 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2390 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2392 return chtml10->out;
2397 * It is a handler who processes the SELECT tag.
2399 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2400 * destination is specified.
2401 * @param node [i] The SELECT tag node is specified.
2402 * @return The conversion result is returned.
2405 s_chtml10_start_select_tag(void *pdoc, Node *child)
2415 chtml10 = GET_CHTML10(pdoc);
2423 for (attr = qs_get_attr(doc,child);
2425 attr = qs_get_next_attr(doc,attr)) {
2426 char *nm = qs_get_attr_name (doc,attr);
2427 char *val = qs_get_attr_value(doc,attr);
2431 if (strcasecmp(nm, "size") == 0) {
2432 /*--------------------------------------------------------------------*/
2433 /* CHTML 1.0 version 2.0 */
2434 /*--------------------------------------------------------------------*/
2435 size = apr_pstrdup(doc->buf.pool, val);
2441 if (strcasecmp(nm, "name") == 0) {
2442 /*--------------------------------------------------------------------*/
2443 /* CHTML 1.0 version 2.0 */
2444 /*--------------------------------------------------------------------*/
2445 name = apr_pstrdup(doc->buf.pool, val);
2451 if (strcasecmp(nm, "multiple") == 0) {
2452 /*--------------------------------------------------------------------*/
2453 /* CHTML 1.0 version 2.0 */
2454 /*--------------------------------------------------------------------*/
2464 if (size && *size != 0) {
2470 if (name && *name != 0) {
2477 return chtml10->out;
2482 * It is a handler who processes the SELECT tag.
2484 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2485 * destination is specified.
2486 * @param node [i] The SELECT tag node is specified.
2487 * @return The conversion result is returned.
2490 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2496 chtml10 = GET_CHTML10(pdoc);
2501 return chtml10->out;
2506 * It is a handler who processes the OPTION tag.
2508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2509 * destination is specified.
2510 * @param node [i] The OPTION tag node is specified.
2511 * @return The conversion result is returned.
2514 s_chtml10_start_option_tag(void *pdoc, Node *child)
2523 chtml10 = GET_CHTML10(pdoc);
2532 for (attr = qs_get_attr(doc,child);
2534 attr = qs_get_next_attr(doc,attr)) {
2535 char *nm = qs_get_attr_name (doc,attr);
2536 char *val = qs_get_attr_value(doc,attr);
2540 if (strcasecmp(nm, "selected") == 0) {
2541 /*--------------------------------------------------------------------*/
2542 /* CHTML 1.0 version 2.0 */
2543 /*--------------------------------------------------------------------*/
2544 selected = apr_pstrdup(doc->buf.pool, val);
2550 if (strcasecmp(nm, "value") == 0) {
2551 /*--------------------------------------------------------------------*/
2552 /* CHTML 1.0 version 2.0 */
2553 /*--------------------------------------------------------------------*/
2554 value = apr_pstrdup(doc->buf.pool, val);
2563 if (value && *value != 0) {
2574 return chtml10->out;
2579 * It is a handler who processes the OPTION tag.
2581 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2582 * destination is specified.
2583 * @param node [i] The OPTION tag node is specified.
2584 * @return The conversion result is returned.
2587 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2589 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2593 return chtml10->out;
2598 * It is a handler who processes the DIV tag.
2600 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2601 * destination is specified.
2602 * @param node [i] The DIV tag node is specified.
2603 * @return The conversion result is returned.
2606 s_chtml10_start_div_tag(void *pdoc, Node *child)
2614 chtml10 = GET_CHTML10(pdoc);
2621 for (attr = qs_get_attr(doc,child);
2623 attr = qs_get_next_attr(doc,attr)) {
2624 char *nm = qs_get_attr_name(doc,attr);
2625 char *val = qs_get_attr_value(doc,attr);
2626 if (STRCASEEQ('a','A',"align", nm)) {
2627 /*----------------------------------------------------------------------*/
2628 /* CHTML 1.0 (W3C version 3.2) */
2629 /*----------------------------------------------------------------------*/
2630 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2631 align = apr_pstrdup(doc->buf.pool, val);
2643 return chtml10->out;
2648 * It is a handler who processes the DIV tag.
2650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2651 * destination is specified.
2652 * @param node [i] The DIV tag node is specified.
2653 * @return The conversion result is returned.
2656 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2662 chtml10 = GET_CHTML10(pdoc);
2667 return chtml10->out;
2672 * It is a handler who processes the CHXJ:IF tag.
2674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2675 * destination is specified.
2676 * @param node [i] The CHXJ:IF tag node is specified.
2677 * @return The conversion result is returned.
2680 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2687 chtml10 = GET_CHTML10(pdoc);
2691 for (child = qs_get_child_node(doc, node);
2693 child = qs_get_next_node(doc, child)) {
2695 s_chtml10_chxjif_tag(chtml10, child);
2698 return chtml10->out;
2703 * It is a handler who processes the PRE tag.
2705 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2706 * destination is specified.
2707 * @param node [i] The PRE tag node is specified.
2708 * @return The conversion result is returned.
2711 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2717 chtml10 = GET_CHTML10(pdoc);
2721 chtml10->pre_flag++;
2723 return chtml10->out;
2728 * It is a handler who processes the PRE tag.
2730 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2731 * destination is specified.
2732 * @param node [i] The PRE tag node is specified.
2733 * @return The conversion result is returned.
2736 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2742 chtml10 = GET_CHTML10(pdoc);
2747 chtml10->pre_flag--;
2749 return chtml10->out;
2754 * It is a handler who processes the P tag.
2756 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2757 * destination is specified.
2758 * @param node [i] The P tag node is specified.
2759 * @return The conversion result is returned.
2762 s_chtml10_start_p_tag(void *pdoc, Node *node)
2770 chtml10 = GET_CHTML10(pdoc);
2775 for (attr = qs_get_attr(doc,node);
2777 attr = qs_get_next_attr(doc,attr)) {
2778 char *nm = qs_get_attr_name(doc,attr);
2779 char *val = qs_get_attr_value(doc,attr);
2780 if (STRCASEEQ('a','A',"align", nm)) {
2781 /*----------------------------------------------------------------------*/
2782 /* CHTML 1.0 (W3C version 3.2) */
2783 /*----------------------------------------------------------------------*/
2784 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2785 align = apr_pstrdup(doc->buf.pool, val);
2797 return chtml10->out;
2802 * It is a handler who processes the P tag.
2804 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2805 * destination is specified.
2806 * @param node [i] The P tag node is specified.
2807 * @return The conversion result is returned.
2810 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2816 chtml10 = GET_CHTML10(pdoc);
2821 return chtml10->out;
2826 * It is a handler who processes the TEXTARE tag.
2828 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2829 * destination is specified.
2830 * @param node [i] The TEXTAREA tag node is specified.
2831 * @return The conversion result is returned.
2834 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2841 chtml10 = GET_CHTML10(pdoc);
2846 chtml10->textarea_flag++;
2850 for (attr = qs_get_attr(doc,node);
2852 attr = qs_get_next_attr(doc,attr)) {
2853 char *name = qs_get_attr_name (doc,attr);
2854 char *value = qs_get_attr_value(doc,attr);
2858 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2859 W_L(" accesskey=\"");
2867 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2876 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2885 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2897 return chtml10->out;
2902 * It is a handler who processes the TEXTAREA tag.
2904 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2905 * destination is specified.
2906 * @param node [i] The TEXTAREA tag node is specified.
2907 * @return The conversion result is returned.
2910 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2916 chtml10 = GET_CHTML10(pdoc);
2921 chtml10->textarea_flag--;
2923 return chtml10->out;
2928 s_chtml10_text(void *pdoc, Node *child)
2940 chtml10 = GET_CHTML10(pdoc);
2944 textval = qs_get_node_value(doc,child);
2945 if (strlen(textval) == 0) {
2946 return chtml10->out;
2949 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2950 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2952 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
2953 memset(one_byte, 0, sizeof(one_byte));
2956 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2960 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2962 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2967 if (is_sjis_kanji(textval[ii])) {
2968 one_byte[0] = textval[ii+0];
2969 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2970 one_byte[0] = textval[ii+1];
2971 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2975 if (chtml10->pre_flag) {
2976 one_byte[0] = textval[ii+0];
2977 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2980 if (chtml10->textarea_flag) {
2981 one_byte[0] = textval[ii+0];
2982 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2985 if (textval[ii] != '\r' && textval[ii] != '\n') {
2986 one_byte[0] = textval[ii+0];
2987 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2992 return chtml10->out;
2997 * It is a handler who processes the BLOCKQUOTE tag.
2999 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3000 * destination is specified.
3001 * @param node [i] The BLOCKQUOTE tag node is specified.
3002 * @return The conversion result is returned.
3005 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3009 chtml10 = GET_CHTML10(pdoc);
3011 W_L("<blockquote>");
3012 return chtml10->out;
3017 * It is a handler who processes the BLOCKQUOTE tag.
3019 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3020 * destination is specified.
3021 * @param node [i] The BLOCKQUOTE tag node is specified.
3022 * @return The conversion result is returned.
3025 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3030 chtml10 = GET_CHTML10(pdoc);
3032 W_L("</blockquote>");
3033 return chtml10->out;
3038 * It is a handler who processes the DIR tag.
3040 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3041 * destination is specified.
3042 * @param node [i] The DIR tag node is specified.
3043 * @return The conversion result is returned.
3046 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3050 chtml10 = GET_CHTML10(pdoc);
3053 return chtml10->out;
3058 * It is a handler who processes the DIR tag.
3060 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3061 * destination is specified.
3062 * @param node [i] The DIR tag node is specified.
3063 * @return The conversion result is returned.
3066 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3071 chtml10 = GET_CHTML10(pdoc);
3074 return chtml10->out;
3079 * It is a handler who processes the DL tag.
3081 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3082 * destination is specified.
3083 * @param node [i] The DL tag node is specified.
3084 * @return The conversion result is returned.
3087 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3091 chtml10 = GET_CHTML10(pdoc);
3094 return chtml10->out;
3099 * It is a handler who processes the DL tag.
3101 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3102 * destination is specified.
3103 * @param node [i] The DL tag node is specified.
3104 * @return The conversion result is returned.
3107 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3111 chtml10 = GET_CHTML10(pdoc);
3114 return chtml10->out;
3119 * It is a handter who processes the DT tag.
3121 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3122 * destination is specified.
3123 * @param node [i] The DT tag node is specified.
3124 * @return The conversion result is returned.
3127 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3131 chtml10 = GET_CHTML10(pdoc);
3134 return chtml10->out;
3139 * It is a handter who processes the DT tag.
3141 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3142 * destination is specified.
3143 * @param node [i] The DT tag node is specified.
3144 * @return The conversion result is returned.
3147 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3149 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3151 return chtml10->out;
3156 * It is a handder who processes the DD tag.
3158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3159 * destination is specified.
3160 * @param node [i] The DD tag node is specified.
3161 * @return The conversion result is returned.
3164 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3168 chtml10 = GET_CHTML10(pdoc);
3171 return chtml10->out;
3176 * It is a handder who processes the DD tag.
3178 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3179 * destination is specified.
3180 * @param node [i] The DD tag node is specified.
3181 * @return The conversion result is returned.
3184 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3186 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3187 return chtml10->out;
3192 * It is a hanmenuer who processes the MENU tag.
3194 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3195 * destination is specified.
3196 * @param node [i] The MENU tag node is specified.
3197 * @return The conversion result is returned.
3200 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3204 chtml10 = GET_CHTML10(pdoc);
3207 return chtml10->out;
3212 * It is a hanmenuer who processes the MENU tag.
3214 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3215 * destination is specified.
3216 * @param node [i] The MENU tag node is specified.
3217 * @return The conversion result is returned.
3220 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3222 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3223 Doc *doc = chtml10->doc;
3225 return chtml10->out;
3230 * It is a handler who processes the PLAINTEXT tag.
3232 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3233 * destination is specified.
3234 * @param node [i] The PLAINTEXT tag node is specified.
3235 * @return The conversion result is returned.
3238 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3243 chtml10 = GET_CHTML10(pdoc);
3246 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3247 return chtml10->out;
3251 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3256 chtml10 = GET_CHTML10(pdoc);
3258 for (child = qs_get_child_node(doc, node);
3260 child = qs_get_next_node(doc, child)) {
3262 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3264 return chtml10->out;
3269 * It is a handler who processes the PLAINTEXT tag.
3271 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3272 * destination is specified.
3273 * @param node [i] The PLAINTEXT tag node is specified.
3274 * @return The conversion result is returned.
3277 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3279 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3280 return chtml10->out;
3285 * It is handler who processes the New Line Code.
3288 s_chtml10_newline_mark(void *pdoc, Node *UNUSED(node))
3290 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3291 Doc *doc = chtml10->doc;
3293 return chtml10->out;