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_str_util.h"
25 #include "chxj_buffered_write.h"
27 #define GET_CHTML10(X) ((chtml10_t*)(X))
28 #define W10_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
29 #define W10_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
30 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
32 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
33 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
34 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
35 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
36 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
37 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
38 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
39 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
40 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
41 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
42 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
43 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
44 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
45 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
46 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
47 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
48 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
49 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
50 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
51 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
52 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
53 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
54 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
55 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
56 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
57 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
58 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
59 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
60 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
61 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
62 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
63 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
64 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
65 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
66 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
67 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
68 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
69 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
70 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
71 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
72 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
73 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
74 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
75 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
76 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
77 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
78 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
79 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
80 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
81 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
82 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
83 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
84 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
85 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
86 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
87 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
88 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
89 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
90 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
91 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
92 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
93 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
94 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
95 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
96 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
97 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
98 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
99 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
100 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
101 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
102 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
103 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
104 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
105 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
106 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
108 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
110 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
111 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
112 static char *s_chtml10_text (void *pdoc, Node *node);
114 tag_handler chtml10_handler[] = {
117 s_chtml10_start_html_tag,
118 s_chtml10_end_html_tag,
122 s_chtml10_start_meta_tag,
123 s_chtml10_end_meta_tag,
127 s_chtml10_start_textarea_tag,
128 s_chtml10_end_textarea_tag,
132 s_chtml10_start_p_tag,
137 s_chtml10_start_pre_tag,
138 s_chtml10_end_pre_tag,
142 s_chtml10_start_ul_tag,
143 s_chtml10_end_ul_tag,
147 s_chtml10_start_li_tag,
148 s_chtml10_end_li_tag,
152 s_chtml10_start_ol_tag,
153 s_chtml10_end_ol_tag,
157 s_chtml10_start_h1_tag,
158 s_chtml10_end_h1_tag,
162 s_chtml10_start_h2_tag,
163 s_chtml10_end_h2_tag,
167 s_chtml10_start_h3_tag,
168 s_chtml10_end_h3_tag,
172 s_chtml10_start_h4_tag,
173 s_chtml10_end_h4_tag,
177 s_chtml10_start_h5_tag,
178 s_chtml10_end_h5_tag,
182 s_chtml10_start_h6_tag,
183 s_chtml10_end_h6_tag,
187 s_chtml10_start_head_tag,
188 s_chtml10_end_head_tag,
192 s_chtml10_start_title_tag,
193 s_chtml10_end_title_tag,
197 s_chtml10_start_base_tag,
198 s_chtml10_end_base_tag,
202 s_chtml10_start_body_tag,
203 s_chtml10_end_body_tag,
207 s_chtml10_start_a_tag,
212 s_chtml10_start_br_tag,
213 s_chtml10_end_br_tag,
222 s_chtml10_start_tr_tag,
223 s_chtml10_end_tr_tag,
237 s_chtml10_start_font_tag,
238 s_chtml10_end_font_tag,
242 s_chtml10_start_form_tag,
243 s_chtml10_end_form_tag,
247 s_chtml10_start_input_tag,
248 s_chtml10_end_input_tag,
252 s_chtml10_start_center_tag,
253 s_chtml10_end_center_tag,
257 s_chtml10_start_hr_tag,
258 s_chtml10_end_hr_tag,
262 s_chtml10_start_img_tag,
263 s_chtml10_end_img_tag,
267 s_chtml10_start_select_tag,
268 s_chtml10_end_select_tag,
272 s_chtml10_start_option_tag,
273 s_chtml10_end_option_tag,
277 s_chtml10_start_div_tag,
278 s_chtml10_end_div_tag,
282 s_chtml10_chxjif_tag,
327 s_chtml10_start_dt_tag,
328 s_chtml10_end_dt_tag,
342 s_chtml10_start_blockquote_tag,
343 s_chtml10_end_blockquote_tag,
347 s_chtml10_start_dir_tag,
348 s_chtml10_end_dir_tag,
352 s_chtml10_start_dl_tag,
353 s_chtml10_end_dl_tag,
357 s_chtml10_start_dd_tag,
358 s_chtml10_end_dd_tag,
362 s_chtml10_start_menu_tag,
363 s_chtml10_end_menu_tag,
367 s_chtml10_start_plaintext_tag,
368 s_chtml10_end_plaintext_tag,
384 * converts from CHTML5.0 to CHTML1.0.
386 * @param r [i] Requet_rec is appointed.
387 * @param spec [i] The result of the device specification processing which
388 * was done in advance is appointed.
389 * @param src [i] The character string before the converting is appointed.
390 * @return The character string after the converting is returned.
393 chxj_exchange_chtml10(
399 chxjconvrule_entry *entryp,
412 DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
414 /*--------------------------------------------------------------------------*/
416 /*--------------------------------------------------------------------------*/
418 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
420 DBG(r,"i found qrcode xml");
423 DBG(r,"not found qrcode xml");
425 /*--------------------------------------------------------------------------*/
426 /* The CHTML structure is initialized. */
427 /*--------------------------------------------------------------------------*/
428 s_init_chtml10(&chtml10, &doc, r, spec);
429 chtml10.entryp = entryp;
430 chtml10.cookie = cookie;
432 chxj_set_content_type(r, "text/html; charset=Windows-31J");
434 /*--------------------------------------------------------------------------*/
435 /* The character string of the input is analyzed. */
436 /*--------------------------------------------------------------------------*/
437 qs_init_malloc(&doc);
438 qs_init_root_node(&doc);
440 ss = apr_pcalloc(r->pool, srclen + 1);
441 memset(ss, 0, srclen + 1);
442 memcpy(ss, src, srclen);
445 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
448 qs_parse_string(&doc,ss, strlen(ss));
450 chxj_buffered_write_init(r->pool, &doc.buf);
451 /*--------------------------------------------------------------------------*/
452 /* It converts it from CHTML to CHTML. */
453 /*--------------------------------------------------------------------------*/
454 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
455 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
456 dst = apr_pstrdup(r->pool, chtml10.out);
457 chxj_buffered_write_terminate(&doc.buf);
459 qs_all_free(&doc,QX_LOGMARK);
462 return apr_pstrdup(r->pool,ss);
465 if (strlen(dst) == 0) {
466 dst = apr_psprintf(r->pool, "\n");
468 *dstlen = strlen(dst);
471 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
474 DBG(r, "end chxj_exchange_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
481 * The CHTML structure is initialized.
483 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
484 * initialized is specified.
485 * @param doc [i] The Doc structure that should be set to the initialized
486 * HDML structure is specified.
487 * @param r [i] To use POOL, the pointer to request_rec is specified.
488 * @param spec [i] The pointer to the device_table
497 memset(doc, 0, sizeof(Doc));
498 memset(chtml10, 0, sizeof(chtml10_t));
502 chtml10->spec = spec;
503 chtml10->out = qs_alloc_zero_byte_string(r);
504 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
505 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
510 * Corresponding EMOJI to a current character-code is retrieved.
511 * The substitution character string is stored in the rslt pointer if agreeing.
513 * @param chtml10 [i] The pointer to the CHTML structure is specified.
514 * @param txt [i] The character string to want to examine whether it is
515 * EMOJI is specified.
516 * @param rslt [o] The pointer to the pointer that stores the result is
518 * @return When corresponding EMOJI exists, it returns it excluding 0.
521 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
528 spec = chtml10->spec;
534 DBG(r,"spec is NULL");
537 for (ee = chtml10->conf->emoji;
542 DBG(r,"emoji->imode is NULL");
546 if (ee->imode->string
548 && strlen(ee->imode->string) > 0
549 && *ee->imode->string == *txt
550 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
551 if (!spec || !spec->emoji_type) {
552 *rslt = apr_palloc(r->pool, 3);
553 (*rslt)[0] = ee->imode->hex1byte & 0xff;
554 (*rslt)[1] = ee->imode->hex2byte & 0xff;
556 return strlen(ee->imode->string);
567 * It is a handler who processes the HTML tag.
569 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
570 * destination is specified.
571 * @param node [i] The HTML tag node is specified.
572 * @return The conversion result is returned.
575 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
581 chtml10 = GET_CHTML10(pdoc);
585 /*--------------------------------------------------------------------------*/
587 /*--------------------------------------------------------------------------*/
595 * It is a handler who processes the HTML tag.
597 * @param pdoc [i/o] The pointer to the CHTML structure at the output
598 * destination is specified.
599 * @param node [i] The HTML tag node is specified.
600 * @return The conversion result is returned.
603 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
610 chtml10 = GET_CHTML10(pdoc);
621 * It is a handler who processes the META tag.
623 * @param pdoc [i/o] The pointer to the CHTML structure at the output
624 * destination is specified.
625 * @param node [i] The META tag node is specified.
626 * @return The conversion result is returned.
629 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
631 chtml10_t *chtml10 = GET_CHTML10(pdoc);
640 * It is a handler who processes the META tag.
642 * @param pdoc [i/o] The pointer to the CHTML structure at the output
643 * destination is specified.
644 * @param node [i] The META tag node is specified.
645 * @return The conversion result is returned.
648 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
650 chtml10_t *chtml10 = GET_CHTML10(pdoc);
657 * It is a handler who processes the HEAD tag.
659 * @param pdoc [i/o] The pointer to the CHTML structure at the output
660 * destination is specified.
661 * @param node [i] The HEAD tag node is specified.
662 * @return The conversion result is returned.
665 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
671 chtml10 = GET_CHTML10(pdoc);
682 * It is a handler who processes the HEAD tag.
684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
685 * destination is specified.
686 * @param node [i] The HEAD tag node is specified.
687 * @return The conversion result is returned.
690 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
696 chtml10 = GET_CHTML10(pdoc);
707 * It is a handler who processes the OL tag.
709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
710 * destination is specified.
711 * @param node [i] The OL tag node is specified.
712 * @return The conversion result is returned.
715 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
721 chtml10 = GET_CHTML10(pdoc);
732 * It is a handler who processes the OL tag.
734 * @param pdoc [i/o] The pointer to the CHTML structure at the output
735 * destination is specified.
736 * @param node [i] The OL tag node is specified.
737 * @return The conversion result is returned.
740 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
746 chtml10 = GET_CHTML10(pdoc);
757 * It is a handler who processes the UL tag.
759 * @param pdoc [i/o] The pointer to the CHTML structure at the output
760 * destination is specified.
761 * @param node [i] The UL tag node is specified.
762 * @return The conversion result is returned.
765 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
771 chtml10 = GET_CHTML10(pdoc);
782 * It is a handler who processes the UL tag.
784 * @param pdoc [i/o] The pointer to the CHTML structure at the output
785 * destination is specified.
786 * @param node [i] The UL tag node is specified.
787 * @return The conversion result is returned.
790 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
796 chtml10 = GET_CHTML10(pdoc);
807 * It is a handler who processes the LI tag.
809 * @param pdoc [i/o] The pointer to the CHTML structure at the output
810 * destination is specified.
811 * @param node [i] The LI tag node is specified.
812 * @return The conversion result is returned.
815 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
821 chtml10 = GET_CHTML10(pdoc);
832 * It is a handler who processes the LI tag.
834 * @param pdoc [i/o] The pointer to the CHTML structure at the output
835 * destination is specified.
836 * @param node [i] The LI tag node is specified.
837 * @return The conversion result is returned.
840 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
842 chtml10_t *chtml10 = GET_CHTML10(pdoc);
848 * It is a handler who processes the H1 tag.
850 * @param pdoc [i/o] The pointer to the CHTML structure at the output
851 * destination is specified.
852 * @param node [i] The H1 tag node is specified.
853 * @return The conversion result is returned.
856 s_chtml10_start_h1_tag(void *pdoc, Node *node)
863 chtml10 = GET_CHTML10(pdoc);
868 for (attr = qs_get_attr(doc,node);
870 attr = qs_get_next_attr(doc,attr)) {
871 char *name = qs_get_attr_name(doc,attr);
872 char *value = qs_get_attr_value(doc,attr);
873 if (STRCASEEQ('a','A',"align", name)) {
874 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
889 * It is a handler who processes the H1 tag.
891 * @param pdoc [i/o] The pointer to the CHTML structure at the output
892 * destination is specified.
893 * @param node [i] The H1 tag node is specified.
894 * @return The conversion result is returned.
897 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
903 chtml10 = GET_CHTML10(pdoc);
914 * It is a handler who processes the H2 tag.
916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
917 * destination is specified.
918 * @param node [i] The H2 tag node is specified.
919 * @return The conversion result is returned.
922 s_chtml10_start_h2_tag(void *pdoc, Node *node)
929 chtml10 = GET_CHTML10(pdoc);
934 for (attr = qs_get_attr(doc,node);
936 attr = qs_get_next_attr(doc,attr)) {
939 name = qs_get_attr_name(doc,attr);
940 value = qs_get_attr_value(doc,attr);
941 if (STRCASEEQ('a','A',"align", name)) {
942 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
957 * It is a handler who processes the H2 tag.
959 * @param pdoc [i/o] The pointer to the CHTML structure at the output
960 * destination is specified.
961 * @param node [i] The H2 tag node is specified.
962 * @return The conversion result is returned.
965 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
971 chtml10 = GET_CHTML10(pdoc);
982 * It is a handler who processes the H3 tag.
984 * @param pdoc [i/o] The pointer to the CHTML structure at the output
985 * destination is specified.
986 * @param node [i] The H3 tag node is specified.
987 * @return The conversion result is returned.
990 s_chtml10_start_h3_tag(void *pdoc, Node *node)
997 chtml10 = GET_CHTML10(pdoc);
1002 for (attr = qs_get_attr(doc,node);
1004 attr = qs_get_next_attr(doc,attr)) {
1005 char *name = qs_get_attr_name(doc,attr);
1006 char *value = qs_get_attr_value(doc,attr);
1007 if (STRCASEEQ('a','A',"align", name)) {
1008 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1018 return chtml10->out;
1023 * It is a handler who processes the H3 tag.
1025 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1026 * destination is specified.
1027 * @param node [i] The H3 tag node is specified.
1028 * @return The conversion result is returned.
1031 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1037 chtml10 = GET_CHTML10(pdoc);
1043 return chtml10->out;
1048 * It is a handler who processes the H4 tag.
1050 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1051 * destination is specified.
1052 * @param node [i] The H4 tag node is specified.
1053 * @return The conversion result is returned.
1056 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1063 chtml10 = GET_CHTML10(pdoc);
1068 for (attr = qs_get_attr(doc,node);
1070 attr = qs_get_next_attr(doc,attr)) {
1073 name = qs_get_attr_name(doc,attr);
1074 value = qs_get_attr_value(doc,attr);
1075 if (STRCASEEQ('a','A',"align", name)) {
1076 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1086 return chtml10->out;
1091 * It is a handler who processes the H4 tag.
1093 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1094 * destination is specified.
1095 * @param node [i] The H4 tag node is specified.
1096 * @return The conversion result is returned.
1099 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1105 chtml10 = GET_CHTML10(pdoc);
1111 return chtml10->out;
1116 * It is a handler who processes the H5 tag.
1118 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1119 * destination is specified.
1120 * @param node [i] The H5 tag node is specified.
1121 * @return The conversion result is returned.
1124 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1131 chtml10 = GET_CHTML10(pdoc);
1136 for (attr = qs_get_attr(doc,node);
1138 attr = qs_get_next_attr(doc,attr)) {
1139 char *name = qs_get_attr_name(doc,attr);
1140 char *value = qs_get_attr_value(doc,attr);
1141 if (STRCASEEQ('a','A',"align", name)) {
1142 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1152 return chtml10->out;
1157 * It is a handler who processes the H5 tag.
1159 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1160 * destination is specified.
1161 * @param node [i] The H5 tag node is specified.
1162 * @return The conversion result is returned.
1165 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1171 chtml10 = GET_CHTML10(pdoc);
1177 return chtml10->out;
1182 * It is a handler who processes the H6 tag.
1184 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1185 * destination is specified.
1186 * @param node [i] The H6 tag node is specified.
1187 * @return The conversion result is returned.
1190 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1197 chtml10 = GET_CHTML10(pdoc);
1202 for (attr = qs_get_attr(doc,node);
1204 attr = qs_get_next_attr(doc,attr)) {
1205 char *name = qs_get_attr_name(doc,attr);
1206 char *value = qs_get_attr_value(doc,attr);
1207 if (STRCASEEQ('a','A',"align", name)) {
1208 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1218 return chtml10->out;
1223 * It is a handler who processes the H6 tag.
1225 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1226 * destination is specified.
1227 * @param node [i] The H6 tag node is specified.
1228 * @return The conversion result is returned.
1231 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1237 chtml10 = GET_CHTML10(pdoc);
1243 return chtml10->out;
1248 * It is a handler who processes the TITLE tag.
1250 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1251 * destination is specified.
1252 * @param node [i] The TITLE tag node is specified.
1253 * @return The conversion result is returned.
1256 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1262 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))
1287 chtml10 = GET_CHTML10(pdoc);
1293 return chtml10->out;
1298 * It is a handler who processes the BASE tag.
1300 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1301 * destination is specified.
1302 * @param node [i] The BASE tag node is specified.
1303 * @return The conversion result is returned.
1306 s_chtml10_start_base_tag(void *pdoc, Node *node)
1313 chtml10 = GET_CHTML10(pdoc);
1319 /*--------------------------------------------------------------------------*/
1320 /* Get Attributes */
1321 /*--------------------------------------------------------------------------*/
1322 for (attr = qs_get_attr(doc,node);
1324 attr = qs_get_next_attr(doc,attr)) {
1325 char *name = qs_get_attr_name(doc,attr);
1326 char *value = qs_get_attr_value(doc,attr);
1327 if (STRCASEEQ('h','H',"href", name)) {
1336 return chtml10->out;
1341 * It is a handler who processes the BASE tag.
1343 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1344 * destination is specified.
1345 * @param node [i] The BASE tag node is specified.
1346 * @return The conversion result is returned.
1349 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1351 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1353 return chtml10->out;
1358 * It is a handler who processes the BODY tag.
1360 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1361 * destination is specified.
1362 * @param node [i] The BODY tag node is specified.
1363 * @return The conversion result is returned.
1366 s_chtml10_start_body_tag(void *pdoc, Node *node)
1373 chtml10 = GET_CHTML10(pdoc);
1380 /*--------------------------------------------------------------------------*/
1381 /* Get Attributes */
1382 /*--------------------------------------------------------------------------*/
1383 for (attr = qs_get_attr(doc,node);
1385 attr = qs_get_next_attr(doc,attr)) {
1387 char *name = qs_get_attr_name(doc,attr);
1391 if (strcasecmp(name, "alink") == 0) {
1392 /*----------------------------------------------------------------------*/
1394 /*----------------------------------------------------------------------*/
1401 if (strcasecmp(name, "bgcolor") == 0) {
1402 /*----------------------------------------------------------------------*/
1404 /*----------------------------------------------------------------------*/
1411 if (strcasecmp(name, "text") == 0) {
1412 /*----------------------------------------------------------------------*/
1414 /*----------------------------------------------------------------------*/
1421 if (strcasecmp(name, "link") == 0) {
1422 /*----------------------------------------------------------------------*/
1424 /*----------------------------------------------------------------------*/
1431 if (strcasecmp(name, "vlink") == 0) {
1432 /*----------------------------------------------------------------------*/
1434 /*----------------------------------------------------------------------*/
1446 return chtml10->out;
1451 * It is a handler who processes the BODY tag.
1453 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1454 * destination is specified.
1455 * @param node [i] The BODY tag node is specified.
1456 * @return The conversion result is returned.
1459 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1465 chtml10 = GET_CHTML10(pdoc);
1471 return chtml10->out;
1476 * It is a handler who processes the A tag.
1478 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1479 * destination is specified.
1480 * @param node [i] The A tag node is specified.
1481 * @return The conversion result is returned.
1484 s_chtml10_start_a_tag(void *pdoc, Node *node)
1491 chtml10 = GET_CHTML10(pdoc);
1497 /*--------------------------------------------------------------------------*/
1498 /* Get Attributes */
1499 /*--------------------------------------------------------------------------*/
1500 for (attr = qs_get_attr(doc,node);
1502 attr = qs_get_next_attr(doc,attr)) {
1503 char *name = qs_get_attr_name(doc,attr);
1504 char *value = qs_get_attr_value(doc,attr);
1508 if (strcasecmp(name, "name") == 0) {
1509 /*--------------------------------------------------------------------*/
1511 /*--------------------------------------------------------------------*/
1520 if (strcasecmp(name, "href") == 0) {
1521 /*--------------------------------------------------------------------*/
1523 /*--------------------------------------------------------------------*/
1524 value = chxj_encoding_parameter(r, value);
1525 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1534 if (strcasecmp(name, "accesskey") == 0) {
1535 /*--------------------------------------------------------------------*/
1537 /*--------------------------------------------------------------------*/
1538 W10_L(" accesskey=\"");
1546 if (strcasecmp(name, "cti") == 0) {
1547 /*--------------------------------------------------------------------*/
1549 /*--------------------------------------------------------------------*/
1556 if (strcasecmp(name, "utn") == 0) {
1557 /*--------------------------------------------------------------------*/
1559 /*--------------------------------------------------------------------*/
1566 if (strcasecmp(name, "telbook") == 0) {
1567 /*--------------------------------------------------------------------*/
1569 /*--------------------------------------------------------------------*/
1576 if (strcasecmp(name, "kana") == 0) {
1577 /*--------------------------------------------------------------------*/
1579 /*--------------------------------------------------------------------*/
1586 if (strcasecmp(name, "email") == 0) {
1587 /*--------------------------------------------------------------------*/
1589 /*--------------------------------------------------------------------*/
1596 if (strcasecmp(name, "ista") == 0) {
1597 /*--------------------------------------------------------------------*/
1599 /*--------------------------------------------------------------------*/
1603 if (strcasecmp(name, "ilet") == 0) {
1604 /*--------------------------------------------------------------------*/
1606 /*--------------------------------------------------------------------*/
1610 if (strcasecmp(name, "iswf") == 0) {
1611 /*--------------------------------------------------------------------*/
1613 /*--------------------------------------------------------------------*/
1617 if (strcasecmp(name, "irst") == 0) {
1618 /*--------------------------------------------------------------------*/
1620 /*--------------------------------------------------------------------*/
1624 if (strcasecmp(name, "ijam") == 0) {
1625 /*--------------------------------------------------------------------*/
1627 /*--------------------------------------------------------------------*/
1638 return chtml10->out;
1643 * It is a handler who processes the A tag.
1645 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1646 * destination is specified.
1647 * @param node [i] The A tag node is specified.
1648 * @return The conversion result is returned.
1651 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1657 chtml10 = GET_CHTML10(pdoc);
1662 return chtml10->out;
1667 * It is a handler who processes the BR tag.
1669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1670 * destination is specified.
1671 * @param node [i] The BR tag node is specified.
1672 * @return The conversion result is returned.
1675 s_chtml10_start_br_tag(void *pdoc, Node *node)
1682 chtml10 = GET_CHTML10(pdoc);
1688 /*--------------------------------------------------------------------------*/
1689 /* Get Attributes */
1690 /*--------------------------------------------------------------------------*/
1691 for (attr = qs_get_attr(doc,node);
1693 attr = qs_get_next_attr(doc,attr)) {
1694 char *name = qs_get_attr_name(doc,attr);
1695 char *value = qs_get_attr_value(doc,attr);
1696 if (STRCASEEQ('c','C',"clear",name)) {
1697 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1705 return chtml10->out;
1710 * It is a handler who processes the BR tag.
1712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1713 * destination is specified.
1714 * @param node [i] The BR tag node is specified.
1715 * @return The conversion result is returned.
1718 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1720 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1722 return chtml10->out;
1727 * It is a handler who processes the TR tag.
1729 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1730 * destination is specified.
1731 * @param node [i] The TR tag node is specified.
1732 * @return The conversion result is returned.
1735 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1737 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1739 return chtml10->out;
1744 * It is a handler who processes the TR tag.
1746 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1747 * destination is specified.
1748 * @param node [i] The TR tag node is specified.
1749 * @return The conversion result is returned.
1752 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1758 chtml10 = GET_CHTML10(pdoc);
1764 return chtml10->out;
1769 * It is a handler who processes the FONT tag.
1771 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1772 * destination is specified.
1773 * @param node [i] The FONT tag node is specified.
1774 * @return The conversion result is returned.
1777 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1779 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1783 return chtml10->out;
1788 * It is a handler who processes the FONT tag.
1790 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1791 * destination is specified.
1792 * @param node [i] The FONT tag node is specified.
1793 * @return The conversion result is returned.
1796 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1798 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1802 return chtml10->out;
1807 * It is a handler who processes the FORM tag.
1809 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1810 * destination is specified.
1811 * @param node [i] The FORM tag node is specified.
1812 * @return The conversion result is returned.
1815 s_chtml10_start_form_tag(void *pdoc, Node *node)
1822 chtml10 = GET_CHTML10(pdoc);
1828 /*--------------------------------------------------------------------------*/
1829 /* Get Attributes */
1830 /*--------------------------------------------------------------------------*/
1831 for (attr = qs_get_attr(doc,node);
1833 attr = qs_get_next_attr(doc,attr)) {
1834 char *name = qs_get_attr_name(doc,attr);
1835 char *value = qs_get_attr_value(doc,attr);
1839 if (strcasecmp(name, "action") == 0) {
1840 /*--------------------------------------------------------------------*/
1842 /*--------------------------------------------------------------------*/
1843 value = chxj_encoding_parameter(r, value);
1844 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1846 W10_L(" action=\"");
1854 if (strcasecmp(name, "method") == 0) {
1855 /*--------------------------------------------------------------------*/
1857 /*--------------------------------------------------------------------*/
1858 W10_L(" method=\"");
1866 if (strcasecmp(name, "utn") == 0) {
1867 /*--------------------------------------------------------------------*/
1869 /*--------------------------------------------------------------------*/
1881 return chtml10->out;
1886 * It is a handler who processes the FORM tag.
1888 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1889 * destination is specified.
1890 * @param node [i] The FORM tag node is specified.
1891 * @return The conversion result is returned.
1894 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1900 chtml10 = GET_CHTML10(pdoc);
1906 return chtml10->out;
1911 * It is a handler who processes the INPUT tag.
1913 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1914 * destination is specified.
1915 * @param node [i] The INPUT tag node is specified.
1916 * @return The conversion result is returned.
1919 s_chtml10_start_input_tag(void *pdoc, Node *node)
1933 chtml10 = GET_CHTML10(pdoc);
1948 /*--------------------------------------------------------------------------*/
1949 /* Get Attributes */
1950 /*--------------------------------------------------------------------------*/
1952 type = qs_get_type_attr(doc, node, r);
1953 name = qs_get_name_attr(doc, node, r);
1954 value = qs_get_value_attr(doc,node,r);
1955 istyle = qs_get_istyle_attr(doc,node,r);
1956 max_length = qs_get_maxlength_attr(doc,node,r);
1957 checked = qs_get_checked_attr(doc,node,r);
1958 accesskey = qs_get_accesskey_attr(doc, node, r);
1959 size = qs_get_size_attr(doc, node, r);
1962 type = qs_trim_string(doc->buf.pool, type);
1963 if (type && (STRCASEEQ('t','T',"text", type) ||
1964 STRCASEEQ('p','P',"password",type) ||
1965 STRCASEEQ('c','C',"checkbox",type) ||
1966 STRCASEEQ('r','R',"radio", type) ||
1967 STRCASEEQ('h','H',"hidden", type) ||
1968 STRCASEEQ('s','S',"submit", type) ||
1969 STRCASEEQ('r','R',"reset", type))) {
1976 if (size && *size != 0) {
1982 if (name && *name != 0) {
1988 if (value && *value != 0) {
1990 W10_V(chxj_add_slash_to_doublequote(doc->pool,value));
1994 if (accesskey && *accesskey != 0) {
1995 W10_L(" accesskey=\"");
2001 /*------------------------------------------------------------------------*/
2003 /*------------------------------------------------------------------------*/
2006 /*--------------------------------------------------------------------------*/
2007 /* The figure is default for the password. */
2008 /*--------------------------------------------------------------------------*/
2009 if (max_length && *max_length != 0) {
2010 W10_L(" maxlength=\"");
2020 return chtml10->out;
2025 * It is a handler who processes the INPUT tag.
2027 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2028 * destination is specified.
2029 * @param node [i] The INPUT tag node is specified.
2030 * @return The conversion result is returned.
2033 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2035 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2037 return chtml10->out;
2042 * It is a handler who processes the CENTER tag.
2044 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2045 * destination is specified.
2046 * @param node [i] The CENTER tag node is specified.
2047 * @return The conversion result is returned.
2050 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2056 chtml10 = GET_CHTML10(pdoc);
2062 return chtml10->out;
2067 * It is a handler who processes the CENTER tag.
2069 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2070 * destination is specified.
2071 * @param node [i] The CENTER tag node is specified.
2072 * @return The conversion result is returned.
2075 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2081 chtml10 = GET_CHTML10(pdoc);
2087 return chtml10->out;
2092 * It is a handler who processes the HR tag.
2094 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2095 * destination is specified.
2096 * @param node [i] The HR tag node is specified.
2097 * @return The conversion result is returned.
2100 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2107 chtml10 = GET_CHTML10(pdoc);
2113 for (attr = qs_get_attr(doc,node);
2115 attr = qs_get_next_attr(doc,attr)) {
2116 char *name = qs_get_attr_name (doc,attr);
2117 char *value = qs_get_attr_value(doc,attr);
2121 if (strcasecmp(name, "align") == 0) {
2122 /*--------------------------------------------------------------------*/
2124 /*--------------------------------------------------------------------*/
2125 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2135 if (strcasecmp(name, "size") == 0) {
2136 /*--------------------------------------------------------------------*/
2138 /*--------------------------------------------------------------------*/
2139 if (value && value[0] != '\0') {
2149 if (strcasecmp(name, "width") == 0) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2153 if (value && value[0] != '\0') {
2163 if (strcasecmp(name, "noshade") == 0) {
2164 /*--------------------------------------------------------------------*/
2166 /*--------------------------------------------------------------------*/
2173 if (strcasecmp(name, "color") == 0) {
2174 /*--------------------------------------------------------------------*/
2176 /*--------------------------------------------------------------------*/
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 /*--------------------------------------------------------------------*/
2290 if (value && (STRCASEEQ('t','T',"top", value) ||
2291 STRCASEEQ('m','M',"middle",value) ||
2292 STRCASEEQ('b','B',"bottom",value) ||
2293 STRCASEEQ('l','L',"left", value) ||
2294 STRCASEEQ('r','R',"right", value))) {
2300 else if (strcasecmp(name, "alt" ) == 0) {
2301 /*--------------------------------------------------------------------*/
2303 /*--------------------------------------------------------------------*/
2304 if (value && value[0] != '\0') {
2314 if (strcasecmp(name, "width" ) == 0) {
2315 /*--------------------------------------------------------------------*/
2317 /*--------------------------------------------------------------------*/
2318 if (value && value[0] != '\0') {
2328 if (strcasecmp(name, "height") == 0) {
2329 /*--------------------------------------------------------------------*/
2331 /*--------------------------------------------------------------------*/
2332 if (value && value[0] != '\0') {
2333 W10_L(" height=\"");
2339 if (strcasecmp(name, "hspace") == 0) {
2340 /*--------------------------------------------------------------------*/
2342 /*--------------------------------------------------------------------*/
2343 if (value && value[0] != '\0') {
2344 W10_L(" hspace=\"");
2353 if (strcasecmp(name, "vspace") == 0) {
2354 /*--------------------------------------------------------------------*/
2356 /*--------------------------------------------------------------------*/
2357 if (value && value[0] != '\0') {
2358 W10_L(" vspace=\"");
2371 return chtml10->out;
2376 * It is a handler who processes the IMG tag.
2378 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2379 * destination is specified.
2380 * @param node [i] The IMG tag node is specified.
2381 * @return The conversion result is returned.
2384 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2386 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2388 return chtml10->out;
2393 * It is a handler who processes the SELECT tag.
2395 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2396 * destination is specified.
2397 * @param node [i] The SELECT tag node is specified.
2398 * @return The conversion result is returned.
2401 s_chtml10_start_select_tag(void *pdoc, Node *child)
2411 chtml10 = GET_CHTML10(pdoc);
2419 for (attr = qs_get_attr(doc,child);
2421 attr = qs_get_next_attr(doc,attr)) {
2422 char *nm = qs_get_attr_name (doc,attr);
2423 char *val = qs_get_attr_value(doc,attr);
2427 if (strcasecmp(nm, "size") == 0) {
2428 /*--------------------------------------------------------------------*/
2429 /* CHTML 1.0 version 2.0 */
2430 /*--------------------------------------------------------------------*/
2431 size = apr_pstrdup(doc->buf.pool, val);
2437 if (strcasecmp(nm, "name") == 0) {
2438 /*--------------------------------------------------------------------*/
2439 /* CHTML 1.0 version 2.0 */
2440 /*--------------------------------------------------------------------*/
2441 name = apr_pstrdup(doc->buf.pool, val);
2447 if (strcasecmp(nm, "multiple") == 0) {
2448 /*--------------------------------------------------------------------*/
2449 /* CHTML 1.0 version 2.0 */
2450 /*--------------------------------------------------------------------*/
2460 if (size && *size != 0) {
2466 if (name && *name != 0) {
2473 return chtml10->out;
2478 * It is a handler who processes the SELECT tag.
2480 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2481 * destination is specified.
2482 * @param node [i] The SELECT tag node is specified.
2483 * @return The conversion result is returned.
2486 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2492 chtml10 = GET_CHTML10(pdoc);
2497 return chtml10->out;
2502 * It is a handler who processes the OPTION tag.
2504 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2505 * destination is specified.
2506 * @param node [i] The OPTION tag node is specified.
2507 * @return The conversion result is returned.
2510 s_chtml10_start_option_tag(void *pdoc, Node *child)
2519 chtml10 = GET_CHTML10(pdoc);
2528 for (attr = qs_get_attr(doc,child);
2530 attr = qs_get_next_attr(doc,attr)) {
2531 char *nm = qs_get_attr_name (doc,attr);
2532 char *val = qs_get_attr_value(doc,attr);
2536 if (strcasecmp(nm, "selected") == 0) {
2537 /*--------------------------------------------------------------------*/
2538 /* CHTML 1.0 version 2.0 */
2539 /*--------------------------------------------------------------------*/
2540 selected = apr_pstrdup(doc->buf.pool, val);
2546 if (strcasecmp(nm, "value") == 0) {
2547 /*--------------------------------------------------------------------*/
2548 /* CHTML 1.0 version 2.0 */
2549 /*--------------------------------------------------------------------*/
2550 value = apr_pstrdup(doc->buf.pool, val);
2559 if (value && *value != 0) {
2570 return chtml10->out;
2575 * It is a handler who processes the OPTION tag.
2577 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2578 * destination is specified.
2579 * @param node [i] The OPTION tag node is specified.
2580 * @return The conversion result is returned.
2583 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2585 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2589 return chtml10->out;
2594 * It is a handler who processes the DIV tag.
2596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2597 * destination is specified.
2598 * @param node [i] The DIV tag node is specified.
2599 * @return The conversion result is returned.
2602 s_chtml10_start_div_tag(void *pdoc, Node *child)
2610 chtml10 = GET_CHTML10(pdoc);
2617 for (attr = qs_get_attr(doc,child);
2619 attr = qs_get_next_attr(doc,attr)) {
2620 char *nm = qs_get_attr_name(doc,attr);
2621 char *val = qs_get_attr_value(doc,attr);
2622 if (STRCASEEQ('a','A',"align", nm)) {
2623 /*----------------------------------------------------------------------*/
2624 /* CHTML 1.0 (W3C version 3.2) */
2625 /*----------------------------------------------------------------------*/
2626 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2627 align = apr_pstrdup(doc->buf.pool, val);
2639 return chtml10->out;
2644 * It is a handler who processes the DIV tag.
2646 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2647 * destination is specified.
2648 * @param node [i] The DIV tag node is specified.
2649 * @return The conversion result is returned.
2652 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2658 chtml10 = GET_CHTML10(pdoc);
2663 return chtml10->out;
2668 * It is a handler who processes the CHXJ:IF tag.
2670 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2671 * destination is specified.
2672 * @param node [i] The CHXJ:IF tag node is specified.
2673 * @return The conversion result is returned.
2676 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2683 chtml10 = GET_CHTML10(pdoc);
2687 for (child = qs_get_child_node(doc, node);
2689 child = qs_get_next_node(doc, child)) {
2690 W10_V(child->otext);
2691 s_chtml10_chxjif_tag(chtml10, child);
2694 return chtml10->out;
2699 * It is a handler who processes the PRE tag.
2701 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2702 * destination is specified.
2703 * @param node [i] The PRE tag node is specified.
2704 * @return The conversion result is returned.
2707 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2713 chtml10 = GET_CHTML10(pdoc);
2717 chtml10->pre_flag++;
2719 return chtml10->out;
2724 * It is a handler who processes the PRE tag.
2726 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2727 * destination is specified.
2728 * @param node [i] The PRE tag node is specified.
2729 * @return The conversion result is returned.
2732 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2738 chtml10 = GET_CHTML10(pdoc);
2743 chtml10->pre_flag--;
2745 return chtml10->out;
2750 * It is a handler who processes the P tag.
2752 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2753 * destination is specified.
2754 * @param node [i] The P tag node is specified.
2755 * @return The conversion result is returned.
2758 s_chtml10_start_p_tag(void *pdoc, Node *node)
2766 chtml10 = GET_CHTML10(pdoc);
2771 for (attr = qs_get_attr(doc,node);
2773 attr = qs_get_next_attr(doc,attr)) {
2774 char *nm = qs_get_attr_name(doc,attr);
2775 char *val = qs_get_attr_value(doc,attr);
2776 if (STRCASEEQ('a','A',"align", nm)) {
2777 /*----------------------------------------------------------------------*/
2778 /* CHTML 1.0 (W3C version 3.2) */
2779 /*----------------------------------------------------------------------*/
2780 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2781 align = apr_pstrdup(doc->buf.pool, val);
2793 return chtml10->out;
2798 * It is a handler who processes the P tag.
2800 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2801 * destination is specified.
2802 * @param node [i] The P tag node is specified.
2803 * @return The conversion result is returned.
2806 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2812 chtml10 = GET_CHTML10(pdoc);
2817 return chtml10->out;
2822 * It is a handler who processes the TEXTARE tag.
2824 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2825 * destination is specified.
2826 * @param node [i] The TEXTAREA tag node is specified.
2827 * @return The conversion result is returned.
2830 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2837 chtml10 = GET_CHTML10(pdoc);
2842 chtml10->textarea_flag++;
2846 for (attr = qs_get_attr(doc,node);
2848 attr = qs_get_next_attr(doc,attr)) {
2849 char *name = qs_get_attr_name (doc,attr);
2850 char *value = qs_get_attr_value(doc,attr);
2854 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2855 W10_L(" accesskey=\"");
2863 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2872 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2881 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2893 return chtml10->out;
2898 * It is a handler who processes the TEXTAREA tag.
2900 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2901 * destination is specified.
2902 * @param node [i] The TEXTAREA tag node is specified.
2903 * @return The conversion result is returned.
2906 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2912 chtml10 = GET_CHTML10(pdoc);
2916 W10_L("</textarea>");
2917 chtml10->textarea_flag--;
2919 return chtml10->out;
2924 s_chtml10_text(void *pdoc, Node *child)
2936 chtml10 = GET_CHTML10(pdoc);
2940 textval = qs_get_node_value(doc,child);
2941 if (strlen(textval) == 0) {
2942 return chtml10->out;
2945 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2946 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2948 tdst = qs_alloc_zero_byte_string(r);
2949 memset(one_byte, 0, sizeof(one_byte));
2952 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2956 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2958 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2963 if (is_sjis_kanji(textval[ii])) {
2964 one_byte[0] = textval[ii+0];
2965 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2966 one_byte[0] = textval[ii+1];
2967 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2971 if (chtml10->pre_flag) {
2972 one_byte[0] = textval[ii+0];
2973 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2976 if (chtml10->textarea_flag) {
2977 one_byte[0] = textval[ii+0];
2978 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2981 if (textval[ii] != '\r' && textval[ii] != '\n') {
2982 one_byte[0] = textval[ii+0];
2983 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2988 return chtml10->out;
2993 * It is a handler who processes the BLOCKQUOTE tag.
2995 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2996 * destination is specified.
2997 * @param node [i] The BLOCKQUOTE tag node is specified.
2998 * @return The conversion result is returned.
3001 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3005 chtml10 = GET_CHTML10(pdoc);
3007 W10_L("<blockquote>");
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_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3026 chtml10 = GET_CHTML10(pdoc);
3028 W10_L("</blockquote>");
3029 return chtml10->out;
3034 * It is a handler who processes the DIR tag.
3036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3037 * destination is specified.
3038 * @param node [i] The DIR tag node is specified.
3039 * @return The conversion result is returned.
3042 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3046 chtml10 = GET_CHTML10(pdoc);
3049 return chtml10->out;
3054 * It is a handler who processes the DIR tag.
3056 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3057 * destination is specified.
3058 * @param node [i] The DIR tag node is specified.
3059 * @return The conversion result is returned.
3062 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3067 chtml10 = GET_CHTML10(pdoc);
3070 return chtml10->out;
3075 * It is a handler who processes the DL tag.
3077 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3078 * destination is specified.
3079 * @param node [i] The DL tag node is specified.
3080 * @return The conversion result is returned.
3083 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3087 chtml10 = GET_CHTML10(pdoc);
3090 return chtml10->out;
3095 * It is a handler who processes the DL tag.
3097 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3098 * destination is specified.
3099 * @param node [i] The DL tag node is specified.
3100 * @return The conversion result is returned.
3103 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3107 chtml10 = GET_CHTML10(pdoc);
3110 return chtml10->out;
3115 * It is a handter who processes the DT tag.
3117 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3118 * destination is specified.
3119 * @param node [i] The DT tag node is specified.
3120 * @return The conversion result is returned.
3123 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3127 chtml10 = GET_CHTML10(pdoc);
3130 return chtml10->out;
3135 * It is a handter who processes the DT tag.
3137 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3138 * destination is specified.
3139 * @param node [i] The DT tag node is specified.
3140 * @return The conversion result is returned.
3143 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3146 chtml10 = GET_CHTML10(pdoc);
3147 return chtml10->out;
3152 * It is a handder who processes the DD tag.
3154 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3155 * destination is specified.
3156 * @param node [i] The DD tag node is specified.
3157 * @return The conversion result is returned.
3160 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3164 chtml10 = GET_CHTML10(pdoc);
3167 return chtml10->out;
3172 * It is a handder who processes the DD tag.
3174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3175 * destination is specified.
3176 * @param node [i] The DD tag node is specified.
3177 * @return The conversion result is returned.
3180 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3183 chtml10 = GET_CHTML10(pdoc);
3184 return chtml10->out;
3189 * It is a hanmenuer who processes the MENU tag.
3191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3192 * destination is specified.
3193 * @param node [i] The MENU tag node is specified.
3194 * @return The conversion result is returned.
3197 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3201 chtml10 = GET_CHTML10(pdoc);
3204 return chtml10->out;
3209 * It is a hanmenuer who processes the MENU tag.
3211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3212 * destination is specified.
3213 * @param node [i] The MENU tag node is specified.
3214 * @return The conversion result is returned.
3217 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3219 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3220 Doc *doc = chtml10->doc;
3222 return chtml10->out;
3227 * It is a hanplaintexter who processes the PLAINTEXT tag.
3229 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3230 * destination is specified.
3231 * @param node [i] The PLAINTEXT tag node is specified.
3232 * @return The conversion result is returned.
3235 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3240 chtml10 = GET_CHTML10(pdoc);
3242 W10_L("<plaintext>");
3243 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3244 return chtml10->out;
3248 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3253 chtml10 = GET_CHTML10(pdoc);
3255 for (child = qs_get_child_node(doc, node);
3257 child = qs_get_next_node(doc, child)) {
3258 W10_V(child->otext);
3259 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3261 return chtml10->out;
3266 * It is a hanplaintexter who processes the PLAINTEXT tag.
3268 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3269 * destination is specified.
3270 * @param node [i] The PLAINTEXT tag node is specified.
3271 * @return The conversion result is returned.
3274 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3276 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3277 return chtml10->out;