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,
345 * converts from CHTML5.0 to CHTML2.0.
347 * @param r [i] Requet_rec is appointed.
348 * @param spec [i] The result of the device specification processing which
349 * was done in advance is appointed.
350 * @param src [i] The character string before the converting is appointed.
351 * @return The character string after the converting is returned.
354 chxj_exchange_chtml20(
360 chxjconvrule_entry *entryp,
369 /*--------------------------------------------------------------------------*/
371 /*--------------------------------------------------------------------------*/
373 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
375 DBG(r,"i found qrcode xml");
378 DBG(r,"not found qrcode xml");
380 /*--------------------------------------------------------------------------*/
381 /* The CHTML structure is initialized. */
382 /*--------------------------------------------------------------------------*/
383 s_init_chtml20(&chtml20, &doc, r, spec);
386 chtml20.entryp = entryp;
387 chtml20.cookie = cookie;
389 chxj_set_content_type(r, "text/html; charset=Windows-31J");
391 /*--------------------------------------------------------------------------*/
392 /* The character string of the input is analyzed. */
393 /*--------------------------------------------------------------------------*/
394 qs_init_malloc(&doc);
395 qs_init_root_node(&doc);
397 ss = apr_pcalloc(r->pool, srclen + 1);
398 memset(ss, 0, srclen + 1);
399 memcpy(ss, src, srclen);
402 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
405 qs_parse_string(&doc,ss, strlen(ss));
407 chxj_buffered_write_init(r->pool, &doc.buf);
408 /*--------------------------------------------------------------------------*/
409 /* It converts it from CHTML to CHTML. */
410 /*--------------------------------------------------------------------------*/
411 chxj_node_exchange(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
412 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
413 dst = apr_pstrdup(r->pool, chtml20.out);
414 chxj_buffered_write_terminate(&doc.buf);
416 qs_all_free(&doc,QX_LOGMARK);
419 return apr_pstrdup(r->pool,ss);
422 if (strlen(dst) == 0) {
423 dst = apr_psprintf(r->pool, "\n");
426 *dstlen = strlen(dst);
429 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
436 * The CHTML structure is initialized.
438 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
439 * initialized is specified.
440 * @param doc [i] The Doc structure that should be set to the initialized
441 * HDML structure is specified.
442 * @param r [i] To use POOL, the pointer to request_rec is specified.
443 * @param spec [i] The pointer to the device_table
446 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
448 memset(doc, 0, sizeof(Doc));
449 memset(chtml20, 0, sizeof(chtml20_t));
453 chtml20->spec = spec;
454 chtml20->out = qs_alloc_zero_byte_string(r);
455 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
457 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
462 * Corresponding EMOJI to a current character-code is retrieved.
463 * The substitution character string is stored in the rslt pointer if agreeing.
465 * @param chtml20 [i] The pointer to the CHTML structure is specified.
466 * @param txt [i] The character string to want to examine whether it is
467 * EMOJI is specified.
468 * @param rslt [o] The pointer to the pointer that stores the result is
470 * @return When corresponding EMOJI exists, it returns it excluding 0.
473 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
480 spec = chtml20->spec;
486 DBG(r,"spec is NULL");
488 for (ee = chtml20->conf->emoji;
492 if (ee->imode == NULL) {
493 DBG(r,"emoji->imode is NULL");
497 if (ee->imode->string != NULL
498 && strlen(ee->imode->string) > 0
499 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
500 if (spec == NULL || spec->emoji_type == NULL) {
501 *rslt = apr_palloc(r->pool, 3);
502 (*rslt)[0] = ee->imode->hex1byte & 0xff;
503 (*rslt)[1] = ee->imode->hex2byte & 0xff;
505 return strlen(ee->imode->string);
517 * It is a handler who processes the HTML tag.
519 * @param pdoc [i/o] The pointer to the CHTML structure at the output
520 * destination is specified.
521 * @param node [i] The HTML tag node is specified.
522 * @return The conversion result is returned.
525 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
531 chtml20 = GET_CHTML20(pdoc);
535 /*--------------------------------------------------------------------------*/
537 /*--------------------------------------------------------------------------*/
544 * It is a handler who processes the HTML tag.
546 * @param pdoc [i/o] The pointer to the CHTML structure at the output
547 * destination is specified.
548 * @param node [i] The HTML tag node is specified.
549 * @return The conversion result is returned.
552 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
558 chtml20 = GET_CHTML20(pdoc);
568 * It is a handler who processes the META tag.
570 * @param pdoc [i/o] The pointer to the CHTML structure at the output
571 * destination is specified.
572 * @param node [i] The META tag node is specified.
573 * @return The conversion result is returned.
576 s_chtml20_start_meta_tag(void *pdoc, Node *node)
582 int content_type_flag;
585 chtml20 = GET_CHTML20(pdoc);
589 content_type_flag = 0;
593 /*--------------------------------------------------------------------------*/
595 /*--------------------------------------------------------------------------*/
596 for (attr = qs_get_attr(doc,node);
598 attr = qs_get_next_attr(doc,attr)) {
603 name = qs_get_attr_name(doc,attr);
604 value = qs_get_attr_value(doc,attr);
609 if (strcasecmp(name, "http-equiv") == 0) {
610 /*----------------------------------------------------------------------*/
612 /*----------------------------------------------------------------------*/
613 W20_L(" http-equiv=\"");
616 if (STRCASEEQ('c','C',"content-type", value)) {
617 content_type_flag = 1;
619 if (STRCASEEQ('r','R',"refresh", value)) {
627 if (strcasecmp(name, "content") == 0) {
628 if (content_type_flag) {
631 W20_L("=\"text/html; charset=Windows-31J\"");
633 else if (refresh_flag) {
634 char *buf = apr_pstrdup(r->pool, value);
638 url = strchr(buf, ';');
640 sec = apr_pstrdup(r->pool, buf);
643 url = chxj_encoding_parameter(r, url);
644 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
674 * It is a handler who processes the META tag.
676 * @param pdoc [i/o] The pointer to the CHTML structure at the output
677 * destination is specified.
678 * @param node [i] The META tag node is specified.
679 * @return The conversion result is returned.
682 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
686 chtml20 = GET_CHTML20(pdoc);
693 * It is a handler who processes the HEAD tag.
695 * @param pdoc [i/o] The pointer to the CHTML structure at the output
696 * destination is specified.
697 * @param node [i] The HEAD tag node is specified.
698 * @return The conversion result is returned.
701 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
707 chtml20 = GET_CHTML20(pdoc);
717 * It is a handler who processes the HEAD tag.
719 * @param pdoc [i/o] The pointer to the CHTML structure at the output
720 * destination is specified.
721 * @param node [i] The HEAD tag node is specified.
722 * @return The conversion result is returned.
725 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
731 chtml20 = GET_CHTML20(pdoc);
735 W20_L("</head>\r\n");
741 * It is a handler who processes the TITLE tag.
743 * @param pdoc [i/o] The pointer to the CHTML structure at the output
744 * destination is specified.
745 * @param node [i] The TITLE tag node is specified.
746 * @return The conversion result is returned.
749 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
755 chtml20 = GET_CHTML20(pdoc);
765 * It is a handler who processes the TITLE tag.
767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
768 * destination is specified.
769 * @param node [i] The TITLE tag node is specified.
770 * @return The conversion result is returned.
773 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
779 chtml20 = GET_CHTML20(pdoc);
783 W20_L("</title>\r\n");
789 * It is a handler who processes the BASE tag.
791 * @param pdoc [i/o] The pointer to the CHTML structure at the output
792 * destination is specified.
793 * @param node [i] The BASE tag node is specified.
794 * @return The conversion result is returned.
797 s_chtml20_start_base_tag(void *pdoc, Node *node)
804 chtml20 = GET_CHTML20(pdoc);
809 /*--------------------------------------------------------------------------*/
811 /*--------------------------------------------------------------------------*/
812 for (attr = qs_get_attr(doc,node);
814 attr = qs_get_next_attr(doc,attr)) {
819 name = qs_get_attr_name(doc,attr);
820 value = qs_get_attr_value(doc,attr);
822 if (STRCASEEQ('h','H',"href", name)) {
834 * It is a handler who processes the BASE tag.
836 * @param pdoc [i/o] The pointer to the CHTML structure at the output
837 * destination is specified.
838 * @param node [i] The BASE tag node is specified.
839 * @return The conversion result is returned.
842 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
848 chtml20 = GET_CHTML20(pdoc);
857 * It is a handler who processes the BODY tag.
859 * @param pdoc [i/o] The pointer to the CHTML structure at the output
860 * destination is specified.
861 * @param node [i] The BODY tag node is specified.
862 * @return The conversion result is returned.
865 s_chtml20_start_body_tag(void *pdoc, Node *node)
872 chtml20 = GET_CHTML20(pdoc);
877 /*--------------------------------------------------------------------------*/
879 /*--------------------------------------------------------------------------*/
880 for (attr = qs_get_attr(doc,node);
882 attr = qs_get_next_attr(doc,attr)) {
886 name = qs_get_attr_name(doc,attr);
887 value = qs_get_attr_value(doc,attr);
892 if (strcasecmp(name, "bgcolor") == 0) {
893 /*----------------------------------------------------------------------*/
895 /*----------------------------------------------------------------------*/
896 W20_L(" bgcolor=\"");
904 if (strcasecmp(name, "text") == 0) {
905 /*----------------------------------------------------------------------*/
907 /*----------------------------------------------------------------------*/
916 if (strcasecmp(name, "link") == 0) {
917 /*----------------------------------------------------------------------*/
919 /*----------------------------------------------------------------------*/
928 if (strcasecmp(name, "alink") == 0) {
929 /*----------------------------------------------------------------------*/
931 /*----------------------------------------------------------------------*/
938 if (strcasecmp(name, "vlink") == 0) {
939 /*----------------------------------------------------------------------*/
941 /*----------------------------------------------------------------------*/
956 * It is a handler who processes the BODY tag.
958 * @param pdoc [i/o] The pointer to the CHTML structure at the output
959 * destination is specified.
960 * @param node [i] The BODY tag node is specified.
961 * @return The conversion result is returned.
964 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
970 chtml20 = GET_CHTML20(pdoc);
974 W20_L("</body>\r\n");
980 * It is a handler who processes the A tag.
982 * @param pdoc [i/o] The pointer to the CHTML structure at the output
983 * destination is specified.
984 * @param node [i] The A tag node is specified.
985 * @return The conversion result is returned.
988 s_chtml20_start_a_tag(void *pdoc, Node *node)
995 chtml20 = GET_CHTML20(pdoc);
1000 /*--------------------------------------------------------------------------*/
1001 /* Get Attributes */
1002 /*--------------------------------------------------------------------------*/
1003 for (attr = qs_get_attr(doc,node);
1005 attr = qs_get_next_attr(doc,attr)) {
1010 name = qs_get_attr_name(doc,attr);
1011 value = qs_get_attr_value(doc,attr);
1016 if (strcasecmp(name, "name") == 0) {
1017 /*--------------------------------------------------------------------*/
1019 /*--------------------------------------------------------------------*/
1028 if (strcasecmp(name, "href") == 0) {
1029 /*--------------------------------------------------------------------*/
1031 /*--------------------------------------------------------------------*/
1032 value = chxj_encoding_parameter(r, value);
1033 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1042 if (strcasecmp(name, "accesskey") == 0) {
1043 /*--------------------------------------------------------------------*/
1045 /*--------------------------------------------------------------------*/
1046 W20_L(" accesskey=\"");
1054 if (strcasecmp(name, "cti") == 0) {
1055 /*--------------------------------------------------------------------*/
1057 /*--------------------------------------------------------------------*/
1066 if (strcasecmp(name, "ijam") == 0) {
1067 /*--------------------------------------------------------------------*/
1069 /*--------------------------------------------------------------------*/
1073 if (strcasecmp(name, "ista") == 0) {
1074 /*--------------------------------------------------------------------*/
1076 /*--------------------------------------------------------------------*/
1080 if (strcasecmp(name, "ilet") == 0) {
1081 /*--------------------------------------------------------------------*/
1083 /*--------------------------------------------------------------------*/
1087 if (strcasecmp(name, "iswf") == 0) {
1088 /*--------------------------------------------------------------------*/
1090 /*--------------------------------------------------------------------*/
1094 if (strcasecmp(name, "irst") == 0) {
1095 /*--------------------------------------------------------------------*/
1097 /*--------------------------------------------------------------------*/
1104 if (strcasecmp(name, "utn") == 0) {
1105 /*--------------------------------------------------------------------*/
1107 /*--------------------------------------------------------------------*/
1114 if (strcasecmp(name, "telbook") == 0) {
1115 /*--------------------------------------------------------------------*/
1117 /*--------------------------------------------------------------------*/
1124 if (strcasecmp(name, "kana") == 0) {
1125 /*--------------------------------------------------------------------*/
1127 /*--------------------------------------------------------------------*/
1134 if (strcasecmp(name, "email") == 0) {
1135 /*--------------------------------------------------------------------*/
1137 /*--------------------------------------------------------------------*/
1147 return chtml20->out;
1152 * It is a handler who processes the A tag.
1154 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1155 * destination is specified.
1156 * @param node [i] The A tag node is specified.
1157 * @return The conversion result is returned.
1160 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1166 chtml20 = GET_CHTML20(pdoc);
1171 return chtml20->out;
1176 * It is a handler who processes the BR tag.
1178 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1179 * destination is specified.
1180 * @param node [i] The BR tag node is specified.
1181 * @return The conversion result is returned.
1184 s_chtml20_start_br_tag(void *pdoc, Node *UNUSED(node))
1190 chtml20 = GET_CHTML20(pdoc);
1195 return chtml20->out;
1200 * It is a handler who processes the BR tag.
1202 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1203 * destination is specified.
1204 * @param node [i] The BR tag node is specified.
1205 * @return The conversion result is returned.
1208 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1214 chtml20 = GET_CHTML20(pdoc);
1218 return chtml20->out;
1223 * It is a handler who processes the TR tag.
1225 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1226 * destination is specified.
1227 * @param node [i] The TR tag node is specified.
1228 * @return The conversion result is returned.
1231 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1237 chtml20 = GET_CHTML20(pdoc);
1241 return chtml20->out;
1246 * It is a handler who processes the TR tag.
1248 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1249 * destination is specified.
1250 * @param node [i] The TR tag node is specified.
1251 * @return The conversion result is returned.
1254 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1260 chtml20 = GET_CHTML20(pdoc);
1265 return chtml20->out;
1270 * It is a handler who processes the FONT tag.
1272 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1273 * destination is specified.
1274 * @param node [i] The FONT tag node is specified.
1275 * @return The conversion result is returned.
1278 s_chtml20_start_font_tag(void *pdoc, Node *node)
1285 chtml20 = GET_CHTML20(pdoc);
1291 /*--------------------------------------------------------------------------*/
1292 /* Get Attributes */
1293 /*--------------------------------------------------------------------------*/
1294 for (attr = qs_get_attr(doc,node);
1296 attr = qs_get_next_attr(doc,attr)) {
1301 name = qs_get_attr_name(doc,attr);
1302 value = qs_get_attr_value(doc,attr);
1307 if (strcasecmp(name, "color") == 0) {
1316 if (strcasecmp(name, "size") == 0) {
1317 /*--------------------------------------------------------------------*/
1319 /*--------------------------------------------------------------------*/
1329 return chtml20->out;
1334 * It is a handler who processes the FONT tag.
1336 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1337 * destination is specified.
1338 * @param node [i] The FONT tag node is specified.
1339 * @return The conversion result is returned.
1342 s_chtml20_end_font_tag(void *pdoc, Node *UNUSED(child))
1348 chtml20 = GET_CHTML20(pdoc);
1353 return chtml20->out;
1358 * It is a handler who processes the FORM tag.
1360 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1361 * destination is specified.
1362 * @param node [i] The FORM tag node is specified.
1363 * @return The conversion result is returned.
1366 s_chtml20_start_form_tag(void *pdoc, Node *node)
1373 chtml20 = GET_CHTML20(pdoc);
1378 /*--------------------------------------------------------------------------*/
1379 /* Get Attributes */
1380 /*--------------------------------------------------------------------------*/
1381 for (attr = qs_get_attr(doc,node);
1383 attr = qs_get_next_attr(doc,attr)) {
1388 name = qs_get_attr_name(doc,attr);
1389 value = qs_get_attr_value(doc,attr);
1394 if (strcasecmp(name, "action") == 0) {
1395 /*--------------------------------------------------------------------*/
1397 /*--------------------------------------------------------------------*/
1398 value = chxj_encoding_parameter(r, value);
1399 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1401 W20_L(" action=\"");
1409 if (strcasecmp(name, "method") == 0) {
1410 /*--------------------------------------------------------------------*/
1412 /*--------------------------------------------------------------------*/
1413 W20_L(" method=\"");
1421 if (strcasecmp(name, "utn") == 0) {
1422 /*--------------------------------------------------------------------*/
1424 /*--------------------------------------------------------------------*/
1434 return chtml20->out;
1439 * It is a handler who processes the FORM tag.
1441 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1442 * destination is specified.
1443 * @param node [i] The FORM tag node is specified.
1444 * @return The conversion result is returned.
1447 s_chtml20_end_form_tag(void *pdoc, Node *UNUSED(child))
1453 chtml20 = GET_CHTML20(pdoc);
1458 return chtml20->out;
1463 * It is a handler who processes the INPUT tag.
1465 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1466 * destination is specified.
1467 * @param node [i] The INPUT tag node is specified.
1468 * @return The conversion result is returned.
1471 s_chtml20_start_input_tag(void *pdoc, Node *node)
1476 char *max_length = NULL;
1480 char *istyle = NULL;
1482 char *checked = NULL;
1483 char *accesskey = NULL;
1485 chtml20 = GET_CHTML20(pdoc);
1491 /*--------------------------------------------------------------------------*/
1492 /* Get Attributes */
1493 /*--------------------------------------------------------------------------*/
1495 type = qs_get_type_attr(doc, node, r);
1496 name = qs_get_name_attr(doc, node, r);
1497 value = qs_get_value_attr(doc,node,r);
1498 istyle = qs_get_istyle_attr(doc,node,r);
1499 max_length = qs_get_maxlength_attr(doc,node,r);
1500 checked = qs_get_checked_attr(doc,node,r);
1501 accesskey = qs_get_accesskey_attr(doc, node, r);
1502 size = qs_get_size_attr(doc, node, r);
1529 W20_L(" accesskey=\"");
1535 /*------------------------------------------------------------------------*/
1537 /*------------------------------------------------------------------------*/
1538 W20_L(" istyle=\"");
1543 /*--------------------------------------------------------------------------*/
1544 /* The figure is default for the password. */
1545 /*--------------------------------------------------------------------------*/
1547 if (chxj_chk_numeric(max_length) != 0)
1548 max_length = apr_psprintf(doc->buf.pool, "0");
1549 if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
1550 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
1554 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
1563 return chtml20->out;
1568 * It is a handler who processes the INPUT tag.
1570 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1571 * destination is specified.
1572 * @param node [i] The INPUT tag node is specified.
1573 * @return The conversion result is returned.
1576 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(child))
1582 chtml20 = GET_CHTML20(pdoc);
1586 return chtml20->out;
1591 * It is a handler who processes the CENTER tag.
1593 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1594 * destination is specified.
1595 * @param node [i] The CENTER tag node is specified.
1596 * @return The conversion result is returned.
1599 s_chtml20_start_center_tag(void *pdoc, Node *UNUSED(node))
1605 chtml20 = GET_CHTML20(pdoc);
1610 return chtml20->out;
1615 * It is a handler who processes the CENTER tag.
1617 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1618 * destination is specified.
1619 * @param node [i] The CENTER tag node is specified.
1620 * @return The conversion result is returned.
1623 s_chtml20_end_center_tag(void *pdoc, Node *UNUSED(child))
1629 chtml20 = GET_CHTML20(pdoc);
1634 return chtml20->out;
1639 * It is a handler who processes the UL tag.
1641 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1642 * destination is specified.
1643 * @param node [i] The UL tag node is specified.
1644 * @return The conversion result is returned.
1647 s_chtml20_start_ul_tag(void *pdoc, Node *UNUSED(node))
1653 chtml20 = GET_CHTML20(pdoc);
1658 return chtml20->out;
1663 * It is a handler who processes the UL tag.
1665 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1666 * destination is specified.
1667 * @param node [i] The UL tag node is specified.
1668 * @return The conversion result is returned.
1671 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
1677 chtml20 = GET_CHTML20(pdoc);
1682 return chtml20->out;
1687 * It is a handler who processes the OL tag.
1689 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1690 * destination is specified.
1691 * @param node [i] The OL tag node is specified.
1692 * @return The conversion result is returned.
1695 s_chtml20_start_ol_tag(void *pdoc, Node *UNUSED(node))
1701 chtml20 = GET_CHTML20(pdoc);
1706 return chtml20->out;
1711 * It is a handler who processes the OL tag.
1713 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1714 * destination is specified.
1715 * @param node [i] The OL tag node is specified.
1716 * @return The conversion result is returned.
1719 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
1725 chtml20 = GET_CHTML20(pdoc);
1730 return chtml20->out;
1735 * It is a handler who processes the LI tag.
1737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1738 * destination is specified.
1739 * @param node [i] The LI tag node is specified.
1740 * @return The conversion result is returned.
1743 s_chtml20_start_li_tag(void *pdoc, Node *UNUSED(node))
1749 chtml20 = GET_CHTML20(pdoc);
1754 return chtml20->out;
1759 * It is a handler who processes the LI tag.
1761 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1762 * destination is specified.
1763 * @param node [i] The LI tag node is specified.
1764 * @return The conversion result is returned.
1767 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
1773 chtml20 = GET_CHTML20(pdoc);
1778 return chtml20->out;
1783 * It is a handler who processes the HR tag.
1785 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1786 * destination is specified.
1787 * @param node [i] The HR tag node is specified.
1788 * @return The conversion result is returned.
1791 s_chtml20_start_hr_tag(void *pdoc, Node *node)
1798 chtml20 = GET_CHTML20(pdoc);
1804 for (attr = qs_get_attr(doc,node);
1806 attr = qs_get_next_attr(doc,attr)) {
1811 name = qs_get_attr_name(doc,attr);
1812 value = qs_get_attr_value(doc,attr);
1817 if (strcasecmp(name, "align") == 0) {
1818 /*--------------------------------------------------------------------*/
1820 /*--------------------------------------------------------------------*/
1829 if (strcasecmp(name, "size") == 0) {
1830 /*--------------------------------------------------------------------*/
1832 /*--------------------------------------------------------------------*/
1841 if (strcasecmp(name, "width") == 0) {
1842 /*--------------------------------------------------------------------*/
1844 /*--------------------------------------------------------------------*/
1853 if (strcasecmp(name, "noshade") == 0) {
1854 /*--------------------------------------------------------------------*/
1856 /*--------------------------------------------------------------------*/
1863 if (strcasecmp(name, "color") == 0) {
1864 /*--------------------------------------------------------------------*/
1866 /*--------------------------------------------------------------------*/
1876 return chtml20->out;
1881 * It is a handler who processes the HR tag.
1883 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1884 * destination is specified.
1885 * @param node [i] The HR tag node is specified.
1886 * @return The conversion result is returned.
1889 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
1895 chtml20 = GET_CHTML20(pdoc);
1899 return chtml20->out;
1904 * It is a handler who processes the IMG tag.
1906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1907 * destination is specified.
1908 * @param node [i] The IMG tag node is specified.
1909 * @return The conversion result is returned.
1912 s_chtml20_start_img_tag(void *pdoc, Node *node)
1918 #ifndef IMG_NOT_CONVERT_FILENAME
1922 chtml20 = GET_CHTML20(pdoc);
1926 #ifndef IMG_NOT_CONVERT_FILENAME
1927 spec = chtml20->spec;
1931 /*-------------------------------------------------------------------------*/
1932 /* Get Attributes */
1933 /*-------------------------------------------------------------------------*/
1934 for (attr = qs_get_attr(doc,node);
1936 attr = qs_get_next_attr(doc,attr)) {
1941 name = qs_get_attr_name(doc,attr);
1942 value = qs_get_attr_value(doc,attr);
1947 if (strcasecmp(name, "src") == 0) {
1948 /*-------------------------------------------------------------------*/
1950 /*-------------------------------------------------------------------*/
1951 #ifdef IMG_NOT_CONVERT_FILENAME
1952 value = chxj_encoding_parameter(r, value);
1953 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1955 value = apr_psprintf(doc->buf.pool,
1958 (strchr(value, '?')) ? '&' : '?',
1959 CHXJ_COOKIE_NOUPDATE_PARAM);
1965 value = chxj_img_conv(r, spec, value);
1966 value = chxj_encoding_parameter(r, value);
1967 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1969 value = apr_psprintf(doc->buf.pool,
1972 (strchr(value, '?')) ? '&' : '?',
1973 CHXJ_COOKIE_NOUPDATE_PARAM);
1984 if (strcasecmp(name, "align" ) == 0) {
1985 /*--------------------------------------------------------------------*/
1987 /*--------------------------------------------------------------------*/
1993 if (strcasecmp(name, "alt" ) == 0) {
1994 /*--------------------------------------------------------------------*/
1996 /*--------------------------------------------------------------------*/
2002 if (strcasecmp(name, "align" ) == 0) {
2003 /*--------------------------------------------------------------------*/
2005 /*--------------------------------------------------------------------*/
2012 if (strcasecmp(name, "width" ) == 0) {
2013 /*--------------------------------------------------------------------*/
2015 /*--------------------------------------------------------------------*/
2024 if (strcasecmp(name, "height") == 0) {
2025 /*--------------------------------------------------------------------*/
2027 /*--------------------------------------------------------------------*/
2028 W20_L(" height=\"");
2033 if (strcasecmp(name, "hspace") == 0) {
2034 /*--------------------------------------------------------------------*/
2036 /*--------------------------------------------------------------------*/
2037 W20_L(" hspace=\"");
2045 if (strcasecmp(name, "vspace") == 0) {
2046 /*--------------------------------------------------------------------*/
2048 /*--------------------------------------------------------------------*/
2049 W20_L(" vspace=\"");
2060 return chtml20->out;
2065 * It is a handler who processes the IMG tag.
2067 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2068 * destination is specified.
2069 * @param node [i] The IMG tag node is specified.
2070 * @return The conversion result is returned.
2073 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2079 chtml20 = GET_CHTML20(pdoc);
2083 return chtml20->out;
2088 * It is a handler who processes the SELECT tag.
2090 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2091 * destination is specified.
2092 * @param node [i] The SELECT tag node is specified.
2093 * @return The conversion result is returned.
2096 s_chtml20_start_select_tag(void *pdoc, Node *child)
2103 chtml20 = GET_CHTML20(pdoc);
2111 for (attr = qs_get_attr(doc,child);
2113 attr = qs_get_next_attr(doc,attr)) {
2118 nm = qs_get_attr_name(doc,attr);
2119 val = qs_get_attr_value(doc,attr);
2124 if (strcasecmp(nm, "size") == 0) {
2125 /*--------------------------------------------------------------------*/
2126 /* CHTML 1.0 version 2.0 */
2127 /*--------------------------------------------------------------------*/
2128 size = apr_pstrdup(doc->buf.pool, val);
2134 if (strcasecmp(nm, "name") == 0) {
2135 /*--------------------------------------------------------------------*/
2136 /* CHTML 1.0 version 2.0 */
2137 /*--------------------------------------------------------------------*/
2138 name = apr_pstrdup(doc->buf.pool, val);
2144 if (strcasecmp(nm, "multiple") == 0) {
2145 /*--------------------------------------------------------------------*/
2146 /* CHTML 1.0 version 2.0 */
2147 /*--------------------------------------------------------------------*/
2170 return chtml20->out;
2175 * It is a handler who processes the SELECT tag.
2177 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2178 * destination is specified.
2179 * @param node [i] The SELECT tag node is specified.
2180 * @return The conversion result is returned.
2183 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2189 chtml20 = GET_CHTML20(pdoc);
2193 W20_L("</select>\r\n");
2194 return chtml20->out;
2199 * It is a handler who processes the OPTION tag.
2201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2202 * destination is specified.
2203 * @param node [i] The OPTION tag node is specified.
2204 * @return The conversion result is returned.
2207 s_chtml20_start_option_tag(void *pdoc, Node *child)
2214 chtml20 = GET_CHTML20(pdoc);
2218 char *selected = NULL;
2222 for (attr = qs_get_attr(doc,child);
2224 attr = qs_get_next_attr(doc,attr)) {
2229 nm = qs_get_attr_name(doc,attr);
2230 val = qs_get_attr_value(doc,attr);
2235 if (strcasecmp(nm, "selected") == 0) {
2236 /*--------------------------------------------------------------------*/
2237 /* CHTML 1.0 version 2.0 */
2238 /*--------------------------------------------------------------------*/
2239 selected = apr_pstrdup(doc->buf.pool, val);
2245 if (strcasecmp(nm, "value") == 0) {
2246 /*--------------------------------------------------------------------*/
2247 /* CHTML 1.0 version 2.0 */
2248 /*--------------------------------------------------------------------*/
2249 value = apr_pstrdup(doc->buf.pool, val);
2264 W20_L(" value=\"\"");
2268 W20_L(" selected ");
2271 return chtml20->out;
2276 * It is a handler who processes the OPTION tag.
2278 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2279 * destination is specified.
2280 * @param node [i] The OPTION tag node is specified.
2281 * @return The conversion result is returned.
2284 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
2290 chtml20 = GET_CHTML20(pdoc);
2296 return chtml20->out;
2301 * It is a handler who processes the DIV tag.
2303 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2304 * destination is specified.
2305 * @param node [i] The DIV tag node is specified.
2306 * @return The conversion result is returned.
2309 s_chtml20_start_div_tag(void *pdoc, Node *child)
2316 chtml20 = GET_CHTML20(pdoc);
2324 for (attr = qs_get_attr(doc,child);
2326 attr = qs_get_next_attr(doc,attr)) {
2331 nm = qs_get_attr_name(doc,attr);
2332 val = qs_get_attr_value(doc,attr);
2334 if (STRCASEEQ('a','A', "align", nm)) {
2335 /*----------------------------------------------------------------------*/
2336 /* CHTML 1.0 (W3C version 3.2) */
2337 /*----------------------------------------------------------------------*/
2338 align = apr_pstrdup(doc->buf.pool, val);
2349 return chtml20->out;
2354 * It is a handler who processes the DIV tag.
2356 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2357 * destination is specified.
2358 * @param node [i] The DIV tag node is specified.
2359 * @return The conversion result is returned.
2362 s_chtml20_end_div_tag(void *pdoc, Node *UNUSED(child))
2368 chtml20 = GET_CHTML20(pdoc);
2372 W20_L("</div>\r\n");
2373 return chtml20->out;
2378 * It is a handler who processes the H1 tag.
2380 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2381 * destination is specified.
2382 * @param node [i] The H1 tag node is specified.
2383 * @return The conversion result is returned.
2386 s_chtml20_start_h1_tag(void *pdoc, Node *UNUSED(node))
2392 chtml20 = GET_CHTML20(pdoc);
2397 return chtml20->out;
2402 * It is a handler who processes the H1 tag.
2404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2405 * destination is specified.
2406 * @param node [i] The H1 tag node is specified.
2407 * @return The conversion result is returned.
2410 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
2416 chtml20 = GET_CHTML20(pdoc);
2421 return chtml20->out;
2426 * It is a handler who processes the H2 tag.
2428 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2429 * destination is specified.
2430 * @param node [i] The H2 tag node is specified.
2431 * @return The conversion result is returned.
2434 s_chtml20_start_h2_tag(void *pdoc, Node *UNUSED(node))
2440 chtml20 = GET_CHTML20(pdoc);
2445 return chtml20->out;
2450 * It is a handler who processes the H2 tag.
2452 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2453 * destination is specified.
2454 * @param node [i] The H2 tag node is specified.
2455 * @return The conversion result is returned.
2458 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
2464 chtml20 = GET_CHTML20(pdoc);
2469 return chtml20->out;
2474 * It is a handler who processes the H3 tag.
2476 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2477 * destination is specified.
2478 * @param node [i] The H3 tag node is specified.
2479 * @return The conversion result is returned.
2482 s_chtml20_start_h3_tag(void *pdoc, Node *UNUSED(node))
2488 chtml20 = GET_CHTML20(pdoc);
2493 return chtml20->out;
2498 * It is a handler who processes the H3 tag.
2500 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2501 * destination is specified.
2502 * @param node [i] The H3 tag node is specified.
2503 * @return The conversion result is returned.
2506 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
2512 chtml20 = GET_CHTML20(pdoc);
2517 return chtml20->out;
2522 * It is a handler who processes the H4 tag.
2524 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2525 * destination is specified.
2526 * @param node [i] The H4 tag node is specified.
2527 * @return The conversion result is returned.
2530 s_chtml20_start_h4_tag(void *pdoc, Node *UNUSED(node))
2536 chtml20 = GET_CHTML20(pdoc);
2541 return chtml20->out;
2546 * It is a handler who processes the H4 tag.
2548 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2549 * destination is specified.
2550 * @param node [i] The H4 tag node is specified.
2551 * @return The conversion result is returned.
2554 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
2560 chtml20 = GET_CHTML20(pdoc);
2565 return chtml20->out;
2570 * It is a handler who processes the H5 tag.
2572 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2573 * destination is specified.
2574 * @param node [i] The H5 tag node is specified.
2575 * @return The conversion result is returned.
2578 s_chtml20_start_h5_tag(void *pdoc, Node *UNUSED(node))
2584 chtml20 = GET_CHTML20(pdoc);
2589 return chtml20->out;
2594 * It is a handler who processes the H5 tag.
2596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2597 * destination is specified.
2598 * @param node [i] The H5 tag node is specified.
2599 * @return The conversion result is returned.
2602 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
2608 chtml20 = GET_CHTML20(pdoc);
2613 return chtml20->out;
2618 * It is a handler who processes the H6 tag.
2620 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2621 * destination is specified.
2622 * @param node [i] The H6 tag node is specified.
2623 * @return The conversion result is returned.
2626 s_chtml20_start_h6_tag(void *pdoc, Node *UNUSED(node))
2632 chtml20 = GET_CHTML20(pdoc);
2637 return chtml20->out;
2642 * It is a handler who processes the H6 tag.
2644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2645 * destination is specified.
2646 * @param node [i] The H6 tag node is specified.
2647 * @return The conversion result is returned.
2650 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
2656 chtml20 = GET_CHTML20(pdoc);
2661 return chtml20->out;
2666 * It is a handler who processes the PRE tag.
2668 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2669 * destination is specified.
2670 * @param node [i] The PRE tag node is specified.
2671 * @return The conversion result is returned.
2674 s_chtml20_start_pre_tag(void *pdoc, Node *UNUSED(node))
2680 chtml20 = GET_CHTML20(pdoc);
2684 chtml20->pre_flag++;
2686 return chtml20->out;
2691 * It is a handler who processes the PRE tag.
2693 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2694 * destination is specified.
2695 * @param node [i] The PRE tag node is specified.
2696 * @return The conversion result is returned.
2699 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
2705 chtml20 = GET_CHTML20(pdoc);
2710 chtml20->pre_flag--;
2712 return chtml20->out;
2717 * It is a handler who processes the P tag.
2719 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2720 * destination is specified.
2721 * @param node [i] The P tag node is specified.
2722 * @return The conversion result is returned.
2725 s_chtml20_start_p_tag(void *pdoc, Node *UNUSED(node))
2731 chtml20 = GET_CHTML20(pdoc);
2736 return chtml20->out;
2741 * It is a handler who processes the P tag.
2743 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2744 * destination is specified.
2745 * @param node [i] The P tag node is specified.
2746 * @return The conversion result is returned.
2749 s_chtml20_end_p_tag(void *pdoc, Node *UNUSED(child))
2755 chtml20 = GET_CHTML20(pdoc);
2760 return chtml20->out;
2765 s_chtml20_chxjif_tag(void *pdoc, Node *node)
2772 chtml20 = GET_CHTML20(pdoc);
2776 for (child = qs_get_child_node(doc, node);
2778 child = qs_get_next_node(doc, child)) {
2780 W20_V(child->otext);
2781 s_chtml20_chxjif_tag(pdoc, child);
2789 * It is a handler who processes the TEXTARE tag.
2791 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2792 * destination is specified.
2793 * @param node [i] The TEXTAREA tag node is specified.
2794 * @return The conversion result is returned.
2797 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
2804 chtml20 = GET_CHTML20(pdoc);
2808 chtml20->textarea_flag++;
2809 W20_L("<textarea ");
2810 for (attr = qs_get_attr(doc,node);
2812 attr = qs_get_next_attr(doc,attr)) {
2817 name = qs_get_attr_name(doc,attr);
2818 value = qs_get_attr_value(doc,attr);
2823 if (strcasecmp(name, "name") == 0) {
2832 if (strcasecmp(name, "rows") == 0) {
2841 if (strcasecmp(name, "cols") == 0) {
2853 return chtml20->out;
2858 * It is a handler who processes the TEXTAREA tag.
2860 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2861 * destination is specified.
2862 * @param node [i] The TEXTAREA tag node is specified.
2863 * @return The conversion result is returned.
2866 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2872 chtml20 = GET_CHTML20(pdoc);
2876 W20_L("</textarea>\r\n");
2877 chtml20->textarea_flag--;
2879 return chtml20->out;
2884 s_chtml20_text_tag(void *pdoc, Node *child)
2896 chtml20 = GET_CHTML20(pdoc);
2900 textval = qs_get_node_value(doc,child);
2901 textval = qs_trim_string(chtml20->doc->r, textval);
2902 if (strlen(textval) == 0)
2903 return chtml20->out;
2905 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2906 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2908 tdst = qs_alloc_zero_byte_string(r);
2909 memset(one_byte, 0, sizeof(one_byte));
2912 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2914 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
2916 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2920 if (is_sjis_kanji(textval[ii])) {
2921 one_byte[0] = textval[ii+0];
2922 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2923 one_byte[0] = textval[ii+1];
2924 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2928 if (chtml20->pre_flag) {
2929 one_byte[0] = textval[ii+0];
2930 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2933 if (chtml20->textarea_flag) {
2934 one_byte[0] = textval[ii+0];
2935 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2938 if (textval[ii] != '\r' && textval[ii] != '\n') {
2939 one_byte[0] = textval[ii+0];
2940 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2944 return chtml20->out;