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_chtml20.h"
18 #include "chxj_hdml.h"
19 #include "chxj_str_util.h"
20 #include "chxj_dump.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_qr_code.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
27 #define GET_CHTML20(X) ((chtml20_t*)(X))
28 #define W_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
29 #define W_V(X) do { chtml20->out = (X) ? BUFFERED_WRITE_VALUE(chtml20->out, &doc->buf, (X)) \
30 : BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, ""); } while(0)
32 static char *s_chtml20_start_html_tag (void *pdoc, Node *node);
33 static char *s_chtml20_end_html_tag (void *pdoc, Node *node);
34 static char *s_chtml20_start_meta_tag (void *pdoc, Node *node);
35 static char *s_chtml20_end_meta_tag (void *pdoc, Node *node);
36 static char *s_chtml20_start_textarea_tag(void *pdoc, Node *node);
37 static char *s_chtml20_end_textarea_tag (void *pdoc, Node *node);
38 static char *s_chtml20_start_p_tag (void *pdoc, Node *node);
39 static char *s_chtml20_end_p_tag (void *pdoc, Node *node);
40 static char *s_chtml20_start_pre_tag (void *pdoc, Node *node);
41 static char *s_chtml20_end_pre_tag (void *pdoc, Node *node);
42 static char *s_chtml20_start_h1_tag (void *pdoc, Node *node);
43 static char *s_chtml20_end_h1_tag (void *pdoc, Node *node);
44 static char *s_chtml20_start_h2_tag (void *pdoc, Node *node);
45 static char *s_chtml20_end_h2_tag (void *pdoc, Node *node);
46 static char *s_chtml20_start_h3_tag (void *pdoc, Node *node);
47 static char *s_chtml20_end_h3_tag (void *pdoc, Node *node);
48 static char *s_chtml20_start_h4_tag (void *pdoc, Node *node);
49 static char *s_chtml20_end_h4_tag (void *pdoc, Node *node);
50 static char *s_chtml20_start_h5_tag (void *pdoc, Node *node);
51 static char *s_chtml20_end_h5_tag (void *pdoc, Node *node);
52 static char *s_chtml20_start_h6_tag (void *pdoc, Node *node);
53 static char *s_chtml20_end_h6_tag (void *pdoc, Node *node);
54 static char *s_chtml20_start_ul_tag (void *pdoc, Node *node);
55 static char *s_chtml20_end_ul_tag (void *pdoc, Node *node);
56 static char *s_chtml20_start_ol_tag (void *pdoc, Node *node);
57 static char *s_chtml20_end_ol_tag (void *pdoc, Node *node);
58 static char *s_chtml20_start_li_tag (void *pdoc, Node *node);
59 static char *s_chtml20_end_li_tag (void *pdoc, Node *node);
60 static char *s_chtml20_start_head_tag (void *pdoc, Node *node);
61 static char *s_chtml20_end_head_tag (void *pdoc, Node *node);
62 static char *s_chtml20_start_title_tag (void *pdoc, Node *node);
63 static char *s_chtml20_end_title_tag (void *pdoc, Node *node);
64 static char *s_chtml20_start_base_tag (void *pdoc, Node *node);
65 static char *s_chtml20_end_base_tag (void *pdoc, Node *node);
66 static char *s_chtml20_start_body_tag (void *pdoc, Node *node);
67 static char *s_chtml20_end_body_tag (void *pdoc, Node *node);
68 static char *s_chtml20_start_a_tag (void *pdoc, Node *node);
69 static char *s_chtml20_end_a_tag (void *pdoc, Node *node);
70 static char *s_chtml20_start_br_tag (void *pdoc, Node *node);
71 static char *s_chtml20_end_br_tag (void *pdoc, Node *node);
72 static char *s_chtml20_start_tr_tag (void *pdoc, Node *node);
73 static char *s_chtml20_end_tr_tag (void *pdoc, Node *node);
74 static char *s_chtml20_start_font_tag (void *pdoc, Node *node);
75 static char *s_chtml20_end_font_tag (void *pdoc, Node *node);
76 static char *s_chtml20_start_form_tag (void *pdoc, Node *node);
77 static char *s_chtml20_end_form_tag (void *pdoc, Node *node);
78 static char *s_chtml20_start_input_tag (void *pdoc, Node *node);
79 static char *s_chtml20_end_input_tag (void *pdoc, Node *node);
80 static char *s_chtml20_start_center_tag (void *pdoc, Node *node);
81 static char *s_chtml20_end_center_tag (void *pdoc, Node *node);
82 static char *s_chtml20_start_hr_tag (void *pdoc, Node *node);
83 static char *s_chtml20_end_hr_tag (void *pdoc, Node *node);
84 static char *s_chtml20_start_img_tag (void *pdoc, Node *node);
85 static char *s_chtml20_end_img_tag (void *pdoc, Node *node);
86 static char *s_chtml20_start_select_tag (void *pdoc, Node *node);
87 static char *s_chtml20_end_select_tag (void *pdoc, Node *node);
88 static char *s_chtml20_start_option_tag (void *pdoc, Node *node);
89 static char *s_chtml20_end_option_tag (void *pdoc, Node *node);
90 static char *s_chtml20_start_div_tag (void *pdoc, Node *node);
91 static char *s_chtml20_end_div_tag (void *pdoc, Node *node);
92 static char *s_chtml20_start_blockquote_tag(void *pdoc, Node *node);
93 static char *s_chtml20_end_blockquote_tag (void *pdoc, Node *node);
94 static char *s_chtml20_start_dir_tag (void *pdoc, Node *node);
95 static char *s_chtml20_end_dir_tag (void *pdoc, Node *node);
96 static char *s_chtml20_start_dl_tag (void *pdoc, Node *node);
97 static char *s_chtml20_end_dl_tag (void *pdoc, Node *node);
98 static char *s_chtml20_start_dt_tag (void *pdoc, Node *node);
99 static char *s_chtml20_end_dt_tag (void *pdoc, Node *node);
100 static char *s_chtml20_start_dd_tag (void *pdoc, Node *node);
101 static char *s_chtml20_end_dd_tag (void *pdoc, Node *node);
102 static char *s_chtml20_start_menu_tag (void *pdoc, Node *node);
103 static char *s_chtml20_end_menu_tag (void *pdoc, Node *node);
104 static char *s_chtml20_start_plaintext_tag (void *pdoc, Node *node);
105 static char *s_chtml20_start_plaintext_tag_inner (void *pdoc, Node *node);
106 static char *s_chtml20_end_plaintext_tag (void *pdoc, Node *node);
107 static char *s_chtml20_start_blink_tag (void *pdoc, Node *node);
108 static char *s_chtml20_end_blink_tag (void *pdoc, Node *node);
110 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
112 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
114 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
115 static char *s_chtml20_text_tag(void *pdoc, Node *node);
118 tag_handler chtml20_handler[] = {
121 s_chtml20_start_html_tag,
122 s_chtml20_end_html_tag,
126 s_chtml20_start_meta_tag,
127 s_chtml20_end_meta_tag,
131 s_chtml20_start_textarea_tag,
132 s_chtml20_end_textarea_tag,
136 s_chtml20_start_p_tag,
141 s_chtml20_start_pre_tag,
142 s_chtml20_end_pre_tag,
146 s_chtml20_start_ul_tag,
147 s_chtml20_end_ul_tag,
151 s_chtml20_start_li_tag,
152 s_chtml20_end_li_tag,
156 s_chtml20_start_ol_tag,
157 s_chtml20_end_ol_tag,
161 s_chtml20_start_h1_tag,
162 s_chtml20_end_h1_tag,
166 s_chtml20_start_h2_tag,
167 s_chtml20_end_h2_tag,
171 s_chtml20_start_h3_tag,
172 s_chtml20_end_h3_tag,
176 s_chtml20_start_h4_tag,
177 s_chtml20_end_h4_tag,
181 s_chtml20_start_h5_tag,
182 s_chtml20_end_h5_tag,
186 s_chtml20_start_h6_tag,
187 s_chtml20_end_h6_tag,
191 s_chtml20_start_head_tag,
192 s_chtml20_end_head_tag,
196 s_chtml20_start_title_tag,
197 s_chtml20_end_title_tag,
201 s_chtml20_start_base_tag,
202 s_chtml20_end_base_tag,
206 s_chtml20_start_body_tag,
207 s_chtml20_end_body_tag,
211 s_chtml20_start_a_tag,
216 s_chtml20_start_br_tag,
217 s_chtml20_end_br_tag,
226 s_chtml20_start_tr_tag,
227 s_chtml20_end_tr_tag,
241 s_chtml20_start_font_tag,
242 s_chtml20_end_font_tag,
246 s_chtml20_start_form_tag,
247 s_chtml20_end_form_tag,
251 s_chtml20_start_input_tag,
252 s_chtml20_end_input_tag,
256 s_chtml20_start_center_tag,
257 s_chtml20_end_center_tag,
261 s_chtml20_start_hr_tag,
262 s_chtml20_end_hr_tag,
266 s_chtml20_start_img_tag,
267 s_chtml20_end_img_tag,
271 s_chtml20_start_select_tag,
272 s_chtml20_end_select_tag,
276 s_chtml20_start_option_tag,
277 s_chtml20_end_option_tag,
281 s_chtml20_start_div_tag,
282 s_chtml20_end_div_tag,
286 s_chtml20_chxjif_tag,
331 s_chtml20_start_dt_tag,
332 s_chtml20_end_dt_tag,
346 s_chtml20_start_blockquote_tag,
347 s_chtml20_end_blockquote_tag,
351 s_chtml20_start_dir_tag,
352 s_chtml20_end_dir_tag,
356 s_chtml20_start_dl_tag,
357 s_chtml20_end_dl_tag,
361 s_chtml20_start_dd_tag,
362 s_chtml20_end_dd_tag,
366 s_chtml20_start_menu_tag,
367 s_chtml20_end_menu_tag,
371 s_chtml20_start_plaintext_tag,
372 s_chtml20_end_plaintext_tag,
376 s_chtml20_start_blink_tag,
377 s_chtml20_end_blink_tag,
382 * converts from CHTML5.0 to CHTML2.0.
384 * @param r [i] Requet_rec is appointed.
385 * @param spec [i] The result of the device specification processing which
386 * was done in advance is appointed.
387 * @param src [i] The character string before the converting is appointed.
388 * @return The character string after the converting is returned.
391 chxj_exchange_chtml20(
397 chxjconvrule_entry *entryp,
406 /*--------------------------------------------------------------------------*/
408 /*--------------------------------------------------------------------------*/
410 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
412 DBG(r,"i found qrcode xml");
415 DBG(r,"not found qrcode xml");
417 /*--------------------------------------------------------------------------*/
418 /* The CHTML structure is initialized. */
419 /*--------------------------------------------------------------------------*/
420 s_init_chtml20(&chtml20, &doc, r, spec);
423 chtml20.entryp = entryp;
424 chtml20.cookie = cookie;
426 chxj_set_content_type(r, "text/html; charset=Windows-31J");
428 /*--------------------------------------------------------------------------*/
429 /* The character string of the input is analyzed. */
430 /*--------------------------------------------------------------------------*/
431 qs_init_malloc(&doc);
432 qs_init_root_node(&doc);
434 ss = apr_pcalloc(r->pool, srclen + 1);
435 memset(ss, 0, srclen + 1);
436 memcpy(ss, src, srclen);
439 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
442 qs_parse_string(&doc,ss, strlen(ss));
444 chxj_buffered_write_init(r->pool, &doc.buf);
445 /*--------------------------------------------------------------------------*/
446 /* It converts it from CHTML to CHTML. */
447 /*--------------------------------------------------------------------------*/
448 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
449 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
450 dst = apr_pstrdup(r->pool, chtml20.out);
451 chxj_buffered_write_terminate(&doc.buf);
453 qs_all_free(&doc,QX_LOGMARK);
456 return apr_pstrdup(r->pool,ss);
459 if (strlen(dst) == 0) {
460 dst = apr_psprintf(r->pool, "\n");
463 *dstlen = strlen(dst);
466 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
473 * The CHTML structure is initialized.
475 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
476 * initialized is specified.
477 * @param doc [i] The Doc structure that should be set to the initialized
478 * HDML structure is specified.
479 * @param r [i] To use POOL, the pointer to request_rec is specified.
480 * @param spec [i] The pointer to the device_table
483 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
485 memset(doc, 0, sizeof(Doc));
486 memset(chtml20, 0, sizeof(chtml20_t));
490 chtml20->spec = spec;
491 chtml20->out = qs_alloc_zero_byte_string(r);
492 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
494 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
499 * Corresponding EMOJI to a current character-code is retrieved.
500 * The substitution character string is stored in the rslt pointer if agreeing.
502 * @param chtml20 [i] The pointer to the CHTML structure is specified.
503 * @param txt [i] The character string to want to examine whether it is
504 * EMOJI is specified.
505 * @param rslt [o] The pointer to the pointer that stores the result is
507 * @return When corresponding EMOJI exists, it returns it excluding 0.
510 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
517 spec = chtml20->spec;
523 DBG(r,"spec is NULL");
525 for (ee = chtml20->conf->emoji;
529 if (ee->imode == NULL) {
530 DBG(r,"emoji->imode is NULL");
534 if (ee->imode->string != NULL
535 && strlen(ee->imode->string) > 0
536 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
537 if (spec == NULL || spec->emoji_type == NULL) {
538 *rslt = apr_palloc(r->pool, 3);
539 (*rslt)[0] = ee->imode->hex1byte & 0xff;
540 (*rslt)[1] = ee->imode->hex2byte & 0xff;
542 return strlen(ee->imode->string);
554 * It is a handler who processes the HTML tag.
556 * @param pdoc [i/o] The pointer to the CHTML structure at the output
557 * destination is specified.
558 * @param node [i] The HTML tag node is specified.
559 * @return The conversion result is returned.
562 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
568 chtml20 = GET_CHTML20(pdoc);
572 /*--------------------------------------------------------------------------*/
574 /*--------------------------------------------------------------------------*/
581 * It is a handler who processes the HTML tag.
583 * @param pdoc [i/o] The pointer to the CHTML structure at the output
584 * destination is specified.
585 * @param node [i] The HTML tag node is specified.
586 * @return The conversion result is returned.
589 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
595 chtml20 = GET_CHTML20(pdoc);
605 * It is a handler who processes the META tag.
607 * @param pdoc [i/o] The pointer to the CHTML structure at the output
608 * destination is specified.
609 * @param node [i] The META tag node is specified.
610 * @return The conversion result is returned.
613 s_chtml20_start_meta_tag(void *pdoc, Node *node)
619 int content_type_flag;
622 chtml20 = GET_CHTML20(pdoc);
626 content_type_flag = 0;
630 /*--------------------------------------------------------------------------*/
632 /*--------------------------------------------------------------------------*/
633 for (attr = qs_get_attr(doc,node);
635 attr = qs_get_next_attr(doc,attr)) {
640 name = qs_get_attr_name(doc,attr);
641 value = qs_get_attr_value(doc,attr);
646 if (strcasecmp(name, "http-equiv") == 0) {
647 /*----------------------------------------------------------------------*/
649 /*----------------------------------------------------------------------*/
650 W_L(" http-equiv=\"");
653 if (STRCASEEQ('c','C',"content-type", value)) {
654 content_type_flag = 1;
656 if (STRCASEEQ('r','R',"refresh", value)) {
664 if (strcasecmp(name, "content") == 0) {
665 if (content_type_flag) {
668 W_L("=\"text/html; charset=Windows-31J\"");
670 else if (refresh_flag) {
671 char *buf = apr_pstrdup(r->pool, value);
675 url = strchr(buf, ';');
677 sec = apr_pstrdup(r->pool, buf);
680 url = chxj_encoding_parameter(r, url);
681 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
711 * It is a handler who processes the META tag.
713 * @param pdoc [i/o] The pointer to the CHTML structure at the output
714 * destination is specified.
715 * @param node [i] The META tag node is specified.
716 * @return The conversion result is returned.
719 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
723 chtml20 = GET_CHTML20(pdoc);
730 * It is a handler who processes the HEAD tag.
732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
733 * destination is specified.
734 * @param node [i] The HEAD tag node is specified.
735 * @return The conversion result is returned.
738 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
744 chtml20 = GET_CHTML20(pdoc);
754 * It is a handler who processes the HEAD tag.
756 * @param pdoc [i/o] The pointer to the CHTML structure at the output
757 * destination is specified.
758 * @param node [i] The HEAD tag node is specified.
759 * @return The conversion result is returned.
762 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
768 chtml20 = GET_CHTML20(pdoc);
778 * It is a handler who processes the TITLE tag.
780 * @param pdoc [i/o] The pointer to the CHTML structure at the output
781 * destination is specified.
782 * @param node [i] The TITLE tag node is specified.
783 * @return The conversion result is returned.
786 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
792 chtml20 = GET_CHTML20(pdoc);
802 * It is a handler who processes the TITLE tag.
804 * @param pdoc [i/o] The pointer to the CHTML structure at the output
805 * destination is specified.
806 * @param node [i] The TITLE tag node is specified.
807 * @return The conversion result is returned.
810 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
816 chtml20 = GET_CHTML20(pdoc);
826 * It is a handler who processes the BASE tag.
828 * @param pdoc [i/o] The pointer to the CHTML structure at the output
829 * destination is specified.
830 * @param node [i] The BASE tag node is specified.
831 * @return The conversion result is returned.
834 s_chtml20_start_base_tag(void *pdoc, Node *node)
841 chtml20 = GET_CHTML20(pdoc);
846 /*--------------------------------------------------------------------------*/
848 /*--------------------------------------------------------------------------*/
849 for (attr = qs_get_attr(doc,node);
851 attr = qs_get_next_attr(doc,attr)) {
856 name = qs_get_attr_name(doc,attr);
857 value = qs_get_attr_value(doc,attr);
859 if (STRCASEEQ('h','H',"href", name)) {
871 * It is a handler who processes the BASE tag.
873 * @param pdoc [i/o] The pointer to the CHTML structure at the output
874 * destination is specified.
875 * @param node [i] The BASE tag node is specified.
876 * @return The conversion result is returned.
879 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
885 chtml20 = GET_CHTML20(pdoc);
894 * It is a handler who processes the BODY tag.
896 * @param pdoc [i/o] The pointer to the CHTML structure at the output
897 * destination is specified.
898 * @param node [i] The BODY tag node is specified.
899 * @return The conversion result is returned.
902 s_chtml20_start_body_tag(void *pdoc, Node *node)
909 chtml20 = GET_CHTML20(pdoc);
914 /*--------------------------------------------------------------------------*/
916 /*--------------------------------------------------------------------------*/
917 for (attr = qs_get_attr(doc,node);
919 attr = qs_get_next_attr(doc,attr)) {
923 name = qs_get_attr_name(doc,attr);
924 value = qs_get_attr_value(doc,attr);
929 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
930 /*----------------------------------------------------------------------*/
932 /*----------------------------------------------------------------------*/
941 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
942 /*----------------------------------------------------------------------*/
944 /*----------------------------------------------------------------------*/
953 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
954 /*----------------------------------------------------------------------*/
956 /*----------------------------------------------------------------------*/
965 if (strcasecmp(name, "alink") == 0) {
966 /*----------------------------------------------------------------------*/
968 /*----------------------------------------------------------------------*/
975 if (strcasecmp(name, "vlink") == 0) {
976 /*----------------------------------------------------------------------*/
978 /*----------------------------------------------------------------------*/
993 * It is a handler who processes the BODY tag.
995 * @param pdoc [i/o] The pointer to the CHTML structure at the output
996 * destination is specified.
997 * @param node [i] The BODY tag node is specified.
998 * @return The conversion result is returned.
1001 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
1007 chtml20 = GET_CHTML20(pdoc);
1012 return chtml20->out;
1017 * It is a handler who processes the A tag.
1019 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1020 * destination is specified.
1021 * @param node [i] The A tag node is specified.
1022 * @return The conversion result is returned.
1025 s_chtml20_start_a_tag(void *pdoc, Node *node)
1032 chtml20 = GET_CHTML20(pdoc);
1037 /*--------------------------------------------------------------------------*/
1038 /* Get Attributes */
1039 /*--------------------------------------------------------------------------*/
1040 for (attr = qs_get_attr(doc,node);
1042 attr = qs_get_next_attr(doc,attr)) {
1047 name = qs_get_attr_name(doc,attr);
1048 value = qs_get_attr_value(doc,attr);
1053 if (strcasecmp(name, "name") == 0) {
1054 /*--------------------------------------------------------------------*/
1056 /*--------------------------------------------------------------------*/
1065 if (strcasecmp(name, "href") == 0) {
1066 /*--------------------------------------------------------------------*/
1068 /*--------------------------------------------------------------------*/
1069 value = chxj_encoding_parameter(r, value);
1070 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1079 if (strcasecmp(name, "accesskey") == 0) {
1080 /*--------------------------------------------------------------------*/
1082 /*--------------------------------------------------------------------*/
1083 W_L(" accesskey=\"");
1091 if (strcasecmp(name, "cti") == 0) {
1092 /*--------------------------------------------------------------------*/
1094 /*--------------------------------------------------------------------*/
1103 if (strcasecmp(name, "ijam") == 0) {
1104 /*--------------------------------------------------------------------*/
1106 /*--------------------------------------------------------------------*/
1110 if (strcasecmp(name, "ista") == 0) {
1111 /*--------------------------------------------------------------------*/
1113 /*--------------------------------------------------------------------*/
1117 if (strcasecmp(name, "ilet") == 0) {
1118 /*--------------------------------------------------------------------*/
1120 /*--------------------------------------------------------------------*/
1124 if (strcasecmp(name, "iswf") == 0) {
1125 /*--------------------------------------------------------------------*/
1127 /*--------------------------------------------------------------------*/
1131 if (strcasecmp(name, "irst") == 0) {
1132 /*--------------------------------------------------------------------*/
1134 /*--------------------------------------------------------------------*/
1141 if (strcasecmp(name, "utn") == 0) {
1142 /*--------------------------------------------------------------------*/
1144 /*--------------------------------------------------------------------*/
1151 if (strcasecmp(name, "telbook") == 0) {
1152 /*--------------------------------------------------------------------*/
1154 /*--------------------------------------------------------------------*/
1161 if (strcasecmp(name, "kana") == 0) {
1162 /*--------------------------------------------------------------------*/
1164 /*--------------------------------------------------------------------*/
1171 if (strcasecmp(name, "email") == 0) {
1172 /*--------------------------------------------------------------------*/
1174 /*--------------------------------------------------------------------*/
1184 return chtml20->out;
1189 * It is a handler who processes the A tag.
1191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1192 * destination is specified.
1193 * @param node [i] The A tag node is specified.
1194 * @return The conversion result is returned.
1197 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1203 chtml20 = GET_CHTML20(pdoc);
1208 return chtml20->out;
1213 * It is a handler who processes the BR tag.
1215 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1216 * destination is specified.
1217 * @param node [i] The BR tag node is specified.
1218 * @return The conversion result is returned.
1221 s_chtml20_start_br_tag(void *pdoc, Node *node)
1228 chtml20 = GET_CHTML20(pdoc);
1233 /*--------------------------------------------------------------------------*/
1234 /* Get Attributes */
1235 /*--------------------------------------------------------------------------*/
1236 for (attr = qs_get_attr(doc,node);
1238 attr = qs_get_next_attr(doc,attr)) {
1242 name = qs_get_attr_name(doc,attr);
1243 value = qs_get_attr_value(doc,attr);
1245 if (STRCASEEQ('c','C',"clear",name)) {
1246 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1254 return chtml20->out;
1259 * It is a handler who processes the BR tag.
1261 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1262 * destination is specified.
1263 * @param node [i] The BR tag node is specified.
1264 * @return The conversion result is returned.
1267 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1273 chtml20 = GET_CHTML20(pdoc);
1277 return chtml20->out;
1282 * It is a handler who processes the TR tag.
1284 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1285 * destination is specified.
1286 * @param node [i] The TR tag node is specified.
1287 * @return The conversion result is returned.
1290 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1296 chtml20 = GET_CHTML20(pdoc);
1300 return chtml20->out;
1305 * It is a handler who processes the TR tag.
1307 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1308 * destination is specified.
1309 * @param node [i] The TR tag node is specified.
1310 * @return The conversion result is returned.
1313 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1319 chtml20 = GET_CHTML20(pdoc);
1324 return chtml20->out;
1329 * It is a handler who processes the FONT tag.
1331 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1332 * destination is specified.
1333 * @param node [i] The FONT tag node is specified.
1334 * @return The conversion result is returned.
1337 s_chtml20_start_font_tag(void *pdoc, Node *node)
1344 chtml20 = GET_CHTML20(pdoc);
1350 /*--------------------------------------------------------------------------*/
1351 /* Get Attributes */
1352 /*--------------------------------------------------------------------------*/
1353 for (attr = qs_get_attr(doc,node);
1355 attr = qs_get_next_attr(doc,attr)) {
1360 name = qs_get_attr_name(doc,attr);
1361 value = qs_get_attr_value(doc,attr);
1366 if (strcasecmp(name, "color") == 0) {
1375 if (strcasecmp(name, "size") == 0) {
1376 /*--------------------------------------------------------------------*/
1378 /*--------------------------------------------------------------------*/
1388 return chtml20->out;
1393 * It is a handler who processes the FONT tag.
1395 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1396 * destination is specified.
1397 * @param node [i] The FONT tag node is specified.
1398 * @return The conversion result is returned.
1401 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1407 chtml20 = GET_CHTML20(pdoc);
1412 return chtml20->out;
1417 * It is a handler who processes the FORM tag.
1419 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1420 * destination is specified.
1421 * @param node [i] The FORM tag node is specified.
1422 * @return The conversion result is returned.
1425 s_chtml20_start_form_tag(void *pdoc, Node *node)
1432 chtml20 = GET_CHTML20(pdoc);
1437 /*--------------------------------------------------------------------------*/
1438 /* Get Attributes */
1439 /*--------------------------------------------------------------------------*/
1440 for (attr = qs_get_attr(doc,node);
1442 attr = qs_get_next_attr(doc,attr)) {
1447 name = qs_get_attr_name(doc,attr);
1448 value = qs_get_attr_value(doc,attr);
1453 if (strcasecmp(name, "action") == 0) {
1454 /*--------------------------------------------------------------------*/
1456 /*--------------------------------------------------------------------*/
1457 value = chxj_encoding_parameter(r, value);
1458 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1468 if (strcasecmp(name, "method") == 0) {
1469 /*--------------------------------------------------------------------*/
1471 /*--------------------------------------------------------------------*/
1480 if (strcasecmp(name, "utn") == 0) {
1481 /*--------------------------------------------------------------------*/
1483 /*--------------------------------------------------------------------*/
1493 return chtml20->out;
1498 * It is a handler who processes the FORM tag.
1500 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1501 * destination is specified.
1502 * @param node [i] The FORM tag node is specified.
1503 * @return The conversion result is returned.
1506 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1512 chtml20 = GET_CHTML20(pdoc);
1517 return chtml20->out;
1522 * It is a handler who processes the INPUT tag.
1524 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1525 * destination is specified.
1526 * @param node [i] The INPUT tag node is specified.
1527 * @return The conversion result is returned.
1530 s_chtml20_start_input_tag(void *pdoc, Node *node)
1535 char *max_length = NULL;
1539 char *istyle = NULL;
1541 char *checked = NULL;
1542 char *accesskey = NULL;
1544 chtml20 = GET_CHTML20(pdoc);
1550 /*--------------------------------------------------------------------------*/
1551 /* Get Attributes */
1552 /*--------------------------------------------------------------------------*/
1554 type = qs_get_type_attr(doc, node, r);
1555 name = qs_get_name_attr(doc, node, r);
1556 value = qs_get_value_attr(doc,node,r);
1557 istyle = qs_get_istyle_attr(doc,node,r);
1558 max_length = qs_get_maxlength_attr(doc,node,r);
1559 checked = qs_get_checked_attr(doc,node,r);
1560 accesskey = qs_get_accesskey_attr(doc, node, r);
1561 size = qs_get_size_attr(doc, node, r);
1564 type = qs_trim_string(doc->buf.pool, type);
1565 if (type && (STRCASEEQ('t','T',"text", type) ||
1566 STRCASEEQ('p','P',"password",type) ||
1567 STRCASEEQ('c','C',"checkbox",type) ||
1568 STRCASEEQ('r','R',"radio", type) ||
1569 STRCASEEQ('h','H',"hidden", type) ||
1570 STRCASEEQ('s','S',"submit", type) ||
1571 STRCASEEQ('r','R',"reset", type))) {
1578 if (size && *size) {
1584 if (name && *name) {
1590 if (value && *value) {
1596 if (accesskey && *accesskey) {
1597 W_L(" accesskey=\"");
1603 /*------------------------------------------------------------------------*/
1605 /*------------------------------------------------------------------------*/
1606 if (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4') {
1613 /*--------------------------------------------------------------------------*/
1614 /* The figure is default for the password. */
1615 /*--------------------------------------------------------------------------*/
1616 if (max_length && *max_length) {
1617 if (chxj_chk_numeric(max_length) != 0) {
1618 max_length = apr_psprintf(doc->buf.pool, "0");
1620 if (istyle && *istyle == '1') {
1621 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1625 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1634 return chtml20->out;
1639 * It is a handler who processes the INPUT tag.
1641 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1642 * destination is specified.
1643 * @param node [i] The INPUT tag node is specified.
1644 * @return The conversion result is returned.
1647 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1653 chtml20 = GET_CHTML20(pdoc);
1657 return chtml20->out;
1662 * It is a handler who processes the CENTER tag.
1664 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1665 * destination is specified.
1666 * @param node [i] The CENTER tag node is specified.
1667 * @return The conversion result is returned.
1670 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1676 chtml20 = GET_CHTML20(pdoc);
1681 return chtml20->out;
1686 * It is a handler who processes the CENTER tag.
1688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1689 * destination is specified.
1690 * @param node [i] The CENTER tag node is specified.
1691 * @return The conversion result is returned.
1694 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1700 chtml20 = GET_CHTML20(pdoc);
1705 return chtml20->out;
1710 * It is a handler who processes the UL tag.
1712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1713 * destination is specified.
1714 * @param node [i] The UL tag node is specified.
1715 * @return The conversion result is returned.
1718 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1724 chtml20 = GET_CHTML20(pdoc);
1729 return chtml20->out;
1734 * It is a handler who processes the UL tag.
1736 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1737 * destination is specified.
1738 * @param node [i] The UL tag node is specified.
1739 * @return The conversion result is returned.
1742 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1748 chtml20 = GET_CHTML20(pdoc);
1753 return chtml20->out;
1758 * It is a handler who processes the OL tag.
1760 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1761 * destination is specified.
1762 * @param node [i] The OL tag node is specified.
1763 * @return The conversion result is returned.
1766 s_chtml20_start_ol_tag(void *pdoc, Node *node)
1773 chtml20 = GET_CHTML20(pdoc);
1778 /*--------------------------------------------------------------------------*/
1779 /* Get Attributes */
1780 /*--------------------------------------------------------------------------*/
1781 for (attr = qs_get_attr(doc,node);
1783 attr = qs_get_next_attr(doc,attr)) {
1784 char *name = qs_get_attr_name(doc,attr);
1785 char *value = qs_get_attr_value(doc,attr);
1786 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1791 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
1798 return chtml20->out;
1803 * It is a handler who processes the OL tag.
1805 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1806 * destination is specified.
1807 * @param node [i] The OL tag node is specified.
1808 * @return The conversion result is returned.
1811 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1817 chtml20 = GET_CHTML20(pdoc);
1822 return chtml20->out;
1827 * It is a handler who processes the LI tag.
1829 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1830 * destination is specified.
1831 * @param node [i] The LI tag node is specified.
1832 * @return The conversion result is returned.
1835 s_chtml20_start_li_tag(void *pdoc, Node *node)
1842 chtml20 = GET_CHTML20(pdoc);
1847 /*--------------------------------------------------------------------------*/
1848 /* Get Attributes */
1849 /*--------------------------------------------------------------------------*/
1850 for (attr = qs_get_attr(doc,node);
1852 attr = qs_get_next_attr(doc,attr)) {
1853 char *name = qs_get_attr_name(doc,attr);
1854 char *value = qs_get_attr_value(doc,attr);
1855 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1860 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
1867 return chtml20->out;
1872 * It is a handler who processes the LI tag.
1874 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1875 * destination is specified.
1876 * @param node [i] The LI tag node is specified.
1877 * @return The conversion result is returned.
1880 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1882 chtml20_t *chtml20 = GET_CHTML20(pdoc);
1883 return chtml20->out;
1888 * It is a handler who processes the HR tag.
1890 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1891 * destination is specified.
1892 * @param node [i] The HR tag node is specified.
1893 * @return The conversion result is returned.
1896 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1903 chtml20 = GET_CHTML20(pdoc);
1909 for (attr = qs_get_attr(doc,node);
1911 attr = qs_get_next_attr(doc,attr)) {
1916 name = qs_get_attr_name(doc,attr);
1917 value = qs_get_attr_value(doc,attr);
1922 if (strcasecmp(name, "align") == 0) {
1923 /*--------------------------------------------------------------------*/
1925 /*--------------------------------------------------------------------*/
1926 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1936 if (strcasecmp(name, "size") == 0) {
1937 /*--------------------------------------------------------------------*/
1939 /*--------------------------------------------------------------------*/
1940 if (value && value[0] != '\0') {
1950 if (strcasecmp(name, "width") == 0) {
1951 /*--------------------------------------------------------------------*/
1953 /*--------------------------------------------------------------------*/
1954 if (value && value[0] != '\0') {
1964 if (strcasecmp(name, "noshade") == 0) {
1965 /*--------------------------------------------------------------------*/
1967 /*--------------------------------------------------------------------*/
1974 if (strcasecmp(name, "color") == 0) {
1975 /*--------------------------------------------------------------------*/
1977 /*--------------------------------------------------------------------*/
1987 return chtml20->out;
1992 * It is a handler who processes the HR tag.
1994 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1995 * destination is specified.
1996 * @param node [i] The HR tag node is specified.
1997 * @return The conversion result is returned.
2000 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
2006 chtml20 = GET_CHTML20(pdoc);
2010 return chtml20->out;
2015 * It is a handler who processes the IMG tag.
2017 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2018 * destination is specified.
2019 * @param node [i] The IMG tag node is specified.
2020 * @return The conversion result is returned.
2023 s_chtml20_start_img_tag(void *pdoc, Node *node)
2029 #ifndef IMG_NOT_CONVERT_FILENAME
2033 chtml20 = GET_CHTML20(pdoc);
2037 #ifndef IMG_NOT_CONVERT_FILENAME
2038 spec = chtml20->spec;
2042 /*-------------------------------------------------------------------------*/
2043 /* Get Attributes */
2044 /*-------------------------------------------------------------------------*/
2045 for (attr = qs_get_attr(doc,node);
2047 attr = qs_get_next_attr(doc,attr)) {
2052 name = qs_get_attr_name(doc,attr);
2053 value = qs_get_attr_value(doc,attr);
2058 if (strcasecmp(name, "src") == 0) {
2059 /*-------------------------------------------------------------------*/
2061 /*-------------------------------------------------------------------*/
2062 #ifdef IMG_NOT_CONVERT_FILENAME
2063 value = chxj_encoding_parameter(r, value);
2064 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2066 value = apr_psprintf(doc->buf.pool,
2069 (strchr(value, '?')) ? '&' : '?',
2070 CHXJ_COOKIE_NOUPDATE_PARAM);
2076 value = chxj_img_conv(r, spec, value);
2077 value = chxj_encoding_parameter(r, value);
2078 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2080 value = apr_psprintf(doc->buf.pool,
2083 (strchr(value, '?')) ? '&' : '?',
2084 CHXJ_COOKIE_NOUPDATE_PARAM);
2095 if (strcasecmp(name, "align" ) == 0) {
2096 /*--------------------------------------------------------------------*/
2098 /*--------------------------------------------------------------------*/
2099 if (value && (STRCASEEQ('t','T',"top", value) ||
2100 STRCASEEQ('m','M',"middle",value) ||
2101 STRCASEEQ('b','B',"bottom",value) ||
2102 STRCASEEQ('l','L',"left", value) ||
2103 STRCASEEQ('r','R',"right", value))) {
2109 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2110 /*--------------------------------------------------------------------*/
2112 /*--------------------------------------------------------------------*/
2121 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2122 /*--------------------------------------------------------------------*/
2124 /*--------------------------------------------------------------------*/
2133 if (strcasecmp(name, "height") == 0 && value && *value) {
2134 /*--------------------------------------------------------------------*/
2136 /*--------------------------------------------------------------------*/
2141 else if (strcasecmp(name, "hspace") == 0 && value && *value) {
2142 /*--------------------------------------------------------------------*/
2144 /*--------------------------------------------------------------------*/
2153 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2154 /*--------------------------------------------------------------------*/
2156 /*--------------------------------------------------------------------*/
2168 return chtml20->out;
2173 * It is a handler who processes the IMG tag.
2175 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2176 * destination is specified.
2177 * @param node [i] The IMG tag node is specified.
2178 * @return The conversion result is returned.
2181 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2187 chtml20 = GET_CHTML20(pdoc);
2191 return chtml20->out;
2196 * It is a handler who processes the SELECT tag.
2198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2199 * destination is specified.
2200 * @param node [i] The SELECT tag node is specified.
2201 * @return The conversion result is returned.
2204 s_chtml20_start_select_tag(void *pdoc, Node *child)
2211 chtml20 = GET_CHTML20(pdoc);
2217 char *multiple = NULL;
2220 for (attr = qs_get_attr(doc,child);
2222 attr = qs_get_next_attr(doc,attr)) {
2223 char *nm = qs_get_attr_name(doc,attr);
2224 char *val = qs_get_attr_value(doc,attr);
2228 if (strcasecmp(nm, "size") == 0) {
2229 /*--------------------------------------------------------------------*/
2230 /* CHTML 1.0 version 2.0 */
2231 /*--------------------------------------------------------------------*/
2232 size = apr_pstrdup(doc->buf.pool, val);
2238 if (strcasecmp(nm, "name") == 0) {
2239 /*--------------------------------------------------------------------*/
2240 /* CHTML 1.0 version 2.0 */
2241 /*--------------------------------------------------------------------*/
2242 name = apr_pstrdup(doc->buf.pool, val);
2248 if (strcasecmp(nm, "multiple") == 0) {
2249 /*--------------------------------------------------------------------*/
2250 /* CHTML 1.0 version 2.0 */
2251 /*--------------------------------------------------------------------*/
2252 multiple = apr_pstrdup(doc->buf.pool, val);
2260 if (size && *size) {
2265 if (name && *name) {
2274 return chtml20->out;
2279 * It is a handler who processes the SELECT tag.
2281 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2282 * destination is specified.
2283 * @param node [i] The SELECT tag node is specified.
2284 * @return The conversion result is returned.
2287 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2293 chtml20 = GET_CHTML20(pdoc);
2298 return chtml20->out;
2303 * It is a handler who processes the OPTION tag.
2305 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2306 * destination is specified.
2307 * @param node [i] The OPTION tag node is specified.
2308 * @return The conversion result is returned.
2311 s_chtml20_start_option_tag(void *pdoc, Node *child)
2318 chtml20 = GET_CHTML20(pdoc);
2322 char *selected = NULL;
2326 for (attr = qs_get_attr(doc,child);
2328 attr = qs_get_next_attr(doc,attr)) {
2333 nm = qs_get_attr_name(doc,attr);
2334 val = qs_get_attr_value(doc,attr);
2339 if (strcasecmp(nm, "selected") == 0) {
2340 /*--------------------------------------------------------------------*/
2341 /* CHTML 1.0 version 2.0 */
2342 /*--------------------------------------------------------------------*/
2343 selected = apr_pstrdup(doc->buf.pool, val);
2349 if (strcasecmp(nm, "value") == 0) {
2350 /*--------------------------------------------------------------------*/
2351 /* CHTML 1.0 version 2.0 */
2352 /*--------------------------------------------------------------------*/
2353 value = apr_pstrdup(doc->buf.pool, val);
2362 if (value && *value) {
2372 return chtml20->out;
2377 * It is a handler who processes the OPTION tag.
2379 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2380 * destination is specified.
2381 * @param node [i] The OPTION tag node is specified.
2382 * @return The conversion result is returned.
2385 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2391 chtml20 = GET_CHTML20(pdoc);
2397 return chtml20->out;
2402 * It is a handler who processes the DIV tag.
2404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2405 * destination is specified.
2406 * @param node [i] The DIV tag node is specified.
2407 * @return The conversion result is returned.
2410 s_chtml20_start_div_tag(void *pdoc, Node *child)
2417 chtml20 = GET_CHTML20(pdoc);
2425 for (attr = qs_get_attr(doc,child);
2427 attr = qs_get_next_attr(doc,attr)) {
2432 nm = qs_get_attr_name(doc,attr);
2433 val = qs_get_attr_value(doc,attr);
2435 if (STRCASEEQ('a','A', "align", nm)) {
2436 /*----------------------------------------------------------------------*/
2437 /* CHTML 1.0 (W3C version 3.2) */
2438 /*----------------------------------------------------------------------*/
2439 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2440 align = apr_pstrdup(doc->buf.pool, val);
2452 return chtml20->out;
2457 * It is a handler who processes the DIV tag.
2459 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2460 * destination is specified.
2461 * @param node [i] The DIV tag node is specified.
2462 * @return The conversion result is returned.
2465 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2471 chtml20 = GET_CHTML20(pdoc);
2476 return chtml20->out;
2481 * It is a handler who processes the H1 tag.
2483 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2484 * destination is specified.
2485 * @param node [i] The H1 tag node is specified.
2486 * @return The conversion result is returned.
2489 s_chtml20_start_h1_tag(void *pdoc, Node *node)
2496 chtml20 = GET_CHTML20(pdoc);
2501 for (attr = qs_get_attr(doc,node);
2503 attr = qs_get_next_attr(doc,attr)) {
2506 name = qs_get_attr_name(doc,attr);
2507 value = qs_get_attr_value(doc,attr);
2508 if (STRCASEEQ('a','A',"align", name)) {
2509 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2518 return chtml20->out;
2523 * It is a handler who processes the H1 tag.
2525 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2526 * destination is specified.
2527 * @param node [i] The H1 tag node is specified.
2528 * @return The conversion result is returned.
2531 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2537 chtml20 = GET_CHTML20(pdoc);
2542 return chtml20->out;
2547 * It is a handler who processes the H2 tag.
2549 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2550 * destination is specified.
2551 * @param node [i] The H2 tag node is specified.
2552 * @return The conversion result is returned.
2555 s_chtml20_start_h2_tag(void *pdoc, Node *node)
2562 chtml20 = GET_CHTML20(pdoc);
2567 for (attr = qs_get_attr(doc,node);
2569 attr = qs_get_next_attr(doc,attr)) {
2572 name = qs_get_attr_name(doc,attr);
2573 value = qs_get_attr_value(doc,attr);
2574 if (STRCASEEQ('a','A',"align", name)) {
2575 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2584 return chtml20->out;
2589 * It is a handler who processes the H2 tag.
2591 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2592 * destination is specified.
2593 * @param node [i] The H2 tag node is specified.
2594 * @return The conversion result is returned.
2597 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2603 chtml20 = GET_CHTML20(pdoc);
2608 return chtml20->out;
2613 * It is a handler who processes the H3 tag.
2615 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2616 * destination is specified.
2617 * @param node [i] The H3 tag node is specified.
2618 * @return The conversion result is returned.
2621 s_chtml20_start_h3_tag(void *pdoc, Node *node)
2628 chtml20 = GET_CHTML20(pdoc);
2633 for (attr = qs_get_attr(doc,node);
2635 attr = qs_get_next_attr(doc,attr)) {
2638 name = qs_get_attr_name(doc,attr);
2639 value = qs_get_attr_value(doc,attr);
2640 if (STRCASEEQ('a','A',"align", name)) {
2641 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2650 return chtml20->out;
2655 * It is a handler who processes the H3 tag.
2657 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2658 * destination is specified.
2659 * @param node [i] The H3 tag node is specified.
2660 * @return The conversion result is returned.
2663 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2669 chtml20 = GET_CHTML20(pdoc);
2674 return chtml20->out;
2679 * It is a handler who processes the H4 tag.
2681 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The H4 tag node is specified.
2684 * @return The conversion result is returned.
2687 s_chtml20_start_h4_tag(void *pdoc, Node *node)
2694 chtml20 = GET_CHTML20(pdoc);
2699 for (attr = qs_get_attr(doc,node);
2701 attr = qs_get_next_attr(doc,attr)) {
2704 name = qs_get_attr_name(doc,attr);
2705 value = qs_get_attr_value(doc,attr);
2706 if (STRCASEEQ('a','A',"align", name)) {
2707 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2716 return chtml20->out;
2721 * It is a handler who processes the H4 tag.
2723 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2724 * destination is specified.
2725 * @param node [i] The H4 tag node is specified.
2726 * @return The conversion result is returned.
2729 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2735 chtml20 = GET_CHTML20(pdoc);
2740 return chtml20->out;
2745 * It is a handler who processes the H5 tag.
2747 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2748 * destination is specified.
2749 * @param node [i] The H5 tag node is specified.
2750 * @return The conversion result is returned.
2753 s_chtml20_start_h5_tag(void *pdoc, Node *node)
2760 chtml20 = GET_CHTML20(pdoc);
2765 for (attr = qs_get_attr(doc,node);
2767 attr = qs_get_next_attr(doc,attr)) {
2770 name = qs_get_attr_name(doc,attr);
2771 value = qs_get_attr_value(doc,attr);
2772 if (STRCASEEQ('a','A',"align", name)) {
2773 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2782 return chtml20->out;
2787 * It is a handler who processes the H5 tag.
2789 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2790 * destination is specified.
2791 * @param node [i] The H5 tag node is specified.
2792 * @return The conversion result is returned.
2795 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2801 chtml20 = GET_CHTML20(pdoc);
2806 return chtml20->out;
2811 * It is a handler who processes the H6 tag.
2813 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2814 * destination is specified.
2815 * @param node [i] The H6 tag node is specified.
2816 * @return The conversion result is returned.
2819 s_chtml20_start_h6_tag(void *pdoc, Node *node)
2826 chtml20 = GET_CHTML20(pdoc);
2831 for (attr = qs_get_attr(doc,node);
2833 attr = qs_get_next_attr(doc,attr)) {
2836 name = qs_get_attr_name(doc,attr);
2837 value = qs_get_attr_value(doc,attr);
2838 if (STRCASEEQ('a','A',"align", name)) {
2839 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2848 return chtml20->out;
2853 * It is a handler who processes the H6 tag.
2855 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2856 * destination is specified.
2857 * @param node [i] The H6 tag node is specified.
2858 * @return The conversion result is returned.
2861 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2867 chtml20 = GET_CHTML20(pdoc);
2872 return chtml20->out;
2877 * It is a handler who processes the PRE tag.
2879 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2880 * destination is specified.
2881 * @param node [i] The PRE tag node is specified.
2882 * @return The conversion result is returned.
2885 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2891 chtml20 = GET_CHTML20(pdoc);
2895 chtml20->pre_flag++;
2897 return chtml20->out;
2902 * It is a handler who processes the PRE tag.
2904 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2905 * destination is specified.
2906 * @param node [i] The PRE tag node is specified.
2907 * @return The conversion result is returned.
2910 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2916 chtml20 = GET_CHTML20(pdoc);
2921 chtml20->pre_flag--;
2923 return chtml20->out;
2928 * It is a handler who processes the P tag.
2930 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2931 * destination is specified.
2932 * @param node [i] The P tag node is specified.
2933 * @return The conversion result is returned.
2936 s_chtml20_start_p_tag(void *pdoc, Node *node)
2944 chtml20 = GET_CHTML20(pdoc);
2949 for (attr = qs_get_attr(doc,node);
2951 attr = qs_get_next_attr(doc,attr)) {
2952 char *nm = qs_get_attr_name(doc,attr);
2953 char *val = qs_get_attr_value(doc,attr);
2954 if (STRCASEEQ('a','A',"align", nm)) {
2955 /*----------------------------------------------------------------------*/
2956 /* CHTML 1.0 (W3C version 3.2) */
2957 /*----------------------------------------------------------------------*/
2958 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2959 align = apr_pstrdup(doc->buf.pool, val);
2970 return chtml20->out;
2975 * It is a handler who processes the P tag.
2977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2978 * destination is specified.
2979 * @param node [i] The P tag node is specified.
2980 * @return The conversion result is returned.
2983 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2989 chtml20 = GET_CHTML20(pdoc);
2994 return chtml20->out;
2999 s_chtml20_chxjif_tag(void *pdoc, Node *node)
3006 chtml20 = GET_CHTML20(pdoc);
3010 for (child = qs_get_child_node(doc, node);
3012 child = qs_get_next_node(doc, child)) {
3015 s_chtml20_chxjif_tag(pdoc, child);
3023 * It is a handler who processes the TEXTARE tag.
3025 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3026 * destination is specified.
3027 * @param node [i] The TEXTAREA tag node is specified.
3028 * @return The conversion result is returned.
3031 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
3038 chtml20 = GET_CHTML20(pdoc);
3042 chtml20->textarea_flag++;
3044 for (attr = qs_get_attr(doc,node);
3046 attr = qs_get_next_attr(doc,attr)) {
3047 char *name = qs_get_attr_name(doc,attr);
3048 char *value = qs_get_attr_value(doc,attr);
3052 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
3053 W_L(" accesskey=\"");
3061 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
3070 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
3079 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
3088 if (strcasecmp(name, "istyle") == 0 && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3100 return chtml20->out;
3105 * It is a handler who processes the TEXTAREA tag.
3107 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3108 * destination is specified.
3109 * @param node [i] The TEXTAREA tag node is specified.
3110 * @return The conversion result is returned.
3113 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3119 chtml20 = GET_CHTML20(pdoc);
3124 chtml20->textarea_flag--;
3126 return chtml20->out;
3131 s_chtml20_text_tag(void *pdoc, Node *child)
3143 chtml20 = GET_CHTML20(pdoc);
3147 textval = qs_get_node_value(doc,child);
3148 if (strlen(textval) == 0) {
3149 return chtml20->out;
3152 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3153 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3155 tdst = qs_alloc_zero_byte_string(r);
3156 memset(one_byte, 0, sizeof(one_byte));
3159 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3161 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
3163 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3167 if (is_sjis_kanji(textval[ii])) {
3168 one_byte[0] = textval[ii+0];
3169 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3170 one_byte[0] = textval[ii+1];
3171 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3175 if (chtml20->pre_flag) {
3176 one_byte[0] = textval[ii+0];
3177 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3180 if (chtml20->textarea_flag) {
3181 one_byte[0] = textval[ii+0];
3182 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3185 if (textval[ii] != '\r' && textval[ii] != '\n') {
3186 one_byte[0] = textval[ii+0];
3187 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3191 return chtml20->out;
3196 * It is a handler who processes the BLOCKQUOTE tag.
3198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3199 * destination is specified.
3200 * @param node [i] The BLOCKQUOTE tag node is specified.
3201 * @return The conversion result is returned.
3204 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3208 chtml20 = GET_CHTML20(pdoc);
3210 W_L("<blockquote>");
3211 return chtml20->out;
3216 * It is a handler who processes the BLOCKQUOTE tag.
3218 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3219 * destination is specified.
3220 * @param node [i] The BLOCKQUOTE tag node is specified.
3221 * @return The conversion result is returned.
3224 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3229 chtml20 = GET_CHTML20(pdoc);
3231 W_L("</blockquote>");
3232 return chtml20->out;
3237 * It is a handler who processes the DIR tag.
3239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3240 * destination is specified.
3241 * @param node [i] The DIR tag node is specified.
3242 * @return The conversion result is returned.
3245 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3249 chtml20 = GET_CHTML20(pdoc);
3252 return chtml20->out;
3257 * It is a handler who processes the DIR tag.
3259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3260 * destination is specified.
3261 * @param node [i] The DIR tag node is specified.
3262 * @return The conversion result is returned.
3265 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3270 chtml20 = GET_CHTML20(pdoc);
3273 return chtml20->out;
3278 * It is a handler who processes the DL tag.
3280 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3281 * destination is specified.
3282 * @param node [i] The DL tag node is specified.
3283 * @return The conversion result is returned.
3286 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3290 chtml20 = GET_CHTML20(pdoc);
3293 return chtml20->out;
3298 * It is a handler who processes the DL tag.
3300 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3301 * destination is specified.
3302 * @param node [i] The DL tag node is specified.
3303 * @return The conversion result is returned.
3306 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3310 chtml20 = GET_CHTML20(pdoc);
3313 return chtml20->out;
3318 * It is a handter who processes the DT tag.
3320 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3321 * destination is specified.
3322 * @param node [i] The DT tag node is specified.
3323 * @return The conversion result is returned.
3326 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3330 chtml20 = GET_CHTML20(pdoc);
3333 return chtml20->out;
3338 * It is a handter who processes the DT tag.
3340 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3341 * destination is specified.
3342 * @param node [i] The DT tag node is specified.
3343 * @return The conversion result is returned.
3346 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3349 chtml20 = GET_CHTML20(pdoc);
3350 return chtml20->out;
3355 * It is a handder who processes the DD tag.
3357 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3358 * destination is specified.
3359 * @param node [i] The DD tag node is specified.
3360 * @return The conversion result is returned.
3363 s_chtml20_start_dd_tag(void *pdoc, Node *UNUSED(child))
3367 chtml20 = GET_CHTML20(pdoc);
3370 return chtml20->out;
3375 * It is a handder who processes the DD tag.
3377 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3378 * destination is specified.
3379 * @param node [i] The DD tag node is specified.
3380 * @return The conversion result is returned.
3383 s_chtml20_end_dd_tag(void *pdoc, Node *UNUSED(child))
3386 chtml20 = GET_CHTML20(pdoc);
3387 return chtml20->out;
3392 * It is a hanmenuer who processes the MENU tag.
3394 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3395 * destination is specified.
3396 * @param node [i] The MENU tag node is specified.
3397 * @return The conversion result is returned.
3400 s_chtml20_start_menu_tag(void *pdoc, Node *UNUSED(child))
3404 chtml20 = GET_CHTML20(pdoc);
3407 return chtml20->out;
3412 * It is a hanmenuer who processes the MENU tag.
3414 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3415 * destination is specified.
3416 * @param node [i] The MENU tag node is specified.
3417 * @return The conversion result is returned.
3420 s_chtml20_end_menu_tag(void *pdoc, Node *UNUSED(child))
3422 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3423 Doc *doc = chtml20->doc;
3425 return chtml20->out;
3430 * It is a hanplaintexter who processes the PLAINTEXT tag.
3432 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3433 * destination is specified.
3434 * @param node [i] The PLAINTEXT tag node is specified.
3435 * @return The conversion result is returned.
3438 s_chtml20_start_plaintext_tag(void *pdoc, Node *node)
3443 chtml20 = GET_CHTML20(pdoc);
3446 s_chtml20_start_plaintext_tag_inner(pdoc,node);
3447 return chtml20->out;
3451 s_chtml20_start_plaintext_tag_inner(void *pdoc, Node *node)
3456 chtml20 = GET_CHTML20(pdoc);
3458 for (child = qs_get_child_node(doc, node);
3460 child = qs_get_next_node(doc, child)) {
3462 s_chtml20_start_plaintext_tag_inner(pdoc, child);
3464 return chtml20->out;
3469 * It is a hanplaintexter who processes the PLAINTEXT tag.
3471 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3472 * destination is specified.
3473 * @param node [i] The PLAINTEXT tag node is specified.
3474 * @return The conversion result is returned.
3477 s_chtml20_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3479 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3480 return chtml20->out;
3484 * It is a hanblinker who processes the BLINK tag.
3486 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3487 * destination is specified.
3488 * @param node [i] The BLINK tag node is specified.
3489 * @return The conversion result is returned.
3492 s_chtml20_start_blink_tag(void *pdoc, Node *UNUSED(child))
3494 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3495 Doc *doc = chtml20->doc;
3497 return chtml20->out;
3502 * It is a hanblinker who processes the BLINK tag.
3504 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3505 * destination is specified.
3506 * @param node [i] The BLINK tag node is specified.
3507 * @return The conversion result is returned.
3510 s_chtml20_end_blink_tag(void *pdoc, Node *UNUSED(child))
3512 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3513 Doc *doc = chtml20->doc;
3515 return chtml20->out;