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"
26 #define GET_CHTML10(X) ((chtml10_t *)(X))
29 #define W_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
30 #define W_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
31 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
34 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml10->conf); W_V(nlcode); } while (0)
36 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
37 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
38 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
39 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
40 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
41 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
42 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
43 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
44 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
45 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
46 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
47 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
48 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
49 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
50 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
51 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
52 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
53 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
54 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
55 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
56 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
57 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
58 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
59 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
60 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
61 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
62 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
63 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
64 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
65 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
66 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
67 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
68 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
69 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
70 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
71 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
72 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
73 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
74 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
75 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
76 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
77 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
78 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
79 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
80 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
81 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
82 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
83 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
84 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
85 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
86 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
87 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
88 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
89 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
90 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
91 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
92 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
93 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
94 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
95 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
96 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
97 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
98 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
99 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
100 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
101 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
102 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
103 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
104 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
105 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
106 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
107 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
108 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
109 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
110 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
111 static char *s_chtml10_newline_mark (void *pdoc, Node *node);
113 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
115 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
116 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
117 static char *s_chtml10_text (void *pdoc, Node *node);
119 tag_handler chtml10_handler[] = {
122 s_chtml10_start_html_tag,
123 s_chtml10_end_html_tag,
127 s_chtml10_start_meta_tag,
128 s_chtml10_end_meta_tag,
132 s_chtml10_start_textarea_tag,
133 s_chtml10_end_textarea_tag,
137 s_chtml10_start_p_tag,
142 s_chtml10_start_pre_tag,
143 s_chtml10_end_pre_tag,
147 s_chtml10_start_ul_tag,
148 s_chtml10_end_ul_tag,
152 s_chtml10_start_li_tag,
153 s_chtml10_end_li_tag,
157 s_chtml10_start_ol_tag,
158 s_chtml10_end_ol_tag,
162 s_chtml10_start_h1_tag,
163 s_chtml10_end_h1_tag,
167 s_chtml10_start_h2_tag,
168 s_chtml10_end_h2_tag,
172 s_chtml10_start_h3_tag,
173 s_chtml10_end_h3_tag,
177 s_chtml10_start_h4_tag,
178 s_chtml10_end_h4_tag,
182 s_chtml10_start_h5_tag,
183 s_chtml10_end_h5_tag,
187 s_chtml10_start_h6_tag,
188 s_chtml10_end_h6_tag,
192 s_chtml10_start_head_tag,
193 s_chtml10_end_head_tag,
197 s_chtml10_start_title_tag,
198 s_chtml10_end_title_tag,
202 s_chtml10_start_base_tag,
203 s_chtml10_end_base_tag,
207 s_chtml10_start_body_tag,
208 s_chtml10_end_body_tag,
212 s_chtml10_start_a_tag,
217 s_chtml10_start_br_tag,
218 s_chtml10_end_br_tag,
227 s_chtml10_start_tr_tag,
228 s_chtml10_end_tr_tag,
242 s_chtml10_start_font_tag,
243 s_chtml10_end_font_tag,
247 s_chtml10_start_form_tag,
248 s_chtml10_end_form_tag,
252 s_chtml10_start_input_tag,
253 s_chtml10_end_input_tag,
257 s_chtml10_start_center_tag,
258 s_chtml10_end_center_tag,
262 s_chtml10_start_hr_tag,
263 s_chtml10_end_hr_tag,
267 s_chtml10_start_img_tag,
268 s_chtml10_end_img_tag,
272 s_chtml10_start_select_tag,
273 s_chtml10_end_select_tag,
277 s_chtml10_start_option_tag,
278 s_chtml10_end_option_tag,
282 s_chtml10_start_div_tag,
283 s_chtml10_end_div_tag,
287 s_chtml10_chxjif_tag,
332 s_chtml10_start_dt_tag,
333 s_chtml10_end_dt_tag,
347 s_chtml10_start_blockquote_tag,
348 s_chtml10_end_blockquote_tag,
352 s_chtml10_start_dir_tag,
353 s_chtml10_end_dir_tag,
357 s_chtml10_start_dl_tag,
358 s_chtml10_end_dl_tag,
362 s_chtml10_start_dd_tag,
363 s_chtml10_end_dd_tag,
367 s_chtml10_start_menu_tag,
368 s_chtml10_end_menu_tag,
372 s_chtml10_start_plaintext_tag,
373 s_chtml10_end_plaintext_tag,
387 s_chtml10_newline_mark,
394 * converts from CHTML5.0 to CHTML1.0.
396 * @param r [i] Requet_rec is appointed.
397 * @param spec [i] The result of the device specification processing which
398 * was done in advance is appointed.
399 * @param src [i] The character string before the converting is appointed.
400 * @return The character string after the converting is returned.
403 chxj_convert_chtml10(
409 chxjconvrule_entry *entryp,
422 DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
424 /*--------------------------------------------------------------------------*/
426 /*--------------------------------------------------------------------------*/
428 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
430 DBG(r,"i found qrcode xml");
433 DBG(r,"not found qrcode xml");
435 /*--------------------------------------------------------------------------*/
436 /* The CHTML structure is initialized. */
437 /*--------------------------------------------------------------------------*/
438 s_init_chtml10(&chtml10, &doc, r, spec);
439 chtml10.entryp = entryp;
440 chtml10.cookie = cookie;
442 chxj_set_content_type(r, "text/html; charset=Windows-31J");
444 /*--------------------------------------------------------------------------*/
445 /* The character string of the input is analyzed. */
446 /*--------------------------------------------------------------------------*/
447 qs_init_malloc(&doc);
448 qs_init_root_node(&doc);
450 ss = apr_pcalloc(r->pool, srclen + 1);
451 memset(ss, 0, srclen + 1);
452 memcpy(ss, src, srclen);
455 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
458 qs_parse_string(&doc,ss, strlen(ss));
460 chxj_buffered_write_init(r->pool, &doc.buf);
461 /*--------------------------------------------------------------------------*/
462 /* It converts it from CHTML to CHTML. */
463 /*--------------------------------------------------------------------------*/
464 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
465 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
466 dst = apr_pstrdup(r->pool, chtml10.out);
467 chxj_buffered_write_terminate(&doc.buf);
469 qs_all_free(&doc,QX_LOGMARK);
472 return apr_pstrdup(r->pool,ss);
475 if (strlen(dst) == 0) {
476 dst = apr_psprintf(r->pool, "\n");
478 *dstlen = strlen(dst);
481 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
484 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
491 * The CHTML structure is initialized.
493 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
494 * initialized is specified.
495 * @param doc [i] The Doc structure that should be set to the initialized
496 * HDML structure is specified.
497 * @param r [i] To use POOL, the pointer to request_rec is specified.
498 * @param spec [i] The pointer to the device_table
507 memset(doc, 0, sizeof(Doc));
508 memset(chtml10, 0, sizeof(chtml10_t));
512 chtml10->spec = spec;
513 chtml10->out = qs_alloc_zero_byte_string(r->pool);
514 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
515 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
520 * Corresponding EMOJI to a current character-code is retrieved.
521 * The substitution character string is stored in the rslt pointer if agreeing.
523 * @param chtml10 [i] The pointer to the CHTML structure is specified.
524 * @param txt [i] The character string to want to examine whether it is
525 * EMOJI is specified.
526 * @param rslt [o] The pointer to the pointer that stores the result is
528 * @return When corresponding EMOJI exists, it returns it excluding 0.
531 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
538 spec = chtml10->spec;
544 DBG(r,"spec is NULL");
547 for (ee = chtml10->conf->emoji;
552 DBG(r,"emoji->imode is NULL");
556 if (ee->imode->string
558 && strlen(ee->imode->string) > 0
559 && *ee->imode->string == *txt
560 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
561 if (!spec || !spec->emoji_type) {
562 *rslt = apr_palloc(r->pool, 3);
563 (*rslt)[0] = ee->imode->hex1byte & 0xff;
564 (*rslt)[1] = ee->imode->hex2byte & 0xff;
566 return strlen(ee->imode->string);
577 * It is a handler who processes the HTML tag.
579 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
580 * destination is specified.
581 * @param node [i] The HTML tag node is specified.
582 * @return The conversion result is returned.
585 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
591 chtml10 = GET_CHTML10(pdoc);
595 /*--------------------------------------------------------------------------*/
597 /*--------------------------------------------------------------------------*/
604 * It is a handler who processes the HTML tag.
606 * @param pdoc [i/o] The pointer to the CHTML structure at the output
607 * destination is specified.
608 * @param node [i] The HTML tag node is specified.
609 * @return The conversion result is returned.
612 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
619 chtml10 = GET_CHTML10(pdoc);
629 * It is a handler who processes the META tag.
631 * @param pdoc [i/o] The pointer to the CHTML structure at the output
632 * destination is specified.
633 * @param node [i] The META tag node is specified.
634 * @return The conversion result is returned.
637 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
639 chtml10_t *chtml10 = GET_CHTML10(pdoc);
648 * It is a handler who processes the META tag.
650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
651 * destination is specified.
652 * @param node [i] The META tag node is specified.
653 * @return The conversion result is returned.
656 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
658 chtml10_t *chtml10 = GET_CHTML10(pdoc);
665 * It is a handler who processes the HEAD tag.
667 * @param pdoc [i/o] The pointer to the CHTML structure at the output
668 * destination is specified.
669 * @param node [i] The HEAD tag node is specified.
670 * @return The conversion result is returned.
673 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
679 chtml10 = GET_CHTML10(pdoc);
690 * It is a handler who processes the HEAD tag.
692 * @param pdoc [i/o] The pointer to the CHTML structure at the output
693 * destination is specified.
694 * @param node [i] The HEAD tag node is specified.
695 * @return The conversion result is returned.
698 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
704 chtml10 = GET_CHTML10(pdoc);
715 * It is a handler who processes the OL tag.
717 * @param pdoc [i/o] The pointer to the CHTML structure at the output
718 * destination is specified.
719 * @param node [i] The OL tag node is specified.
720 * @return The conversion result is returned.
723 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
729 chtml10 = GET_CHTML10(pdoc);
740 * It is a handler who processes the OL tag.
742 * @param pdoc [i/o] The pointer to the CHTML structure at the output
743 * destination is specified.
744 * @param node [i] The OL tag node is specified.
745 * @return The conversion result is returned.
748 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
754 chtml10 = GET_CHTML10(pdoc);
765 * It is a handler who processes the UL tag.
767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
768 * destination is specified.
769 * @param node [i] The UL tag node is specified.
770 * @return The conversion result is returned.
773 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
779 chtml10 = GET_CHTML10(pdoc);
790 * It is a handler who processes the UL tag.
792 * @param pdoc [i/o] The pointer to the CHTML structure at the output
793 * destination is specified.
794 * @param node [i] The UL tag node is specified.
795 * @return The conversion result is returned.
798 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
804 chtml10 = GET_CHTML10(pdoc);
815 * It is a handler who processes the LI tag.
817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
818 * destination is specified.
819 * @param node [i] The LI tag node is specified.
820 * @return The conversion result is returned.
823 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
829 chtml10 = GET_CHTML10(pdoc);
840 * It is a handler who processes the LI tag.
842 * @param pdoc [i/o] The pointer to the CHTML structure at the output
843 * destination is specified.
844 * @param node [i] The LI tag node is specified.
845 * @return The conversion result is returned.
848 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
850 chtml10_t *chtml10 = GET_CHTML10(pdoc);
856 * It is a handler who processes the H1 tag.
858 * @param pdoc [i/o] The pointer to the CHTML structure at the output
859 * destination is specified.
860 * @param node [i] The H1 tag node is specified.
861 * @return The conversion result is returned.
864 s_chtml10_start_h1_tag(void *pdoc, Node *node)
871 chtml10 = GET_CHTML10(pdoc);
876 for (attr = qs_get_attr(doc,node);
878 attr = qs_get_next_attr(doc,attr)) {
879 char *name = qs_get_attr_name(doc,attr);
880 char *value = qs_get_attr_value(doc,attr);
881 if (STRCASEEQ('a','A',"align", name)) {
882 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
897 * It is a handler who processes the H1 tag.
899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
900 * destination is specified.
901 * @param node [i] The H1 tag node is specified.
902 * @return The conversion result is returned.
905 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
911 chtml10 = GET_CHTML10(pdoc);
922 * It is a handler who processes the H2 tag.
924 * @param pdoc [i/o] The pointer to the CHTML structure at the output
925 * destination is specified.
926 * @param node [i] The H2 tag node is specified.
927 * @return The conversion result is returned.
930 s_chtml10_start_h2_tag(void *pdoc, Node *node)
936 chtml10 = GET_CHTML10(pdoc);
940 for (attr = qs_get_attr(doc,node);
942 attr = qs_get_next_attr(doc,attr)) {
943 char *name = qs_get_attr_name(doc,attr);
944 char *value = qs_get_attr_value(doc,attr);
945 if (STRCASEEQ('a','A',"align", name)) {
946 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
961 * It is a handler who processes the H2 tag.
963 * @param pdoc [i/o] The pointer to the CHTML structure at the output
964 * destination is specified.
965 * @param node [i] The H2 tag node is specified.
966 * @return The conversion result is returned.
969 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
975 chtml10 = GET_CHTML10(pdoc);
986 * It is a handler who processes the H3 tag.
988 * @param pdoc [i/o] The pointer to the CHTML structure at the output
989 * destination is specified.
990 * @param node [i] The H3 tag node is specified.
991 * @return The conversion result is returned.
994 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1001 chtml10 = GET_CHTML10(pdoc);
1006 for (attr = qs_get_attr(doc,node);
1008 attr = qs_get_next_attr(doc,attr)) {
1009 char *name = qs_get_attr_name(doc,attr);
1010 char *value = qs_get_attr_value(doc,attr);
1011 if (STRCASEEQ('a','A',"align", name)) {
1012 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1022 return chtml10->out;
1027 * It is a handler who processes the H3 tag.
1029 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1030 * destination is specified.
1031 * @param node [i] The H3 tag node is specified.
1032 * @return The conversion result is returned.
1035 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1041 chtml10 = GET_CHTML10(pdoc);
1047 return chtml10->out;
1052 * It is a handler who processes the H4 tag.
1054 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1055 * destination is specified.
1056 * @param node [i] The H4 tag node is specified.
1057 * @return The conversion result is returned.
1060 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1066 chtml10 = GET_CHTML10(pdoc);
1070 for (attr = qs_get_attr(doc,node);
1072 attr = qs_get_next_attr(doc,attr)) {
1073 char *name = qs_get_attr_name(doc,attr);
1074 char *value = qs_get_attr_value(doc,attr);
1075 if (STRCASEEQ('a','A',"align", name)) {
1076 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1086 return chtml10->out;
1091 * It is a handler who processes the H4 tag.
1093 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1094 * destination is specified.
1095 * @param node [i] The H4 tag node is specified.
1096 * @return The conversion result is returned.
1099 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1104 chtml10 = GET_CHTML10(pdoc);
1109 return chtml10->out;
1114 * It is a handler who processes the H5 tag.
1116 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1117 * destination is specified.
1118 * @param node [i] The H5 tag node is specified.
1119 * @return The conversion result is returned.
1122 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1129 chtml10 = GET_CHTML10(pdoc);
1134 for (attr = qs_get_attr(doc,node);
1136 attr = qs_get_next_attr(doc,attr)) {
1137 char *name = qs_get_attr_name(doc,attr);
1138 char *value = qs_get_attr_value(doc,attr);
1139 if (STRCASEEQ('a','A',"align", name)) {
1140 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1150 return chtml10->out;
1155 * It is a handler who processes the H5 tag.
1157 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1158 * destination is specified.
1159 * @param node [i] The H5 tag node is specified.
1160 * @return The conversion result is returned.
1163 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1168 chtml10 = GET_CHTML10(pdoc);
1173 return chtml10->out;
1178 * It is a handler who processes the H6 tag.
1180 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1181 * destination is specified.
1182 * @param node [i] The H6 tag node is specified.
1183 * @return The conversion result is returned.
1186 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1192 chtml10 = GET_CHTML10(pdoc);
1196 for (attr = qs_get_attr(doc,node);
1198 attr = qs_get_next_attr(doc,attr)) {
1199 char *name = qs_get_attr_name(doc,attr);
1200 char *value = qs_get_attr_value(doc,attr);
1201 if (STRCASEEQ('a','A',"align", name)) {
1202 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1212 return chtml10->out;
1217 * It is a handler who processes the H6 tag.
1219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1220 * destination is specified.
1221 * @param node [i] The H6 tag node is specified.
1222 * @return The conversion result is returned.
1225 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1230 chtml10 = GET_CHTML10(pdoc);
1235 return chtml10->out;
1240 * It is a handler who processes the TITLE tag.
1242 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1243 * destination is specified.
1244 * @param node [i] The TITLE tag node is specified.
1245 * @return The conversion result is returned.
1248 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1253 chtml10 = GET_CHTML10(pdoc);
1258 return chtml10->out;
1263 * It is a handler who processes the TITLE tag.
1265 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1266 * destination is specified.
1267 * @param node [i] The TITLE tag node is specified.
1268 * @return The conversion result is returned.
1271 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1276 chtml10 = GET_CHTML10(pdoc);
1281 return chtml10->out;
1286 * It is a handler who processes the BASE tag.
1288 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1289 * destination is specified.
1290 * @param node [i] The BASE tag node is specified.
1291 * @return The conversion result is returned.
1294 s_chtml10_start_base_tag(void *pdoc, Node *node)
1300 chtml10 = GET_CHTML10(pdoc);
1304 /*--------------------------------------------------------------------------*/
1305 /* Get Attributes */
1306 /*--------------------------------------------------------------------------*/
1307 for (attr = qs_get_attr(doc,node);
1309 attr = qs_get_next_attr(doc,attr)) {
1310 char *name = qs_get_attr_name(doc,attr);
1311 char *value = qs_get_attr_value(doc,attr);
1312 if (STRCASEEQ('h','H',"href", name)) {
1321 return chtml10->out;
1326 * It is a handler who processes the BASE tag.
1328 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1329 * destination is specified.
1330 * @param node [i] The BASE tag node is specified.
1331 * @return The conversion result is returned.
1334 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1336 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1338 return chtml10->out;
1343 * It is a handler who processes the BODY tag.
1345 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1346 * destination is specified.
1347 * @param node [i] The BODY tag node is specified.
1348 * @return The conversion result is returned.
1351 s_chtml10_start_body_tag(void *pdoc, Node *node)
1357 chtml10 = GET_CHTML10(pdoc);
1361 /*--------------------------------------------------------------------------*/
1362 /* Get Attributes */
1363 /*--------------------------------------------------------------------------*/
1364 for (attr = qs_get_attr(doc,node);
1366 attr = qs_get_next_attr(doc,attr)) {
1367 char *name = qs_get_attr_name(doc,attr);
1371 if (strcasecmp(name, "alink") == 0) {
1372 /*----------------------------------------------------------------------*/
1374 /*----------------------------------------------------------------------*/
1381 if (strcasecmp(name, "bgcolor") == 0) {
1382 /*----------------------------------------------------------------------*/
1384 /*----------------------------------------------------------------------*/
1391 if (strcasecmp(name, "text") == 0) {
1392 /*----------------------------------------------------------------------*/
1394 /*----------------------------------------------------------------------*/
1401 if (strcasecmp(name, "link") == 0) {
1402 /*----------------------------------------------------------------------*/
1404 /*----------------------------------------------------------------------*/
1411 if (strcasecmp(name, "vlink") == 0) {
1412 /*----------------------------------------------------------------------*/
1414 /*----------------------------------------------------------------------*/
1426 return chtml10->out;
1431 * It is a handler who processes the BODY tag.
1433 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1434 * destination is specified.
1435 * @param node [i] The BODY tag node is specified.
1436 * @return The conversion result is returned.
1439 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1444 chtml10 = GET_CHTML10(pdoc);
1449 return chtml10->out;
1454 * It is a handler who processes the A tag.
1456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1457 * destination is specified.
1458 * @param node [i] The A tag node is specified.
1459 * @return The conversion result is returned.
1462 s_chtml10_start_a_tag(void *pdoc, Node *node)
1469 chtml10 = GET_CHTML10(pdoc);
1475 /*--------------------------------------------------------------------------*/
1476 /* Get Attributes */
1477 /*--------------------------------------------------------------------------*/
1478 for (attr = qs_get_attr(doc,node);
1480 attr = qs_get_next_attr(doc,attr)) {
1481 char *name = qs_get_attr_name(doc,attr);
1482 char *value = qs_get_attr_value(doc,attr);
1486 if (strcasecmp(name, "name") == 0) {
1487 /*--------------------------------------------------------------------*/
1489 /*--------------------------------------------------------------------*/
1498 if (strcasecmp(name, "href") == 0) {
1499 /*--------------------------------------------------------------------*/
1501 /*--------------------------------------------------------------------*/
1502 value = chxj_encoding_parameter(r, value);
1503 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1512 if (strcasecmp(name, "accesskey") == 0) {
1513 /*--------------------------------------------------------------------*/
1515 /*--------------------------------------------------------------------*/
1516 W_L(" accesskey=\"");
1524 if (strcasecmp(name, "cti") == 0) {
1525 /*--------------------------------------------------------------------*/
1527 /*--------------------------------------------------------------------*/
1534 if (strcasecmp(name, "utn") == 0) {
1535 /*--------------------------------------------------------------------*/
1537 /*--------------------------------------------------------------------*/
1544 if (strcasecmp(name, "telbook") == 0) {
1545 /*--------------------------------------------------------------------*/
1547 /*--------------------------------------------------------------------*/
1554 if (strcasecmp(name, "kana") == 0) {
1555 /*--------------------------------------------------------------------*/
1557 /*--------------------------------------------------------------------*/
1564 if (strcasecmp(name, "email") == 0) {
1565 /*--------------------------------------------------------------------*/
1567 /*--------------------------------------------------------------------*/
1574 if (strcasecmp(name, "ista") == 0) {
1575 /*--------------------------------------------------------------------*/
1577 /*--------------------------------------------------------------------*/
1581 if (strcasecmp(name, "ilet") == 0) {
1582 /*--------------------------------------------------------------------*/
1584 /*--------------------------------------------------------------------*/
1588 if (strcasecmp(name, "iswf") == 0) {
1589 /*--------------------------------------------------------------------*/
1591 /*--------------------------------------------------------------------*/
1595 if (strcasecmp(name, "irst") == 0) {
1596 /*--------------------------------------------------------------------*/
1598 /*--------------------------------------------------------------------*/
1602 if (strcasecmp(name, "ijam") == 0) {
1603 /*--------------------------------------------------------------------*/
1605 /*--------------------------------------------------------------------*/
1616 return chtml10->out;
1621 * It is a handler who processes the A tag.
1623 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1624 * destination is specified.
1625 * @param node [i] The A tag node is specified.
1626 * @return The conversion result is returned.
1629 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1635 chtml10 = GET_CHTML10(pdoc);
1641 return chtml10->out;
1646 * It is a handler who processes the BR tag.
1648 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1649 * destination is specified.
1650 * @param node [i] The BR tag node is specified.
1651 * @return The conversion result is returned.
1654 s_chtml10_start_br_tag(void *pdoc, Node *node)
1661 chtml10 = GET_CHTML10(pdoc);
1667 /*--------------------------------------------------------------------------*/
1668 /* Get Attributes */
1669 /*--------------------------------------------------------------------------*/
1670 for (attr = qs_get_attr(doc,node);
1672 attr = qs_get_next_attr(doc,attr)) {
1673 char *name = qs_get_attr_name(doc,attr);
1674 char *value = qs_get_attr_value(doc,attr);
1675 if (STRCASEEQ('c','C',"clear",name)) {
1676 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1685 return chtml10->out;
1690 * It is a handler who processes the BR tag.
1692 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1693 * destination is specified.
1694 * @param node [i] The BR tag node is specified.
1695 * @return The conversion result is returned.
1698 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1700 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1702 return chtml10->out;
1707 * It is a handler who processes the TR tag.
1709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1710 * destination is specified.
1711 * @param node [i] The TR tag node is specified.
1712 * @return The conversion result is returned.
1715 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1717 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1719 return chtml10->out;
1724 * It is a handler who processes the TR tag.
1726 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1727 * destination is specified.
1728 * @param node [i] The TR tag node is specified.
1729 * @return The conversion result is returned.
1732 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1738 chtml10 = GET_CHTML10(pdoc);
1744 return chtml10->out;
1749 * It is a handler who processes the FONT tag.
1751 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1752 * destination is specified.
1753 * @param node [i] The FONT tag node is specified.
1754 * @return The conversion result is returned.
1757 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1759 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1763 return chtml10->out;
1768 * It is a handler who processes the FONT tag.
1770 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1771 * destination is specified.
1772 * @param node [i] The FONT tag node is specified.
1773 * @return The conversion result is returned.
1776 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1778 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1782 return chtml10->out;
1787 * It is a handler who processes the FORM tag.
1789 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1790 * destination is specified.
1791 * @param node [i] The FORM tag node is specified.
1792 * @return The conversion result is returned.
1795 s_chtml10_start_form_tag(void *pdoc, Node *node)
1802 chtml10 = GET_CHTML10(pdoc);
1808 /*--------------------------------------------------------------------------*/
1809 /* Get Attributes */
1810 /*--------------------------------------------------------------------------*/
1811 for (attr = qs_get_attr(doc,node);
1813 attr = qs_get_next_attr(doc,attr)) {
1814 char *name = qs_get_attr_name(doc,attr);
1815 char *value = qs_get_attr_value(doc,attr);
1819 if (strcasecmp(name, "action") == 0) {
1820 /*--------------------------------------------------------------------*/
1822 /*--------------------------------------------------------------------*/
1823 value = chxj_encoding_parameter(r, value);
1824 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1834 if (strcasecmp(name, "method") == 0) {
1835 /*--------------------------------------------------------------------*/
1837 /*--------------------------------------------------------------------*/
1846 if (strcasecmp(name, "utn") == 0) {
1847 /*--------------------------------------------------------------------*/
1849 /*--------------------------------------------------------------------*/
1861 return chtml10->out;
1866 * It is a handler who processes the FORM tag.
1868 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1869 * destination is specified.
1870 * @param node [i] The FORM tag node is specified.
1871 * @return The conversion result is returned.
1874 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1880 chtml10 = GET_CHTML10(pdoc);
1886 return chtml10->out;
1891 * It is a handler who processes the INPUT tag.
1893 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1894 * destination is specified.
1895 * @param node [i] The INPUT tag node is specified.
1896 * @return The conversion result is returned.
1899 s_chtml10_start_input_tag(void *pdoc, Node *node)
1913 chtml10 = GET_CHTML10(pdoc);
1928 /*--------------------------------------------------------------------------*/
1929 /* Get Attributes */
1930 /*--------------------------------------------------------------------------*/
1932 type = qs_get_type_attr(doc, node, doc->buf.pool);
1933 name = qs_get_name_attr(doc, node, doc->buf.pool);
1934 value = qs_get_value_attr(doc,node,doc->buf.pool);
1935 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1936 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1937 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
1938 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1939 size = qs_get_size_attr(doc, node, doc->buf.pool);
1942 type = qs_trim_string(doc->buf.pool, type);
1943 if (type && (STRCASEEQ('t','T',"text", type) ||
1944 STRCASEEQ('p','P',"password",type) ||
1945 STRCASEEQ('c','C',"checkbox",type) ||
1946 STRCASEEQ('r','R',"radio", type) ||
1947 STRCASEEQ('h','H',"hidden", type) ||
1948 STRCASEEQ('s','S',"submit", type) ||
1949 STRCASEEQ('r','R',"reset", type))) {
1956 if (size && *size != 0) {
1962 if (name && *name != 0) {
1968 if (value && *value != 0) {
1970 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1974 if (accesskey && *accesskey != 0) {
1975 W_L(" accesskey=\"");
1981 /*------------------------------------------------------------------------*/
1983 /*------------------------------------------------------------------------*/
1986 /*--------------------------------------------------------------------------*/
1987 /* The figure is default for the password. */
1988 /*--------------------------------------------------------------------------*/
1989 if (max_length && *max_length != 0) {
1990 W_L(" maxlength=\"");
2000 return chtml10->out;
2005 * It is a handler who processes the INPUT tag.
2007 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2008 * destination is specified.
2009 * @param node [i] The INPUT tag node is specified.
2010 * @return The conversion result is returned.
2013 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2015 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2017 return chtml10->out;
2022 * It is a handler who processes the CENTER tag.
2024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2025 * destination is specified.
2026 * @param node [i] The CENTER tag node is specified.
2027 * @return The conversion result is returned.
2030 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2036 chtml10 = GET_CHTML10(pdoc);
2042 return chtml10->out;
2047 * It is a handler who processes the CENTER tag.
2049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2050 * destination is specified.
2051 * @param node [i] The CENTER tag node is specified.
2052 * @return The conversion result is returned.
2055 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2061 chtml10 = GET_CHTML10(pdoc);
2067 return chtml10->out;
2072 * It is a handler who processes the HR tag.
2074 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2075 * destination is specified.
2076 * @param node [i] The HR tag node is specified.
2077 * @return The conversion result is returned.
2080 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2087 chtml10 = GET_CHTML10(pdoc);
2093 for (attr = qs_get_attr(doc,node);
2095 attr = qs_get_next_attr(doc,attr)) {
2096 char *name = qs_get_attr_name (doc,attr);
2097 char *value = qs_get_attr_value(doc,attr);
2101 if (strcasecmp(name, "align") == 0) {
2102 /*--------------------------------------------------------------------*/
2104 /*--------------------------------------------------------------------*/
2105 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2115 if (strcasecmp(name, "size") == 0) {
2116 /*--------------------------------------------------------------------*/
2118 /*--------------------------------------------------------------------*/
2119 if (value && value[0] != '\0') {
2129 if (strcasecmp(name, "width") == 0) {
2130 /*--------------------------------------------------------------------*/
2132 /*--------------------------------------------------------------------*/
2133 if (value && value[0] != '\0') {
2143 if (strcasecmp(name, "noshade") == 0) {
2144 /*--------------------------------------------------------------------*/
2146 /*--------------------------------------------------------------------*/
2153 if (strcasecmp(name, "color") == 0) {
2154 /*--------------------------------------------------------------------*/
2156 /*--------------------------------------------------------------------*/
2166 return chtml10->out;
2171 * It is a handler who processes the HR tag.
2173 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2174 * destination is specified.
2175 * @param node [i] The HR tag node is specified.
2176 * @return The conversion result is returned.
2179 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2181 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2184 return chtml10->out;
2189 * It is a handler who processes the IMG tag.
2191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2192 * destination is specified.
2193 * @param node [i] The IMG tag node is specified.
2194 * @return The conversion result is returned.
2197 s_chtml10_start_img_tag(void *pdoc, Node *node)
2203 #ifndef IMG_NOT_CONVERT_FILENAME
2207 chtml10 = GET_CHTML10(pdoc);
2208 #ifndef IMG_NOT_CONVERT_FILENAME
2209 spec = chtml10->spec;
2215 /*--------------------------------------------------------------------------*/
2216 /* Get Attributes */
2217 /*--------------------------------------------------------------------------*/
2218 for (attr = qs_get_attr(doc,node);
2220 attr = qs_get_next_attr(doc,attr)) {
2221 char *name = qs_get_attr_name (doc,attr);
2222 char *value = qs_get_attr_value(doc,attr);
2226 if (strcasecmp(name, "src") == 0) {
2227 /*--------------------------------------------------------------------*/
2229 /*--------------------------------------------------------------------*/
2230 #ifdef IMG_NOT_CONVERT_FILENAME
2231 value = chxj_encoding_parameter(r, value);
2232 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2234 value = apr_psprintf(doc->buf.pool,
2237 (strchr(value, '?')) ? '&' : '?',
2238 CHXJ_COOKIE_NOUPDATE_PARAM);
2244 value = chxj_img_conv(r, spec, value);
2245 value = chxj_encoding_parameter(r, value);
2246 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2248 value = apr_psprintf(doc->buf.pool,
2251 (strchr(value, '?')) ? '&' : '?',
2252 CHXJ_COOKIE_NOUPDATE_PARAM);
2263 if (strcasecmp(name, "align" ) == 0) {
2264 /*--------------------------------------------------------------------*/
2266 /*--------------------------------------------------------------------*/
2267 /*--------------------------------------------------------------------*/
2269 /*--------------------------------------------------------------------*/
2271 if (STRCASEEQ('t','T',"top", value) ||
2272 STRCASEEQ('m','M',"middle",value) ||
2273 STRCASEEQ('b','B',"bottom",value) ||
2274 STRCASEEQ('l','L',"left", value) ||
2275 STRCASEEQ('r','R',"right", value)) {
2280 else if (STRCASEEQ('c','C',"center", value)) {
2287 else if (strcasecmp(name, "alt" ) == 0) {
2288 /*--------------------------------------------------------------------*/
2290 /*--------------------------------------------------------------------*/
2291 if (value && value[0] != '\0') {
2301 if (strcasecmp(name, "width" ) == 0) {
2302 /*--------------------------------------------------------------------*/
2304 /*--------------------------------------------------------------------*/
2305 if (value && value[0] != '\0') {
2315 if (strcasecmp(name, "height") == 0) {
2316 /*--------------------------------------------------------------------*/
2318 /*--------------------------------------------------------------------*/
2319 if (value && value[0] != '\0') {
2326 if (strcasecmp(name, "hspace") == 0) {
2327 /*--------------------------------------------------------------------*/
2329 /*--------------------------------------------------------------------*/
2330 if (value && value[0] != '\0') {
2340 if (strcasecmp(name, "vspace") == 0) {
2341 /*--------------------------------------------------------------------*/
2343 /*--------------------------------------------------------------------*/
2344 if (value && value[0] != '\0') {
2358 return chtml10->out;
2363 * It is a handler who processes the IMG tag.
2365 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2366 * destination is specified.
2367 * @param node [i] The IMG tag node is specified.
2368 * @return The conversion result is returned.
2371 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2373 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2375 return chtml10->out;
2380 * It is a handler who processes the SELECT tag.
2382 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2383 * destination is specified.
2384 * @param node [i] The SELECT tag node is specified.
2385 * @return The conversion result is returned.
2388 s_chtml10_start_select_tag(void *pdoc, Node *child)
2398 chtml10 = GET_CHTML10(pdoc);
2406 for (attr = qs_get_attr(doc,child);
2408 attr = qs_get_next_attr(doc,attr)) {
2409 char *nm = qs_get_attr_name (doc,attr);
2410 char *val = qs_get_attr_value(doc,attr);
2414 if (strcasecmp(nm, "size") == 0) {
2415 /*--------------------------------------------------------------------*/
2416 /* CHTML 1.0 version 2.0 */
2417 /*--------------------------------------------------------------------*/
2418 size = apr_pstrdup(doc->buf.pool, val);
2424 if (strcasecmp(nm, "name") == 0) {
2425 /*--------------------------------------------------------------------*/
2426 /* CHTML 1.0 version 2.0 */
2427 /*--------------------------------------------------------------------*/
2428 name = apr_pstrdup(doc->buf.pool, val);
2434 if (strcasecmp(nm, "multiple") == 0) {
2435 /*--------------------------------------------------------------------*/
2436 /* CHTML 1.0 version 2.0 */
2437 /*--------------------------------------------------------------------*/
2447 if (size && *size != 0) {
2453 if (name && *name != 0) {
2460 return chtml10->out;
2465 * It is a handler who processes the SELECT tag.
2467 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2468 * destination is specified.
2469 * @param node [i] The SELECT tag node is specified.
2470 * @return The conversion result is returned.
2473 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2479 chtml10 = GET_CHTML10(pdoc);
2484 return chtml10->out;
2489 * It is a handler who processes the OPTION tag.
2491 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2492 * destination is specified.
2493 * @param node [i] The OPTION tag node is specified.
2494 * @return The conversion result is returned.
2497 s_chtml10_start_option_tag(void *pdoc, Node *child)
2506 chtml10 = GET_CHTML10(pdoc);
2515 for (attr = qs_get_attr(doc,child);
2517 attr = qs_get_next_attr(doc,attr)) {
2518 char *nm = qs_get_attr_name (doc,attr);
2519 char *val = qs_get_attr_value(doc,attr);
2523 if (strcasecmp(nm, "selected") == 0) {
2524 /*--------------------------------------------------------------------*/
2525 /* CHTML 1.0 version 2.0 */
2526 /*--------------------------------------------------------------------*/
2527 selected = apr_pstrdup(doc->buf.pool, val);
2533 if (strcasecmp(nm, "value") == 0) {
2534 /*--------------------------------------------------------------------*/
2535 /* CHTML 1.0 version 2.0 */
2536 /*--------------------------------------------------------------------*/
2537 value = apr_pstrdup(doc->buf.pool, val);
2546 if (value && *value != 0) {
2557 return chtml10->out;
2562 * It is a handler who processes the OPTION tag.
2564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2565 * destination is specified.
2566 * @param node [i] The OPTION tag node is specified.
2567 * @return The conversion result is returned.
2570 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2572 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2576 return chtml10->out;
2581 * It is a handler who processes the DIV tag.
2583 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2584 * destination is specified.
2585 * @param node [i] The DIV tag node is specified.
2586 * @return The conversion result is returned.
2589 s_chtml10_start_div_tag(void *pdoc, Node *child)
2597 chtml10 = GET_CHTML10(pdoc);
2604 for (attr = qs_get_attr(doc,child);
2606 attr = qs_get_next_attr(doc,attr)) {
2607 char *nm = qs_get_attr_name(doc,attr);
2608 char *val = qs_get_attr_value(doc,attr);
2609 if (STRCASEEQ('a','A',"align", nm)) {
2610 /*----------------------------------------------------------------------*/
2611 /* CHTML 1.0 (W3C version 3.2) */
2612 /*----------------------------------------------------------------------*/
2613 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2614 align = apr_pstrdup(doc->buf.pool, val);
2626 return chtml10->out;
2631 * It is a handler who processes the DIV tag.
2633 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2634 * destination is specified.
2635 * @param node [i] The DIV tag node is specified.
2636 * @return The conversion result is returned.
2639 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2645 chtml10 = GET_CHTML10(pdoc);
2650 return chtml10->out;
2655 * It is a handler who processes the CHXJ:IF tag.
2657 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2658 * destination is specified.
2659 * @param node [i] The CHXJ:IF tag node is specified.
2660 * @return The conversion result is returned.
2663 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2670 chtml10 = GET_CHTML10(pdoc);
2674 for (child = qs_get_child_node(doc, node);
2676 child = qs_get_next_node(doc, child)) {
2678 s_chtml10_chxjif_tag(chtml10, child);
2681 return chtml10->out;
2686 * It is a handler who processes the PRE tag.
2688 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2689 * destination is specified.
2690 * @param node [i] The PRE tag node is specified.
2691 * @return The conversion result is returned.
2694 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2700 chtml10 = GET_CHTML10(pdoc);
2704 chtml10->pre_flag++;
2706 return chtml10->out;
2711 * It is a handler who processes the PRE tag.
2713 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2714 * destination is specified.
2715 * @param node [i] The PRE tag node is specified.
2716 * @return The conversion result is returned.
2719 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2725 chtml10 = GET_CHTML10(pdoc);
2730 chtml10->pre_flag--;
2732 return chtml10->out;
2737 * It is a handler who processes the P tag.
2739 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2740 * destination is specified.
2741 * @param node [i] The P tag node is specified.
2742 * @return The conversion result is returned.
2745 s_chtml10_start_p_tag(void *pdoc, Node *node)
2753 chtml10 = GET_CHTML10(pdoc);
2758 for (attr = qs_get_attr(doc,node);
2760 attr = qs_get_next_attr(doc,attr)) {
2761 char *nm = qs_get_attr_name(doc,attr);
2762 char *val = qs_get_attr_value(doc,attr);
2763 if (STRCASEEQ('a','A',"align", nm)) {
2764 /*----------------------------------------------------------------------*/
2765 /* CHTML 1.0 (W3C version 3.2) */
2766 /*----------------------------------------------------------------------*/
2767 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2768 align = apr_pstrdup(doc->buf.pool, val);
2780 return chtml10->out;
2785 * It is a handler who processes the P tag.
2787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2788 * destination is specified.
2789 * @param node [i] The P tag node is specified.
2790 * @return The conversion result is returned.
2793 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2799 chtml10 = GET_CHTML10(pdoc);
2804 return chtml10->out;
2809 * It is a handler who processes the TEXTARE tag.
2811 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2812 * destination is specified.
2813 * @param node [i] The TEXTAREA tag node is specified.
2814 * @return The conversion result is returned.
2817 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2824 chtml10 = GET_CHTML10(pdoc);
2829 chtml10->textarea_flag++;
2833 for (attr = qs_get_attr(doc,node);
2835 attr = qs_get_next_attr(doc,attr)) {
2836 char *name = qs_get_attr_name (doc,attr);
2837 char *value = qs_get_attr_value(doc,attr);
2841 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2842 W_L(" accesskey=\"");
2850 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2859 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2868 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2880 return chtml10->out;
2885 * It is a handler who processes the TEXTAREA tag.
2887 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2888 * destination is specified.
2889 * @param node [i] The TEXTAREA tag node is specified.
2890 * @return The conversion result is returned.
2893 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2899 chtml10 = GET_CHTML10(pdoc);
2904 chtml10->textarea_flag--;
2906 return chtml10->out;
2911 s_chtml10_text(void *pdoc, Node *child)
2923 chtml10 = GET_CHTML10(pdoc);
2927 textval = qs_get_node_value(doc,child);
2928 if (strlen(textval) == 0) {
2929 return chtml10->out;
2932 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2933 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2935 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
2936 memset(one_byte, 0, sizeof(one_byte));
2939 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2943 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2945 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2950 if (is_sjis_kanji(textval[ii])) {
2951 one_byte[0] = textval[ii+0];
2952 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2953 one_byte[0] = textval[ii+1];
2954 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2958 if (chtml10->pre_flag) {
2959 one_byte[0] = textval[ii+0];
2960 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2963 if (chtml10->textarea_flag) {
2964 one_byte[0] = textval[ii+0];
2965 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2968 if (textval[ii] != '\r' && textval[ii] != '\n') {
2969 one_byte[0] = textval[ii+0];
2970 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2975 return chtml10->out;
2980 * It is a handler who processes the BLOCKQUOTE tag.
2982 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2983 * destination is specified.
2984 * @param node [i] The BLOCKQUOTE tag node is specified.
2985 * @return The conversion result is returned.
2988 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2992 chtml10 = GET_CHTML10(pdoc);
2994 W_L("<blockquote>");
2995 return chtml10->out;
3000 * It is a handler who processes the BLOCKQUOTE tag.
3002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3003 * destination is specified.
3004 * @param node [i] The BLOCKQUOTE tag node is specified.
3005 * @return The conversion result is returned.
3008 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3013 chtml10 = GET_CHTML10(pdoc);
3015 W_L("</blockquote>");
3016 return chtml10->out;
3021 * It is a handler who processes the DIR tag.
3023 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3024 * destination is specified.
3025 * @param node [i] The DIR tag node is specified.
3026 * @return The conversion result is returned.
3029 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3033 chtml10 = GET_CHTML10(pdoc);
3036 return chtml10->out;
3041 * It is a handler who processes the DIR tag.
3043 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3044 * destination is specified.
3045 * @param node [i] The DIR tag node is specified.
3046 * @return The conversion result is returned.
3049 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3054 chtml10 = GET_CHTML10(pdoc);
3057 return chtml10->out;
3062 * It is a handler who processes the DL tag.
3064 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3065 * destination is specified.
3066 * @param node [i] The DL tag node is specified.
3067 * @return The conversion result is returned.
3070 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3074 chtml10 = GET_CHTML10(pdoc);
3077 return chtml10->out;
3082 * It is a handler who processes the DL tag.
3084 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3085 * destination is specified.
3086 * @param node [i] The DL tag node is specified.
3087 * @return The conversion result is returned.
3090 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3094 chtml10 = GET_CHTML10(pdoc);
3097 return chtml10->out;
3102 * It is a handter who processes the DT tag.
3104 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3105 * destination is specified.
3106 * @param node [i] The DT tag node is specified.
3107 * @return The conversion result is returned.
3110 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3114 chtml10 = GET_CHTML10(pdoc);
3117 return chtml10->out;
3122 * It is a handter who processes the DT tag.
3124 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3125 * destination is specified.
3126 * @param node [i] The DT tag node is specified.
3127 * @return The conversion result is returned.
3130 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3132 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3134 return chtml10->out;
3139 * It is a handder who processes the DD tag.
3141 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3142 * destination is specified.
3143 * @param node [i] The DD tag node is specified.
3144 * @return The conversion result is returned.
3147 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3151 chtml10 = GET_CHTML10(pdoc);
3154 return chtml10->out;
3159 * It is a handder who processes the DD tag.
3161 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3162 * destination is specified.
3163 * @param node [i] The DD tag node is specified.
3164 * @return The conversion result is returned.
3167 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3169 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3170 return chtml10->out;
3175 * It is a hanmenuer who processes the MENU tag.
3177 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3178 * destination is specified.
3179 * @param node [i] The MENU tag node is specified.
3180 * @return The conversion result is returned.
3183 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3187 chtml10 = GET_CHTML10(pdoc);
3190 return chtml10->out;
3195 * It is a hanmenuer who processes the MENU tag.
3197 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3198 * destination is specified.
3199 * @param node [i] The MENU tag node is specified.
3200 * @return The conversion result is returned.
3203 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3205 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3206 Doc *doc = chtml10->doc;
3208 return chtml10->out;
3213 * It is a handler who processes the PLAINTEXT tag.
3215 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3216 * destination is specified.
3217 * @param node [i] The PLAINTEXT tag node is specified.
3218 * @return The conversion result is returned.
3221 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3226 chtml10 = GET_CHTML10(pdoc);
3229 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3230 return chtml10->out;
3234 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3239 chtml10 = GET_CHTML10(pdoc);
3241 for (child = qs_get_child_node(doc, node);
3243 child = qs_get_next_node(doc, child)) {
3245 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3247 return chtml10->out;
3252 * It is a handler who processes the PLAINTEXT tag.
3254 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3255 * destination is specified.
3256 * @param node [i] The PLAINTEXT tag node is specified.
3257 * @return The conversion result is returned.
3260 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3262 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3263 return chtml10->out;
3268 * It is handler who processes the New Line Code.
3271 s_chtml10_newline_mark(void *pdoc, Node *UNUSED(node))
3273 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3274 Doc *doc = chtml10->doc;
3276 return chtml10->out;