2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_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"
26 #define GET_CHTML10(X) ((chtml10_t*)(X))
27 #define W10_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
28 #define W10_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
29 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
31 static char *s_chtml10_start_html_tag (void *pdoc, Node *node);
32 static char *s_chtml10_end_html_tag (void *pdoc, Node *node);
33 static char *s_chtml10_start_meta_tag (void *pdoc, Node *node);
34 static char *s_chtml10_end_meta_tag (void *pdoc, Node *node);
35 static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
36 static char *s_chtml10_end_textarea_tag (void *pdoc, Node *node);
37 static char *s_chtml10_start_p_tag (void *pdoc, Node *node);
38 static char *s_chtml10_end_p_tag (void *pdoc, Node *node);
39 static char *s_chtml10_start_pre_tag (void *pdoc, Node *node);
40 static char *s_chtml10_end_pre_tag (void *pdoc, Node *node);
41 static char *s_chtml10_start_ul_tag (void *pdoc, Node *node);
42 static char *s_chtml10_end_ul_tag (void *pdoc, Node *node);
43 static char *s_chtml10_start_li_tag (void *pdoc, Node *node);
44 static char *s_chtml10_end_li_tag (void *pdoc, Node *node);
45 static char *s_chtml10_start_ol_tag (void *pdoc, Node *node);
46 static char *s_chtml10_end_ol_tag (void *pdoc, Node *node);
47 static char *s_chtml10_start_h1_tag (void *pdoc, Node *node);
48 static char *s_chtml10_end_h1_tag (void *pdoc, Node *node);
49 static char *s_chtml10_start_h2_tag (void *pdoc, Node *node);
50 static char *s_chtml10_end_h2_tag (void *pdoc, Node *node);
51 static char *s_chtml10_start_h3_tag (void *pdoc, Node *node);
52 static char *s_chtml10_end_h3_tag (void *pdoc, Node *node);
53 static char *s_chtml10_start_h4_tag (void *pdoc, Node *node);
54 static char *s_chtml10_end_h4_tag (void *pdoc, Node *node);
55 static char *s_chtml10_start_h5_tag (void *pdoc, Node *node);
56 static char *s_chtml10_end_h5_tag (void *pdoc, Node *node);
57 static char *s_chtml10_start_h6_tag (void *pdoc, Node *node);
58 static char *s_chtml10_end_h6_tag (void *pdoc, Node *node);
59 static char *s_chtml10_start_head_tag (void *pdoc, Node *node);
60 static char *s_chtml10_end_head_tag (void *pdoc, Node *node);
61 static char *s_chtml10_start_title_tag (void *pdoc, Node *node);
62 static char *s_chtml10_end_title_tag (void *pdoc, Node *node);
63 static char *s_chtml10_start_base_tag (void *pdoc, Node *node);
64 static char *s_chtml10_end_base_tag (void *pdoc, Node *node);
65 static char *s_chtml10_start_body_tag (void *pdoc, Node *node);
66 static char *s_chtml10_end_body_tag (void *pdoc, Node *node);
67 static char *s_chtml10_start_a_tag (void *pdoc, Node *node);
68 static char *s_chtml10_end_a_tag (void *pdoc, Node *node);
69 static char *s_chtml10_start_br_tag (void *pdoc, Node *node);
70 static char *s_chtml10_end_br_tag (void *pdoc, Node *node);
71 static char *s_chtml10_start_tr_tag (void *pdoc, Node *node);
72 static char *s_chtml10_end_tr_tag (void *pdoc, Node *node);
73 static char *s_chtml10_start_font_tag (void *pdoc, Node *node);
74 static char *s_chtml10_end_font_tag (void *pdoc, Node *node);
75 static char *s_chtml10_start_input_tag (void *pdoc, Node *node);
76 static char *s_chtml10_end_input_tag (void *pdoc, Node *node);
77 static char *s_chtml10_start_form_tag (void *pdoc, Node *node);
78 static char *s_chtml10_end_form_tag (void *pdoc, Node *node);
79 static char *s_chtml10_start_center_tag (void *pdoc, Node *node);
80 static char *s_chtml10_end_center_tag (void *pdoc, Node *node);
81 static char *s_chtml10_start_hr_tag (void *pdoc, Node *node);
82 static char *s_chtml10_end_hr_tag (void *pdoc, Node *node);
83 static char *s_chtml10_start_img_tag (void *pdoc, Node *node);
84 static char *s_chtml10_end_img_tag (void *pdoc, Node *node);
85 static char *s_chtml10_start_select_tag (void *pdoc, Node *node);
86 static char *s_chtml10_end_select_tag (void *pdoc, Node *node);
87 static char *s_chtml10_start_option_tag (void *pdoc, Node *node);
88 static char *s_chtml10_end_option_tag (void *pdoc, Node *node);
89 static char *s_chtml10_start_div_tag (void *pdoc, Node *node);
90 static char *s_chtml10_end_div_tag (void *pdoc, Node *node);
91 static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
92 static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
93 static char *s_chtml10_start_dir_tag (void *pdoc, Node *node);
94 static char *s_chtml10_end_dir_tag (void *pdoc, Node *node);
95 static char *s_chtml10_start_dl_tag (void *pdoc, Node *node);
96 static char *s_chtml10_end_dl_tag (void *pdoc, Node *node);
97 static char *s_chtml10_start_dt_tag (void *pdoc, Node *node);
98 static char *s_chtml10_end_dt_tag (void *pdoc, Node *node);
99 static char *s_chtml10_start_dd_tag (void *pdoc, Node *node);
100 static char *s_chtml10_end_dd_tag (void *pdoc, Node *node);
101 static char *s_chtml10_start_menu_tag (void *pdoc, Node *node);
102 static char *s_chtml10_end_menu_tag (void *pdoc, Node *node);
103 static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
104 static char *s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node);
105 static char *s_chtml10_end_plaintext_tag (void *pdoc, Node *node);
107 static void s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
109 static int s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
110 static char *s_chtml10_chxjif_tag (void *pdoc, Node *node);
111 static char *s_chtml10_text (void *pdoc, Node *node);
113 tag_handler chtml10_handler[] = {
116 s_chtml10_start_html_tag,
117 s_chtml10_end_html_tag,
121 s_chtml10_start_meta_tag,
122 s_chtml10_end_meta_tag,
126 s_chtml10_start_textarea_tag,
127 s_chtml10_end_textarea_tag,
131 s_chtml10_start_p_tag,
136 s_chtml10_start_pre_tag,
137 s_chtml10_end_pre_tag,
141 s_chtml10_start_ul_tag,
142 s_chtml10_end_ul_tag,
146 s_chtml10_start_li_tag,
147 s_chtml10_end_li_tag,
151 s_chtml10_start_ol_tag,
152 s_chtml10_end_ol_tag,
156 s_chtml10_start_h1_tag,
157 s_chtml10_end_h1_tag,
161 s_chtml10_start_h2_tag,
162 s_chtml10_end_h2_tag,
166 s_chtml10_start_h3_tag,
167 s_chtml10_end_h3_tag,
171 s_chtml10_start_h4_tag,
172 s_chtml10_end_h4_tag,
176 s_chtml10_start_h5_tag,
177 s_chtml10_end_h5_tag,
181 s_chtml10_start_h6_tag,
182 s_chtml10_end_h6_tag,
186 s_chtml10_start_head_tag,
187 s_chtml10_end_head_tag,
191 s_chtml10_start_title_tag,
192 s_chtml10_end_title_tag,
196 s_chtml10_start_base_tag,
197 s_chtml10_end_base_tag,
201 s_chtml10_start_body_tag,
202 s_chtml10_end_body_tag,
206 s_chtml10_start_a_tag,
211 s_chtml10_start_br_tag,
212 s_chtml10_end_br_tag,
221 s_chtml10_start_tr_tag,
222 s_chtml10_end_tr_tag,
236 s_chtml10_start_font_tag,
237 s_chtml10_end_font_tag,
241 s_chtml10_start_form_tag,
242 s_chtml10_end_form_tag,
246 s_chtml10_start_input_tag,
247 s_chtml10_end_input_tag,
251 s_chtml10_start_center_tag,
252 s_chtml10_end_center_tag,
256 s_chtml10_start_hr_tag,
257 s_chtml10_end_hr_tag,
261 s_chtml10_start_img_tag,
262 s_chtml10_end_img_tag,
266 s_chtml10_start_select_tag,
267 s_chtml10_end_select_tag,
271 s_chtml10_start_option_tag,
272 s_chtml10_end_option_tag,
276 s_chtml10_start_div_tag,
277 s_chtml10_end_div_tag,
281 s_chtml10_chxjif_tag,
326 s_chtml10_start_dt_tag,
327 s_chtml10_end_dt_tag,
341 s_chtml10_start_blockquote_tag,
342 s_chtml10_end_blockquote_tag,
346 s_chtml10_start_dir_tag,
347 s_chtml10_end_dir_tag,
351 s_chtml10_start_dl_tag,
352 s_chtml10_end_dl_tag,
356 s_chtml10_start_dd_tag,
357 s_chtml10_end_dd_tag,
361 s_chtml10_start_menu_tag,
362 s_chtml10_end_menu_tag,
366 s_chtml10_start_plaintext_tag,
367 s_chtml10_end_plaintext_tag,
383 * converts from CHTML5.0 to CHTML1.0.
385 * @param r [i] Requet_rec is appointed.
386 * @param spec [i] The result of the device specification processing which
387 * was done in advance is appointed.
388 * @param src [i] The character string before the converting is appointed.
389 * @return The character string after the converting is returned.
392 chxj_exchange_chtml10(
398 chxjconvrule_entry* entryp,
411 DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
413 /*--------------------------------------------------------------------------*/
415 /*--------------------------------------------------------------------------*/
417 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
419 DBG(r,"i found qrcode xml");
422 DBG(r,"not found qrcode xml");
424 /*--------------------------------------------------------------------------*/
425 /* The CHTML structure is initialized. */
426 /*--------------------------------------------------------------------------*/
427 s_init_chtml10(&chtml10, &doc, r, spec);
428 chtml10.entryp = entryp;
429 chtml10.cookie = cookie;
431 chxj_set_content_type(r, "text/html; charset=Windows-31J");
433 /*--------------------------------------------------------------------------*/
434 /* The character string of the input is analyzed. */
435 /*--------------------------------------------------------------------------*/
436 qs_init_malloc(&doc);
437 qs_init_root_node(&doc);
439 ss = apr_pcalloc(r->pool, srclen + 1);
440 memset(ss, 0, srclen + 1);
441 memcpy(ss, src, srclen);
444 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
447 qs_parse_string(&doc,ss, strlen(ss));
449 chxj_buffered_write_init(r->pool, &doc.buf);
450 /*--------------------------------------------------------------------------*/
451 /* It converts it from CHTML to CHTML. */
452 /*--------------------------------------------------------------------------*/
453 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
454 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
455 dst = apr_pstrdup(r->pool, chtml10.out);
456 chxj_buffered_write_terminate(&doc.buf);
458 qs_all_free(&doc,QX_LOGMARK);
461 return apr_pstrdup(r->pool,ss);
464 if (strlen(dst) == 0) {
465 dst = apr_psprintf(r->pool, "\n");
467 *dstlen = strlen(dst);
470 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
473 DBG(r, "end chxj_exchange_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
480 * The CHTML structure is initialized.
482 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
483 * initialized is specified.
484 * @param doc [i] The Doc structure that should be set to the initialized
485 * HDML structure is specified.
486 * @param r [i] To use POOL, the pointer to request_rec is specified.
487 * @param spec [i] The pointer to the device_table
496 memset(doc, 0, sizeof(Doc));
497 memset(chtml10, 0, sizeof(chtml10_t));
501 chtml10->spec = spec;
502 chtml10->out = qs_alloc_zero_byte_string(r);
503 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
504 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
509 * Corresponding EMOJI to a current character-code is retrieved.
510 * The substitution character string is stored in the rslt pointer if agreeing.
512 * @param chtml10 [i] The pointer to the CHTML structure is specified.
513 * @param txt [i] The character string to want to examine whether it is
514 * EMOJI is specified.
515 * @param rslt [o] The pointer to the pointer that stores the result is
517 * @return When corresponding EMOJI exists, it returns it excluding 0.
520 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
527 spec = chtml10->spec;
533 DBG(r,"spec is NULL");
536 for (ee = chtml10->conf->emoji;
541 DBG(r,"emoji->imode is NULL");
545 if (ee->imode->string
547 && strlen(ee->imode->string) > 0
548 && *ee->imode->string == *txt
549 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
550 if (!spec || !spec->emoji_type) {
551 *rslt = apr_palloc(r->pool, 3);
552 (*rslt)[0] = ee->imode->hex1byte & 0xff;
553 (*rslt)[1] = ee->imode->hex2byte & 0xff;
555 return strlen(ee->imode->string);
566 * It is a handler who processes the HTML tag.
568 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
569 * destination is specified.
570 * @param node [i] The HTML tag node is specified.
571 * @return The conversion result is returned.
574 s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node))
580 chtml10 = GET_CHTML10(pdoc);
584 /*--------------------------------------------------------------------------*/
586 /*--------------------------------------------------------------------------*/
594 * It is a handler who processes the HTML tag.
596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
597 * destination is specified.
598 * @param node [i] The HTML tag node is specified.
599 * @return The conversion result is returned.
602 s_chtml10_end_html_tag(void* pdoc, Node* UNUSED(child))
609 chtml10 = GET_CHTML10(pdoc);
620 * It is a handler who processes the META tag.
622 * @param pdoc [i/o] The pointer to the CHTML structure at the output
623 * destination is specified.
624 * @param node [i] The META tag node is specified.
625 * @return The conversion result is returned.
628 s_chtml10_start_meta_tag(void* pdoc, Node* UNUSED(node))
632 chtml10 = GET_CHTML10(pdoc);
641 * It is a handler who processes the META tag.
643 * @param pdoc [i/o] The pointer to the CHTML structure at the output
644 * destination is specified.
645 * @param node [i] The META tag node is specified.
646 * @return The conversion result is returned.
649 s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child))
653 chtml10 = GET_CHTML10(pdoc);
660 * It is a handler who processes the HEAD tag.
662 * @param pdoc [i/o] The pointer to the CHTML structure at the output
663 * destination is specified.
664 * @param node [i] The HEAD tag node is specified.
665 * @return The conversion result is returned.
668 s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node))
674 chtml10 = GET_CHTML10(pdoc);
685 * It is a handler who processes the HEAD tag.
687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
688 * destination is specified.
689 * @param node [i] The HEAD tag node is specified.
690 * @return The conversion result is returned.
693 s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child))
699 chtml10 = GET_CHTML10(pdoc);
710 * It is a handler who processes the OL tag.
712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
713 * destination is specified.
714 * @param node [i] The OL tag node is specified.
715 * @return The conversion result is returned.
718 s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node))
724 chtml10 = GET_CHTML10(pdoc);
735 * It is a handler who processes the OL tag.
737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
738 * destination is specified.
739 * @param node [i] The OL tag node is specified.
740 * @return The conversion result is returned.
743 s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child))
749 chtml10 = GET_CHTML10(pdoc);
760 * It is a handler who processes the UL tag.
762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
763 * destination is specified.
764 * @param node [i] The UL tag node is specified.
765 * @return The conversion result is returned.
768 s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node))
774 chtml10 = GET_CHTML10(pdoc);
785 * It is a handler who processes the UL tag.
787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
788 * destination is specified.
789 * @param node [i] The UL tag node is specified.
790 * @return The conversion result is returned.
793 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
799 chtml10 = GET_CHTML10(pdoc);
810 * It is a handler who processes the LI tag.
812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
813 * destination is specified.
814 * @param node [i] The LI tag node is specified.
815 * @return The conversion result is returned.
818 s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node))
824 chtml10 = GET_CHTML10(pdoc);
835 * It is a handler who processes the LI tag.
837 * @param pdoc [i/o] The pointer to the CHTML structure at the output
838 * destination is specified.
839 * @param node [i] The LI tag node is specified.
840 * @return The conversion result is returned.
843 s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child))
846 chtml10 = GET_CHTML10(pdoc);
852 * It is a handler who processes the H1 tag.
854 * @param pdoc [i/o] The pointer to the CHTML structure at the output
855 * destination is specified.
856 * @param node [i] The H1 tag node is specified.
857 * @return The conversion result is returned.
860 s_chtml10_start_h1_tag(void* pdoc, Node* node)
867 chtml10 = GET_CHTML10(pdoc);
872 for (attr = qs_get_attr(doc,node);
874 attr = qs_get_next_attr(doc,attr)) {
877 name = qs_get_attr_name(doc,attr);
878 value = qs_get_attr_value(doc,attr);
879 if (STRCASEEQ('a','A',"align", name)) {
880 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
895 * It is a handler who processes the H1 tag.
897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
898 * destination is specified.
899 * @param node [i] The H1 tag node is specified.
900 * @return The conversion result is returned.
903 s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child))
909 chtml10 = GET_CHTML10(pdoc);
920 * It is a handler who processes the H2 tag.
922 * @param pdoc [i/o] The pointer to the CHTML structure at the output
923 * destination is specified.
924 * @param node [i] The H2 tag node is specified.
925 * @return The conversion result is returned.
928 s_chtml10_start_h2_tag(void *pdoc, Node *node)
935 chtml10 = GET_CHTML10(pdoc);
940 for (attr = qs_get_attr(doc,node);
942 attr = qs_get_next_attr(doc,attr)) {
945 name = qs_get_attr_name(doc,attr);
946 value = qs_get_attr_value(doc,attr);
947 if (STRCASEEQ('a','A',"align", name)) {
948 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
963 * It is a handler who processes the H2 tag.
965 * @param pdoc [i/o] The pointer to the CHTML structure at the output
966 * destination is specified.
967 * @param node [i] The H2 tag node is specified.
968 * @return The conversion result is returned.
971 s_chtml10_end_h2_tag(void* pdoc, Node* UNUSED(child))
977 chtml10 = GET_CHTML10(pdoc);
988 * It is a handler who processes the H3 tag.
990 * @param pdoc [i/o] The pointer to the CHTML structure at the output
991 * destination is specified.
992 * @param node [i] The H3 tag node is specified.
993 * @return The conversion result is returned.
996 s_chtml10_start_h3_tag(void *pdoc, Node *node)
1003 chtml10 = GET_CHTML10(pdoc);
1008 for (attr = qs_get_attr(doc,node);
1010 attr = qs_get_next_attr(doc,attr)) {
1013 name = qs_get_attr_name(doc,attr);
1014 value = qs_get_attr_value(doc,attr);
1015 if (STRCASEEQ('a','A',"align", name)) {
1016 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1026 return chtml10->out;
1031 * It is a handler who processes the H3 tag.
1033 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1034 * destination is specified.
1035 * @param node [i] The H3 tag node is specified.
1036 * @return The conversion result is returned.
1039 s_chtml10_end_h3_tag(void* pdoc, Node* UNUSED(child))
1045 chtml10 = GET_CHTML10(pdoc);
1051 return chtml10->out;
1056 * It is a handler who processes the H4 tag.
1058 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1059 * destination is specified.
1060 * @param node [i] The H4 tag node is specified.
1061 * @return The conversion result is returned.
1064 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1071 chtml10 = GET_CHTML10(pdoc);
1076 for (attr = qs_get_attr(doc,node);
1078 attr = qs_get_next_attr(doc,attr)) {
1081 name = qs_get_attr_name(doc,attr);
1082 value = qs_get_attr_value(doc,attr);
1083 if (STRCASEEQ('a','A',"align", name)) {
1084 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1094 return chtml10->out;
1099 * It is a handler who processes the H4 tag.
1101 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1102 * destination is specified.
1103 * @param node [i] The H4 tag node is specified.
1104 * @return The conversion result is returned.
1107 s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child))
1113 chtml10 = GET_CHTML10(pdoc);
1119 return chtml10->out;
1124 * It is a handler who processes the H5 tag.
1126 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1127 * destination is specified.
1128 * @param node [i] The H5 tag node is specified.
1129 * @return The conversion result is returned.
1132 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1139 chtml10 = GET_CHTML10(pdoc);
1144 for (attr = qs_get_attr(doc,node);
1146 attr = qs_get_next_attr(doc,attr)) {
1149 name = qs_get_attr_name(doc,attr);
1150 value = qs_get_attr_value(doc,attr);
1151 if (STRCASEEQ('a','A',"align", name)) {
1152 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1162 return chtml10->out;
1167 * It is a handler who processes the H5 tag.
1169 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1170 * destination is specified.
1171 * @param node [i] The H5 tag node is specified.
1172 * @return The conversion result is returned.
1175 s_chtml10_end_h5_tag(void* pdoc, Node* UNUSED(child))
1181 chtml10 = GET_CHTML10(pdoc);
1187 return chtml10->out;
1192 * It is a handler who processes the H6 tag.
1194 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1195 * destination is specified.
1196 * @param node [i] The H6 tag node is specified.
1197 * @return The conversion result is returned.
1200 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1207 chtml10 = GET_CHTML10(pdoc);
1212 for (attr = qs_get_attr(doc,node);
1214 attr = qs_get_next_attr(doc,attr)) {
1217 name = qs_get_attr_name(doc,attr);
1218 value = qs_get_attr_value(doc,attr);
1219 if (STRCASEEQ('a','A',"align", name)) {
1220 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1230 return chtml10->out;
1235 * It is a handler who processes the H6 tag.
1237 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1238 * destination is specified.
1239 * @param node [i] The H6 tag node is specified.
1240 * @return The conversion result is returned.
1243 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1249 chtml10 = GET_CHTML10(pdoc);
1255 return chtml10->out;
1260 * It is a handler who processes the TITLE tag.
1262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1263 * destination is specified.
1264 * @param node [i] The TITLE tag node is specified.
1265 * @return The conversion result is returned.
1268 s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node))
1274 chtml10 = GET_CHTML10(pdoc);
1280 return chtml10->out;
1285 * It is a handler who processes the TITLE tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The TITLE tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child))
1299 chtml10 = GET_CHTML10(pdoc);
1305 return chtml10->out;
1310 * It is a handler who processes the BASE tag.
1312 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1313 * destination is specified.
1314 * @param node [i] The BASE tag node is specified.
1315 * @return The conversion result is returned.
1318 s_chtml10_start_base_tag(void* pdoc, Node* node)
1325 chtml10 = GET_CHTML10(pdoc);
1331 /*--------------------------------------------------------------------------*/
1332 /* Get Attributes */
1333 /*--------------------------------------------------------------------------*/
1334 for (attr = qs_get_attr(doc,node);
1336 attr = qs_get_next_attr(doc,attr)) {
1340 name = qs_get_attr_name(doc,attr);
1341 value = qs_get_attr_value(doc,attr);
1343 if (STRCASEEQ('h','H',"href", name)) {
1352 return chtml10->out;
1357 * It is a handler who processes the BASE tag.
1359 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1360 * destination is specified.
1361 * @param node [i] The BASE tag node is specified.
1362 * @return The conversion result is returned.
1365 s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child))
1367 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1369 return chtml10->out;
1374 * It is a handler who processes the BODY tag.
1376 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1377 * destination is specified.
1378 * @param node [i] The BODY tag node is specified.
1379 * @return The conversion result is returned.
1382 s_chtml10_start_body_tag(void* pdoc, Node* node)
1389 chtml10 = GET_CHTML10(pdoc);
1396 /*--------------------------------------------------------------------------*/
1397 /* Get Attributes */
1398 /*--------------------------------------------------------------------------*/
1399 for (attr = qs_get_attr(doc,node);
1401 attr = qs_get_next_attr(doc,attr)) {
1405 name = qs_get_attr_name(doc,attr);
1410 if (strcasecmp(name, "alink") == 0) {
1411 /*----------------------------------------------------------------------*/
1413 /*----------------------------------------------------------------------*/
1420 if (strcasecmp(name, "bgcolor") == 0) {
1421 /*----------------------------------------------------------------------*/
1423 /*----------------------------------------------------------------------*/
1430 if (strcasecmp(name, "text") == 0) {
1431 /*----------------------------------------------------------------------*/
1433 /*----------------------------------------------------------------------*/
1440 if (strcasecmp(name, "link") == 0) {
1441 /*----------------------------------------------------------------------*/
1443 /*----------------------------------------------------------------------*/
1450 if (strcasecmp(name, "vlink") == 0) {
1451 /*----------------------------------------------------------------------*/
1453 /*----------------------------------------------------------------------*/
1465 return chtml10->out;
1470 * It is a handler who processes the BODY tag.
1472 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1473 * destination is specified.
1474 * @param node [i] The BODY tag node is specified.
1475 * @return The conversion result is returned.
1478 s_chtml10_end_body_tag(void* pdoc, Node* UNUSED(child))
1484 chtml10 = GET_CHTML10(pdoc);
1490 return chtml10->out;
1495 * It is a handler who processes the A tag.
1497 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1498 * destination is specified.
1499 * @param node [i] The A tag node is specified.
1500 * @return The conversion result is returned.
1503 s_chtml10_start_a_tag(void *pdoc, Node *node)
1510 chtml10 = GET_CHTML10(pdoc);
1516 /*--------------------------------------------------------------------------*/
1517 /* Get Attributes */
1518 /*--------------------------------------------------------------------------*/
1519 for (attr = qs_get_attr(doc,node);
1521 attr = qs_get_next_attr(doc,attr)) {
1526 name = qs_get_attr_name(doc,attr);
1527 value = qs_get_attr_value(doc,attr);
1532 if (strcasecmp(name, "name") == 0) {
1533 /*--------------------------------------------------------------------*/
1535 /*--------------------------------------------------------------------*/
1544 if (strcasecmp(name, "href") == 0) {
1545 /*--------------------------------------------------------------------*/
1547 /*--------------------------------------------------------------------*/
1548 value = chxj_encoding_parameter(r, value);
1549 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1558 if (strcasecmp(name, "accesskey") == 0) {
1559 /*--------------------------------------------------------------------*/
1561 /*--------------------------------------------------------------------*/
1562 W10_L(" accesskey=\"");
1570 if (strcasecmp(name, "cti") == 0) {
1571 /*--------------------------------------------------------------------*/
1573 /*--------------------------------------------------------------------*/
1580 if (strcasecmp(name, "utn") == 0) {
1581 /*--------------------------------------------------------------------*/
1583 /*--------------------------------------------------------------------*/
1590 if (strcasecmp(name, "telbook") == 0) {
1591 /*--------------------------------------------------------------------*/
1593 /*--------------------------------------------------------------------*/
1600 if (strcasecmp(name, "kana") == 0) {
1601 /*--------------------------------------------------------------------*/
1603 /*--------------------------------------------------------------------*/
1610 if (strcasecmp(name, "email") == 0) {
1611 /*--------------------------------------------------------------------*/
1613 /*--------------------------------------------------------------------*/
1620 if (strcasecmp(name, "ista") == 0) {
1621 /*--------------------------------------------------------------------*/
1623 /*--------------------------------------------------------------------*/
1627 if (strcasecmp(name, "ilet") == 0) {
1628 /*--------------------------------------------------------------------*/
1630 /*--------------------------------------------------------------------*/
1634 if (strcasecmp(name, "iswf") == 0) {
1635 /*--------------------------------------------------------------------*/
1637 /*--------------------------------------------------------------------*/
1641 if (strcasecmp(name, "irst") == 0) {
1642 /*--------------------------------------------------------------------*/
1644 /*--------------------------------------------------------------------*/
1648 if (strcasecmp(name, "ijam") == 0) {
1649 /*--------------------------------------------------------------------*/
1651 /*--------------------------------------------------------------------*/
1662 return chtml10->out;
1667 * It is a handler who processes the A tag.
1669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1670 * destination is specified.
1671 * @param node [i] The A tag node is specified.
1672 * @return The conversion result is returned.
1675 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1681 chtml10 = GET_CHTML10(pdoc);
1686 return chtml10->out;
1691 * It is a handler who processes the BR tag.
1693 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1694 * destination is specified.
1695 * @param node [i] The BR tag node is specified.
1696 * @return The conversion result is returned.
1699 s_chtml10_start_br_tag(void *pdoc, Node *node)
1706 chtml10 = GET_CHTML10(pdoc);
1712 /*--------------------------------------------------------------------------*/
1713 /* Get Attributes */
1714 /*--------------------------------------------------------------------------*/
1715 for (attr = qs_get_attr(doc,node);
1717 attr = qs_get_next_attr(doc,attr)) {
1721 name = qs_get_attr_name(doc,attr);
1722 value = qs_get_attr_value(doc,attr);
1724 if (STRCASEEQ('c','C',"clear",name)) {
1725 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1733 return chtml10->out;
1738 * It is a handler who processes the BR tag.
1740 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1741 * destination is specified.
1742 * @param node [i] The BR tag node is specified.
1743 * @return The conversion result is returned.
1746 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1748 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1750 return chtml10->out;
1755 * It is a handler who processes the TR tag.
1757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1758 * destination is specified.
1759 * @param node [i] The TR tag node is specified.
1760 * @return The conversion result is returned.
1763 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1765 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1767 return chtml10->out;
1772 * It is a handler who processes the TR tag.
1774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1775 * destination is specified.
1776 * @param node [i] The TR tag node is specified.
1777 * @return The conversion result is returned.
1780 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1786 chtml10 = GET_CHTML10(pdoc);
1792 return chtml10->out;
1797 * It is a handler who processes the FONT tag.
1799 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1800 * destination is specified.
1801 * @param node [i] The FONT tag node is specified.
1802 * @return The conversion result is returned.
1805 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1807 chtml10_t *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_end_font_tag(void *pdoc, Node *UNUSED(child))
1826 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1830 return chtml10->out;
1835 * It is a handler who processes the FORM tag.
1837 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1838 * destination is specified.
1839 * @param node [i] The FORM tag node is specified.
1840 * @return The conversion result is returned.
1843 s_chtml10_start_form_tag(void *pdoc, Node *node)
1850 chtml10 = GET_CHTML10(pdoc);
1856 /*--------------------------------------------------------------------------*/
1857 /* Get Attributes */
1858 /*--------------------------------------------------------------------------*/
1859 for (attr = qs_get_attr(doc,node);
1861 attr = qs_get_next_attr(doc,attr)) {
1865 name = qs_get_attr_name(doc,attr);
1866 value = qs_get_attr_value(doc,attr);
1871 if (strcasecmp(name, "action") == 0) {
1872 /*--------------------------------------------------------------------*/
1874 /*--------------------------------------------------------------------*/
1875 value = chxj_encoding_parameter(r, value);
1876 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1878 W10_L(" action=\"");
1886 if (strcasecmp(name, "method") == 0) {
1887 /*--------------------------------------------------------------------*/
1889 /*--------------------------------------------------------------------*/
1890 W10_L(" method=\"");
1898 if (strcasecmp(name, "utn") == 0) {
1899 /*--------------------------------------------------------------------*/
1901 /*--------------------------------------------------------------------*/
1913 return chtml10->out;
1918 * It is a handler who processes the FORM tag.
1920 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1921 * destination is specified.
1922 * @param node [i] The FORM tag node is specified.
1923 * @return The conversion result is returned.
1926 s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child))
1932 chtml10 = GET_CHTML10(pdoc);
1938 return chtml10->out;
1943 * It is a handler who processes the INPUT tag.
1945 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1946 * destination is specified.
1947 * @param node [i] The INPUT tag node is specified.
1948 * @return The conversion result is returned.
1951 s_chtml10_start_input_tag(void* pdoc, Node* node)
1965 chtml10 = GET_CHTML10(pdoc);
1980 /*--------------------------------------------------------------------------*/
1981 /* Get Attributes */
1982 /*--------------------------------------------------------------------------*/
1984 type = qs_get_type_attr(doc, node, r);
1985 name = qs_get_name_attr(doc, node, r);
1986 value = qs_get_value_attr(doc,node,r);
1987 istyle = qs_get_istyle_attr(doc,node,r);
1988 max_length = qs_get_maxlength_attr(doc,node,r);
1989 checked = qs_get_checked_attr(doc,node,r);
1990 accesskey = qs_get_accesskey_attr(doc, node, r);
1991 size = qs_get_size_attr(doc, node, r);
1994 type = qs_trim_string(doc->buf.pool, type);
1995 if (type && (STRCASEEQ('t','T',"text", type) ||
1996 STRCASEEQ('p','P',"password",type) ||
1997 STRCASEEQ('c','C',"checkbox",type) ||
1998 STRCASEEQ('r','R',"radio", type) ||
1999 STRCASEEQ('h','H',"hidden", type) ||
2000 STRCASEEQ('s','S',"submit", type) ||
2001 STRCASEEQ('r','R',"reset", type))) {
2008 if (size && *size != 0) {
2014 if (name && *name != 0) {
2020 if (value && *value != 0) {
2026 if (accesskey && *accesskey != 0) {
2027 W10_L(" accesskey=\"");
2033 /*------------------------------------------------------------------------*/
2035 /*------------------------------------------------------------------------*/
2038 /*--------------------------------------------------------------------------*/
2039 /* The figure is default for the password. */
2040 /*--------------------------------------------------------------------------*/
2041 if (max_length && *max_length != 0) {
2042 W10_L(" maxlength=\"");
2052 return chtml10->out;
2057 * It is a handler who processes the INPUT tag.
2059 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2060 * destination is specified.
2061 * @param node [i] The INPUT tag node is specified.
2062 * @return The conversion result is returned.
2065 s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child))
2067 chtml10_t* chtml10 = GET_CHTML10(pdoc);
2069 return chtml10->out;
2074 * It is a handler who processes the CENTER tag.
2076 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2077 * destination is specified.
2078 * @param node [i] The CENTER tag node is specified.
2079 * @return The conversion result is returned.
2082 s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node))
2088 chtml10 = GET_CHTML10(pdoc);
2094 return chtml10->out;
2099 * It is a handler who processes the CENTER tag.
2101 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2102 * destination is specified.
2103 * @param node [i] The CENTER tag node is specified.
2104 * @return The conversion result is returned.
2107 s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child))
2113 chtml10 = GET_CHTML10(pdoc);
2119 return chtml10->out;
2124 * It is a handler who processes the HR tag.
2126 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2127 * destination is specified.
2128 * @param node [i] The HR tag node is specified.
2129 * @return The conversion result is returned.
2132 s_chtml10_start_hr_tag(void* pdoc, Node* node)
2139 chtml10 = GET_CHTML10(pdoc);
2145 for (attr = qs_get_attr(doc,node);
2147 attr = qs_get_next_attr(doc,attr)) {
2152 name = qs_get_attr_name (doc,attr);
2153 value = qs_get_attr_value(doc,attr);
2158 if (strcasecmp(name, "align") == 0) {
2159 /*--------------------------------------------------------------------*/
2161 /*--------------------------------------------------------------------*/
2162 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2172 if (strcasecmp(name, "size") == 0) {
2173 /*--------------------------------------------------------------------*/
2175 /*--------------------------------------------------------------------*/
2176 if (value && value[0] != '\0') {
2186 if (strcasecmp(name, "width") == 0) {
2187 /*--------------------------------------------------------------------*/
2189 /*--------------------------------------------------------------------*/
2190 if (value && value[0] != '\0') {
2200 if (strcasecmp(name, "noshade") == 0) {
2201 /*--------------------------------------------------------------------*/
2203 /*--------------------------------------------------------------------*/
2210 if (strcasecmp(name, "color") == 0) {
2211 /*--------------------------------------------------------------------*/
2213 /*--------------------------------------------------------------------*/
2223 return chtml10->out;
2228 * It is a handler who processes the HR tag.
2230 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2231 * destination is specified.
2232 * @param node [i] The HR tag node is specified.
2233 * @return The conversion result is returned.
2236 s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child))
2240 chtml10 = GET_CHTML10(pdoc);
2242 return chtml10->out;
2247 * It is a handler who processes the IMG tag.
2249 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2250 * destination is specified.
2251 * @param node [i] The IMG tag node is specified.
2252 * @return The conversion result is returned.
2255 s_chtml10_start_img_tag(void* pdoc, Node* node)
2261 #ifndef IMG_NOT_CONVERT_FILENAME
2265 chtml10 = GET_CHTML10(pdoc);
2266 #ifndef IMG_NOT_CONVERT_FILENAME
2267 spec = chtml10->spec;
2273 /*--------------------------------------------------------------------------*/
2274 /* Get Attributes */
2275 /*--------------------------------------------------------------------------*/
2276 for (attr = qs_get_attr(doc,node);
2278 attr = qs_get_next_attr(doc,attr)) {
2283 name = qs_get_attr_name (doc,attr);
2284 value = qs_get_attr_value(doc,attr);
2289 if (strcasecmp(name, "src") == 0) {
2290 /*--------------------------------------------------------------------*/
2292 /*--------------------------------------------------------------------*/
2293 #ifdef IMG_NOT_CONVERT_FILENAME
2294 value = chxj_encoding_parameter(r, value);
2295 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2297 value = apr_psprintf(doc->buf.pool,
2300 (strchr(value, '?')) ? '&' : '?',
2301 CHXJ_COOKIE_NOUPDATE_PARAM);
2307 value = chxj_img_conv(r, spec, value);
2308 value = chxj_encoding_parameter(r, value);
2309 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2311 value = apr_psprintf(doc->buf.pool,
2314 (strchr(value, '?')) ? '&' : '?',
2315 CHXJ_COOKIE_NOUPDATE_PARAM);
2326 if (strcasecmp(name, "align" ) == 0) {
2327 /*--------------------------------------------------------------------*/
2329 /*--------------------------------------------------------------------*/
2330 /*--------------------------------------------------------------------*/
2332 /*--------------------------------------------------------------------*/
2333 if (value && (STRCASEEQ('t','T',"top", value) ||
2334 STRCASEEQ('m','M',"middle",value) ||
2335 STRCASEEQ('b','B',"bottom",value) ||
2336 STRCASEEQ('l','L',"left", value) ||
2337 STRCASEEQ('r','R',"right", value))) {
2343 else if (strcasecmp(name, "alt" ) == 0) {
2344 /*--------------------------------------------------------------------*/
2346 /*--------------------------------------------------------------------*/
2347 if (value && value[0] != '\0') {
2357 if (strcasecmp(name, "width" ) == 0) {
2358 /*--------------------------------------------------------------------*/
2360 /*--------------------------------------------------------------------*/
2361 if (value && value[0] != '\0') {
2371 if (strcasecmp(name, "height") == 0) {
2372 /*--------------------------------------------------------------------*/
2374 /*--------------------------------------------------------------------*/
2375 if (value && value[0] != '\0') {
2376 W10_L(" height=\"");
2382 if (strcasecmp(name, "hspace") == 0) {
2383 /*--------------------------------------------------------------------*/
2385 /*--------------------------------------------------------------------*/
2386 if (value && value[0] != '\0') {
2387 W10_L(" hspace=\"");
2396 if (strcasecmp(name, "vspace") == 0) {
2397 /*--------------------------------------------------------------------*/
2399 /*--------------------------------------------------------------------*/
2400 if (value && value[0] != '\0') {
2401 W10_L(" vspace=\"");
2414 return chtml10->out;
2419 * It is a handler who processes the IMG tag.
2421 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2422 * destination is specified.
2423 * @param node [i] The IMG tag node is specified.
2424 * @return The conversion result is returned.
2427 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2431 chtml10 = GET_CHTML10(pdoc);
2433 return chtml10->out;
2438 * It is a handler who processes the SELECT tag.
2440 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2441 * destination is specified.
2442 * @param node [i] The SELECT tag node is specified.
2443 * @return The conversion result is returned.
2446 s_chtml10_start_select_tag(void *pdoc, Node *child)
2456 chtml10 = GET_CHTML10(pdoc);
2464 for (attr = qs_get_attr(doc,child);
2466 attr = qs_get_next_attr(doc,attr)) {
2470 nm = qs_get_attr_name (doc,attr);
2471 val = qs_get_attr_value(doc,attr);
2476 if (strcasecmp(nm, "size") == 0) {
2477 /*--------------------------------------------------------------------*/
2478 /* CHTML 1.0 version 2.0 */
2479 /*--------------------------------------------------------------------*/
2480 size = apr_pstrdup(doc->buf.pool, val);
2486 if (strcasecmp(nm, "name") == 0) {
2487 /*--------------------------------------------------------------------*/
2488 /* CHTML 1.0 version 2.0 */
2489 /*--------------------------------------------------------------------*/
2490 name = apr_pstrdup(doc->buf.pool, val);
2496 if (strcasecmp(nm, "multiple") == 0) {
2497 /*--------------------------------------------------------------------*/
2498 /* CHTML 1.0 version 2.0 */
2499 /*--------------------------------------------------------------------*/
2509 if (size && *size != 0) {
2515 if (name && *name != 0) {
2522 return chtml10->out;
2527 * It is a handler who processes the SELECT tag.
2529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2530 * destination is specified.
2531 * @param node [i] The SELECT tag node is specified.
2532 * @return The conversion result is returned.
2535 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2541 chtml10 = GET_CHTML10(pdoc);
2546 return chtml10->out;
2551 * It is a handler who processes the OPTION tag.
2553 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2554 * destination is specified.
2555 * @param node [i] The OPTION tag node is specified.
2556 * @return The conversion result is returned.
2559 s_chtml10_start_option_tag(void *pdoc, Node *child)
2569 chtml10 = GET_CHTML10(pdoc);
2578 for (attr = qs_get_attr(doc,child);
2580 attr = qs_get_next_attr(doc,attr)) {
2584 nm = qs_get_attr_name (doc,attr);
2585 val = qs_get_attr_value(doc,attr);
2590 if (strcasecmp(nm, "selected") == 0) {
2591 /*--------------------------------------------------------------------*/
2592 /* CHTML 1.0 version 2.0 */
2593 /*--------------------------------------------------------------------*/
2594 selected = apr_pstrdup(doc->buf.pool, val);
2600 if (strcasecmp(nm, "value") == 0) {
2601 /*--------------------------------------------------------------------*/
2602 /* CHTML 1.0 version 2.0 */
2603 /*--------------------------------------------------------------------*/
2604 value = apr_pstrdup(doc->buf.pool, val);
2613 if (value && *value != 0) {
2624 return chtml10->out;
2629 * It is a handler who processes the OPTION tag.
2631 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2632 * destination is specified.
2633 * @param node [i] The OPTION tag node is specified.
2634 * @return The conversion result is returned.
2637 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2641 chtml10 = GET_CHTML10(pdoc);
2645 return chtml10->out;
2650 * It is a handler who processes the DIV tag.
2652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2653 * destination is specified.
2654 * @param node [i] The DIV tag node is specified.
2655 * @return The conversion result is returned.
2658 s_chtml10_start_div_tag(void *pdoc, Node *child)
2667 chtml10 = GET_CHTML10(pdoc);
2675 for (attr = qs_get_attr(doc,child);
2677 attr = qs_get_next_attr(doc,attr)) {
2682 nm = qs_get_attr_name(doc,attr);
2683 val = qs_get_attr_value(doc,attr);
2685 if (STRCASEEQ('a','A',"align", nm)) {
2686 /*----------------------------------------------------------------------*/
2687 /* CHTML 1.0 (W3C version 3.2) */
2688 /*----------------------------------------------------------------------*/
2689 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2690 align = apr_pstrdup(doc->buf.pool, val);
2702 return chtml10->out;
2707 * It is a handler who processes the DIV tag.
2709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2710 * destination is specified.
2711 * @param node [i] The DIV tag node is specified.
2712 * @return The conversion result is returned.
2715 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2721 chtml10 = GET_CHTML10(pdoc);
2726 return chtml10->out;
2731 * It is a handler who processes the CHXJ:IF tag.
2733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2734 * destination is specified.
2735 * @param node [i] The CHXJ:IF tag node is specified.
2736 * @return The conversion result is returned.
2739 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2746 chtml10 = GET_CHTML10(pdoc);
2750 for (child = qs_get_child_node(doc, node);
2752 child = qs_get_next_node(doc, child)) {
2753 W10_V(child->otext);
2754 s_chtml10_chxjif_tag(chtml10, child);
2757 return chtml10->out;
2762 * It is a handler who processes the PRE tag.
2764 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2765 * destination is specified.
2766 * @param node [i] The PRE tag node is specified.
2767 * @return The conversion result is returned.
2770 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2776 chtml10 = GET_CHTML10(pdoc);
2780 chtml10->pre_flag++;
2782 return chtml10->out;
2787 * It is a handler who processes the PRE tag.
2789 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2790 * destination is specified.
2791 * @param node [i] The PRE tag node is specified.
2792 * @return The conversion result is returned.
2795 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2801 chtml10 = GET_CHTML10(pdoc);
2806 chtml10->pre_flag--;
2808 return chtml10->out;
2813 * It is a handler who processes the P tag.
2815 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2816 * destination is specified.
2817 * @param node [i] The P tag node is specified.
2818 * @return The conversion result is returned.
2821 s_chtml10_start_p_tag(void *pdoc, Node *node)
2829 chtml10 = GET_CHTML10(pdoc);
2834 for (attr = qs_get_attr(doc,node);
2836 attr = qs_get_next_attr(doc,attr)) {
2837 char *nm = qs_get_attr_name(doc,attr);
2838 char *val = qs_get_attr_value(doc,attr);
2839 if (STRCASEEQ('a','A',"align", nm)) {
2840 /*----------------------------------------------------------------------*/
2841 /* CHTML 1.0 (W3C version 3.2) */
2842 /*----------------------------------------------------------------------*/
2843 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2844 align = apr_pstrdup(doc->buf.pool, val);
2856 return chtml10->out;
2861 * It is a handler who processes the P tag.
2863 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2864 * destination is specified.
2865 * @param node [i] The P tag node is specified.
2866 * @return The conversion result is returned.
2869 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2875 chtml10 = GET_CHTML10(pdoc);
2880 return chtml10->out;
2885 * It is a handler who processes the TEXTARE tag.
2887 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2888 * destination is specified.
2889 * @param node [i] The TEXTAREA tag node is specified.
2890 * @return The conversion result is returned.
2893 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2900 chtml10 = GET_CHTML10(pdoc);
2905 chtml10->textarea_flag++;
2909 for (attr = qs_get_attr(doc,node);
2911 attr = qs_get_next_attr(doc,attr)) {
2916 name = qs_get_attr_name (doc,attr);
2917 value = qs_get_attr_value(doc,attr);
2922 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2923 W10_L(" accesskey=\"");
2931 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2940 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2949 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2962 return chtml10->out;
2967 * It is a handler who processes the TEXTAREA tag.
2969 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2970 * destination is specified.
2971 * @param node [i] The TEXTAREA tag node is specified.
2972 * @return The conversion result is returned.
2975 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2981 chtml10 = GET_CHTML10(pdoc);
2985 W10_L("</textarea>");
2986 chtml10->textarea_flag--;
2988 return chtml10->out;
2993 s_chtml10_text(void *pdoc, Node *child)
3005 chtml10 = GET_CHTML10(pdoc);
3009 textval = qs_get_node_value(doc,child);
3010 if (strlen(textval) == 0) {
3011 return chtml10->out;
3014 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3015 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3017 tdst = qs_alloc_zero_byte_string(r);
3018 memset(one_byte, 0, sizeof(one_byte));
3021 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3025 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
3027 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3032 if (is_sjis_kanji(textval[ii])) {
3033 one_byte[0] = textval[ii+0];
3034 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3035 one_byte[0] = textval[ii+1];
3036 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3040 if (chtml10->pre_flag) {
3041 one_byte[0] = textval[ii+0];
3042 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3045 if (chtml10->textarea_flag) {
3046 one_byte[0] = textval[ii+0];
3047 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3050 if (textval[ii] != '\r' && textval[ii] != '\n') {
3051 one_byte[0] = textval[ii+0];
3052 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3057 return chtml10->out;
3062 * It is a handler who processes the BLOCKQUOTE tag.
3064 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3065 * destination is specified.
3066 * @param node [i] The BLOCKQUOTE tag node is specified.
3067 * @return The conversion result is returned.
3070 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3074 chtml10 = GET_CHTML10(pdoc);
3076 W10_L("<blockquote>");
3077 return chtml10->out;
3082 * It is a handler who processes the BLOCKQUOTE tag.
3084 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3085 * destination is specified.
3086 * @param node [i] The BLOCKQUOTE tag node is specified.
3087 * @return The conversion result is returned.
3090 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3095 chtml10 = GET_CHTML10(pdoc);
3097 W10_L("</blockquote>");
3098 return chtml10->out;
3103 * It is a handler who processes the DIR tag.
3105 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3106 * destination is specified.
3107 * @param node [i] The DIR tag node is specified.
3108 * @return The conversion result is returned.
3111 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3115 chtml10 = GET_CHTML10(pdoc);
3118 return chtml10->out;
3123 * It is a handler who processes the DIR tag.
3125 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3126 * destination is specified.
3127 * @param node [i] The DIR tag node is specified.
3128 * @return The conversion result is returned.
3131 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3136 chtml10 = GET_CHTML10(pdoc);
3139 return chtml10->out;
3144 * It is a handler who processes the DL tag.
3146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3147 * destination is specified.
3148 * @param node [i] The DL tag node is specified.
3149 * @return The conversion result is returned.
3152 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3156 chtml10 = GET_CHTML10(pdoc);
3159 return chtml10->out;
3164 * It is a handler who processes the DL tag.
3166 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3167 * destination is specified.
3168 * @param node [i] The DL tag node is specified.
3169 * @return The conversion result is returned.
3172 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3176 chtml10 = GET_CHTML10(pdoc);
3179 return chtml10->out;
3184 * It is a handter who processes the DT tag.
3186 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3187 * destination is specified.
3188 * @param node [i] The DT tag node is specified.
3189 * @return The conversion result is returned.
3192 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3196 chtml10 = GET_CHTML10(pdoc);
3199 return chtml10->out;
3204 * It is a handter who processes the DT tag.
3206 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3207 * destination is specified.
3208 * @param node [i] The DT tag node is specified.
3209 * @return The conversion result is returned.
3212 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3215 chtml10 = GET_CHTML10(pdoc);
3216 return chtml10->out;
3221 * It is a handder who processes the DD tag.
3223 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3224 * destination is specified.
3225 * @param node [i] The DD tag node is specified.
3226 * @return The conversion result is returned.
3229 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3233 chtml10 = GET_CHTML10(pdoc);
3236 return chtml10->out;
3241 * It is a handder who processes the DD tag.
3243 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3244 * destination is specified.
3245 * @param node [i] The DD tag node is specified.
3246 * @return The conversion result is returned.
3249 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3252 chtml10 = GET_CHTML10(pdoc);
3253 return chtml10->out;
3258 * It is a hanmenuer who processes the MENU tag.
3260 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3261 * destination is specified.
3262 * @param node [i] The MENU tag node is specified.
3263 * @return The conversion result is returned.
3266 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3270 chtml10 = GET_CHTML10(pdoc);
3273 return chtml10->out;
3278 * It is a hanmenuer who processes the MENU tag.
3280 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3281 * destination is specified.
3282 * @param node [i] The MENU tag node is specified.
3283 * @return The conversion result is returned.
3286 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3288 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3289 Doc *doc = chtml10->doc;
3291 return chtml10->out;
3296 * It is a hanplaintexter who processes the PLAINTEXT tag.
3298 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3299 * destination is specified.
3300 * @param node [i] The PLAINTEXT tag node is specified.
3301 * @return The conversion result is returned.
3304 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3309 chtml10 = GET_CHTML10(pdoc);
3311 W10_L("<plaintext>");
3312 s_chtml10_start_plaintext_tag_inner(pdoc,node);
3313 return chtml10->out;
3317 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3322 chtml10 = GET_CHTML10(pdoc);
3324 for (child = qs_get_child_node(doc, node);
3326 child = qs_get_next_node(doc, child)) {
3327 W10_V(child->otext);
3328 s_chtml10_start_plaintext_tag_inner(pdoc, child);
3330 return chtml10->out;
3335 * It is a hanplaintexter who processes the PLAINTEXT tag.
3337 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3338 * destination is specified.
3339 * @param node [i] The PLAINTEXT tag node is specified.
3340 * @return The conversion result is returned.
3343 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3345 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3346 return chtml10->out;