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);
104 static void s_init_chtml10(chtml10_t* chtml, Doc* doc, request_rec* r, device_table* spec);
106 static int s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
107 static char* s_chtml10_chxjif_tag (void* pdoc, Node* node);
108 static char* s_chtml10_text (void* pdoc, Node* node);
110 tag_handler chtml10_handler[] = {
113 s_chtml10_start_html_tag,
114 s_chtml10_end_html_tag,
118 s_chtml10_start_meta_tag,
119 s_chtml10_end_meta_tag,
123 s_chtml10_start_textarea_tag,
124 s_chtml10_end_textarea_tag,
128 s_chtml10_start_p_tag,
133 s_chtml10_start_pre_tag,
134 s_chtml10_end_pre_tag,
138 s_chtml10_start_ul_tag,
139 s_chtml10_end_ul_tag,
143 s_chtml10_start_li_tag,
144 s_chtml10_end_li_tag,
148 s_chtml10_start_ol_tag,
149 s_chtml10_end_ol_tag,
153 s_chtml10_start_h1_tag,
154 s_chtml10_end_h1_tag,
158 s_chtml10_start_h2_tag,
159 s_chtml10_end_h2_tag,
163 s_chtml10_start_h3_tag,
164 s_chtml10_end_h3_tag,
168 s_chtml10_start_h4_tag,
169 s_chtml10_end_h4_tag,
173 s_chtml10_start_h5_tag,
174 s_chtml10_end_h5_tag,
178 s_chtml10_start_h6_tag,
179 s_chtml10_end_h6_tag,
183 s_chtml10_start_head_tag,
184 s_chtml10_end_head_tag,
188 s_chtml10_start_title_tag,
189 s_chtml10_end_title_tag,
193 s_chtml10_start_base_tag,
194 s_chtml10_end_base_tag,
198 s_chtml10_start_body_tag,
199 s_chtml10_end_body_tag,
203 s_chtml10_start_a_tag,
208 s_chtml10_start_br_tag,
209 s_chtml10_end_br_tag,
218 s_chtml10_start_tr_tag,
219 s_chtml10_end_tr_tag,
233 s_chtml10_start_font_tag,
234 s_chtml10_end_font_tag,
238 s_chtml10_start_form_tag,
239 s_chtml10_end_form_tag,
243 s_chtml10_start_input_tag,
244 s_chtml10_end_input_tag,
248 s_chtml10_start_center_tag,
249 s_chtml10_end_center_tag,
253 s_chtml10_start_hr_tag,
254 s_chtml10_end_hr_tag,
258 s_chtml10_start_img_tag,
259 s_chtml10_end_img_tag,
263 s_chtml10_start_select_tag,
264 s_chtml10_end_select_tag,
268 s_chtml10_start_option_tag,
269 s_chtml10_end_option_tag,
273 s_chtml10_start_div_tag,
274 s_chtml10_end_div_tag,
278 s_chtml10_chxjif_tag,
323 s_chtml10_start_dt_tag,
324 s_chtml10_end_dt_tag,
338 s_chtml10_start_blockquote_tag,
339 s_chtml10_end_blockquote_tag,
343 s_chtml10_start_dir_tag,
344 s_chtml10_end_dir_tag,
348 s_chtml10_start_dl_tag,
349 s_chtml10_end_dl_tag,
353 s_chtml10_start_dd_tag,
354 s_chtml10_end_dd_tag,
358 s_chtml10_start_menu_tag,
359 s_chtml10_end_menu_tag,
365 * converts from CHTML5.0 to CHTML1.0.
367 * @param r [i] Requet_rec is appointed.
368 * @param spec [i] The result of the device specification processing which
369 * was done in advance is appointed.
370 * @param src [i] The character string before the converting is appointed.
371 * @return The character string after the converting is returned.
374 chxj_exchange_chtml10(
380 chxjconvrule_entry* entryp,
393 DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
395 /*--------------------------------------------------------------------------*/
397 /*--------------------------------------------------------------------------*/
399 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
401 DBG(r,"i found qrcode xml");
404 DBG(r,"not found qrcode xml");
406 /*--------------------------------------------------------------------------*/
407 /* The CHTML structure is initialized. */
408 /*--------------------------------------------------------------------------*/
409 s_init_chtml10(&chtml10, &doc, r, spec);
410 chtml10.entryp = entryp;
411 chtml10.cookie = cookie;
413 chxj_set_content_type(r, "text/html; charset=Windows-31J");
415 /*--------------------------------------------------------------------------*/
416 /* The character string of the input is analyzed. */
417 /*--------------------------------------------------------------------------*/
418 qs_init_malloc(&doc);
419 qs_init_root_node(&doc);
421 ss = apr_pcalloc(r->pool, srclen + 1);
422 memset(ss, 0, srclen + 1);
423 memcpy(ss, src, srclen);
426 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
429 qs_parse_string(&doc,ss, strlen(ss));
431 chxj_buffered_write_init(r->pool, &doc.buf);
432 /*--------------------------------------------------------------------------*/
433 /* It converts it from CHTML to CHTML. */
434 /*--------------------------------------------------------------------------*/
435 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
436 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
437 dst = apr_pstrdup(r->pool, chtml10.out);
438 chxj_buffered_write_terminate(&doc.buf);
440 qs_all_free(&doc,QX_LOGMARK);
443 return apr_pstrdup(r->pool,ss);
446 if (strlen(dst) == 0) {
447 dst = apr_psprintf(r->pool, "\n");
449 *dstlen = strlen(dst);
452 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
455 DBG(r, "end chxj_exchange_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
462 * The CHTML structure is initialized.
464 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
465 * initialized is specified.
466 * @param doc [i] The Doc structure that should be set to the initialized
467 * HDML structure is specified.
468 * @param r [i] To use POOL, the pointer to request_rec is specified.
469 * @param spec [i] The pointer to the device_table
478 memset(doc, 0, sizeof(Doc));
479 memset(chtml10, 0, sizeof(chtml10_t));
483 chtml10->spec = spec;
484 chtml10->out = qs_alloc_zero_byte_string(r);
485 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
486 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
491 * Corresponding EMOJI to a current character-code is retrieved.
492 * The substitution character string is stored in the rslt pointer if agreeing.
494 * @param chtml10 [i] The pointer to the CHTML structure is specified.
495 * @param txt [i] The character string to want to examine whether it is
496 * EMOJI is specified.
497 * @param rslt [o] The pointer to the pointer that stores the result is
499 * @return When corresponding EMOJI exists, it returns it excluding 0.
502 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
509 spec = chtml10->spec;
515 DBG(r,"spec is NULL");
518 for (ee = chtml10->conf->emoji;
523 DBG(r,"emoji->imode is NULL");
527 if (ee->imode->string
529 && strlen(ee->imode->string) > 0
530 && *ee->imode->string == *txt
531 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
532 if (!spec || !spec->emoji_type) {
533 *rslt = apr_palloc(r->pool, 3);
534 (*rslt)[0] = ee->imode->hex1byte & 0xff;
535 (*rslt)[1] = ee->imode->hex2byte & 0xff;
537 return strlen(ee->imode->string);
548 * It is a handler who processes the HTML tag.
550 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
551 * destination is specified.
552 * @param node [i] The HTML tag node is specified.
553 * @return The conversion result is returned.
556 s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node))
562 chtml10 = GET_CHTML10(pdoc);
566 /*--------------------------------------------------------------------------*/
568 /*--------------------------------------------------------------------------*/
576 * It is a handler who processes the HTML tag.
578 * @param pdoc [i/o] The pointer to the CHTML structure at the output
579 * destination is specified.
580 * @param node [i] The HTML tag node is specified.
581 * @return The conversion result is returned.
584 s_chtml10_end_html_tag(void* pdoc, Node* UNUSED(child))
591 chtml10 = GET_CHTML10(pdoc);
602 * It is a handler who processes the META tag.
604 * @param pdoc [i/o] The pointer to the CHTML structure at the output
605 * destination is specified.
606 * @param node [i] The META tag node is specified.
607 * @return The conversion result is returned.
610 s_chtml10_start_meta_tag(void* pdoc, Node* UNUSED(node))
614 chtml10 = GET_CHTML10(pdoc);
623 * It is a handler who processes the META tag.
625 * @param pdoc [i/o] The pointer to the CHTML structure at the output
626 * destination is specified.
627 * @param node [i] The META tag node is specified.
628 * @return The conversion result is returned.
631 s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child))
635 chtml10 = GET_CHTML10(pdoc);
642 * It is a handler who processes the HEAD tag.
644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
645 * destination is specified.
646 * @param node [i] The HEAD tag node is specified.
647 * @return The conversion result is returned.
650 s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node))
656 chtml10 = GET_CHTML10(pdoc);
667 * It is a handler who processes the HEAD tag.
669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
670 * destination is specified.
671 * @param node [i] The HEAD tag node is specified.
672 * @return The conversion result is returned.
675 s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child))
681 chtml10 = GET_CHTML10(pdoc);
692 * It is a handler who processes the OL tag.
694 * @param pdoc [i/o] The pointer to the CHTML structure at the output
695 * destination is specified.
696 * @param node [i] The OL tag node is specified.
697 * @return The conversion result is returned.
700 s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node))
706 chtml10 = GET_CHTML10(pdoc);
717 * It is a handler who processes the OL tag.
719 * @param pdoc [i/o] The pointer to the CHTML structure at the output
720 * destination is specified.
721 * @param node [i] The OL tag node is specified.
722 * @return The conversion result is returned.
725 s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child))
731 chtml10 = GET_CHTML10(pdoc);
742 * It is a handler who processes the UL tag.
744 * @param pdoc [i/o] The pointer to the CHTML structure at the output
745 * destination is specified.
746 * @param node [i] The UL tag node is specified.
747 * @return The conversion result is returned.
750 s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node))
756 chtml10 = GET_CHTML10(pdoc);
767 * It is a handler who processes the UL tag.
769 * @param pdoc [i/o] The pointer to the CHTML structure at the output
770 * destination is specified.
771 * @param node [i] The UL tag node is specified.
772 * @return The conversion result is returned.
775 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
781 chtml10 = GET_CHTML10(pdoc);
792 * It is a handler who processes the LI tag.
794 * @param pdoc [i/o] The pointer to the CHTML structure at the output
795 * destination is specified.
796 * @param node [i] The LI tag node is specified.
797 * @return The conversion result is returned.
800 s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node))
806 chtml10 = GET_CHTML10(pdoc);
817 * It is a handler who processes the LI tag.
819 * @param pdoc [i/o] The pointer to the CHTML structure at the output
820 * destination is specified.
821 * @param node [i] The LI tag node is specified.
822 * @return The conversion result is returned.
825 s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child))
828 chtml10 = GET_CHTML10(pdoc);
834 * It is a handler who processes the H1 tag.
836 * @param pdoc [i/o] The pointer to the CHTML structure at the output
837 * destination is specified.
838 * @param node [i] The H1 tag node is specified.
839 * @return The conversion result is returned.
842 s_chtml10_start_h1_tag(void* pdoc, Node* node)
849 chtml10 = GET_CHTML10(pdoc);
854 for (attr = qs_get_attr(doc,node);
856 attr = qs_get_next_attr(doc,attr)) {
859 name = qs_get_attr_name(doc,attr);
860 value = qs_get_attr_value(doc,attr);
861 if (STRCASEEQ('a','A',"align", name)) {
862 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
877 * It is a handler who processes the H1 tag.
879 * @param pdoc [i/o] The pointer to the CHTML structure at the output
880 * destination is specified.
881 * @param node [i] The H1 tag node is specified.
882 * @return The conversion result is returned.
885 s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child))
891 chtml10 = GET_CHTML10(pdoc);
902 * It is a handler who processes the H2 tag.
904 * @param pdoc [i/o] The pointer to the CHTML structure at the output
905 * destination is specified.
906 * @param node [i] The H2 tag node is specified.
907 * @return The conversion result is returned.
910 s_chtml10_start_h2_tag(void *pdoc, Node *node)
917 chtml10 = GET_CHTML10(pdoc);
922 for (attr = qs_get_attr(doc,node);
924 attr = qs_get_next_attr(doc,attr)) {
927 name = qs_get_attr_name(doc,attr);
928 value = qs_get_attr_value(doc,attr);
929 if (STRCASEEQ('a','A',"align", name)) {
930 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
945 * It is a handler who processes the H2 tag.
947 * @param pdoc [i/o] The pointer to the CHTML structure at the output
948 * destination is specified.
949 * @param node [i] The H2 tag node is specified.
950 * @return The conversion result is returned.
953 s_chtml10_end_h2_tag(void* pdoc, Node* UNUSED(child))
959 chtml10 = GET_CHTML10(pdoc);
970 * It is a handler who processes the H3 tag.
972 * @param pdoc [i/o] The pointer to the CHTML structure at the output
973 * destination is specified.
974 * @param node [i] The H3 tag node is specified.
975 * @return The conversion result is returned.
978 s_chtml10_start_h3_tag(void *pdoc, Node *node)
985 chtml10 = GET_CHTML10(pdoc);
990 for (attr = qs_get_attr(doc,node);
992 attr = qs_get_next_attr(doc,attr)) {
995 name = qs_get_attr_name(doc,attr);
996 value = qs_get_attr_value(doc,attr);
997 if (STRCASEEQ('a','A',"align", name)) {
998 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1008 return chtml10->out;
1013 * It is a handler who processes the H3 tag.
1015 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1016 * destination is specified.
1017 * @param node [i] The H3 tag node is specified.
1018 * @return The conversion result is returned.
1021 s_chtml10_end_h3_tag(void* pdoc, Node* UNUSED(child))
1027 chtml10 = GET_CHTML10(pdoc);
1033 return chtml10->out;
1038 * It is a handler who processes the H4 tag.
1040 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1041 * destination is specified.
1042 * @param node [i] The H4 tag node is specified.
1043 * @return The conversion result is returned.
1046 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1053 chtml10 = GET_CHTML10(pdoc);
1058 for (attr = qs_get_attr(doc,node);
1060 attr = qs_get_next_attr(doc,attr)) {
1063 name = qs_get_attr_name(doc,attr);
1064 value = qs_get_attr_value(doc,attr);
1065 if (STRCASEEQ('a','A',"align", name)) {
1066 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1076 return chtml10->out;
1081 * It is a handler who processes the H4 tag.
1083 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1084 * destination is specified.
1085 * @param node [i] The H4 tag node is specified.
1086 * @return The conversion result is returned.
1089 s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child))
1095 chtml10 = GET_CHTML10(pdoc);
1101 return chtml10->out;
1106 * It is a handler who processes the H5 tag.
1108 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1109 * destination is specified.
1110 * @param node [i] The H5 tag node is specified.
1111 * @return The conversion result is returned.
1114 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1121 chtml10 = GET_CHTML10(pdoc);
1126 for (attr = qs_get_attr(doc,node);
1128 attr = qs_get_next_attr(doc,attr)) {
1131 name = qs_get_attr_name(doc,attr);
1132 value = qs_get_attr_value(doc,attr);
1133 if (STRCASEEQ('a','A',"align", name)) {
1134 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1144 return chtml10->out;
1149 * It is a handler who processes the H5 tag.
1151 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1152 * destination is specified.
1153 * @param node [i] The H5 tag node is specified.
1154 * @return The conversion result is returned.
1157 s_chtml10_end_h5_tag(void* pdoc, Node* UNUSED(child))
1163 chtml10 = GET_CHTML10(pdoc);
1169 return chtml10->out;
1174 * It is a handler who processes the H6 tag.
1176 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1177 * destination is specified.
1178 * @param node [i] The H6 tag node is specified.
1179 * @return The conversion result is returned.
1182 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1189 chtml10 = GET_CHTML10(pdoc);
1194 for (attr = qs_get_attr(doc,node);
1196 attr = qs_get_next_attr(doc,attr)) {
1199 name = qs_get_attr_name(doc,attr);
1200 value = qs_get_attr_value(doc,attr);
1201 if (STRCASEEQ('a','A',"align", name)) {
1202 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1212 return chtml10->out;
1217 * It is a handler who processes the H6 tag.
1219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1220 * destination is specified.
1221 * @param node [i] The H6 tag node is specified.
1222 * @return The conversion result is returned.
1225 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1231 chtml10 = GET_CHTML10(pdoc);
1237 return chtml10->out;
1242 * It is a handler who processes the TITLE tag.
1244 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1245 * destination is specified.
1246 * @param node [i] The TITLE tag node is specified.
1247 * @return The conversion result is returned.
1250 s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node))
1256 chtml10 = GET_CHTML10(pdoc);
1262 return chtml10->out;
1267 * It is a handler who processes the TITLE tag.
1269 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1270 * destination is specified.
1271 * @param node [i] The TITLE tag node is specified.
1272 * @return The conversion result is returned.
1275 s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child))
1281 chtml10 = GET_CHTML10(pdoc);
1287 return chtml10->out;
1292 * It is a handler who processes the BASE tag.
1294 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1295 * destination is specified.
1296 * @param node [i] The BASE tag node is specified.
1297 * @return The conversion result is returned.
1300 s_chtml10_start_base_tag(void* pdoc, Node* node)
1307 chtml10 = GET_CHTML10(pdoc);
1313 /*--------------------------------------------------------------------------*/
1314 /* Get Attributes */
1315 /*--------------------------------------------------------------------------*/
1316 for (attr = qs_get_attr(doc,node);
1318 attr = qs_get_next_attr(doc,attr)) {
1322 name = qs_get_attr_name(doc,attr);
1323 value = qs_get_attr_value(doc,attr);
1325 if (STRCASEEQ('h','H',"href", name)) {
1334 return chtml10->out;
1339 * It is a handler who processes the BASE tag.
1341 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1342 * destination is specified.
1343 * @param node [i] The BASE tag node is specified.
1344 * @return The conversion result is returned.
1347 s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child))
1349 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1351 return chtml10->out;
1356 * It is a handler who processes the BODY tag.
1358 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1359 * destination is specified.
1360 * @param node [i] The BODY tag node is specified.
1361 * @return The conversion result is returned.
1364 s_chtml10_start_body_tag(void* pdoc, Node* node)
1371 chtml10 = GET_CHTML10(pdoc);
1378 /*--------------------------------------------------------------------------*/
1379 /* Get Attributes */
1380 /*--------------------------------------------------------------------------*/
1381 for (attr = qs_get_attr(doc,node);
1383 attr = qs_get_next_attr(doc,attr)) {
1387 name = qs_get_attr_name(doc,attr);
1392 if (strcasecmp(name, "alink") == 0) {
1393 /*----------------------------------------------------------------------*/
1395 /*----------------------------------------------------------------------*/
1402 if (strcasecmp(name, "bgcolor") == 0) {
1403 /*----------------------------------------------------------------------*/
1405 /*----------------------------------------------------------------------*/
1412 if (strcasecmp(name, "text") == 0) {
1413 /*----------------------------------------------------------------------*/
1415 /*----------------------------------------------------------------------*/
1422 if (strcasecmp(name, "link") == 0) {
1423 /*----------------------------------------------------------------------*/
1425 /*----------------------------------------------------------------------*/
1432 if (strcasecmp(name, "vlink") == 0) {
1433 /*----------------------------------------------------------------------*/
1435 /*----------------------------------------------------------------------*/
1447 return chtml10->out;
1452 * It is a handler who processes the BODY tag.
1454 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1455 * destination is specified.
1456 * @param node [i] The BODY tag node is specified.
1457 * @return The conversion result is returned.
1460 s_chtml10_end_body_tag(void* pdoc, Node* UNUSED(child))
1466 chtml10 = GET_CHTML10(pdoc);
1472 return chtml10->out;
1477 * It is a handler who processes the A tag.
1479 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1480 * destination is specified.
1481 * @param node [i] The A tag node is specified.
1482 * @return The conversion result is returned.
1485 s_chtml10_start_a_tag(void *pdoc, Node *node)
1492 chtml10 = GET_CHTML10(pdoc);
1498 /*--------------------------------------------------------------------------*/
1499 /* Get Attributes */
1500 /*--------------------------------------------------------------------------*/
1501 for (attr = qs_get_attr(doc,node);
1503 attr = qs_get_next_attr(doc,attr)) {
1508 name = qs_get_attr_name(doc,attr);
1509 value = qs_get_attr_value(doc,attr);
1514 if (strcasecmp(name, "name") == 0) {
1515 /*--------------------------------------------------------------------*/
1517 /*--------------------------------------------------------------------*/
1526 if (strcasecmp(name, "href") == 0) {
1527 /*--------------------------------------------------------------------*/
1529 /*--------------------------------------------------------------------*/
1530 value = chxj_encoding_parameter(r, value);
1531 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1540 if (strcasecmp(name, "accesskey") == 0) {
1541 /*--------------------------------------------------------------------*/
1543 /*--------------------------------------------------------------------*/
1544 W10_L(" accesskey=\"");
1552 if (strcasecmp(name, "cti") == 0) {
1553 /*--------------------------------------------------------------------*/
1555 /*--------------------------------------------------------------------*/
1562 if (strcasecmp(name, "utn") == 0) {
1563 /*--------------------------------------------------------------------*/
1565 /*--------------------------------------------------------------------*/
1572 if (strcasecmp(name, "telbook") == 0) {
1573 /*--------------------------------------------------------------------*/
1575 /*--------------------------------------------------------------------*/
1582 if (strcasecmp(name, "kana") == 0) {
1583 /*--------------------------------------------------------------------*/
1585 /*--------------------------------------------------------------------*/
1592 if (strcasecmp(name, "email") == 0) {
1593 /*--------------------------------------------------------------------*/
1595 /*--------------------------------------------------------------------*/
1602 if (strcasecmp(name, "ista") == 0) {
1603 /*--------------------------------------------------------------------*/
1605 /*--------------------------------------------------------------------*/
1609 if (strcasecmp(name, "ilet") == 0) {
1610 /*--------------------------------------------------------------------*/
1612 /*--------------------------------------------------------------------*/
1616 if (strcasecmp(name, "iswf") == 0) {
1617 /*--------------------------------------------------------------------*/
1619 /*--------------------------------------------------------------------*/
1623 if (strcasecmp(name, "irst") == 0) {
1624 /*--------------------------------------------------------------------*/
1626 /*--------------------------------------------------------------------*/
1630 if (strcasecmp(name, "ijam") == 0) {
1631 /*--------------------------------------------------------------------*/
1633 /*--------------------------------------------------------------------*/
1644 return chtml10->out;
1649 * It is a handler who processes the A tag.
1651 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1652 * destination is specified.
1653 * @param node [i] The A tag node is specified.
1654 * @return The conversion result is returned.
1657 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1663 chtml10 = GET_CHTML10(pdoc);
1668 return chtml10->out;
1673 * It is a handler who processes the BR tag.
1675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1676 * destination is specified.
1677 * @param node [i] The BR tag node is specified.
1678 * @return The conversion result is returned.
1681 s_chtml10_start_br_tag(void *pdoc, Node *node)
1688 chtml10 = GET_CHTML10(pdoc);
1694 /*--------------------------------------------------------------------------*/
1695 /* Get Attributes */
1696 /*--------------------------------------------------------------------------*/
1697 for (attr = qs_get_attr(doc,node);
1699 attr = qs_get_next_attr(doc,attr)) {
1703 name = qs_get_attr_name(doc,attr);
1704 value = qs_get_attr_value(doc,attr);
1706 if (STRCASEEQ('c','C',"clear",name)) {
1707 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1715 return chtml10->out;
1720 * It is a handler who processes the BR tag.
1722 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1723 * destination is specified.
1724 * @param node [i] The BR tag node is specified.
1725 * @return The conversion result is returned.
1728 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1730 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1732 return chtml10->out;
1737 * It is a handler who processes the TR tag.
1739 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1740 * destination is specified.
1741 * @param node [i] The TR tag node is specified.
1742 * @return The conversion result is returned.
1745 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1747 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1749 return chtml10->out;
1754 * It is a handler who processes the TR tag.
1756 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1757 * destination is specified.
1758 * @param node [i] The TR tag node is specified.
1759 * @return The conversion result is returned.
1762 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1768 chtml10 = GET_CHTML10(pdoc);
1774 return chtml10->out;
1779 * It is a handler who processes the FONT tag.
1781 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1782 * destination is specified.
1783 * @param node [i] The FONT tag node is specified.
1784 * @return The conversion result is returned.
1787 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1789 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1793 return chtml10->out;
1798 * It is a handler who processes the FONT tag.
1800 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1801 * destination is specified.
1802 * @param node [i] The FONT tag node is specified.
1803 * @return The conversion result is returned.
1806 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1808 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1812 return chtml10->out;
1817 * It is a handler who processes the FORM tag.
1819 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1820 * destination is specified.
1821 * @param node [i] The FORM tag node is specified.
1822 * @return The conversion result is returned.
1825 s_chtml10_start_form_tag(void *pdoc, Node *node)
1832 chtml10 = GET_CHTML10(pdoc);
1838 /*--------------------------------------------------------------------------*/
1839 /* Get Attributes */
1840 /*--------------------------------------------------------------------------*/
1841 for (attr = qs_get_attr(doc,node);
1843 attr = qs_get_next_attr(doc,attr)) {
1847 name = qs_get_attr_name(doc,attr);
1848 value = qs_get_attr_value(doc,attr);
1853 if (strcasecmp(name, "action") == 0) {
1854 /*--------------------------------------------------------------------*/
1856 /*--------------------------------------------------------------------*/
1857 value = chxj_encoding_parameter(r, value);
1858 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1860 W10_L(" action=\"");
1868 if (strcasecmp(name, "method") == 0) {
1869 /*--------------------------------------------------------------------*/
1871 /*--------------------------------------------------------------------*/
1872 W10_L(" method=\"");
1880 if (strcasecmp(name, "utn") == 0) {
1881 /*--------------------------------------------------------------------*/
1883 /*--------------------------------------------------------------------*/
1895 return chtml10->out;
1900 * It is a handler who processes the FORM tag.
1902 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1903 * destination is specified.
1904 * @param node [i] The FORM tag node is specified.
1905 * @return The conversion result is returned.
1908 s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child))
1914 chtml10 = GET_CHTML10(pdoc);
1920 return chtml10->out;
1925 * It is a handler who processes the INPUT tag.
1927 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1928 * destination is specified.
1929 * @param node [i] The INPUT tag node is specified.
1930 * @return The conversion result is returned.
1933 s_chtml10_start_input_tag(void* pdoc, Node* node)
1947 chtml10 = GET_CHTML10(pdoc);
1962 /*--------------------------------------------------------------------------*/
1963 /* Get Attributes */
1964 /*--------------------------------------------------------------------------*/
1966 type = qs_get_type_attr(doc, node, r);
1967 name = qs_get_name_attr(doc, node, r);
1968 value = qs_get_value_attr(doc,node,r);
1969 istyle = qs_get_istyle_attr(doc,node,r);
1970 max_length = qs_get_maxlength_attr(doc,node,r);
1971 checked = qs_get_checked_attr(doc,node,r);
1972 accesskey = qs_get_accesskey_attr(doc, node, r);
1973 size = qs_get_size_attr(doc, node, r);
1976 type = qs_trim_string(doc->buf.pool, type);
1977 if (type && (STRCASEEQ('t','T',"text", type) ||
1978 STRCASEEQ('p','P',"password",type) ||
1979 STRCASEEQ('c','C',"checkbox",type) ||
1980 STRCASEEQ('r','R',"radio", type) ||
1981 STRCASEEQ('h','H',"hidden", type) ||
1982 STRCASEEQ('s','S',"submit", type) ||
1983 STRCASEEQ('r','R',"reset", type))) {
1990 if (size && *size != 0) {
1996 if (name && *name != 0) {
2002 if (value && *value != 0) {
2008 if (accesskey && *accesskey != 0) {
2009 W10_L(" accesskey=\"");
2015 /*------------------------------------------------------------------------*/
2017 /*------------------------------------------------------------------------*/
2020 /*--------------------------------------------------------------------------*/
2021 /* The figure is default for the password. */
2022 /*--------------------------------------------------------------------------*/
2023 if (max_length && *max_length != 0) {
2024 W10_L(" maxlength=\"");
2034 return chtml10->out;
2039 * It is a handler who processes the INPUT tag.
2041 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2042 * destination is specified.
2043 * @param node [i] The INPUT tag node is specified.
2044 * @return The conversion result is returned.
2047 s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child))
2049 chtml10_t* chtml10 = GET_CHTML10(pdoc);
2051 return chtml10->out;
2056 * It is a handler who processes the CENTER tag.
2058 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2059 * destination is specified.
2060 * @param node [i] The CENTER tag node is specified.
2061 * @return The conversion result is returned.
2064 s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node))
2070 chtml10 = GET_CHTML10(pdoc);
2076 return chtml10->out;
2081 * It is a handler who processes the CENTER tag.
2083 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2084 * destination is specified.
2085 * @param node [i] The CENTER tag node is specified.
2086 * @return The conversion result is returned.
2089 s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child))
2095 chtml10 = GET_CHTML10(pdoc);
2101 return chtml10->out;
2106 * It is a handler who processes the HR tag.
2108 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2109 * destination is specified.
2110 * @param node [i] The HR tag node is specified.
2111 * @return The conversion result is returned.
2114 s_chtml10_start_hr_tag(void* pdoc, Node* node)
2121 chtml10 = GET_CHTML10(pdoc);
2127 for (attr = qs_get_attr(doc,node);
2129 attr = qs_get_next_attr(doc,attr)) {
2134 name = qs_get_attr_name (doc,attr);
2135 value = qs_get_attr_value(doc,attr);
2140 if (strcasecmp(name, "align") == 0) {
2141 /*--------------------------------------------------------------------*/
2143 /*--------------------------------------------------------------------*/
2144 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2154 if (strcasecmp(name, "size") == 0) {
2155 /*--------------------------------------------------------------------*/
2157 /*--------------------------------------------------------------------*/
2158 if (value && value[0] != '\0') {
2168 if (strcasecmp(name, "width") == 0) {
2169 /*--------------------------------------------------------------------*/
2171 /*--------------------------------------------------------------------*/
2172 if (value && value[0] != '\0') {
2182 if (strcasecmp(name, "noshade") == 0) {
2183 /*--------------------------------------------------------------------*/
2185 /*--------------------------------------------------------------------*/
2192 if (strcasecmp(name, "color") == 0) {
2193 /*--------------------------------------------------------------------*/
2195 /*--------------------------------------------------------------------*/
2205 return chtml10->out;
2210 * It is a handler who processes the HR tag.
2212 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2213 * destination is specified.
2214 * @param node [i] The HR tag node is specified.
2215 * @return The conversion result is returned.
2218 s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child))
2222 chtml10 = GET_CHTML10(pdoc);
2224 return chtml10->out;
2229 * It is a handler who processes the IMG tag.
2231 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2232 * destination is specified.
2233 * @param node [i] The IMG tag node is specified.
2234 * @return The conversion result is returned.
2237 s_chtml10_start_img_tag(void* pdoc, Node* node)
2243 #ifndef IMG_NOT_CONVERT_FILENAME
2247 chtml10 = GET_CHTML10(pdoc);
2248 #ifndef IMG_NOT_CONVERT_FILENAME
2249 spec = chtml10->spec;
2255 /*--------------------------------------------------------------------------*/
2256 /* Get Attributes */
2257 /*--------------------------------------------------------------------------*/
2258 for (attr = qs_get_attr(doc,node);
2260 attr = qs_get_next_attr(doc,attr)) {
2265 name = qs_get_attr_name (doc,attr);
2266 value = qs_get_attr_value(doc,attr);
2271 if (strcasecmp(name, "src") == 0) {
2272 /*--------------------------------------------------------------------*/
2274 /*--------------------------------------------------------------------*/
2275 #ifdef IMG_NOT_CONVERT_FILENAME
2276 value = chxj_encoding_parameter(r, value);
2277 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2279 value = apr_psprintf(doc->buf.pool,
2282 (strchr(value, '?')) ? '&' : '?',
2283 CHXJ_COOKIE_NOUPDATE_PARAM);
2289 value = chxj_img_conv(r, spec, value);
2290 value = chxj_encoding_parameter(r, value);
2291 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2293 value = apr_psprintf(doc->buf.pool,
2296 (strchr(value, '?')) ? '&' : '?',
2297 CHXJ_COOKIE_NOUPDATE_PARAM);
2308 if (strcasecmp(name, "align" ) == 0) {
2309 /*--------------------------------------------------------------------*/
2311 /*--------------------------------------------------------------------*/
2312 /*--------------------------------------------------------------------*/
2314 /*--------------------------------------------------------------------*/
2315 if (value && (STRCASEEQ('t','T',"top", value) ||
2316 STRCASEEQ('m','M',"middle",value) ||
2317 STRCASEEQ('b','B',"bottom",value) ||
2318 STRCASEEQ('l','L',"left", value) ||
2319 STRCASEEQ('r','R',"right", value))) {
2325 else if (strcasecmp(name, "alt" ) == 0) {
2326 /*--------------------------------------------------------------------*/
2328 /*--------------------------------------------------------------------*/
2329 if (value && value[0] != '\0') {
2339 if (strcasecmp(name, "width" ) == 0) {
2340 /*--------------------------------------------------------------------*/
2342 /*--------------------------------------------------------------------*/
2343 if (value && value[0] != '\0') {
2353 if (strcasecmp(name, "height") == 0) {
2354 /*--------------------------------------------------------------------*/
2356 /*--------------------------------------------------------------------*/
2357 if (value && value[0] != '\0') {
2358 W10_L(" height=\"");
2364 if (strcasecmp(name, "hspace") == 0) {
2365 /*--------------------------------------------------------------------*/
2367 /*--------------------------------------------------------------------*/
2368 if (value && value[0] != '\0') {
2369 W10_L(" hspace=\"");
2378 if (strcasecmp(name, "vspace") == 0) {
2379 /*--------------------------------------------------------------------*/
2381 /*--------------------------------------------------------------------*/
2382 if (value && value[0] != '\0') {
2383 W10_L(" vspace=\"");
2396 return chtml10->out;
2401 * It is a handler who processes the IMG tag.
2403 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2404 * destination is specified.
2405 * @param node [i] The IMG tag node is specified.
2406 * @return The conversion result is returned.
2409 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2413 chtml10 = GET_CHTML10(pdoc);
2415 return chtml10->out;
2420 * It is a handler who processes the SELECT tag.
2422 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2423 * destination is specified.
2424 * @param node [i] The SELECT tag node is specified.
2425 * @return The conversion result is returned.
2428 s_chtml10_start_select_tag(void *pdoc, Node *child)
2438 chtml10 = GET_CHTML10(pdoc);
2446 for (attr = qs_get_attr(doc,child);
2448 attr = qs_get_next_attr(doc,attr)) {
2452 nm = qs_get_attr_name (doc,attr);
2453 val = qs_get_attr_value(doc,attr);
2458 if (strcasecmp(nm, "size") == 0) {
2459 /*--------------------------------------------------------------------*/
2460 /* CHTML 1.0 version 2.0 */
2461 /*--------------------------------------------------------------------*/
2462 size = apr_pstrdup(doc->buf.pool, val);
2468 if (strcasecmp(nm, "name") == 0) {
2469 /*--------------------------------------------------------------------*/
2470 /* CHTML 1.0 version 2.0 */
2471 /*--------------------------------------------------------------------*/
2472 name = apr_pstrdup(doc->buf.pool, val);
2478 if (strcasecmp(nm, "multiple") == 0) {
2479 /*--------------------------------------------------------------------*/
2480 /* CHTML 1.0 version 2.0 */
2481 /*--------------------------------------------------------------------*/
2504 return chtml10->out;
2509 * It is a handler who processes the SELECT tag.
2511 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2512 * destination is specified.
2513 * @param node [i] The SELECT tag node is specified.
2514 * @return The conversion result is returned.
2517 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2523 chtml10 = GET_CHTML10(pdoc);
2527 W10_L("</select>\r\n");
2528 return chtml10->out;
2533 * It is a handler who processes the OPTION tag.
2535 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2536 * destination is specified.
2537 * @param node [i] The OPTION tag node is specified.
2538 * @return The conversion result is returned.
2541 s_chtml10_start_option_tag(void *pdoc, Node *child)
2551 chtml10 = GET_CHTML10(pdoc);
2560 for (attr = qs_get_attr(doc,child);
2562 attr = qs_get_next_attr(doc,attr)) {
2566 nm = qs_get_attr_name (doc,attr);
2567 val = qs_get_attr_value(doc,attr);
2572 if (strcasecmp(nm, "selected") == 0) {
2573 /*--------------------------------------------------------------------*/
2574 /* CHTML 1.0 version 2.0 */
2575 /*--------------------------------------------------------------------*/
2576 selected = apr_pstrdup(doc->buf.pool, val);
2582 if (strcasecmp(nm, "value") == 0) {
2583 /*--------------------------------------------------------------------*/
2584 /* CHTML 1.0 version 2.0 */
2585 /*--------------------------------------------------------------------*/
2586 value = apr_pstrdup(doc->buf.pool, val);
2595 if (value && *value != 0) {
2606 return chtml10->out;
2611 * It is a handler who processes the OPTION tag.
2613 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2614 * destination is specified.
2615 * @param node [i] The OPTION tag node is specified.
2616 * @return The conversion result is returned.
2619 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2623 chtml10 = GET_CHTML10(pdoc);
2627 return chtml10->out;
2632 * It is a handler who processes the DIV tag.
2634 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2635 * destination is specified.
2636 * @param node [i] The DIV tag node is specified.
2637 * @return The conversion result is returned.
2640 s_chtml10_start_div_tag(void *pdoc, Node *child)
2649 chtml10 = GET_CHTML10(pdoc);
2657 for (attr = qs_get_attr(doc,child);
2659 attr = qs_get_next_attr(doc,attr)) {
2664 nm = qs_get_attr_name(doc,attr);
2665 val = qs_get_attr_value(doc,attr);
2667 if (STRCASEEQ('a','A',"align", nm)) {
2668 /*----------------------------------------------------------------------*/
2669 /* CHTML 1.0 (W3C version 3.2) */
2670 /*----------------------------------------------------------------------*/
2671 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2672 align = apr_pstrdup(doc->buf.pool, val);
2684 return chtml10->out;
2689 * It is a handler who processes the DIV tag.
2691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2692 * destination is specified.
2693 * @param node [i] The DIV tag node is specified.
2694 * @return The conversion result is returned.
2697 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2703 chtml10 = GET_CHTML10(pdoc);
2708 return chtml10->out;
2713 * It is a handler who processes the CHXJ:IF tag.
2715 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2716 * destination is specified.
2717 * @param node [i] The CHXJ:IF tag node is specified.
2718 * @return The conversion result is returned.
2721 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2728 chtml10 = GET_CHTML10(pdoc);
2732 for (child = qs_get_child_node(doc, node);
2734 child = qs_get_next_node(doc, child)) {
2735 W10_V(child->otext);
2736 s_chtml10_chxjif_tag(chtml10, child);
2739 return chtml10->out;
2744 * It is a handler who processes the PRE tag.
2746 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2747 * destination is specified.
2748 * @param node [i] The PRE tag node is specified.
2749 * @return The conversion result is returned.
2752 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2758 chtml10 = GET_CHTML10(pdoc);
2762 chtml10->pre_flag++;
2764 return chtml10->out;
2769 * It is a handler who processes the PRE tag.
2771 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2772 * destination is specified.
2773 * @param node [i] The PRE tag node is specified.
2774 * @return The conversion result is returned.
2777 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2783 chtml10 = GET_CHTML10(pdoc);
2788 chtml10->pre_flag--;
2790 return chtml10->out;
2795 * It is a handler who processes the P tag.
2797 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2798 * destination is specified.
2799 * @param node [i] The P tag node is specified.
2800 * @return The conversion result is returned.
2803 s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
2809 chtml10 = GET_CHTML10(pdoc);
2814 return chtml10->out;
2819 * It is a handler who processes the P tag.
2821 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2822 * destination is specified.
2823 * @param node [i] The P tag node is specified.
2824 * @return The conversion result is returned.
2827 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2833 chtml10 = GET_CHTML10(pdoc);
2838 return chtml10->out;
2843 * It is a handler who processes the TEXTARE tag.
2845 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2846 * destination is specified.
2847 * @param node [i] The TEXTAREA tag node is specified.
2848 * @return The conversion result is returned.
2851 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2858 chtml10 = GET_CHTML10(pdoc);
2863 chtml10->textarea_flag++;
2865 W10_L("<textarea ");
2867 for (attr = qs_get_attr(doc,node);
2869 attr = qs_get_next_attr(doc,attr)) {
2874 name = qs_get_attr_name (doc,attr);
2875 value = qs_get_attr_value(doc,attr);
2880 if (strcasecmp(name, "name") == 0) {
2889 if (strcasecmp(name, "rows") == 0) {
2898 if (strcasecmp(name, "cols") == 0) {
2911 return chtml10->out;
2916 * It is a handler who processes the TEXTAREA tag.
2918 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2919 * destination is specified.
2920 * @param node [i] The TEXTAREA tag node is specified.
2921 * @return The conversion result is returned.
2924 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2930 chtml10 = GET_CHTML10(pdoc);
2934 W10_L("</textarea>\r\n");
2935 chtml10->textarea_flag--;
2937 return chtml10->out;
2942 s_chtml10_text(void *pdoc, Node *child)
2954 chtml10 = GET_CHTML10(pdoc);
2958 textval = qs_get_node_value(doc,child);
2959 textval = qs_trim_string(doc->buf.pool, textval);
2961 if (strlen(textval) == 0)
2962 return chtml10->out;
2964 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2965 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2967 tdst = qs_alloc_zero_byte_string(r);
2968 memset(one_byte, 0, sizeof(one_byte));
2971 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2975 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2977 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2982 if (is_sjis_kanji(textval[ii])) {
2983 one_byte[0] = textval[ii+0];
2984 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2985 one_byte[0] = textval[ii+1];
2986 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2990 if (chtml10->pre_flag) {
2991 one_byte[0] = textval[ii+0];
2992 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2995 if (chtml10->textarea_flag) {
2996 one_byte[0] = textval[ii+0];
2997 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3000 if (textval[ii] != '\r' && textval[ii] != '\n') {
3001 one_byte[0] = textval[ii+0];
3002 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3007 return chtml10->out;
3012 * It is a handler who processes the BLOCKQUOTE tag.
3014 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3015 * destination is specified.
3016 * @param node [i] The BLOCKQUOTE tag node is specified.
3017 * @return The conversion result is returned.
3020 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3024 chtml10 = GET_CHTML10(pdoc);
3026 W10_L("<blockquote>");
3027 return chtml10->out;
3032 * It is a handler who processes the BLOCKQUOTE tag.
3034 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3035 * destination is specified.
3036 * @param node [i] The BLOCKQUOTE tag node is specified.
3037 * @return The conversion result is returned.
3040 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3045 chtml10 = GET_CHTML10(pdoc);
3047 W10_L("</blockquote>");
3048 return chtml10->out;
3053 * It is a handler who processes the DIR tag.
3055 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3056 * destination is specified.
3057 * @param node [i] The DIR tag node is specified.
3058 * @return The conversion result is returned.
3061 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3065 chtml10 = GET_CHTML10(pdoc);
3068 return chtml10->out;
3073 * It is a handler who processes the DIR tag.
3075 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3076 * destination is specified.
3077 * @param node [i] The DIR tag node is specified.
3078 * @return The conversion result is returned.
3081 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3086 chtml10 = GET_CHTML10(pdoc);
3089 return chtml10->out;
3094 * It is a handler who processes the DL tag.
3096 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3097 * destination is specified.
3098 * @param node [i] The DL tag node is specified.
3099 * @return The conversion result is returned.
3102 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3106 chtml10 = GET_CHTML10(pdoc);
3109 return chtml10->out;
3114 * It is a handler who processes the DL tag.
3116 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3117 * destination is specified.
3118 * @param node [i] The DL tag node is specified.
3119 * @return The conversion result is returned.
3122 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3126 chtml10 = GET_CHTML10(pdoc);
3129 return chtml10->out;
3134 * It is a handter who processes the DT tag.
3136 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3137 * destination is specified.
3138 * @param node [i] The DT tag node is specified.
3139 * @return The conversion result is returned.
3142 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3146 chtml10 = GET_CHTML10(pdoc);
3149 return chtml10->out;
3154 * It is a handter who processes the DT tag.
3156 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3157 * destination is specified.
3158 * @param node [i] The DT tag node is specified.
3159 * @return The conversion result is returned.
3162 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3165 chtml10 = GET_CHTML10(pdoc);
3166 return chtml10->out;
3171 * It is a handder who processes the DD tag.
3173 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3174 * destination is specified.
3175 * @param node [i] The DD tag node is specified.
3176 * @return The conversion result is returned.
3179 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3183 chtml10 = GET_CHTML10(pdoc);
3186 return chtml10->out;
3191 * It is a handder who processes the DD tag.
3193 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3194 * destination is specified.
3195 * @param node [i] The DD tag node is specified.
3196 * @return The conversion result is returned.
3199 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3202 chtml10 = GET_CHTML10(pdoc);
3203 return chtml10->out;
3208 * It is a hanmenuer who processes the MENU tag.
3210 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3211 * destination is specified.
3212 * @param node [i] The MENU tag node is specified.
3213 * @return The conversion result is returned.
3216 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3220 chtml10 = GET_CHTML10(pdoc);
3223 return chtml10->out;
3228 * It is a hanmenuer who processes the MENU tag.
3230 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3231 * destination is specified.
3232 * @param node [i] The MENU tag node is specified.
3233 * @return The conversion result is returned.
3236 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3238 chtml10_t *chtml10 = GET_CHTML10(pdoc);
3239 Doc *doc = chtml10->doc;
3241 return chtml10->out;