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,
360 * converts from CHTML5.0 to CHTML2.0.
362 * @param r [i] Requet_rec is appointed.
363 * @param spec [i] The result of the device specification processing which
364 * was done in advance is appointed.
365 * @param src [i] The character string before the converting is appointed.
366 * @return The character string after the converting is returned.
369 chxj_exchange_chtml20(
375 chxjconvrule_entry *entryp,
384 /*--------------------------------------------------------------------------*/
386 /*--------------------------------------------------------------------------*/
388 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
390 DBG(r,"i found qrcode xml");
393 DBG(r,"not found qrcode xml");
395 /*--------------------------------------------------------------------------*/
396 /* The CHTML structure is initialized. */
397 /*--------------------------------------------------------------------------*/
398 s_init_chtml20(&chtml20, &doc, r, spec);
401 chtml20.entryp = entryp;
402 chtml20.cookie = cookie;
404 chxj_set_content_type(r, "text/html; charset=Windows-31J");
406 /*--------------------------------------------------------------------------*/
407 /* The character string of the input is analyzed. */
408 /*--------------------------------------------------------------------------*/
409 qs_init_malloc(&doc);
410 qs_init_root_node(&doc);
412 ss = apr_pcalloc(r->pool, srclen + 1);
413 memset(ss, 0, srclen + 1);
414 memcpy(ss, src, srclen);
417 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
420 qs_parse_string(&doc,ss, strlen(ss));
422 chxj_buffered_write_init(r->pool, &doc.buf);
423 /*--------------------------------------------------------------------------*/
424 /* It converts it from CHTML to CHTML. */
425 /*--------------------------------------------------------------------------*/
426 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
427 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
428 dst = apr_pstrdup(r->pool, chtml20.out);
429 chxj_buffered_write_terminate(&doc.buf);
431 qs_all_free(&doc,QX_LOGMARK);
434 return apr_pstrdup(r->pool,ss);
437 if (strlen(dst) == 0) {
438 dst = apr_psprintf(r->pool, "\n");
441 *dstlen = strlen(dst);
444 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
451 * The CHTML structure is initialized.
453 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
454 * initialized is specified.
455 * @param doc [i] The Doc structure that should be set to the initialized
456 * HDML structure is specified.
457 * @param r [i] To use POOL, the pointer to request_rec is specified.
458 * @param spec [i] The pointer to the device_table
461 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
463 memset(doc, 0, sizeof(Doc));
464 memset(chtml20, 0, sizeof(chtml20_t));
468 chtml20->spec = spec;
469 chtml20->out = qs_alloc_zero_byte_string(r);
470 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
472 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
477 * Corresponding EMOJI to a current character-code is retrieved.
478 * The substitution character string is stored in the rslt pointer if agreeing.
480 * @param chtml20 [i] The pointer to the CHTML structure is specified.
481 * @param txt [i] The character string to want to examine whether it is
482 * EMOJI is specified.
483 * @param rslt [o] The pointer to the pointer that stores the result is
485 * @return When corresponding EMOJI exists, it returns it excluding 0.
488 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
495 spec = chtml20->spec;
501 DBG(r,"spec is NULL");
503 for (ee = chtml20->conf->emoji;
507 if (ee->imode == NULL) {
508 DBG(r,"emoji->imode is NULL");
512 if (ee->imode->string != NULL
513 && strlen(ee->imode->string) > 0
514 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
515 if (spec == NULL || spec->emoji_type == NULL) {
516 *rslt = apr_palloc(r->pool, 3);
517 (*rslt)[0] = ee->imode->hex1byte & 0xff;
518 (*rslt)[1] = ee->imode->hex2byte & 0xff;
520 return strlen(ee->imode->string);
532 * It is a handler who processes the HTML tag.
534 * @param pdoc [i/o] The pointer to the CHTML structure at the output
535 * destination is specified.
536 * @param node [i] The HTML tag node is specified.
537 * @return The conversion result is returned.
540 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
546 chtml20 = GET_CHTML20(pdoc);
550 /*--------------------------------------------------------------------------*/
552 /*--------------------------------------------------------------------------*/
559 * It is a handler who processes the HTML tag.
561 * @param pdoc [i/o] The pointer to the CHTML structure at the output
562 * destination is specified.
563 * @param node [i] The HTML tag node is specified.
564 * @return The conversion result is returned.
567 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
573 chtml20 = GET_CHTML20(pdoc);
583 * It is a handler who processes the META tag.
585 * @param pdoc [i/o] The pointer to the CHTML structure at the output
586 * destination is specified.
587 * @param node [i] The META tag node is specified.
588 * @return The conversion result is returned.
591 s_chtml20_start_meta_tag(void *pdoc, Node *node)
597 int content_type_flag;
600 chtml20 = GET_CHTML20(pdoc);
604 content_type_flag = 0;
608 /*--------------------------------------------------------------------------*/
610 /*--------------------------------------------------------------------------*/
611 for (attr = qs_get_attr(doc,node);
613 attr = qs_get_next_attr(doc,attr)) {
618 name = qs_get_attr_name(doc,attr);
619 value = qs_get_attr_value(doc,attr);
624 if (strcasecmp(name, "http-equiv") == 0) {
625 /*----------------------------------------------------------------------*/
627 /*----------------------------------------------------------------------*/
628 W20_L(" http-equiv=\"");
631 if (STRCASEEQ('c','C',"content-type", value)) {
632 content_type_flag = 1;
634 if (STRCASEEQ('r','R',"refresh", value)) {
642 if (strcasecmp(name, "content") == 0) {
643 if (content_type_flag) {
646 W20_L("=\"text/html; charset=Windows-31J\"");
648 else if (refresh_flag) {
649 char *buf = apr_pstrdup(r->pool, value);
653 url = strchr(buf, ';');
655 sec = apr_pstrdup(r->pool, buf);
658 url = chxj_encoding_parameter(r, url);
659 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
689 * It is a handler who processes the META tag.
691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
692 * destination is specified.
693 * @param node [i] The META tag node is specified.
694 * @return The conversion result is returned.
697 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
701 chtml20 = GET_CHTML20(pdoc);
708 * It is a handler who processes the HEAD tag.
710 * @param pdoc [i/o] The pointer to the CHTML structure at the output
711 * destination is specified.
712 * @param node [i] The HEAD tag node is specified.
713 * @return The conversion result is returned.
716 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
722 chtml20 = GET_CHTML20(pdoc);
732 * It is a handler who processes the HEAD tag.
734 * @param pdoc [i/o] The pointer to the CHTML structure at the output
735 * destination is specified.
736 * @param node [i] The HEAD tag node is specified.
737 * @return The conversion result is returned.
740 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
746 chtml20 = GET_CHTML20(pdoc);
750 W20_L("</head>\r\n");
756 * It is a handler who processes the TITLE tag.
758 * @param pdoc [i/o] The pointer to the CHTML structure at the output
759 * destination is specified.
760 * @param node [i] The TITLE tag node is specified.
761 * @return The conversion result is returned.
764 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
770 chtml20 = GET_CHTML20(pdoc);
780 * It is a handler who processes the TITLE tag.
782 * @param pdoc [i/o] The pointer to the CHTML structure at the output
783 * destination is specified.
784 * @param node [i] The TITLE tag node is specified.
785 * @return The conversion result is returned.
788 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
794 chtml20 = GET_CHTML20(pdoc);
798 W20_L("</title>\r\n");
804 * It is a handler who processes the BASE tag.
806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
807 * destination is specified.
808 * @param node [i] The BASE tag node is specified.
809 * @return The conversion result is returned.
812 s_chtml20_start_base_tag(void *pdoc, Node *node)
819 chtml20 = GET_CHTML20(pdoc);
824 /*--------------------------------------------------------------------------*/
826 /*--------------------------------------------------------------------------*/
827 for (attr = qs_get_attr(doc,node);
829 attr = qs_get_next_attr(doc,attr)) {
834 name = qs_get_attr_name(doc,attr);
835 value = qs_get_attr_value(doc,attr);
837 if (STRCASEEQ('h','H',"href", name)) {
849 * It is a handler who processes the BASE tag.
851 * @param pdoc [i/o] The pointer to the CHTML structure at the output
852 * destination is specified.
853 * @param node [i] The BASE tag node is specified.
854 * @return The conversion result is returned.
857 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
863 chtml20 = GET_CHTML20(pdoc);
872 * It is a handler who processes the BODY tag.
874 * @param pdoc [i/o] The pointer to the CHTML structure at the output
875 * destination is specified.
876 * @param node [i] The BODY tag node is specified.
877 * @return The conversion result is returned.
880 s_chtml20_start_body_tag(void *pdoc, Node *node)
887 chtml20 = GET_CHTML20(pdoc);
892 /*--------------------------------------------------------------------------*/
894 /*--------------------------------------------------------------------------*/
895 for (attr = qs_get_attr(doc,node);
897 attr = qs_get_next_attr(doc,attr)) {
901 name = qs_get_attr_name(doc,attr);
902 value = qs_get_attr_value(doc,attr);
907 if (strcasecmp(name, "bgcolor") == 0) {
908 /*----------------------------------------------------------------------*/
910 /*----------------------------------------------------------------------*/
911 W20_L(" bgcolor=\"");
919 if (strcasecmp(name, "text") == 0) {
920 /*----------------------------------------------------------------------*/
922 /*----------------------------------------------------------------------*/
931 if (strcasecmp(name, "link") == 0) {
932 /*----------------------------------------------------------------------*/
934 /*----------------------------------------------------------------------*/
943 if (strcasecmp(name, "alink") == 0) {
944 /*----------------------------------------------------------------------*/
946 /*----------------------------------------------------------------------*/
953 if (strcasecmp(name, "vlink") == 0) {
954 /*----------------------------------------------------------------------*/
956 /*----------------------------------------------------------------------*/
971 * It is a handler who processes the BODY tag.
973 * @param pdoc [i/o] The pointer to the CHTML structure at the output
974 * destination is specified.
975 * @param node [i] The BODY tag node is specified.
976 * @return The conversion result is returned.
979 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
985 chtml20 = GET_CHTML20(pdoc);
989 W20_L("</body>\r\n");
995 * It is a handler who processes the A tag.
997 * @param pdoc [i/o] The pointer to the CHTML structure at the output
998 * destination is specified.
999 * @param node [i] The A tag node is specified.
1000 * @return The conversion result is returned.
1003 s_chtml20_start_a_tag(void *pdoc, Node *node)
1010 chtml20 = GET_CHTML20(pdoc);
1015 /*--------------------------------------------------------------------------*/
1016 /* Get Attributes */
1017 /*--------------------------------------------------------------------------*/
1018 for (attr = qs_get_attr(doc,node);
1020 attr = qs_get_next_attr(doc,attr)) {
1025 name = qs_get_attr_name(doc,attr);
1026 value = qs_get_attr_value(doc,attr);
1031 if (strcasecmp(name, "name") == 0) {
1032 /*--------------------------------------------------------------------*/
1034 /*--------------------------------------------------------------------*/
1043 if (strcasecmp(name, "href") == 0) {
1044 /*--------------------------------------------------------------------*/
1046 /*--------------------------------------------------------------------*/
1047 value = chxj_encoding_parameter(r, value);
1048 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1057 if (strcasecmp(name, "accesskey") == 0) {
1058 /*--------------------------------------------------------------------*/
1060 /*--------------------------------------------------------------------*/
1061 W20_L(" accesskey=\"");
1069 if (strcasecmp(name, "cti") == 0) {
1070 /*--------------------------------------------------------------------*/
1072 /*--------------------------------------------------------------------*/
1081 if (strcasecmp(name, "ijam") == 0) {
1082 /*--------------------------------------------------------------------*/
1084 /*--------------------------------------------------------------------*/
1088 if (strcasecmp(name, "ista") == 0) {
1089 /*--------------------------------------------------------------------*/
1091 /*--------------------------------------------------------------------*/
1095 if (strcasecmp(name, "ilet") == 0) {
1096 /*--------------------------------------------------------------------*/
1098 /*--------------------------------------------------------------------*/
1102 if (strcasecmp(name, "iswf") == 0) {
1103 /*--------------------------------------------------------------------*/
1105 /*--------------------------------------------------------------------*/
1109 if (strcasecmp(name, "irst") == 0) {
1110 /*--------------------------------------------------------------------*/
1112 /*--------------------------------------------------------------------*/
1119 if (strcasecmp(name, "utn") == 0) {
1120 /*--------------------------------------------------------------------*/
1122 /*--------------------------------------------------------------------*/
1129 if (strcasecmp(name, "telbook") == 0) {
1130 /*--------------------------------------------------------------------*/
1132 /*--------------------------------------------------------------------*/
1139 if (strcasecmp(name, "kana") == 0) {
1140 /*--------------------------------------------------------------------*/
1142 /*--------------------------------------------------------------------*/
1149 if (strcasecmp(name, "email") == 0) {
1150 /*--------------------------------------------------------------------*/
1152 /*--------------------------------------------------------------------*/
1162 return chtml20->out;
1167 * It is a handler who processes the A tag.
1169 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1170 * destination is specified.
1171 * @param node [i] The A tag node is specified.
1172 * @return The conversion result is returned.
1175 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1181 chtml20 = GET_CHTML20(pdoc);
1186 return chtml20->out;
1191 * It is a handler who processes the BR tag.
1193 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1194 * destination is specified.
1195 * @param node [i] The BR tag node is specified.
1196 * @return The conversion result is returned.
1199 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1205 chtml20 = GET_CHTML20(pdoc);
1210 return chtml20->out;
1215 * It is a handler who processes the BR tag.
1217 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1218 * destination is specified.
1219 * @param node [i] The BR tag node is specified.
1220 * @return The conversion result is returned.
1223 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1229 chtml20 = GET_CHTML20(pdoc);
1233 return chtml20->out;
1238 * It is a handler who processes the TR tag.
1240 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1241 * destination is specified.
1242 * @param node [i] The TR tag node is specified.
1243 * @return The conversion result is returned.
1246 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1252 chtml20 = GET_CHTML20(pdoc);
1256 return chtml20->out;
1261 * It is a handler who processes the TR tag.
1263 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1264 * destination is specified.
1265 * @param node [i] The TR tag node is specified.
1266 * @return The conversion result is returned.
1269 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1275 chtml20 = GET_CHTML20(pdoc);
1280 return chtml20->out;
1285 * It is a handler who processes the FONT tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The FONT tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml20_start_font_tag(void *pdoc, Node *node)
1300 chtml20 = GET_CHTML20(pdoc);
1306 /*--------------------------------------------------------------------------*/
1307 /* Get Attributes */
1308 /*--------------------------------------------------------------------------*/
1309 for (attr = qs_get_attr(doc,node);
1311 attr = qs_get_next_attr(doc,attr)) {
1316 name = qs_get_attr_name(doc,attr);
1317 value = qs_get_attr_value(doc,attr);
1322 if (strcasecmp(name, "color") == 0) {
1331 if (strcasecmp(name, "size") == 0) {
1332 /*--------------------------------------------------------------------*/
1334 /*--------------------------------------------------------------------*/
1344 return chtml20->out;
1349 * It is a handler who processes the FONT tag.
1351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1352 * destination is specified.
1353 * @param node [i] The FONT tag node is specified.
1354 * @return The conversion result is returned.
1357 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1363 chtml20 = GET_CHTML20(pdoc);
1368 return chtml20->out;
1373 * It is a handler who processes the FORM tag.
1375 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1376 * destination is specified.
1377 * @param node [i] The FORM tag node is specified.
1378 * @return The conversion result is returned.
1381 s_chtml20_start_form_tag(void *pdoc, Node *node)
1388 chtml20 = GET_CHTML20(pdoc);
1393 /*--------------------------------------------------------------------------*/
1394 /* Get Attributes */
1395 /*--------------------------------------------------------------------------*/
1396 for (attr = qs_get_attr(doc,node);
1398 attr = qs_get_next_attr(doc,attr)) {
1403 name = qs_get_attr_name(doc,attr);
1404 value = qs_get_attr_value(doc,attr);
1409 if (strcasecmp(name, "action") == 0) {
1410 /*--------------------------------------------------------------------*/
1412 /*--------------------------------------------------------------------*/
1413 value = chxj_encoding_parameter(r, value);
1414 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1416 W20_L(" action=\"");
1424 if (strcasecmp(name, "method") == 0) {
1425 /*--------------------------------------------------------------------*/
1427 /*--------------------------------------------------------------------*/
1428 W20_L(" method=\"");
1436 if (strcasecmp(name, "utn") == 0) {
1437 /*--------------------------------------------------------------------*/
1439 /*--------------------------------------------------------------------*/
1449 return chtml20->out;
1454 * It is a handler who processes the FORM tag.
1456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1457 * destination is specified.
1458 * @param node [i] The FORM tag node is specified.
1459 * @return The conversion result is returned.
1462 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1468 chtml20 = GET_CHTML20(pdoc);
1473 return chtml20->out;
1478 * It is a handler who processes the INPUT tag.
1480 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1481 * destination is specified.
1482 * @param node [i] The INPUT tag node is specified.
1483 * @return The conversion result is returned.
1486 s_chtml20_start_input_tag(void *pdoc, Node *node)
1491 char *max_length = NULL;
1495 char *istyle = NULL;
1497 char *checked = NULL;
1498 char *accesskey = NULL;
1500 chtml20 = GET_CHTML20(pdoc);
1506 /*--------------------------------------------------------------------------*/
1507 /* Get Attributes */
1508 /*--------------------------------------------------------------------------*/
1510 type = qs_get_type_attr(doc, node, r);
1511 name = qs_get_name_attr(doc, node, r);
1512 value = qs_get_value_attr(doc,node,r);
1513 istyle = qs_get_istyle_attr(doc,node,r);
1514 max_length = qs_get_maxlength_attr(doc,node,r);
1515 checked = qs_get_checked_attr(doc,node,r);
1516 accesskey = qs_get_accesskey_attr(doc, node, r);
1517 size = qs_get_size_attr(doc, node, r);
1544 W20_L(" accesskey=\"");
1550 /*------------------------------------------------------------------------*/
1552 /*------------------------------------------------------------------------*/
1553 W20_L(" istyle=\"");
1558 /*--------------------------------------------------------------------------*/
1559 /* The figure is default for the password. */
1560 /*--------------------------------------------------------------------------*/
1562 if (chxj_chk_numeric(max_length) != 0)
1563 max_length = apr_psprintf(doc->buf.pool, "0");
1564 if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
1565 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1569 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1578 return chtml20->out;
1583 * It is a handler who processes the INPUT tag.
1585 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1586 * destination is specified.
1587 * @param node [i] The INPUT tag node is specified.
1588 * @return The conversion result is returned.
1591 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1597 chtml20 = GET_CHTML20(pdoc);
1601 return chtml20->out;
1606 * It is a handler who processes the CENTER tag.
1608 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1609 * destination is specified.
1610 * @param node [i] The CENTER tag node is specified.
1611 * @return The conversion result is returned.
1614 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1620 chtml20 = GET_CHTML20(pdoc);
1625 return chtml20->out;
1630 * It is a handler who processes the CENTER tag.
1632 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1633 * destination is specified.
1634 * @param node [i] The CENTER tag node is specified.
1635 * @return The conversion result is returned.
1638 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1644 chtml20 = GET_CHTML20(pdoc);
1649 return chtml20->out;
1654 * It is a handler who processes the UL tag.
1656 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1657 * destination is specified.
1658 * @param node [i] The UL tag node is specified.
1659 * @return The conversion result is returned.
1662 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1668 chtml20 = GET_CHTML20(pdoc);
1673 return chtml20->out;
1678 * It is a handler who processes the UL tag.
1680 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1681 * destination is specified.
1682 * @param node [i] The UL tag node is specified.
1683 * @return The conversion result is returned.
1686 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1692 chtml20 = GET_CHTML20(pdoc);
1697 return chtml20->out;
1702 * It is a handler who processes the OL tag.
1704 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1705 * destination is specified.
1706 * @param node [i] The OL tag node is specified.
1707 * @return The conversion result is returned.
1710 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1716 chtml20 = GET_CHTML20(pdoc);
1721 return chtml20->out;
1726 * It is a handler who processes the OL tag.
1728 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1729 * destination is specified.
1730 * @param node [i] The OL tag node is specified.
1731 * @return The conversion result is returned.
1734 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1740 chtml20 = GET_CHTML20(pdoc);
1745 return chtml20->out;
1750 * It is a handler who processes the LI tag.
1752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1753 * destination is specified.
1754 * @param node [i] The LI tag node is specified.
1755 * @return The conversion result is returned.
1758 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1764 chtml20 = GET_CHTML20(pdoc);
1769 return chtml20->out;
1774 * It is a handler who processes the LI tag.
1776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1777 * destination is specified.
1778 * @param node [i] The LI tag node is specified.
1779 * @return The conversion result is returned.
1782 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1788 chtml20 = GET_CHTML20(pdoc);
1793 return chtml20->out;
1798 * It is a handler who processes the HR tag.
1800 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1801 * destination is specified.
1802 * @param node [i] The HR tag node is specified.
1803 * @return The conversion result is returned.
1806 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1813 chtml20 = GET_CHTML20(pdoc);
1819 for (attr = qs_get_attr(doc,node);
1821 attr = qs_get_next_attr(doc,attr)) {
1826 name = qs_get_attr_name(doc,attr);
1827 value = qs_get_attr_value(doc,attr);
1832 if (strcasecmp(name, "align") == 0) {
1833 /*--------------------------------------------------------------------*/
1835 /*--------------------------------------------------------------------*/
1844 if (strcasecmp(name, "size") == 0) {
1845 /*--------------------------------------------------------------------*/
1847 /*--------------------------------------------------------------------*/
1856 if (strcasecmp(name, "width") == 0) {
1857 /*--------------------------------------------------------------------*/
1859 /*--------------------------------------------------------------------*/
1868 if (strcasecmp(name, "noshade") == 0) {
1869 /*--------------------------------------------------------------------*/
1871 /*--------------------------------------------------------------------*/
1878 if (strcasecmp(name, "color") == 0) {
1879 /*--------------------------------------------------------------------*/
1881 /*--------------------------------------------------------------------*/
1891 return chtml20->out;
1896 * It is a handler who processes the HR tag.
1898 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1899 * destination is specified.
1900 * @param node [i] The HR tag node is specified.
1901 * @return The conversion result is returned.
1904 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1910 chtml20 = GET_CHTML20(pdoc);
1914 return chtml20->out;
1919 * It is a handler who processes the IMG tag.
1921 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1922 * destination is specified.
1923 * @param node [i] The IMG tag node is specified.
1924 * @return The conversion result is returned.
1927 s_chtml20_start_img_tag(void *pdoc, Node *node)
1933 #ifndef IMG_NOT_CONVERT_FILENAME
1937 chtml20 = GET_CHTML20(pdoc);
1941 #ifndef IMG_NOT_CONVERT_FILENAME
1942 spec = chtml20->spec;
1946 /*-------------------------------------------------------------------------*/
1947 /* Get Attributes */
1948 /*-------------------------------------------------------------------------*/
1949 for (attr = qs_get_attr(doc,node);
1951 attr = qs_get_next_attr(doc,attr)) {
1956 name = qs_get_attr_name(doc,attr);
1957 value = qs_get_attr_value(doc,attr);
1962 if (strcasecmp(name, "src") == 0) {
1963 /*-------------------------------------------------------------------*/
1965 /*-------------------------------------------------------------------*/
1966 #ifdef IMG_NOT_CONVERT_FILENAME
1967 value = chxj_encoding_parameter(r, value);
1968 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1970 value = apr_psprintf(doc->buf.pool,
1973 (strchr(value, '?')) ? '&' : '?',
1974 CHXJ_COOKIE_NOUPDATE_PARAM);
1980 value = chxj_img_conv(r, spec, value);
1981 value = chxj_encoding_parameter(r, value);
1982 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1984 value = apr_psprintf(doc->buf.pool,
1987 (strchr(value, '?')) ? '&' : '?',
1988 CHXJ_COOKIE_NOUPDATE_PARAM);
1999 if (strcasecmp(name, "align" ) == 0) {
2000 /*--------------------------------------------------------------------*/
2002 /*--------------------------------------------------------------------*/
2008 if (strcasecmp(name, "alt" ) == 0) {
2009 /*--------------------------------------------------------------------*/
2011 /*--------------------------------------------------------------------*/
2017 if (strcasecmp(name, "align" ) == 0) {
2018 /*--------------------------------------------------------------------*/
2020 /*--------------------------------------------------------------------*/
2027 if (strcasecmp(name, "width" ) == 0) {
2028 /*--------------------------------------------------------------------*/
2030 /*--------------------------------------------------------------------*/
2039 if (strcasecmp(name, "height") == 0) {
2040 /*--------------------------------------------------------------------*/
2042 /*--------------------------------------------------------------------*/
2043 W20_L(" height=\"");
2048 if (strcasecmp(name, "hspace") == 0) {
2049 /*--------------------------------------------------------------------*/
2051 /*--------------------------------------------------------------------*/
2052 W20_L(" hspace=\"");
2060 if (strcasecmp(name, "vspace") == 0) {
2061 /*--------------------------------------------------------------------*/
2063 /*--------------------------------------------------------------------*/
2064 W20_L(" vspace=\"");
2075 return chtml20->out;
2080 * It is a handler who processes the IMG tag.
2082 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2083 * destination is specified.
2084 * @param node [i] The IMG tag node is specified.
2085 * @return The conversion result is returned.
2088 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2094 chtml20 = GET_CHTML20(pdoc);
2098 return chtml20->out;
2103 * It is a handler who processes the SELECT tag.
2105 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2106 * destination is specified.
2107 * @param node [i] The SELECT tag node is specified.
2108 * @return The conversion result is returned.
2111 s_chtml20_start_select_tag(void *pdoc, Node *child)
2118 chtml20 = GET_CHTML20(pdoc);
2126 for (attr = qs_get_attr(doc,child);
2128 attr = qs_get_next_attr(doc,attr)) {
2133 nm = qs_get_attr_name(doc,attr);
2134 val = qs_get_attr_value(doc,attr);
2139 if (strcasecmp(nm, "size") == 0) {
2140 /*--------------------------------------------------------------------*/
2141 /* CHTML 1.0 version 2.0 */
2142 /*--------------------------------------------------------------------*/
2143 size = apr_pstrdup(doc->buf.pool, val);
2149 if (strcasecmp(nm, "name") == 0) {
2150 /*--------------------------------------------------------------------*/
2151 /* CHTML 1.0 version 2.0 */
2152 /*--------------------------------------------------------------------*/
2153 name = apr_pstrdup(doc->buf.pool, val);
2159 if (strcasecmp(nm, "multiple") == 0) {
2160 /*--------------------------------------------------------------------*/
2161 /* CHTML 1.0 version 2.0 */
2162 /*--------------------------------------------------------------------*/
2185 return chtml20->out;
2190 * It is a handler who processes the SELECT tag.
2192 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2193 * destination is specified.
2194 * @param node [i] The SELECT tag node is specified.
2195 * @return The conversion result is returned.
2198 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2204 chtml20 = GET_CHTML20(pdoc);
2208 W20_L("</select>\r\n");
2209 return chtml20->out;
2214 * It is a handler who processes the OPTION tag.
2216 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2217 * destination is specified.
2218 * @param node [i] The OPTION tag node is specified.
2219 * @return The conversion result is returned.
2222 s_chtml20_start_option_tag(void *pdoc, Node *child)
2229 chtml20 = GET_CHTML20(pdoc);
2233 char *selected = NULL;
2237 for (attr = qs_get_attr(doc,child);
2239 attr = qs_get_next_attr(doc,attr)) {
2244 nm = qs_get_attr_name(doc,attr);
2245 val = qs_get_attr_value(doc,attr);
2250 if (strcasecmp(nm, "selected") == 0) {
2251 /*--------------------------------------------------------------------*/
2252 /* CHTML 1.0 version 2.0 */
2253 /*--------------------------------------------------------------------*/
2254 selected = apr_pstrdup(doc->buf.pool, val);
2260 if (strcasecmp(nm, "value") == 0) {
2261 /*--------------------------------------------------------------------*/
2262 /* CHTML 1.0 version 2.0 */
2263 /*--------------------------------------------------------------------*/
2264 value = apr_pstrdup(doc->buf.pool, val);
2279 W20_L(" value=\"\"");
2283 W20_L(" selected ");
2286 return chtml20->out;
2291 * It is a handler who processes the OPTION tag.
2293 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2294 * destination is specified.
2295 * @param node [i] The OPTION tag node is specified.
2296 * @return The conversion result is returned.
2299 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2305 chtml20 = GET_CHTML20(pdoc);
2311 return chtml20->out;
2316 * It is a handler who processes the DIV tag.
2318 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2319 * destination is specified.
2320 * @param node [i] The DIV tag node is specified.
2321 * @return The conversion result is returned.
2324 s_chtml20_start_div_tag(void *pdoc, Node *child)
2331 chtml20 = GET_CHTML20(pdoc);
2339 for (attr = qs_get_attr(doc,child);
2341 attr = qs_get_next_attr(doc,attr)) {
2346 nm = qs_get_attr_name(doc,attr);
2347 val = qs_get_attr_value(doc,attr);
2349 if (STRCASEEQ('a','A', "align", nm)) {
2350 /*----------------------------------------------------------------------*/
2351 /* CHTML 1.0 (W3C version 3.2) */
2352 /*----------------------------------------------------------------------*/
2353 align = apr_pstrdup(doc->buf.pool, val);
2364 return chtml20->out;
2369 * It is a handler who processes the DIV tag.
2371 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2372 * destination is specified.
2373 * @param node [i] The DIV tag node is specified.
2374 * @return The conversion result is returned.
2377 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2383 chtml20 = GET_CHTML20(pdoc);
2387 W20_L("</div>\r\n");
2388 return chtml20->out;
2393 * It is a handler who processes the H1 tag.
2395 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2396 * destination is specified.
2397 * @param node [i] The H1 tag node is specified.
2398 * @return The conversion result is returned.
2401 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2407 chtml20 = GET_CHTML20(pdoc);
2412 return chtml20->out;
2417 * It is a handler who processes the H1 tag.
2419 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2420 * destination is specified.
2421 * @param node [i] The H1 tag node is specified.
2422 * @return The conversion result is returned.
2425 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2431 chtml20 = GET_CHTML20(pdoc);
2436 return chtml20->out;
2441 * It is a handler who processes the H2 tag.
2443 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2444 * destination is specified.
2445 * @param node [i] The H2 tag node is specified.
2446 * @return The conversion result is returned.
2449 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2455 chtml20 = GET_CHTML20(pdoc);
2460 return chtml20->out;
2465 * It is a handler who processes the H2 tag.
2467 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2468 * destination is specified.
2469 * @param node [i] The H2 tag node is specified.
2470 * @return The conversion result is returned.
2473 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2479 chtml20 = GET_CHTML20(pdoc);
2484 return chtml20->out;
2489 * It is a handler who processes the H3 tag.
2491 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2492 * destination is specified.
2493 * @param node [i] The H3 tag node is specified.
2494 * @return The conversion result is returned.
2497 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2503 chtml20 = GET_CHTML20(pdoc);
2508 return chtml20->out;
2513 * It is a handler who processes the H3 tag.
2515 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2516 * destination is specified.
2517 * @param node [i] The H3 tag node is specified.
2518 * @return The conversion result is returned.
2521 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2527 chtml20 = GET_CHTML20(pdoc);
2532 return chtml20->out;
2537 * It is a handler who processes the H4 tag.
2539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2540 * destination is specified.
2541 * @param node [i] The H4 tag node is specified.
2542 * @return The conversion result is returned.
2545 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2551 chtml20 = GET_CHTML20(pdoc);
2556 return chtml20->out;
2561 * It is a handler who processes the H4 tag.
2563 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2564 * destination is specified.
2565 * @param node [i] The H4 tag node is specified.
2566 * @return The conversion result is returned.
2569 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2575 chtml20 = GET_CHTML20(pdoc);
2580 return chtml20->out;
2585 * It is a handler who processes the H5 tag.
2587 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2588 * destination is specified.
2589 * @param node [i] The H5 tag node is specified.
2590 * @return The conversion result is returned.
2593 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2599 chtml20 = GET_CHTML20(pdoc);
2604 return chtml20->out;
2609 * It is a handler who processes the H5 tag.
2611 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2612 * destination is specified.
2613 * @param node [i] The H5 tag node is specified.
2614 * @return The conversion result is returned.
2617 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2623 chtml20 = GET_CHTML20(pdoc);
2628 return chtml20->out;
2633 * It is a handler who processes the H6 tag.
2635 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2636 * destination is specified.
2637 * @param node [i] The H6 tag node is specified.
2638 * @return The conversion result is returned.
2641 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2647 chtml20 = GET_CHTML20(pdoc);
2652 return chtml20->out;
2657 * It is a handler who processes the H6 tag.
2659 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2660 * destination is specified.
2661 * @param node [i] The H6 tag node is specified.
2662 * @return The conversion result is returned.
2665 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2671 chtml20 = GET_CHTML20(pdoc);
2676 return chtml20->out;
2681 * It is a handler who processes the PRE tag.
2683 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2684 * destination is specified.
2685 * @param node [i] The PRE tag node is specified.
2686 * @return The conversion result is returned.
2689 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2695 chtml20 = GET_CHTML20(pdoc);
2699 chtml20->pre_flag++;
2701 return chtml20->out;
2706 * It is a handler who processes the PRE tag.
2708 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2709 * destination is specified.
2710 * @param node [i] The PRE tag node is specified.
2711 * @return The conversion result is returned.
2714 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2720 chtml20 = GET_CHTML20(pdoc);
2725 chtml20->pre_flag--;
2727 return chtml20->out;
2732 * It is a handler who processes the P tag.
2734 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2735 * destination is specified.
2736 * @param node [i] The P tag node is specified.
2737 * @return The conversion result is returned.
2740 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2746 chtml20 = GET_CHTML20(pdoc);
2751 return chtml20->out;
2756 * It is a handler who processes the P tag.
2758 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2759 * destination is specified.
2760 * @param node [i] The P tag node is specified.
2761 * @return The conversion result is returned.
2764 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2770 chtml20 = GET_CHTML20(pdoc);
2775 return chtml20->out;
2780 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2787 chtml20 = GET_CHTML20(pdoc);
2791 for (child = qs_get_child_node(doc, node);
2793 child = qs_get_next_node(doc, child)) {
2795 W20_V(child->otext);
2796 s_chtml20_chxjif_tag(pdoc, child);
2804 * It is a handler who processes the TEXTARE tag.
2806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2807 * destination is specified.
2808 * @param node [i] The TEXTAREA tag node is specified.
2809 * @return The conversion result is returned.
2812 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2819 chtml20 = GET_CHTML20(pdoc);
2823 chtml20->textarea_flag++;
2824 W20_L("<textarea ");
2825 for (attr = qs_get_attr(doc,node);
2827 attr = qs_get_next_attr(doc,attr)) {
2832 name = qs_get_attr_name(doc,attr);
2833 value = qs_get_attr_value(doc,attr);
2838 if (strcasecmp(name, "name") == 0) {
2847 if (strcasecmp(name, "rows") == 0) {
2856 if (strcasecmp(name, "cols") == 0) {
2868 return chtml20->out;
2873 * It is a handler who processes the TEXTAREA tag.
2875 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2876 * destination is specified.
2877 * @param node [i] The TEXTAREA tag node is specified.
2878 * @return The conversion result is returned.
2881 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2887 chtml20 = GET_CHTML20(pdoc);
2891 W20_L("</textarea>\r\n");
2892 chtml20->textarea_flag--;
2894 return chtml20->out;
2899 s_chtml20_text_tag(void *pdoc, Node *child)
2911 chtml20 = GET_CHTML20(pdoc);
2915 textval = qs_get_node_value(doc,child);
2916 textval = qs_trim_string(doc->buf.pool, textval);
2917 if (strlen(textval) == 0)
2918 return chtml20->out;
2920 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2921 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2923 tdst = qs_alloc_zero_byte_string(r);
2924 memset(one_byte, 0, sizeof(one_byte));
2927 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2929 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
2931 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2935 if (is_sjis_kanji(textval[ii])) {
2936 one_byte[0] = textval[ii+0];
2937 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2938 one_byte[0] = textval[ii+1];
2939 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2943 if (chtml20->pre_flag) {
2944 one_byte[0] = textval[ii+0];
2945 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2948 if (chtml20->textarea_flag) {
2949 one_byte[0] = textval[ii+0];
2950 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2953 if (textval[ii] != '\r' && textval[ii] != '\n') {
2954 one_byte[0] = textval[ii+0];
2955 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2959 return chtml20->out;