2 * Copyright (C) 2005-2011 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_chtml10.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_cookie.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_conv_z2h.h"
29 #define GET_CHTML10(X) ((chtml10_t *)(X))
32 #define W_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml10->conf); W_V(nlcode); } while (0)
39 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
40 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
41 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
42 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
43 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
44 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
45 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
46 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
47 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
48 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
49 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
50 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
51 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
52 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
53 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
54 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
55 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
56 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
57 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
58 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
59 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
60 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
61 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
62 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
63 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
64 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
65 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
66 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
67 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
68 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
69 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
70 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
71 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
72 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
73 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
74 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
75 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
76 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
77 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
78 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
79 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
80 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
81 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
82 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
83 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
84 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
85 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
86 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
87 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
88 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
89 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
90 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
91 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
92 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
93 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
94 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
95 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
96 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
97 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
98 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
99 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
100 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
101 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
102 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
103 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
104 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
105 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
106 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
107 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
108 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
109 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
110 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
111 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
112 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
113 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
114 static char *s_chtml10_newline_mark (void *pdoc, Node *node);
116 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
118 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
119 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
120 static char *s_chtml10_text (void *pdoc, Node *node);
122 tag_handler chtml10_handler[] = {
125 s_chtml10_start_html_tag,
126 s_chtml10_end_html_tag,
130 s_chtml10_start_meta_tag,
131 s_chtml10_end_meta_tag,
135 s_chtml10_start_textarea_tag,
136 s_chtml10_end_textarea_tag,
140 s_chtml10_start_p_tag,
145 s_chtml10_start_pre_tag,
146 s_chtml10_end_pre_tag,
150 s_chtml10_start_ul_tag,
151 s_chtml10_end_ul_tag,
155 s_chtml10_start_li_tag,
156 s_chtml10_end_li_tag,
160 s_chtml10_start_ol_tag,
161 s_chtml10_end_ol_tag,
165 s_chtml10_start_h1_tag,
166 s_chtml10_end_h1_tag,
170 s_chtml10_start_h2_tag,
171 s_chtml10_end_h2_tag,
175 s_chtml10_start_h3_tag,
176 s_chtml10_end_h3_tag,
180 s_chtml10_start_h4_tag,
181 s_chtml10_end_h4_tag,
185 s_chtml10_start_h5_tag,
186 s_chtml10_end_h5_tag,
190 s_chtml10_start_h6_tag,
191 s_chtml10_end_h6_tag,
195 s_chtml10_start_head_tag,
196 s_chtml10_end_head_tag,
200 s_chtml10_start_title_tag,
201 s_chtml10_end_title_tag,
205 s_chtml10_start_base_tag,
206 s_chtml10_end_base_tag,
210 s_chtml10_start_body_tag,
211 s_chtml10_end_body_tag,
215 s_chtml10_start_a_tag,
220 s_chtml10_start_br_tag,
221 s_chtml10_end_br_tag,
230 s_chtml10_start_tr_tag,
231 s_chtml10_end_tr_tag,
245 s_chtml10_start_font_tag,
246 s_chtml10_end_font_tag,
250 s_chtml10_start_form_tag,
251 s_chtml10_end_form_tag,
255 s_chtml10_start_input_tag,
256 s_chtml10_end_input_tag,
260 s_chtml10_start_center_tag,
261 s_chtml10_end_center_tag,
265 s_chtml10_start_hr_tag,
266 s_chtml10_end_hr_tag,
270 s_chtml10_start_img_tag,
271 s_chtml10_end_img_tag,
275 s_chtml10_start_select_tag,
276 s_chtml10_end_select_tag,
280 s_chtml10_start_option_tag,
281 s_chtml10_end_option_tag,
285 s_chtml10_start_div_tag,
286 s_chtml10_end_div_tag,
290 s_chtml10_chxjif_tag,
295 s_chtml10_chxjif_tag,
340 s_chtml10_start_dt_tag,
341 s_chtml10_end_dt_tag,
355 s_chtml10_start_blockquote_tag,
356 s_chtml10_end_blockquote_tag,
360 s_chtml10_start_dir_tag,
361 s_chtml10_end_dir_tag,
365 s_chtml10_start_dl_tag,
366 s_chtml10_end_dl_tag,
370 s_chtml10_start_dd_tag,
371 s_chtml10_end_dd_tag,
375 s_chtml10_start_menu_tag,
376 s_chtml10_end_menu_tag,
380 s_chtml10_start_plaintext_tag,
381 s_chtml10_end_plaintext_tag,
395 s_chtml10_newline_mark,
402 * converts from CHTML5.0 to CHTML1.0.
404 * @param r [i] Requet_rec is appointed.
405 * @param spec [i] The result of the device specification processing which
406 * was done in advance is appointed.
407 * @param src [i] The character string before the converting is appointed.
408 * @return The character string after the converting is returned.
411 chxj_convert_chtml10(
417 chxjconvrule_entry *entryp,
430 DBG(r, "REQ[%X] start %s() cookie_id=[%s]", TO_ADDR(r),__func__, (cookie) ? cookie->cookie_id : "");
432 /*--------------------------------------------------------------------------*/
434 /*--------------------------------------------------------------------------*/
436 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
438 DBG(r, "REQ[%X] found qrcode xml", TO_ADDR(r));
439 DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
442 DBG(r,"REQ[%X] not found qrcode xml", TO_ADDR(r));
444 /*--------------------------------------------------------------------------*/
445 /* The CHTML structure is initialized. */
446 /*--------------------------------------------------------------------------*/
447 s_init_chtml10(&chtml10, &doc, r, spec);
448 chtml10.entryp = entryp;
449 chtml10.cookie = cookie;
451 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
453 /*--------------------------------------------------------------------------*/
454 /* The character string of the input is analyzed. */
455 /*--------------------------------------------------------------------------*/
456 qs_init_malloc(&doc);
457 qs_init_root_node(&doc);
459 ss = apr_pcalloc(r->pool, srclen + 1);
460 memset(ss, 0, srclen + 1);
461 memcpy(ss, src, srclen);
464 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
467 qs_parse_string(&doc,ss, strlen(ss));
469 chxj_buffered_write_init(r->pool, &doc.buf);
470 /*--------------------------------------------------------------------------*/
471 /* It converts it from CHTML to CHTML. */
472 /*--------------------------------------------------------------------------*/
473 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
474 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
475 dst = apr_pstrdup(r->pool, chtml10.out);
476 chxj_buffered_write_terminate(&doc.buf);
478 qs_all_free(&doc,QX_LOGMARK);
481 DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
482 return apr_pstrdup(r->pool,ss);
485 if (strlen(dst) == 0) {
486 dst = apr_psprintf(r->pool, "\n");
488 *dstlen = strlen(dst);
491 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
494 DBG(r, "REQ[%X] cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", TO_ADDR(r),(cookie) ? cookie->cookie_id : "", apr_time_now() - t);
495 DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
502 * The CHTML structure is initialized.
504 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
505 * initialized is specified.
506 * @param doc [i] The Doc structure that should be set to the initialized
507 * HDML structure is specified.
508 * @param r [i] To use POOL, the pointer to request_rec is specified.
509 * @param spec [i] The pointer to the device_table
518 memset(doc, 0, sizeof(Doc));
519 memset(chtml10, 0, sizeof(chtml10_t));
523 chtml10->spec = spec;
524 chtml10->out = qs_alloc_zero_byte_string(r->pool);
525 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
526 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
531 * Corresponding EMOJI to a current character-code is retrieved.
532 * The substitution character string is stored in the rslt pointer if agreeing.
534 * @param chtml10 [i] The pointer to the CHTML structure is specified.
535 * @param txt [i] The character string to want to examine whether it is
536 * EMOJI is specified.
537 * @param rslt [o] The pointer to the pointer that stores the result is
539 * @return When corresponding EMOJI exists, it returns it excluding 0.
542 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
549 spec = chtml10->spec;
555 DBG(r,"REQ[%X] spec is NULL", TO_ADDR(r));
558 for (ee = chtml10->conf->emoji;
563 DBG(r,"REQ[%X] emoji->imode is NULL", TO_ADDR(r));
567 if (ee->imode->string
569 && strlen(ee->imode->string) > 0
570 && *ee->imode->string == *txt
571 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
572 *rslt = apr_palloc(r->pool, 3);
573 (*rslt)[0] = ee->imode->hex1byte & 0xff;
574 (*rslt)[1] = ee->imode->hex2byte & 0xff;
576 return strlen(ee->imode->string);
583 chxj_chtml10_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
594 chtml10 = &__chtml10;
597 DBG(r, "REQ[%X] start %s()", TO_ADDR(r),__func__);
598 memset(doc, 0, sizeof(Doc));
599 memset(chtml10, 0, sizeof(chtml10_t));
603 chtml10->spec = spec;
604 chtml10->out = qs_alloc_zero_byte_string(r->pool);
605 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
606 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
608 apr_pool_create(&pool, r->pool);
610 chxj_buffered_write_init(pool, &doc->buf);
612 for (ii=0; ii<len; ii++) {
616 rtn = s_chtml10_search_emoji(chtml10, (char *)&src[ii], &out);
623 if (is_sjis_kanji(src[ii])) {
624 two_byte[0] = src[ii+0];
625 two_byte[1] = src[ii+1];
631 one_byte[0] = src[ii+0];
637 chtml10->out = chxj_buffered_write_flush(chtml10->out, &doc->buf);
639 DBG(r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
645 * It is a handler who processes the HTML tag.
647 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
648 * destination is specified.
649 * @param node [i] The HTML tag node is specified.
650 * @return The conversion result is returned.
653 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
659 chtml10 = GET_CHTML10(pdoc);
663 /*--------------------------------------------------------------------------*/
665 /*--------------------------------------------------------------------------*/
672 * It is a handler who processes the HTML tag.
674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
675 * destination is specified.
676 * @param node [i] The HTML tag node is specified.
677 * @return The conversion result is returned.
680 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
687 chtml10 = GET_CHTML10(pdoc);
697 * It is a handler who processes the META tag.
699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
700 * destination is specified.
701 * @param node [i] The META tag node is specified.
702 * @return The conversion result is returned.
705 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
707 chtml10_t *chtml10 = GET_CHTML10(pdoc);
716 * It is a handler who processes the META tag.
718 * @param pdoc [i/o] The pointer to the CHTML structure at the output
719 * destination is specified.
720 * @param node [i] The META tag node is specified.
721 * @return The conversion result is returned.
724 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
726 chtml10_t *chtml10 = GET_CHTML10(pdoc);
733 * It is a handler who processes the HEAD tag.
735 * @param pdoc [i/o] The pointer to the CHTML structure at the output
736 * destination is specified.
737 * @param node [i] The HEAD tag node is specified.
738 * @return The conversion result is returned.
741 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
747 chtml10 = GET_CHTML10(pdoc);
758 * It is a handler who processes the HEAD tag.
760 * @param pdoc [i/o] The pointer to the CHTML structure at the output
761 * destination is specified.
762 * @param node [i] The HEAD tag node is specified.
763 * @return The conversion result is returned.
766 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
772 chtml10 = GET_CHTML10(pdoc);
783 * It is a handler who processes the OL tag.
785 * @param pdoc [i/o] The pointer to the CHTML structure at the output
786 * destination is specified.
787 * @param node [i] The OL tag node is specified.
788 * @return The conversion result is returned.
791 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
797 chtml10 = GET_CHTML10(pdoc);
808 * It is a handler who processes the OL tag.
810 * @param pdoc [i/o] The pointer to the CHTML structure at the output
811 * destination is specified.
812 * @param node [i] The OL tag node is specified.
813 * @return The conversion result is returned.
816 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
822 chtml10 = GET_CHTML10(pdoc);
833 * It is a handler who processes the UL tag.
835 * @param pdoc [i/o] The pointer to the CHTML structure at the output
836 * destination is specified.
837 * @param node [i] The UL tag node is specified.
838 * @return The conversion result is returned.
841 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
847 chtml10 = GET_CHTML10(pdoc);
858 * It is a handler who processes the UL tag.
860 * @param pdoc [i/o] The pointer to the CHTML structure at the output
861 * destination is specified.
862 * @param node [i] The UL tag node is specified.
863 * @return The conversion result is returned.
866 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
872 chtml10 = GET_CHTML10(pdoc);
883 * It is a handler who processes the LI tag.
885 * @param pdoc [i/o] The pointer to the CHTML structure at the output
886 * destination is specified.
887 * @param node [i] The LI tag node is specified.
888 * @return The conversion result is returned.
891 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
897 chtml10 = GET_CHTML10(pdoc);
908 * It is a handler who processes the LI tag.
910 * @param pdoc [i/o] The pointer to the CHTML structure at the output
911 * destination is specified.
912 * @param node [i] The LI tag node is specified.
913 * @return The conversion result is returned.
916 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
918 chtml10_t *chtml10 = GET_CHTML10(pdoc);
924 * It is a handler who processes the H1 tag.
926 * @param pdoc [i/o] The pointer to the CHTML structure at the output
927 * destination is specified.
928 * @param node [i] The H1 tag node is specified.
929 * @return The conversion result is returned.
932 s_chtml10_start_h1_tag(void *pdoc, Node *node)
939 chtml10 = GET_CHTML10(pdoc);
944 for (attr = qs_get_attr(doc,node);
946 attr = qs_get_next_attr(doc,attr)) {
947 char *name = qs_get_attr_name(doc,attr);
948 char *value = qs_get_attr_value(doc,attr);
949 if (STRCASEEQ('a','A',"align", name)) {
950 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
965 * It is a handler who processes the H1 tag.
967 * @param pdoc [i/o] The pointer to the CHTML structure at the output
968 * destination is specified.
969 * @param node [i] The H1 tag node is specified.
970 * @return The conversion result is returned.
973 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
979 chtml10 = GET_CHTML10(pdoc);
990 * It is a handler who processes the H2 tag.
992 * @param pdoc [i/o] The pointer to the CHTML structure at the output
993 * destination is specified.
994 * @param node [i] The H2 tag node is specified.
995 * @return The conversion result is returned.
998 s_chtml10_start_h2_tag(void *pdoc, Node *node)
1004 chtml10 = GET_CHTML10(pdoc);
1008 for (attr = qs_get_attr(doc,node);
1010 attr = qs_get_next_attr(doc,attr)) {
1011 char *name = qs_get_attr_name(doc,attr);
1012 char *value = qs_get_attr_value(doc,attr);
1013 if (STRCASEEQ('a','A',"align", name)) {
1014 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1024 return chtml10->out;
1029 * It is a handler who processes the H2 tag.
1031 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1032 * destination is specified.
1033 * @param node [i] The H2 tag node is specified.
1034 * @return The conversion result is returned.
1037 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
1043 chtml10 = GET_CHTML10(pdoc);
1049 return chtml10->out;
1054 * It is a handler who processes the H3 tag.
1056 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1057 * destination is specified.
1058 * @param node [i] The H3 tag node is specified.
1059 * @return The conversion result is returned.
1062 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1069 chtml10 = GET_CHTML10(pdoc);
1074 for (attr = qs_get_attr(doc,node);
1076 attr = qs_get_next_attr(doc,attr)) {
1077 char *name = qs_get_attr_name(doc,attr);
1078 char *value = qs_get_attr_value(doc,attr);
1079 if (STRCASEEQ('a','A',"align", name)) {
1080 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1090 return chtml10->out;
1095 * It is a handler who processes the H3 tag.
1097 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1098 * destination is specified.
1099 * @param node [i] The H3 tag node is specified.
1100 * @return The conversion result is returned.
1103 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1109 chtml10 = GET_CHTML10(pdoc);
1115 return chtml10->out;
1120 * It is a handler who processes the H4 tag.
1122 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1123 * destination is specified.
1124 * @param node [i] The H4 tag node is specified.
1125 * @return The conversion result is returned.
1128 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1134 chtml10 = GET_CHTML10(pdoc);
1138 for (attr = qs_get_attr(doc,node);
1140 attr = qs_get_next_attr(doc,attr)) {
1141 char *name = qs_get_attr_name(doc,attr);
1142 char *value = qs_get_attr_value(doc,attr);
1143 if (STRCASEEQ('a','A',"align", name)) {
1144 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1154 return chtml10->out;
1159 * It is a handler who processes the H4 tag.
1161 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1162 * destination is specified.
1163 * @param node [i] The H4 tag node is specified.
1164 * @return The conversion result is returned.
1167 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1172 chtml10 = GET_CHTML10(pdoc);
1177 return chtml10->out;
1182 * It is a handler who processes the H5 tag.
1184 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1185 * destination is specified.
1186 * @param node [i] The H5 tag node is specified.
1187 * @return The conversion result is returned.
1190 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1197 chtml10 = GET_CHTML10(pdoc);
1202 for (attr = qs_get_attr(doc,node);
1204 attr = qs_get_next_attr(doc,attr)) {
1205 char *name = qs_get_attr_name(doc,attr);
1206 char *value = qs_get_attr_value(doc,attr);
1207 if (STRCASEEQ('a','A',"align", name)) {
1208 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1218 return chtml10->out;
1223 * It is a handler who processes the H5 tag.
1225 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1226 * destination is specified.
1227 * @param node [i] The H5 tag node is specified.
1228 * @return The conversion result is returned.
1231 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1236 chtml10 = GET_CHTML10(pdoc);
1241 return chtml10->out;
1246 * It is a handler who processes the H6 tag.
1248 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1249 * destination is specified.
1250 * @param node [i] The H6 tag node is specified.
1251 * @return The conversion result is returned.
1254 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1260 chtml10 = GET_CHTML10(pdoc);
1264 for (attr = qs_get_attr(doc,node);
1266 attr = qs_get_next_attr(doc,attr)) {
1267 char *name = qs_get_attr_name(doc,attr);
1268 char *value = qs_get_attr_value(doc,attr);
1269 if (STRCASEEQ('a','A',"align", name)) {
1270 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1280 return chtml10->out;
1285 * It is a handler who processes the H6 tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The H6 tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1298 chtml10 = GET_CHTML10(pdoc);
1303 return chtml10->out;
1308 * It is a handler who processes the TITLE tag.
1310 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1311 * destination is specified.
1312 * @param node [i] The TITLE tag node is specified.
1313 * @return The conversion result is returned.
1316 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1321 chtml10 = GET_CHTML10(pdoc);
1326 return chtml10->out;
1331 * It is a handler who processes the TITLE tag.
1333 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1334 * destination is specified.
1335 * @param node [i] The TITLE tag node is specified.
1336 * @return The conversion result is returned.
1339 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1344 chtml10 = GET_CHTML10(pdoc);
1349 return chtml10->out;
1354 * It is a handler who processes the BASE tag.
1356 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1357 * destination is specified.
1358 * @param node [i] The BASE tag node is specified.
1359 * @return The conversion result is returned.
1362 s_chtml10_start_base_tag(void *pdoc, Node *node)
1368 chtml10 = GET_CHTML10(pdoc);
1372 /*--------------------------------------------------------------------------*/
1373 /* Get Attributes */
1374 /*--------------------------------------------------------------------------*/
1375 for (attr = qs_get_attr(doc,node);
1377 attr = qs_get_next_attr(doc,attr)) {
1378 char *name = qs_get_attr_name(doc,attr);
1379 char *value = qs_get_attr_value(doc,attr);
1380 if (STRCASEEQ('h','H',"href", name)) {
1389 return chtml10->out;
1394 * It is a handler who processes the BASE tag.
1396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1397 * destination is specified.
1398 * @param node [i] The BASE tag node is specified.
1399 * @return The conversion result is returned.
1402 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1404 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1406 return chtml10->out;
1411 * It is a handler who processes the BODY tag.
1413 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1414 * destination is specified.
1415 * @param node [i] The BODY tag node is specified.
1416 * @return The conversion result is returned.
1419 s_chtml10_start_body_tag(void *pdoc, Node *node)
1425 chtml10 = GET_CHTML10(pdoc);
1429 /*--------------------------------------------------------------------------*/
1430 /* Get Attributes */
1431 /*--------------------------------------------------------------------------*/
1432 for (attr = qs_get_attr(doc,node);
1434 attr = qs_get_next_attr(doc,attr)) {
1435 char *name = qs_get_attr_name(doc,attr);
1439 if (strcasecmp(name, "alink") == 0) {
1440 /*----------------------------------------------------------------------*/
1442 /*----------------------------------------------------------------------*/
1449 if (strcasecmp(name, "bgcolor") == 0) {
1450 /*----------------------------------------------------------------------*/
1452 /*----------------------------------------------------------------------*/
1459 if (strcasecmp(name, "text") == 0) {
1460 /*----------------------------------------------------------------------*/
1462 /*----------------------------------------------------------------------*/
1469 if (strcasecmp(name, "link") == 0) {
1470 /*----------------------------------------------------------------------*/
1472 /*----------------------------------------------------------------------*/
1479 if (strcasecmp(name, "vlink") == 0) {
1480 /*----------------------------------------------------------------------*/
1482 /*----------------------------------------------------------------------*/
1494 return chtml10->out;
1499 * It is a handler who processes the BODY tag.
1501 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1502 * destination is specified.
1503 * @param node [i] The BODY tag node is specified.
1504 * @return The conversion result is returned.
1507 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1512 chtml10 = GET_CHTML10(pdoc);
1517 return chtml10->out;
1522 * It is a handler who processes the A tag.
1524 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1525 * destination is specified.
1526 * @param node [i] The A tag node is specified.
1527 * @return The conversion result is returned.
1530 s_chtml10_start_a_tag(void *pdoc, Node *node)
1537 chtml10 = GET_CHTML10(pdoc);
1543 /*--------------------------------------------------------------------------*/
1544 /* Get Attributes */
1545 /*--------------------------------------------------------------------------*/
1546 for (attr = qs_get_attr(doc,node);
1548 attr = qs_get_next_attr(doc,attr)) {
1549 char *name = qs_get_attr_name(doc,attr);
1550 char *value = qs_get_attr_value(doc,attr);
1554 if (strcasecmp(name, "name") == 0) {
1555 /*--------------------------------------------------------------------*/
1557 /*--------------------------------------------------------------------*/
1566 if (strcasecmp(name, "href") == 0) {
1567 /*--------------------------------------------------------------------*/
1569 /*--------------------------------------------------------------------*/
1570 value = chxj_encoding_parameter(r, value);
1571 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1572 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1582 if (strcasecmp(name, "accesskey") == 0) {
1583 /*--------------------------------------------------------------------*/
1585 /*--------------------------------------------------------------------*/
1586 W_L(" accesskey=\"");
1594 if (strcasecmp(name, "cti") == 0) {
1595 /*--------------------------------------------------------------------*/
1597 /*--------------------------------------------------------------------*/
1604 if (strcasecmp(name, "utn") == 0) {
1605 /*--------------------------------------------------------------------*/
1607 /*--------------------------------------------------------------------*/
1614 if (strcasecmp(name, "telbook") == 0) {
1615 /*--------------------------------------------------------------------*/
1617 /*--------------------------------------------------------------------*/
1624 if (strcasecmp(name, "kana") == 0) {
1625 /*--------------------------------------------------------------------*/
1627 /*--------------------------------------------------------------------*/
1634 if (strcasecmp(name, "email") == 0) {
1635 /*--------------------------------------------------------------------*/
1637 /*--------------------------------------------------------------------*/
1644 if (strcasecmp(name, "ista") == 0) {
1645 /*--------------------------------------------------------------------*/
1647 /*--------------------------------------------------------------------*/
1651 if (strcasecmp(name, "ilet") == 0) {
1652 /*--------------------------------------------------------------------*/
1654 /*--------------------------------------------------------------------*/
1658 if (strcasecmp(name, "iswf") == 0) {
1659 /*--------------------------------------------------------------------*/
1661 /*--------------------------------------------------------------------*/
1665 if (strcasecmp(name, "irst") == 0) {
1666 /*--------------------------------------------------------------------*/
1668 /*--------------------------------------------------------------------*/
1672 if (strcasecmp(name, "ijam") == 0) {
1673 /*--------------------------------------------------------------------*/
1675 /*--------------------------------------------------------------------*/
1686 return chtml10->out;
1691 * It is a handler who processes the A tag.
1693 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1694 * destination is specified.
1695 * @param node [i] The A tag node is specified.
1696 * @return The conversion result is returned.
1699 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1705 chtml10 = GET_CHTML10(pdoc);
1711 return chtml10->out;
1716 * It is a handler who processes the BR tag.
1718 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1719 * destination is specified.
1720 * @param node [i] The BR tag node is specified.
1721 * @return The conversion result is returned.
1724 s_chtml10_start_br_tag(void *pdoc, Node *node)
1731 chtml10 = GET_CHTML10(pdoc);
1737 /*--------------------------------------------------------------------------*/
1738 /* Get Attributes */
1739 /*--------------------------------------------------------------------------*/
1740 for (attr = qs_get_attr(doc,node);
1742 attr = qs_get_next_attr(doc,attr)) {
1743 char *name = qs_get_attr_name(doc,attr);
1744 char *value = qs_get_attr_value(doc,attr);
1745 if (STRCASEEQ('c','C',"clear",name)) {
1746 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1755 return chtml10->out;
1760 * It is a handler who processes the BR tag.
1762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1763 * destination is specified.
1764 * @param node [i] The BR tag node is specified.
1765 * @return The conversion result is returned.
1768 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1770 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1772 return chtml10->out;
1777 * It is a handler who processes the TR tag.
1779 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1780 * destination is specified.
1781 * @param node [i] The TR tag node is specified.
1782 * @return The conversion result is returned.
1785 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1787 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1789 return chtml10->out;
1794 * It is a handler who processes the TR tag.
1796 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1797 * destination is specified.
1798 * @param node [i] The TR tag node is specified.
1799 * @return The conversion result is returned.
1802 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1808 chtml10 = GET_CHTML10(pdoc);
1814 return chtml10->out;
1819 * It is a handler who processes the FONT tag.
1821 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1822 * destination is specified.
1823 * @param node [i] The FONT tag node is specified.
1824 * @return The conversion result is returned.
1827 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1829 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1833 return chtml10->out;
1838 * It is a handler who processes the FONT tag.
1840 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1841 * destination is specified.
1842 * @param node [i] The FONT tag node is specified.
1843 * @return The conversion result is returned.
1846 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1848 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1852 return chtml10->out;
1857 * It is a handler who processes the FORM tag.
1859 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1860 * destination is specified.
1861 * @param node [i] The FORM tag node is specified.
1862 * @return The conversion result is returned.
1865 s_chtml10_start_form_tag(void *pdoc, Node *node)
1871 char *new_hidden_tag = NULL;
1872 char *attr_value = NULL;
1873 char *attr_method = NULL;
1875 chtml10 = GET_CHTML10(pdoc);
1880 /*--------------------------------------------------------------------------*/
1881 /* Get Attributes */
1882 /*--------------------------------------------------------------------------*/
1883 for (attr = qs_get_attr(doc,node);
1885 attr = qs_get_next_attr(doc,attr)) {
1886 char *name = qs_get_attr_name(doc,attr);
1887 char *value = qs_get_attr_value(doc,attr);
1891 if (strcasecmp(name, "action") == 0) {
1892 /*--------------------------------------------------------------------*/
1894 /*--------------------------------------------------------------------*/
1895 attr_value = chxj_encoding_parameter(r, value);
1896 attr_value = chxj_add_cookie_parameter(r, attr_value, chtml10->cookie);
1902 if (strcasecmp(name, "method") == 0) {
1903 /*--------------------------------------------------------------------*/
1905 /*--------------------------------------------------------------------*/
1906 attr_method = apr_pstrdup(doc->pool, value);
1912 if (strcasecmp(name, "utn") == 0) {
1913 /*--------------------------------------------------------------------*/
1915 /*--------------------------------------------------------------------*/
1925 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1930 char *new_query_string = NULL;
1931 q = strchr(attr_value, '?');
1933 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_value, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml10->entryp);
1934 if (new_hidden_tag || new_query_string) {
1940 if (new_query_string) {
1942 W_V(new_query_string);
1952 if (new_hidden_tag) {
1953 W_V(new_hidden_tag);
1956 return chtml10->out;
1961 * It is a handler who processes the FORM tag.
1963 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1964 * destination is specified.
1965 * @param node [i] The FORM tag node is specified.
1966 * @return The conversion result is returned.
1969 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1975 chtml10 = GET_CHTML10(pdoc);
1981 return chtml10->out;
1986 * It is a handler who processes the INPUT tag.
1988 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1989 * destination is specified.
1990 * @param node [i] The INPUT tag node is specified.
1991 * @return The conversion result is returned.
1994 s_chtml10_start_input_tag(void *pdoc, Node *node)
2008 chtml10 = GET_CHTML10(pdoc);
2023 /*--------------------------------------------------------------------------*/
2024 /* Get Attributes */
2025 /*--------------------------------------------------------------------------*/
2027 type = qs_get_type_attr(doc, node, doc->buf.pool);
2028 name = qs_get_name_attr(doc, node, doc->buf.pool);
2029 value = qs_get_value_attr(doc,node,doc->buf.pool);
2030 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2031 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2032 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2033 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2034 size = qs_get_size_attr(doc, node, doc->buf.pool);
2037 type = qs_trim_string(doc->buf.pool, type);
2038 if (type && (STRCASEEQ('t','T',"text", type) ||
2039 STRCASEEQ('p','P',"password",type) ||
2040 STRCASEEQ('c','C',"checkbox",type) ||
2041 STRCASEEQ('r','R',"radio", type) ||
2042 STRCASEEQ('h','H',"hidden", type) ||
2043 STRCASEEQ('s','S',"submit", type) ||
2044 STRCASEEQ('r','R',"reset", type))) {
2051 if (size && *size != 0) {
2057 if (name && *name != 0) {
2063 if (value && *value != 0) {
2064 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2065 apr_size_t value_len = strlen(value);
2066 value = chxj_conv_z2h(r, value, &value_len, chtml10->entryp);
2070 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2074 if (accesskey && *accesskey != 0) {
2075 W_L(" accesskey=\"");
2081 /*------------------------------------------------------------------------*/
2083 /*------------------------------------------------------------------------*/
2086 /*--------------------------------------------------------------------------*/
2087 /* The figure is default for the password. */
2088 /*--------------------------------------------------------------------------*/
2089 if (max_length && *max_length != 0) {
2090 W_L(" maxlength=\"");
2100 return chtml10->out;
2105 * It is a handler who processes the INPUT tag.
2107 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2108 * destination is specified.
2109 * @param node [i] The INPUT tag node is specified.
2110 * @return The conversion result is returned.
2113 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2115 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2117 return chtml10->out;
2122 * It is a handler who processes the CENTER tag.
2124 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2125 * destination is specified.
2126 * @param node [i] The CENTER tag node is specified.
2127 * @return The conversion result is returned.
2130 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2136 chtml10 = GET_CHTML10(pdoc);
2142 return chtml10->out;
2147 * It is a handler who processes the CENTER tag.
2149 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2150 * destination is specified.
2151 * @param node [i] The CENTER tag node is specified.
2152 * @return The conversion result is returned.
2155 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2161 chtml10 = GET_CHTML10(pdoc);
2167 return chtml10->out;
2172 * It is a handler who processes the HR tag.
2174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2175 * destination is specified.
2176 * @param node [i] The HR tag node is specified.
2177 * @return The conversion result is returned.
2180 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2187 chtml10 = GET_CHTML10(pdoc);
2193 for (attr = qs_get_attr(doc,node);
2195 attr = qs_get_next_attr(doc,attr)) {
2196 char *name = qs_get_attr_name (doc,attr);
2197 char *value = qs_get_attr_value(doc,attr);
2201 if (strcasecmp(name, "align") == 0) {
2202 /*--------------------------------------------------------------------*/
2204 /*--------------------------------------------------------------------*/
2205 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2215 if (strcasecmp(name, "size") == 0) {
2216 /*--------------------------------------------------------------------*/
2218 /*--------------------------------------------------------------------*/
2219 if (value && value[0] != '\0') {
2229 if (strcasecmp(name, "width") == 0) {
2230 /*--------------------------------------------------------------------*/
2232 /*--------------------------------------------------------------------*/
2233 if (value && value[0] != '\0') {
2243 if (strcasecmp(name, "noshade") == 0) {
2244 /*--------------------------------------------------------------------*/
2246 /*--------------------------------------------------------------------*/
2253 if (strcasecmp(name, "color") == 0) {
2254 /*--------------------------------------------------------------------*/
2256 /*--------------------------------------------------------------------*/
2266 return chtml10->out;
2271 * It is a handler who processes the HR tag.
2273 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2274 * destination is specified.
2275 * @param node [i] The HR tag node is specified.
2276 * @return The conversion result is returned.
2279 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2281 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2284 return chtml10->out;
2289 * It is a handler who processes the IMG tag.
2291 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2292 * destination is specified.
2293 * @param node [i] The IMG tag node is specified.
2294 * @return The conversion result is returned.
2297 s_chtml10_start_img_tag(void *pdoc, Node *node)
2303 #ifndef IMG_NOT_CONVERT_FILENAME
2307 chtml10 = GET_CHTML10(pdoc);
2308 #ifndef IMG_NOT_CONVERT_FILENAME
2309 spec = chtml10->spec;
2315 /*--------------------------------------------------------------------------*/
2316 /* Get Attributes */
2317 /*--------------------------------------------------------------------------*/
2318 for (attr = qs_get_attr(doc,node);
2320 attr = qs_get_next_attr(doc,attr)) {
2321 char *name = qs_get_attr_name (doc,attr);
2322 char *value = qs_get_attr_value(doc,attr);
2326 if (strcasecmp(name, "src") == 0) {
2327 /*--------------------------------------------------------------------*/
2329 /*--------------------------------------------------------------------*/
2330 #ifdef IMG_NOT_CONVERT_FILENAME
2331 value = chxj_encoding_parameter(r, value);
2332 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2333 value = chxj_add_cookie_no_update_parameter(r, value);
2338 value = chxj_img_conv(r, spec, value);
2339 value = chxj_encoding_parameter(r, value);
2340 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2341 value = chxj_add_cookie_no_update_parameter(r, value);
2351 if (strcasecmp(name, "align" ) == 0) {
2352 /*--------------------------------------------------------------------*/
2354 /*--------------------------------------------------------------------*/
2355 /*--------------------------------------------------------------------*/
2357 /*--------------------------------------------------------------------*/
2359 if (STRCASEEQ('t','T',"top", value) ||
2360 STRCASEEQ('m','M',"middle",value) ||
2361 STRCASEEQ('b','B',"bottom",value) ||
2362 STRCASEEQ('l','L',"left", value) ||
2363 STRCASEEQ('r','R',"right", value)) {
2368 else if (STRCASEEQ('c','C',"center", value)) {
2375 else if (strcasecmp(name, "alt" ) == 0) {
2376 /*--------------------------------------------------------------------*/
2378 /*--------------------------------------------------------------------*/
2379 if (value && value[0] != '\0') {
2389 if (strcasecmp(name, "width" ) == 0) {
2390 /*--------------------------------------------------------------------*/
2392 /*--------------------------------------------------------------------*/
2393 if (value && value[0] != '\0') {
2403 if (strcasecmp(name, "height") == 0) {
2404 /*--------------------------------------------------------------------*/
2406 /*--------------------------------------------------------------------*/
2407 if (value && value[0] != '\0') {
2414 if (strcasecmp(name, "hspace") == 0) {
2415 /*--------------------------------------------------------------------*/
2417 /*--------------------------------------------------------------------*/
2418 if (value && value[0] != '\0') {
2428 if (strcasecmp(name, "vspace") == 0) {
2429 /*--------------------------------------------------------------------*/
2431 /*--------------------------------------------------------------------*/
2432 if (value && value[0] != '\0') {
2446 return chtml10->out;
2451 * It is a handler who processes the IMG tag.
2453 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2454 * destination is specified.
2455 * @param node [i] The IMG tag node is specified.
2456 * @return The conversion result is returned.
2459 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2461 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2463 return chtml10->out;
2468 * It is a handler who processes the SELECT tag.
2470 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2471 * destination is specified.
2472 * @param node [i] The SELECT tag node is specified.
2473 * @return The conversion result is returned.
2476 s_chtml10_start_select_tag(void *pdoc, Node *child)
2486 chtml10 = GET_CHTML10(pdoc);
2494 for (attr = qs_get_attr(doc,child);
2496 attr = qs_get_next_attr(doc,attr)) {
2497 char *nm = qs_get_attr_name (doc,attr);
2498 char *val = qs_get_attr_value(doc,attr);
2502 if (strcasecmp(nm, "size") == 0) {
2503 /*--------------------------------------------------------------------*/
2504 /* CHTML 1.0 version 2.0 */
2505 /*--------------------------------------------------------------------*/
2506 size = apr_pstrdup(doc->buf.pool, val);
2512 if (strcasecmp(nm, "name") == 0) {
2513 /*--------------------------------------------------------------------*/
2514 /* CHTML 1.0 version 2.0 */
2515 /*--------------------------------------------------------------------*/
2516 name = apr_pstrdup(doc->buf.pool, val);
2522 if (strcasecmp(nm, "multiple") == 0) {
2523 /*--------------------------------------------------------------------*/
2524 /* CHTML 1.0 version 2.0 */
2525 /*--------------------------------------------------------------------*/
2535 if (size && *size != 0) {
2541 if (name && *name != 0) {
2548 return chtml10->out;
2553 * It is a handler who processes the SELECT tag.
2555 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2556 * destination is specified.
2557 * @param node [i] The SELECT tag node is specified.
2558 * @return The conversion result is returned.
2561 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2567 chtml10 = GET_CHTML10(pdoc);
2572 return chtml10->out;
2577 * It is a handler who processes the OPTION tag.
2579 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2580 * destination is specified.
2581 * @param node [i] The OPTION tag node is specified.
2582 * @return The conversion result is returned.
2585 s_chtml10_start_option_tag(void *pdoc, Node *child)
2594 chtml10 = GET_CHTML10(pdoc);
2603 for (attr = qs_get_attr(doc,child);
2605 attr = qs_get_next_attr(doc,attr)) {
2606 char *nm = qs_get_attr_name (doc,attr);
2607 char *val = qs_get_attr_value(doc,attr);
2611 if (strcasecmp(nm, "selected") == 0) {
2612 /*--------------------------------------------------------------------*/
2613 /* CHTML 1.0 version 2.0 */
2614 /*--------------------------------------------------------------------*/
2615 selected = apr_pstrdup(doc->buf.pool, val);
2621 if (strcasecmp(nm, "value") == 0) {
2622 /*--------------------------------------------------------------------*/
2623 /* CHTML 1.0 version 2.0 */
2624 /*--------------------------------------------------------------------*/
2625 value = apr_pstrdup(doc->buf.pool, val);
2645 return chtml10->out;
2650 * It is a handler who processes the OPTION tag.
2652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2653 * destination is specified.
2654 * @param node [i] The OPTION tag node is specified.
2655 * @return The conversion result is returned.
2658 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2660 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2664 return chtml10->out;
2669 * It is a handler who processes the DIV tag.
2671 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2672 * destination is specified.
2673 * @param node [i] The DIV tag node is specified.
2674 * @return The conversion result is returned.
2677 s_chtml10_start_div_tag(void *pdoc, Node *child)
2685 chtml10 = GET_CHTML10(pdoc);
2692 for (attr = qs_get_attr(doc,child);
2694 attr = qs_get_next_attr(doc,attr)) {
2695 char *nm = qs_get_attr_name(doc,attr);
2696 char *val = qs_get_attr_value(doc,attr);
2697 if (STRCASEEQ('a','A',"align", nm)) {
2698 /*----------------------------------------------------------------------*/
2699 /* CHTML 1.0 (W3C version 3.2) */
2700 /*----------------------------------------------------------------------*/
2701 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2702 align = apr_pstrdup(doc->buf.pool, val);
2714 return chtml10->out;
2719 * It is a handler who processes the DIV tag.
2721 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2722 * destination is specified.
2723 * @param node [i] The DIV tag node is specified.
2724 * @return The conversion result is returned.
2727 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2733 chtml10 = GET_CHTML10(pdoc);
2738 return chtml10->out;
2743 * It is a handler who processes the CHXJ:IF tag.
2745 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2746 * destination is specified.
2747 * @param node [i] The CHXJ:IF tag node is specified.
2748 * @return The conversion result is returned.
2751 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2758 chtml10 = GET_CHTML10(pdoc);
2762 for (child = qs_get_child_node(doc, node);
2764 child = qs_get_next_node(doc, child)) {
2766 s_chtml10_chxjif_tag(chtml10, child);
2769 return chtml10->out;
2774 * It is a handler who processes the PRE tag.
2776 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2777 * destination is specified.
2778 * @param node [i] The PRE tag node is specified.
2779 * @return The conversion result is returned.
2782 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2788 chtml10 = GET_CHTML10(pdoc);
2792 chtml10->pre_flag++;
2794 return chtml10->out;
2799 * It is a handler who processes the PRE tag.
2801 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2802 * destination is specified.
2803 * @param node [i] The PRE tag node is specified.
2804 * @return The conversion result is returned.
2807 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2813 chtml10 = GET_CHTML10(pdoc);
2818 chtml10->pre_flag--;
2820 return chtml10->out;
2825 * It is a handler who processes the P tag.
2827 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2828 * destination is specified.
2829 * @param node [i] The P tag node is specified.
2830 * @return The conversion result is returned.
2833 s_chtml10_start_p_tag(void *pdoc, Node *node)
2841 chtml10 = GET_CHTML10(pdoc);
2846 for (attr = qs_get_attr(doc,node);
2848 attr = qs_get_next_attr(doc,attr)) {
2849 char *nm = qs_get_attr_name(doc,attr);
2850 char *val = qs_get_attr_value(doc,attr);
2851 if (STRCASEEQ('a','A',"align", nm)) {
2852 /*----------------------------------------------------------------------*/
2853 /* CHTML 1.0 (W3C version 3.2) */
2854 /*----------------------------------------------------------------------*/
2855 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2856 align = apr_pstrdup(doc->buf.pool, val);
2868 return chtml10->out;
2873 * It is a handler who processes the P tag.
2875 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2876 * destination is specified.
2877 * @param node [i] The P tag node is specified.
2878 * @return The conversion result is returned.
2881 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2887 chtml10 = GET_CHTML10(pdoc);
2892 return chtml10->out;
2897 * It is a handler who processes the TEXTARE tag.
2899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2900 * destination is specified.
2901 * @param node [i] The TEXTAREA tag node is specified.
2902 * @return The conversion result is returned.
2905 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2912 chtml10 = GET_CHTML10(pdoc);
2917 chtml10->textarea_flag++;
2921 for (attr = qs_get_attr(doc,node);
2923 attr = qs_get_next_attr(doc,attr)) {
2924 char *name = qs_get_attr_name (doc,attr);
2925 char *value = qs_get_attr_value(doc,attr);
2929 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2930 W_L(" accesskey=\"");
2938 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2947 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2956 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2968 return chtml10->out;
2973 * It is a handler who processes the TEXTAREA tag.
2975 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2976 * destination is specified.
2977 * @param node [i] The TEXTAREA tag node is specified.
2978 * @return The conversion result is returned.
2981 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2987 chtml10 = GET_CHTML10(pdoc);
2992 chtml10->textarea_flag--;
2994 return chtml10->out;
2999 s_chtml10_text(void *pdoc, Node *child)
3010 apr_size_t z2h_input_len;
3012 chtml10 = GET_CHTML10(pdoc);
3016 textval = qs_get_node_value(doc,child);
3017 if (strlen(textval) == 0) {
3018 return chtml10->out;
3021 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3022 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3024 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3025 memset(one_byte, 0, sizeof(one_byte));
3028 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3032 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
3034 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3039 if (is_sjis_kanji(textval[ii])) {
3040 one_byte[0] = textval[ii+0];
3041 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3042 one_byte[0] = textval[ii+1];
3043 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3047 if (chtml10->pre_flag) {
3048 one_byte[0] = textval[ii+0];
3049 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3052 if (chtml10->textarea_flag) {
3053 one_byte[0] = textval[ii+0];
3054 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3057 if (textval[ii] != '\r' && textval[ii] != '\n') {
3058 one_byte[0] = textval[ii+0];
3059 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3063 z2h_input_len = strlen(tdst);
3064 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml10->entryp);
3067 return chtml10->out;
3072 * It is a handler who processes the BLOCKQUOTE tag.
3074 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3075 * destination is specified.
3076 * @param node [i] The BLOCKQUOTE tag node is specified.
3077 * @return The conversion result is returned.
3080 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3084 chtml10 = GET_CHTML10(pdoc);
3086 W_L("<blockquote>");
3087 return chtml10->out;
3092 * It is a handler who processes the BLOCKQUOTE tag.
3094 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3095 * destination is specified.
3096 * @param node [i] The BLOCKQUOTE tag node is specified.
3097 * @return The conversion result is returned.
3100 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3105 chtml10 = GET_CHTML10(pdoc);
3107 W_L("</blockquote>");
3108 return chtml10->out;
3113 * It is a handler who processes the DIR tag.
3115 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3116 * destination is specified.
3117 * @param node [i] The DIR tag node is specified.
3118 * @return The conversion result is returned.
3121 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3125 chtml10 = GET_CHTML10(pdoc);
3128 return chtml10->out;
3133 * It is a handler who processes the DIR tag.
3135 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3136 * destination is specified.
3137 * @param node [i] The DIR tag node is specified.
3138 * @return The conversion result is returned.
3141 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3146 chtml10 = GET_CHTML10(pdoc);
3149 return chtml10->out;
3154 * It is a handler who processes the DL tag.
3156 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3157 * destination is specified.
3158 * @param node [i] The DL tag node is specified.
3159 * @return The conversion result is returned.
3162 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3166 chtml10 = GET_CHTML10(pdoc);
3169 return chtml10->out;
3174 * It is a handler who processes the DL tag.
3176 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3177 * destination is specified.
3178 * @param node [i] The DL tag node is specified.
3179 * @return The conversion result is returned.
3182 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3186 chtml10 = GET_CHTML10(pdoc);
3189 return chtml10->out;
3194 * It is a handter who processes the DT tag.
3196 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3197 * destination is specified.
3198 * @param node [i] The DT tag node is specified.
3199 * @return The conversion result is returned.
3202 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3206 chtml10 = GET_CHTML10(pdoc);
3209 return chtml10->out;
3214 * It is a handter who processes the DT tag.
3216 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3217 * destination is specified.
3218 * @param node [i] The DT tag node is specified.
3219 * @return The conversion result is returned.
3222 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3224 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3226 return chtml10->out;
3231 * It is a handder who processes the DD tag.
3233 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3234 * destination is specified.
3235 * @param node [i] The DD tag node is specified.
3236 * @return The conversion result is returned.
3239 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3243 chtml10 = GET_CHTML10(pdoc);
3246 return chtml10->out;
3251 * It is a handder who processes the DD tag.
3253 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3254 * destination is specified.
3255 * @param node [i] The DD tag node is specified.
3256 * @return The conversion result is returned.
3259 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3261 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3262 return chtml10->out;
3267 * It is a hanmenuer who processes the MENU tag.
3269 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3270 * destination is specified.
3271 * @param node [i] The MENU tag node is specified.
3272 * @return The conversion result is returned.
3275 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3279 chtml10 = GET_CHTML10(pdoc);
3282 return chtml10->out;
3287 * It is a hanmenuer who processes the MENU tag.
3289 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3290 * destination is specified.
3291 * @param node [i] The MENU tag node is specified.
3292 * @return The conversion result is returned.
3295 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3297 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3298 Doc *doc = chtml10->doc;
3300 return chtml10->out;
3305 * It is a handler who processes the PLAINTEXT tag.
3307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3308 * destination is specified.
3309 * @param node [i] The PLAINTEXT tag node is specified.
3310 * @return The conversion result is returned.
3313 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3318 chtml10 = GET_CHTML10(pdoc);
3321 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3322 return chtml10->out;
3326 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3331 chtml10 = GET_CHTML10(pdoc);
3333 for (child = qs_get_child_node(doc, node);
3335 child = qs_get_next_node(doc, child)) {
3337 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3339 return chtml10->out;
3344 * It is a handler who processes the PLAINTEXT tag.
3346 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3347 * destination is specified.
3348 * @param node [i] The PLAINTEXT tag node is specified.
3349 * @return The conversion result is returned.
3352 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3354 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3355 return chtml10->out;
3360 * It is handler who processes the New Line Code.
3363 s_chtml10_newline_mark(void *pdoc, Node *UNUSED(node))
3365 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3366 Doc *doc = chtml10->doc;
3368 return chtml10->out;