2 * Copyright (C) 2005-2009 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, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
432 /*--------------------------------------------------------------------------*/
434 /*--------------------------------------------------------------------------*/
436 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
438 DBG(r,"i found qrcode xml");
441 DBG(r,"not found qrcode xml");
443 /*--------------------------------------------------------------------------*/
444 /* The CHTML structure is initialized. */
445 /*--------------------------------------------------------------------------*/
446 s_init_chtml10(&chtml10, &doc, r, spec);
447 chtml10.entryp = entryp;
448 chtml10.cookie = cookie;
450 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
452 /*--------------------------------------------------------------------------*/
453 /* The character string of the input is analyzed. */
454 /*--------------------------------------------------------------------------*/
455 qs_init_malloc(&doc);
456 qs_init_root_node(&doc);
458 ss = apr_pcalloc(r->pool, srclen + 1);
459 memset(ss, 0, srclen + 1);
460 memcpy(ss, src, srclen);
463 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
466 qs_parse_string(&doc,ss, strlen(ss));
468 chxj_buffered_write_init(r->pool, &doc.buf);
469 /*--------------------------------------------------------------------------*/
470 /* It converts it from CHTML to CHTML. */
471 /*--------------------------------------------------------------------------*/
472 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
473 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
474 dst = apr_pstrdup(r->pool, chtml10.out);
475 chxj_buffered_write_terminate(&doc.buf);
477 qs_all_free(&doc,QX_LOGMARK);
480 return apr_pstrdup(r->pool,ss);
483 if (strlen(dst) == 0) {
484 dst = apr_psprintf(r->pool, "\n");
486 *dstlen = strlen(dst);
489 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
492 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
499 * The CHTML structure is initialized.
501 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
502 * initialized is specified.
503 * @param doc [i] The Doc structure that should be set to the initialized
504 * HDML structure is specified.
505 * @param r [i] To use POOL, the pointer to request_rec is specified.
506 * @param spec [i] The pointer to the device_table
515 memset(doc, 0, sizeof(Doc));
516 memset(chtml10, 0, sizeof(chtml10_t));
520 chtml10->spec = spec;
521 chtml10->out = qs_alloc_zero_byte_string(r->pool);
522 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
523 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
528 * Corresponding EMOJI to a current character-code is retrieved.
529 * The substitution character string is stored in the rslt pointer if agreeing.
531 * @param chtml10 [i] The pointer to the CHTML structure is specified.
532 * @param txt [i] The character string to want to examine whether it is
533 * EMOJI is specified.
534 * @param rslt [o] The pointer to the pointer that stores the result is
536 * @return When corresponding EMOJI exists, it returns it excluding 0.
539 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
546 spec = chtml10->spec;
552 DBG(r,"spec is NULL");
555 for (ee = chtml10->conf->emoji;
560 DBG(r,"emoji->imode is NULL");
564 if (ee->imode->string
566 && strlen(ee->imode->string) > 0
567 && *ee->imode->string == *txt
568 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
569 *rslt = apr_palloc(r->pool, 3);
570 (*rslt)[0] = ee->imode->hex1byte & 0xff;
571 (*rslt)[1] = ee->imode->hex2byte & 0xff;
573 return strlen(ee->imode->string);
580 chxj_chtml10_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
591 chtml10 = &__chtml10;
594 DBG(r, "REQ[%X] start chxj_chtml10_emoji_only_converter()", (unsigned int)(apr_size_t)r);
595 memset(doc, 0, sizeof(Doc));
596 memset(chtml10, 0, sizeof(chtml10_t));
600 chtml10->spec = spec;
601 chtml10->out = qs_alloc_zero_byte_string(r->pool);
602 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
603 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
605 apr_pool_create(&pool, r->pool);
607 chxj_buffered_write_init(pool, &doc->buf);
609 for (ii=0; ii<len; ii++) {
613 rtn = s_chtml10_search_emoji(chtml10, (char *)&src[ii], &out);
620 if (is_sjis_kanji(src[ii])) {
621 two_byte[0] = src[ii+0];
622 two_byte[1] = src[ii+1];
628 one_byte[0] = src[ii+0];
634 chtml10->out = chxj_buffered_write_flush(chtml10->out, &doc->buf);
636 DBG(r, "REQ[%X] end chxj_chtml10_emoji_only_converter()", (unsigned int)(apr_size_t)r);
642 * It is a handler who processes the HTML tag.
644 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
645 * destination is specified.
646 * @param node [i] The HTML tag node is specified.
647 * @return The conversion result is returned.
650 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
656 chtml10 = GET_CHTML10(pdoc);
660 /*--------------------------------------------------------------------------*/
662 /*--------------------------------------------------------------------------*/
669 * It is a handler who processes the HTML tag.
671 * @param pdoc [i/o] The pointer to the CHTML structure at the output
672 * destination is specified.
673 * @param node [i] The HTML tag node is specified.
674 * @return The conversion result is returned.
677 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
684 chtml10 = GET_CHTML10(pdoc);
694 * It is a handler who processes the META tag.
696 * @param pdoc [i/o] The pointer to the CHTML structure at the output
697 * destination is specified.
698 * @param node [i] The META tag node is specified.
699 * @return The conversion result is returned.
702 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
704 chtml10_t *chtml10 = GET_CHTML10(pdoc);
713 * It is a handler who processes the META tag.
715 * @param pdoc [i/o] The pointer to the CHTML structure at the output
716 * destination is specified.
717 * @param node [i] The META tag node is specified.
718 * @return The conversion result is returned.
721 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
723 chtml10_t *chtml10 = GET_CHTML10(pdoc);
730 * It is a handler who processes the HEAD tag.
732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
733 * destination is specified.
734 * @param node [i] The HEAD tag node is specified.
735 * @return The conversion result is returned.
738 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
744 chtml10 = GET_CHTML10(pdoc);
755 * It is a handler who processes the HEAD tag.
757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
758 * destination is specified.
759 * @param node [i] The HEAD tag node is specified.
760 * @return The conversion result is returned.
763 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
769 chtml10 = GET_CHTML10(pdoc);
780 * It is a handler who processes the OL tag.
782 * @param pdoc [i/o] The pointer to the CHTML structure at the output
783 * destination is specified.
784 * @param node [i] The OL tag node is specified.
785 * @return The conversion result is returned.
788 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
794 chtml10 = GET_CHTML10(pdoc);
805 * It is a handler who processes the OL tag.
807 * @param pdoc [i/o] The pointer to the CHTML structure at the output
808 * destination is specified.
809 * @param node [i] The OL tag node is specified.
810 * @return The conversion result is returned.
813 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
819 chtml10 = GET_CHTML10(pdoc);
830 * It is a handler who processes the UL tag.
832 * @param pdoc [i/o] The pointer to the CHTML structure at the output
833 * destination is specified.
834 * @param node [i] The UL tag node is specified.
835 * @return The conversion result is returned.
838 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
844 chtml10 = GET_CHTML10(pdoc);
855 * It is a handler who processes the UL tag.
857 * @param pdoc [i/o] The pointer to the CHTML structure at the output
858 * destination is specified.
859 * @param node [i] The UL tag node is specified.
860 * @return The conversion result is returned.
863 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
869 chtml10 = GET_CHTML10(pdoc);
880 * It is a handler who processes the LI tag.
882 * @param pdoc [i/o] The pointer to the CHTML structure at the output
883 * destination is specified.
884 * @param node [i] The LI tag node is specified.
885 * @return The conversion result is returned.
888 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
894 chtml10 = GET_CHTML10(pdoc);
905 * It is a handler who processes the LI tag.
907 * @param pdoc [i/o] The pointer to the CHTML structure at the output
908 * destination is specified.
909 * @param node [i] The LI tag node is specified.
910 * @return The conversion result is returned.
913 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
915 chtml10_t *chtml10 = GET_CHTML10(pdoc);
921 * It is a handler who processes the H1 tag.
923 * @param pdoc [i/o] The pointer to the CHTML structure at the output
924 * destination is specified.
925 * @param node [i] The H1 tag node is specified.
926 * @return The conversion result is returned.
929 s_chtml10_start_h1_tag(void *pdoc, Node *node)
936 chtml10 = GET_CHTML10(pdoc);
941 for (attr = qs_get_attr(doc,node);
943 attr = qs_get_next_attr(doc,attr)) {
944 char *name = qs_get_attr_name(doc,attr);
945 char *value = qs_get_attr_value(doc,attr);
946 if (STRCASEEQ('a','A',"align", name)) {
947 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
962 * It is a handler who processes the H1 tag.
964 * @param pdoc [i/o] The pointer to the CHTML structure at the output
965 * destination is specified.
966 * @param node [i] The H1 tag node is specified.
967 * @return The conversion result is returned.
970 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
976 chtml10 = GET_CHTML10(pdoc);
987 * It is a handler who processes the H2 tag.
989 * @param pdoc [i/o] The pointer to the CHTML structure at the output
990 * destination is specified.
991 * @param node [i] The H2 tag node is specified.
992 * @return The conversion result is returned.
995 s_chtml10_start_h2_tag(void *pdoc, Node *node)
1001 chtml10 = GET_CHTML10(pdoc);
1005 for (attr = qs_get_attr(doc,node);
1007 attr = qs_get_next_attr(doc,attr)) {
1008 char *name = qs_get_attr_name(doc,attr);
1009 char *value = qs_get_attr_value(doc,attr);
1010 if (STRCASEEQ('a','A',"align", name)) {
1011 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1021 return chtml10->out;
1026 * It is a handler who processes the H2 tag.
1028 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1029 * destination is specified.
1030 * @param node [i] The H2 tag node is specified.
1031 * @return The conversion result is returned.
1034 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
1040 chtml10 = GET_CHTML10(pdoc);
1046 return chtml10->out;
1051 * It is a handler who processes the H3 tag.
1053 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1054 * destination is specified.
1055 * @param node [i] The H3 tag node is specified.
1056 * @return The conversion result is returned.
1059 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1066 chtml10 = GET_CHTML10(pdoc);
1071 for (attr = qs_get_attr(doc,node);
1073 attr = qs_get_next_attr(doc,attr)) {
1074 char *name = qs_get_attr_name(doc,attr);
1075 char *value = qs_get_attr_value(doc,attr);
1076 if (STRCASEEQ('a','A',"align", name)) {
1077 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1087 return chtml10->out;
1092 * It is a handler who processes the H3 tag.
1094 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1095 * destination is specified.
1096 * @param node [i] The H3 tag node is specified.
1097 * @return The conversion result is returned.
1100 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1106 chtml10 = GET_CHTML10(pdoc);
1112 return chtml10->out;
1117 * It is a handler who processes the H4 tag.
1119 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1120 * destination is specified.
1121 * @param node [i] The H4 tag node is specified.
1122 * @return The conversion result is returned.
1125 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1131 chtml10 = GET_CHTML10(pdoc);
1135 for (attr = qs_get_attr(doc,node);
1137 attr = qs_get_next_attr(doc,attr)) {
1138 char *name = qs_get_attr_name(doc,attr);
1139 char *value = qs_get_attr_value(doc,attr);
1140 if (STRCASEEQ('a','A',"align", name)) {
1141 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1151 return chtml10->out;
1156 * It is a handler who processes the H4 tag.
1158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1159 * destination is specified.
1160 * @param node [i] The H4 tag node is specified.
1161 * @return The conversion result is returned.
1164 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1169 chtml10 = GET_CHTML10(pdoc);
1174 return chtml10->out;
1179 * It is a handler who processes the H5 tag.
1181 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1182 * destination is specified.
1183 * @param node [i] The H5 tag node is specified.
1184 * @return The conversion result is returned.
1187 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1194 chtml10 = GET_CHTML10(pdoc);
1199 for (attr = qs_get_attr(doc,node);
1201 attr = qs_get_next_attr(doc,attr)) {
1202 char *name = qs_get_attr_name(doc,attr);
1203 char *value = qs_get_attr_value(doc,attr);
1204 if (STRCASEEQ('a','A',"align", name)) {
1205 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1215 return chtml10->out;
1220 * It is a handler who processes the H5 tag.
1222 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1223 * destination is specified.
1224 * @param node [i] The H5 tag node is specified.
1225 * @return The conversion result is returned.
1228 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1233 chtml10 = GET_CHTML10(pdoc);
1238 return chtml10->out;
1243 * It is a handler who processes the H6 tag.
1245 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1246 * destination is specified.
1247 * @param node [i] The H6 tag node is specified.
1248 * @return The conversion result is returned.
1251 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1257 chtml10 = GET_CHTML10(pdoc);
1261 for (attr = qs_get_attr(doc,node);
1263 attr = qs_get_next_attr(doc,attr)) {
1264 char *name = qs_get_attr_name(doc,attr);
1265 char *value = qs_get_attr_value(doc,attr);
1266 if (STRCASEEQ('a','A',"align", name)) {
1267 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1277 return chtml10->out;
1282 * It is a handler who processes the H6 tag.
1284 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1285 * destination is specified.
1286 * @param node [i] The H6 tag node is specified.
1287 * @return The conversion result is returned.
1290 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1295 chtml10 = GET_CHTML10(pdoc);
1300 return chtml10->out;
1305 * It is a handler who processes the TITLE tag.
1307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1308 * destination is specified.
1309 * @param node [i] The TITLE tag node is specified.
1310 * @return The conversion result is returned.
1313 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1318 chtml10 = GET_CHTML10(pdoc);
1323 return chtml10->out;
1328 * It is a handler who processes the TITLE tag.
1330 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1331 * destination is specified.
1332 * @param node [i] The TITLE tag node is specified.
1333 * @return The conversion result is returned.
1336 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1341 chtml10 = GET_CHTML10(pdoc);
1346 return chtml10->out;
1351 * It is a handler who processes the BASE tag.
1353 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1354 * destination is specified.
1355 * @param node [i] The BASE tag node is specified.
1356 * @return The conversion result is returned.
1359 s_chtml10_start_base_tag(void *pdoc, Node *node)
1365 chtml10 = GET_CHTML10(pdoc);
1369 /*--------------------------------------------------------------------------*/
1370 /* Get Attributes */
1371 /*--------------------------------------------------------------------------*/
1372 for (attr = qs_get_attr(doc,node);
1374 attr = qs_get_next_attr(doc,attr)) {
1375 char *name = qs_get_attr_name(doc,attr);
1376 char *value = qs_get_attr_value(doc,attr);
1377 if (STRCASEEQ('h','H',"href", name)) {
1386 return chtml10->out;
1391 * It is a handler who processes the BASE tag.
1393 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1394 * destination is specified.
1395 * @param node [i] The BASE tag node is specified.
1396 * @return The conversion result is returned.
1399 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1401 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1403 return chtml10->out;
1408 * It is a handler who processes the BODY tag.
1410 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1411 * destination is specified.
1412 * @param node [i] The BODY tag node is specified.
1413 * @return The conversion result is returned.
1416 s_chtml10_start_body_tag(void *pdoc, Node *node)
1422 chtml10 = GET_CHTML10(pdoc);
1426 /*--------------------------------------------------------------------------*/
1427 /* Get Attributes */
1428 /*--------------------------------------------------------------------------*/
1429 for (attr = qs_get_attr(doc,node);
1431 attr = qs_get_next_attr(doc,attr)) {
1432 char *name = qs_get_attr_name(doc,attr);
1436 if (strcasecmp(name, "alink") == 0) {
1437 /*----------------------------------------------------------------------*/
1439 /*----------------------------------------------------------------------*/
1446 if (strcasecmp(name, "bgcolor") == 0) {
1447 /*----------------------------------------------------------------------*/
1449 /*----------------------------------------------------------------------*/
1456 if (strcasecmp(name, "text") == 0) {
1457 /*----------------------------------------------------------------------*/
1459 /*----------------------------------------------------------------------*/
1466 if (strcasecmp(name, "link") == 0) {
1467 /*----------------------------------------------------------------------*/
1469 /*----------------------------------------------------------------------*/
1476 if (strcasecmp(name, "vlink") == 0) {
1477 /*----------------------------------------------------------------------*/
1479 /*----------------------------------------------------------------------*/
1491 return chtml10->out;
1496 * It is a handler who processes the BODY tag.
1498 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1499 * destination is specified.
1500 * @param node [i] The BODY tag node is specified.
1501 * @return The conversion result is returned.
1504 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1509 chtml10 = GET_CHTML10(pdoc);
1514 return chtml10->out;
1519 * It is a handler who processes the A tag.
1521 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1522 * destination is specified.
1523 * @param node [i] The A tag node is specified.
1524 * @return The conversion result is returned.
1527 s_chtml10_start_a_tag(void *pdoc, Node *node)
1534 chtml10 = GET_CHTML10(pdoc);
1540 /*--------------------------------------------------------------------------*/
1541 /* Get Attributes */
1542 /*--------------------------------------------------------------------------*/
1543 for (attr = qs_get_attr(doc,node);
1545 attr = qs_get_next_attr(doc,attr)) {
1546 char *name = qs_get_attr_name(doc,attr);
1547 char *value = qs_get_attr_value(doc,attr);
1551 if (strcasecmp(name, "name") == 0) {
1552 /*--------------------------------------------------------------------*/
1554 /*--------------------------------------------------------------------*/
1563 if (strcasecmp(name, "href") == 0) {
1564 /*--------------------------------------------------------------------*/
1566 /*--------------------------------------------------------------------*/
1567 value = chxj_encoding_parameter(r, value);
1568 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1569 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1579 if (strcasecmp(name, "accesskey") == 0) {
1580 /*--------------------------------------------------------------------*/
1582 /*--------------------------------------------------------------------*/
1583 W_L(" accesskey=\"");
1591 if (strcasecmp(name, "cti") == 0) {
1592 /*--------------------------------------------------------------------*/
1594 /*--------------------------------------------------------------------*/
1601 if (strcasecmp(name, "utn") == 0) {
1602 /*--------------------------------------------------------------------*/
1604 /*--------------------------------------------------------------------*/
1611 if (strcasecmp(name, "telbook") == 0) {
1612 /*--------------------------------------------------------------------*/
1614 /*--------------------------------------------------------------------*/
1621 if (strcasecmp(name, "kana") == 0) {
1622 /*--------------------------------------------------------------------*/
1624 /*--------------------------------------------------------------------*/
1631 if (strcasecmp(name, "email") == 0) {
1632 /*--------------------------------------------------------------------*/
1634 /*--------------------------------------------------------------------*/
1641 if (strcasecmp(name, "ista") == 0) {
1642 /*--------------------------------------------------------------------*/
1644 /*--------------------------------------------------------------------*/
1648 if (strcasecmp(name, "ilet") == 0) {
1649 /*--------------------------------------------------------------------*/
1651 /*--------------------------------------------------------------------*/
1655 if (strcasecmp(name, "iswf") == 0) {
1656 /*--------------------------------------------------------------------*/
1658 /*--------------------------------------------------------------------*/
1662 if (strcasecmp(name, "irst") == 0) {
1663 /*--------------------------------------------------------------------*/
1665 /*--------------------------------------------------------------------*/
1669 if (strcasecmp(name, "ijam") == 0) {
1670 /*--------------------------------------------------------------------*/
1672 /*--------------------------------------------------------------------*/
1683 return chtml10->out;
1688 * It is a handler who processes the A tag.
1690 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1691 * destination is specified.
1692 * @param node [i] The A tag node is specified.
1693 * @return The conversion result is returned.
1696 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1702 chtml10 = GET_CHTML10(pdoc);
1708 return chtml10->out;
1713 * It is a handler who processes the BR tag.
1715 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1716 * destination is specified.
1717 * @param node [i] The BR tag node is specified.
1718 * @return The conversion result is returned.
1721 s_chtml10_start_br_tag(void *pdoc, Node *node)
1728 chtml10 = GET_CHTML10(pdoc);
1734 /*--------------------------------------------------------------------------*/
1735 /* Get Attributes */
1736 /*--------------------------------------------------------------------------*/
1737 for (attr = qs_get_attr(doc,node);
1739 attr = qs_get_next_attr(doc,attr)) {
1740 char *name = qs_get_attr_name(doc,attr);
1741 char *value = qs_get_attr_value(doc,attr);
1742 if (STRCASEEQ('c','C',"clear",name)) {
1743 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1752 return chtml10->out;
1757 * It is a handler who processes the BR tag.
1759 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1760 * destination is specified.
1761 * @param node [i] The BR tag node is specified.
1762 * @return The conversion result is returned.
1765 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1767 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1769 return chtml10->out;
1774 * It is a handler who processes the TR tag.
1776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1777 * destination is specified.
1778 * @param node [i] The TR tag node is specified.
1779 * @return The conversion result is returned.
1782 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1784 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1786 return chtml10->out;
1791 * It is a handler who processes the TR tag.
1793 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1794 * destination is specified.
1795 * @param node [i] The TR tag node is specified.
1796 * @return The conversion result is returned.
1799 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1805 chtml10 = GET_CHTML10(pdoc);
1811 return chtml10->out;
1816 * It is a handler who processes the FONT tag.
1818 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1819 * destination is specified.
1820 * @param node [i] The FONT tag node is specified.
1821 * @return The conversion result is returned.
1824 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1826 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1830 return chtml10->out;
1835 * It is a handler who processes the FONT tag.
1837 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1838 * destination is specified.
1839 * @param node [i] The FONT tag node is specified.
1840 * @return The conversion result is returned.
1843 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1845 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1849 return chtml10->out;
1854 * It is a handler who processes the FORM tag.
1856 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1857 * destination is specified.
1858 * @param node [i] The FORM tag node is specified.
1859 * @return The conversion result is returned.
1862 s_chtml10_start_form_tag(void *pdoc, Node *node)
1868 char *new_hidden_tag = NULL;
1869 char *attr_value = NULL;
1870 char *attr_method = NULL;
1872 chtml10 = GET_CHTML10(pdoc);
1877 /*--------------------------------------------------------------------------*/
1878 /* Get Attributes */
1879 /*--------------------------------------------------------------------------*/
1880 for (attr = qs_get_attr(doc,node);
1882 attr = qs_get_next_attr(doc,attr)) {
1883 char *name = qs_get_attr_name(doc,attr);
1884 char *value = qs_get_attr_value(doc,attr);
1888 if (strcasecmp(name, "action") == 0) {
1889 /*--------------------------------------------------------------------*/
1891 /*--------------------------------------------------------------------*/
1892 attr_value = chxj_encoding_parameter(r, value);
1893 attr_value = chxj_add_cookie_parameter(r, attr_value, chtml10->cookie);
1899 if (strcasecmp(name, "method") == 0) {
1900 /*--------------------------------------------------------------------*/
1902 /*--------------------------------------------------------------------*/
1903 attr_method = apr_pstrdup(doc->pool, value);
1909 if (strcasecmp(name, "utn") == 0) {
1910 /*--------------------------------------------------------------------*/
1912 /*--------------------------------------------------------------------*/
1922 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1927 char *new_query_string = NULL;
1928 q = strchr(attr_value, '?');
1930 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);
1931 if (new_hidden_tag || new_query_string) {
1937 if (new_query_string) {
1939 W_V(new_query_string);
1949 if (new_hidden_tag) {
1950 W_V(new_hidden_tag);
1953 return chtml10->out;
1958 * It is a handler who processes the FORM tag.
1960 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1961 * destination is specified.
1962 * @param node [i] The FORM tag node is specified.
1963 * @return The conversion result is returned.
1966 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1972 chtml10 = GET_CHTML10(pdoc);
1978 return chtml10->out;
1983 * It is a handler who processes the INPUT tag.
1985 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1986 * destination is specified.
1987 * @param node [i] The INPUT tag node is specified.
1988 * @return The conversion result is returned.
1991 s_chtml10_start_input_tag(void *pdoc, Node *node)
2005 chtml10 = GET_CHTML10(pdoc);
2020 /*--------------------------------------------------------------------------*/
2021 /* Get Attributes */
2022 /*--------------------------------------------------------------------------*/
2024 type = qs_get_type_attr(doc, node, doc->buf.pool);
2025 name = qs_get_name_attr(doc, node, doc->buf.pool);
2026 value = qs_get_value_attr(doc,node,doc->buf.pool);
2027 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2028 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2029 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2030 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2031 size = qs_get_size_attr(doc, node, doc->buf.pool);
2034 type = qs_trim_string(doc->buf.pool, type);
2035 if (type && (STRCASEEQ('t','T',"text", type) ||
2036 STRCASEEQ('p','P',"password",type) ||
2037 STRCASEEQ('c','C',"checkbox",type) ||
2038 STRCASEEQ('r','R',"radio", type) ||
2039 STRCASEEQ('h','H',"hidden", type) ||
2040 STRCASEEQ('s','S',"submit", type) ||
2041 STRCASEEQ('r','R',"reset", type))) {
2048 if (size && *size != 0) {
2054 if (name && *name != 0) {
2060 if (value && *value != 0) {
2061 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2062 apr_size_t value_len = strlen(value);
2063 value = chxj_conv_z2h(r, value, &value_len, chtml10->entryp);
2067 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2071 if (accesskey && *accesskey != 0) {
2072 W_L(" accesskey=\"");
2078 /*------------------------------------------------------------------------*/
2080 /*------------------------------------------------------------------------*/
2083 /*--------------------------------------------------------------------------*/
2084 /* The figure is default for the password. */
2085 /*--------------------------------------------------------------------------*/
2086 if (max_length && *max_length != 0) {
2087 W_L(" maxlength=\"");
2097 return chtml10->out;
2102 * It is a handler who processes the INPUT tag.
2104 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2105 * destination is specified.
2106 * @param node [i] The INPUT tag node is specified.
2107 * @return The conversion result is returned.
2110 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2112 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2114 return chtml10->out;
2119 * It is a handler who processes the CENTER tag.
2121 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2122 * destination is specified.
2123 * @param node [i] The CENTER tag node is specified.
2124 * @return The conversion result is returned.
2127 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2133 chtml10 = GET_CHTML10(pdoc);
2139 return chtml10->out;
2144 * It is a handler who processes the CENTER tag.
2146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2147 * destination is specified.
2148 * @param node [i] The CENTER tag node is specified.
2149 * @return The conversion result is returned.
2152 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2158 chtml10 = GET_CHTML10(pdoc);
2164 return chtml10->out;
2169 * It is a handler who processes the HR tag.
2171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2172 * destination is specified.
2173 * @param node [i] The HR tag node is specified.
2174 * @return The conversion result is returned.
2177 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2184 chtml10 = GET_CHTML10(pdoc);
2190 for (attr = qs_get_attr(doc,node);
2192 attr = qs_get_next_attr(doc,attr)) {
2193 char *name = qs_get_attr_name (doc,attr);
2194 char *value = qs_get_attr_value(doc,attr);
2198 if (strcasecmp(name, "align") == 0) {
2199 /*--------------------------------------------------------------------*/
2201 /*--------------------------------------------------------------------*/
2202 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2212 if (strcasecmp(name, "size") == 0) {
2213 /*--------------------------------------------------------------------*/
2215 /*--------------------------------------------------------------------*/
2216 if (value && value[0] != '\0') {
2226 if (strcasecmp(name, "width") == 0) {
2227 /*--------------------------------------------------------------------*/
2229 /*--------------------------------------------------------------------*/
2230 if (value && value[0] != '\0') {
2240 if (strcasecmp(name, "noshade") == 0) {
2241 /*--------------------------------------------------------------------*/
2243 /*--------------------------------------------------------------------*/
2250 if (strcasecmp(name, "color") == 0) {
2251 /*--------------------------------------------------------------------*/
2253 /*--------------------------------------------------------------------*/
2263 return chtml10->out;
2268 * It is a handler who processes the HR tag.
2270 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2271 * destination is specified.
2272 * @param node [i] The HR tag node is specified.
2273 * @return The conversion result is returned.
2276 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2278 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2281 return chtml10->out;
2286 * It is a handler who processes the IMG tag.
2288 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2289 * destination is specified.
2290 * @param node [i] The IMG tag node is specified.
2291 * @return The conversion result is returned.
2294 s_chtml10_start_img_tag(void *pdoc, Node *node)
2300 #ifndef IMG_NOT_CONVERT_FILENAME
2304 chtml10 = GET_CHTML10(pdoc);
2305 #ifndef IMG_NOT_CONVERT_FILENAME
2306 spec = chtml10->spec;
2312 /*--------------------------------------------------------------------------*/
2313 /* Get Attributes */
2314 /*--------------------------------------------------------------------------*/
2315 for (attr = qs_get_attr(doc,node);
2317 attr = qs_get_next_attr(doc,attr)) {
2318 char *name = qs_get_attr_name (doc,attr);
2319 char *value = qs_get_attr_value(doc,attr);
2323 if (strcasecmp(name, "src") == 0) {
2324 /*--------------------------------------------------------------------*/
2326 /*--------------------------------------------------------------------*/
2327 #ifdef IMG_NOT_CONVERT_FILENAME
2328 value = chxj_encoding_parameter(r, value);
2329 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2330 value = chxj_add_cookie_no_update_parameter(r, value);
2335 value = chxj_img_conv(r, spec, value);
2336 value = chxj_encoding_parameter(r, value);
2337 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2338 value = chxj_add_cookie_no_update_parameter(r, value);
2348 if (strcasecmp(name, "align" ) == 0) {
2349 /*--------------------------------------------------------------------*/
2351 /*--------------------------------------------------------------------*/
2352 /*--------------------------------------------------------------------*/
2354 /*--------------------------------------------------------------------*/
2356 if (STRCASEEQ('t','T',"top", value) ||
2357 STRCASEEQ('m','M',"middle",value) ||
2358 STRCASEEQ('b','B',"bottom",value) ||
2359 STRCASEEQ('l','L',"left", value) ||
2360 STRCASEEQ('r','R',"right", value)) {
2365 else if (STRCASEEQ('c','C',"center", value)) {
2372 else if (strcasecmp(name, "alt" ) == 0) {
2373 /*--------------------------------------------------------------------*/
2375 /*--------------------------------------------------------------------*/
2376 if (value && value[0] != '\0') {
2386 if (strcasecmp(name, "width" ) == 0) {
2387 /*--------------------------------------------------------------------*/
2389 /*--------------------------------------------------------------------*/
2390 if (value && value[0] != '\0') {
2400 if (strcasecmp(name, "height") == 0) {
2401 /*--------------------------------------------------------------------*/
2403 /*--------------------------------------------------------------------*/
2404 if (value && value[0] != '\0') {
2411 if (strcasecmp(name, "hspace") == 0) {
2412 /*--------------------------------------------------------------------*/
2414 /*--------------------------------------------------------------------*/
2415 if (value && value[0] != '\0') {
2425 if (strcasecmp(name, "vspace") == 0) {
2426 /*--------------------------------------------------------------------*/
2428 /*--------------------------------------------------------------------*/
2429 if (value && value[0] != '\0') {
2443 return chtml10->out;
2448 * It is a handler who processes the IMG tag.
2450 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2451 * destination is specified.
2452 * @param node [i] The IMG tag node is specified.
2453 * @return The conversion result is returned.
2456 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2458 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2460 return chtml10->out;
2465 * It is a handler who processes the SELECT tag.
2467 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2468 * destination is specified.
2469 * @param node [i] The SELECT tag node is specified.
2470 * @return The conversion result is returned.
2473 s_chtml10_start_select_tag(void *pdoc, Node *child)
2483 chtml10 = GET_CHTML10(pdoc);
2491 for (attr = qs_get_attr(doc,child);
2493 attr = qs_get_next_attr(doc,attr)) {
2494 char *nm = qs_get_attr_name (doc,attr);
2495 char *val = qs_get_attr_value(doc,attr);
2499 if (strcasecmp(nm, "size") == 0) {
2500 /*--------------------------------------------------------------------*/
2501 /* CHTML 1.0 version 2.0 */
2502 /*--------------------------------------------------------------------*/
2503 size = apr_pstrdup(doc->buf.pool, val);
2509 if (strcasecmp(nm, "name") == 0) {
2510 /*--------------------------------------------------------------------*/
2511 /* CHTML 1.0 version 2.0 */
2512 /*--------------------------------------------------------------------*/
2513 name = apr_pstrdup(doc->buf.pool, val);
2519 if (strcasecmp(nm, "multiple") == 0) {
2520 /*--------------------------------------------------------------------*/
2521 /* CHTML 1.0 version 2.0 */
2522 /*--------------------------------------------------------------------*/
2532 if (size && *size != 0) {
2538 if (name && *name != 0) {
2545 return chtml10->out;
2550 * It is a handler who processes the SELECT tag.
2552 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2553 * destination is specified.
2554 * @param node [i] The SELECT tag node is specified.
2555 * @return The conversion result is returned.
2558 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2564 chtml10 = GET_CHTML10(pdoc);
2569 return chtml10->out;
2574 * It is a handler who processes the OPTION tag.
2576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2577 * destination is specified.
2578 * @param node [i] The OPTION tag node is specified.
2579 * @return The conversion result is returned.
2582 s_chtml10_start_option_tag(void *pdoc, Node *child)
2591 chtml10 = GET_CHTML10(pdoc);
2600 for (attr = qs_get_attr(doc,child);
2602 attr = qs_get_next_attr(doc,attr)) {
2603 char *nm = qs_get_attr_name (doc,attr);
2604 char *val = qs_get_attr_value(doc,attr);
2608 if (strcasecmp(nm, "selected") == 0) {
2609 /*--------------------------------------------------------------------*/
2610 /* CHTML 1.0 version 2.0 */
2611 /*--------------------------------------------------------------------*/
2612 selected = apr_pstrdup(doc->buf.pool, val);
2618 if (strcasecmp(nm, "value") == 0) {
2619 /*--------------------------------------------------------------------*/
2620 /* CHTML 1.0 version 2.0 */
2621 /*--------------------------------------------------------------------*/
2622 value = apr_pstrdup(doc->buf.pool, val);
2642 return chtml10->out;
2647 * It is a handler who processes the OPTION tag.
2649 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2650 * destination is specified.
2651 * @param node [i] The OPTION tag node is specified.
2652 * @return The conversion result is returned.
2655 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2657 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2661 return chtml10->out;
2666 * It is a handler who processes the DIV tag.
2668 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2669 * destination is specified.
2670 * @param node [i] The DIV tag node is specified.
2671 * @return The conversion result is returned.
2674 s_chtml10_start_div_tag(void *pdoc, Node *child)
2682 chtml10 = GET_CHTML10(pdoc);
2689 for (attr = qs_get_attr(doc,child);
2691 attr = qs_get_next_attr(doc,attr)) {
2692 char *nm = qs_get_attr_name(doc,attr);
2693 char *val = qs_get_attr_value(doc,attr);
2694 if (STRCASEEQ('a','A',"align", nm)) {
2695 /*----------------------------------------------------------------------*/
2696 /* CHTML 1.0 (W3C version 3.2) */
2697 /*----------------------------------------------------------------------*/
2698 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2699 align = apr_pstrdup(doc->buf.pool, val);
2711 return chtml10->out;
2716 * It is a handler who processes the DIV tag.
2718 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2719 * destination is specified.
2720 * @param node [i] The DIV tag node is specified.
2721 * @return The conversion result is returned.
2724 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2730 chtml10 = GET_CHTML10(pdoc);
2735 return chtml10->out;
2740 * It is a handler who processes the CHXJ:IF tag.
2742 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2743 * destination is specified.
2744 * @param node [i] The CHXJ:IF tag node is specified.
2745 * @return The conversion result is returned.
2748 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2755 chtml10 = GET_CHTML10(pdoc);
2759 for (child = qs_get_child_node(doc, node);
2761 child = qs_get_next_node(doc, child)) {
2763 s_chtml10_chxjif_tag(chtml10, child);
2766 return chtml10->out;
2771 * It is a handler who processes the PRE tag.
2773 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2774 * destination is specified.
2775 * @param node [i] The PRE tag node is specified.
2776 * @return The conversion result is returned.
2779 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2785 chtml10 = GET_CHTML10(pdoc);
2789 chtml10->pre_flag++;
2791 return chtml10->out;
2796 * It is a handler who processes the PRE tag.
2798 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2799 * destination is specified.
2800 * @param node [i] The PRE tag node is specified.
2801 * @return The conversion result is returned.
2804 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2810 chtml10 = GET_CHTML10(pdoc);
2815 chtml10->pre_flag--;
2817 return chtml10->out;
2822 * It is a handler who processes the P tag.
2824 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2825 * destination is specified.
2826 * @param node [i] The P tag node is specified.
2827 * @return The conversion result is returned.
2830 s_chtml10_start_p_tag(void *pdoc, Node *node)
2838 chtml10 = GET_CHTML10(pdoc);
2843 for (attr = qs_get_attr(doc,node);
2845 attr = qs_get_next_attr(doc,attr)) {
2846 char *nm = qs_get_attr_name(doc,attr);
2847 char *val = qs_get_attr_value(doc,attr);
2848 if (STRCASEEQ('a','A',"align", nm)) {
2849 /*----------------------------------------------------------------------*/
2850 /* CHTML 1.0 (W3C version 3.2) */
2851 /*----------------------------------------------------------------------*/
2852 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2853 align = apr_pstrdup(doc->buf.pool, val);
2865 return chtml10->out;
2870 * It is a handler who processes the P tag.
2872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2873 * destination is specified.
2874 * @param node [i] The P tag node is specified.
2875 * @return The conversion result is returned.
2878 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2884 chtml10 = GET_CHTML10(pdoc);
2889 return chtml10->out;
2894 * It is a handler who processes the TEXTARE tag.
2896 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2897 * destination is specified.
2898 * @param node [i] The TEXTAREA tag node is specified.
2899 * @return The conversion result is returned.
2902 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2909 chtml10 = GET_CHTML10(pdoc);
2914 chtml10->textarea_flag++;
2918 for (attr = qs_get_attr(doc,node);
2920 attr = qs_get_next_attr(doc,attr)) {
2921 char *name = qs_get_attr_name (doc,attr);
2922 char *value = qs_get_attr_value(doc,attr);
2926 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2927 W_L(" accesskey=\"");
2935 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2944 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2953 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2965 return chtml10->out;
2970 * It is a handler who processes the TEXTAREA tag.
2972 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2973 * destination is specified.
2974 * @param node [i] The TEXTAREA tag node is specified.
2975 * @return The conversion result is returned.
2978 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2984 chtml10 = GET_CHTML10(pdoc);
2989 chtml10->textarea_flag--;
2991 return chtml10->out;
2996 s_chtml10_text(void *pdoc, Node *child)
3007 apr_size_t z2h_input_len;
3009 chtml10 = GET_CHTML10(pdoc);
3013 textval = qs_get_node_value(doc,child);
3014 if (strlen(textval) == 0) {
3015 return chtml10->out;
3018 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3019 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3021 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3022 memset(one_byte, 0, sizeof(one_byte));
3025 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3029 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
3031 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3036 if (is_sjis_kanji(textval[ii])) {
3037 one_byte[0] = textval[ii+0];
3038 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3039 one_byte[0] = textval[ii+1];
3040 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3044 if (chtml10->pre_flag) {
3045 one_byte[0] = textval[ii+0];
3046 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3049 if (chtml10->textarea_flag) {
3050 one_byte[0] = textval[ii+0];
3051 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3054 if (textval[ii] != '\r' && textval[ii] != '\n') {
3055 one_byte[0] = textval[ii+0];
3056 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3060 z2h_input_len = strlen(tdst);
3061 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml10->entryp);
3064 return chtml10->out;
3069 * It is a handler who processes the BLOCKQUOTE tag.
3071 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3072 * destination is specified.
3073 * @param node [i] The BLOCKQUOTE tag node is specified.
3074 * @return The conversion result is returned.
3077 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3081 chtml10 = GET_CHTML10(pdoc);
3083 W_L("<blockquote>");
3084 return chtml10->out;
3089 * It is a handler who processes the BLOCKQUOTE tag.
3091 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3092 * destination is specified.
3093 * @param node [i] The BLOCKQUOTE tag node is specified.
3094 * @return The conversion result is returned.
3097 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3102 chtml10 = GET_CHTML10(pdoc);
3104 W_L("</blockquote>");
3105 return chtml10->out;
3110 * It is a handler who processes the DIR tag.
3112 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3113 * destination is specified.
3114 * @param node [i] The DIR tag node is specified.
3115 * @return The conversion result is returned.
3118 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3122 chtml10 = GET_CHTML10(pdoc);
3125 return chtml10->out;
3130 * It is a handler who processes the DIR tag.
3132 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3133 * destination is specified.
3134 * @param node [i] The DIR tag node is specified.
3135 * @return The conversion result is returned.
3138 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3143 chtml10 = GET_CHTML10(pdoc);
3146 return chtml10->out;
3151 * It is a handler who processes the DL tag.
3153 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3154 * destination is specified.
3155 * @param node [i] The DL tag node is specified.
3156 * @return The conversion result is returned.
3159 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3163 chtml10 = GET_CHTML10(pdoc);
3166 return chtml10->out;
3171 * It is a handler who processes the DL tag.
3173 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3174 * destination is specified.
3175 * @param node [i] The DL tag node is specified.
3176 * @return The conversion result is returned.
3179 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3183 chtml10 = GET_CHTML10(pdoc);
3186 return chtml10->out;
3191 * It is a handter who processes the DT tag.
3193 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3194 * destination is specified.
3195 * @param node [i] The DT tag node is specified.
3196 * @return The conversion result is returned.
3199 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3203 chtml10 = GET_CHTML10(pdoc);
3206 return chtml10->out;
3211 * It is a handter who processes the DT tag.
3213 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3214 * destination is specified.
3215 * @param node [i] The DT tag node is specified.
3216 * @return The conversion result is returned.
3219 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3221 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3223 return chtml10->out;
3228 * It is a handder who processes the DD tag.
3230 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3231 * destination is specified.
3232 * @param node [i] The DD tag node is specified.
3233 * @return The conversion result is returned.
3236 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3240 chtml10 = GET_CHTML10(pdoc);
3243 return chtml10->out;
3248 * It is a handder who processes the DD tag.
3250 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3251 * destination is specified.
3252 * @param node [i] The DD tag node is specified.
3253 * @return The conversion result is returned.
3256 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3258 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3259 return chtml10->out;
3264 * It is a hanmenuer who processes the MENU tag.
3266 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3267 * destination is specified.
3268 * @param node [i] The MENU tag node is specified.
3269 * @return The conversion result is returned.
3272 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3276 chtml10 = GET_CHTML10(pdoc);
3279 return chtml10->out;
3284 * It is a hanmenuer who processes the MENU tag.
3286 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3287 * destination is specified.
3288 * @param node [i] The MENU tag node is specified.
3289 * @return The conversion result is returned.
3292 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3294 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3295 Doc *doc = chtml10->doc;
3297 return chtml10->out;
3302 * It is a handler who processes the PLAINTEXT tag.
3304 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3305 * destination is specified.
3306 * @param node [i] The PLAINTEXT tag node is specified.
3307 * @return The conversion result is returned.
3310 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3315 chtml10 = GET_CHTML10(pdoc);
3318 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3319 return chtml10->out;
3323 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3328 chtml10 = GET_CHTML10(pdoc);
3330 for (child = qs_get_child_node(doc, node);
3332 child = qs_get_next_node(doc, child)) {
3334 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3336 return chtml10->out;
3341 * It is a handler who processes the PLAINTEXT tag.
3343 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3344 * destination is specified.
3345 * @param node [i] The PLAINTEXT tag node is specified.
3346 * @return The conversion result is returned.
3349 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3351 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3352 return chtml10->out;
3357 * It is handler who processes the New Line Code.
3360 s_chtml10_newline_mark(void *pdoc, Node *UNUSED(node))
3362 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3363 Doc *doc = chtml10->doc;
3365 return chtml10->out;