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"
28 #define GET_CHTML10(X) ((chtml10_t *)(X))
31 #define W_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml10->conf); W_V(nlcode); } while (0)
38 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
39 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
40 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
41 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
42 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
43 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
44 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
45 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
46 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
47 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
48 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
49 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
50 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
51 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
52 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
53 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
54 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
55 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
56 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
57 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
58 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
59 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
60 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
61 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
62 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
63 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
64 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
65 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
66 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
67 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
68 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
69 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
70 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
71 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
72 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
73 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
74 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
75 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
76 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
77 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
78 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
79 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
80 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
81 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
82 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
83 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
84 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
85 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
86 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
87 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
88 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
89 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
90 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
91 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
92 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
93 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
94 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
95 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
96 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
97 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
98 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
99 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
100 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
101 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
102 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
103 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
104 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
105 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
106 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
107 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
108 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
109 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
110 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
111 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
112 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
113 static char *s_chtml10_newline_mark (void *pdoc, Node *node);
115 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
117 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
118 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
119 static char *s_chtml10_text (void *pdoc, Node *node);
121 tag_handler chtml10_handler[] = {
124 s_chtml10_start_html_tag,
125 s_chtml10_end_html_tag,
129 s_chtml10_start_meta_tag,
130 s_chtml10_end_meta_tag,
134 s_chtml10_start_textarea_tag,
135 s_chtml10_end_textarea_tag,
139 s_chtml10_start_p_tag,
144 s_chtml10_start_pre_tag,
145 s_chtml10_end_pre_tag,
149 s_chtml10_start_ul_tag,
150 s_chtml10_end_ul_tag,
154 s_chtml10_start_li_tag,
155 s_chtml10_end_li_tag,
159 s_chtml10_start_ol_tag,
160 s_chtml10_end_ol_tag,
164 s_chtml10_start_h1_tag,
165 s_chtml10_end_h1_tag,
169 s_chtml10_start_h2_tag,
170 s_chtml10_end_h2_tag,
174 s_chtml10_start_h3_tag,
175 s_chtml10_end_h3_tag,
179 s_chtml10_start_h4_tag,
180 s_chtml10_end_h4_tag,
184 s_chtml10_start_h5_tag,
185 s_chtml10_end_h5_tag,
189 s_chtml10_start_h6_tag,
190 s_chtml10_end_h6_tag,
194 s_chtml10_start_head_tag,
195 s_chtml10_end_head_tag,
199 s_chtml10_start_title_tag,
200 s_chtml10_end_title_tag,
204 s_chtml10_start_base_tag,
205 s_chtml10_end_base_tag,
209 s_chtml10_start_body_tag,
210 s_chtml10_end_body_tag,
214 s_chtml10_start_a_tag,
219 s_chtml10_start_br_tag,
220 s_chtml10_end_br_tag,
229 s_chtml10_start_tr_tag,
230 s_chtml10_end_tr_tag,
244 s_chtml10_start_font_tag,
245 s_chtml10_end_font_tag,
249 s_chtml10_start_form_tag,
250 s_chtml10_end_form_tag,
254 s_chtml10_start_input_tag,
255 s_chtml10_end_input_tag,
259 s_chtml10_start_center_tag,
260 s_chtml10_end_center_tag,
264 s_chtml10_start_hr_tag,
265 s_chtml10_end_hr_tag,
269 s_chtml10_start_img_tag,
270 s_chtml10_end_img_tag,
274 s_chtml10_start_select_tag,
275 s_chtml10_end_select_tag,
279 s_chtml10_start_option_tag,
280 s_chtml10_end_option_tag,
284 s_chtml10_start_div_tag,
285 s_chtml10_end_div_tag,
289 s_chtml10_chxjif_tag,
334 s_chtml10_start_dt_tag,
335 s_chtml10_end_dt_tag,
349 s_chtml10_start_blockquote_tag,
350 s_chtml10_end_blockquote_tag,
354 s_chtml10_start_dir_tag,
355 s_chtml10_end_dir_tag,
359 s_chtml10_start_dl_tag,
360 s_chtml10_end_dl_tag,
364 s_chtml10_start_dd_tag,
365 s_chtml10_end_dd_tag,
369 s_chtml10_start_menu_tag,
370 s_chtml10_end_menu_tag,
374 s_chtml10_start_plaintext_tag,
375 s_chtml10_end_plaintext_tag,
389 s_chtml10_newline_mark,
396 * converts from CHTML5.0 to CHTML1.0.
398 * @param r [i] Requet_rec is appointed.
399 * @param spec [i] The result of the device specification processing which
400 * was done in advance is appointed.
401 * @param src [i] The character string before the converting is appointed.
402 * @return The character string after the converting is returned.
405 chxj_convert_chtml10(
411 chxjconvrule_entry *entryp,
424 DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
426 /*--------------------------------------------------------------------------*/
428 /*--------------------------------------------------------------------------*/
430 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
432 DBG(r,"i found qrcode xml");
435 DBG(r,"not found qrcode xml");
437 /*--------------------------------------------------------------------------*/
438 /* The CHTML structure is initialized. */
439 /*--------------------------------------------------------------------------*/
440 s_init_chtml10(&chtml10, &doc, r, spec);
441 chtml10.entryp = entryp;
442 chtml10.cookie = cookie;
444 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
446 /*--------------------------------------------------------------------------*/
447 /* The character string of the input is analyzed. */
448 /*--------------------------------------------------------------------------*/
449 qs_init_malloc(&doc);
450 qs_init_root_node(&doc);
452 ss = apr_pcalloc(r->pool, srclen + 1);
453 memset(ss, 0, srclen + 1);
454 memcpy(ss, src, srclen);
457 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
460 qs_parse_string(&doc,ss, strlen(ss));
462 chxj_buffered_write_init(r->pool, &doc.buf);
463 /*--------------------------------------------------------------------------*/
464 /* It converts it from CHTML to CHTML. */
465 /*--------------------------------------------------------------------------*/
466 chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
467 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
468 dst = apr_pstrdup(r->pool, chtml10.out);
469 chxj_buffered_write_terminate(&doc.buf);
471 qs_all_free(&doc,QX_LOGMARK);
474 return apr_pstrdup(r->pool,ss);
477 if (strlen(dst) == 0) {
478 dst = apr_psprintf(r->pool, "\n");
480 *dstlen = strlen(dst);
483 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
486 DBG(r, "end chxj_convert_chtml10() cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
493 * The CHTML structure is initialized.
495 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
496 * initialized is specified.
497 * @param doc [i] The Doc structure that should be set to the initialized
498 * HDML structure is specified.
499 * @param r [i] To use POOL, the pointer to request_rec is specified.
500 * @param spec [i] The pointer to the device_table
509 memset(doc, 0, sizeof(Doc));
510 memset(chtml10, 0, sizeof(chtml10_t));
514 chtml10->spec = spec;
515 chtml10->out = qs_alloc_zero_byte_string(r->pool);
516 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
517 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
522 * Corresponding EMOJI to a current character-code is retrieved.
523 * The substitution character string is stored in the rslt pointer if agreeing.
525 * @param chtml10 [i] The pointer to the CHTML structure is specified.
526 * @param txt [i] The character string to want to examine whether it is
527 * EMOJI is specified.
528 * @param rslt [o] The pointer to the pointer that stores the result is
530 * @return When corresponding EMOJI exists, it returns it excluding 0.
533 s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
540 spec = chtml10->spec;
546 DBG(r,"spec is NULL");
549 for (ee = chtml10->conf->emoji;
554 DBG(r,"emoji->imode is NULL");
558 if (ee->imode->string
560 && strlen(ee->imode->string) > 0
561 && *ee->imode->string == *txt
562 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
563 *rslt = apr_palloc(r->pool, 3);
564 (*rslt)[0] = ee->imode->hex1byte & 0xff;
565 (*rslt)[1] = ee->imode->hex2byte & 0xff;
567 return strlen(ee->imode->string);
574 chxj_chtml10_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
585 chtml10 = &__chtml10;
588 DBG(r, "REQ[%X] start chxj_chtml10_emoji_only_converter()", (apr_size_t)(unsigned int)r);
589 memset(doc, 0, sizeof(Doc));
590 memset(chtml10, 0, sizeof(chtml10_t));
594 chtml10->spec = spec;
595 chtml10->out = qs_alloc_zero_byte_string(r->pool);
596 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
597 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
599 apr_pool_create(&pool, r->pool);
601 chxj_buffered_write_init(pool, &doc->buf);
603 for (ii=0; ii<len; ii++) {
607 rtn = s_chtml10_search_emoji(chtml10, (char *)&src[ii], &out);
614 if (is_sjis_kanji(src[ii])) {
615 two_byte[0] = src[ii+0];
616 two_byte[1] = src[ii+1];
622 one_byte[0] = src[ii+0];
628 chtml10->out = chxj_buffered_write_flush(chtml10->out, &doc->buf);
630 DBG(r, "REQ[%X] end chxj_chtml10_emoji_only_converter()", (apr_size_t)(unsigned int)r);
636 * It is a handler who processes the HTML tag.
638 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
639 * destination is specified.
640 * @param node [i] The HTML tag node is specified.
641 * @return The conversion result is returned.
644 s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
650 chtml10 = GET_CHTML10(pdoc);
654 /*--------------------------------------------------------------------------*/
656 /*--------------------------------------------------------------------------*/
663 * It is a handler who processes the HTML tag.
665 * @param pdoc [i/o] The pointer to the CHTML structure at the output
666 * destination is specified.
667 * @param node [i] The HTML tag node is specified.
668 * @return The conversion result is returned.
671 s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
678 chtml10 = GET_CHTML10(pdoc);
688 * It is a handler who processes the META tag.
690 * @param pdoc [i/o] The pointer to the CHTML structure at the output
691 * destination is specified.
692 * @param node [i] The META tag node is specified.
693 * @return The conversion result is returned.
696 s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node))
698 chtml10_t *chtml10 = GET_CHTML10(pdoc);
707 * It is a handler who processes the META tag.
709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
710 * destination is specified.
711 * @param node [i] The META tag node is specified.
712 * @return The conversion result is returned.
715 s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
717 chtml10_t *chtml10 = GET_CHTML10(pdoc);
724 * It is a handler who processes the HEAD tag.
726 * @param pdoc [i/o] The pointer to the CHTML structure at the output
727 * destination is specified.
728 * @param node [i] The HEAD tag node is specified.
729 * @return The conversion result is returned.
732 s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
738 chtml10 = GET_CHTML10(pdoc);
749 * It is a handler who processes the HEAD tag.
751 * @param pdoc [i/o] The pointer to the CHTML structure at the output
752 * destination is specified.
753 * @param node [i] The HEAD tag node is specified.
754 * @return The conversion result is returned.
757 s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
763 chtml10 = GET_CHTML10(pdoc);
774 * It is a handler who processes the OL tag.
776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
777 * destination is specified.
778 * @param node [i] The OL tag node is specified.
779 * @return The conversion result is returned.
782 s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node))
788 chtml10 = GET_CHTML10(pdoc);
799 * It is a handler who processes the OL tag.
801 * @param pdoc [i/o] The pointer to the CHTML structure at the output
802 * destination is specified.
803 * @param node [i] The OL tag node is specified.
804 * @return The conversion result is returned.
807 s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
813 chtml10 = GET_CHTML10(pdoc);
824 * It is a handler who processes the UL tag.
826 * @param pdoc [i/o] The pointer to the CHTML structure at the output
827 * destination is specified.
828 * @param node [i] The UL tag node is specified.
829 * @return The conversion result is returned.
832 s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node))
838 chtml10 = GET_CHTML10(pdoc);
849 * It is a handler who processes the UL tag.
851 * @param pdoc [i/o] The pointer to the CHTML structure at the output
852 * destination is specified.
853 * @param node [i] The UL tag node is specified.
854 * @return The conversion result is returned.
857 s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
863 chtml10 = GET_CHTML10(pdoc);
874 * It is a handler who processes the LI tag.
876 * @param pdoc [i/o] The pointer to the CHTML structure at the output
877 * destination is specified.
878 * @param node [i] The LI tag node is specified.
879 * @return The conversion result is returned.
882 s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node))
888 chtml10 = GET_CHTML10(pdoc);
899 * It is a handler who processes the LI tag.
901 * @param pdoc [i/o] The pointer to the CHTML structure at the output
902 * destination is specified.
903 * @param node [i] The LI tag node is specified.
904 * @return The conversion result is returned.
907 s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
909 chtml10_t *chtml10 = GET_CHTML10(pdoc);
915 * It is a handler who processes the H1 tag.
917 * @param pdoc [i/o] The pointer to the CHTML structure at the output
918 * destination is specified.
919 * @param node [i] The H1 tag node is specified.
920 * @return The conversion result is returned.
923 s_chtml10_start_h1_tag(void *pdoc, Node *node)
930 chtml10 = GET_CHTML10(pdoc);
935 for (attr = qs_get_attr(doc,node);
937 attr = qs_get_next_attr(doc,attr)) {
938 char *name = qs_get_attr_name(doc,attr);
939 char *value = qs_get_attr_value(doc,attr);
940 if (STRCASEEQ('a','A',"align", name)) {
941 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
956 * It is a handler who processes the H1 tag.
958 * @param pdoc [i/o] The pointer to the CHTML structure at the output
959 * destination is specified.
960 * @param node [i] The H1 tag node is specified.
961 * @return The conversion result is returned.
964 s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
970 chtml10 = GET_CHTML10(pdoc);
981 * It is a handler who processes the H2 tag.
983 * @param pdoc [i/o] The pointer to the CHTML structure at the output
984 * destination is specified.
985 * @param node [i] The H2 tag node is specified.
986 * @return The conversion result is returned.
989 s_chtml10_start_h2_tag(void *pdoc, Node *node)
995 chtml10 = GET_CHTML10(pdoc);
999 for (attr = qs_get_attr(doc,node);
1001 attr = qs_get_next_attr(doc,attr)) {
1002 char *name = qs_get_attr_name(doc,attr);
1003 char *value = qs_get_attr_value(doc,attr);
1004 if (STRCASEEQ('a','A',"align", name)) {
1005 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1015 return chtml10->out;
1020 * It is a handler who processes the H2 tag.
1022 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1023 * destination is specified.
1024 * @param node [i] The H2 tag node is specified.
1025 * @return The conversion result is returned.
1028 s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
1034 chtml10 = GET_CHTML10(pdoc);
1040 return chtml10->out;
1045 * It is a handler who processes the H3 tag.
1047 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1048 * destination is specified.
1049 * @param node [i] The H3 tag node is specified.
1050 * @return The conversion result is returned.
1053 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1060 chtml10 = GET_CHTML10(pdoc);
1065 for (attr = qs_get_attr(doc,node);
1067 attr = qs_get_next_attr(doc,attr)) {
1068 char *name = qs_get_attr_name(doc,attr);
1069 char *value = qs_get_attr_value(doc,attr);
1070 if (STRCASEEQ('a','A',"align", name)) {
1071 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1081 return chtml10->out;
1086 * It is a handler who processes the H3 tag.
1088 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1089 * destination is specified.
1090 * @param node [i] The H3 tag node is specified.
1091 * @return The conversion result is returned.
1094 s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
1100 chtml10 = GET_CHTML10(pdoc);
1106 return chtml10->out;
1111 * It is a handler who processes the H4 tag.
1113 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1114 * destination is specified.
1115 * @param node [i] The H4 tag node is specified.
1116 * @return The conversion result is returned.
1119 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1125 chtml10 = GET_CHTML10(pdoc);
1129 for (attr = qs_get_attr(doc,node);
1131 attr = qs_get_next_attr(doc,attr)) {
1132 char *name = qs_get_attr_name(doc,attr);
1133 char *value = qs_get_attr_value(doc,attr);
1134 if (STRCASEEQ('a','A',"align", name)) {
1135 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1145 return chtml10->out;
1150 * It is a handler who processes the H4 tag.
1152 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1153 * destination is specified.
1154 * @param node [i] The H4 tag node is specified.
1155 * @return The conversion result is returned.
1158 s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
1163 chtml10 = GET_CHTML10(pdoc);
1168 return chtml10->out;
1173 * It is a handler who processes the H5 tag.
1175 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1176 * destination is specified.
1177 * @param node [i] The H5 tag node is specified.
1178 * @return The conversion result is returned.
1181 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1188 chtml10 = GET_CHTML10(pdoc);
1193 for (attr = qs_get_attr(doc,node);
1195 attr = qs_get_next_attr(doc,attr)) {
1196 char *name = qs_get_attr_name(doc,attr);
1197 char *value = qs_get_attr_value(doc,attr);
1198 if (STRCASEEQ('a','A',"align", name)) {
1199 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1209 return chtml10->out;
1214 * It is a handler who processes the H5 tag.
1216 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1217 * destination is specified.
1218 * @param node [i] The H5 tag node is specified.
1219 * @return The conversion result is returned.
1222 s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
1227 chtml10 = GET_CHTML10(pdoc);
1232 return chtml10->out;
1237 * It is a handler who processes the H6 tag.
1239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1240 * destination is specified.
1241 * @param node [i] The H6 tag node is specified.
1242 * @return The conversion result is returned.
1245 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1251 chtml10 = GET_CHTML10(pdoc);
1255 for (attr = qs_get_attr(doc,node);
1257 attr = qs_get_next_attr(doc,attr)) {
1258 char *name = qs_get_attr_name(doc,attr);
1259 char *value = qs_get_attr_value(doc,attr);
1260 if (STRCASEEQ('a','A',"align", name)) {
1261 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1271 return chtml10->out;
1276 * It is a handler who processes the H6 tag.
1278 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1279 * destination is specified.
1280 * @param node [i] The H6 tag node is specified.
1281 * @return The conversion result is returned.
1284 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1289 chtml10 = GET_CHTML10(pdoc);
1294 return chtml10->out;
1299 * It is a handler who processes the TITLE tag.
1301 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1302 * destination is specified.
1303 * @param node [i] The TITLE tag node is specified.
1304 * @return The conversion result is returned.
1307 s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node))
1312 chtml10 = GET_CHTML10(pdoc);
1317 return chtml10->out;
1322 * It is a handler who processes the TITLE tag.
1324 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1325 * destination is specified.
1326 * @param node [i] The TITLE tag node is specified.
1327 * @return The conversion result is returned.
1330 s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
1335 chtml10 = GET_CHTML10(pdoc);
1340 return chtml10->out;
1345 * It is a handler who processes the BASE tag.
1347 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1348 * destination is specified.
1349 * @param node [i] The BASE tag node is specified.
1350 * @return The conversion result is returned.
1353 s_chtml10_start_base_tag(void *pdoc, Node *node)
1359 chtml10 = GET_CHTML10(pdoc);
1363 /*--------------------------------------------------------------------------*/
1364 /* Get Attributes */
1365 /*--------------------------------------------------------------------------*/
1366 for (attr = qs_get_attr(doc,node);
1368 attr = qs_get_next_attr(doc,attr)) {
1369 char *name = qs_get_attr_name(doc,attr);
1370 char *value = qs_get_attr_value(doc,attr);
1371 if (STRCASEEQ('h','H',"href", name)) {
1380 return chtml10->out;
1385 * It is a handler who processes the BASE tag.
1387 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1388 * destination is specified.
1389 * @param node [i] The BASE tag node is specified.
1390 * @return The conversion result is returned.
1393 s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1395 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1397 return chtml10->out;
1402 * It is a handler who processes the BODY tag.
1404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1405 * destination is specified.
1406 * @param node [i] The BODY tag node is specified.
1407 * @return The conversion result is returned.
1410 s_chtml10_start_body_tag(void *pdoc, Node *node)
1416 chtml10 = GET_CHTML10(pdoc);
1420 /*--------------------------------------------------------------------------*/
1421 /* Get Attributes */
1422 /*--------------------------------------------------------------------------*/
1423 for (attr = qs_get_attr(doc,node);
1425 attr = qs_get_next_attr(doc,attr)) {
1426 char *name = qs_get_attr_name(doc,attr);
1430 if (strcasecmp(name, "alink") == 0) {
1431 /*----------------------------------------------------------------------*/
1433 /*----------------------------------------------------------------------*/
1440 if (strcasecmp(name, "bgcolor") == 0) {
1441 /*----------------------------------------------------------------------*/
1443 /*----------------------------------------------------------------------*/
1450 if (strcasecmp(name, "text") == 0) {
1451 /*----------------------------------------------------------------------*/
1453 /*----------------------------------------------------------------------*/
1460 if (strcasecmp(name, "link") == 0) {
1461 /*----------------------------------------------------------------------*/
1463 /*----------------------------------------------------------------------*/
1470 if (strcasecmp(name, "vlink") == 0) {
1471 /*----------------------------------------------------------------------*/
1473 /*----------------------------------------------------------------------*/
1485 return chtml10->out;
1490 * It is a handler who processes the BODY tag.
1492 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1493 * destination is specified.
1494 * @param node [i] The BODY tag node is specified.
1495 * @return The conversion result is returned.
1498 s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1503 chtml10 = GET_CHTML10(pdoc);
1508 return chtml10->out;
1513 * It is a handler who processes the A tag.
1515 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1516 * destination is specified.
1517 * @param node [i] The A tag node is specified.
1518 * @return The conversion result is returned.
1521 s_chtml10_start_a_tag(void *pdoc, Node *node)
1528 chtml10 = GET_CHTML10(pdoc);
1534 /*--------------------------------------------------------------------------*/
1535 /* Get Attributes */
1536 /*--------------------------------------------------------------------------*/
1537 for (attr = qs_get_attr(doc,node);
1539 attr = qs_get_next_attr(doc,attr)) {
1540 char *name = qs_get_attr_name(doc,attr);
1541 char *value = qs_get_attr_value(doc,attr);
1545 if (strcasecmp(name, "name") == 0) {
1546 /*--------------------------------------------------------------------*/
1548 /*--------------------------------------------------------------------*/
1557 if (strcasecmp(name, "href") == 0) {
1558 /*--------------------------------------------------------------------*/
1560 /*--------------------------------------------------------------------*/
1561 value = chxj_encoding_parameter(r, value);
1562 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1563 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1573 if (strcasecmp(name, "accesskey") == 0) {
1574 /*--------------------------------------------------------------------*/
1576 /*--------------------------------------------------------------------*/
1577 W_L(" accesskey=\"");
1585 if (strcasecmp(name, "cti") == 0) {
1586 /*--------------------------------------------------------------------*/
1588 /*--------------------------------------------------------------------*/
1595 if (strcasecmp(name, "utn") == 0) {
1596 /*--------------------------------------------------------------------*/
1598 /*--------------------------------------------------------------------*/
1605 if (strcasecmp(name, "telbook") == 0) {
1606 /*--------------------------------------------------------------------*/
1608 /*--------------------------------------------------------------------*/
1615 if (strcasecmp(name, "kana") == 0) {
1616 /*--------------------------------------------------------------------*/
1618 /*--------------------------------------------------------------------*/
1625 if (strcasecmp(name, "email") == 0) {
1626 /*--------------------------------------------------------------------*/
1628 /*--------------------------------------------------------------------*/
1635 if (strcasecmp(name, "ista") == 0) {
1636 /*--------------------------------------------------------------------*/
1638 /*--------------------------------------------------------------------*/
1642 if (strcasecmp(name, "ilet") == 0) {
1643 /*--------------------------------------------------------------------*/
1645 /*--------------------------------------------------------------------*/
1649 if (strcasecmp(name, "iswf") == 0) {
1650 /*--------------------------------------------------------------------*/
1652 /*--------------------------------------------------------------------*/
1656 if (strcasecmp(name, "irst") == 0) {
1657 /*--------------------------------------------------------------------*/
1659 /*--------------------------------------------------------------------*/
1663 if (strcasecmp(name, "ijam") == 0) {
1664 /*--------------------------------------------------------------------*/
1666 /*--------------------------------------------------------------------*/
1677 return chtml10->out;
1682 * It is a handler who processes the A tag.
1684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1685 * destination is specified.
1686 * @param node [i] The A tag node is specified.
1687 * @return The conversion result is returned.
1690 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1696 chtml10 = GET_CHTML10(pdoc);
1702 return chtml10->out;
1707 * It is a handler who processes the BR tag.
1709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1710 * destination is specified.
1711 * @param node [i] The BR tag node is specified.
1712 * @return The conversion result is returned.
1715 s_chtml10_start_br_tag(void *pdoc, Node *node)
1722 chtml10 = GET_CHTML10(pdoc);
1728 /*--------------------------------------------------------------------------*/
1729 /* Get Attributes */
1730 /*--------------------------------------------------------------------------*/
1731 for (attr = qs_get_attr(doc,node);
1733 attr = qs_get_next_attr(doc,attr)) {
1734 char *name = qs_get_attr_name(doc,attr);
1735 char *value = qs_get_attr_value(doc,attr);
1736 if (STRCASEEQ('c','C',"clear",name)) {
1737 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1746 return chtml10->out;
1751 * It is a handler who processes the BR tag.
1753 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1754 * destination is specified.
1755 * @param node [i] The BR tag node is specified.
1756 * @return The conversion result is returned.
1759 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1761 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1763 return chtml10->out;
1768 * It is a handler who processes the TR tag.
1770 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1771 * destination is specified.
1772 * @param node [i] The TR tag node is specified.
1773 * @return The conversion result is returned.
1776 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1778 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1780 return chtml10->out;
1785 * It is a handler who processes the TR tag.
1787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1788 * destination is specified.
1789 * @param node [i] The TR tag node is specified.
1790 * @return The conversion result is returned.
1793 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1799 chtml10 = GET_CHTML10(pdoc);
1805 return chtml10->out;
1810 * It is a handler who processes the FONT tag.
1812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1813 * destination is specified.
1814 * @param node [i] The FONT tag node is specified.
1815 * @return The conversion result is returned.
1818 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1820 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1824 return chtml10->out;
1829 * It is a handler who processes the FONT tag.
1831 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1832 * destination is specified.
1833 * @param node [i] The FONT tag node is specified.
1834 * @return The conversion result is returned.
1837 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1839 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1843 return chtml10->out;
1848 * It is a handler who processes the FORM tag.
1850 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1851 * destination is specified.
1852 * @param node [i] The FORM tag node is specified.
1853 * @return The conversion result is returned.
1856 s_chtml10_start_form_tag(void *pdoc, Node *node)
1862 char *new_hidden_tag = NULL;
1863 char *attr_value = NULL;
1864 char *attr_method = NULL;
1866 chtml10 = GET_CHTML10(pdoc);
1871 /*--------------------------------------------------------------------------*/
1872 /* Get Attributes */
1873 /*--------------------------------------------------------------------------*/
1874 for (attr = qs_get_attr(doc,node);
1876 attr = qs_get_next_attr(doc,attr)) {
1877 char *name = qs_get_attr_name(doc,attr);
1878 char *value = qs_get_attr_value(doc,attr);
1882 if (strcasecmp(name, "action") == 0) {
1883 /*--------------------------------------------------------------------*/
1885 /*--------------------------------------------------------------------*/
1886 attr_value = chxj_encoding_parameter(r, value);
1887 attr_value = chxj_add_cookie_parameter(r, attr_value, chtml10->cookie);
1893 if (strcasecmp(name, "method") == 0) {
1894 /*--------------------------------------------------------------------*/
1896 /*--------------------------------------------------------------------*/
1897 attr_method = apr_pstrdup(doc->pool, value);
1903 if (strcasecmp(name, "utn") == 0) {
1904 /*--------------------------------------------------------------------*/
1906 /*--------------------------------------------------------------------*/
1916 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1921 char *new_query_string = NULL;
1922 q = strchr(attr_value, '?');
1924 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);
1925 if (new_hidden_tag || new_query_string) {
1931 if (new_query_string) {
1933 W_V(new_query_string);
1943 if (new_hidden_tag) {
1944 W_V(new_hidden_tag);
1947 return chtml10->out;
1952 * It is a handler who processes the FORM tag.
1954 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1955 * destination is specified.
1956 * @param node [i] The FORM tag node is specified.
1957 * @return The conversion result is returned.
1960 s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child))
1966 chtml10 = GET_CHTML10(pdoc);
1972 return chtml10->out;
1977 * It is a handler who processes the INPUT tag.
1979 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1980 * destination is specified.
1981 * @param node [i] The INPUT tag node is specified.
1982 * @return The conversion result is returned.
1985 s_chtml10_start_input_tag(void *pdoc, Node *node)
1999 chtml10 = GET_CHTML10(pdoc);
2014 /*--------------------------------------------------------------------------*/
2015 /* Get Attributes */
2016 /*--------------------------------------------------------------------------*/
2018 type = qs_get_type_attr(doc, node, doc->buf.pool);
2019 name = qs_get_name_attr(doc, node, doc->buf.pool);
2020 value = qs_get_value_attr(doc,node,doc->buf.pool);
2021 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2022 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2023 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2024 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2025 size = qs_get_size_attr(doc, node, doc->buf.pool);
2028 type = qs_trim_string(doc->buf.pool, type);
2029 if (type && (STRCASEEQ('t','T',"text", type) ||
2030 STRCASEEQ('p','P',"password",type) ||
2031 STRCASEEQ('c','C',"checkbox",type) ||
2032 STRCASEEQ('r','R',"radio", type) ||
2033 STRCASEEQ('h','H',"hidden", type) ||
2034 STRCASEEQ('s','S',"submit", type) ||
2035 STRCASEEQ('r','R',"reset", type))) {
2042 if (size && *size != 0) {
2048 if (name && *name != 0) {
2054 if (value && *value != 0) {
2056 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2060 if (accesskey && *accesskey != 0) {
2061 W_L(" accesskey=\"");
2067 /*------------------------------------------------------------------------*/
2069 /*------------------------------------------------------------------------*/
2072 /*--------------------------------------------------------------------------*/
2073 /* The figure is default for the password. */
2074 /*--------------------------------------------------------------------------*/
2075 if (max_length && *max_length != 0) {
2076 W_L(" maxlength=\"");
2086 return chtml10->out;
2091 * It is a handler who processes the INPUT tag.
2093 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2094 * destination is specified.
2095 * @param node [i] The INPUT tag node is specified.
2096 * @return The conversion result is returned.
2099 s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2101 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2103 return chtml10->out;
2108 * It is a handler who processes the CENTER tag.
2110 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2111 * destination is specified.
2112 * @param node [i] The CENTER tag node is specified.
2113 * @return The conversion result is returned.
2116 s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node))
2122 chtml10 = GET_CHTML10(pdoc);
2128 return chtml10->out;
2133 * It is a handler who processes the CENTER tag.
2135 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2136 * destination is specified.
2137 * @param node [i] The CENTER tag node is specified.
2138 * @return The conversion result is returned.
2141 s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child))
2147 chtml10 = GET_CHTML10(pdoc);
2153 return chtml10->out;
2158 * It is a handler who processes the HR tag.
2160 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2161 * destination is specified.
2162 * @param node [i] The HR tag node is specified.
2163 * @return The conversion result is returned.
2166 s_chtml10_start_hr_tag(void *pdoc, Node *node)
2173 chtml10 = GET_CHTML10(pdoc);
2179 for (attr = qs_get_attr(doc,node);
2181 attr = qs_get_next_attr(doc,attr)) {
2182 char *name = qs_get_attr_name (doc,attr);
2183 char *value = qs_get_attr_value(doc,attr);
2187 if (strcasecmp(name, "align") == 0) {
2188 /*--------------------------------------------------------------------*/
2190 /*--------------------------------------------------------------------*/
2191 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2201 if (strcasecmp(name, "size") == 0) {
2202 /*--------------------------------------------------------------------*/
2204 /*--------------------------------------------------------------------*/
2205 if (value && value[0] != '\0') {
2215 if (strcasecmp(name, "width") == 0) {
2216 /*--------------------------------------------------------------------*/
2218 /*--------------------------------------------------------------------*/
2219 if (value && value[0] != '\0') {
2229 if (strcasecmp(name, "noshade") == 0) {
2230 /*--------------------------------------------------------------------*/
2232 /*--------------------------------------------------------------------*/
2239 if (strcasecmp(name, "color") == 0) {
2240 /*--------------------------------------------------------------------*/
2242 /*--------------------------------------------------------------------*/
2252 return chtml10->out;
2257 * It is a handler who processes the HR tag.
2259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2260 * destination is specified.
2261 * @param node [i] The HR tag node is specified.
2262 * @return The conversion result is returned.
2265 s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
2267 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2270 return chtml10->out;
2275 * It is a handler who processes the IMG tag.
2277 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2278 * destination is specified.
2279 * @param node [i] The IMG tag node is specified.
2280 * @return The conversion result is returned.
2283 s_chtml10_start_img_tag(void *pdoc, Node *node)
2289 #ifndef IMG_NOT_CONVERT_FILENAME
2293 chtml10 = GET_CHTML10(pdoc);
2294 #ifndef IMG_NOT_CONVERT_FILENAME
2295 spec = chtml10->spec;
2301 /*--------------------------------------------------------------------------*/
2302 /* Get Attributes */
2303 /*--------------------------------------------------------------------------*/
2304 for (attr = qs_get_attr(doc,node);
2306 attr = qs_get_next_attr(doc,attr)) {
2307 char *name = qs_get_attr_name (doc,attr);
2308 char *value = qs_get_attr_value(doc,attr);
2312 if (strcasecmp(name, "src") == 0) {
2313 /*--------------------------------------------------------------------*/
2315 /*--------------------------------------------------------------------*/
2316 #ifdef IMG_NOT_CONVERT_FILENAME
2317 value = chxj_encoding_parameter(r, value);
2318 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2319 value = chxj_add_cookie_no_update_parameter(r, value);
2324 value = chxj_img_conv(r, spec, value);
2325 value = chxj_encoding_parameter(r, value);
2326 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2327 value = chxj_add_cookie_no_update_parameter(r, value);
2337 if (strcasecmp(name, "align" ) == 0) {
2338 /*--------------------------------------------------------------------*/
2340 /*--------------------------------------------------------------------*/
2341 /*--------------------------------------------------------------------*/
2343 /*--------------------------------------------------------------------*/
2345 if (STRCASEEQ('t','T',"top", value) ||
2346 STRCASEEQ('m','M',"middle",value) ||
2347 STRCASEEQ('b','B',"bottom",value) ||
2348 STRCASEEQ('l','L',"left", value) ||
2349 STRCASEEQ('r','R',"right", value)) {
2354 else if (STRCASEEQ('c','C',"center", value)) {
2361 else if (strcasecmp(name, "alt" ) == 0) {
2362 /*--------------------------------------------------------------------*/
2364 /*--------------------------------------------------------------------*/
2365 if (value && value[0] != '\0') {
2375 if (strcasecmp(name, "width" ) == 0) {
2376 /*--------------------------------------------------------------------*/
2378 /*--------------------------------------------------------------------*/
2379 if (value && value[0] != '\0') {
2389 if (strcasecmp(name, "height") == 0) {
2390 /*--------------------------------------------------------------------*/
2392 /*--------------------------------------------------------------------*/
2393 if (value && value[0] != '\0') {
2400 if (strcasecmp(name, "hspace") == 0) {
2401 /*--------------------------------------------------------------------*/
2403 /*--------------------------------------------------------------------*/
2404 if (value && value[0] != '\0') {
2414 if (strcasecmp(name, "vspace") == 0) {
2415 /*--------------------------------------------------------------------*/
2417 /*--------------------------------------------------------------------*/
2418 if (value && value[0] != '\0') {
2432 return chtml10->out;
2437 * It is a handler who processes the IMG tag.
2439 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2440 * destination is specified.
2441 * @param node [i] The IMG tag node is specified.
2442 * @return The conversion result is returned.
2445 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2447 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2449 return chtml10->out;
2454 * It is a handler who processes the SELECT tag.
2456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2457 * destination is specified.
2458 * @param node [i] The SELECT tag node is specified.
2459 * @return The conversion result is returned.
2462 s_chtml10_start_select_tag(void *pdoc, Node *child)
2472 chtml10 = GET_CHTML10(pdoc);
2480 for (attr = qs_get_attr(doc,child);
2482 attr = qs_get_next_attr(doc,attr)) {
2483 char *nm = qs_get_attr_name (doc,attr);
2484 char *val = qs_get_attr_value(doc,attr);
2488 if (strcasecmp(nm, "size") == 0) {
2489 /*--------------------------------------------------------------------*/
2490 /* CHTML 1.0 version 2.0 */
2491 /*--------------------------------------------------------------------*/
2492 size = apr_pstrdup(doc->buf.pool, val);
2498 if (strcasecmp(nm, "name") == 0) {
2499 /*--------------------------------------------------------------------*/
2500 /* CHTML 1.0 version 2.0 */
2501 /*--------------------------------------------------------------------*/
2502 name = apr_pstrdup(doc->buf.pool, val);
2508 if (strcasecmp(nm, "multiple") == 0) {
2509 /*--------------------------------------------------------------------*/
2510 /* CHTML 1.0 version 2.0 */
2511 /*--------------------------------------------------------------------*/
2521 if (size && *size != 0) {
2527 if (name && *name != 0) {
2534 return chtml10->out;
2539 * It is a handler who processes the SELECT tag.
2541 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2542 * destination is specified.
2543 * @param node [i] The SELECT tag node is specified.
2544 * @return The conversion result is returned.
2547 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2553 chtml10 = GET_CHTML10(pdoc);
2558 return chtml10->out;
2563 * It is a handler who processes the OPTION tag.
2565 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2566 * destination is specified.
2567 * @param node [i] The OPTION tag node is specified.
2568 * @return The conversion result is returned.
2571 s_chtml10_start_option_tag(void *pdoc, Node *child)
2580 chtml10 = GET_CHTML10(pdoc);
2589 for (attr = qs_get_attr(doc,child);
2591 attr = qs_get_next_attr(doc,attr)) {
2592 char *nm = qs_get_attr_name (doc,attr);
2593 char *val = qs_get_attr_value(doc,attr);
2597 if (strcasecmp(nm, "selected") == 0) {
2598 /*--------------------------------------------------------------------*/
2599 /* CHTML 1.0 version 2.0 */
2600 /*--------------------------------------------------------------------*/
2601 selected = apr_pstrdup(doc->buf.pool, val);
2607 if (strcasecmp(nm, "value") == 0) {
2608 /*--------------------------------------------------------------------*/
2609 /* CHTML 1.0 version 2.0 */
2610 /*--------------------------------------------------------------------*/
2611 value = apr_pstrdup(doc->buf.pool, val);
2631 return chtml10->out;
2636 * It is a handler who processes the OPTION tag.
2638 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2639 * destination is specified.
2640 * @param node [i] The OPTION tag node is specified.
2641 * @return The conversion result is returned.
2644 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2646 chtml10_t *chtml10 = GET_CHTML10(pdoc);
2650 return chtml10->out;
2655 * It is a handler who processes the DIV tag.
2657 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2658 * destination is specified.
2659 * @param node [i] The DIV tag node is specified.
2660 * @return The conversion result is returned.
2663 s_chtml10_start_div_tag(void *pdoc, Node *child)
2671 chtml10 = GET_CHTML10(pdoc);
2678 for (attr = qs_get_attr(doc,child);
2680 attr = qs_get_next_attr(doc,attr)) {
2681 char *nm = qs_get_attr_name(doc,attr);
2682 char *val = qs_get_attr_value(doc,attr);
2683 if (STRCASEEQ('a','A',"align", nm)) {
2684 /*----------------------------------------------------------------------*/
2685 /* CHTML 1.0 (W3C version 3.2) */
2686 /*----------------------------------------------------------------------*/
2687 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2688 align = apr_pstrdup(doc->buf.pool, val);
2700 return chtml10->out;
2705 * It is a handler who processes the DIV tag.
2707 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2708 * destination is specified.
2709 * @param node [i] The DIV tag node is specified.
2710 * @return The conversion result is returned.
2713 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2719 chtml10 = GET_CHTML10(pdoc);
2724 return chtml10->out;
2729 * It is a handler who processes the CHXJ:IF tag.
2731 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2732 * destination is specified.
2733 * @param node [i] The CHXJ:IF tag node is specified.
2734 * @return The conversion result is returned.
2737 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2744 chtml10 = GET_CHTML10(pdoc);
2748 for (child = qs_get_child_node(doc, node);
2750 child = qs_get_next_node(doc, child)) {
2752 s_chtml10_chxjif_tag(chtml10, child);
2755 return chtml10->out;
2760 * It is a handler who processes the PRE tag.
2762 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2763 * destination is specified.
2764 * @param node [i] The PRE tag node is specified.
2765 * @return The conversion result is returned.
2768 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2774 chtml10 = GET_CHTML10(pdoc);
2778 chtml10->pre_flag++;
2780 return chtml10->out;
2785 * It is a handler who processes the PRE tag.
2787 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2788 * destination is specified.
2789 * @param node [i] The PRE tag node is specified.
2790 * @return The conversion result is returned.
2793 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2799 chtml10 = GET_CHTML10(pdoc);
2804 chtml10->pre_flag--;
2806 return chtml10->out;
2811 * It is a handler who processes the P tag.
2813 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2814 * destination is specified.
2815 * @param node [i] The P tag node is specified.
2816 * @return The conversion result is returned.
2819 s_chtml10_start_p_tag(void *pdoc, Node *node)
2827 chtml10 = GET_CHTML10(pdoc);
2832 for (attr = qs_get_attr(doc,node);
2834 attr = qs_get_next_attr(doc,attr)) {
2835 char *nm = qs_get_attr_name(doc,attr);
2836 char *val = qs_get_attr_value(doc,attr);
2837 if (STRCASEEQ('a','A',"align", nm)) {
2838 /*----------------------------------------------------------------------*/
2839 /* CHTML 1.0 (W3C version 3.2) */
2840 /*----------------------------------------------------------------------*/
2841 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2842 align = apr_pstrdup(doc->buf.pool, val);
2854 return chtml10->out;
2859 * It is a handler who processes the P tag.
2861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2862 * destination is specified.
2863 * @param node [i] The P tag node is specified.
2864 * @return The conversion result is returned.
2867 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2873 chtml10 = GET_CHTML10(pdoc);
2878 return chtml10->out;
2883 * It is a handler who processes the TEXTARE tag.
2885 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2886 * destination is specified.
2887 * @param node [i] The TEXTAREA tag node is specified.
2888 * @return The conversion result is returned.
2891 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2898 chtml10 = GET_CHTML10(pdoc);
2903 chtml10->textarea_flag++;
2907 for (attr = qs_get_attr(doc,node);
2909 attr = qs_get_next_attr(doc,attr)) {
2910 char *name = qs_get_attr_name (doc,attr);
2911 char *value = qs_get_attr_value(doc,attr);
2915 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2916 W_L(" accesskey=\"");
2924 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2933 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2942 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2954 return chtml10->out;
2959 * It is a handler who processes the TEXTAREA tag.
2961 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2962 * destination is specified.
2963 * @param node [i] The TEXTAREA tag node is specified.
2964 * @return The conversion result is returned.
2967 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2973 chtml10 = GET_CHTML10(pdoc);
2978 chtml10->textarea_flag--;
2980 return chtml10->out;
2985 s_chtml10_text(void *pdoc, Node *child)
2997 chtml10 = GET_CHTML10(pdoc);
3001 textval = qs_get_node_value(doc,child);
3002 if (strlen(textval) == 0) {
3003 return chtml10->out;
3006 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3007 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3009 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3010 memset(one_byte, 0, sizeof(one_byte));
3013 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3017 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
3019 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3024 if (is_sjis_kanji(textval[ii])) {
3025 one_byte[0] = textval[ii+0];
3026 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3027 one_byte[0] = textval[ii+1];
3028 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3032 if (chtml10->pre_flag) {
3033 one_byte[0] = textval[ii+0];
3034 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3037 if (chtml10->textarea_flag) {
3038 one_byte[0] = textval[ii+0];
3039 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3042 if (textval[ii] != '\r' && textval[ii] != '\n') {
3043 one_byte[0] = textval[ii+0];
3044 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3049 return chtml10->out;
3054 * It is a handler who processes the BLOCKQUOTE tag.
3056 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3057 * destination is specified.
3058 * @param node [i] The BLOCKQUOTE tag node is specified.
3059 * @return The conversion result is returned.
3062 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3066 chtml10 = GET_CHTML10(pdoc);
3068 W_L("<blockquote>");
3069 return chtml10->out;
3074 * It is a handler who processes the BLOCKQUOTE tag.
3076 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3077 * destination is specified.
3078 * @param node [i] The BLOCKQUOTE tag node is specified.
3079 * @return The conversion result is returned.
3082 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3087 chtml10 = GET_CHTML10(pdoc);
3089 W_L("</blockquote>");
3090 return chtml10->out;
3095 * It is a handler who processes the DIR tag.
3097 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3098 * destination is specified.
3099 * @param node [i] The DIR tag node is specified.
3100 * @return The conversion result is returned.
3103 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3107 chtml10 = GET_CHTML10(pdoc);
3110 return chtml10->out;
3115 * It is a handler who processes the DIR tag.
3117 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3118 * destination is specified.
3119 * @param node [i] The DIR tag node is specified.
3120 * @return The conversion result is returned.
3123 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3128 chtml10 = GET_CHTML10(pdoc);
3131 return chtml10->out;
3136 * It is a handler who processes the DL tag.
3138 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3139 * destination is specified.
3140 * @param node [i] The DL tag node is specified.
3141 * @return The conversion result is returned.
3144 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3148 chtml10 = GET_CHTML10(pdoc);
3151 return chtml10->out;
3156 * It is a handler who processes the DL tag.
3158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3159 * destination is specified.
3160 * @param node [i] The DL tag node is specified.
3161 * @return The conversion result is returned.
3164 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3168 chtml10 = GET_CHTML10(pdoc);
3171 return chtml10->out;
3176 * It is a handter who processes the DT tag.
3178 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3179 * destination is specified.
3180 * @param node [i] The DT tag node is specified.
3181 * @return The conversion result is returned.
3184 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3188 chtml10 = GET_CHTML10(pdoc);
3191 return chtml10->out;
3196 * It is a handter who processes the DT tag.
3198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3199 * destination is specified.
3200 * @param node [i] The DT tag node is specified.
3201 * @return The conversion result is returned.
3204 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3206 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3208 return chtml10->out;
3213 * It is a handder who processes the DD tag.
3215 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3216 * destination is specified.
3217 * @param node [i] The DD tag node is specified.
3218 * @return The conversion result is returned.
3221 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3225 chtml10 = GET_CHTML10(pdoc);
3228 return chtml10->out;
3233 * It is a handder who processes the DD tag.
3235 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3236 * destination is specified.
3237 * @param node [i] The DD tag node is specified.
3238 * @return The conversion result is returned.
3241 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3243 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3244 return chtml10->out;
3249 * It is a hanmenuer who processes the MENU tag.
3251 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3252 * destination is specified.
3253 * @param node [i] The MENU tag node is specified.
3254 * @return The conversion result is returned.
3257 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3261 chtml10 = GET_CHTML10(pdoc);
3264 return chtml10->out;
3269 * It is a hanmenuer who processes the MENU tag.
3271 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3272 * destination is specified.
3273 * @param node [i] The MENU tag node is specified.
3274 * @return The conversion result is returned.
3277 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3279 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3280 Doc *doc = chtml10->doc;
3282 return chtml10->out;
3287 * It is a handler who processes the PLAINTEXT tag.
3289 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3290 * destination is specified.
3291 * @param node [i] The PLAINTEXT tag node is specified.
3292 * @return The conversion result is returned.
3295 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3300 chtml10 = GET_CHTML10(pdoc);
3303 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3304 return chtml10->out;
3308 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3313 chtml10 = GET_CHTML10(pdoc);
3315 for (child = qs_get_child_node(doc, node);
3317 child = qs_get_next_node(doc, child)) {
3319 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3321 return chtml10->out;
3326 * It is a handler who processes the PLAINTEXT tag.
3328 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3329 * destination is specified.
3330 * @param node [i] The PLAINTEXT tag node is specified.
3331 * @return The conversion result is returned.
3334 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3336 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3337 return chtml10->out;
3342 * It is handler who processes the New Line Code.
3345 s_chtml10_newline_mark(void *pdoc, Node *UNUSED(node))
3347 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3348 Doc *doc = chtml10->doc;
3350 return chtml10->out;