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 W20_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
29 #define W20_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);
93 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
95 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
97 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
98 static char *s_chtml20_text_tag(void *pdoc, Node *node);
101 tag_handler chtml20_handler[] = {
104 s_chtml20_start_html_tag,
105 s_chtml20_end_html_tag,
109 s_chtml20_start_meta_tag,
110 s_chtml20_end_meta_tag,
114 s_chtml20_start_textarea_tag,
115 s_chtml20_end_textarea_tag,
119 s_chtml20_start_p_tag,
124 s_chtml20_start_pre_tag,
125 s_chtml20_end_pre_tag,
129 s_chtml20_start_ul_tag,
130 s_chtml20_end_ul_tag,
134 s_chtml20_start_li_tag,
135 s_chtml20_end_li_tag,
139 s_chtml20_start_ol_tag,
140 s_chtml20_end_ol_tag,
144 s_chtml20_start_h1_tag,
145 s_chtml20_end_h1_tag,
149 s_chtml20_start_h2_tag,
150 s_chtml20_end_h2_tag,
154 s_chtml20_start_h3_tag,
155 s_chtml20_end_h3_tag,
159 s_chtml20_start_h4_tag,
160 s_chtml20_end_h4_tag,
164 s_chtml20_start_h5_tag,
165 s_chtml20_end_h5_tag,
169 s_chtml20_start_h6_tag,
170 s_chtml20_end_h6_tag,
174 s_chtml20_start_head_tag,
175 s_chtml20_end_head_tag,
179 s_chtml20_start_title_tag,
180 s_chtml20_end_title_tag,
184 s_chtml20_start_base_tag,
185 s_chtml20_end_base_tag,
189 s_chtml20_start_body_tag,
190 s_chtml20_end_body_tag,
194 s_chtml20_start_a_tag,
199 s_chtml20_start_br_tag,
200 s_chtml20_end_br_tag,
209 s_chtml20_start_tr_tag,
210 s_chtml20_end_tr_tag,
224 s_chtml20_start_font_tag,
225 s_chtml20_end_font_tag,
229 s_chtml20_start_form_tag,
230 s_chtml20_end_form_tag,
234 s_chtml20_start_input_tag,
235 s_chtml20_end_input_tag,
239 s_chtml20_start_center_tag,
240 s_chtml20_end_center_tag,
244 s_chtml20_start_hr_tag,
245 s_chtml20_end_hr_tag,
249 s_chtml20_start_img_tag,
250 s_chtml20_end_img_tag,
254 s_chtml20_start_select_tag,
255 s_chtml20_end_select_tag,
259 s_chtml20_start_option_tag,
260 s_chtml20_end_option_tag,
264 s_chtml20_start_div_tag,
265 s_chtml20_end_div_tag,
269 s_chtml20_chxjif_tag,
355 * converts from CHTML5.0 to CHTML2.0.
357 * @param r [i] Requet_rec is appointed.
358 * @param spec [i] The result of the device specification processing which
359 * was done in advance is appointed.
360 * @param src [i] The character string before the converting is appointed.
361 * @return The character string after the converting is returned.
364 chxj_exchange_chtml20(
370 chxjconvrule_entry *entryp,
379 /*--------------------------------------------------------------------------*/
381 /*--------------------------------------------------------------------------*/
383 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
385 DBG(r,"i found qrcode xml");
388 DBG(r,"not found qrcode xml");
390 /*--------------------------------------------------------------------------*/
391 /* The CHTML structure is initialized. */
392 /*--------------------------------------------------------------------------*/
393 s_init_chtml20(&chtml20, &doc, r, spec);
396 chtml20.entryp = entryp;
397 chtml20.cookie = cookie;
399 chxj_set_content_type(r, "text/html; charset=Windows-31J");
401 /*--------------------------------------------------------------------------*/
402 /* The character string of the input is analyzed. */
403 /*--------------------------------------------------------------------------*/
404 qs_init_malloc(&doc);
405 qs_init_root_node(&doc);
407 ss = apr_pcalloc(r->pool, srclen + 1);
408 memset(ss, 0, srclen + 1);
409 memcpy(ss, src, srclen);
412 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
415 qs_parse_string(&doc,ss, strlen(ss));
417 chxj_buffered_write_init(r->pool, &doc.buf);
418 /*--------------------------------------------------------------------------*/
419 /* It converts it from CHTML to CHTML. */
420 /*--------------------------------------------------------------------------*/
421 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
422 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
423 dst = apr_pstrdup(r->pool, chtml20.out);
424 chxj_buffered_write_terminate(&doc.buf);
426 qs_all_free(&doc,QX_LOGMARK);
429 return apr_pstrdup(r->pool,ss);
432 if (strlen(dst) == 0) {
433 dst = apr_psprintf(r->pool, "\n");
436 *dstlen = strlen(dst);
439 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
446 * The CHTML structure is initialized.
448 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
449 * initialized is specified.
450 * @param doc [i] The Doc structure that should be set to the initialized
451 * HDML structure is specified.
452 * @param r [i] To use POOL, the pointer to request_rec is specified.
453 * @param spec [i] The pointer to the device_table
456 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
458 memset(doc, 0, sizeof(Doc));
459 memset(chtml20, 0, sizeof(chtml20_t));
463 chtml20->spec = spec;
464 chtml20->out = qs_alloc_zero_byte_string(r);
465 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
467 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
472 * Corresponding EMOJI to a current character-code is retrieved.
473 * The substitution character string is stored in the rslt pointer if agreeing.
475 * @param chtml20 [i] The pointer to the CHTML structure is specified.
476 * @param txt [i] The character string to want to examine whether it is
477 * EMOJI is specified.
478 * @param rslt [o] The pointer to the pointer that stores the result is
480 * @return When corresponding EMOJI exists, it returns it excluding 0.
483 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
490 spec = chtml20->spec;
496 DBG(r,"spec is NULL");
498 for (ee = chtml20->conf->emoji;
502 if (ee->imode == NULL) {
503 DBG(r,"emoji->imode is NULL");
507 if (ee->imode->string != NULL
508 && strlen(ee->imode->string) > 0
509 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
510 if (spec == NULL || spec->emoji_type == NULL) {
511 *rslt = apr_palloc(r->pool, 3);
512 (*rslt)[0] = ee->imode->hex1byte & 0xff;
513 (*rslt)[1] = ee->imode->hex2byte & 0xff;
515 return strlen(ee->imode->string);
527 * It is a handler who processes the HTML tag.
529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
530 * destination is specified.
531 * @param node [i] The HTML tag node is specified.
532 * @return The conversion result is returned.
535 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
541 chtml20 = GET_CHTML20(pdoc);
545 /*--------------------------------------------------------------------------*/
547 /*--------------------------------------------------------------------------*/
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_end_html_tag(void *pdoc, Node *UNUSED(child))
568 chtml20 = GET_CHTML20(pdoc);
578 * It is a handler who processes the META tag.
580 * @param pdoc [i/o] The pointer to the CHTML structure at the output
581 * destination is specified.
582 * @param node [i] The META tag node is specified.
583 * @return The conversion result is returned.
586 s_chtml20_start_meta_tag(void *pdoc, Node *node)
592 int content_type_flag;
595 chtml20 = GET_CHTML20(pdoc);
599 content_type_flag = 0;
603 /*--------------------------------------------------------------------------*/
605 /*--------------------------------------------------------------------------*/
606 for (attr = qs_get_attr(doc,node);
608 attr = qs_get_next_attr(doc,attr)) {
613 name = qs_get_attr_name(doc,attr);
614 value = qs_get_attr_value(doc,attr);
619 if (strcasecmp(name, "http-equiv") == 0) {
620 /*----------------------------------------------------------------------*/
622 /*----------------------------------------------------------------------*/
623 W20_L(" http-equiv=\"");
626 if (STRCASEEQ('c','C',"content-type", value)) {
627 content_type_flag = 1;
629 if (STRCASEEQ('r','R',"refresh", value)) {
637 if (strcasecmp(name, "content") == 0) {
638 if (content_type_flag) {
641 W20_L("=\"text/html; charset=Windows-31J\"");
643 else if (refresh_flag) {
644 char *buf = apr_pstrdup(r->pool, value);
648 url = strchr(buf, ';');
650 sec = apr_pstrdup(r->pool, buf);
653 url = chxj_encoding_parameter(r, url);
654 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
684 * It is a handler who processes the META tag.
686 * @param pdoc [i/o] The pointer to the CHTML structure at the output
687 * destination is specified.
688 * @param node [i] The META tag node is specified.
689 * @return The conversion result is returned.
692 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
696 chtml20 = GET_CHTML20(pdoc);
703 * It is a handler who processes the HEAD tag.
705 * @param pdoc [i/o] The pointer to the CHTML structure at the output
706 * destination is specified.
707 * @param node [i] The HEAD tag node is specified.
708 * @return The conversion result is returned.
711 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
717 chtml20 = GET_CHTML20(pdoc);
727 * It is a handler who processes the HEAD tag.
729 * @param pdoc [i/o] The pointer to the CHTML structure at the output
730 * destination is specified.
731 * @param node [i] The HEAD tag node is specified.
732 * @return The conversion result is returned.
735 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
741 chtml20 = GET_CHTML20(pdoc);
745 W20_L("</head>\r\n");
751 * It is a handler who processes the TITLE tag.
753 * @param pdoc [i/o] The pointer to the CHTML structure at the output
754 * destination is specified.
755 * @param node [i] The TITLE tag node is specified.
756 * @return The conversion result is returned.
759 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
765 chtml20 = GET_CHTML20(pdoc);
775 * It is a handler who processes the TITLE tag.
777 * @param pdoc [i/o] The pointer to the CHTML structure at the output
778 * destination is specified.
779 * @param node [i] The TITLE tag node is specified.
780 * @return The conversion result is returned.
783 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
789 chtml20 = GET_CHTML20(pdoc);
793 W20_L("</title>\r\n");
799 * It is a handler who processes the BASE tag.
801 * @param pdoc [i/o] The pointer to the CHTML structure at the output
802 * destination is specified.
803 * @param node [i] The BASE tag node is specified.
804 * @return The conversion result is returned.
807 s_chtml20_start_base_tag(void *pdoc, Node *node)
814 chtml20 = GET_CHTML20(pdoc);
819 /*--------------------------------------------------------------------------*/
821 /*--------------------------------------------------------------------------*/
822 for (attr = qs_get_attr(doc,node);
824 attr = qs_get_next_attr(doc,attr)) {
829 name = qs_get_attr_name(doc,attr);
830 value = qs_get_attr_value(doc,attr);
832 if (STRCASEEQ('h','H',"href", name)) {
844 * It is a handler who processes the BASE tag.
846 * @param pdoc [i/o] The pointer to the CHTML structure at the output
847 * destination is specified.
848 * @param node [i] The BASE tag node is specified.
849 * @return The conversion result is returned.
852 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
858 chtml20 = GET_CHTML20(pdoc);
867 * It is a handler who processes the BODY tag.
869 * @param pdoc [i/o] The pointer to the CHTML structure at the output
870 * destination is specified.
871 * @param node [i] The BODY tag node is specified.
872 * @return The conversion result is returned.
875 s_chtml20_start_body_tag(void *pdoc, Node *node)
882 chtml20 = GET_CHTML20(pdoc);
887 /*--------------------------------------------------------------------------*/
889 /*--------------------------------------------------------------------------*/
890 for (attr = qs_get_attr(doc,node);
892 attr = qs_get_next_attr(doc,attr)) {
896 name = qs_get_attr_name(doc,attr);
897 value = qs_get_attr_value(doc,attr);
902 if (strcasecmp(name, "bgcolor") == 0) {
903 /*----------------------------------------------------------------------*/
905 /*----------------------------------------------------------------------*/
906 W20_L(" bgcolor=\"");
914 if (strcasecmp(name, "text") == 0) {
915 /*----------------------------------------------------------------------*/
917 /*----------------------------------------------------------------------*/
926 if (strcasecmp(name, "link") == 0) {
927 /*----------------------------------------------------------------------*/
929 /*----------------------------------------------------------------------*/
938 if (strcasecmp(name, "alink") == 0) {
939 /*----------------------------------------------------------------------*/
941 /*----------------------------------------------------------------------*/
948 if (strcasecmp(name, "vlink") == 0) {
949 /*----------------------------------------------------------------------*/
951 /*----------------------------------------------------------------------*/
966 * It is a handler who processes the BODY tag.
968 * @param pdoc [i/o] The pointer to the CHTML structure at the output
969 * destination is specified.
970 * @param node [i] The BODY tag node is specified.
971 * @return The conversion result is returned.
974 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
980 chtml20 = GET_CHTML20(pdoc);
984 W20_L("</body>\r\n");
990 * It is a handler who processes the A tag.
992 * @param pdoc [i/o] The pointer to the CHTML structure at the output
993 * destination is specified.
994 * @param node [i] The A tag node is specified.
995 * @return The conversion result is returned.
998 s_chtml20_start_a_tag(void *pdoc, Node *node)
1005 chtml20 = GET_CHTML20(pdoc);
1010 /*--------------------------------------------------------------------------*/
1011 /* Get Attributes */
1012 /*--------------------------------------------------------------------------*/
1013 for (attr = qs_get_attr(doc,node);
1015 attr = qs_get_next_attr(doc,attr)) {
1020 name = qs_get_attr_name(doc,attr);
1021 value = qs_get_attr_value(doc,attr);
1026 if (strcasecmp(name, "name") == 0) {
1027 /*--------------------------------------------------------------------*/
1029 /*--------------------------------------------------------------------*/
1038 if (strcasecmp(name, "href") == 0) {
1039 /*--------------------------------------------------------------------*/
1041 /*--------------------------------------------------------------------*/
1042 value = chxj_encoding_parameter(r, value);
1043 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1052 if (strcasecmp(name, "accesskey") == 0) {
1053 /*--------------------------------------------------------------------*/
1055 /*--------------------------------------------------------------------*/
1056 W20_L(" accesskey=\"");
1064 if (strcasecmp(name, "cti") == 0) {
1065 /*--------------------------------------------------------------------*/
1067 /*--------------------------------------------------------------------*/
1076 if (strcasecmp(name, "ijam") == 0) {
1077 /*--------------------------------------------------------------------*/
1079 /*--------------------------------------------------------------------*/
1083 if (strcasecmp(name, "ista") == 0) {
1084 /*--------------------------------------------------------------------*/
1086 /*--------------------------------------------------------------------*/
1090 if (strcasecmp(name, "ilet") == 0) {
1091 /*--------------------------------------------------------------------*/
1093 /*--------------------------------------------------------------------*/
1097 if (strcasecmp(name, "iswf") == 0) {
1098 /*--------------------------------------------------------------------*/
1100 /*--------------------------------------------------------------------*/
1104 if (strcasecmp(name, "irst") == 0) {
1105 /*--------------------------------------------------------------------*/
1107 /*--------------------------------------------------------------------*/
1114 if (strcasecmp(name, "utn") == 0) {
1115 /*--------------------------------------------------------------------*/
1117 /*--------------------------------------------------------------------*/
1124 if (strcasecmp(name, "telbook") == 0) {
1125 /*--------------------------------------------------------------------*/
1127 /*--------------------------------------------------------------------*/
1134 if (strcasecmp(name, "kana") == 0) {
1135 /*--------------------------------------------------------------------*/
1137 /*--------------------------------------------------------------------*/
1144 if (strcasecmp(name, "email") == 0) {
1145 /*--------------------------------------------------------------------*/
1147 /*--------------------------------------------------------------------*/
1157 return chtml20->out;
1162 * It is a handler who processes the A tag.
1164 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1165 * destination is specified.
1166 * @param node [i] The A tag node is specified.
1167 * @return The conversion result is returned.
1170 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1176 chtml20 = GET_CHTML20(pdoc);
1181 return chtml20->out;
1186 * It is a handler who processes the BR tag.
1188 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1189 * destination is specified.
1190 * @param node [i] The BR tag node is specified.
1191 * @return The conversion result is returned.
1194 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1200 chtml20 = GET_CHTML20(pdoc);
1205 return chtml20->out;
1210 * It is a handler who processes the BR tag.
1212 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1213 * destination is specified.
1214 * @param node [i] The BR tag node is specified.
1215 * @return The conversion result is returned.
1218 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1224 chtml20 = GET_CHTML20(pdoc);
1228 return chtml20->out;
1233 * It is a handler who processes the TR tag.
1235 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1236 * destination is specified.
1237 * @param node [i] The TR tag node is specified.
1238 * @return The conversion result is returned.
1241 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1247 chtml20 = GET_CHTML20(pdoc);
1251 return chtml20->out;
1256 * It is a handler who processes the TR tag.
1258 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1259 * destination is specified.
1260 * @param node [i] The TR tag node is specified.
1261 * @return The conversion result is returned.
1264 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1270 chtml20 = GET_CHTML20(pdoc);
1275 return chtml20->out;
1280 * It is a handler who processes the FONT tag.
1282 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1283 * destination is specified.
1284 * @param node [i] The FONT tag node is specified.
1285 * @return The conversion result is returned.
1288 s_chtml20_start_font_tag(void *pdoc, Node *node)
1295 chtml20 = GET_CHTML20(pdoc);
1301 /*--------------------------------------------------------------------------*/
1302 /* Get Attributes */
1303 /*--------------------------------------------------------------------------*/
1304 for (attr = qs_get_attr(doc,node);
1306 attr = qs_get_next_attr(doc,attr)) {
1311 name = qs_get_attr_name(doc,attr);
1312 value = qs_get_attr_value(doc,attr);
1317 if (strcasecmp(name, "color") == 0) {
1326 if (strcasecmp(name, "size") == 0) {
1327 /*--------------------------------------------------------------------*/
1329 /*--------------------------------------------------------------------*/
1339 return chtml20->out;
1344 * It is a handler who processes the FONT tag.
1346 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1347 * destination is specified.
1348 * @param node [i] The FONT tag node is specified.
1349 * @return The conversion result is returned.
1352 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1358 chtml20 = GET_CHTML20(pdoc);
1363 return chtml20->out;
1368 * It is a handler who processes the FORM tag.
1370 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1371 * destination is specified.
1372 * @param node [i] The FORM tag node is specified.
1373 * @return The conversion result is returned.
1376 s_chtml20_start_form_tag(void *pdoc, Node *node)
1383 chtml20 = GET_CHTML20(pdoc);
1388 /*--------------------------------------------------------------------------*/
1389 /* Get Attributes */
1390 /*--------------------------------------------------------------------------*/
1391 for (attr = qs_get_attr(doc,node);
1393 attr = qs_get_next_attr(doc,attr)) {
1398 name = qs_get_attr_name(doc,attr);
1399 value = qs_get_attr_value(doc,attr);
1404 if (strcasecmp(name, "action") == 0) {
1405 /*--------------------------------------------------------------------*/
1407 /*--------------------------------------------------------------------*/
1408 value = chxj_encoding_parameter(r, value);
1409 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1411 W20_L(" action=\"");
1419 if (strcasecmp(name, "method") == 0) {
1420 /*--------------------------------------------------------------------*/
1422 /*--------------------------------------------------------------------*/
1423 W20_L(" method=\"");
1431 if (strcasecmp(name, "utn") == 0) {
1432 /*--------------------------------------------------------------------*/
1434 /*--------------------------------------------------------------------*/
1444 return chtml20->out;
1449 * It is a handler who processes the FORM tag.
1451 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1452 * destination is specified.
1453 * @param node [i] The FORM tag node is specified.
1454 * @return The conversion result is returned.
1457 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1463 chtml20 = GET_CHTML20(pdoc);
1468 return chtml20->out;
1473 * It is a handler who processes the INPUT tag.
1475 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1476 * destination is specified.
1477 * @param node [i] The INPUT tag node is specified.
1478 * @return The conversion result is returned.
1481 s_chtml20_start_input_tag(void *pdoc, Node *node)
1486 char *max_length = NULL;
1490 char *istyle = NULL;
1492 char *checked = NULL;
1493 char *accesskey = NULL;
1495 chtml20 = GET_CHTML20(pdoc);
1501 /*--------------------------------------------------------------------------*/
1502 /* Get Attributes */
1503 /*--------------------------------------------------------------------------*/
1505 type = qs_get_type_attr(doc, node, r);
1506 name = qs_get_name_attr(doc, node, r);
1507 value = qs_get_value_attr(doc,node,r);
1508 istyle = qs_get_istyle_attr(doc,node,r);
1509 max_length = qs_get_maxlength_attr(doc,node,r);
1510 checked = qs_get_checked_attr(doc,node,r);
1511 accesskey = qs_get_accesskey_attr(doc, node, r);
1512 size = qs_get_size_attr(doc, node, r);
1539 W20_L(" accesskey=\"");
1545 /*------------------------------------------------------------------------*/
1547 /*------------------------------------------------------------------------*/
1548 W20_L(" istyle=\"");
1553 /*--------------------------------------------------------------------------*/
1554 /* The figure is default for the password. */
1555 /*--------------------------------------------------------------------------*/
1557 if (chxj_chk_numeric(max_length) != 0)
1558 max_length = apr_psprintf(doc->buf.pool, "0");
1559 if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
1560 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1564 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1573 return chtml20->out;
1578 * It is a handler who processes the INPUT tag.
1580 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1581 * destination is specified.
1582 * @param node [i] The INPUT tag node is specified.
1583 * @return The conversion result is returned.
1586 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1592 chtml20 = GET_CHTML20(pdoc);
1596 return chtml20->out;
1601 * It is a handler who processes the CENTER tag.
1603 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1604 * destination is specified.
1605 * @param node [i] The CENTER tag node is specified.
1606 * @return The conversion result is returned.
1609 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1615 chtml20 = GET_CHTML20(pdoc);
1620 return chtml20->out;
1625 * It is a handler who processes the CENTER tag.
1627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1628 * destination is specified.
1629 * @param node [i] The CENTER tag node is specified.
1630 * @return The conversion result is returned.
1633 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1639 chtml20 = GET_CHTML20(pdoc);
1644 return chtml20->out;
1649 * It is a handler who processes the UL tag.
1651 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1652 * destination is specified.
1653 * @param node [i] The UL tag node is specified.
1654 * @return The conversion result is returned.
1657 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1663 chtml20 = GET_CHTML20(pdoc);
1668 return chtml20->out;
1673 * It is a handler who processes the UL tag.
1675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1676 * destination is specified.
1677 * @param node [i] The UL tag node is specified.
1678 * @return The conversion result is returned.
1681 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1687 chtml20 = GET_CHTML20(pdoc);
1692 return chtml20->out;
1697 * It is a handler who processes the OL tag.
1699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1700 * destination is specified.
1701 * @param node [i] The OL tag node is specified.
1702 * @return The conversion result is returned.
1705 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1711 chtml20 = GET_CHTML20(pdoc);
1716 return chtml20->out;
1721 * It is a handler who processes the OL tag.
1723 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1724 * destination is specified.
1725 * @param node [i] The OL tag node is specified.
1726 * @return The conversion result is returned.
1729 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1735 chtml20 = GET_CHTML20(pdoc);
1740 return chtml20->out;
1745 * It is a handler who processes the LI tag.
1747 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1748 * destination is specified.
1749 * @param node [i] The LI tag node is specified.
1750 * @return The conversion result is returned.
1753 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1759 chtml20 = GET_CHTML20(pdoc);
1764 return chtml20->out;
1769 * It is a handler who processes the LI tag.
1771 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1772 * destination is specified.
1773 * @param node [i] The LI tag node is specified.
1774 * @return The conversion result is returned.
1777 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1783 chtml20 = GET_CHTML20(pdoc);
1788 return chtml20->out;
1793 * It is a handler who processes the HR tag.
1795 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1796 * destination is specified.
1797 * @param node [i] The HR tag node is specified.
1798 * @return The conversion result is returned.
1801 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1808 chtml20 = GET_CHTML20(pdoc);
1814 for (attr = qs_get_attr(doc,node);
1816 attr = qs_get_next_attr(doc,attr)) {
1821 name = qs_get_attr_name(doc,attr);
1822 value = qs_get_attr_value(doc,attr);
1827 if (strcasecmp(name, "align") == 0) {
1828 /*--------------------------------------------------------------------*/
1830 /*--------------------------------------------------------------------*/
1839 if (strcasecmp(name, "size") == 0) {
1840 /*--------------------------------------------------------------------*/
1842 /*--------------------------------------------------------------------*/
1851 if (strcasecmp(name, "width") == 0) {
1852 /*--------------------------------------------------------------------*/
1854 /*--------------------------------------------------------------------*/
1863 if (strcasecmp(name, "noshade") == 0) {
1864 /*--------------------------------------------------------------------*/
1866 /*--------------------------------------------------------------------*/
1873 if (strcasecmp(name, "color") == 0) {
1874 /*--------------------------------------------------------------------*/
1876 /*--------------------------------------------------------------------*/
1886 return chtml20->out;
1891 * It is a handler who processes the HR tag.
1893 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1894 * destination is specified.
1895 * @param node [i] The HR tag node is specified.
1896 * @return The conversion result is returned.
1899 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1905 chtml20 = GET_CHTML20(pdoc);
1909 return chtml20->out;
1914 * It is a handler who processes the IMG tag.
1916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1917 * destination is specified.
1918 * @param node [i] The IMG tag node is specified.
1919 * @return The conversion result is returned.
1922 s_chtml20_start_img_tag(void *pdoc, Node *node)
1928 #ifndef IMG_NOT_CONVERT_FILENAME
1932 chtml20 = GET_CHTML20(pdoc);
1936 #ifndef IMG_NOT_CONVERT_FILENAME
1937 spec = chtml20->spec;
1941 /*-------------------------------------------------------------------------*/
1942 /* Get Attributes */
1943 /*-------------------------------------------------------------------------*/
1944 for (attr = qs_get_attr(doc,node);
1946 attr = qs_get_next_attr(doc,attr)) {
1951 name = qs_get_attr_name(doc,attr);
1952 value = qs_get_attr_value(doc,attr);
1957 if (strcasecmp(name, "src") == 0) {
1958 /*-------------------------------------------------------------------*/
1960 /*-------------------------------------------------------------------*/
1961 #ifdef IMG_NOT_CONVERT_FILENAME
1962 value = chxj_encoding_parameter(r, value);
1963 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1965 value = apr_psprintf(doc->buf.pool,
1968 (strchr(value, '?')) ? '&' : '?',
1969 CHXJ_COOKIE_NOUPDATE_PARAM);
1975 value = chxj_img_conv(r, spec, value);
1976 value = chxj_encoding_parameter(r, value);
1977 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1979 value = apr_psprintf(doc->buf.pool,
1982 (strchr(value, '?')) ? '&' : '?',
1983 CHXJ_COOKIE_NOUPDATE_PARAM);
1994 if (strcasecmp(name, "align" ) == 0) {
1995 /*--------------------------------------------------------------------*/
1997 /*--------------------------------------------------------------------*/
2003 if (strcasecmp(name, "alt" ) == 0) {
2004 /*--------------------------------------------------------------------*/
2006 /*--------------------------------------------------------------------*/
2012 if (strcasecmp(name, "align" ) == 0) {
2013 /*--------------------------------------------------------------------*/
2015 /*--------------------------------------------------------------------*/
2022 if (strcasecmp(name, "width" ) == 0) {
2023 /*--------------------------------------------------------------------*/
2025 /*--------------------------------------------------------------------*/
2034 if (strcasecmp(name, "height") == 0) {
2035 /*--------------------------------------------------------------------*/
2037 /*--------------------------------------------------------------------*/
2038 W20_L(" height=\"");
2043 if (strcasecmp(name, "hspace") == 0) {
2044 /*--------------------------------------------------------------------*/
2046 /*--------------------------------------------------------------------*/
2047 W20_L(" hspace=\"");
2055 if (strcasecmp(name, "vspace") == 0) {
2056 /*--------------------------------------------------------------------*/
2058 /*--------------------------------------------------------------------*/
2059 W20_L(" vspace=\"");
2070 return chtml20->out;
2075 * It is a handler who processes the IMG tag.
2077 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2078 * destination is specified.
2079 * @param node [i] The IMG tag node is specified.
2080 * @return The conversion result is returned.
2083 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2089 chtml20 = GET_CHTML20(pdoc);
2093 return chtml20->out;
2098 * It is a handler who processes the SELECT tag.
2100 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2101 * destination is specified.
2102 * @param node [i] The SELECT tag node is specified.
2103 * @return The conversion result is returned.
2106 s_chtml20_start_select_tag(void *pdoc, Node *child)
2113 chtml20 = GET_CHTML20(pdoc);
2121 for (attr = qs_get_attr(doc,child);
2123 attr = qs_get_next_attr(doc,attr)) {
2128 nm = qs_get_attr_name(doc,attr);
2129 val = qs_get_attr_value(doc,attr);
2134 if (strcasecmp(nm, "size") == 0) {
2135 /*--------------------------------------------------------------------*/
2136 /* CHTML 1.0 version 2.0 */
2137 /*--------------------------------------------------------------------*/
2138 size = apr_pstrdup(doc->buf.pool, val);
2144 if (strcasecmp(nm, "name") == 0) {
2145 /*--------------------------------------------------------------------*/
2146 /* CHTML 1.0 version 2.0 */
2147 /*--------------------------------------------------------------------*/
2148 name = apr_pstrdup(doc->buf.pool, val);
2154 if (strcasecmp(nm, "multiple") == 0) {
2155 /*--------------------------------------------------------------------*/
2156 /* CHTML 1.0 version 2.0 */
2157 /*--------------------------------------------------------------------*/
2180 return chtml20->out;
2185 * It is a handler who processes the SELECT tag.
2187 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2188 * destination is specified.
2189 * @param node [i] The SELECT tag node is specified.
2190 * @return The conversion result is returned.
2193 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2199 chtml20 = GET_CHTML20(pdoc);
2203 W20_L("</select>\r\n");
2204 return chtml20->out;
2209 * It is a handler who processes the OPTION tag.
2211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2212 * destination is specified.
2213 * @param node [i] The OPTION tag node is specified.
2214 * @return The conversion result is returned.
2217 s_chtml20_start_option_tag(void *pdoc, Node *child)
2224 chtml20 = GET_CHTML20(pdoc);
2228 char *selected = NULL;
2232 for (attr = qs_get_attr(doc,child);
2234 attr = qs_get_next_attr(doc,attr)) {
2239 nm = qs_get_attr_name(doc,attr);
2240 val = qs_get_attr_value(doc,attr);
2245 if (strcasecmp(nm, "selected") == 0) {
2246 /*--------------------------------------------------------------------*/
2247 /* CHTML 1.0 version 2.0 */
2248 /*--------------------------------------------------------------------*/
2249 selected = apr_pstrdup(doc->buf.pool, val);
2255 if (strcasecmp(nm, "value") == 0) {
2256 /*--------------------------------------------------------------------*/
2257 /* CHTML 1.0 version 2.0 */
2258 /*--------------------------------------------------------------------*/
2259 value = apr_pstrdup(doc->buf.pool, val);
2274 W20_L(" value=\"\"");
2278 W20_L(" selected ");
2281 return chtml20->out;
2286 * It is a handler who processes the OPTION tag.
2288 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2289 * destination is specified.
2290 * @param node [i] The OPTION tag node is specified.
2291 * @return The conversion result is returned.
2294 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2300 chtml20 = GET_CHTML20(pdoc);
2306 return chtml20->out;
2311 * It is a handler who processes the DIV tag.
2313 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2314 * destination is specified.
2315 * @param node [i] The DIV tag node is specified.
2316 * @return The conversion result is returned.
2319 s_chtml20_start_div_tag(void *pdoc, Node *child)
2326 chtml20 = GET_CHTML20(pdoc);
2334 for (attr = qs_get_attr(doc,child);
2336 attr = qs_get_next_attr(doc,attr)) {
2341 nm = qs_get_attr_name(doc,attr);
2342 val = qs_get_attr_value(doc,attr);
2344 if (STRCASEEQ('a','A', "align", nm)) {
2345 /*----------------------------------------------------------------------*/
2346 /* CHTML 1.0 (W3C version 3.2) */
2347 /*----------------------------------------------------------------------*/
2348 align = apr_pstrdup(doc->buf.pool, val);
2359 return chtml20->out;
2364 * It is a handler who processes the DIV tag.
2366 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2367 * destination is specified.
2368 * @param node [i] The DIV tag node is specified.
2369 * @return The conversion result is returned.
2372 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2378 chtml20 = GET_CHTML20(pdoc);
2382 W20_L("</div>\r\n");
2383 return chtml20->out;
2388 * It is a handler who processes the H1 tag.
2390 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2391 * destination is specified.
2392 * @param node [i] The H1 tag node is specified.
2393 * @return The conversion result is returned.
2396 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2402 chtml20 = GET_CHTML20(pdoc);
2407 return chtml20->out;
2412 * It is a handler who processes the H1 tag.
2414 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2415 * destination is specified.
2416 * @param node [i] The H1 tag node is specified.
2417 * @return The conversion result is returned.
2420 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2426 chtml20 = GET_CHTML20(pdoc);
2431 return chtml20->out;
2436 * It is a handler who processes the H2 tag.
2438 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2439 * destination is specified.
2440 * @param node [i] The H2 tag node is specified.
2441 * @return The conversion result is returned.
2444 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2450 chtml20 = GET_CHTML20(pdoc);
2455 return chtml20->out;
2460 * It is a handler who processes the H2 tag.
2462 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2463 * destination is specified.
2464 * @param node [i] The H2 tag node is specified.
2465 * @return The conversion result is returned.
2468 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2474 chtml20 = GET_CHTML20(pdoc);
2479 return chtml20->out;
2484 * It is a handler who processes the H3 tag.
2486 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2487 * destination is specified.
2488 * @param node [i] The H3 tag node is specified.
2489 * @return The conversion result is returned.
2492 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2498 chtml20 = GET_CHTML20(pdoc);
2503 return chtml20->out;
2508 * It is a handler who processes the H3 tag.
2510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2511 * destination is specified.
2512 * @param node [i] The H3 tag node is specified.
2513 * @return The conversion result is returned.
2516 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2522 chtml20 = GET_CHTML20(pdoc);
2527 return chtml20->out;
2532 * It is a handler who processes the H4 tag.
2534 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2535 * destination is specified.
2536 * @param node [i] The H4 tag node is specified.
2537 * @return The conversion result is returned.
2540 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2546 chtml20 = GET_CHTML20(pdoc);
2551 return chtml20->out;
2556 * It is a handler who processes the H4 tag.
2558 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2559 * destination is specified.
2560 * @param node [i] The H4 tag node is specified.
2561 * @return The conversion result is returned.
2564 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2570 chtml20 = GET_CHTML20(pdoc);
2575 return chtml20->out;
2580 * It is a handler who processes the H5 tag.
2582 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2583 * destination is specified.
2584 * @param node [i] The H5 tag node is specified.
2585 * @return The conversion result is returned.
2588 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2594 chtml20 = GET_CHTML20(pdoc);
2599 return chtml20->out;
2604 * It is a handler who processes the H5 tag.
2606 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2607 * destination is specified.
2608 * @param node [i] The H5 tag node is specified.
2609 * @return The conversion result is returned.
2612 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2618 chtml20 = GET_CHTML20(pdoc);
2623 return chtml20->out;
2628 * It is a handler who processes the H6 tag.
2630 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2631 * destination is specified.
2632 * @param node [i] The H6 tag node is specified.
2633 * @return The conversion result is returned.
2636 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2642 chtml20 = GET_CHTML20(pdoc);
2647 return chtml20->out;
2652 * It is a handler who processes the H6 tag.
2654 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2655 * destination is specified.
2656 * @param node [i] The H6 tag node is specified.
2657 * @return The conversion result is returned.
2660 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2666 chtml20 = GET_CHTML20(pdoc);
2671 return chtml20->out;
2676 * It is a handler who processes the PRE tag.
2678 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2679 * destination is specified.
2680 * @param node [i] The PRE tag node is specified.
2681 * @return The conversion result is returned.
2684 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2690 chtml20 = GET_CHTML20(pdoc);
2694 chtml20->pre_flag++;
2696 return chtml20->out;
2701 * It is a handler who processes the PRE tag.
2703 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2704 * destination is specified.
2705 * @param node [i] The PRE tag node is specified.
2706 * @return The conversion result is returned.
2709 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2715 chtml20 = GET_CHTML20(pdoc);
2720 chtml20->pre_flag--;
2722 return chtml20->out;
2727 * It is a handler who processes the P tag.
2729 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2730 * destination is specified.
2731 * @param node [i] The P tag node is specified.
2732 * @return The conversion result is returned.
2735 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2741 chtml20 = GET_CHTML20(pdoc);
2746 return chtml20->out;
2751 * It is a handler who processes the P tag.
2753 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2754 * destination is specified.
2755 * @param node [i] The P tag node is specified.
2756 * @return The conversion result is returned.
2759 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2765 chtml20 = GET_CHTML20(pdoc);
2770 return chtml20->out;
2775 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2782 chtml20 = GET_CHTML20(pdoc);
2786 for (child = qs_get_child_node(doc, node);
2788 child = qs_get_next_node(doc, child)) {
2790 W20_V(child->otext);
2791 s_chtml20_chxjif_tag(pdoc, child);
2799 * It is a handler who processes the TEXTARE tag.
2801 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2802 * destination is specified.
2803 * @param node [i] The TEXTAREA tag node is specified.
2804 * @return The conversion result is returned.
2807 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2814 chtml20 = GET_CHTML20(pdoc);
2818 chtml20->textarea_flag++;
2819 W20_L("<textarea ");
2820 for (attr = qs_get_attr(doc,node);
2822 attr = qs_get_next_attr(doc,attr)) {
2827 name = qs_get_attr_name(doc,attr);
2828 value = qs_get_attr_value(doc,attr);
2833 if (strcasecmp(name, "name") == 0) {
2842 if (strcasecmp(name, "rows") == 0) {
2851 if (strcasecmp(name, "cols") == 0) {
2863 return chtml20->out;
2868 * It is a handler who processes the TEXTAREA tag.
2870 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2871 * destination is specified.
2872 * @param node [i] The TEXTAREA tag node is specified.
2873 * @return The conversion result is returned.
2876 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2882 chtml20 = GET_CHTML20(pdoc);
2886 W20_L("</textarea>\r\n");
2887 chtml20->textarea_flag--;
2889 return chtml20->out;
2894 s_chtml20_text_tag(void *pdoc, Node *child)
2906 chtml20 = GET_CHTML20(pdoc);
2910 textval = qs_get_node_value(doc,child);
2911 textval = qs_trim_string(doc->buf.pool, textval);
2912 if (strlen(textval) == 0)
2913 return chtml20->out;
2915 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2916 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2918 tdst = qs_alloc_zero_byte_string(r);
2919 memset(one_byte, 0, sizeof(one_byte));
2922 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2924 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
2926 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2930 if (is_sjis_kanji(textval[ii])) {
2931 one_byte[0] = textval[ii+0];
2932 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2933 one_byte[0] = textval[ii+1];
2934 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2938 if (chtml20->pre_flag) {
2939 one_byte[0] = textval[ii+0];
2940 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2943 if (chtml20->textarea_flag) {
2944 one_byte[0] = textval[ii+0];
2945 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2948 if (textval[ii] != '\r' && textval[ii] != '\n') {
2949 one_byte[0] = textval[ii+0];
2950 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2954 return chtml20->out;