2 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno 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,
309 * converts from CHTML5.0 to CHTML1.0.
311 * @param r [i] Requet_rec is appointed.
312 * @param spec [i] The result of the device specification processing which
313 * was done in advance is appointed.
314 * @param src [i] The character string before the converting is appointed.
315 * @return The character string after the converting is returned.
318 chxj_exchange_chtml10(
324 chxjconvrule_entry* entryp,
335 DBG1(r, "start chxj_exchange_chtml10() cookie_id=[%s]", cookie->cookie_id);
337 /*--------------------------------------------------------------------------*/
339 /*--------------------------------------------------------------------------*/
341 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
343 DBG(r,"i found qrcode xml");
346 DBG(r,"not found qrcode xml");
348 /*--------------------------------------------------------------------------*/
349 /* The CHTML structure is initialized. */
350 /*--------------------------------------------------------------------------*/
351 s_init_chtml10(&chtml10, &doc, r, spec);
352 chtml10.entryp = entryp;
353 chtml10.cookie = cookie;
355 ap_set_content_type(r, "text/html; charset=Windows-31J");
357 /*--------------------------------------------------------------------------*/
358 /* The character string of the input is analyzed. */
359 /*--------------------------------------------------------------------------*/
360 qs_init_malloc(&doc);
361 qs_init_root_node(&doc);
363 ss = apr_pcalloc(r->pool, srclen + 1);
364 memset(ss, 0, srclen + 1);
365 memcpy(ss, src, srclen);
368 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
371 qs_parse_string(&doc,ss, strlen(ss));
373 /*--------------------------------------------------------------------------*/
374 /* It converts it from CHTML to CHTML. */
375 /*--------------------------------------------------------------------------*/
376 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
380 qs_all_free(&doc,QX_LOGMARK);
383 return apr_pstrdup(r->pool,ss);
385 if (strlen(dst) == 0) {
386 dst = apr_psprintf(r->pool, "\n");
388 *dstlen = strlen(dst);
391 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
394 DBG1(r, "end chxj_exchange_chtml10() cookie_id=[%s]", cookie->cookie_id);
401 * The CHTML structure is initialized.
403 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
404 * initialized is specified.
405 * @param doc [i] The Doc structure that should be set to the initialized
406 * HDML structure is specified.
407 * @param r [i] To use POOL, the pointer to request_rec is specified.
408 * @param spec [i] The pointer to the device_table
417 memset(doc, 0, sizeof(Doc));
418 memset(chtml10, 0, sizeof(chtml10_t));
422 chtml10->spec = spec;
423 chtml10->out = qs_alloc_zero_byte_string(r);
424 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
425 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
430 * Corresponding EMOJI to a current character-code is retrieved.
431 * The substitution character string is stored in the rslt pointer if agreeing.
433 * @param chtml10 [i] The pointer to the CHTML structure is specified.
434 * @param txt [i] The character string to want to examine whether it is
435 * EMOJI is specified.
436 * @param rslt [o] The pointer to the pointer that stores the result is
438 * @return When corresponding EMOJI exists, it returns it excluding 0.
441 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
448 spec = chtml10->spec;
454 DBG(r,"spec is NULL");
457 for (ee = chtml10->conf->emoji;
462 DBG(r,"emoji->imode is NULL");
466 if (ee->imode->string
468 && strlen(ee->imode->string) > 0
469 && *ee->imode->string == *txt
470 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
471 if (!spec || !spec->emoji_type) {
472 *rslt = apr_palloc(r->pool, 3);
473 (*rslt)[0] = ee->imode->hex1byte & 0xff;
474 (*rslt)[1] = ee->imode->hex2byte & 0xff;
476 return strlen(ee->imode->string);
487 * It is a handler who processes the HTML tag.
489 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
490 * destination is specified.
491 * @param node [i] The HTML tag node is specified.
492 * @return The conversion result is returned.
495 s_chtml10_start_html_tag(void* pdoc, Node* node)
501 chtml10 = GET_CHTML10(pdoc);
505 /*--------------------------------------------------------------------------*/
507 /*--------------------------------------------------------------------------*/
508 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
515 * It is a handler who processes the HTML tag.
517 * @param pdoc [i/o] The pointer to the CHTML structure at the output
518 * destination is specified.
519 * @param node [i] The HTML tag node is specified.
520 * @return The conversion result is returned.
523 s_chtml10_end_html_tag(void* pdoc, Node* child)
530 chtml10 = GET_CHTML10(pdoc);
534 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
541 * It is a handler who processes the META tag.
543 * @param pdoc [i/o] The pointer to the CHTML structure at the output
544 * destination is specified.
545 * @param node [i] The META tag node is specified.
546 * @return The conversion result is returned.
549 s_chtml10_start_meta_tag(void* pdoc, Node* node)
553 chtml10 = GET_CHTML10(pdoc);
562 * It is a handler who processes the META tag.
564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
565 * destination is specified.
566 * @param node [i] The META tag node is specified.
567 * @return The conversion result is returned.
570 s_chtml10_end_meta_tag(void* pdoc, Node* child)
574 chtml10 = GET_CHTML10(pdoc);
581 * It is a handler who processes the HEAD tag.
583 * @param pdoc [i/o] The pointer to the CHTML structure at the output
584 * destination is specified.
585 * @param node [i] The HEAD tag node is specified.
586 * @return The conversion result is returned.
589 s_chtml10_start_head_tag(void* pdoc, Node* node)
595 chtml10 = GET_CHTML10(pdoc);
599 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
606 * It is a handler who processes the HEAD tag.
608 * @param pdoc [i/o] The pointer to the CHTML structure at the output
609 * destination is specified.
610 * @param node [i] The HEAD tag node is specified.
611 * @return The conversion result is returned.
614 s_chtml10_end_head_tag(void* pdoc, Node* child)
620 chtml10 = GET_CHTML10(pdoc);
624 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
631 * It is a handler who processes the OL tag.
633 * @param pdoc [i/o] The pointer to the CHTML structure at the output
634 * destination is specified.
635 * @param node [i] The OL tag node is specified.
636 * @return The conversion result is returned.
639 s_chtml10_start_ol_tag(void* pdoc, Node* node)
645 chtml10 = GET_CHTML10(pdoc);
649 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
656 * It is a handler who processes the OL tag.
658 * @param pdoc [i/o] The pointer to the CHTML structure at the output
659 * destination is specified.
660 * @param node [i] The OL tag node is specified.
661 * @return The conversion result is returned.
664 s_chtml10_end_ol_tag(void* pdoc, Node* child)
670 chtml10 = GET_CHTML10(pdoc);
674 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
681 * It is a handler who processes the UL tag.
683 * @param pdoc [i/o] The pointer to the CHTML structure at the output
684 * destination is specified.
685 * @param node [i] The UL tag node is specified.
686 * @return The conversion result is returned.
689 s_chtml10_start_ul_tag(void* pdoc, Node* node)
695 chtml10 = GET_CHTML10(pdoc);
699 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
706 * It is a handler who processes the UL tag.
708 * @param pdoc [i/o] The pointer to the CHTML structure at the output
709 * destination is specified.
710 * @param node [i] The UL tag node is specified.
711 * @return The conversion result is returned.
714 s_chtml10_end_ul_tag(void* pdoc, Node* child)
720 chtml10 = GET_CHTML10(pdoc);
724 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
731 * It is a handler who processes the LI tag.
733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
734 * destination is specified.
735 * @param node [i] The LI tag node is specified.
736 * @return The conversion result is returned.
739 s_chtml10_start_li_tag(void* pdoc, Node* node)
745 chtml10 = GET_CHTML10(pdoc);
749 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
756 * It is a handler who processes the LI tag.
758 * @param pdoc [i/o] The pointer to the CHTML structure at the output
759 * destination is specified.
760 * @param node [i] The LI tag node is specified.
761 * @return The conversion result is returned.
764 s_chtml10_end_li_tag(void* pdoc, Node* child)
770 chtml10 = GET_CHTML10(pdoc);
774 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
781 * It is a handler who processes the H1 tag.
783 * @param pdoc [i/o] The pointer to the CHTML structure at the output
784 * destination is specified.
785 * @param node [i] The H1 tag node is specified.
786 * @return The conversion result is returned.
789 s_chtml10_start_h1_tag(void* pdoc, Node* node)
795 chtml10 = GET_CHTML10(pdoc);
799 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
806 * It is a handler who processes the H1 tag.
808 * @param pdoc [i/o] The pointer to the CHTML structure at the output
809 * destination is specified.
810 * @param node [i] The H1 tag node is specified.
811 * @return The conversion result is returned.
814 s_chtml10_end_h1_tag(void* pdoc, Node* child)
820 chtml10 = GET_CHTML10(pdoc);
824 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
831 * It is a handler who processes the H2 tag.
833 * @param pdoc [i/o] The pointer to the CHTML structure at the output
834 * destination is specified.
835 * @param node [i] The H2 tag node is specified.
836 * @return The conversion result is returned.
839 s_chtml10_start_h2_tag(void* pdoc, Node* node)
845 chtml10 = GET_CHTML10(pdoc);
849 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
856 * It is a handler who processes the H2 tag.
858 * @param pdoc [i/o] The pointer to the CHTML structure at the output
859 * destination is specified.
860 * @param node [i] The H2 tag node is specified.
861 * @return The conversion result is returned.
864 s_chtml10_end_h2_tag(void* pdoc, Node* child)
870 chtml10 = GET_CHTML10(pdoc);
874 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
881 * It is a handler who processes the H3 tag.
883 * @param pdoc [i/o] The pointer to the CHTML structure at the output
884 * destination is specified.
885 * @param node [i] The H3 tag node is specified.
886 * @return The conversion result is returned.
889 s_chtml10_start_h3_tag(void* pdoc, Node* node)
895 chtml10 = GET_CHTML10(pdoc);
899 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
906 * It is a handler who processes the H3 tag.
908 * @param pdoc [i/o] The pointer to the CHTML structure at the output
909 * destination is specified.
910 * @param node [i] The H3 tag node is specified.
911 * @return The conversion result is returned.
914 s_chtml10_end_h3_tag(void* pdoc, Node* child)
920 chtml10 = GET_CHTML10(pdoc);
924 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
931 * It is a handler who processes the H4 tag.
933 * @param pdoc [i/o] The pointer to the CHTML structure at the output
934 * destination is specified.
935 * @param node [i] The H4 tag node is specified.
936 * @return The conversion result is returned.
939 s_chtml10_start_h4_tag(void* pdoc, Node* node)
945 chtml10 = GET_CHTML10(pdoc);
949 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
956 * It is a handler who processes the H4 tag.
958 * @param pdoc [i/o] The pointer to the CHTML structure at the output
959 * destination is specified.
960 * @param node [i] The H4 tag node is specified.
961 * @return The conversion result is returned.
964 s_chtml10_end_h4_tag(void* pdoc, Node* child)
970 chtml10 = GET_CHTML10(pdoc);
974 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
981 * It is a handler who processes the H5 tag.
983 * @param pdoc [i/o] The pointer to the CHTML structure at the output
984 * destination is specified.
985 * @param node [i] The H5 tag node is specified.
986 * @return The conversion result is returned.
989 s_chtml10_start_h5_tag(void* pdoc, Node* node)
995 chtml10 = GET_CHTML10(pdoc);
999 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
1001 return chtml10->out;
1006 * It is a handler who processes the H5 tag.
1008 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1009 * destination is specified.
1010 * @param node [i] The H5 tag node is specified.
1011 * @return The conversion result is returned.
1014 s_chtml10_end_h5_tag(void* pdoc, Node* child)
1020 chtml10 = GET_CHTML10(pdoc);
1024 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
1026 return chtml10->out;
1031 * It is a handler who processes the H6 tag.
1033 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1034 * destination is specified.
1035 * @param node [i] The H6 tag node is specified.
1036 * @return The conversion result is returned.
1039 s_chtml10_start_h6_tag(void* pdoc, Node* node)
1045 chtml10 = GET_CHTML10(pdoc);
1049 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1051 return chtml10->out;
1056 * It is a handler who processes the H6 tag.
1058 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1059 * destination is specified.
1060 * @param node [i] The H6 tag node is specified.
1061 * @return The conversion result is returned.
1064 s_chtml10_end_h6_tag(void* pdoc, Node* child)
1070 chtml10 = GET_CHTML10(pdoc);
1074 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1076 return chtml10->out;
1081 * It is a handler who processes the TITLE tag.
1083 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1084 * destination is specified.
1085 * @param node [i] The TITLE tag node is specified.
1086 * @return The conversion result is returned.
1089 s_chtml10_start_title_tag(void* pdoc, Node* node)
1095 chtml10 = GET_CHTML10(pdoc);
1099 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1101 return chtml10->out;
1106 * It is a handler who processes the TITLE tag.
1108 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1109 * destination is specified.
1110 * @param node [i] The TITLE tag node is specified.
1111 * @return The conversion result is returned.
1114 s_chtml10_end_title_tag(void* pdoc, Node* child)
1120 chtml10 = GET_CHTML10(pdoc);
1124 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1126 return chtml10->out;
1131 * It is a handler who processes the BASE tag.
1133 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1134 * destination is specified.
1135 * @param node [i] The BASE tag node is specified.
1136 * @return The conversion result is returned.
1139 s_chtml10_start_base_tag(void* pdoc, Node* node)
1146 chtml10 = GET_CHTML10(pdoc);
1151 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1153 /*--------------------------------------------------------------------------*/
1154 /* Get Attributes */
1155 /*--------------------------------------------------------------------------*/
1156 for (attr = qs_get_attr(doc,node);
1158 attr = qs_get_next_attr(doc,attr)) {
1162 name = qs_get_attr_name(doc,attr);
1163 value = qs_get_attr_value(doc,attr);
1165 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1166 chtml10->out = apr_pstrcat(r->pool,
1175 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1177 return chtml10->out;
1182 * It is a handler who processes the BASE tag.
1184 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1185 * destination is specified.
1186 * @param node [i] The BASE tag node is specified.
1187 * @return The conversion result is returned.
1190 s_chtml10_end_base_tag(void* pdoc, Node* child)
1192 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1194 return chtml10->out;
1199 * It is a handler who processes the BODY tag.
1201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1202 * destination is specified.
1203 * @param node [i] The BODY tag node is specified.
1204 * @return The conversion result is returned.
1207 s_chtml10_start_body_tag(void* pdoc, Node* node)
1214 chtml10 = GET_CHTML10(pdoc);
1218 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1220 /*--------------------------------------------------------------------------*/
1221 /* Get Attributes */
1222 /*--------------------------------------------------------------------------*/
1223 for (attr = qs_get_attr(doc,node);
1225 attr = qs_get_next_attr(doc,attr)) {
1229 name = qs_get_attr_name(doc,attr);
1234 if (strcasecmp(name, "alink") == 0) {
1235 /*----------------------------------------------------------------------*/
1237 /*----------------------------------------------------------------------*/
1244 if (strcasecmp(name, "bgcolor") == 0) {
1245 /*----------------------------------------------------------------------*/
1247 /*----------------------------------------------------------------------*/
1254 if (strcasecmp(name, "text") == 0) {
1255 /*----------------------------------------------------------------------*/
1257 /*----------------------------------------------------------------------*/
1264 if (strcasecmp(name, "link") == 0) {
1265 /*----------------------------------------------------------------------*/
1267 /*----------------------------------------------------------------------*/
1274 if (strcasecmp(name, "vlink") == 0) {
1275 /*----------------------------------------------------------------------*/
1277 /*----------------------------------------------------------------------*/
1287 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1289 return chtml10->out;
1294 * It is a handler who processes the BODY tag.
1296 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1297 * destination is specified.
1298 * @param node [i] The BODY tag node is specified.
1299 * @return The conversion result is returned.
1302 s_chtml10_end_body_tag(void* pdoc, Node* child)
1308 chtml10 = GET_CHTML10(pdoc);
1312 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1314 return chtml10->out;
1319 * It is a handler who processes the A tag.
1321 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1322 * destination is specified.
1323 * @param node [i] The A tag node is specified.
1324 * @return The conversion result is returned.
1327 s_chtml10_start_a_tag(void* pdoc, Node* node)
1334 chtml10 = GET_CHTML10(pdoc);
1338 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1340 /*--------------------------------------------------------------------------*/
1341 /* Get Attributes */
1342 /*--------------------------------------------------------------------------*/
1343 for (attr = qs_get_attr(doc,node);
1345 attr = qs_get_next_attr(doc,attr)) {
1350 name = qs_get_attr_name(doc,attr);
1351 value = qs_get_attr_value(doc,attr);
1356 if (strcasecmp(name, "name") == 0) {
1357 /*----------------------------------------------------------------------*/
1359 /*----------------------------------------------------------------------*/
1360 chtml10->out = apr_pstrcat(r->pool,
1371 if (strcasecmp(name, "href") == 0) {
1372 /*----------------------------------------------------------------------*/
1374 /*----------------------------------------------------------------------*/
1375 value = chxj_encoding_parameter(r, value);
1376 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1378 chtml10->out = apr_pstrcat(r->pool,
1389 if (strcasecmp(name, "accesskey") == 0) {
1390 /*----------------------------------------------------------------------*/
1392 /*----------------------------------------------------------------------*/
1393 chtml10->out = apr_pstrcat(r->pool,
1404 if (strcasecmp(name, "cti") == 0) {
1405 /*----------------------------------------------------------------------*/
1407 /*----------------------------------------------------------------------*/
1414 if (strcasecmp(name, "utn") == 0) {
1415 /*----------------------------------------------------------------------*/
1417 /*----------------------------------------------------------------------*/
1424 if (strcasecmp(name, "telbook") == 0) {
1425 /*----------------------------------------------------------------------*/
1427 /*----------------------------------------------------------------------*/
1434 if (strcasecmp(name, "kana") == 0) {
1435 /*----------------------------------------------------------------------*/
1437 /*----------------------------------------------------------------------*/
1444 if (strcasecmp(name, "email") == 0) {
1445 /*----------------------------------------------------------------------*/
1447 /*----------------------------------------------------------------------*/
1454 if (strcasecmp(name, "ista") == 0) {
1455 /*----------------------------------------------------------------------*/
1457 /*----------------------------------------------------------------------*/
1461 if (strcasecmp(name, "ilet") == 0) {
1462 /*----------------------------------------------------------------------*/
1464 /*----------------------------------------------------------------------*/
1468 if (strcasecmp(name, "iswf") == 0) {
1469 /*----------------------------------------------------------------------*/
1471 /*----------------------------------------------------------------------*/
1475 if (strcasecmp(name, "irst") == 0) {
1476 /*----------------------------------------------------------------------*/
1478 /*----------------------------------------------------------------------*/
1482 if (strcasecmp(name, "ijam") == 0) {
1483 /*----------------------------------------------------------------------*/
1485 /*----------------------------------------------------------------------*/
1495 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1497 return chtml10->out;
1502 * It is a handler who processes the A tag.
1504 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1505 * destination is specified.
1506 * @param node [i] The A tag node is specified.
1507 * @return The conversion result is returned.
1510 s_chtml10_end_a_tag(void* pdoc, Node* child)
1516 chtml10 = GET_CHTML10(pdoc);
1520 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1522 return chtml10->out;
1527 * It is a handler who processes the BR tag.
1529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1530 * destination is specified.
1531 * @param node [i] The BR tag node is specified.
1532 * @return The conversion result is returned.
1535 s_chtml10_start_br_tag(void* pdoc, Node* node)
1541 chtml10 = GET_CHTML10(pdoc);
1545 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1547 return chtml10->out;
1552 * It is a handler who processes the BR tag.
1554 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1555 * destination is specified.
1556 * @param node [i] The BR tag node is specified.
1557 * @return The conversion result is returned.
1560 s_chtml10_end_br_tag(void* pdoc, Node* child)
1562 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1564 return chtml10->out;
1569 * It is a handler who processes the TR tag.
1571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1572 * destination is specified.
1573 * @param node [i] The TR tag node is specified.
1574 * @return The conversion result is returned.
1577 s_chtml10_start_tr_tag(void* pdoc, Node* node)
1579 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1581 return chtml10->out;
1586 * It is a handler who processes the TR tag.
1588 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1589 * destination is specified.
1590 * @param node [i] The TR tag node is specified.
1591 * @return The conversion result is returned.
1594 s_chtml10_end_tr_tag(void* pdoc, Node* child)
1600 chtml10 = GET_CHTML10(pdoc);
1604 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1606 return chtml10->out;
1611 * It is a handler who processes the FONT tag.
1613 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1614 * destination is specified.
1615 * @param node [i] The FONT tag node is specified.
1616 * @return The conversion result is returned.
1619 s_chtml10_start_font_tag(void* pdoc, Node* node)
1621 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1625 return chtml10->out;
1630 * It is a handler who processes the FONT tag.
1632 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1633 * destination is specified.
1634 * @param node [i] The FONT tag node is specified.
1635 * @return The conversion result is returned.
1638 s_chtml10_end_font_tag(void* pdoc, Node* child)
1640 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1644 return chtml10->out;
1649 * It is a handler who processes the FORM tag.
1651 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1652 * destination is specified.
1653 * @param node [i] The FORM tag node is specified.
1654 * @return The conversion result is returned.
1657 s_chtml10_start_form_tag(void* pdoc, Node* node)
1664 chtml10 = GET_CHTML10(pdoc);
1668 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1670 /*--------------------------------------------------------------------------*/
1671 /* Get Attributes */
1672 /*--------------------------------------------------------------------------*/
1673 for (attr = qs_get_attr(doc,node);
1675 attr = qs_get_next_attr(doc,attr)) {
1679 name = qs_get_attr_name(doc,attr);
1680 value = qs_get_attr_value(doc,attr);
1685 if (strcasecmp(name, "action") == 0) {
1686 /*----------------------------------------------------------------------*/
1688 /*----------------------------------------------------------------------*/
1689 value = chxj_encoding_parameter(r, value);
1690 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1692 chtml10->out = apr_pstrcat(r->pool,
1703 if (strcasecmp(name, "method") == 0) {
1704 /*----------------------------------------------------------------------*/
1706 /*----------------------------------------------------------------------*/
1707 chtml10->out = apr_pstrcat(r->pool,
1718 if (strcasecmp(name, "utn") == 0) {
1719 /*----------------------------------------------------------------------*/
1721 /*----------------------------------------------------------------------*/
1731 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1733 return chtml10->out;
1738 * It is a handler who processes the FORM tag.
1740 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1741 * destination is specified.
1742 * @param node [i] The FORM tag node is specified.
1743 * @return The conversion result is returned.
1746 s_chtml10_end_form_tag(void* pdoc, Node* child)
1752 chtml10 = GET_CHTML10(pdoc);
1756 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1758 return chtml10->out;
1763 * It is a handler who processes the INPUT tag.
1765 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1766 * destination is specified.
1767 * @param node [i] The INPUT tag node is specified.
1768 * @return The conversion result is returned.
1771 s_chtml10_start_input_tag(void* pdoc, Node* node)
1785 chtml10 = GET_CHTML10(pdoc);
1798 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1800 /*--------------------------------------------------------------------------*/
1801 /* Get Attributes */
1802 /*--------------------------------------------------------------------------*/
1804 type = qs_get_type_attr(doc, node, r);
1805 name = qs_get_name_attr(doc, node, r);
1806 value = qs_get_value_attr(doc,node,r);
1807 istyle = qs_get_istyle_attr(doc,node,r);
1808 max_length = qs_get_maxlength_attr(doc,node,r);
1809 checked = qs_get_checked_attr(doc,node,r);
1810 accesskey = qs_get_accesskey_attr(doc, node, r);
1811 size = qs_get_size_attr(doc, node, r);
1814 chtml10->out = apr_pstrcat(r->pool,
1822 chtml10->out = apr_pstrcat(r->pool,
1830 chtml10->out = apr_pstrcat(r->pool,
1838 chtml10->out = apr_pstrcat(r->pool,
1846 chtml10->out = apr_pstrcat(r->pool,
1853 /*------------------------------------------------------------------------*/
1855 /*------------------------------------------------------------------------*/
1858 /*--------------------------------------------------------------------------*/
1859 /* The figure is default for the password. */
1860 /*--------------------------------------------------------------------------*/
1862 chtml10->out = apr_pstrcat(r->pool,
1870 chtml10->out = apr_pstrcat(r->pool,
1871 chtml10->out, " checked ", NULL);
1873 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1875 return chtml10->out;
1880 * It is a handler who processes the INPUT tag.
1882 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1883 * destination is specified.
1884 * @param node [i] The INPUT tag node is specified.
1885 * @return The conversion result is returned.
1888 s_chtml10_end_input_tag(void* pdoc, Node* child)
1890 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1892 return chtml10->out;
1897 * It is a handler who processes the CENTER tag.
1899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1900 * destination is specified.
1901 * @param node [i] The CENTER tag node is specified.
1902 * @return The conversion result is returned.
1905 s_chtml10_start_center_tag(void* pdoc, Node* node)
1911 chtml10 = GET_CHTML10(pdoc);
1915 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1917 return chtml10->out;
1922 * It is a handler who processes the CENTER tag.
1924 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1925 * destination is specified.
1926 * @param node [i] The CENTER tag node is specified.
1927 * @return The conversion result is returned.
1930 s_chtml10_end_center_tag(void* pdoc, Node* child)
1936 chtml10 = GET_CHTML10(pdoc);
1940 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1942 return chtml10->out;
1947 * It is a handler who processes the HR tag.
1949 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1950 * destination is specified.
1951 * @param node [i] The HR tag node is specified.
1952 * @return The conversion result is returned.
1955 s_chtml10_start_hr_tag(void* pdoc, Node* node)
1962 chtml10 = GET_CHTML10(pdoc);
1966 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1968 for (attr = qs_get_attr(doc,node);
1970 attr = qs_get_next_attr(doc,attr)) {
1975 name = qs_get_attr_name (doc,attr);
1976 value = qs_get_attr_value(doc,attr);
1981 if (strcasecmp(name, "align") == 0) {
1982 /*----------------------------------------------------------------------*/
1984 /*----------------------------------------------------------------------*/
1985 chtml10->out = apr_pstrcat(r->pool,
1987 " align=\"", value, "\" ", NULL);
1993 if (strcasecmp(name, "size") == 0) {
1994 /*----------------------------------------------------------------------*/
1996 /*----------------------------------------------------------------------*/
1997 chtml10->out = apr_pstrcat(r->pool,
1999 " size=\"", value, "\" ", NULL);
2005 if (strcasecmp(name, "width") == 0) {
2006 /*----------------------------------------------------------------------*/
2008 /*----------------------------------------------------------------------*/
2009 chtml10->out = apr_pstrcat(r->pool,
2011 " width=\"", value, "\" ", NULL);
2017 if (strcasecmp(name, "noshade") == 0) {
2018 /*----------------------------------------------------------------------*/
2020 /*----------------------------------------------------------------------*/
2021 chtml10->out = apr_pstrcat(r->pool,
2029 if (strcasecmp(name, "color") == 0) {
2030 /*----------------------------------------------------------------------*/
2032 /*----------------------------------------------------------------------*/
2042 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2044 return chtml10->out;
2049 * It is a handler who processes the HR tag.
2051 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2052 * destination is specified.
2053 * @param node [i] The HR tag node is specified.
2054 * @return The conversion result is returned.
2057 s_chtml10_end_hr_tag(void* pdoc, Node* child)
2061 chtml10 = GET_CHTML10(pdoc);
2063 return chtml10->out;
2068 * It is a handler who processes the IMG tag.
2070 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2071 * destination is specified.
2072 * @param node [i] The IMG tag node is specified.
2073 * @return The conversion result is returned.
2076 s_chtml10_start_img_tag(void* pdoc, Node* node)
2082 #ifndef IMG_NOT_CONVERT_FILENAME
2083 device_table_t* spec;
2086 chtml10 = GET_CHTML10(pdoc);
2087 #ifndef IMG_NOT_CONVERT_FILENAME
2088 spec = chtml10->spec;
2093 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
2096 /*--------------------------------------------------------------------------*/
2097 /* Get Attributes */
2098 /*--------------------------------------------------------------------------*/
2099 for (attr = qs_get_attr(doc,node);
2101 attr = qs_get_next_attr(doc,attr)) {
2106 name = qs_get_attr_name (doc,attr);
2107 value = qs_get_attr_value(doc,attr);
2112 if (strcasecmp(name, "src") == 0) {
2113 /*----------------------------------------------------------------------*/
2115 /*----------------------------------------------------------------------*/
2116 #ifdef IMG_NOT_CONVERT_FILENAME
2117 value = chxj_encoding_parameter(r, value);
2118 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2119 chtml10->out = apr_pstrcat(r->pool,
2120 chtml10->out, " src=\"",value,"\"", NULL);
2122 value = chxj_img_conv(r, spec, value);
2123 value = chxj_encoding_parameter(r, value);
2124 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2125 chtml10->out = apr_pstrcat(r->pool,
2126 chtml10->out, " src=\"",
2129 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2136 if (strcasecmp(name, "align" ) == 0) {
2137 /*--------------------------------------------------------------------*/
2139 /*--------------------------------------------------------------------*/
2140 /*--------------------------------------------------------------------*/
2142 /*--------------------------------------------------------------------*/
2143 chtml10->out = apr_pstrcat(r->pool,
2144 chtml10->out, " align=\"",value,"\"", NULL);
2147 if (strcasecmp(name, "alt" ) == 0) {
2148 /*--------------------------------------------------------------------*/
2150 /*--------------------------------------------------------------------*/
2151 chtml10->out = apr_pstrcat(r->pool,
2152 chtml10->out, " alt=\"",value,"\"", NULL);
2158 if (strcasecmp(name, "width" ) == 0) {
2159 /*----------------------------------------------------------------------*/
2161 /*----------------------------------------------------------------------*/
2162 chtml10->out = apr_pstrcat(r->pool,
2163 chtml10->out, " width=\"",value,"\"", NULL);
2169 if (strcasecmp(name, "height") == 0) {
2170 /*--------------------------------------------------------------------*/
2172 /*--------------------------------------------------------------------*/
2173 chtml10->out = apr_pstrcat(r->pool,
2174 chtml10->out, " height=\"",value,"\"", NULL);
2177 if (strcasecmp(name, "hspace") == 0) {
2178 /*--------------------------------------------------------------------*/
2180 /*--------------------------------------------------------------------*/
2181 chtml10->out = apr_pstrcat(r->pool,
2182 chtml10->out, " hspace=\"",value,"\"", NULL);
2188 if (strcasecmp(name, "vspace") == 0) {
2189 /*----------------------------------------------------------------------*/
2191 /*----------------------------------------------------------------------*/
2192 chtml10->out = apr_pstrcat(r->pool,
2193 chtml10->out, " vspace=\"",value,"\"", NULL);
2202 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2204 return chtml10->out;
2209 * It is a handler who processes the IMG tag.
2211 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2212 * destination is specified.
2213 * @param node [i] The IMG tag node is specified.
2214 * @return The conversion result is returned.
2217 s_chtml10_end_img_tag(void* pdoc, Node* child)
2221 chtml10 = GET_CHTML10(pdoc);
2223 return chtml10->out;
2228 * It is a handler who processes the SELECT tag.
2230 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2231 * destination is specified.
2232 * @param node [i] The SELECT tag node is specified.
2233 * @return The conversion result is returned.
2236 s_chtml10_start_select_tag(void* pdoc, Node* child)
2246 chtml10 = GET_CHTML10(pdoc);
2253 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2254 for (attr = qs_get_attr(doc,child);
2256 attr = qs_get_next_attr(doc,attr)) {
2260 nm = qs_get_attr_name (doc,attr);
2261 val = qs_get_attr_value(doc,attr);
2266 if (strcasecmp(nm, "size") == 0) {
2267 /*----------------------------------------------------------------------*/
2268 /* CHTML 1.0 version 2.0 */
2269 /*----------------------------------------------------------------------*/
2270 size = apr_pstrdup(r->pool, val);
2276 if (strcasecmp(nm, "name") == 0) {
2277 /*----------------------------------------------------------------------*/
2278 /* CHTML 1.0 version 2.0 */
2279 /*----------------------------------------------------------------------*/
2280 name = apr_pstrdup(r->pool, val);
2286 if (strcasecmp(nm, "multiple") == 0) {
2287 /*----------------------------------------------------------------------*/
2288 /* CHTML 1.0 version 2.0 */
2289 /*----------------------------------------------------------------------*/
2300 chtml10->out = apr_pstrcat(r->pool,
2308 chtml10->out = apr_pstrcat(r->pool,
2315 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2317 return chtml10->out;
2322 * It is a handler who processes the SELECT tag.
2324 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2325 * destination is specified.
2326 * @param node [i] The SELECT tag node is specified.
2327 * @return The conversion result is returned.
2330 s_chtml10_end_select_tag(void* pdoc, Node* child)
2336 chtml10 = GET_CHTML10(pdoc);
2340 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2342 return chtml10->out;
2347 * It is a handler who processes the OPTION tag.
2349 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2350 * destination is specified.
2351 * @param node [i] The OPTION tag node is specified.
2352 * @return The conversion result is returned.
2355 s_chtml10_start_option_tag(void* pdoc, Node* child)
2365 chtml10 = GET_CHTML10(pdoc);
2372 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2373 for (attr = qs_get_attr(doc,child);
2375 attr = qs_get_next_attr(doc,attr)) {
2379 nm = qs_get_attr_name (doc,attr);
2380 val = qs_get_attr_value(doc,attr);
2385 if (strcasecmp(nm, "selected") == 0) {
2386 /*----------------------------------------------------------------------*/
2387 /* CHTML 1.0 version 2.0 */
2388 /*----------------------------------------------------------------------*/
2389 selected = apr_pstrdup(r->pool, val);
2395 if (strcasecmp(nm, "value") == 0) {
2396 /*----------------------------------------------------------------------*/
2397 /* CHTML 1.0 version 2.0 */
2398 /*----------------------------------------------------------------------*/
2399 value = apr_pstrdup(r->pool, val);
2409 chtml10->out = apr_pstrcat(r->pool,
2416 chtml10->out = apr_pstrcat(r->pool,
2422 chtml10->out = apr_pstrcat(r->pool,
2427 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2429 return chtml10->out;
2434 * It is a handler who processes the OPTION tag.
2436 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2437 * destination is specified.
2438 * @param node [i] The OPTION tag node is specified.
2439 * @return The conversion result is returned.
2442 s_chtml10_end_option_tag(void* pdoc, Node* child)
2446 chtml10 = GET_CHTML10(pdoc);
2450 return chtml10->out;
2455 * It is a handler who processes the DIV tag.
2457 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2458 * destination is specified.
2459 * @param node [i] The DIV tag node is specified.
2460 * @return The conversion result is returned.
2463 s_chtml10_start_div_tag(void* pdoc, Node* child)
2472 chtml10 = GET_CHTML10(pdoc);
2478 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2479 for (attr = qs_get_attr(doc,child);
2481 attr = qs_get_next_attr(doc,attr)) {
2485 nm = qs_get_attr_name(doc,attr);
2486 val = qs_get_attr_value(doc,attr);
2488 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2489 /*----------------------------------------------------------------------*/
2490 /* CHTML 1.0 (W3C version 3.2) */
2491 /*----------------------------------------------------------------------*/
2492 align = apr_pstrdup(r->pool, val);
2497 chtml10->out = apr_pstrcat(r->pool,
2498 chtml10->out, " align=\"", align, "\"", NULL);
2500 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2502 return chtml10->out;
2507 * It is a handler who processes the DIV tag.
2509 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2510 * destination is specified.
2511 * @param node [i] The DIV tag node is specified.
2512 * @return The conversion result is returned.
2515 s_chtml10_end_div_tag(void* pdoc, Node* child)
2521 chtml10 = GET_CHTML10(pdoc);
2525 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2527 return chtml10->out;
2532 * It is a handler who processes the CHXJ:IF tag.
2534 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2535 * destination is specified.
2536 * @param node [i] The CHXJ:IF tag node is specified.
2537 * @return The conversion result is returned.
2540 s_chtml10_chxjif_tag(void* pdoc, Node* node)
2547 chtml10 = GET_CHTML10(pdoc);
2551 for (child = qs_get_child_node(doc, node);
2553 child = qs_get_next_node(doc, child)) {
2554 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2555 s_chtml10_chxjif_tag(chtml10, child);
2558 return chtml10->out;
2563 * It is a handler who processes the PRE tag.
2565 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2566 * destination is specified.
2567 * @param node [i] The PRE tag node is specified.
2568 * @return The conversion result is returned.
2571 s_chtml10_start_pre_tag(void* pdoc, Node* node)
2577 chtml10 = GET_CHTML10(pdoc);
2581 chtml10->pre_flag++;
2582 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2584 return chtml10->out;
2589 * It is a handler who processes the PRE tag.
2591 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2592 * destination is specified.
2593 * @param node [i] The PRE tag node is specified.
2594 * @return The conversion result is returned.
2597 s_chtml10_end_pre_tag(void* pdoc, Node* child)
2603 chtml10 = GET_CHTML10(pdoc);
2607 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2608 chtml10->pre_flag--;
2610 return chtml10->out;
2615 * It is a handler who processes the P tag.
2617 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2618 * destination is specified.
2619 * @param node [i] The P tag node is specified.
2620 * @return The conversion result is returned.
2623 s_chtml10_start_p_tag(void* pdoc, Node* node)
2629 chtml10 = GET_CHTML10(pdoc);
2633 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2635 return chtml10->out;
2640 * It is a handler who processes the P tag.
2642 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2643 * destination is specified.
2644 * @param node [i] The P tag node is specified.
2645 * @return The conversion result is returned.
2648 s_chtml10_end_p_tag(void* pdoc, Node* child)
2654 chtml10 = GET_CHTML10(pdoc);
2658 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2660 return chtml10->out;
2665 * It is a handler who processes the TEXTARE tag.
2667 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2668 * destination is specified.
2669 * @param node [i] The TEXTAREA tag node is specified.
2670 * @return The conversion result is returned.
2673 s_chtml10_start_textarea_tag(void* pdoc, Node* node)
2680 chtml10 = GET_CHTML10(pdoc);
2685 chtml10->textarea_flag++;
2686 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2688 for (attr = qs_get_attr(doc,node);
2690 attr = qs_get_next_attr(doc,attr)) {
2695 name = qs_get_attr_name (doc,attr);
2696 value = qs_get_attr_value(doc,attr);
2701 if (strcasecmp(name, "name") == 0) {
2702 chtml10->out = apr_pstrcat(r->pool,
2713 if (strcasecmp(name, "rows") == 0) {
2714 chtml10->out = apr_pstrcat(r->pool,
2725 if (strcasecmp(name, "cols") == 0) {
2726 chtml10->out = apr_pstrcat(r->pool,
2740 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2742 return chtml10->out;
2747 * It is a handler who processes the TEXTAREA tag.
2749 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2750 * destination is specified.
2751 * @param node [i] The TEXTAREA tag node is specified.
2752 * @return The conversion result is returned.
2755 s_chtml10_end_textarea_tag(void* pdoc, Node* child)
2761 chtml10 = GET_CHTML10(pdoc);
2765 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2766 chtml10->textarea_flag--;
2768 return chtml10->out;
2773 s_chtml10_text(void* pdoc, Node* child)
2785 chtml10 = GET_CHTML10(pdoc);
2789 textval = qs_get_node_value(doc,child);
2790 textval = qs_trim_string(r, textval);
2792 if (strlen(textval) == 0)
2793 return chtml10->out;
2795 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2796 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2798 tdst = qs_alloc_zero_byte_string(r);
2799 memset(one_byte, 0, sizeof(one_byte));
2802 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2806 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2808 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2813 if (is_sjis_kanji(textval[ii])) {
2814 one_byte[0] = textval[ii+0];
2815 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2816 one_byte[0] = textval[ii+1];
2817 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2821 if (chtml10->pre_flag) {
2822 one_byte[0] = textval[ii+0];
2823 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2826 if (chtml10->textarea_flag) {
2827 one_byte[0] = textval[ii+0];
2828 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2831 if (textval[ii] != '\r' && textval[ii] != '\n') {
2832 one_byte[0] = textval[ii+0];
2833 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2837 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2839 return chtml10->out;