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);
112 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
114 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
115 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
116 static char *s_chtml10_text (void *pdoc, Node *node);
118 tag_handler chtml10_handler[] = {
121 s_chtml10_start_html_tag,
122 s_chtml10_end_html_tag,
126 s_chtml10_start_meta_tag,
127 s_chtml10_end_meta_tag,
131 s_chtml10_start_textarea_tag,
132 s_chtml10_end_textarea_tag,
136 s_chtml10_start_p_tag,
141 s_chtml10_start_pre_tag,
142 s_chtml10_end_pre_tag,
146 s_chtml10_start_ul_tag,
147 s_chtml10_end_ul_tag,
151 s_chtml10_start_li_tag,
152 s_chtml10_end_li_tag,
156 s_chtml10_start_ol_tag,
157 s_chtml10_end_ol_tag,
161 s_chtml10_start_h1_tag,
162 s_chtml10_end_h1_tag,
166 s_chtml10_start_h2_tag,
167 s_chtml10_end_h2_tag,
171 s_chtml10_start_h3_tag,
172 s_chtml10_end_h3_tag,
176 s_chtml10_start_h4_tag,
177 s_chtml10_end_h4_tag,
181 s_chtml10_start_h5_tag,
182 s_chtml10_end_h5_tag,
186 s_chtml10_start_h6_tag,
187 s_chtml10_end_h6_tag,
191 s_chtml10_start_head_tag,
192 s_chtml10_end_head_tag,
196 s_chtml10_start_title_tag,
197 s_chtml10_end_title_tag,
201 s_chtml10_start_base_tag,
202 s_chtml10_end_base_tag,
206 s_chtml10_start_body_tag,
207 s_chtml10_end_body_tag,
211 s_chtml10_start_a_tag,
216 s_chtml10_start_br_tag,
217 s_chtml10_end_br_tag,
226 s_chtml10_start_tr_tag,
227 s_chtml10_end_tr_tag,
241 s_chtml10_start_font_tag,
242 s_chtml10_end_font_tag,
246 s_chtml10_start_form_tag,
247 s_chtml10_end_form_tag,
251 s_chtml10_start_input_tag,
252 s_chtml10_end_input_tag,
256 s_chtml10_start_center_tag,
257 s_chtml10_end_center_tag,
261 s_chtml10_start_hr_tag,
262 s_chtml10_end_hr_tag,
266 s_chtml10_start_img_tag,
267 s_chtml10_end_img_tag,
271 s_chtml10_start_select_tag,
272 s_chtml10_end_select_tag,
276 s_chtml10_start_option_tag,
277 s_chtml10_end_option_tag,
281 s_chtml10_start_div_tag,
282 s_chtml10_end_div_tag,
286 s_chtml10_chxjif_tag,
331 s_chtml10_start_dt_tag,
332 s_chtml10_end_dt_tag,
346 s_chtml10_start_blockquote_tag,
347 s_chtml10_end_blockquote_tag,
351 s_chtml10_start_dir_tag,
352 s_chtml10_end_dir_tag,
356 s_chtml10_start_dl_tag,
357 s_chtml10_end_dl_tag,
361 s_chtml10_start_dd_tag,
362 s_chtml10_end_dd_tag,
366 s_chtml10_start_menu_tag,
367 s_chtml10_end_menu_tag,
371 s_chtml10_start_plaintext_tag,
372 s_chtml10_end_plaintext_tag,
388 * converts from CHTML5.0 to CHTML1.0.
390 * @param r [i] Requet_rec is appointed.
391 * @param spec [i] The result of the device specification processing which
392 * was done in advance is appointed.
393 * @param src [i] The character string before the converting is appointed.
394 * @return The character string after the converting is returned.
397 chxj_convert_chtml10(
403 chxjconvrule_entry *entryp,
416 DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
418 /*--------------------------------------------------------------------------*/
420 /*--------------------------------------------------------------------------*/
422 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
424 DBG(r,"i found qrcode xml");
427 DBG(r,"not found qrcode xml");
429 /*--------------------------------------------------------------------------*/
430 /* The CHTML structure is initialized. */
431 /*--------------------------------------------------------------------------*/
432 s_init_chtml10(&chtml10, &doc, r, spec);
433 chtml10.entryp = entryp;
434 chtml10.cookie = cookie;
436 chxj_set_content_type(r, "text/html; charset=Windows-31J");
438 /*--------------------------------------------------------------------------*/
439 /* The character string of the input is analyzed. */
440 /*--------------------------------------------------------------------------*/
441 qs_init_malloc(&doc);
442 qs_init_root_node(&doc);
444 ss = apr_pcalloc(r->pool, srclen + 1);
445 memset(ss, 0, srclen + 1);
446 memcpy(ss, src, srclen);
449 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
452 qs_parse_string(&doc,ss, strlen(ss));
454 chxj_buffered_write_init(r->pool, &doc.buf);
455 /*--------------------------------------------------------------------------*/
456 /* It converts it from CHTML to CHTML. */
457 /*--------------------------------------------------------------------------*/
458 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
459 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
460 dst = apr_pstrdup(r->pool, chtml10.out);
461 chxj_buffered_write_terminate(&doc.buf);
463 qs_all_free(&doc,QX_LOGMARK);
466 return apr_pstrdup(r->pool,ss);
469 if (strlen(dst) == 0) {
470 dst = apr_psprintf(r->pool, "\n");
472 *dstlen = strlen(dst);
475 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
478 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
485 * The CHTML structure is initialized.
487 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
488 * initialized is specified.
489 * @param doc [i] The Doc structure that should be set to the initialized
490 * HDML structure is specified.
491 * @param r [i] To use POOL, the pointer to request_rec is specified.
492 * @param spec [i] The pointer to the device_table
501 memset(doc, 0, sizeof(Doc));
502 memset(chtml10, 0, sizeof(chtml10_t));
506 chtml10->spec = spec;
507 chtml10->out = qs_alloc_zero_byte_string(r->pool);
508 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
509 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
514 * Corresponding EMOJI to a current character-code is retrieved.
515 * The substitution character string is stored in the rslt pointer if agreeing.
517 * @param chtml10 [i] The pointer to the CHTML structure is specified.
518 * @param txt [i] The character string to want to examine whether it is
519 * EMOJI is specified.
520 * @param rslt [o] The pointer to the pointer that stores the result is
522 * @return When corresponding EMOJI exists, it returns it excluding 0.
525 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
532 spec = chtml10->spec;
538 DBG(r,"spec is NULL");
541 for (ee = chtml10->conf->emoji;
546 DBG(r,"emoji->imode is NULL");
550 if (ee->imode->string
552 && strlen(ee->imode->string) > 0
553 && *ee->imode->string == *txt
554 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
555 if (!spec || !spec->emoji_type) {
556 *rslt = apr_palloc(r->pool, 3);
557 (*rslt)[0] = ee->imode->hex1byte & 0xff;
558 (*rslt)[1] = ee->imode->hex2byte & 0xff;
560 return strlen(ee->imode->string);
571 * It is a handler who processes the HTML tag.
573 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
574 * destination is specified.
575 * @param node [i] The HTML tag node is specified.
576 * @return The conversion result is returned.
579 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
585 chtml10 = GET_CHTML10(pdoc);
589 /*--------------------------------------------------------------------------*/
591 /*--------------------------------------------------------------------------*/
600 * It is a handler who processes the HTML tag.
602 * @param pdoc [i/o] The pointer to the CHTML structure at the output
603 * destination is specified.
604 * @param node [i] The HTML tag node is specified.
605 * @return The conversion result is returned.
608 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
615 chtml10 = GET_CHTML10(pdoc);
627 * It is a handler who processes the META tag.
629 * @param pdoc [i/o] The pointer to the CHTML structure at the output
630 * destination is specified.
631 * @param node [i] The META tag node is specified.
632 * @return The conversion result is returned.
635 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
637 chtml10_t *chtml10 = GET_CHTML10(pdoc);
646 * It is a handler who processes the META tag.
648 * @param pdoc [i/o] The pointer to the CHTML structure at the output
649 * destination is specified.
650 * @param node [i] The META tag node is specified.
651 * @return The conversion result is returned.
654 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
656 chtml10_t *chtml10 = GET_CHTML10(pdoc);
663 * It is a handler who processes the HEAD tag.
665 * @param pdoc [i/o] The pointer to the CHTML structure at the output
666 * destination is specified.
667 * @param node [i] The HEAD tag node is specified.
668 * @return The conversion result is returned.
671 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
677 chtml10 = GET_CHTML10(pdoc);
689 * It is a handler who processes the HEAD tag.
691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
692 * destination is specified.
693 * @param node [i] The HEAD tag node is specified.
694 * @return The conversion result is returned.
697 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
703 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);
741 * It is a handler who processes the OL tag.
743 * @param pdoc [i/o] The pointer to the CHTML structure at the output
744 * destination is specified.
745 * @param node [i] The OL tag node is specified.
746 * @return The conversion result is returned.
749 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
755 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);
793 * It is a handler who processes the UL tag.
795 * @param pdoc [i/o] The pointer to the CHTML structure at the output
796 * destination is specified.
797 * @param node [i] The UL tag node is specified.
798 * @return The conversion result is returned.
801 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
807 chtml10 = GET_CHTML10(pdoc);
819 * It is a handler who processes the LI tag.
821 * @param pdoc [i/o] The pointer to the CHTML structure at the output
822 * destination is specified.
823 * @param node [i] The LI tag node is specified.
824 * @return The conversion result is returned.
827 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
833 chtml10 = GET_CHTML10(pdoc);
844 * It is a handler who processes the LI tag.
846 * @param pdoc [i/o] The pointer to the CHTML structure at the output
847 * destination is specified.
848 * @param node [i] The LI tag node is specified.
849 * @return The conversion result is returned.
852 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
854 chtml10_t *chtml10 = GET_CHTML10(pdoc);
860 * It is a handler who processes the H1 tag.
862 * @param pdoc [i/o] The pointer to the CHTML structure at the output
863 * destination is specified.
864 * @param node [i] The H1 tag node is specified.
865 * @return The conversion result is returned.
868 s_chtml10_start_h1_tag(void *pdoc, Node *node)
875 chtml10 = GET_CHTML10(pdoc);
880 for (attr = qs_get_attr(doc,node);
882 attr = qs_get_next_attr(doc,attr)) {
883 char *name = qs_get_attr_name(doc,attr);
884 char *value = qs_get_attr_value(doc,attr);
885 if (STRCASEEQ('a','A',"align", name)) {
886 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
901 * It is a handler who processes the H1 tag.
903 * @param pdoc [i/o] The pointer to the CHTML structure at the output
904 * destination is specified.
905 * @param node [i] The H1 tag node is specified.
906 * @return The conversion result is returned.
909 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
915 chtml10 = GET_CHTML10(pdoc);
927 * It is a handler who processes the H2 tag.
929 * @param pdoc [i/o] The pointer to the CHTML structure at the output
930 * destination is specified.
931 * @param node [i] The H2 tag node is specified.
932 * @return The conversion result is returned.
935 s_chtml10_start_h2_tag(void *pdoc, Node *node)
941 chtml10 = GET_CHTML10(pdoc);
945 for (attr = qs_get_attr(doc,node);
947 attr = qs_get_next_attr(doc,attr)) {
948 char *name = qs_get_attr_name(doc,attr);
949 char *value = qs_get_attr_value(doc,attr);
950 if (STRCASEEQ('a','A',"align", name)) {
951 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
966 * It is a handler who processes the H2 tag.
968 * @param pdoc [i/o] The pointer to the CHTML structure at the output
969 * destination is specified.
970 * @param node [i] The H2 tag node is specified.
971 * @return The conversion result is returned.
974 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
980 chtml10 = GET_CHTML10(pdoc);
992 * It is a handler who processes the H3 tag.
994 * @param pdoc [i/o] The pointer to the CHTML structure at the output
995 * destination is specified.
996 * @param node [i] The H3 tag node is specified.
997 * @return The conversion result is returned.
1000 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1007 chtml10 = GET_CHTML10(pdoc);
1012 for (attr = qs_get_attr(doc,node);
1014 attr = qs_get_next_attr(doc,attr)) {
1015 char *name = qs_get_attr_name(doc,attr);
1016 char *value = qs_get_attr_value(doc,attr);
1017 if (STRCASEEQ('a','A',"align", name)) {
1018 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1028 return chtml10->out;
1033 * It is a handler who processes the H3 tag.
1035 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1036 * destination is specified.
1037 * @param node [i] The H3 tag node is specified.
1038 * @return The conversion result is returned.
1041 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1047 chtml10 = GET_CHTML10(pdoc);
1054 return chtml10->out;
1059 * It is a handler who processes the H4 tag.
1061 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1062 * destination is specified.
1063 * @param node [i] The H4 tag node is specified.
1064 * @return The conversion result is returned.
1067 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1073 chtml10 = GET_CHTML10(pdoc);
1077 for (attr = qs_get_attr(doc,node);
1079 attr = qs_get_next_attr(doc,attr)) {
1080 char *name = qs_get_attr_name(doc,attr);
1081 char *value = qs_get_attr_value(doc,attr);
1082 if (STRCASEEQ('a','A',"align", name)) {
1083 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1093 return chtml10->out;
1098 * It is a handler who processes the H4 tag.
1100 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1101 * destination is specified.
1102 * @param node [i] The H4 tag node is specified.
1103 * @return The conversion result is returned.
1106 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1111 chtml10 = GET_CHTML10(pdoc);
1117 return chtml10->out;
1122 * It is a handler who processes the H5 tag.
1124 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1125 * destination is specified.
1126 * @param node [i] The H5 tag node is specified.
1127 * @return The conversion result is returned.
1130 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1137 chtml10 = GET_CHTML10(pdoc);
1142 for (attr = qs_get_attr(doc,node);
1144 attr = qs_get_next_attr(doc,attr)) {
1145 char *name = qs_get_attr_name(doc,attr);
1146 char *value = qs_get_attr_value(doc,attr);
1147 if (STRCASEEQ('a','A',"align", name)) {
1148 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1158 return chtml10->out;
1163 * It is a handler who processes the H5 tag.
1165 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1166 * destination is specified.
1167 * @param node [i] The H5 tag node is specified.
1168 * @return The conversion result is returned.
1171 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1176 chtml10 = GET_CHTML10(pdoc);
1182 return chtml10->out;
1187 * It is a handler who processes the H6 tag.
1189 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1190 * destination is specified.
1191 * @param node [i] The H6 tag node is specified.
1192 * @return The conversion result is returned.
1195 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1201 chtml10 = GET_CHTML10(pdoc);
1205 for (attr = qs_get_attr(doc,node);
1207 attr = qs_get_next_attr(doc,attr)) {
1208 char *name = qs_get_attr_name(doc,attr);
1209 char *value = qs_get_attr_value(doc,attr);
1210 if (STRCASEEQ('a','A',"align", name)) {
1211 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1221 return chtml10->out;
1226 * It is a handler who processes the H6 tag.
1228 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1229 * destination is specified.
1230 * @param node [i] The H6 tag node is specified.
1231 * @return The conversion result is returned.
1234 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1239 chtml10 = GET_CHTML10(pdoc);
1245 return chtml10->out;
1250 * It is a handler who processes the TITLE tag.
1252 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1253 * destination is specified.
1254 * @param node [i] The TITLE tag node is specified.
1255 * @return The conversion result is returned.
1258 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1263 chtml10 = GET_CHTML10(pdoc);
1268 return chtml10->out;
1273 * It is a handler who processes the TITLE tag.
1275 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1276 * destination is specified.
1277 * @param node [i] The TITLE tag node is specified.
1278 * @return The conversion result is returned.
1281 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1286 chtml10 = GET_CHTML10(pdoc);
1292 return chtml10->out;
1297 * It is a handler who processes the BASE tag.
1299 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1300 * destination is specified.
1301 * @param node [i] The BASE tag node is specified.
1302 * @return The conversion result is returned.
1305 s_chtml10_start_base_tag(void *pdoc, Node *node)
1311 chtml10 = GET_CHTML10(pdoc);
1315 /*--------------------------------------------------------------------------*/
1316 /* Get Attributes */
1317 /*--------------------------------------------------------------------------*/
1318 for (attr = qs_get_attr(doc,node);
1320 attr = qs_get_next_attr(doc,attr)) {
1321 char *name = qs_get_attr_name(doc,attr);
1322 char *value = qs_get_attr_value(doc,attr);
1323 if (STRCASEEQ('h','H',"href", name)) {
1333 return chtml10->out;
1338 * It is a handler who processes the BASE tag.
1340 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1341 * destination is specified.
1342 * @param node [i] The BASE tag node is specified.
1343 * @return The conversion result is returned.
1346 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1348 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1350 return chtml10->out;
1355 * It is a handler who processes the BODY tag.
1357 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1358 * destination is specified.
1359 * @param node [i] The BODY tag node is specified.
1360 * @return The conversion result is returned.
1363 s_chtml10_start_body_tag(void *pdoc, Node *node)
1369 chtml10 = GET_CHTML10(pdoc);
1373 /*--------------------------------------------------------------------------*/
1374 /* Get Attributes */
1375 /*--------------------------------------------------------------------------*/
1376 for (attr = qs_get_attr(doc,node);
1378 attr = qs_get_next_attr(doc,attr)) {
1379 char *name = qs_get_attr_name(doc,attr);
1383 if (strcasecmp(name, "alink") == 0) {
1384 /*----------------------------------------------------------------------*/
1386 /*----------------------------------------------------------------------*/
1393 if (strcasecmp(name, "bgcolor") == 0) {
1394 /*----------------------------------------------------------------------*/
1396 /*----------------------------------------------------------------------*/
1403 if (strcasecmp(name, "text") == 0) {
1404 /*----------------------------------------------------------------------*/
1406 /*----------------------------------------------------------------------*/
1413 if (strcasecmp(name, "link") == 0) {
1414 /*----------------------------------------------------------------------*/
1416 /*----------------------------------------------------------------------*/
1423 if (strcasecmp(name, "vlink") == 0) {
1424 /*----------------------------------------------------------------------*/
1426 /*----------------------------------------------------------------------*/
1439 return chtml10->out;
1444 * It is a handler who processes the BODY tag.
1446 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1447 * destination is specified.
1448 * @param node [i] The BODY tag node is specified.
1449 * @return The conversion result is returned.
1452 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1457 chtml10 = GET_CHTML10(pdoc);
1463 return chtml10->out;
1468 * It is a handler who processes the A tag.
1470 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1471 * destination is specified.
1472 * @param node [i] The A tag node is specified.
1473 * @return The conversion result is returned.
1476 s_chtml10_start_a_tag(void *pdoc, Node *node)
1483 chtml10 = GET_CHTML10(pdoc);
1489 /*--------------------------------------------------------------------------*/
1490 /* Get Attributes */
1491 /*--------------------------------------------------------------------------*/
1492 for (attr = qs_get_attr(doc,node);
1494 attr = qs_get_next_attr(doc,attr)) {
1495 char *name = qs_get_attr_name(doc,attr);
1496 char *value = qs_get_attr_value(doc,attr);
1500 if (strcasecmp(name, "name") == 0) {
1501 /*--------------------------------------------------------------------*/
1503 /*--------------------------------------------------------------------*/
1512 if (strcasecmp(name, "href") == 0) {
1513 /*--------------------------------------------------------------------*/
1515 /*--------------------------------------------------------------------*/
1516 value = chxj_encoding_parameter(r, value);
1517 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1526 if (strcasecmp(name, "accesskey") == 0) {
1527 /*--------------------------------------------------------------------*/
1529 /*--------------------------------------------------------------------*/
1530 W_L(" accesskey=\"");
1538 if (strcasecmp(name, "cti") == 0) {
1539 /*--------------------------------------------------------------------*/
1541 /*--------------------------------------------------------------------*/
1548 if (strcasecmp(name, "utn") == 0) {
1549 /*--------------------------------------------------------------------*/
1551 /*--------------------------------------------------------------------*/
1558 if (strcasecmp(name, "telbook") == 0) {
1559 /*--------------------------------------------------------------------*/
1561 /*--------------------------------------------------------------------*/
1568 if (strcasecmp(name, "kana") == 0) {
1569 /*--------------------------------------------------------------------*/
1571 /*--------------------------------------------------------------------*/
1578 if (strcasecmp(name, "email") == 0) {
1579 /*--------------------------------------------------------------------*/
1581 /*--------------------------------------------------------------------*/
1588 if (strcasecmp(name, "ista") == 0) {
1589 /*--------------------------------------------------------------------*/
1591 /*--------------------------------------------------------------------*/
1595 if (strcasecmp(name, "ilet") == 0) {
1596 /*--------------------------------------------------------------------*/
1598 /*--------------------------------------------------------------------*/
1602 if (strcasecmp(name, "iswf") == 0) {
1603 /*--------------------------------------------------------------------*/
1605 /*--------------------------------------------------------------------*/
1609 if (strcasecmp(name, "irst") == 0) {
1610 /*--------------------------------------------------------------------*/
1612 /*--------------------------------------------------------------------*/
1616 if (strcasecmp(name, "ijam") == 0) {
1617 /*--------------------------------------------------------------------*/
1619 /*--------------------------------------------------------------------*/
1630 return chtml10->out;
1635 * It is a handler who processes the A tag.
1637 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1638 * destination is specified.
1639 * @param node [i] The A tag node is specified.
1640 * @return The conversion result is returned.
1643 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1649 chtml10 = GET_CHTML10(pdoc);
1655 return chtml10->out;
1660 * It is a handler who processes the BR tag.
1662 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1663 * destination is specified.
1664 * @param node [i] The BR tag node is specified.
1665 * @return The conversion result is returned.
1668 s_chtml10_start_br_tag(void *pdoc, Node *node)
1675 chtml10 = GET_CHTML10(pdoc);
1681 /*--------------------------------------------------------------------------*/
1682 /* Get Attributes */
1683 /*--------------------------------------------------------------------------*/
1684 for (attr = qs_get_attr(doc,node);
1686 attr = qs_get_next_attr(doc,attr)) {
1687 char *name = qs_get_attr_name(doc,attr);
1688 char *value = qs_get_attr_value(doc,attr);
1689 if (STRCASEEQ('c','C',"clear",name)) {
1690 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1699 return chtml10->out;
1704 * It is a handler who processes the BR tag.
1706 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1707 * destination is specified.
1708 * @param node [i] The BR tag node is specified.
1709 * @return The conversion result is returned.
1712 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1714 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1716 return chtml10->out;
1721 * It is a handler who processes the TR tag.
1723 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1724 * destination is specified.
1725 * @param node [i] The TR tag node is specified.
1726 * @return The conversion result is returned.
1729 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1731 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1733 return chtml10->out;
1738 * It is a handler who processes the TR tag.
1740 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1741 * destination is specified.
1742 * @param node [i] The TR tag node is specified.
1743 * @return The conversion result is returned.
1746 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1752 chtml10 = GET_CHTML10(pdoc);
1759 return chtml10->out;
1764 * It is a handler who processes the FONT tag.
1766 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1767 * destination is specified.
1768 * @param node [i] The FONT tag node is specified.
1769 * @return The conversion result is returned.
1772 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1774 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1778 return chtml10->out;
1783 * It is a handler who processes the FONT tag.
1785 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1786 * destination is specified.
1787 * @param node [i] The FONT tag node is specified.
1788 * @return The conversion result is returned.
1791 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1793 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1797 return chtml10->out;
1802 * It is a handler who processes the FORM tag.
1804 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1805 * destination is specified.
1806 * @param node [i] The FORM tag node is specified.
1807 * @return The conversion result is returned.
1810 s_chtml10_start_form_tag(void *pdoc, Node *node)
1817 chtml10 = GET_CHTML10(pdoc);
1823 /*--------------------------------------------------------------------------*/
1824 /* Get Attributes */
1825 /*--------------------------------------------------------------------------*/
1826 for (attr = qs_get_attr(doc,node);
1828 attr = qs_get_next_attr(doc,attr)) {
1829 char *name = qs_get_attr_name(doc,attr);
1830 char *value = qs_get_attr_value(doc,attr);
1834 if (strcasecmp(name, "action") == 0) {
1835 /*--------------------------------------------------------------------*/
1837 /*--------------------------------------------------------------------*/
1838 value = chxj_encoding_parameter(r, value);
1839 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1849 if (strcasecmp(name, "method") == 0) {
1850 /*--------------------------------------------------------------------*/
1852 /*--------------------------------------------------------------------*/
1861 if (strcasecmp(name, "utn") == 0) {
1862 /*--------------------------------------------------------------------*/
1864 /*--------------------------------------------------------------------*/
1877 return chtml10->out;
1882 * It is a handler who processes the FORM tag.
1884 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1885 * destination is specified.
1886 * @param node [i] The FORM tag node is specified.
1887 * @return The conversion result is returned.
1890 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1896 chtml10 = GET_CHTML10(pdoc);
1903 return chtml10->out;
1908 * It is a handler who processes the INPUT tag.
1910 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1911 * destination is specified.
1912 * @param node [i] The INPUT tag node is specified.
1913 * @return The conversion result is returned.
1916 s_chtml10_start_input_tag(void *pdoc, Node *node)
1930 chtml10 = GET_CHTML10(pdoc);
1945 /*--------------------------------------------------------------------------*/
1946 /* Get Attributes */
1947 /*--------------------------------------------------------------------------*/
1949 type = qs_get_type_attr(doc, node, doc->buf.pool);
1950 name = qs_get_name_attr(doc, node, doc->buf.pool);
1951 value = qs_get_value_attr(doc,node,doc->buf.pool);
1952 istyle = qs_get_istyle_attr(doc,node,r);
1953 max_length = qs_get_maxlength_attr(doc,node,r);
1954 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
1955 accesskey = qs_get_accesskey_attr(doc, node, r);
1956 size = qs_get_size_attr(doc, node, doc->buf.pool);
1959 type = qs_trim_string(doc->buf.pool, type);
1960 if (type && (STRCASEEQ('t','T',"text", type) ||
1961 STRCASEEQ('p','P',"password",type) ||
1962 STRCASEEQ('c','C',"checkbox",type) ||
1963 STRCASEEQ('r','R',"radio", type) ||
1964 STRCASEEQ('h','H',"hidden", type) ||
1965 STRCASEEQ('s','S',"submit", type) ||
1966 STRCASEEQ('r','R',"reset", type))) {
1973 if (size && *size != 0) {
1979 if (name && *name != 0) {
1985 if (value && *value != 0) {
1991 if (accesskey && *accesskey != 0) {
1992 W_L(" accesskey=\"");
1998 /*------------------------------------------------------------------------*/
2000 /*------------------------------------------------------------------------*/
2003 /*--------------------------------------------------------------------------*/
2004 /* The figure is default for the password. */
2005 /*--------------------------------------------------------------------------*/
2006 if (max_length && *max_length != 0) {
2007 W_L(" maxlength=\"");
2018 return chtml10->out;
2023 * It is a handler who processes the INPUT tag.
2025 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2026 * destination is specified.
2027 * @param node [i] The INPUT tag node is specified.
2028 * @return The conversion result is returned.
2031 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2033 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2035 return chtml10->out;
2040 * It is a handler who processes the CENTER tag.
2042 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2043 * destination is specified.
2044 * @param node [i] The CENTER tag node is specified.
2045 * @return The conversion result is returned.
2048 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2054 chtml10 = GET_CHTML10(pdoc);
2060 return chtml10->out;
2065 * It is a handler who processes the CENTER tag.
2067 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2068 * destination is specified.
2069 * @param node [i] The CENTER tag node is specified.
2070 * @return The conversion result is returned.
2073 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2079 chtml10 = GET_CHTML10(pdoc);
2086 return chtml10->out;
2091 * It is a handler who processes the HR tag.
2093 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2094 * destination is specified.
2095 * @param node [i] The HR tag node is specified.
2096 * @return The conversion result is returned.
2099 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2106 chtml10 = GET_CHTML10(pdoc);
2112 for (attr = qs_get_attr(doc,node);
2114 attr = qs_get_next_attr(doc,attr)) {
2115 char *name = qs_get_attr_name (doc,attr);
2116 char *value = qs_get_attr_value(doc,attr);
2120 if (strcasecmp(name, "align") == 0) {
2121 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2124 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2134 if (strcasecmp(name, "size") == 0) {
2135 /*--------------------------------------------------------------------*/
2137 /*--------------------------------------------------------------------*/
2138 if (value && value[0] != '\0') {
2148 if (strcasecmp(name, "width") == 0) {
2149 /*--------------------------------------------------------------------*/
2151 /*--------------------------------------------------------------------*/
2152 if (value && value[0] != '\0') {
2162 if (strcasecmp(name, "noshade") == 0) {
2163 /*--------------------------------------------------------------------*/
2165 /*--------------------------------------------------------------------*/
2172 if (strcasecmp(name, "color") == 0) {
2173 /*--------------------------------------------------------------------*/
2175 /*--------------------------------------------------------------------*/
2186 return chtml10->out;
2191 * It is a handler who processes the HR tag.
2193 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2194 * destination is specified.
2195 * @param node [i] The HR tag node is specified.
2196 * @return The conversion result is returned.
2199 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2201 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2204 return chtml10->out;
2209 * It is a handler who processes the IMG tag.
2211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2212 * destination is specified.
2213 * @param node [i] The IMG tag node is specified.
2214 * @return The conversion result is returned.
2217 s_chtml10_start_img_tag(void *pdoc, Node *node)
2223 #ifndef IMG_NOT_CONVERT_FILENAME
2227 chtml10 = GET_CHTML10(pdoc);
2228 #ifndef IMG_NOT_CONVERT_FILENAME
2229 spec = chtml10->spec;
2235 /*--------------------------------------------------------------------------*/
2236 /* Get Attributes */
2237 /*--------------------------------------------------------------------------*/
2238 for (attr = qs_get_attr(doc,node);
2240 attr = qs_get_next_attr(doc,attr)) {
2241 char *name = qs_get_attr_name (doc,attr);
2242 char *value = qs_get_attr_value(doc,attr);
2246 if (strcasecmp(name, "src") == 0) {
2247 /*--------------------------------------------------------------------*/
2249 /*--------------------------------------------------------------------*/
2250 #ifdef IMG_NOT_CONVERT_FILENAME
2251 value = chxj_encoding_parameter(r, value);
2252 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2254 value = apr_psprintf(doc->buf.pool,
2257 (strchr(value, '?')) ? '&' : '?',
2258 CHXJ_COOKIE_NOUPDATE_PARAM);
2264 value = chxj_img_conv(r, spec, value);
2265 value = chxj_encoding_parameter(r, value);
2266 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2268 value = apr_psprintf(doc->buf.pool,
2271 (strchr(value, '?')) ? '&' : '?',
2272 CHXJ_COOKIE_NOUPDATE_PARAM);
2283 if (strcasecmp(name, "align" ) == 0) {
2284 /*--------------------------------------------------------------------*/
2286 /*--------------------------------------------------------------------*/
2287 /*--------------------------------------------------------------------*/
2289 /*--------------------------------------------------------------------*/
2291 if (STRCASEEQ('t','T',"top", value) ||
2292 STRCASEEQ('m','M',"middle",value) ||
2293 STRCASEEQ('b','B',"bottom",value) ||
2294 STRCASEEQ('l','L',"left", value) ||
2295 STRCASEEQ('r','R',"right", value)) {
2300 else if (STRCASEEQ('c','C',"center", value)) {
2307 else if (strcasecmp(name, "alt" ) == 0) {
2308 /*--------------------------------------------------------------------*/
2310 /*--------------------------------------------------------------------*/
2311 if (value && value[0] != '\0') {
2321 if (strcasecmp(name, "width" ) == 0) {
2322 /*--------------------------------------------------------------------*/
2324 /*--------------------------------------------------------------------*/
2325 if (value && value[0] != '\0') {
2335 if (strcasecmp(name, "height") == 0) {
2336 /*--------------------------------------------------------------------*/
2338 /*--------------------------------------------------------------------*/
2339 if (value && value[0] != '\0') {
2346 if (strcasecmp(name, "hspace") == 0) {
2347 /*--------------------------------------------------------------------*/
2349 /*--------------------------------------------------------------------*/
2350 if (value && value[0] != '\0') {
2360 if (strcasecmp(name, "vspace") == 0) {
2361 /*--------------------------------------------------------------------*/
2363 /*--------------------------------------------------------------------*/
2364 if (value && value[0] != '\0') {
2379 return chtml10->out;
2384 * It is a handler who processes the IMG tag.
2386 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2387 * destination is specified.
2388 * @param node [i] The IMG tag node is specified.
2389 * @return The conversion result is returned.
2392 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2394 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2396 return chtml10->out;
2401 * It is a handler who processes the SELECT tag.
2403 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2404 * destination is specified.
2405 * @param node [i] The SELECT tag node is specified.
2406 * @return The conversion result is returned.
2409 s_chtml10_start_select_tag(void *pdoc, Node *child)
2419 chtml10 = GET_CHTML10(pdoc);
2427 for (attr = qs_get_attr(doc,child);
2429 attr = qs_get_next_attr(doc,attr)) {
2430 char *nm = qs_get_attr_name (doc,attr);
2431 char *val = qs_get_attr_value(doc,attr);
2435 if (strcasecmp(nm, "size") == 0) {
2436 /*--------------------------------------------------------------------*/
2437 /* CHTML 1.0 version 2.0 */
2438 /*--------------------------------------------------------------------*/
2439 size = apr_pstrdup(doc->buf.pool, val);
2445 if (strcasecmp(nm, "name") == 0) {
2446 /*--------------------------------------------------------------------*/
2447 /* CHTML 1.0 version 2.0 */
2448 /*--------------------------------------------------------------------*/
2449 name = apr_pstrdup(doc->buf.pool, val);
2455 if (strcasecmp(nm, "multiple") == 0) {
2456 /*--------------------------------------------------------------------*/
2457 /* CHTML 1.0 version 2.0 */
2458 /*--------------------------------------------------------------------*/
2468 if (size && *size != 0) {
2474 if (name && *name != 0) {
2482 return chtml10->out;
2487 * It is a handler who processes the SELECT tag.
2489 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2490 * destination is specified.
2491 * @param node [i] The SELECT tag node is specified.
2492 * @return The conversion result is returned.
2495 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2501 chtml10 = GET_CHTML10(pdoc);
2507 return chtml10->out;
2512 * It is a handler who processes the OPTION tag.
2514 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2515 * destination is specified.
2516 * @param node [i] The OPTION tag node is specified.
2517 * @return The conversion result is returned.
2520 s_chtml10_start_option_tag(void *pdoc, Node *child)
2529 chtml10 = GET_CHTML10(pdoc);
2538 for (attr = qs_get_attr(doc,child);
2540 attr = qs_get_next_attr(doc,attr)) {
2541 char *nm = qs_get_attr_name (doc,attr);
2542 char *val = qs_get_attr_value(doc,attr);
2546 if (strcasecmp(nm, "selected") == 0) {
2547 /*--------------------------------------------------------------------*/
2548 /* CHTML 1.0 version 2.0 */
2549 /*--------------------------------------------------------------------*/
2550 selected = apr_pstrdup(doc->buf.pool, val);
2556 if (strcasecmp(nm, "value") == 0) {
2557 /*--------------------------------------------------------------------*/
2558 /* CHTML 1.0 version 2.0 */
2559 /*--------------------------------------------------------------------*/
2560 value = apr_pstrdup(doc->buf.pool, val);
2569 if (value && *value != 0) {
2580 return chtml10->out;
2585 * It is a handler who processes the OPTION tag.
2587 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2588 * destination is specified.
2589 * @param node [i] The OPTION tag node is specified.
2590 * @return The conversion result is returned.
2593 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2595 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2596 Doc *doc = chtml10->doc;
2601 return chtml10->out;
2606 * It is a handler who processes the DIV tag.
2608 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2609 * destination is specified.
2610 * @param node [i] The DIV tag node is specified.
2611 * @return The conversion result is returned.
2614 s_chtml10_start_div_tag(void *pdoc, Node *child)
2622 chtml10 = GET_CHTML10(pdoc);
2629 for (attr = qs_get_attr(doc,child);
2631 attr = qs_get_next_attr(doc,attr)) {
2632 char *nm = qs_get_attr_name(doc,attr);
2633 char *val = qs_get_attr_value(doc,attr);
2634 if (STRCASEEQ('a','A',"align", nm)) {
2635 /*----------------------------------------------------------------------*/
2636 /* CHTML 1.0 (W3C version 3.2) */
2637 /*----------------------------------------------------------------------*/
2638 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2639 align = apr_pstrdup(doc->buf.pool, val);
2652 return chtml10->out;
2657 * It is a handler who processes the DIV tag.
2659 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2660 * destination is specified.
2661 * @param node [i] The DIV tag node is specified.
2662 * @return The conversion result is returned.
2665 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2671 chtml10 = GET_CHTML10(pdoc);
2677 return chtml10->out;
2682 * It is a handler who processes the CHXJ:IF tag.
2684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2685 * destination is specified.
2686 * @param node [i] The CHXJ:IF tag node is specified.
2687 * @return The conversion result is returned.
2690 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2697 chtml10 = GET_CHTML10(pdoc);
2701 for (child = qs_get_child_node(doc, node);
2703 child = qs_get_next_node(doc, child)) {
2705 s_chtml10_chxjif_tag(chtml10, child);
2708 return chtml10->out;
2713 * It is a handler who processes the PRE tag.
2715 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2716 * destination is specified.
2717 * @param node [i] The PRE tag node is specified.
2718 * @return The conversion result is returned.
2721 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2727 chtml10 = GET_CHTML10(pdoc);
2731 chtml10->pre_flag++;
2734 return chtml10->out;
2739 * It is a handler who processes the PRE tag.
2741 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2742 * destination is specified.
2743 * @param node [i] The PRE tag node is specified.
2744 * @return The conversion result is returned.
2747 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2753 chtml10 = GET_CHTML10(pdoc);
2759 chtml10->pre_flag--;
2761 return chtml10->out;
2766 * It is a handler who processes the P tag.
2768 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2769 * destination is specified.
2770 * @param node [i] The P tag node is specified.
2771 * @return The conversion result is returned.
2774 s_chtml10_start_p_tag(void *pdoc, Node *node)
2782 chtml10 = GET_CHTML10(pdoc);
2787 for (attr = qs_get_attr(doc,node);
2789 attr = qs_get_next_attr(doc,attr)) {
2790 char *nm = qs_get_attr_name(doc,attr);
2791 char *val = qs_get_attr_value(doc,attr);
2792 if (STRCASEEQ('a','A',"align", nm)) {
2793 /*----------------------------------------------------------------------*/
2794 /* CHTML 1.0 (W3C version 3.2) */
2795 /*----------------------------------------------------------------------*/
2796 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2797 align = apr_pstrdup(doc->buf.pool, val);
2810 return chtml10->out;
2815 * It is a handler who processes the P tag.
2817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2818 * destination is specified.
2819 * @param node [i] The P tag node is specified.
2820 * @return The conversion result is returned.
2823 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2829 chtml10 = GET_CHTML10(pdoc);
2835 return chtml10->out;
2840 * It is a handler who processes the TEXTARE tag.
2842 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2843 * destination is specified.
2844 * @param node [i] The TEXTAREA tag node is specified.
2845 * @return The conversion result is returned.
2848 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2855 chtml10 = GET_CHTML10(pdoc);
2860 chtml10->textarea_flag++;
2864 for (attr = qs_get_attr(doc,node);
2866 attr = qs_get_next_attr(doc,attr)) {
2867 char *name = qs_get_attr_name (doc,attr);
2868 char *value = qs_get_attr_value(doc,attr);
2872 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2873 W_L(" accesskey=\"");
2881 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2890 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2899 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2912 return chtml10->out;
2917 * It is a handler who processes the TEXTAREA tag.
2919 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2920 * destination is specified.
2921 * @param node [i] The TEXTAREA tag node is specified.
2922 * @return The conversion result is returned.
2925 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2931 chtml10 = GET_CHTML10(pdoc);
2937 chtml10->textarea_flag--;
2939 return chtml10->out;
2944 s_chtml10_text(void *pdoc, Node *child)
2956 chtml10 = GET_CHTML10(pdoc);
2960 textval = qs_get_node_value(doc,child);
2961 if (strlen(textval) == 0) {
2962 return chtml10->out;
2965 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2966 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2968 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
2969 memset(one_byte, 0, sizeof(one_byte));
2972 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2976 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2978 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2983 if (is_sjis_kanji(textval[ii])) {
2984 one_byte[0] = textval[ii+0];
2985 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2986 one_byte[0] = textval[ii+1];
2987 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2991 if (chtml10->pre_flag) {
2992 one_byte[0] = textval[ii+0];
2993 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2996 if (chtml10->textarea_flag) {
2997 one_byte[0] = textval[ii+0];
2998 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3001 if (textval[ii] != '\r' && textval[ii] != '\n') {
3002 one_byte[0] = textval[ii+0];
3003 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3008 return chtml10->out;
3013 * It is a handler who processes the BLOCKQUOTE tag.
3015 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3016 * destination is specified.
3017 * @param node [i] The BLOCKQUOTE tag node is specified.
3018 * @return The conversion result is returned.
3021 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3025 chtml10 = GET_CHTML10(pdoc);
3027 W_L("<blockquote>");
3029 return chtml10->out;
3034 * It is a handler who processes the BLOCKQUOTE tag.
3036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3037 * destination is specified.
3038 * @param node [i] The BLOCKQUOTE tag node is specified.
3039 * @return The conversion result is returned.
3042 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3047 chtml10 = GET_CHTML10(pdoc);
3049 W_L("</blockquote>");
3051 return chtml10->out;
3056 * It is a handler who processes the DIR tag.
3058 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3059 * destination is specified.
3060 * @param node [i] The DIR tag node is specified.
3061 * @return The conversion result is returned.
3064 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3068 chtml10 = GET_CHTML10(pdoc);
3072 return chtml10->out;
3077 * It is a handler who processes the DIR tag.
3079 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3080 * destination is specified.
3081 * @param node [i] The DIR tag node is specified.
3082 * @return The conversion result is returned.
3085 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3090 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_start_dl_tag(void *pdoc, Node *UNUSED(child))
3111 chtml10 = GET_CHTML10(pdoc);
3114 return chtml10->out;
3119 * It is a handler who processes the DL tag.
3121 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3122 * destination is specified.
3123 * @param node [i] The DL tag node is specified.
3124 * @return The conversion result is returned.
3127 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3131 chtml10 = GET_CHTML10(pdoc);
3135 return chtml10->out;
3140 * It is a handter who processes the DT tag.
3142 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3143 * destination is specified.
3144 * @param node [i] The DT tag node is specified.
3145 * @return The conversion result is returned.
3148 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3152 chtml10 = GET_CHTML10(pdoc);
3155 return chtml10->out;
3160 * It is a handter who processes the DT tag.
3162 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3163 * destination is specified.
3164 * @param node [i] The DT tag node is specified.
3165 * @return The conversion result is returned.
3168 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3170 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3171 Doc *doc = chtml10->doc;
3174 return chtml10->out;
3179 * It is a handder who processes the DD tag.
3181 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3182 * destination is specified.
3183 * @param node [i] The DD tag node is specified.
3184 * @return The conversion result is returned.
3187 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3191 chtml10 = GET_CHTML10(pdoc);
3194 return chtml10->out;
3199 * It is a handder who processes the DD tag.
3201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3202 * destination is specified.
3203 * @param node [i] The DD tag node is specified.
3204 * @return The conversion result is returned.
3207 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3209 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3210 Doc *doc = chtml10->doc;
3212 return chtml10->out;
3217 * It is a hanmenuer who processes the MENU tag.
3219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3220 * destination is specified.
3221 * @param node [i] The MENU tag node is specified.
3222 * @return The conversion result is returned.
3225 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3229 chtml10 = GET_CHTML10(pdoc);
3233 return chtml10->out;
3238 * It is a hanmenuer who processes the MENU tag.
3240 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3241 * destination is specified.
3242 * @param node [i] The MENU tag node is specified.
3243 * @return The conversion result is returned.
3246 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3248 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3249 Doc *doc = chtml10->doc;
3252 return chtml10->out;
3257 * It is a hanplaintexter who processes the PLAINTEXT tag.
3259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3260 * destination is specified.
3261 * @param node [i] The PLAINTEXT tag node is specified.
3262 * @return The conversion result is returned.
3265 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3270 chtml10 = GET_CHTML10(pdoc);
3273 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3274 return chtml10->out;
3278 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3283 chtml10 = GET_CHTML10(pdoc);
3285 for (child = qs_get_child_node(doc, node);
3287 child = qs_get_next_node(doc, child)) {
3289 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3291 return chtml10->out;
3296 * It is a hanplaintexter who processes the PLAINTEXT tag.
3298 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3299 * destination is specified.
3300 * @param node [i] The PLAINTEXT tag node is specified.
3301 * @return The conversion result is returned.
3304 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3306 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3307 return chtml10->out;