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))
27 #define W10_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
28 #define W10_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
29 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
31 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
32 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
33 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
34 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
35 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
36 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
37 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
38 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
39 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
40 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
41 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
42 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
43 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
44 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
45 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
46 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
47 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
48 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
49 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
50 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
51 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
52 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
53 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
54 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
55 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
56 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
57 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
58 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
59 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
60 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
61 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
62 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
63 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
64 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
65 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
66 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
67 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
68 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
69 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
70 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
71 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
72 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
73 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
74 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
75 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
76 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
77 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
78 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
79 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
80 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
81 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
82 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
83 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
84 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
85 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
86 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
87 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
88 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
89 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
90 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
91 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
92 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
93 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
94 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
95 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
96 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
97 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
98 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
99 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
100 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
101 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
102 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
103 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
104 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
105 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
107 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
109 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
110 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
111 static char *s_chtml10_text (void *pdoc, Node *node);
113 tag_handler chtml10_handler[] = {
116 s_chtml10_start_html_tag,
117 s_chtml10_end_html_tag,
121 s_chtml10_start_meta_tag,
122 s_chtml10_end_meta_tag,
126 s_chtml10_start_textarea_tag,
127 s_chtml10_end_textarea_tag,
131 s_chtml10_start_p_tag,
136 s_chtml10_start_pre_tag,
137 s_chtml10_end_pre_tag,
141 s_chtml10_start_ul_tag,
142 s_chtml10_end_ul_tag,
146 s_chtml10_start_li_tag,
147 s_chtml10_end_li_tag,
151 s_chtml10_start_ol_tag,
152 s_chtml10_end_ol_tag,
156 s_chtml10_start_h1_tag,
157 s_chtml10_end_h1_tag,
161 s_chtml10_start_h2_tag,
162 s_chtml10_end_h2_tag,
166 s_chtml10_start_h3_tag,
167 s_chtml10_end_h3_tag,
171 s_chtml10_start_h4_tag,
172 s_chtml10_end_h4_tag,
176 s_chtml10_start_h5_tag,
177 s_chtml10_end_h5_tag,
181 s_chtml10_start_h6_tag,
182 s_chtml10_end_h6_tag,
186 s_chtml10_start_head_tag,
187 s_chtml10_end_head_tag,
191 s_chtml10_start_title_tag,
192 s_chtml10_end_title_tag,
196 s_chtml10_start_base_tag,
197 s_chtml10_end_base_tag,
201 s_chtml10_start_body_tag,
202 s_chtml10_end_body_tag,
206 s_chtml10_start_a_tag,
211 s_chtml10_start_br_tag,
212 s_chtml10_end_br_tag,
221 s_chtml10_start_tr_tag,
222 s_chtml10_end_tr_tag,
236 s_chtml10_start_font_tag,
237 s_chtml10_end_font_tag,
241 s_chtml10_start_form_tag,
242 s_chtml10_end_form_tag,
246 s_chtml10_start_input_tag,
247 s_chtml10_end_input_tag,
251 s_chtml10_start_center_tag,
252 s_chtml10_end_center_tag,
256 s_chtml10_start_hr_tag,
257 s_chtml10_end_hr_tag,
261 s_chtml10_start_img_tag,
262 s_chtml10_end_img_tag,
266 s_chtml10_start_select_tag,
267 s_chtml10_end_select_tag,
271 s_chtml10_start_option_tag,
272 s_chtml10_end_option_tag,
276 s_chtml10_start_div_tag,
277 s_chtml10_end_div_tag,
281 s_chtml10_chxjif_tag,
326 s_chtml10_start_dt_tag,
327 s_chtml10_end_dt_tag,
341 s_chtml10_start_blockquote_tag,
342 s_chtml10_end_blockquote_tag,
346 s_chtml10_start_dir_tag,
347 s_chtml10_end_dir_tag,
351 s_chtml10_start_dl_tag,
352 s_chtml10_end_dl_tag,
356 s_chtml10_start_dd_tag,
357 s_chtml10_end_dd_tag,
361 s_chtml10_start_menu_tag,
362 s_chtml10_end_menu_tag,
366 s_chtml10_start_plaintext_tag,
367 s_chtml10_end_plaintext_tag,
383 * converts from CHTML5.0 to CHTML1.0.
385 * @param r [i] Requet_rec is appointed.
386 * @param spec [i] The result of the device specification processing which
387 * was done in advance is appointed.
388 * @param src [i] The character string before the converting is appointed.
389 * @return The character string after the converting is returned.
392 chxj_exchange_chtml10(
398 chxjconvrule_entry *entryp,
411 DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
413 /*--------------------------------------------------------------------------*/
415 /*--------------------------------------------------------------------------*/
417 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
419 DBG(r,"i found qrcode xml");
422 DBG(r,"not found qrcode xml");
424 /*--------------------------------------------------------------------------*/
425 /* The CHTML structure is initialized. */
426 /*--------------------------------------------------------------------------*/
427 s_init_chtml10(&chtml10, &doc, r, spec);
428 chtml10.entryp = entryp;
429 chtml10.cookie = cookie;
431 chxj_set_content_type(r, "text/html; charset=Windows-31J");
433 /*--------------------------------------------------------------------------*/
434 /* The character string of the input is analyzed. */
435 /*--------------------------------------------------------------------------*/
436 qs_init_malloc(&doc);
437 qs_init_root_node(&doc);
439 ss = apr_pcalloc(r->pool, srclen + 1);
440 memset(ss, 0, srclen + 1);
441 memcpy(ss, src, srclen);
444 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
447 qs_parse_string(&doc,ss, strlen(ss));
449 chxj_buffered_write_init(r->pool, &doc.buf);
450 /*--------------------------------------------------------------------------*/
451 /* It converts it from CHTML to CHTML. */
452 /*--------------------------------------------------------------------------*/
453 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
454 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
455 dst = apr_pstrdup(r->pool, chtml10.out);
456 chxj_buffered_write_terminate(&doc.buf);
458 qs_all_free(&doc,QX_LOGMARK);
461 return apr_pstrdup(r->pool,ss);
464 if (strlen(dst) == 0) {
465 dst = apr_psprintf(r->pool, "\n");
467 *dstlen = strlen(dst);
470 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
473 DBG(r, "end chxj_exchange_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
480 * The CHTML structure is initialized.
482 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
483 * initialized is specified.
484 * @param doc [i] The Doc structure that should be set to the initialized
485 * HDML structure is specified.
486 * @param r [i] To use POOL, the pointer to request_rec is specified.
487 * @param spec [i] The pointer to the device_table
496 memset(doc, 0, sizeof(Doc));
497 memset(chtml10, 0, sizeof(chtml10_t));
501 chtml10->spec = spec;
502 chtml10->out = qs_alloc_zero_byte_string(r);
503 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
504 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
509 * Corresponding EMOJI to a current character-code is retrieved.
510 * The substitution character string is stored in the rslt pointer if agreeing.
512 * @param chtml10 [i] The pointer to the CHTML structure is specified.
513 * @param txt [i] The character string to want to examine whether it is
514 * EMOJI is specified.
515 * @param rslt [o] The pointer to the pointer that stores the result is
517 * @return When corresponding EMOJI exists, it returns it excluding 0.
520 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
527 spec = chtml10->spec;
533 DBG(r,"spec is NULL");
536 for (ee = chtml10->conf->emoji;
541 DBG(r,"emoji->imode is NULL");
545 if (ee->imode->string
547 && strlen(ee->imode->string) > 0
548 && *ee->imode->string == *txt
549 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
550 if (!spec || !spec->emoji_type) {
551 *rslt = apr_palloc(r->pool, 3);
552 (*rslt)[0] = ee->imode->hex1byte & 0xff;
553 (*rslt)[1] = ee->imode->hex2byte & 0xff;
555 return strlen(ee->imode->string);
566 * It is a handler who processes the HTML tag.
568 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
569 * destination is specified.
570 * @param node [i] The HTML tag node is specified.
571 * @return The conversion result is returned.
574 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
580 chtml10 = GET_CHTML10(pdoc);
584 /*--------------------------------------------------------------------------*/
586 /*--------------------------------------------------------------------------*/
594 * It is a handler who processes the HTML tag.
596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
597 * destination is specified.
598 * @param node [i] The HTML tag node is specified.
599 * @return The conversion result is returned.
602 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
609 chtml10 = GET_CHTML10(pdoc);
620 * It is a handler who processes the META tag.
622 * @param pdoc [i/o] The pointer to the CHTML structure at the output
623 * destination is specified.
624 * @param node [i] The META tag node is specified.
625 * @return The conversion result is returned.
628 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
630 chtml10_t *chtml10 = GET_CHTML10(pdoc);
639 * It is a handler who processes the META tag.
641 * @param pdoc [i/o] The pointer to the CHTML structure at the output
642 * destination is specified.
643 * @param node [i] The META tag node is specified.
644 * @return The conversion result is returned.
647 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
649 chtml10_t *chtml10 = GET_CHTML10(pdoc);
656 * It is a handler who processes the HEAD tag.
658 * @param pdoc [i/o] The pointer to the CHTML structure at the output
659 * destination is specified.
660 * @param node [i] The HEAD tag node is specified.
661 * @return The conversion result is returned.
664 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
670 chtml10 = GET_CHTML10(pdoc);
681 * It is a handler who processes the HEAD tag.
683 * @param pdoc [i/o] The pointer to the CHTML structure at the output
684 * destination is specified.
685 * @param node [i] The HEAD tag node is specified.
686 * @return The conversion result is returned.
689 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
695 chtml10 = GET_CHTML10(pdoc);
706 * It is a handler who processes the OL tag.
708 * @param pdoc [i/o] The pointer to the CHTML structure at the output
709 * destination is specified.
710 * @param node [i] The OL tag node is specified.
711 * @return The conversion result is returned.
714 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
720 chtml10 = GET_CHTML10(pdoc);
731 * It is a handler who processes the OL tag.
733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
734 * destination is specified.
735 * @param node [i] The OL tag node is specified.
736 * @return The conversion result is returned.
739 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
745 chtml10 = GET_CHTML10(pdoc);
756 * It is a handler who processes the UL tag.
758 * @param pdoc [i/o] The pointer to the CHTML structure at the output
759 * destination is specified.
760 * @param node [i] The UL tag node is specified.
761 * @return The conversion result is returned.
764 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
770 chtml10 = GET_CHTML10(pdoc);
781 * It is a handler who processes the UL tag.
783 * @param pdoc [i/o] The pointer to the CHTML structure at the output
784 * destination is specified.
785 * @param node [i] The UL tag node is specified.
786 * @return The conversion result is returned.
789 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
795 chtml10 = GET_CHTML10(pdoc);
806 * It is a handler who processes the LI tag.
808 * @param pdoc [i/o] The pointer to the CHTML structure at the output
809 * destination is specified.
810 * @param node [i] The LI tag node is specified.
811 * @return The conversion result is returned.
814 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
820 chtml10 = GET_CHTML10(pdoc);
831 * It is a handler who processes the LI tag.
833 * @param pdoc [i/o] The pointer to the CHTML structure at the output
834 * destination is specified.
835 * @param node [i] The LI tag node is specified.
836 * @return The conversion result is returned.
839 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
841 chtml10_t *chtml10 = GET_CHTML10(pdoc);
847 * It is a handler who processes the H1 tag.
849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
850 * destination is specified.
851 * @param node [i] The H1 tag node is specified.
852 * @return The conversion result is returned.
855 s_chtml10_start_h1_tag(void *pdoc, Node *node)
862 chtml10 = GET_CHTML10(pdoc);
867 for (attr = qs_get_attr(doc,node);
869 attr = qs_get_next_attr(doc,attr)) {
870 char *name = qs_get_attr_name(doc,attr);
871 char *value = qs_get_attr_value(doc,attr);
872 if (STRCASEEQ('a','A',"align", name)) {
873 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
888 * It is a handler who processes the H1 tag.
890 * @param pdoc [i/o] The pointer to the CHTML structure at the output
891 * destination is specified.
892 * @param node [i] The H1 tag node is specified.
893 * @return The conversion result is returned.
896 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
902 chtml10 = GET_CHTML10(pdoc);
913 * It is a handler who processes the H2 tag.
915 * @param pdoc [i/o] The pointer to the CHTML structure at the output
916 * destination is specified.
917 * @param node [i] The H2 tag node is specified.
918 * @return The conversion result is returned.
921 s_chtml10_start_h2_tag(void *pdoc, Node *node)
928 chtml10 = GET_CHTML10(pdoc);
933 for (attr = qs_get_attr(doc,node);
935 attr = qs_get_next_attr(doc,attr)) {
938 name = qs_get_attr_name(doc,attr);
939 value = qs_get_attr_value(doc,attr);
940 if (STRCASEEQ('a','A',"align", name)) {
941 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
956 * It is a handler who processes the H2 tag.
958 * @param pdoc [i/o] The pointer to the CHTML structure at the output
959 * destination is specified.
960 * @param node [i] The H2 tag node is specified.
961 * @return The conversion result is returned.
964 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
970 chtml10 = GET_CHTML10(pdoc);
981 * It is a handler who processes the H3 tag.
983 * @param pdoc [i/o] The pointer to the CHTML structure at the output
984 * destination is specified.
985 * @param node [i] The H3 tag node is specified.
986 * @return The conversion result is returned.
989 s_chtml10_start_h3_tag(void *pdoc, Node *node)
996 chtml10 = GET_CHTML10(pdoc);
1001 for (attr = qs_get_attr(doc,node);
1003 attr = qs_get_next_attr(doc,attr)) {
1004 char *name = qs_get_attr_name(doc,attr);
1005 char *value = qs_get_attr_value(doc,attr);
1006 if (STRCASEEQ('a','A',"align", name)) {
1007 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1017 return chtml10->out;
1022 * It is a handler who processes the H3 tag.
1024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1025 * destination is specified.
1026 * @param node [i] The H3 tag node is specified.
1027 * @return The conversion result is returned.
1030 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1036 chtml10 = GET_CHTML10(pdoc);
1042 return chtml10->out;
1047 * It is a handler who processes the H4 tag.
1049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1050 * destination is specified.
1051 * @param node [i] The H4 tag node is specified.
1052 * @return The conversion result is returned.
1055 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1062 chtml10 = GET_CHTML10(pdoc);
1067 for (attr = qs_get_attr(doc,node);
1069 attr = qs_get_next_attr(doc,attr)) {
1072 name = qs_get_attr_name(doc,attr);
1073 value = qs_get_attr_value(doc,attr);
1074 if (STRCASEEQ('a','A',"align", name)) {
1075 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1085 return chtml10->out;
1090 * It is a handler who processes the H4 tag.
1092 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1093 * destination is specified.
1094 * @param node [i] The H4 tag node is specified.
1095 * @return The conversion result is returned.
1098 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1104 chtml10 = GET_CHTML10(pdoc);
1110 return chtml10->out;
1115 * It is a handler who processes the H5 tag.
1117 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1118 * destination is specified.
1119 * @param node [i] The H5 tag node is specified.
1120 * @return The conversion result is returned.
1123 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1130 chtml10 = GET_CHTML10(pdoc);
1135 for (attr = qs_get_attr(doc,node);
1137 attr = qs_get_next_attr(doc,attr)) {
1138 char *name = qs_get_attr_name(doc,attr);
1139 char *value = qs_get_attr_value(doc,attr);
1140 if (STRCASEEQ('a','A',"align", name)) {
1141 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1151 return chtml10->out;
1156 * It is a handler who processes the H5 tag.
1158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1159 * destination is specified.
1160 * @param node [i] The H5 tag node is specified.
1161 * @return The conversion result is returned.
1164 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1170 chtml10 = GET_CHTML10(pdoc);
1176 return chtml10->out;
1181 * It is a handler who processes the H6 tag.
1183 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1184 * destination is specified.
1185 * @param node [i] The H6 tag node is specified.
1186 * @return The conversion result is returned.
1189 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1196 chtml10 = GET_CHTML10(pdoc);
1201 for (attr = qs_get_attr(doc,node);
1203 attr = qs_get_next_attr(doc,attr)) {
1204 char *name = qs_get_attr_name(doc,attr);
1205 char *value = qs_get_attr_value(doc,attr);
1206 if (STRCASEEQ('a','A',"align", name)) {
1207 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1217 return chtml10->out;
1222 * It is a handler who processes the H6 tag.
1224 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1225 * destination is specified.
1226 * @param node [i] The H6 tag node is specified.
1227 * @return The conversion result is returned.
1230 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1236 chtml10 = GET_CHTML10(pdoc);
1242 return chtml10->out;
1247 * It is a handler who processes the TITLE tag.
1249 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1250 * destination is specified.
1251 * @param node [i] The TITLE tag node is specified.
1252 * @return The conversion result is returned.
1255 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1261 chtml10 = GET_CHTML10(pdoc);
1267 return chtml10->out;
1272 * It is a handler who processes the TITLE tag.
1274 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1275 * destination is specified.
1276 * @param node [i] The TITLE tag node is specified.
1277 * @return The conversion result is returned.
1280 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)
1312 chtml10 = GET_CHTML10(pdoc);
1318 /*--------------------------------------------------------------------------*/
1319 /* Get Attributes */
1320 /*--------------------------------------------------------------------------*/
1321 for (attr = qs_get_attr(doc,node);
1323 attr = qs_get_next_attr(doc,attr)) {
1324 char *name = qs_get_attr_name(doc,attr);
1325 char *value = qs_get_attr_value(doc,attr);
1326 if (STRCASEEQ('h','H',"href", name)) {
1335 return chtml10->out;
1340 * It is a handler who processes the BASE tag.
1342 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1343 * destination is specified.
1344 * @param node [i] The BASE tag node is specified.
1345 * @return The conversion result is returned.
1348 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1350 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1352 return chtml10->out;
1357 * It is a handler who processes the BODY tag.
1359 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1360 * destination is specified.
1361 * @param node [i] The BODY tag node is specified.
1362 * @return The conversion result is returned.
1365 s_chtml10_start_body_tag(void *pdoc, Node *node)
1372 chtml10 = GET_CHTML10(pdoc);
1379 /*--------------------------------------------------------------------------*/
1380 /* Get Attributes */
1381 /*--------------------------------------------------------------------------*/
1382 for (attr = qs_get_attr(doc,node);
1384 attr = qs_get_next_attr(doc,attr)) {
1386 char *name = qs_get_attr_name(doc,attr);
1390 if (strcasecmp(name, "alink") == 0) {
1391 /*----------------------------------------------------------------------*/
1393 /*----------------------------------------------------------------------*/
1400 if (strcasecmp(name, "bgcolor") == 0) {
1401 /*----------------------------------------------------------------------*/
1403 /*----------------------------------------------------------------------*/
1410 if (strcasecmp(name, "text") == 0) {
1411 /*----------------------------------------------------------------------*/
1413 /*----------------------------------------------------------------------*/
1420 if (strcasecmp(name, "link") == 0) {
1421 /*----------------------------------------------------------------------*/
1423 /*----------------------------------------------------------------------*/
1430 if (strcasecmp(name, "vlink") == 0) {
1431 /*----------------------------------------------------------------------*/
1433 /*----------------------------------------------------------------------*/
1445 return chtml10->out;
1450 * It is a handler who processes the BODY tag.
1452 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1453 * destination is specified.
1454 * @param node [i] The BODY tag node is specified.
1455 * @return The conversion result is returned.
1458 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1464 chtml10 = GET_CHTML10(pdoc);
1470 return chtml10->out;
1475 * It is a handler who processes the A tag.
1477 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1478 * destination is specified.
1479 * @param node [i] The A tag node is specified.
1480 * @return The conversion result is returned.
1483 s_chtml10_start_a_tag(void *pdoc, Node *node)
1490 chtml10 = GET_CHTML10(pdoc);
1496 /*--------------------------------------------------------------------------*/
1497 /* Get Attributes */
1498 /*--------------------------------------------------------------------------*/
1499 for (attr = qs_get_attr(doc,node);
1501 attr = qs_get_next_attr(doc,attr)) {
1502 char *name = qs_get_attr_name(doc,attr);
1503 char *value = qs_get_attr_value(doc,attr);
1507 if (strcasecmp(name, "name") == 0) {
1508 /*--------------------------------------------------------------------*/
1510 /*--------------------------------------------------------------------*/
1519 if (strcasecmp(name, "href") == 0) {
1520 /*--------------------------------------------------------------------*/
1522 /*--------------------------------------------------------------------*/
1523 value = chxj_encoding_parameter(r, value);
1524 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1533 if (strcasecmp(name, "accesskey") == 0) {
1534 /*--------------------------------------------------------------------*/
1536 /*--------------------------------------------------------------------*/
1537 W10_L(" accesskey=\"");
1545 if (strcasecmp(name, "cti") == 0) {
1546 /*--------------------------------------------------------------------*/
1548 /*--------------------------------------------------------------------*/
1555 if (strcasecmp(name, "utn") == 0) {
1556 /*--------------------------------------------------------------------*/
1558 /*--------------------------------------------------------------------*/
1565 if (strcasecmp(name, "telbook") == 0) {
1566 /*--------------------------------------------------------------------*/
1568 /*--------------------------------------------------------------------*/
1575 if (strcasecmp(name, "kana") == 0) {
1576 /*--------------------------------------------------------------------*/
1578 /*--------------------------------------------------------------------*/
1585 if (strcasecmp(name, "email") == 0) {
1586 /*--------------------------------------------------------------------*/
1588 /*--------------------------------------------------------------------*/
1595 if (strcasecmp(name, "ista") == 0) {
1596 /*--------------------------------------------------------------------*/
1598 /*--------------------------------------------------------------------*/
1602 if (strcasecmp(name, "ilet") == 0) {
1603 /*--------------------------------------------------------------------*/
1605 /*--------------------------------------------------------------------*/
1609 if (strcasecmp(name, "iswf") == 0) {
1610 /*--------------------------------------------------------------------*/
1612 /*--------------------------------------------------------------------*/
1616 if (strcasecmp(name, "irst") == 0) {
1617 /*--------------------------------------------------------------------*/
1619 /*--------------------------------------------------------------------*/
1623 if (strcasecmp(name, "ijam") == 0) {
1624 /*--------------------------------------------------------------------*/
1626 /*--------------------------------------------------------------------*/
1637 return chtml10->out;
1642 * It is a handler who processes the A tag.
1644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1645 * destination is specified.
1646 * @param node [i] The A tag node is specified.
1647 * @return The conversion result is returned.
1650 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1656 chtml10 = GET_CHTML10(pdoc);
1661 return chtml10->out;
1666 * It is a handler who processes the BR tag.
1668 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1669 * destination is specified.
1670 * @param node [i] The BR tag node is specified.
1671 * @return The conversion result is returned.
1674 s_chtml10_start_br_tag(void *pdoc, Node *node)
1681 chtml10 = GET_CHTML10(pdoc);
1687 /*--------------------------------------------------------------------------*/
1688 /* Get Attributes */
1689 /*--------------------------------------------------------------------------*/
1690 for (attr = qs_get_attr(doc,node);
1692 attr = qs_get_next_attr(doc,attr)) {
1693 char *name = qs_get_attr_name(doc,attr);
1694 char *value = qs_get_attr_value(doc,attr);
1695 if (STRCASEEQ('c','C',"clear",name)) {
1696 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1704 return chtml10->out;
1709 * It is a handler who processes the BR tag.
1711 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1712 * destination is specified.
1713 * @param node [i] The BR tag node is specified.
1714 * @return The conversion result is returned.
1717 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1719 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1721 return chtml10->out;
1726 * It is a handler who processes the TR tag.
1728 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1729 * destination is specified.
1730 * @param node [i] The TR tag node is specified.
1731 * @return The conversion result is returned.
1734 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1736 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1738 return chtml10->out;
1743 * It is a handler who processes the TR tag.
1745 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1746 * destination is specified.
1747 * @param node [i] The TR tag node is specified.
1748 * @return The conversion result is returned.
1751 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1757 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_start_font_tag(void *pdoc, Node *UNUSED(node))
1778 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1782 return chtml10->out;
1787 * It is a handler who processes the FONT tag.
1789 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1790 * destination is specified.
1791 * @param node [i] The FONT tag node is specified.
1792 * @return The conversion result is returned.
1795 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1797 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1801 return chtml10->out;
1806 * It is a handler who processes the FORM tag.
1808 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1809 * destination is specified.
1810 * @param node [i] The FORM tag node is specified.
1811 * @return The conversion result is returned.
1814 s_chtml10_start_form_tag(void *pdoc, Node *node)
1821 chtml10 = GET_CHTML10(pdoc);
1827 /*--------------------------------------------------------------------------*/
1828 /* Get Attributes */
1829 /*--------------------------------------------------------------------------*/
1830 for (attr = qs_get_attr(doc,node);
1832 attr = qs_get_next_attr(doc,attr)) {
1833 char *name = qs_get_attr_name(doc,attr);
1834 char *value = qs_get_attr_value(doc,attr);
1838 if (strcasecmp(name, "action") == 0) {
1839 /*--------------------------------------------------------------------*/
1841 /*--------------------------------------------------------------------*/
1842 value = chxj_encoding_parameter(r, value);
1843 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1845 W10_L(" action=\"");
1853 if (strcasecmp(name, "method") == 0) {
1854 /*--------------------------------------------------------------------*/
1856 /*--------------------------------------------------------------------*/
1857 W10_L(" method=\"");
1865 if (strcasecmp(name, "utn") == 0) {
1866 /*--------------------------------------------------------------------*/
1868 /*--------------------------------------------------------------------*/
1880 return chtml10->out;
1885 * It is a handler who processes the FORM tag.
1887 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1888 * destination is specified.
1889 * @param node [i] The FORM tag node is specified.
1890 * @return The conversion result is returned.
1893 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1899 chtml10 = GET_CHTML10(pdoc);
1905 return chtml10->out;
1910 * It is a handler who processes the INPUT tag.
1912 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1913 * destination is specified.
1914 * @param node [i] The INPUT tag node is specified.
1915 * @return The conversion result is returned.
1918 s_chtml10_start_input_tag(void *pdoc, Node *node)
1932 chtml10 = GET_CHTML10(pdoc);
1947 /*--------------------------------------------------------------------------*/
1948 /* Get Attributes */
1949 /*--------------------------------------------------------------------------*/
1951 type = qs_get_type_attr(doc, node, r);
1952 name = qs_get_name_attr(doc, node, r);
1953 value = qs_get_value_attr(doc,node,r);
1954 istyle = qs_get_istyle_attr(doc,node,r);
1955 max_length = qs_get_maxlength_attr(doc,node,r);
1956 checked = qs_get_checked_attr(doc,node,r);
1957 accesskey = qs_get_accesskey_attr(doc, node, r);
1958 size = qs_get_size_attr(doc, node, r);
1961 type = qs_trim_string(doc->buf.pool, type);
1962 if (type && (STRCASEEQ('t','T',"text", type) ||
1963 STRCASEEQ('p','P',"password",type) ||
1964 STRCASEEQ('c','C',"checkbox",type) ||
1965 STRCASEEQ('r','R',"radio", type) ||
1966 STRCASEEQ('h','H',"hidden", type) ||
1967 STRCASEEQ('s','S',"submit", type) ||
1968 STRCASEEQ('r','R',"reset", type))) {
1975 if (size && *size != 0) {
1981 if (name && *name != 0) {
1987 if (value && *value != 0) {
1989 W10_V(chxj_add_slash_to_doublequote(doc->pool,value));
1993 if (accesskey && *accesskey != 0) {
1994 W10_L(" accesskey=\"");
2000 /*------------------------------------------------------------------------*/
2002 /*------------------------------------------------------------------------*/
2005 /*--------------------------------------------------------------------------*/
2006 /* The figure is default for the password. */
2007 /*--------------------------------------------------------------------------*/
2008 if (max_length && *max_length != 0) {
2009 W10_L(" maxlength=\"");
2019 return chtml10->out;
2024 * It is a handler who processes the INPUT tag.
2026 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2027 * destination is specified.
2028 * @param node [i] The INPUT tag node is specified.
2029 * @return The conversion result is returned.
2032 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2034 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2036 return chtml10->out;
2041 * It is a handler who processes the CENTER tag.
2043 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2044 * destination is specified.
2045 * @param node [i] The CENTER tag node is specified.
2046 * @return The conversion result is returned.
2049 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2055 chtml10 = GET_CHTML10(pdoc);
2061 return chtml10->out;
2066 * It is a handler who processes the CENTER tag.
2068 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2069 * destination is specified.
2070 * @param node [i] The CENTER tag node is specified.
2071 * @return The conversion result is returned.
2074 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2080 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 /*--------------------------------------------------------------------*/
2185 return chtml10->out;
2190 * It is a handler who processes the HR tag.
2192 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2193 * destination is specified.
2194 * @param node [i] The HR tag node is specified.
2195 * @return The conversion result is returned.
2198 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2200 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2203 return chtml10->out;
2208 * It is a handler who processes the IMG tag.
2210 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2211 * destination is specified.
2212 * @param node [i] The IMG tag node is specified.
2213 * @return The conversion result is returned.
2216 s_chtml10_start_img_tag(void *pdoc, Node *node)
2222 #ifndef IMG_NOT_CONVERT_FILENAME
2226 chtml10 = GET_CHTML10(pdoc);
2227 #ifndef IMG_NOT_CONVERT_FILENAME
2228 spec = chtml10->spec;
2234 /*--------------------------------------------------------------------------*/
2235 /* Get Attributes */
2236 /*--------------------------------------------------------------------------*/
2237 for (attr = qs_get_attr(doc,node);
2239 attr = qs_get_next_attr(doc,attr)) {
2240 char *name = qs_get_attr_name (doc,attr);
2241 char *value = qs_get_attr_value(doc,attr);
2245 if (strcasecmp(name, "src") == 0) {
2246 /*--------------------------------------------------------------------*/
2248 /*--------------------------------------------------------------------*/
2249 #ifdef IMG_NOT_CONVERT_FILENAME
2250 value = chxj_encoding_parameter(r, value);
2251 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2253 value = apr_psprintf(doc->buf.pool,
2256 (strchr(value, '?')) ? '&' : '?',
2257 CHXJ_COOKIE_NOUPDATE_PARAM);
2263 value = chxj_img_conv(r, spec, value);
2264 value = chxj_encoding_parameter(r, value);
2265 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2267 value = apr_psprintf(doc->buf.pool,
2270 (strchr(value, '?')) ? '&' : '?',
2271 CHXJ_COOKIE_NOUPDATE_PARAM);
2282 if (strcasecmp(name, "align" ) == 0) {
2283 /*--------------------------------------------------------------------*/
2285 /*--------------------------------------------------------------------*/
2286 /*--------------------------------------------------------------------*/
2288 /*--------------------------------------------------------------------*/
2289 if (value && (STRCASEEQ('t','T',"top", value) ||
2290 STRCASEEQ('m','M',"middle",value) ||
2291 STRCASEEQ('b','B',"bottom",value) ||
2292 STRCASEEQ('l','L',"left", value) ||
2293 STRCASEEQ('r','R',"right", value))) {
2299 else if (strcasecmp(name, "alt" ) == 0) {
2300 /*--------------------------------------------------------------------*/
2302 /*--------------------------------------------------------------------*/
2303 if (value && value[0] != '\0') {
2313 if (strcasecmp(name, "width" ) == 0) {
2314 /*--------------------------------------------------------------------*/
2316 /*--------------------------------------------------------------------*/
2317 if (value && value[0] != '\0') {
2327 if (strcasecmp(name, "height") == 0) {
2328 /*--------------------------------------------------------------------*/
2330 /*--------------------------------------------------------------------*/
2331 if (value && value[0] != '\0') {
2332 W10_L(" height=\"");
2338 if (strcasecmp(name, "hspace") == 0) {
2339 /*--------------------------------------------------------------------*/
2341 /*--------------------------------------------------------------------*/
2342 if (value && value[0] != '\0') {
2343 W10_L(" hspace=\"");
2352 if (strcasecmp(name, "vspace") == 0) {
2353 /*--------------------------------------------------------------------*/
2355 /*--------------------------------------------------------------------*/
2356 if (value && value[0] != '\0') {
2357 W10_L(" vspace=\"");
2370 return chtml10->out;
2375 * It is a handler who processes the IMG tag.
2377 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2378 * destination is specified.
2379 * @param node [i] The IMG tag node is specified.
2380 * @return The conversion result is returned.
2383 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2385 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2387 return chtml10->out;
2392 * It is a handler who processes the SELECT tag.
2394 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2395 * destination is specified.
2396 * @param node [i] The SELECT tag node is specified.
2397 * @return The conversion result is returned.
2400 s_chtml10_start_select_tag(void *pdoc, Node *child)
2410 chtml10 = GET_CHTML10(pdoc);
2418 for (attr = qs_get_attr(doc,child);
2420 attr = qs_get_next_attr(doc,attr)) {
2421 char *nm = qs_get_attr_name (doc,attr);
2422 char *val = qs_get_attr_value(doc,attr);
2426 if (strcasecmp(nm, "size") == 0) {
2427 /*--------------------------------------------------------------------*/
2428 /* CHTML 1.0 version 2.0 */
2429 /*--------------------------------------------------------------------*/
2430 size = apr_pstrdup(doc->buf.pool, val);
2436 if (strcasecmp(nm, "name") == 0) {
2437 /*--------------------------------------------------------------------*/
2438 /* CHTML 1.0 version 2.0 */
2439 /*--------------------------------------------------------------------*/
2440 name = apr_pstrdup(doc->buf.pool, val);
2446 if (strcasecmp(nm, "multiple") == 0) {
2447 /*--------------------------------------------------------------------*/
2448 /* CHTML 1.0 version 2.0 */
2449 /*--------------------------------------------------------------------*/
2459 if (size && *size != 0) {
2465 if (name && *name != 0) {
2472 return chtml10->out;
2477 * It is a handler who processes the SELECT tag.
2479 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2480 * destination is specified.
2481 * @param node [i] The SELECT tag node is specified.
2482 * @return The conversion result is returned.
2485 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2491 chtml10 = GET_CHTML10(pdoc);
2496 return chtml10->out;
2501 * It is a handler who processes the OPTION tag.
2503 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2504 * destination is specified.
2505 * @param node [i] The OPTION tag node is specified.
2506 * @return The conversion result is returned.
2509 s_chtml10_start_option_tag(void *pdoc, Node *child)
2518 chtml10 = GET_CHTML10(pdoc);
2527 for (attr = qs_get_attr(doc,child);
2529 attr = qs_get_next_attr(doc,attr)) {
2530 char *nm = qs_get_attr_name (doc,attr);
2531 char *val = qs_get_attr_value(doc,attr);
2535 if (strcasecmp(nm, "selected") == 0) {
2536 /*--------------------------------------------------------------------*/
2537 /* CHTML 1.0 version 2.0 */
2538 /*--------------------------------------------------------------------*/
2539 selected = apr_pstrdup(doc->buf.pool, val);
2545 if (strcasecmp(nm, "value") == 0) {
2546 /*--------------------------------------------------------------------*/
2547 /* CHTML 1.0 version 2.0 */
2548 /*--------------------------------------------------------------------*/
2549 value = apr_pstrdup(doc->buf.pool, val);
2558 if (value && *value != 0) {
2569 return chtml10->out;
2574 * It is a handler who processes the OPTION tag.
2576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2577 * destination is specified.
2578 * @param node [i] The OPTION tag node is specified.
2579 * @return The conversion result is returned.
2582 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2584 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2588 return chtml10->out;
2593 * It is a handler who processes the DIV tag.
2595 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2596 * destination is specified.
2597 * @param node [i] The DIV tag node is specified.
2598 * @return The conversion result is returned.
2601 s_chtml10_start_div_tag(void *pdoc, Node *child)
2609 chtml10 = GET_CHTML10(pdoc);
2616 for (attr = qs_get_attr(doc,child);
2618 attr = qs_get_next_attr(doc,attr)) {
2619 char *nm = qs_get_attr_name(doc,attr);
2620 char *val = qs_get_attr_value(doc,attr);
2621 if (STRCASEEQ('a','A',"align", nm)) {
2622 /*----------------------------------------------------------------------*/
2623 /* CHTML 1.0 (W3C version 3.2) */
2624 /*----------------------------------------------------------------------*/
2625 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2626 align = apr_pstrdup(doc->buf.pool, val);
2638 return chtml10->out;
2643 * It is a handler who processes the DIV tag.
2645 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2646 * destination is specified.
2647 * @param node [i] The DIV tag node is specified.
2648 * @return The conversion result is returned.
2651 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2657 chtml10 = GET_CHTML10(pdoc);
2662 return chtml10->out;
2667 * It is a handler who processes the CHXJ:IF tag.
2669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2670 * destination is specified.
2671 * @param node [i] The CHXJ:IF tag node is specified.
2672 * @return The conversion result is returned.
2675 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2682 chtml10 = GET_CHTML10(pdoc);
2686 for (child = qs_get_child_node(doc, node);
2688 child = qs_get_next_node(doc, child)) {
2689 W10_V(child->otext);
2690 s_chtml10_chxjif_tag(chtml10, child);
2693 return chtml10->out;
2698 * It is a handler who processes the PRE tag.
2700 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2701 * destination is specified.
2702 * @param node [i] The PRE tag node is specified.
2703 * @return The conversion result is returned.
2706 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2712 chtml10 = GET_CHTML10(pdoc);
2716 chtml10->pre_flag++;
2718 return chtml10->out;
2723 * It is a handler who processes the PRE tag.
2725 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2726 * destination is specified.
2727 * @param node [i] The PRE tag node is specified.
2728 * @return The conversion result is returned.
2731 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2737 chtml10 = GET_CHTML10(pdoc);
2742 chtml10->pre_flag--;
2744 return chtml10->out;
2749 * It is a handler who processes the P tag.
2751 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2752 * destination is specified.
2753 * @param node [i] The P tag node is specified.
2754 * @return The conversion result is returned.
2757 s_chtml10_start_p_tag(void *pdoc, Node *node)
2765 chtml10 = GET_CHTML10(pdoc);
2770 for (attr = qs_get_attr(doc,node);
2772 attr = qs_get_next_attr(doc,attr)) {
2773 char *nm = qs_get_attr_name(doc,attr);
2774 char *val = qs_get_attr_value(doc,attr);
2775 if (STRCASEEQ('a','A',"align", nm)) {
2776 /*----------------------------------------------------------------------*/
2777 /* CHTML 1.0 (W3C version 3.2) */
2778 /*----------------------------------------------------------------------*/
2779 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2780 align = apr_pstrdup(doc->buf.pool, val);
2792 return chtml10->out;
2797 * It is a handler who processes the P tag.
2799 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2800 * destination is specified.
2801 * @param node [i] The P tag node is specified.
2802 * @return The conversion result is returned.
2805 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2811 chtml10 = GET_CHTML10(pdoc);
2816 return chtml10->out;
2821 * It is a handler who processes the TEXTARE tag.
2823 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2824 * destination is specified.
2825 * @param node [i] The TEXTAREA tag node is specified.
2826 * @return The conversion result is returned.
2829 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2836 chtml10 = GET_CHTML10(pdoc);
2841 chtml10->textarea_flag++;
2845 for (attr = qs_get_attr(doc,node);
2847 attr = qs_get_next_attr(doc,attr)) {
2848 char *name = qs_get_attr_name (doc,attr);
2849 char *value = qs_get_attr_value(doc,attr);
2853 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2854 W10_L(" accesskey=\"");
2862 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2871 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2880 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2892 return chtml10->out;
2897 * It is a handler who processes the TEXTAREA tag.
2899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2900 * destination is specified.
2901 * @param node [i] The TEXTAREA tag node is specified.
2902 * @return The conversion result is returned.
2905 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2911 chtml10 = GET_CHTML10(pdoc);
2915 W10_L("</textarea>");
2916 chtml10->textarea_flag--;
2918 return chtml10->out;
2923 s_chtml10_text(void *pdoc, Node *child)
2935 chtml10 = GET_CHTML10(pdoc);
2939 textval = qs_get_node_value(doc,child);
2940 if (strlen(textval) == 0) {
2941 return chtml10->out;
2944 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2945 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2947 tdst = qs_alloc_zero_byte_string(r);
2948 memset(one_byte, 0, sizeof(one_byte));
2951 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2955 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2957 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2962 if (is_sjis_kanji(textval[ii])) {
2963 one_byte[0] = textval[ii+0];
2964 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2965 one_byte[0] = textval[ii+1];
2966 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2970 if (chtml10->pre_flag) {
2971 one_byte[0] = textval[ii+0];
2972 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2975 if (chtml10->textarea_flag) {
2976 one_byte[0] = textval[ii+0];
2977 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2980 if (textval[ii] != '\r' && textval[ii] != '\n') {
2981 one_byte[0] = textval[ii+0];
2982 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2987 return chtml10->out;
2992 * It is a handler who processes the BLOCKQUOTE tag.
2994 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2995 * destination is specified.
2996 * @param node [i] The BLOCKQUOTE tag node is specified.
2997 * @return The conversion result is returned.
3000 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3004 chtml10 = GET_CHTML10(pdoc);
3006 W10_L("<blockquote>");
3007 return chtml10->out;
3012 * It is a handler who processes the BLOCKQUOTE tag.
3014 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3015 * destination is specified.
3016 * @param node [i] The BLOCKQUOTE tag node is specified.
3017 * @return The conversion result is returned.
3020 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3025 chtml10 = GET_CHTML10(pdoc);
3027 W10_L("</blockquote>");
3028 return chtml10->out;
3033 * It is a handler who processes the DIR tag.
3035 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3036 * destination is specified.
3037 * @param node [i] The DIR tag node is specified.
3038 * @return The conversion result is returned.
3041 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3045 chtml10 = GET_CHTML10(pdoc);
3048 return chtml10->out;
3053 * It is a handler who processes the DIR tag.
3055 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3056 * destination is specified.
3057 * @param node [i] The DIR tag node is specified.
3058 * @return The conversion result is returned.
3061 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3066 chtml10 = GET_CHTML10(pdoc);
3069 return chtml10->out;
3074 * It is a handler who processes the DL tag.
3076 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3077 * destination is specified.
3078 * @param node [i] The DL tag node is specified.
3079 * @return The conversion result is returned.
3082 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3086 chtml10 = GET_CHTML10(pdoc);
3089 return chtml10->out;
3094 * It is a handler who processes the DL tag.
3096 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3097 * destination is specified.
3098 * @param node [i] The DL tag node is specified.
3099 * @return The conversion result is returned.
3102 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3106 chtml10 = GET_CHTML10(pdoc);
3109 return chtml10->out;
3114 * It is a handter who processes the DT tag.
3116 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3117 * destination is specified.
3118 * @param node [i] The DT tag node is specified.
3119 * @return The conversion result is returned.
3122 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3126 chtml10 = GET_CHTML10(pdoc);
3129 return chtml10->out;
3134 * It is a handter who processes the DT tag.
3136 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3137 * destination is specified.
3138 * @param node [i] The DT tag node is specified.
3139 * @return The conversion result is returned.
3142 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3145 chtml10 = GET_CHTML10(pdoc);
3146 return chtml10->out;
3151 * It is a handder who processes the DD tag.
3153 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3154 * destination is specified.
3155 * @param node [i] The DD tag node is specified.
3156 * @return The conversion result is returned.
3159 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3163 chtml10 = GET_CHTML10(pdoc);
3166 return chtml10->out;
3171 * It is a handder who processes the DD tag.
3173 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3174 * destination is specified.
3175 * @param node [i] The DD tag node is specified.
3176 * @return The conversion result is returned.
3179 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3182 chtml10 = GET_CHTML10(pdoc);
3183 return chtml10->out;
3188 * It is a hanmenuer who processes the MENU tag.
3190 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3191 * destination is specified.
3192 * @param node [i] The MENU tag node is specified.
3193 * @return The conversion result is returned.
3196 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3200 chtml10 = GET_CHTML10(pdoc);
3203 return chtml10->out;
3208 * It is a hanmenuer who processes the MENU tag.
3210 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3211 * destination is specified.
3212 * @param node [i] The MENU tag node is specified.
3213 * @return The conversion result is returned.
3216 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3218 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3219 Doc *doc = chtml10->doc;
3221 return chtml10->out;
3226 * It is a hanplaintexter who processes the PLAINTEXT tag.
3228 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3229 * destination is specified.
3230 * @param node [i] The PLAINTEXT tag node is specified.
3231 * @return The conversion result is returned.
3234 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3239 chtml10 = GET_CHTML10(pdoc);
3241 W10_L("<plaintext>");
3242 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3243 return chtml10->out;
3247 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3252 chtml10 = GET_CHTML10(pdoc);
3254 for (child = qs_get_child_node(doc, node);
3256 child = qs_get_next_node(doc, child)) {
3257 W10_V(child->otext);
3258 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3260 return chtml10->out;
3265 * It is a hanplaintexter who processes the PLAINTEXT tag.
3267 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3268 * destination is specified.
3269 * @param node [i] The PLAINTEXT tag node is specified.
3270 * @return The conversion result is returned.
3273 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3275 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3276 return chtml10->out;