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"
25 #define GET_CHTML10(X) ((chtml10_t*)(X))
27 static char* s_chtml10_start_html_tag (void* pdoc, Node* node);
28 static char* s_chtml10_end_html_tag (void* pdoc, Node* node);
29 static char* s_chtml10_start_meta_tag (void* pdoc, Node* node);
30 static char* s_chtml10_end_meta_tag (void* pdoc, Node* node);
31 static char* s_chtml10_start_textarea_tag (void* pdoc, Node* node);
32 static char* s_chtml10_end_textarea_tag (void* pdoc, Node* node);
33 static char* s_chtml10_start_p_tag (void* pdoc, Node* node);
34 static char* s_chtml10_end_p_tag (void* pdoc, Node* node);
35 static char* s_chtml10_start_pre_tag (void* pdoc, Node* node);
36 static char* s_chtml10_end_pre_tag (void* pdoc, Node* node);
37 static char* s_chtml10_start_ul_tag (void* pdoc, Node* node);
38 static char* s_chtml10_end_ul_tag (void* pdoc, Node* node);
39 static char* s_chtml10_start_li_tag (void* pdoc, Node* node);
40 static char* s_chtml10_end_li_tag (void* pdoc, Node* node);
41 static char* s_chtml10_start_ol_tag (void* pdoc, Node* node);
42 static char* s_chtml10_end_ol_tag (void* pdoc, Node* node);
43 static char* s_chtml10_start_h1_tag (void* pdoc, Node* node);
44 static char* s_chtml10_end_h1_tag (void* pdoc, Node* node);
45 static char* s_chtml10_start_h2_tag (void* pdoc, Node* node);
46 static char* s_chtml10_end_h2_tag (void* pdoc, Node* node);
47 static char* s_chtml10_start_h3_tag (void* pdoc, Node* node);
48 static char* s_chtml10_end_h3_tag (void* pdoc, Node* node);
49 static char* s_chtml10_start_h4_tag (void* pdoc, Node* node);
50 static char* s_chtml10_end_h4_tag (void* pdoc, Node* node);
51 static char* s_chtml10_start_h5_tag (void* pdoc, Node* node);
52 static char* s_chtml10_end_h5_tag (void* pdoc, Node* node);
53 static char* s_chtml10_start_h6_tag (void* pdoc, Node* node);
54 static char* s_chtml10_end_h6_tag (void* pdoc, Node* node);
55 static char* s_chtml10_start_head_tag (void* pdoc, Node* node);
56 static char* s_chtml10_end_head_tag (void* pdoc, Node* node);
57 static char* s_chtml10_start_title_tag (void* pdoc, Node* node);
58 static char* s_chtml10_end_title_tag (void* pdoc, Node* node);
59 static char* s_chtml10_start_base_tag (void* pdoc, Node* node);
60 static char* s_chtml10_end_base_tag (void* pdoc, Node* node);
61 static char* s_chtml10_start_body_tag (void* pdoc, Node* node);
62 static char* s_chtml10_end_body_tag (void* pdoc, Node* node);
63 static char* s_chtml10_start_a_tag (void* pdoc, Node* node);
64 static char* s_chtml10_end_a_tag (void* pdoc, Node* node);
65 static char* s_chtml10_start_br_tag (void* pdoc, Node* node);
66 static char* s_chtml10_end_br_tag (void* pdoc, Node* node);
67 static char* s_chtml10_start_tr_tag (void* pdoc, Node* node);
68 static char* s_chtml10_end_tr_tag (void* pdoc, Node* node);
69 static char* s_chtml10_start_font_tag (void* pdoc, Node* node);
70 static char* s_chtml10_end_font_tag (void* pdoc, Node* node);
71 static char* s_chtml10_start_input_tag (void* pdoc, Node* node);
72 static char* s_chtml10_end_input_tag (void* pdoc, Node* node);
73 static char* s_chtml10_start_form_tag (void* pdoc, Node* node);
74 static char* s_chtml10_end_form_tag (void* pdoc, Node* node);
75 static char* s_chtml10_start_center_tag (void* pdoc, Node* node);
76 static char* s_chtml10_end_center_tag (void* pdoc, Node* node);
77 static char* s_chtml10_start_hr_tag (void* pdoc, Node* node);
78 static char* s_chtml10_end_hr_tag (void* pdoc, Node* node);
79 static char* s_chtml10_start_img_tag (void* pdoc, Node* node);
80 static char* s_chtml10_end_img_tag (void* pdoc, Node* node);
81 static char* s_chtml10_start_select_tag (void* pdoc, Node* node);
82 static char* s_chtml10_end_select_tag (void* pdoc, Node* node);
83 static char* s_chtml10_start_option_tag (void* pdoc, Node* node);
84 static char* s_chtml10_end_option_tag (void* pdoc, Node* node);
85 static char* s_chtml10_start_div_tag (void* pdoc, Node* node);
86 static char* s_chtml10_end_div_tag (void* pdoc, Node* node);
88 static void s_init_chtml10(chtml10_t* chtml, Doc* doc, request_rec* r, device_table* spec);
90 static int s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
91 static char* s_chtml10_chxjif_tag (void* pdoc, Node* node);
92 static char* s_chtml10_text (void* pdoc, Node* node);
94 tag_handler chtml10_handler[] = {
97 s_chtml10_start_html_tag,
98 s_chtml10_end_html_tag,
102 s_chtml10_start_meta_tag,
103 s_chtml10_end_meta_tag,
107 s_chtml10_start_textarea_tag,
108 s_chtml10_end_textarea_tag,
112 s_chtml10_start_p_tag,
117 s_chtml10_start_pre_tag,
118 s_chtml10_end_pre_tag,
122 s_chtml10_start_ul_tag,
123 s_chtml10_end_ul_tag,
127 s_chtml10_start_li_tag,
128 s_chtml10_end_li_tag,
132 s_chtml10_start_ol_tag,
133 s_chtml10_end_ol_tag,
137 s_chtml10_start_h1_tag,
138 s_chtml10_end_h1_tag,
142 s_chtml10_start_h2_tag,
143 s_chtml10_end_h2_tag,
147 s_chtml10_start_h3_tag,
148 s_chtml10_end_h3_tag,
152 s_chtml10_start_h4_tag,
153 s_chtml10_end_h4_tag,
157 s_chtml10_start_h5_tag,
158 s_chtml10_end_h5_tag,
162 s_chtml10_start_h6_tag,
163 s_chtml10_end_h6_tag,
167 s_chtml10_start_head_tag,
168 s_chtml10_end_head_tag,
172 s_chtml10_start_title_tag,
173 s_chtml10_end_title_tag,
177 s_chtml10_start_base_tag,
178 s_chtml10_end_base_tag,
182 s_chtml10_start_body_tag,
183 s_chtml10_end_body_tag,
187 s_chtml10_start_a_tag,
192 s_chtml10_start_br_tag,
193 s_chtml10_end_br_tag,
202 s_chtml10_start_tr_tag,
203 s_chtml10_end_tr_tag,
217 s_chtml10_start_font_tag,
218 s_chtml10_end_font_tag,
222 s_chtml10_start_form_tag,
223 s_chtml10_end_form_tag,
227 s_chtml10_start_input_tag,
228 s_chtml10_end_input_tag,
232 s_chtml10_start_center_tag,
233 s_chtml10_end_center_tag,
237 s_chtml10_start_hr_tag,
238 s_chtml10_end_hr_tag,
242 s_chtml10_start_img_tag,
243 s_chtml10_end_img_tag,
247 s_chtml10_start_select_tag,
248 s_chtml10_end_select_tag,
252 s_chtml10_start_option_tag,
253 s_chtml10_end_option_tag,
257 s_chtml10_start_div_tag,
258 s_chtml10_end_div_tag,
262 s_chtml10_chxjif_tag,
324 * converts from CHTML5.0 to CHTML1.0.
326 * @param r [i] Requet_rec is appointed.
327 * @param spec [i] The result of the device specification processing which
328 * was done in advance is appointed.
329 * @param src [i] The character string before the converting is appointed.
330 * @return The character string after the converting is returned.
333 chxj_exchange_chtml10(
339 chxjconvrule_entry* entryp,
350 DBG1(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
352 /*--------------------------------------------------------------------------*/
354 /*--------------------------------------------------------------------------*/
356 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
358 DBG(r,"i found qrcode xml");
361 DBG(r,"not found qrcode xml");
363 /*--------------------------------------------------------------------------*/
364 /* The CHTML structure is initialized. */
365 /*--------------------------------------------------------------------------*/
366 s_init_chtml10(&chtml10, &doc, r, spec);
367 chtml10.entryp = entryp;
368 chtml10.cookie = cookie;
370 ap_set_content_type(r, "text/html; charset=Windows-31J");
372 /*--------------------------------------------------------------------------*/
373 /* The character string of the input is analyzed. */
374 /*--------------------------------------------------------------------------*/
375 qs_init_malloc(&doc);
376 qs_init_root_node(&doc);
378 ss = apr_pcalloc(r->pool, srclen + 1);
379 memset(ss, 0, srclen + 1);
380 memcpy(ss, src, srclen);
383 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
386 qs_parse_string(&doc,ss, strlen(ss));
388 /*--------------------------------------------------------------------------*/
389 /* It converts it from CHTML to CHTML. */
390 /*--------------------------------------------------------------------------*/
391 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
395 qs_all_free(&doc,QX_LOGMARK);
398 return apr_pstrdup(r->pool,ss);
400 if (strlen(dst) == 0) {
401 dst = apr_psprintf(r->pool, "\n");
403 *dstlen = strlen(dst);
406 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
409 DBG1(r, "end chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
416 * The CHTML structure is initialized.
418 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
419 * initialized is specified.
420 * @param doc [i] The Doc structure that should be set to the initialized
421 * HDML structure is specified.
422 * @param r [i] To use POOL, the pointer to request_rec is specified.
423 * @param spec [i] The pointer to the device_table
432 memset(doc, 0, sizeof(Doc));
433 memset(chtml10, 0, sizeof(chtml10_t));
437 chtml10->spec = spec;
438 chtml10->out = qs_alloc_zero_byte_string(r);
439 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
440 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
445 * Corresponding EMOJI to a current character-code is retrieved.
446 * The substitution character string is stored in the rslt pointer if agreeing.
448 * @param chtml10 [i] The pointer to the CHTML structure is specified.
449 * @param txt [i] The character string to want to examine whether it is
450 * EMOJI is specified.
451 * @param rslt [o] The pointer to the pointer that stores the result is
453 * @return When corresponding EMOJI exists, it returns it excluding 0.
456 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
463 spec = chtml10->spec;
469 DBG(r,"spec is NULL");
472 for (ee = chtml10->conf->emoji;
477 DBG(r,"emoji->imode is NULL");
481 if (ee->imode->string
483 && strlen(ee->imode->string) > 0
484 && *ee->imode->string == *txt
485 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
486 if (!spec || !spec->emoji_type) {
487 *rslt = apr_palloc(r->pool, 3);
488 (*rslt)[0] = ee->imode->hex1byte & 0xff;
489 (*rslt)[1] = ee->imode->hex2byte & 0xff;
491 return strlen(ee->imode->string);
502 * It is a handler who processes the HTML tag.
504 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
505 * destination is specified.
506 * @param node [i] The HTML tag node is specified.
507 * @return The conversion result is returned.
510 s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node))
516 chtml10 = GET_CHTML10(pdoc);
520 /*--------------------------------------------------------------------------*/
522 /*--------------------------------------------------------------------------*/
523 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
530 * It is a handler who processes the HTML tag.
532 * @param pdoc [i/o] The pointer to the CHTML structure at the output
533 * destination is specified.
534 * @param node [i] The HTML tag node is specified.
535 * @return The conversion result is returned.
538 s_chtml10_end_html_tag(void* pdoc, Node* UNUSED(child))
545 chtml10 = GET_CHTML10(pdoc);
549 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
556 * It is a handler who processes the META tag.
558 * @param pdoc [i/o] The pointer to the CHTML structure at the output
559 * destination is specified.
560 * @param node [i] The META tag node is specified.
561 * @return The conversion result is returned.
564 s_chtml10_start_meta_tag(void* pdoc, Node* UNUSED(node))
568 chtml10 = GET_CHTML10(pdoc);
577 * It is a handler who processes the META tag.
579 * @param pdoc [i/o] The pointer to the CHTML structure at the output
580 * destination is specified.
581 * @param node [i] The META tag node is specified.
582 * @return The conversion result is returned.
585 s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child))
589 chtml10 = GET_CHTML10(pdoc);
596 * It is a handler who processes the HEAD tag.
598 * @param pdoc [i/o] The pointer to the CHTML structure at the output
599 * destination is specified.
600 * @param node [i] The HEAD tag node is specified.
601 * @return The conversion result is returned.
604 s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node))
610 chtml10 = GET_CHTML10(pdoc);
614 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
621 * It is a handler who processes the HEAD tag.
623 * @param pdoc [i/o] The pointer to the CHTML structure at the output
624 * destination is specified.
625 * @param node [i] The HEAD tag node is specified.
626 * @return The conversion result is returned.
629 s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child))
635 chtml10 = GET_CHTML10(pdoc);
639 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
646 * It is a handler who processes the OL tag.
648 * @param pdoc [i/o] The pointer to the CHTML structure at the output
649 * destination is specified.
650 * @param node [i] The OL tag node is specified.
651 * @return The conversion result is returned.
654 s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node))
660 chtml10 = GET_CHTML10(pdoc);
664 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
671 * It is a handler who processes the OL tag.
673 * @param pdoc [i/o] The pointer to the CHTML structure at the output
674 * destination is specified.
675 * @param node [i] The OL tag node is specified.
676 * @return The conversion result is returned.
679 s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child))
685 chtml10 = GET_CHTML10(pdoc);
689 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
696 * It is a handler who processes the UL tag.
698 * @param pdoc [i/o] The pointer to the CHTML structure at the output
699 * destination is specified.
700 * @param node [i] The UL tag node is specified.
701 * @return The conversion result is returned.
704 s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node))
710 chtml10 = GET_CHTML10(pdoc);
714 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
721 * It is a handler who processes the UL tag.
723 * @param pdoc [i/o] The pointer to the CHTML structure at the output
724 * destination is specified.
725 * @param node [i] The UL tag node is specified.
726 * @return The conversion result is returned.
729 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
735 chtml10 = GET_CHTML10(pdoc);
739 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
746 * It is a handler who processes the LI tag.
748 * @param pdoc [i/o] The pointer to the CHTML structure at the output
749 * destination is specified.
750 * @param node [i] The LI tag node is specified.
751 * @return The conversion result is returned.
754 s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node))
760 chtml10 = GET_CHTML10(pdoc);
764 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
771 * It is a handler who processes the LI tag.
773 * @param pdoc [i/o] The pointer to the CHTML structure at the output
774 * destination is specified.
775 * @param node [i] The LI tag node is specified.
776 * @return The conversion result is returned.
779 s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child))
785 chtml10 = GET_CHTML10(pdoc);
789 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
796 * It is a handler who processes the H1 tag.
798 * @param pdoc [i/o] The pointer to the CHTML structure at the output
799 * destination is specified.
800 * @param node [i] The H1 tag node is specified.
801 * @return The conversion result is returned.
804 s_chtml10_start_h1_tag(void* pdoc, Node* UNUSED(node))
810 chtml10 = GET_CHTML10(pdoc);
814 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
821 * It is a handler who processes the H1 tag.
823 * @param pdoc [i/o] The pointer to the CHTML structure at the output
824 * destination is specified.
825 * @param node [i] The H1 tag node is specified.
826 * @return The conversion result is returned.
829 s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child))
835 chtml10 = GET_CHTML10(pdoc);
839 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
846 * It is a handler who processes the H2 tag.
848 * @param pdoc [i/o] The pointer to the CHTML structure at the output
849 * destination is specified.
850 * @param node [i] The H2 tag node is specified.
851 * @return The conversion result is returned.
854 s_chtml10_start_h2_tag(void* pdoc, Node* UNUSED(node))
860 chtml10 = GET_CHTML10(pdoc);
864 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
871 * It is a handler who processes the H2 tag.
873 * @param pdoc [i/o] The pointer to the CHTML structure at the output
874 * destination is specified.
875 * @param node [i] The H2 tag node is specified.
876 * @return The conversion result is returned.
879 s_chtml10_end_h2_tag(void* pdoc, Node* UNUSED(child))
885 chtml10 = GET_CHTML10(pdoc);
889 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
896 * It is a handler who processes the H3 tag.
898 * @param pdoc [i/o] The pointer to the CHTML structure at the output
899 * destination is specified.
900 * @param node [i] The H3 tag node is specified.
901 * @return The conversion result is returned.
904 s_chtml10_start_h3_tag(void* pdoc, Node* UNUSED(node))
910 chtml10 = GET_CHTML10(pdoc);
914 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
921 * It is a handler who processes the H3 tag.
923 * @param pdoc [i/o] The pointer to the CHTML structure at the output
924 * destination is specified.
925 * @param node [i] The H3 tag node is specified.
926 * @return The conversion result is returned.
929 s_chtml10_end_h3_tag(void* pdoc, Node* UNUSED(child))
935 chtml10 = GET_CHTML10(pdoc);
939 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
946 * It is a handler who processes the H4 tag.
948 * @param pdoc [i/o] The pointer to the CHTML structure at the output
949 * destination is specified.
950 * @param node [i] The H4 tag node is specified.
951 * @return The conversion result is returned.
954 s_chtml10_start_h4_tag(void* pdoc, Node* UNUSED(node))
960 chtml10 = GET_CHTML10(pdoc);
964 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
971 * It is a handler who processes the H4 tag.
973 * @param pdoc [i/o] The pointer to the CHTML structure at the output
974 * destination is specified.
975 * @param node [i] The H4 tag node is specified.
976 * @return The conversion result is returned.
979 s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child))
985 chtml10 = GET_CHTML10(pdoc);
989 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
996 * It is a handler who processes the H5 tag.
998 * @param pdoc [i/o] The pointer to the CHTML structure at the output
999 * destination is specified.
1000 * @param node [i] The H5 tag node is specified.
1001 * @return The conversion result is returned.
1004 s_chtml10_start_h5_tag(void* pdoc, Node* UNUSED(node))
1010 chtml10 = GET_CHTML10(pdoc);
1014 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
1016 return chtml10->out;
1021 * It is a handler who processes the H5 tag.
1023 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1024 * destination is specified.
1025 * @param node [i] The H5 tag node is specified.
1026 * @return The conversion result is returned.
1029 s_chtml10_end_h5_tag(void* pdoc, Node* UNUSED(child))
1035 chtml10 = GET_CHTML10(pdoc);
1039 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
1041 return chtml10->out;
1046 * It is a handler who processes the H6 tag.
1048 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1049 * destination is specified.
1050 * @param node [i] The H6 tag node is specified.
1051 * @return The conversion result is returned.
1054 s_chtml10_start_h6_tag(void* pdoc, Node* UNUSED(node))
1060 chtml10 = GET_CHTML10(pdoc);
1064 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1066 return chtml10->out;
1071 * It is a handler who processes the H6 tag.
1073 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1074 * destination is specified.
1075 * @param node [i] The H6 tag node is specified.
1076 * @return The conversion result is returned.
1079 s_chtml10_end_h6_tag(void* pdoc, Node* UNUSED(child))
1085 chtml10 = GET_CHTML10(pdoc);
1089 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1091 return chtml10->out;
1096 * It is a handler who processes the TITLE tag.
1098 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1099 * destination is specified.
1100 * @param node [i] The TITLE tag node is specified.
1101 * @return The conversion result is returned.
1104 s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node))
1110 chtml10 = GET_CHTML10(pdoc);
1114 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1116 return chtml10->out;
1121 * It is a handler who processes the TITLE tag.
1123 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1124 * destination is specified.
1125 * @param node [i] The TITLE tag node is specified.
1126 * @return The conversion result is returned.
1129 s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child))
1135 chtml10 = GET_CHTML10(pdoc);
1139 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1141 return chtml10->out;
1146 * It is a handler who processes the BASE tag.
1148 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1149 * destination is specified.
1150 * @param node [i] The BASE tag node is specified.
1151 * @return The conversion result is returned.
1154 s_chtml10_start_base_tag(void* pdoc, Node* node)
1161 chtml10 = GET_CHTML10(pdoc);
1166 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1168 /*--------------------------------------------------------------------------*/
1169 /* Get Attributes */
1170 /*--------------------------------------------------------------------------*/
1171 for (attr = qs_get_attr(doc,node);
1173 attr = qs_get_next_attr(doc,attr)) {
1177 name = qs_get_attr_name(doc,attr);
1178 value = qs_get_attr_value(doc,attr);
1180 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1181 chtml10->out = apr_pstrcat(r->pool,
1190 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1192 return chtml10->out;
1197 * It is a handler who processes the BASE tag.
1199 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1200 * destination is specified.
1201 * @param node [i] The BASE tag node is specified.
1202 * @return The conversion result is returned.
1205 s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child))
1207 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1209 return chtml10->out;
1214 * It is a handler who processes the BODY tag.
1216 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1217 * destination is specified.
1218 * @param node [i] The BODY tag node is specified.
1219 * @return The conversion result is returned.
1222 s_chtml10_start_body_tag(void* pdoc, Node* node)
1229 chtml10 = GET_CHTML10(pdoc);
1233 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1235 /*--------------------------------------------------------------------------*/
1236 /* Get Attributes */
1237 /*--------------------------------------------------------------------------*/
1238 for (attr = qs_get_attr(doc,node);
1240 attr = qs_get_next_attr(doc,attr)) {
1244 name = qs_get_attr_name(doc,attr);
1249 if (strcasecmp(name, "alink") == 0) {
1250 /*----------------------------------------------------------------------*/
1252 /*----------------------------------------------------------------------*/
1259 if (strcasecmp(name, "bgcolor") == 0) {
1260 /*----------------------------------------------------------------------*/
1262 /*----------------------------------------------------------------------*/
1269 if (strcasecmp(name, "text") == 0) {
1270 /*----------------------------------------------------------------------*/
1272 /*----------------------------------------------------------------------*/
1279 if (strcasecmp(name, "link") == 0) {
1280 /*----------------------------------------------------------------------*/
1282 /*----------------------------------------------------------------------*/
1289 if (strcasecmp(name, "vlink") == 0) {
1290 /*----------------------------------------------------------------------*/
1292 /*----------------------------------------------------------------------*/
1302 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1304 return chtml10->out;
1309 * It is a handler who processes the BODY tag.
1311 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1312 * destination is specified.
1313 * @param node [i] The BODY tag node is specified.
1314 * @return The conversion result is returned.
1317 s_chtml10_end_body_tag(void* pdoc, Node* UNUSED(child))
1323 chtml10 = GET_CHTML10(pdoc);
1327 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1329 return chtml10->out;
1334 * It is a handler who processes the A tag.
1336 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1337 * destination is specified.
1338 * @param node [i] The A tag node is specified.
1339 * @return The conversion result is returned.
1342 s_chtml10_start_a_tag(void* pdoc, Node* node)
1349 chtml10 = GET_CHTML10(pdoc);
1353 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1355 /*--------------------------------------------------------------------------*/
1356 /* Get Attributes */
1357 /*--------------------------------------------------------------------------*/
1358 for (attr = qs_get_attr(doc,node);
1360 attr = qs_get_next_attr(doc,attr)) {
1365 name = qs_get_attr_name(doc,attr);
1366 value = qs_get_attr_value(doc,attr);
1371 if (strcasecmp(name, "name") == 0) {
1372 /*--------------------------------------------------------------------*/
1374 /*--------------------------------------------------------------------*/
1375 chtml10->out = apr_pstrcat(r->pool,
1386 if (strcasecmp(name, "href") == 0) {
1387 /*--------------------------------------------------------------------*/
1389 /*--------------------------------------------------------------------*/
1390 value = chxj_encoding_parameter(r, value);
1391 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1393 chtml10->out = apr_pstrcat(r->pool,
1404 if (strcasecmp(name, "accesskey") == 0) {
1405 /*--------------------------------------------------------------------*/
1407 /*--------------------------------------------------------------------*/
1408 chtml10->out = apr_pstrcat(r->pool,
1419 if (strcasecmp(name, "cti") == 0) {
1420 /*--------------------------------------------------------------------*/
1422 /*--------------------------------------------------------------------*/
1429 if (strcasecmp(name, "utn") == 0) {
1430 /*--------------------------------------------------------------------*/
1432 /*--------------------------------------------------------------------*/
1439 if (strcasecmp(name, "telbook") == 0) {
1440 /*--------------------------------------------------------------------*/
1442 /*--------------------------------------------------------------------*/
1449 if (strcasecmp(name, "kana") == 0) {
1450 /*--------------------------------------------------------------------*/
1452 /*--------------------------------------------------------------------*/
1459 if (strcasecmp(name, "email") == 0) {
1460 /*--------------------------------------------------------------------*/
1462 /*--------------------------------------------------------------------*/
1469 if (strcasecmp(name, "ista") == 0) {
1470 /*--------------------------------------------------------------------*/
1472 /*--------------------------------------------------------------------*/
1476 if (strcasecmp(name, "ilet") == 0) {
1477 /*--------------------------------------------------------------------*/
1479 /*--------------------------------------------------------------------*/
1483 if (strcasecmp(name, "iswf") == 0) {
1484 /*--------------------------------------------------------------------*/
1486 /*--------------------------------------------------------------------*/
1490 if (strcasecmp(name, "irst") == 0) {
1491 /*--------------------------------------------------------------------*/
1493 /*--------------------------------------------------------------------*/
1497 if (strcasecmp(name, "ijam") == 0) {
1498 /*--------------------------------------------------------------------*/
1500 /*--------------------------------------------------------------------*/
1510 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1512 return chtml10->out;
1517 * It is a handler who processes the A tag.
1519 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1520 * destination is specified.
1521 * @param node [i] The A tag node is specified.
1522 * @return The conversion result is returned.
1525 s_chtml10_end_a_tag(void* pdoc, Node* UNUSED(child))
1531 chtml10 = GET_CHTML10(pdoc);
1535 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1537 return chtml10->out;
1542 * It is a handler who processes the BR tag.
1544 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1545 * destination is specified.
1546 * @param node [i] The BR tag node is specified.
1547 * @return The conversion result is returned.
1550 s_chtml10_start_br_tag(void* pdoc, Node* UNUSED(node))
1556 chtml10 = GET_CHTML10(pdoc);
1560 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1562 return chtml10->out;
1567 * It is a handler who processes the BR tag.
1569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1570 * destination is specified.
1571 * @param node [i] The BR tag node is specified.
1572 * @return The conversion result is returned.
1575 s_chtml10_end_br_tag(void* pdoc, Node* UNUSED(child))
1577 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1579 return chtml10->out;
1584 * It is a handler who processes the TR tag.
1586 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1587 * destination is specified.
1588 * @param node [i] The TR tag node is specified.
1589 * @return The conversion result is returned.
1592 s_chtml10_start_tr_tag(void* pdoc, Node* UNUSED(node))
1594 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1596 return chtml10->out;
1601 * It is a handler who processes the TR tag.
1603 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1604 * destination is specified.
1605 * @param node [i] The TR tag node is specified.
1606 * @return The conversion result is returned.
1609 s_chtml10_end_tr_tag(void* pdoc, Node* UNUSED(child))
1615 chtml10 = GET_CHTML10(pdoc);
1619 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1621 return chtml10->out;
1626 * It is a handler who processes the FONT tag.
1628 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1629 * destination is specified.
1630 * @param node [i] The FONT tag node is specified.
1631 * @return The conversion result is returned.
1634 s_chtml10_start_font_tag(void* pdoc, Node* UNUSED(node))
1636 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1640 return chtml10->out;
1645 * It is a handler who processes the FONT tag.
1647 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1648 * destination is specified.
1649 * @param node [i] The FONT tag node is specified.
1650 * @return The conversion result is returned.
1653 s_chtml10_end_font_tag(void* pdoc, Node* UNUSED(child))
1655 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1659 return chtml10->out;
1664 * It is a handler who processes the FORM tag.
1666 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1667 * destination is specified.
1668 * @param node [i] The FORM tag node is specified.
1669 * @return The conversion result is returned.
1672 s_chtml10_start_form_tag(void* pdoc, Node* node)
1679 chtml10 = GET_CHTML10(pdoc);
1683 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1685 /*--------------------------------------------------------------------------*/
1686 /* Get Attributes */
1687 /*--------------------------------------------------------------------------*/
1688 for (attr = qs_get_attr(doc,node);
1690 attr = qs_get_next_attr(doc,attr)) {
1694 name = qs_get_attr_name(doc,attr);
1695 value = qs_get_attr_value(doc,attr);
1700 if (strcasecmp(name, "action") == 0) {
1701 /*--------------------------------------------------------------------*/
1703 /*--------------------------------------------------------------------*/
1704 value = chxj_encoding_parameter(r, value);
1705 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1707 chtml10->out = apr_pstrcat(r->pool,
1718 if (strcasecmp(name, "method") == 0) {
1719 /*--------------------------------------------------------------------*/
1721 /*--------------------------------------------------------------------*/
1722 chtml10->out = apr_pstrcat(r->pool,
1733 if (strcasecmp(name, "utn") == 0) {
1734 /*--------------------------------------------------------------------*/
1736 /*--------------------------------------------------------------------*/
1746 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1748 return chtml10->out;
1753 * It is a handler who processes the FORM tag.
1755 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1756 * destination is specified.
1757 * @param node [i] The FORM tag node is specified.
1758 * @return The conversion result is returned.
1761 s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child))
1767 chtml10 = GET_CHTML10(pdoc);
1771 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1773 return chtml10->out;
1778 * It is a handler who processes the INPUT tag.
1780 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1781 * destination is specified.
1782 * @param node [i] The INPUT tag node is specified.
1783 * @return The conversion result is returned.
1786 s_chtml10_start_input_tag(void* pdoc, Node* node)
1800 chtml10 = GET_CHTML10(pdoc);
1813 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1815 /*--------------------------------------------------------------------------*/
1816 /* Get Attributes */
1817 /*--------------------------------------------------------------------------*/
1819 type = qs_get_type_attr(doc, node, r);
1820 name = qs_get_name_attr(doc, node, r);
1821 value = qs_get_value_attr(doc,node,r);
1822 istyle = qs_get_istyle_attr(doc,node,r);
1823 max_length = qs_get_maxlength_attr(doc,node,r);
1824 checked = qs_get_checked_attr(doc,node,r);
1825 accesskey = qs_get_accesskey_attr(doc, node, r);
1826 size = qs_get_size_attr(doc, node, r);
1829 chtml10->out = apr_pstrcat(r->pool,
1837 chtml10->out = apr_pstrcat(r->pool,
1845 chtml10->out = apr_pstrcat(r->pool,
1853 chtml10->out = apr_pstrcat(r->pool,
1861 chtml10->out = apr_pstrcat(r->pool,
1868 /*------------------------------------------------------------------------*/
1870 /*------------------------------------------------------------------------*/
1873 /*--------------------------------------------------------------------------*/
1874 /* The figure is default for the password. */
1875 /*--------------------------------------------------------------------------*/
1877 chtml10->out = apr_pstrcat(r->pool,
1885 chtml10->out = apr_pstrcat(r->pool,
1886 chtml10->out, " checked ", NULL);
1888 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1890 return chtml10->out;
1895 * It is a handler who processes the INPUT tag.
1897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1898 * destination is specified.
1899 * @param node [i] The INPUT tag node is specified.
1900 * @return The conversion result is returned.
1903 s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child))
1905 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1907 return chtml10->out;
1912 * It is a handler who processes the CENTER tag.
1914 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1915 * destination is specified.
1916 * @param node [i] The CENTER tag node is specified.
1917 * @return The conversion result is returned.
1920 s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node))
1926 chtml10 = GET_CHTML10(pdoc);
1930 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1932 return chtml10->out;
1937 * It is a handler who processes the CENTER tag.
1939 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1940 * destination is specified.
1941 * @param node [i] The CENTER tag node is specified.
1942 * @return The conversion result is returned.
1945 s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child))
1951 chtml10 = GET_CHTML10(pdoc);
1955 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1957 return chtml10->out;
1962 * It is a handler who processes the HR tag.
1964 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1965 * destination is specified.
1966 * @param node [i] The HR tag node is specified.
1967 * @return The conversion result is returned.
1970 s_chtml10_start_hr_tag(void* pdoc, Node* node)
1977 chtml10 = GET_CHTML10(pdoc);
1981 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1983 for (attr = qs_get_attr(doc,node);
1985 attr = qs_get_next_attr(doc,attr)) {
1990 name = qs_get_attr_name (doc,attr);
1991 value = qs_get_attr_value(doc,attr);
1996 if (strcasecmp(name, "align") == 0) {
1997 /*--------------------------------------------------------------------*/
1999 /*--------------------------------------------------------------------*/
2000 chtml10->out = apr_pstrcat(r->pool,
2002 " align=\"", value, "\" ", NULL);
2008 if (strcasecmp(name, "size") == 0) {
2009 /*--------------------------------------------------------------------*/
2011 /*--------------------------------------------------------------------*/
2012 chtml10->out = apr_pstrcat(r->pool,
2014 " size=\"", value, "\" ", NULL);
2020 if (strcasecmp(name, "width") == 0) {
2021 /*--------------------------------------------------------------------*/
2023 /*--------------------------------------------------------------------*/
2024 chtml10->out = apr_pstrcat(r->pool,
2026 " width=\"", value, "\" ", NULL);
2032 if (strcasecmp(name, "noshade") == 0) {
2033 /*--------------------------------------------------------------------*/
2035 /*--------------------------------------------------------------------*/
2036 chtml10->out = apr_pstrcat(r->pool,
2044 if (strcasecmp(name, "color") == 0) {
2045 /*--------------------------------------------------------------------*/
2047 /*--------------------------------------------------------------------*/
2057 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2059 return chtml10->out;
2064 * It is a handler who processes the HR tag.
2066 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2067 * destination is specified.
2068 * @param node [i] The HR tag node is specified.
2069 * @return The conversion result is returned.
2072 s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child))
2076 chtml10 = GET_CHTML10(pdoc);
2078 return chtml10->out;
2083 * It is a handler who processes the IMG tag.
2085 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2086 * destination is specified.
2087 * @param node [i] The IMG tag node is specified.
2088 * @return The conversion result is returned.
2091 s_chtml10_start_img_tag(void* pdoc, Node* node)
2097 #ifndef IMG_NOT_CONVERT_FILENAME
2101 chtml10 = GET_CHTML10(pdoc);
2102 #ifndef IMG_NOT_CONVERT_FILENAME
2103 spec = chtml10->spec;
2108 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
2111 /*--------------------------------------------------------------------------*/
2112 /* Get Attributes */
2113 /*--------------------------------------------------------------------------*/
2114 for (attr = qs_get_attr(doc,node);
2116 attr = qs_get_next_attr(doc,attr)) {
2121 name = qs_get_attr_name (doc,attr);
2122 value = qs_get_attr_value(doc,attr);
2127 if (strcasecmp(name, "src") == 0) {
2128 /*--------------------------------------------------------------------*/
2130 /*--------------------------------------------------------------------*/
2131 #ifdef IMG_NOT_CONVERT_FILENAME
2132 value = chxj_encoding_parameter(r, value);
2133 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2135 value = apr_psprintf(r->pool,
2138 (strchr(value, '?')) ? '&' : '?',
2139 CHXJ_COOKIE_NOUPDATE_PARAM);
2141 chtml10->out = apr_pstrcat(r->pool,
2142 chtml10->out, " src=\"",value,"\"", NULL);
2144 value = chxj_img_conv(r, spec, value);
2145 value = chxj_encoding_parameter(r, value);
2146 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2148 value = apr_psprintf(r->pool,
2151 (strchr(value, '?')) ? '&' : '?',
2152 CHXJ_COOKIE_NOUPDATE_PARAM);
2154 chtml10->out = apr_pstrcat(r->pool,
2155 chtml10->out, " src=\"",
2158 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2165 if (strcasecmp(name, "align" ) == 0) {
2166 /*--------------------------------------------------------------------*/
2168 /*--------------------------------------------------------------------*/
2169 /*--------------------------------------------------------------------*/
2171 /*--------------------------------------------------------------------*/
2172 chtml10->out = apr_pstrcat(r->pool,
2173 chtml10->out, " align=\"",value,"\"", NULL);
2176 if (strcasecmp(name, "alt" ) == 0) {
2177 /*--------------------------------------------------------------------*/
2179 /*--------------------------------------------------------------------*/
2180 chtml10->out = apr_pstrcat(r->pool,
2181 chtml10->out, " alt=\"",value,"\"", NULL);
2187 if (strcasecmp(name, "width" ) == 0) {
2188 /*--------------------------------------------------------------------*/
2190 /*--------------------------------------------------------------------*/
2191 chtml10->out = apr_pstrcat(r->pool,
2192 chtml10->out, " width=\"",value,"\"", NULL);
2198 if (strcasecmp(name, "height") == 0) {
2199 /*--------------------------------------------------------------------*/
2201 /*--------------------------------------------------------------------*/
2202 chtml10->out = apr_pstrcat(r->pool,
2203 chtml10->out, " height=\"",value,"\"", NULL);
2206 if (strcasecmp(name, "hspace") == 0) {
2207 /*--------------------------------------------------------------------*/
2209 /*--------------------------------------------------------------------*/
2210 chtml10->out = apr_pstrcat(r->pool,
2211 chtml10->out, " hspace=\"",value,"\"", NULL);
2217 if (strcasecmp(name, "vspace") == 0) {
2218 /*--------------------------------------------------------------------*/
2220 /*--------------------------------------------------------------------*/
2221 chtml10->out = apr_pstrcat(r->pool,
2222 chtml10->out, " vspace=\"",value,"\"", NULL);
2231 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2233 return chtml10->out;
2238 * It is a handler who processes the IMG tag.
2240 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2241 * destination is specified.
2242 * @param node [i] The IMG tag node is specified.
2243 * @return The conversion result is returned.
2246 s_chtml10_end_img_tag(void* pdoc, Node* UNUSED(child))
2250 chtml10 = GET_CHTML10(pdoc);
2252 return chtml10->out;
2257 * It is a handler who processes the SELECT tag.
2259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2260 * destination is specified.
2261 * @param node [i] The SELECT tag node is specified.
2262 * @return The conversion result is returned.
2265 s_chtml10_start_select_tag(void* pdoc, Node* child)
2275 chtml10 = GET_CHTML10(pdoc);
2282 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2283 for (attr = qs_get_attr(doc,child);
2285 attr = qs_get_next_attr(doc,attr)) {
2289 nm = qs_get_attr_name (doc,attr);
2290 val = qs_get_attr_value(doc,attr);
2295 if (strcasecmp(nm, "size") == 0) {
2296 /*--------------------------------------------------------------------*/
2297 /* CHTML 1.0 version 2.0 */
2298 /*--------------------------------------------------------------------*/
2299 size = apr_pstrdup(r->pool, val);
2305 if (strcasecmp(nm, "name") == 0) {
2306 /*--------------------------------------------------------------------*/
2307 /* CHTML 1.0 version 2.0 */
2308 /*--------------------------------------------------------------------*/
2309 name = apr_pstrdup(r->pool, val);
2315 if (strcasecmp(nm, "multiple") == 0) {
2316 /*--------------------------------------------------------------------*/
2317 /* CHTML 1.0 version 2.0 */
2318 /*--------------------------------------------------------------------*/
2329 chtml10->out = apr_pstrcat(r->pool,
2337 chtml10->out = apr_pstrcat(r->pool,
2344 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2346 return chtml10->out;
2351 * It is a handler who processes the SELECT tag.
2353 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2354 * destination is specified.
2355 * @param node [i] The SELECT tag node is specified.
2356 * @return The conversion result is returned.
2359 s_chtml10_end_select_tag(void* pdoc, Node* UNUSED(child))
2365 chtml10 = GET_CHTML10(pdoc);
2369 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2371 return chtml10->out;
2376 * It is a handler who processes the OPTION tag.
2378 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2379 * destination is specified.
2380 * @param node [i] The OPTION tag node is specified.
2381 * @return The conversion result is returned.
2384 s_chtml10_start_option_tag(void* pdoc, Node* child)
2394 chtml10 = GET_CHTML10(pdoc);
2401 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2402 for (attr = qs_get_attr(doc,child);
2404 attr = qs_get_next_attr(doc,attr)) {
2408 nm = qs_get_attr_name (doc,attr);
2409 val = qs_get_attr_value(doc,attr);
2414 if (strcasecmp(nm, "selected") == 0) {
2415 /*--------------------------------------------------------------------*/
2416 /* CHTML 1.0 version 2.0 */
2417 /*--------------------------------------------------------------------*/
2418 selected = apr_pstrdup(r->pool, val);
2424 if (strcasecmp(nm, "value") == 0) {
2425 /*--------------------------------------------------------------------*/
2426 /* CHTML 1.0 version 2.0 */
2427 /*--------------------------------------------------------------------*/
2428 value = apr_pstrdup(r->pool, val);
2438 chtml10->out = apr_pstrcat(r->pool,
2445 chtml10->out = apr_pstrcat(r->pool,
2451 chtml10->out = apr_pstrcat(r->pool,
2456 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2458 return chtml10->out;
2463 * It is a handler who processes the OPTION tag.
2465 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2466 * destination is specified.
2467 * @param node [i] The OPTION tag node is specified.
2468 * @return The conversion result is returned.
2471 s_chtml10_end_option_tag(void* pdoc, Node* UNUSED(child))
2475 chtml10 = GET_CHTML10(pdoc);
2479 return chtml10->out;
2484 * It is a handler who processes the DIV tag.
2486 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2487 * destination is specified.
2488 * @param node [i] The DIV tag node is specified.
2489 * @return The conversion result is returned.
2492 s_chtml10_start_div_tag(void* pdoc, Node* child)
2501 chtml10 = GET_CHTML10(pdoc);
2507 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2508 for (attr = qs_get_attr(doc,child);
2510 attr = qs_get_next_attr(doc,attr)) {
2515 nm = qs_get_attr_name(doc,attr);
2516 val = qs_get_attr_value(doc,attr);
2518 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2519 /*----------------------------------------------------------------------*/
2520 /* CHTML 1.0 (W3C version 3.2) */
2521 /*----------------------------------------------------------------------*/
2522 align = apr_pstrdup(r->pool, val);
2527 chtml10->out = apr_pstrcat(r->pool,
2528 chtml10->out, " align=\"", align, "\"", NULL);
2530 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2532 return chtml10->out;
2537 * It is a handler who processes the DIV tag.
2539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2540 * destination is specified.
2541 * @param node [i] The DIV tag node is specified.
2542 * @return The conversion result is returned.
2545 s_chtml10_end_div_tag(void* pdoc, Node* UNUSED(child))
2551 chtml10 = GET_CHTML10(pdoc);
2555 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2557 return chtml10->out;
2562 * It is a handler who processes the CHXJ:IF tag.
2564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2565 * destination is specified.
2566 * @param node [i] The CHXJ:IF tag node is specified.
2567 * @return The conversion result is returned.
2570 s_chtml10_chxjif_tag(void* pdoc, Node* node)
2577 chtml10 = GET_CHTML10(pdoc);
2581 for (child = qs_get_child_node(doc, node);
2583 child = qs_get_next_node(doc, child)) {
2584 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2585 s_chtml10_chxjif_tag(chtml10, child);
2588 return chtml10->out;
2593 * It is a handler who processes the PRE tag.
2595 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2596 * destination is specified.
2597 * @param node [i] The PRE tag node is specified.
2598 * @return The conversion result is returned.
2601 s_chtml10_start_pre_tag(void* pdoc, Node* UNUSED(node))
2607 chtml10 = GET_CHTML10(pdoc);
2611 chtml10->pre_flag++;
2612 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2614 return chtml10->out;
2619 * It is a handler who processes the PRE tag.
2621 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2622 * destination is specified.
2623 * @param node [i] The PRE tag node is specified.
2624 * @return The conversion result is returned.
2627 s_chtml10_end_pre_tag(void* pdoc, Node* UNUSED(child))
2633 chtml10 = GET_CHTML10(pdoc);
2637 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2638 chtml10->pre_flag--;
2640 return chtml10->out;
2645 * It is a handler who processes the P tag.
2647 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2648 * destination is specified.
2649 * @param node [i] The P tag node is specified.
2650 * @return The conversion result is returned.
2653 s_chtml10_start_p_tag(void* pdoc, Node* UNUSED(node))
2659 chtml10 = GET_CHTML10(pdoc);
2663 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2665 return chtml10->out;
2670 * It is a handler who processes the P tag.
2672 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2673 * destination is specified.
2674 * @param node [i] The P tag node is specified.
2675 * @return The conversion result is returned.
2678 s_chtml10_end_p_tag(void* pdoc, Node* UNUSED(child))
2684 chtml10 = GET_CHTML10(pdoc);
2688 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2690 return chtml10->out;
2695 * It is a handler who processes the TEXTARE tag.
2697 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2698 * destination is specified.
2699 * @param node [i] The TEXTAREA tag node is specified.
2700 * @return The conversion result is returned.
2703 s_chtml10_start_textarea_tag(void* pdoc, Node* node)
2710 chtml10 = GET_CHTML10(pdoc);
2715 chtml10->textarea_flag++;
2716 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2718 for (attr = qs_get_attr(doc,node);
2720 attr = qs_get_next_attr(doc,attr)) {
2725 name = qs_get_attr_name (doc,attr);
2726 value = qs_get_attr_value(doc,attr);
2731 if (strcasecmp(name, "name") == 0) {
2732 chtml10->out = apr_pstrcat(r->pool,
2743 if (strcasecmp(name, "rows") == 0) {
2744 chtml10->out = apr_pstrcat(r->pool,
2755 if (strcasecmp(name, "cols") == 0) {
2756 chtml10->out = apr_pstrcat(r->pool,
2770 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2772 return chtml10->out;
2777 * It is a handler who processes the TEXTAREA tag.
2779 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2780 * destination is specified.
2781 * @param node [i] The TEXTAREA tag node is specified.
2782 * @return The conversion result is returned.
2785 s_chtml10_end_textarea_tag(void* pdoc, Node* UNUSED(child))
2791 chtml10 = GET_CHTML10(pdoc);
2795 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2796 chtml10->textarea_flag--;
2798 return chtml10->out;
2803 s_chtml10_text(void* pdoc, Node* child)
2815 chtml10 = GET_CHTML10(pdoc);
2819 textval = qs_get_node_value(doc,child);
2820 textval = qs_trim_string(r, textval);
2822 if (strlen(textval) == 0)
2823 return chtml10->out;
2825 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2826 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2828 tdst = qs_alloc_zero_byte_string(r);
2829 memset(one_byte, 0, sizeof(one_byte));
2832 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2836 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2838 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2843 if (is_sjis_kanji(textval[ii])) {
2844 one_byte[0] = textval[ii+0];
2845 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2846 one_byte[0] = textval[ii+1];
2847 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2851 if (chtml10->pre_flag) {
2852 one_byte[0] = textval[ii+0];
2853 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2856 if (chtml10->textarea_flag) {
2857 one_byte[0] = textval[ii+0];
2858 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2861 if (textval[ii] != '\r' && textval[ii] != '\n') {
2862 one_byte[0] = textval[ii+0];
2863 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2867 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2869 return chtml10->out;