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);
109 static char *s_chtml20_start_marquee_tag (void *pdoc, Node *node);
110 static char *s_chtml20_end_marquee_tag (void *pdoc, Node *node);
112 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
114 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
116 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
117 static char *s_chtml20_text_tag(void *pdoc, Node *node);
120 tag_handler chtml20_handler[] = {
123 s_chtml20_start_html_tag,
124 s_chtml20_end_html_tag,
128 s_chtml20_start_meta_tag,
129 s_chtml20_end_meta_tag,
133 s_chtml20_start_textarea_tag,
134 s_chtml20_end_textarea_tag,
138 s_chtml20_start_p_tag,
143 s_chtml20_start_pre_tag,
144 s_chtml20_end_pre_tag,
148 s_chtml20_start_ul_tag,
149 s_chtml20_end_ul_tag,
153 s_chtml20_start_li_tag,
154 s_chtml20_end_li_tag,
158 s_chtml20_start_ol_tag,
159 s_chtml20_end_ol_tag,
163 s_chtml20_start_h1_tag,
164 s_chtml20_end_h1_tag,
168 s_chtml20_start_h2_tag,
169 s_chtml20_end_h2_tag,
173 s_chtml20_start_h3_tag,
174 s_chtml20_end_h3_tag,
178 s_chtml20_start_h4_tag,
179 s_chtml20_end_h4_tag,
183 s_chtml20_start_h5_tag,
184 s_chtml20_end_h5_tag,
188 s_chtml20_start_h6_tag,
189 s_chtml20_end_h6_tag,
193 s_chtml20_start_head_tag,
194 s_chtml20_end_head_tag,
198 s_chtml20_start_title_tag,
199 s_chtml20_end_title_tag,
203 s_chtml20_start_base_tag,
204 s_chtml20_end_base_tag,
208 s_chtml20_start_body_tag,
209 s_chtml20_end_body_tag,
213 s_chtml20_start_a_tag,
218 s_chtml20_start_br_tag,
219 s_chtml20_end_br_tag,
228 s_chtml20_start_tr_tag,
229 s_chtml20_end_tr_tag,
243 s_chtml20_start_font_tag,
244 s_chtml20_end_font_tag,
248 s_chtml20_start_form_tag,
249 s_chtml20_end_form_tag,
253 s_chtml20_start_input_tag,
254 s_chtml20_end_input_tag,
258 s_chtml20_start_center_tag,
259 s_chtml20_end_center_tag,
263 s_chtml20_start_hr_tag,
264 s_chtml20_end_hr_tag,
268 s_chtml20_start_img_tag,
269 s_chtml20_end_img_tag,
273 s_chtml20_start_select_tag,
274 s_chtml20_end_select_tag,
278 s_chtml20_start_option_tag,
279 s_chtml20_end_option_tag,
283 s_chtml20_start_div_tag,
284 s_chtml20_end_div_tag,
288 s_chtml20_chxjif_tag,
333 s_chtml20_start_dt_tag,
334 s_chtml20_end_dt_tag,
348 s_chtml20_start_blockquote_tag,
349 s_chtml20_end_blockquote_tag,
353 s_chtml20_start_dir_tag,
354 s_chtml20_end_dir_tag,
358 s_chtml20_start_dl_tag,
359 s_chtml20_end_dl_tag,
363 s_chtml20_start_dd_tag,
364 s_chtml20_end_dd_tag,
368 s_chtml20_start_menu_tag,
369 s_chtml20_end_menu_tag,
373 s_chtml20_start_plaintext_tag,
374 s_chtml20_end_plaintext_tag,
378 s_chtml20_start_blink_tag,
379 s_chtml20_end_blink_tag,
383 s_chtml20_start_marquee_tag,
384 s_chtml20_end_marquee_tag,
389 * converts from CHTML5.0 to CHTML2.0.
391 * @param r [i] Requet_rec is appointed.
392 * @param spec [i] The result of the device specification processing which
393 * was done in advance is appointed.
394 * @param src [i] The character string before the converting is appointed.
395 * @return The character string after the converting is returned.
398 chxj_exchange_chtml20(
404 chxjconvrule_entry *entryp,
413 /*--------------------------------------------------------------------------*/
415 /*--------------------------------------------------------------------------*/
417 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
419 DBG(r,"i found qrcode xml");
422 DBG(r,"not found qrcode xml");
424 /*--------------------------------------------------------------------------*/
425 /* The CHTML structure is initialized. */
426 /*--------------------------------------------------------------------------*/
427 s_init_chtml20(&chtml20, &doc, r, spec);
430 chtml20.entryp = entryp;
431 chtml20.cookie = cookie;
433 chxj_set_content_type(r, "text/html; charset=Windows-31J");
435 /*--------------------------------------------------------------------------*/
436 /* The character string of the input is analyzed. */
437 /*--------------------------------------------------------------------------*/
438 qs_init_malloc(&doc);
439 qs_init_root_node(&doc);
441 ss = apr_pcalloc(r->pool, srclen + 1);
442 memset(ss, 0, srclen + 1);
443 memcpy(ss, src, srclen);
446 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
449 qs_parse_string(&doc,ss, strlen(ss));
451 chxj_buffered_write_init(r->pool, &doc.buf);
452 /*--------------------------------------------------------------------------*/
453 /* It converts it from CHTML to CHTML. */
454 /*--------------------------------------------------------------------------*/
455 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
456 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
457 dst = apr_pstrdup(r->pool, chtml20.out);
458 chxj_buffered_write_terminate(&doc.buf);
460 qs_all_free(&doc,QX_LOGMARK);
463 return apr_pstrdup(r->pool,ss);
466 if (strlen(dst) == 0) {
467 dst = apr_psprintf(r->pool, "\n");
470 *dstlen = strlen(dst);
473 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
480 * The CHTML structure is initialized.
482 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
483 * initialized is specified.
484 * @param doc [i] The Doc structure that should be set to the initialized
485 * HDML structure is specified.
486 * @param r [i] To use POOL, the pointer to request_rec is specified.
487 * @param spec [i] The pointer to the device_table
490 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
492 memset(doc, 0, sizeof(Doc));
493 memset(chtml20, 0, sizeof(chtml20_t));
497 chtml20->spec = spec;
498 chtml20->out = qs_alloc_zero_byte_string(r);
499 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
501 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
506 * Corresponding EMOJI to a current character-code is retrieved.
507 * The substitution character string is stored in the rslt pointer if agreeing.
509 * @param chtml20 [i] The pointer to the CHTML structure is specified.
510 * @param txt [i] The character string to want to examine whether it is
511 * EMOJI is specified.
512 * @param rslt [o] The pointer to the pointer that stores the result is
514 * @return When corresponding EMOJI exists, it returns it excluding 0.
517 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
524 spec = chtml20->spec;
530 DBG(r,"spec is NULL");
532 for (ee = chtml20->conf->emoji;
536 if (ee->imode == NULL) {
537 DBG(r,"emoji->imode is NULL");
541 if (ee->imode->string != NULL
542 && strlen(ee->imode->string) > 0
543 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
544 if (spec == NULL || spec->emoji_type == NULL) {
545 *rslt = apr_palloc(r->pool, 3);
546 (*rslt)[0] = ee->imode->hex1byte & 0xff;
547 (*rslt)[1] = ee->imode->hex2byte & 0xff;
549 return strlen(ee->imode->string);
561 * It is a handler who processes the HTML tag.
563 * @param pdoc [i/o] The pointer to the CHTML structure at the output
564 * destination is specified.
565 * @param node [i] The HTML tag node is specified.
566 * @return The conversion result is returned.
569 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
575 chtml20 = GET_CHTML20(pdoc);
579 /*--------------------------------------------------------------------------*/
581 /*--------------------------------------------------------------------------*/
588 * It is a handler who processes the HTML tag.
590 * @param pdoc [i/o] The pointer to the CHTML structure at the output
591 * destination is specified.
592 * @param node [i] The HTML tag node is specified.
593 * @return The conversion result is returned.
596 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
602 chtml20 = GET_CHTML20(pdoc);
612 * It is a handler who processes the META tag.
614 * @param pdoc [i/o] The pointer to the CHTML structure at the output
615 * destination is specified.
616 * @param node [i] The META tag node is specified.
617 * @return The conversion result is returned.
620 s_chtml20_start_meta_tag(void *pdoc, Node *node)
626 int content_type_flag;
629 chtml20 = GET_CHTML20(pdoc);
633 content_type_flag = 0;
637 /*--------------------------------------------------------------------------*/
639 /*--------------------------------------------------------------------------*/
640 for (attr = qs_get_attr(doc,node);
642 attr = qs_get_next_attr(doc,attr)) {
647 name = qs_get_attr_name(doc,attr);
648 value = qs_get_attr_value(doc,attr);
653 if (strcasecmp(name, "http-equiv") == 0) {
654 /*----------------------------------------------------------------------*/
656 /*----------------------------------------------------------------------*/
657 W_L(" http-equiv=\"");
660 if (STRCASEEQ('c','C',"content-type", value)) {
661 content_type_flag = 1;
663 if (STRCASEEQ('r','R',"refresh", value)) {
671 if (strcasecmp(name, "content") == 0) {
672 if (content_type_flag) {
675 W_L("=\"text/html; charset=Windows-31J\"");
677 else if (refresh_flag) {
678 char *buf = apr_pstrdup(r->pool, value);
682 url = strchr(buf, ';');
684 sec = apr_pstrdup(r->pool, buf);
687 url = chxj_encoding_parameter(r, url);
688 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
718 * It is a handler who processes the META tag.
720 * @param pdoc [i/o] The pointer to the CHTML structure at the output
721 * destination is specified.
722 * @param node [i] The META tag node is specified.
723 * @return The conversion result is returned.
726 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
730 chtml20 = GET_CHTML20(pdoc);
737 * It is a handler who processes the HEAD tag.
739 * @param pdoc [i/o] The pointer to the CHTML structure at the output
740 * destination is specified.
741 * @param node [i] The HEAD tag node is specified.
742 * @return The conversion result is returned.
745 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
751 chtml20 = GET_CHTML20(pdoc);
761 * It is a handler who processes the HEAD tag.
763 * @param pdoc [i/o] The pointer to the CHTML structure at the output
764 * destination is specified.
765 * @param node [i] The HEAD tag node is specified.
766 * @return The conversion result is returned.
769 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
775 chtml20 = GET_CHTML20(pdoc);
785 * It is a handler who processes the TITLE tag.
787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
788 * destination is specified.
789 * @param node [i] The TITLE tag node is specified.
790 * @return The conversion result is returned.
793 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
799 chtml20 = GET_CHTML20(pdoc);
809 * It is a handler who processes the TITLE tag.
811 * @param pdoc [i/o] The pointer to the CHTML structure at the output
812 * destination is specified.
813 * @param node [i] The TITLE tag node is specified.
814 * @return The conversion result is returned.
817 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
823 chtml20 = GET_CHTML20(pdoc);
833 * It is a handler who processes the BASE tag.
835 * @param pdoc [i/o] The pointer to the CHTML structure at the output
836 * destination is specified.
837 * @param node [i] The BASE tag node is specified.
838 * @return The conversion result is returned.
841 s_chtml20_start_base_tag(void *pdoc, Node *node)
848 chtml20 = GET_CHTML20(pdoc);
853 /*--------------------------------------------------------------------------*/
855 /*--------------------------------------------------------------------------*/
856 for (attr = qs_get_attr(doc,node);
858 attr = qs_get_next_attr(doc,attr)) {
863 name = qs_get_attr_name(doc,attr);
864 value = qs_get_attr_value(doc,attr);
866 if (STRCASEEQ('h','H',"href", name)) {
878 * It is a handler who processes the BASE tag.
880 * @param pdoc [i/o] The pointer to the CHTML structure at the output
881 * destination is specified.
882 * @param node [i] The BASE tag node is specified.
883 * @return The conversion result is returned.
886 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
892 chtml20 = GET_CHTML20(pdoc);
901 * It is a handler who processes the BODY tag.
903 * @param pdoc [i/o] The pointer to the CHTML structure at the output
904 * destination is specified.
905 * @param node [i] The BODY tag node is specified.
906 * @return The conversion result is returned.
909 s_chtml20_start_body_tag(void *pdoc, Node *node)
916 chtml20 = GET_CHTML20(pdoc);
921 /*--------------------------------------------------------------------------*/
923 /*--------------------------------------------------------------------------*/
924 for (attr = qs_get_attr(doc,node);
926 attr = qs_get_next_attr(doc,attr)) {
930 name = qs_get_attr_name(doc,attr);
931 value = qs_get_attr_value(doc,attr);
936 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
937 /*----------------------------------------------------------------------*/
939 /*----------------------------------------------------------------------*/
948 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
949 /*----------------------------------------------------------------------*/
951 /*----------------------------------------------------------------------*/
960 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
961 /*----------------------------------------------------------------------*/
963 /*----------------------------------------------------------------------*/
972 if (strcasecmp(name, "alink") == 0) {
973 /*----------------------------------------------------------------------*/
975 /*----------------------------------------------------------------------*/
982 if (strcasecmp(name, "vlink") == 0) {
983 /*----------------------------------------------------------------------*/
985 /*----------------------------------------------------------------------*/
1000 * It is a handler who processes the BODY tag.
1002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The BODY tag node is specified.
1005 * @return The conversion result is returned.
1008 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
1014 chtml20 = GET_CHTML20(pdoc);
1019 return chtml20->out;
1024 * It is a handler who processes the A tag.
1026 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1027 * destination is specified.
1028 * @param node [i] The A tag node is specified.
1029 * @return The conversion result is returned.
1032 s_chtml20_start_a_tag(void *pdoc, Node *node)
1039 chtml20 = GET_CHTML20(pdoc);
1044 /*--------------------------------------------------------------------------*/
1045 /* Get Attributes */
1046 /*--------------------------------------------------------------------------*/
1047 for (attr = qs_get_attr(doc,node);
1049 attr = qs_get_next_attr(doc,attr)) {
1054 name = qs_get_attr_name(doc,attr);
1055 value = qs_get_attr_value(doc,attr);
1060 if (strcasecmp(name, "name") == 0) {
1061 /*--------------------------------------------------------------------*/
1063 /*--------------------------------------------------------------------*/
1072 if (strcasecmp(name, "href") == 0) {
1073 /*--------------------------------------------------------------------*/
1075 /*--------------------------------------------------------------------*/
1076 value = chxj_encoding_parameter(r, value);
1077 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1086 if (strcasecmp(name, "accesskey") == 0) {
1087 /*--------------------------------------------------------------------*/
1089 /*--------------------------------------------------------------------*/
1090 W_L(" accesskey=\"");
1098 if (strcasecmp(name, "cti") == 0) {
1099 /*--------------------------------------------------------------------*/
1101 /*--------------------------------------------------------------------*/
1110 if (strcasecmp(name, "ijam") == 0) {
1111 /*--------------------------------------------------------------------*/
1113 /*--------------------------------------------------------------------*/
1117 if (strcasecmp(name, "ista") == 0) {
1118 /*--------------------------------------------------------------------*/
1120 /*--------------------------------------------------------------------*/
1124 if (strcasecmp(name, "ilet") == 0) {
1125 /*--------------------------------------------------------------------*/
1127 /*--------------------------------------------------------------------*/
1131 if (strcasecmp(name, "iswf") == 0) {
1132 /*--------------------------------------------------------------------*/
1134 /*--------------------------------------------------------------------*/
1138 if (strcasecmp(name, "irst") == 0) {
1139 /*--------------------------------------------------------------------*/
1141 /*--------------------------------------------------------------------*/
1148 if (strcasecmp(name, "utn") == 0) {
1149 /*--------------------------------------------------------------------*/
1151 /*--------------------------------------------------------------------*/
1158 if (strcasecmp(name, "telbook") == 0) {
1159 /*--------------------------------------------------------------------*/
1161 /*--------------------------------------------------------------------*/
1168 if (strcasecmp(name, "kana") == 0) {
1169 /*--------------------------------------------------------------------*/
1171 /*--------------------------------------------------------------------*/
1178 if (strcasecmp(name, "email") == 0) {
1179 /*--------------------------------------------------------------------*/
1181 /*--------------------------------------------------------------------*/
1191 return chtml20->out;
1196 * It is a handler who processes the A tag.
1198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1199 * destination is specified.
1200 * @param node [i] The A tag node is specified.
1201 * @return The conversion result is returned.
1204 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1210 chtml20 = GET_CHTML20(pdoc);
1215 return chtml20->out;
1220 * It is a handler who processes the BR tag.
1222 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1223 * destination is specified.
1224 * @param node [i] The BR tag node is specified.
1225 * @return The conversion result is returned.
1228 s_chtml20_start_br_tag(void *pdoc, Node *node)
1235 chtml20 = GET_CHTML20(pdoc);
1240 /*--------------------------------------------------------------------------*/
1241 /* Get Attributes */
1242 /*--------------------------------------------------------------------------*/
1243 for (attr = qs_get_attr(doc,node);
1245 attr = qs_get_next_attr(doc,attr)) {
1249 name = qs_get_attr_name(doc,attr);
1250 value = qs_get_attr_value(doc,attr);
1252 if (STRCASEEQ('c','C',"clear",name)) {
1253 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1261 return chtml20->out;
1266 * It is a handler who processes the BR tag.
1268 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1269 * destination is specified.
1270 * @param node [i] The BR tag node is specified.
1271 * @return The conversion result is returned.
1274 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1280 chtml20 = GET_CHTML20(pdoc);
1284 return chtml20->out;
1289 * It is a handler who processes the TR tag.
1291 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1292 * destination is specified.
1293 * @param node [i] The TR tag node is specified.
1294 * @return The conversion result is returned.
1297 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1303 chtml20 = GET_CHTML20(pdoc);
1307 return chtml20->out;
1312 * It is a handler who processes the TR tag.
1314 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1315 * destination is specified.
1316 * @param node [i] The TR tag node is specified.
1317 * @return The conversion result is returned.
1320 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1326 chtml20 = GET_CHTML20(pdoc);
1331 return chtml20->out;
1336 * It is a handler who processes the FONT tag.
1338 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1339 * destination is specified.
1340 * @param node [i] The FONT tag node is specified.
1341 * @return The conversion result is returned.
1344 s_chtml20_start_font_tag(void *pdoc, Node *node)
1351 chtml20 = GET_CHTML20(pdoc);
1357 /*--------------------------------------------------------------------------*/
1358 /* Get Attributes */
1359 /*--------------------------------------------------------------------------*/
1360 for (attr = qs_get_attr(doc,node);
1362 attr = qs_get_next_attr(doc,attr)) {
1367 name = qs_get_attr_name(doc,attr);
1368 value = qs_get_attr_value(doc,attr);
1373 if (strcasecmp(name, "color") == 0) {
1382 if (strcasecmp(name, "size") == 0) {
1383 /*--------------------------------------------------------------------*/
1385 /*--------------------------------------------------------------------*/
1395 return chtml20->out;
1400 * It is a handler who processes the FONT tag.
1402 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1403 * destination is specified.
1404 * @param node [i] The FONT tag node is specified.
1405 * @return The conversion result is returned.
1408 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1414 chtml20 = GET_CHTML20(pdoc);
1419 return chtml20->out;
1424 * It is a handler who processes the FORM tag.
1426 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1427 * destination is specified.
1428 * @param node [i] The FORM tag node is specified.
1429 * @return The conversion result is returned.
1432 s_chtml20_start_form_tag(void *pdoc, Node *node)
1439 chtml20 = GET_CHTML20(pdoc);
1444 /*--------------------------------------------------------------------------*/
1445 /* Get Attributes */
1446 /*--------------------------------------------------------------------------*/
1447 for (attr = qs_get_attr(doc,node);
1449 attr = qs_get_next_attr(doc,attr)) {
1454 name = qs_get_attr_name(doc,attr);
1455 value = qs_get_attr_value(doc,attr);
1460 if (strcasecmp(name, "action") == 0) {
1461 /*--------------------------------------------------------------------*/
1463 /*--------------------------------------------------------------------*/
1464 value = chxj_encoding_parameter(r, value);
1465 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1475 if (strcasecmp(name, "method") == 0) {
1476 /*--------------------------------------------------------------------*/
1478 /*--------------------------------------------------------------------*/
1487 if (strcasecmp(name, "utn") == 0) {
1488 /*--------------------------------------------------------------------*/
1490 /*--------------------------------------------------------------------*/
1500 return chtml20->out;
1505 * It is a handler who processes the FORM tag.
1507 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1508 * destination is specified.
1509 * @param node [i] The FORM tag node is specified.
1510 * @return The conversion result is returned.
1513 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1519 chtml20 = GET_CHTML20(pdoc);
1524 return chtml20->out;
1529 * It is a handler who processes the INPUT tag.
1531 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1532 * destination is specified.
1533 * @param node [i] The INPUT tag node is specified.
1534 * @return The conversion result is returned.
1537 s_chtml20_start_input_tag(void *pdoc, Node *node)
1542 char *max_length = NULL;
1546 char *istyle = NULL;
1548 char *checked = NULL;
1549 char *accesskey = NULL;
1551 chtml20 = GET_CHTML20(pdoc);
1557 /*--------------------------------------------------------------------------*/
1558 /* Get Attributes */
1559 /*--------------------------------------------------------------------------*/
1561 type = qs_get_type_attr(doc, node, r);
1562 name = qs_get_name_attr(doc, node, r);
1563 value = qs_get_value_attr(doc,node,r);
1564 istyle = qs_get_istyle_attr(doc,node,r);
1565 max_length = qs_get_maxlength_attr(doc,node,r);
1566 checked = qs_get_checked_attr(doc,node,r);
1567 accesskey = qs_get_accesskey_attr(doc, node, r);
1568 size = qs_get_size_attr(doc, node, r);
1571 type = qs_trim_string(doc->buf.pool, type);
1572 if (type && (STRCASEEQ('t','T',"text", type) ||
1573 STRCASEEQ('p','P',"password",type) ||
1574 STRCASEEQ('c','C',"checkbox",type) ||
1575 STRCASEEQ('r','R',"radio", type) ||
1576 STRCASEEQ('h','H',"hidden", type) ||
1577 STRCASEEQ('s','S',"submit", type) ||
1578 STRCASEEQ('r','R',"reset", type))) {
1585 if (size && *size) {
1591 if (name && *name) {
1597 if (value && *value) {
1603 if (accesskey && *accesskey) {
1604 W_L(" accesskey=\"");
1610 /*------------------------------------------------------------------------*/
1612 /*------------------------------------------------------------------------*/
1613 if (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4') {
1620 /*--------------------------------------------------------------------------*/
1621 /* The figure is default for the password. */
1622 /*--------------------------------------------------------------------------*/
1623 if (max_length && *max_length) {
1624 if (chxj_chk_numeric(max_length) != 0) {
1625 max_length = apr_psprintf(doc->buf.pool, "0");
1627 if (istyle && *istyle == '1') {
1628 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1632 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1641 return chtml20->out;
1646 * It is a handler who processes the INPUT tag.
1648 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1649 * destination is specified.
1650 * @param node [i] The INPUT tag node is specified.
1651 * @return The conversion result is returned.
1654 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1660 chtml20 = GET_CHTML20(pdoc);
1664 return chtml20->out;
1669 * It is a handler who processes the CENTER tag.
1671 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1672 * destination is specified.
1673 * @param node [i] The CENTER tag node is specified.
1674 * @return The conversion result is returned.
1677 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1683 chtml20 = GET_CHTML20(pdoc);
1688 return chtml20->out;
1693 * It is a handler who processes the CENTER tag.
1695 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1696 * destination is specified.
1697 * @param node [i] The CENTER tag node is specified.
1698 * @return The conversion result is returned.
1701 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1707 chtml20 = GET_CHTML20(pdoc);
1712 return chtml20->out;
1717 * It is a handler who processes the UL tag.
1719 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1720 * destination is specified.
1721 * @param node [i] The UL tag node is specified.
1722 * @return The conversion result is returned.
1725 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1731 chtml20 = GET_CHTML20(pdoc);
1736 return chtml20->out;
1741 * It is a handler who processes the UL tag.
1743 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1744 * destination is specified.
1745 * @param node [i] The UL tag node is specified.
1746 * @return The conversion result is returned.
1749 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1755 chtml20 = GET_CHTML20(pdoc);
1760 return chtml20->out;
1765 * It is a handler who processes the OL tag.
1767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1768 * destination is specified.
1769 * @param node [i] The OL tag node is specified.
1770 * @return The conversion result is returned.
1773 s_chtml20_start_ol_tag(void *pdoc, Node *node)
1780 chtml20 = GET_CHTML20(pdoc);
1785 /*--------------------------------------------------------------------------*/
1786 /* Get Attributes */
1787 /*--------------------------------------------------------------------------*/
1788 for (attr = qs_get_attr(doc,node);
1790 attr = qs_get_next_attr(doc,attr)) {
1791 char *name = qs_get_attr_name(doc,attr);
1792 char *value = qs_get_attr_value(doc,attr);
1793 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1798 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
1805 return chtml20->out;
1810 * It is a handler who processes the OL tag.
1812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1813 * destination is specified.
1814 * @param node [i] The OL tag node is specified.
1815 * @return The conversion result is returned.
1818 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1824 chtml20 = GET_CHTML20(pdoc);
1829 return chtml20->out;
1834 * It is a handler who processes the LI tag.
1836 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1837 * destination is specified.
1838 * @param node [i] The LI tag node is specified.
1839 * @return The conversion result is returned.
1842 s_chtml20_start_li_tag(void *pdoc, Node *node)
1849 chtml20 = GET_CHTML20(pdoc);
1854 /*--------------------------------------------------------------------------*/
1855 /* Get Attributes */
1856 /*--------------------------------------------------------------------------*/
1857 for (attr = qs_get_attr(doc,node);
1859 attr = qs_get_next_attr(doc,attr)) {
1860 char *name = qs_get_attr_name(doc,attr);
1861 char *value = qs_get_attr_value(doc,attr);
1862 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1867 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
1874 return chtml20->out;
1879 * It is a handler who processes the LI tag.
1881 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1882 * destination is specified.
1883 * @param node [i] The LI tag node is specified.
1884 * @return The conversion result is returned.
1887 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1889 chtml20_t *chtml20 = GET_CHTML20(pdoc);
1890 return chtml20->out;
1895 * It is a handler who processes the HR tag.
1897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1898 * destination is specified.
1899 * @param node [i] The HR tag node is specified.
1900 * @return The conversion result is returned.
1903 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1910 chtml20 = GET_CHTML20(pdoc);
1916 for (attr = qs_get_attr(doc,node);
1918 attr = qs_get_next_attr(doc,attr)) {
1923 name = qs_get_attr_name(doc,attr);
1924 value = qs_get_attr_value(doc,attr);
1929 if (strcasecmp(name, "align") == 0) {
1930 /*--------------------------------------------------------------------*/
1932 /*--------------------------------------------------------------------*/
1933 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1943 if (strcasecmp(name, "size") == 0) {
1944 /*--------------------------------------------------------------------*/
1946 /*--------------------------------------------------------------------*/
1947 if (value && value[0] != '\0') {
1957 if (strcasecmp(name, "width") == 0) {
1958 /*--------------------------------------------------------------------*/
1960 /*--------------------------------------------------------------------*/
1961 if (value && value[0] != '\0') {
1971 if (strcasecmp(name, "noshade") == 0) {
1972 /*--------------------------------------------------------------------*/
1974 /*--------------------------------------------------------------------*/
1981 if (strcasecmp(name, "color") == 0) {
1982 /*--------------------------------------------------------------------*/
1984 /*--------------------------------------------------------------------*/
1994 return chtml20->out;
1999 * It is a handler who processes the HR tag.
2001 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2002 * destination is specified.
2003 * @param node [i] The HR tag node is specified.
2004 * @return The conversion result is returned.
2007 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
2013 chtml20 = GET_CHTML20(pdoc);
2017 return chtml20->out;
2022 * It is a handler who processes the IMG tag.
2024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2025 * destination is specified.
2026 * @param node [i] The IMG tag node is specified.
2027 * @return The conversion result is returned.
2030 s_chtml20_start_img_tag(void *pdoc, Node *node)
2036 #ifndef IMG_NOT_CONVERT_FILENAME
2040 chtml20 = GET_CHTML20(pdoc);
2044 #ifndef IMG_NOT_CONVERT_FILENAME
2045 spec = chtml20->spec;
2049 /*-------------------------------------------------------------------------*/
2050 /* Get Attributes */
2051 /*-------------------------------------------------------------------------*/
2052 for (attr = qs_get_attr(doc,node);
2054 attr = qs_get_next_attr(doc,attr)) {
2059 name = qs_get_attr_name(doc,attr);
2060 value = qs_get_attr_value(doc,attr);
2065 if (strcasecmp(name, "src") == 0) {
2066 /*-------------------------------------------------------------------*/
2068 /*-------------------------------------------------------------------*/
2069 #ifdef IMG_NOT_CONVERT_FILENAME
2070 value = chxj_encoding_parameter(r, value);
2071 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2073 value = apr_psprintf(doc->buf.pool,
2076 (strchr(value, '?')) ? '&' : '?',
2077 CHXJ_COOKIE_NOUPDATE_PARAM);
2083 value = chxj_img_conv(r, spec, value);
2084 value = chxj_encoding_parameter(r, value);
2085 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2087 value = apr_psprintf(doc->buf.pool,
2090 (strchr(value, '?')) ? '&' : '?',
2091 CHXJ_COOKIE_NOUPDATE_PARAM);
2102 if (strcasecmp(name, "align" ) == 0) {
2103 /*--------------------------------------------------------------------*/
2105 /*--------------------------------------------------------------------*/
2106 if (value && (STRCASEEQ('t','T',"top", value) ||
2107 STRCASEEQ('m','M',"middle",value) ||
2108 STRCASEEQ('b','B',"bottom",value) ||
2109 STRCASEEQ('l','L',"left", value) ||
2110 STRCASEEQ('r','R',"right", value))) {
2116 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2117 /*--------------------------------------------------------------------*/
2119 /*--------------------------------------------------------------------*/
2128 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2129 /*--------------------------------------------------------------------*/
2131 /*--------------------------------------------------------------------*/
2140 if (strcasecmp(name, "height") == 0 && value && *value) {
2141 /*--------------------------------------------------------------------*/
2143 /*--------------------------------------------------------------------*/
2148 else if (strcasecmp(name, "hspace") == 0 && value && *value) {
2149 /*--------------------------------------------------------------------*/
2151 /*--------------------------------------------------------------------*/
2160 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2161 /*--------------------------------------------------------------------*/
2163 /*--------------------------------------------------------------------*/
2175 return chtml20->out;
2180 * It is a handler who processes the IMG tag.
2182 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2183 * destination is specified.
2184 * @param node [i] The IMG tag node is specified.
2185 * @return The conversion result is returned.
2188 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2194 chtml20 = GET_CHTML20(pdoc);
2198 return chtml20->out;
2203 * It is a handler who processes the SELECT tag.
2205 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2206 * destination is specified.
2207 * @param node [i] The SELECT tag node is specified.
2208 * @return The conversion result is returned.
2211 s_chtml20_start_select_tag(void *pdoc, Node *child)
2218 chtml20 = GET_CHTML20(pdoc);
2224 char *multiple = NULL;
2227 for (attr = qs_get_attr(doc,child);
2229 attr = qs_get_next_attr(doc,attr)) {
2230 char *nm = qs_get_attr_name(doc,attr);
2231 char *val = qs_get_attr_value(doc,attr);
2235 if (strcasecmp(nm, "size") == 0) {
2236 /*--------------------------------------------------------------------*/
2237 /* CHTML 1.0 version 2.0 */
2238 /*--------------------------------------------------------------------*/
2239 size = apr_pstrdup(doc->buf.pool, val);
2245 if (strcasecmp(nm, "name") == 0) {
2246 /*--------------------------------------------------------------------*/
2247 /* CHTML 1.0 version 2.0 */
2248 /*--------------------------------------------------------------------*/
2249 name = apr_pstrdup(doc->buf.pool, val);
2255 if (strcasecmp(nm, "multiple") == 0) {
2256 /*--------------------------------------------------------------------*/
2257 /* CHTML 1.0 version 2.0 */
2258 /*--------------------------------------------------------------------*/
2259 multiple = apr_pstrdup(doc->buf.pool, val);
2267 if (size && *size) {
2272 if (name && *name) {
2281 return chtml20->out;
2286 * It is a handler who processes the SELECT tag.
2288 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2289 * destination is specified.
2290 * @param node [i] The SELECT tag node is specified.
2291 * @return The conversion result is returned.
2294 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2300 chtml20 = GET_CHTML20(pdoc);
2305 return chtml20->out;
2310 * It is a handler who processes the OPTION tag.
2312 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2313 * destination is specified.
2314 * @param node [i] The OPTION tag node is specified.
2315 * @return The conversion result is returned.
2318 s_chtml20_start_option_tag(void *pdoc, Node *child)
2325 chtml20 = GET_CHTML20(pdoc);
2329 char *selected = NULL;
2333 for (attr = qs_get_attr(doc,child);
2335 attr = qs_get_next_attr(doc,attr)) {
2340 nm = qs_get_attr_name(doc,attr);
2341 val = qs_get_attr_value(doc,attr);
2346 if (strcasecmp(nm, "selected") == 0) {
2347 /*--------------------------------------------------------------------*/
2348 /* CHTML 1.0 version 2.0 */
2349 /*--------------------------------------------------------------------*/
2350 selected = apr_pstrdup(doc->buf.pool, val);
2356 if (strcasecmp(nm, "value") == 0) {
2357 /*--------------------------------------------------------------------*/
2358 /* CHTML 1.0 version 2.0 */
2359 /*--------------------------------------------------------------------*/
2360 value = apr_pstrdup(doc->buf.pool, val);
2369 if (value && *value) {
2379 return chtml20->out;
2384 * It is a handler who processes the OPTION tag.
2386 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2387 * destination is specified.
2388 * @param node [i] The OPTION tag node is specified.
2389 * @return The conversion result is returned.
2392 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2398 chtml20 = GET_CHTML20(pdoc);
2404 return chtml20->out;
2409 * It is a handler who processes the DIV tag.
2411 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2412 * destination is specified.
2413 * @param node [i] The DIV tag node is specified.
2414 * @return The conversion result is returned.
2417 s_chtml20_start_div_tag(void *pdoc, Node *child)
2424 chtml20 = GET_CHTML20(pdoc);
2432 for (attr = qs_get_attr(doc,child);
2434 attr = qs_get_next_attr(doc,attr)) {
2439 nm = qs_get_attr_name(doc,attr);
2440 val = qs_get_attr_value(doc,attr);
2442 if (STRCASEEQ('a','A', "align", nm)) {
2443 /*----------------------------------------------------------------------*/
2444 /* CHTML 1.0 (W3C version 3.2) */
2445 /*----------------------------------------------------------------------*/
2446 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2447 align = apr_pstrdup(doc->buf.pool, val);
2459 return chtml20->out;
2464 * It is a handler who processes the DIV tag.
2466 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2467 * destination is specified.
2468 * @param node [i] The DIV tag node is specified.
2469 * @return The conversion result is returned.
2472 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2478 chtml20 = GET_CHTML20(pdoc);
2483 return chtml20->out;
2488 * It is a handler who processes the H1 tag.
2490 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2491 * destination is specified.
2492 * @param node [i] The H1 tag node is specified.
2493 * @return The conversion result is returned.
2496 s_chtml20_start_h1_tag(void *pdoc, Node *node)
2503 chtml20 = GET_CHTML20(pdoc);
2508 for (attr = qs_get_attr(doc,node);
2510 attr = qs_get_next_attr(doc,attr)) {
2513 name = qs_get_attr_name(doc,attr);
2514 value = qs_get_attr_value(doc,attr);
2515 if (STRCASEEQ('a','A',"align", name)) {
2516 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2525 return chtml20->out;
2530 * It is a handler who processes the H1 tag.
2532 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2533 * destination is specified.
2534 * @param node [i] The H1 tag node is specified.
2535 * @return The conversion result is returned.
2538 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2544 chtml20 = GET_CHTML20(pdoc);
2549 return chtml20->out;
2554 * It is a handler who processes the H2 tag.
2556 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2557 * destination is specified.
2558 * @param node [i] The H2 tag node is specified.
2559 * @return The conversion result is returned.
2562 s_chtml20_start_h2_tag(void *pdoc, Node *node)
2569 chtml20 = GET_CHTML20(pdoc);
2574 for (attr = qs_get_attr(doc,node);
2576 attr = qs_get_next_attr(doc,attr)) {
2579 name = qs_get_attr_name(doc,attr);
2580 value = qs_get_attr_value(doc,attr);
2581 if (STRCASEEQ('a','A',"align", name)) {
2582 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2591 return chtml20->out;
2596 * It is a handler who processes the H2 tag.
2598 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2599 * destination is specified.
2600 * @param node [i] The H2 tag node is specified.
2601 * @return The conversion result is returned.
2604 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2610 chtml20 = GET_CHTML20(pdoc);
2615 return chtml20->out;
2620 * It is a handler who processes the H3 tag.
2622 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2623 * destination is specified.
2624 * @param node [i] The H3 tag node is specified.
2625 * @return The conversion result is returned.
2628 s_chtml20_start_h3_tag(void *pdoc, Node *node)
2635 chtml20 = GET_CHTML20(pdoc);
2640 for (attr = qs_get_attr(doc,node);
2642 attr = qs_get_next_attr(doc,attr)) {
2645 name = qs_get_attr_name(doc,attr);
2646 value = qs_get_attr_value(doc,attr);
2647 if (STRCASEEQ('a','A',"align", name)) {
2648 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2657 return chtml20->out;
2662 * It is a handler who processes the H3 tag.
2664 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2665 * destination is specified.
2666 * @param node [i] The H3 tag node is specified.
2667 * @return The conversion result is returned.
2670 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2676 chtml20 = GET_CHTML20(pdoc);
2681 return chtml20->out;
2686 * It is a handler who processes the H4 tag.
2688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2689 * destination is specified.
2690 * @param node [i] The H4 tag node is specified.
2691 * @return The conversion result is returned.
2694 s_chtml20_start_h4_tag(void *pdoc, Node *node)
2701 chtml20 = GET_CHTML20(pdoc);
2706 for (attr = qs_get_attr(doc,node);
2708 attr = qs_get_next_attr(doc,attr)) {
2711 name = qs_get_attr_name(doc,attr);
2712 value = qs_get_attr_value(doc,attr);
2713 if (STRCASEEQ('a','A',"align", name)) {
2714 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2723 return chtml20->out;
2728 * It is a handler who processes the H4 tag.
2730 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2731 * destination is specified.
2732 * @param node [i] The H4 tag node is specified.
2733 * @return The conversion result is returned.
2736 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2742 chtml20 = GET_CHTML20(pdoc);
2747 return chtml20->out;
2752 * It is a handler who processes the H5 tag.
2754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2755 * destination is specified.
2756 * @param node [i] The H5 tag node is specified.
2757 * @return The conversion result is returned.
2760 s_chtml20_start_h5_tag(void *pdoc, Node *node)
2767 chtml20 = GET_CHTML20(pdoc);
2772 for (attr = qs_get_attr(doc,node);
2774 attr = qs_get_next_attr(doc,attr)) {
2777 name = qs_get_attr_name(doc,attr);
2778 value = qs_get_attr_value(doc,attr);
2779 if (STRCASEEQ('a','A',"align", name)) {
2780 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2789 return chtml20->out;
2794 * It is a handler who processes the H5 tag.
2796 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2797 * destination is specified.
2798 * @param node [i] The H5 tag node is specified.
2799 * @return The conversion result is returned.
2802 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2808 chtml20 = GET_CHTML20(pdoc);
2813 return chtml20->out;
2818 * It is a handler who processes the H6 tag.
2820 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2821 * destination is specified.
2822 * @param node [i] The H6 tag node is specified.
2823 * @return The conversion result is returned.
2826 s_chtml20_start_h6_tag(void *pdoc, Node *node)
2833 chtml20 = GET_CHTML20(pdoc);
2838 for (attr = qs_get_attr(doc,node);
2840 attr = qs_get_next_attr(doc,attr)) {
2843 name = qs_get_attr_name(doc,attr);
2844 value = qs_get_attr_value(doc,attr);
2845 if (STRCASEEQ('a','A',"align", name)) {
2846 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2855 return chtml20->out;
2860 * It is a handler who processes the H6 tag.
2862 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2863 * destination is specified.
2864 * @param node [i] The H6 tag node is specified.
2865 * @return The conversion result is returned.
2868 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2874 chtml20 = GET_CHTML20(pdoc);
2879 return chtml20->out;
2884 * It is a handler who processes the PRE tag.
2886 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2887 * destination is specified.
2888 * @param node [i] The PRE tag node is specified.
2889 * @return The conversion result is returned.
2892 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2898 chtml20 = GET_CHTML20(pdoc);
2902 chtml20->pre_flag++;
2904 return chtml20->out;
2909 * It is a handler who processes the PRE tag.
2911 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2912 * destination is specified.
2913 * @param node [i] The PRE tag node is specified.
2914 * @return The conversion result is returned.
2917 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2923 chtml20 = GET_CHTML20(pdoc);
2928 chtml20->pre_flag--;
2930 return chtml20->out;
2935 * It is a handler who processes the P tag.
2937 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2938 * destination is specified.
2939 * @param node [i] The P tag node is specified.
2940 * @return The conversion result is returned.
2943 s_chtml20_start_p_tag(void *pdoc, Node *node)
2951 chtml20 = GET_CHTML20(pdoc);
2956 for (attr = qs_get_attr(doc,node);
2958 attr = qs_get_next_attr(doc,attr)) {
2959 char *nm = qs_get_attr_name(doc,attr);
2960 char *val = qs_get_attr_value(doc,attr);
2961 if (STRCASEEQ('a','A',"align", nm)) {
2962 /*----------------------------------------------------------------------*/
2963 /* CHTML 1.0 (W3C version 3.2) */
2964 /*----------------------------------------------------------------------*/
2965 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2966 align = apr_pstrdup(doc->buf.pool, val);
2977 return chtml20->out;
2982 * It is a handler who processes the P tag.
2984 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2985 * destination is specified.
2986 * @param node [i] The P tag node is specified.
2987 * @return The conversion result is returned.
2990 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2996 chtml20 = GET_CHTML20(pdoc);
3001 return chtml20->out;
3006 s_chtml20_chxjif_tag(void *pdoc, Node *node)
3013 chtml20 = GET_CHTML20(pdoc);
3017 for (child = qs_get_child_node(doc, node);
3019 child = qs_get_next_node(doc, child)) {
3022 s_chtml20_chxjif_tag(pdoc, child);
3030 * It is a handler who processes the TEXTARE tag.
3032 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3033 * destination is specified.
3034 * @param node [i] The TEXTAREA tag node is specified.
3035 * @return The conversion result is returned.
3038 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
3045 chtml20 = GET_CHTML20(pdoc);
3049 chtml20->textarea_flag++;
3051 for (attr = qs_get_attr(doc,node);
3053 attr = qs_get_next_attr(doc,attr)) {
3054 char *name = qs_get_attr_name(doc,attr);
3055 char *value = qs_get_attr_value(doc,attr);
3059 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
3060 W_L(" accesskey=\"");
3068 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
3077 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
3086 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
3095 if (strcasecmp(name, "istyle") == 0 && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3107 return chtml20->out;
3112 * It is a handler who processes the TEXTAREA tag.
3114 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3115 * destination is specified.
3116 * @param node [i] The TEXTAREA tag node is specified.
3117 * @return The conversion result is returned.
3120 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3126 chtml20 = GET_CHTML20(pdoc);
3131 chtml20->textarea_flag--;
3133 return chtml20->out;
3138 s_chtml20_text_tag(void *pdoc, Node *child)
3150 chtml20 = GET_CHTML20(pdoc);
3154 textval = qs_get_node_value(doc,child);
3155 if (strlen(textval) == 0) {
3156 return chtml20->out;
3159 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3160 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3162 tdst = qs_alloc_zero_byte_string(r);
3163 memset(one_byte, 0, sizeof(one_byte));
3166 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3168 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
3170 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3174 if (is_sjis_kanji(textval[ii])) {
3175 one_byte[0] = textval[ii+0];
3176 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3177 one_byte[0] = textval[ii+1];
3178 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3182 if (chtml20->pre_flag) {
3183 one_byte[0] = textval[ii+0];
3184 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3187 if (chtml20->textarea_flag) {
3188 one_byte[0] = textval[ii+0];
3189 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3192 if (textval[ii] != '\r' && textval[ii] != '\n') {
3193 one_byte[0] = textval[ii+0];
3194 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3198 return chtml20->out;
3203 * It is a handler who processes the BLOCKQUOTE tag.
3205 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3206 * destination is specified.
3207 * @param node [i] The BLOCKQUOTE tag node is specified.
3208 * @return The conversion result is returned.
3211 s_chtml20_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3215 chtml20 = GET_CHTML20(pdoc);
3217 W_L("<blockquote>");
3218 return chtml20->out;
3223 * It is a handler who processes the BLOCKQUOTE tag.
3225 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3226 * destination is specified.
3227 * @param node [i] The BLOCKQUOTE tag node is specified.
3228 * @return The conversion result is returned.
3231 s_chtml20_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3236 chtml20 = GET_CHTML20(pdoc);
3238 W_L("</blockquote>");
3239 return chtml20->out;
3244 * It is a handler who processes the DIR tag.
3246 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3247 * destination is specified.
3248 * @param node [i] The DIR tag node is specified.
3249 * @return The conversion result is returned.
3252 s_chtml20_start_dir_tag(void *pdoc, Node *UNUSED(child))
3256 chtml20 = GET_CHTML20(pdoc);
3259 return chtml20->out;
3264 * It is a handler who processes the DIR tag.
3266 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3267 * destination is specified.
3268 * @param node [i] The DIR tag node is specified.
3269 * @return The conversion result is returned.
3272 s_chtml20_end_dir_tag(void *pdoc, Node *UNUSED(child))
3277 chtml20 = GET_CHTML20(pdoc);
3280 return chtml20->out;
3285 * It is a handler who processes the DL tag.
3287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3288 * destination is specified.
3289 * @param node [i] The DL tag node is specified.
3290 * @return The conversion result is returned.
3293 s_chtml20_start_dl_tag(void *pdoc, Node *UNUSED(child))
3297 chtml20 = GET_CHTML20(pdoc);
3300 return chtml20->out;
3305 * It is a handler who processes the DL tag.
3307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3308 * destination is specified.
3309 * @param node [i] The DL tag node is specified.
3310 * @return The conversion result is returned.
3313 s_chtml20_end_dl_tag(void *pdoc, Node *UNUSED(child))
3317 chtml20 = GET_CHTML20(pdoc);
3320 return chtml20->out;
3325 * It is a handter who processes the DT tag.
3327 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3328 * destination is specified.
3329 * @param node [i] The DT tag node is specified.
3330 * @return The conversion result is returned.
3333 s_chtml20_start_dt_tag(void *pdoc, Node *UNUSED(child))
3337 chtml20 = GET_CHTML20(pdoc);
3340 return chtml20->out;
3345 * It is a handter who processes the DT tag.
3347 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3348 * destination is specified.
3349 * @param node [i] The DT tag node is specified.
3350 * @return The conversion result is returned.
3353 s_chtml20_end_dt_tag(void *pdoc, Node *UNUSED(child))
3356 chtml20 = GET_CHTML20(pdoc);
3357 return chtml20->out;
3362 * It is a handder who processes the DD tag.
3364 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3365 * destination is specified.
3366 * @param node [i] The DD tag node is specified.
3367 * @return The conversion result is returned.
3370 s_chtml20_start_dd_tag(void *pdoc, Node *UNUSED(child))
3374 chtml20 = GET_CHTML20(pdoc);
3377 return chtml20->out;
3382 * It is a handder who processes the DD tag.
3384 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3385 * destination is specified.
3386 * @param node [i] The DD tag node is specified.
3387 * @return The conversion result is returned.
3390 s_chtml20_end_dd_tag(void *pdoc, Node *UNUSED(child))
3393 chtml20 = GET_CHTML20(pdoc);
3394 return chtml20->out;
3399 * It is a hanmenuer who processes the MENU tag.
3401 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3402 * destination is specified.
3403 * @param node [i] The MENU tag node is specified.
3404 * @return The conversion result is returned.
3407 s_chtml20_start_menu_tag(void *pdoc, Node *UNUSED(child))
3411 chtml20 = GET_CHTML20(pdoc);
3414 return chtml20->out;
3419 * It is a hanmenuer who processes the MENU tag.
3421 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3422 * destination is specified.
3423 * @param node [i] The MENU tag node is specified.
3424 * @return The conversion result is returned.
3427 s_chtml20_end_menu_tag(void *pdoc, Node *UNUSED(child))
3429 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3430 Doc *doc = chtml20->doc;
3432 return chtml20->out;
3437 * It is a hanplaintexter who processes the PLAINTEXT tag.
3439 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3440 * destination is specified.
3441 * @param node [i] The PLAINTEXT tag node is specified.
3442 * @return The conversion result is returned.
3445 s_chtml20_start_plaintext_tag(void *pdoc, Node *node)
3450 chtml20 = GET_CHTML20(pdoc);
3453 s_chtml20_start_plaintext_tag_inner(pdoc,node);
3454 return chtml20->out;
3458 s_chtml20_start_plaintext_tag_inner(void *pdoc, Node *node)
3463 chtml20 = GET_CHTML20(pdoc);
3465 for (child = qs_get_child_node(doc, node);
3467 child = qs_get_next_node(doc, child)) {
3469 s_chtml20_start_plaintext_tag_inner(pdoc, child);
3471 return chtml20->out;
3476 * It is a hanplaintexter who processes the PLAINTEXT tag.
3478 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3479 * destination is specified.
3480 * @param node [i] The PLAINTEXT tag node is specified.
3481 * @return The conversion result is returned.
3484 s_chtml20_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3486 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3487 return chtml20->out;
3491 * It is a hanblinker who processes the BLINK tag.
3493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3494 * destination is specified.
3495 * @param node [i] The BLINK tag node is specified.
3496 * @return The conversion result is returned.
3499 s_chtml20_start_blink_tag(void *pdoc, Node *UNUSED(child))
3501 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3502 Doc *doc = chtml20->doc;
3504 return chtml20->out;
3509 * It is a hanblinker who processes the BLINK tag.
3511 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3512 * destination is specified.
3513 * @param node [i] The BLINK tag node is specified.
3514 * @return The conversion result is returned.
3517 s_chtml20_end_blink_tag(void *pdoc, Node *UNUSED(child))
3519 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3520 Doc *doc = chtml20->doc;
3522 return chtml20->out;
3527 * It is a hanmarqueeer who processes the MARQUEE tag.
3529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3530 * destination is specified.
3531 * @param node [i] The MARQUEE tag node is specified.
3532 * @return The conversion result is returned.
3535 s_chtml20_start_marquee_tag(void *pdoc, Node *node)
3537 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3538 Doc *doc = chtml20->doc;
3541 /*--------------------------------------------------------------------------*/
3542 /* Get Attributes */
3543 /*--------------------------------------------------------------------------*/
3544 for (attr = qs_get_attr(doc,node);
3546 attr = qs_get_next_attr(doc,attr)) {
3547 char *name = qs_get_attr_name(doc,attr);
3548 char *value = qs_get_attr_value(doc,attr);
3549 if (STRCASEEQ('d','D',"direction", name)) {
3550 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3551 W_L(" direction=\"");
3556 else if (STRCASEEQ('b','B',"behavior",name)) {
3557 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
3558 W_L(" behavior=\"");
3563 else if (STRCASEEQ('l','L',"loop",name)) {
3564 if (value && *value) {
3572 return chtml20->out;
3577 * It is a hanmarqueeer who processes the MARQUEE tag.
3579 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3580 * destination is specified.
3581 * @param node [i] The MARQUEE tag node is specified.
3582 * @return The conversion result is returned.
3585 s_chtml20_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3587 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3588 Doc *doc = chtml20->doc;
3590 return chtml20->out;