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"
24 #define GET_CHTML10(X) ((chtml10_t*)(X))
26 static char* s_chtml10_start_html_tag (void* pdoc, Node* node);
27 static char* s_chtml10_end_html_tag (void* pdoc, Node* node);
28 static char* s_chtml10_start_meta_tag (void* pdoc, Node* node);
29 static char* s_chtml10_end_meta_tag (void* pdoc, Node* node);
30 static char* s_chtml10_start_textarea_tag (void* pdoc, Node* node);
31 static char* s_chtml10_end_textarea_tag (void* pdoc, Node* node);
32 static char* s_chtml10_start_p_tag (void* pdoc, Node* node);
33 static char* s_chtml10_end_p_tag (void* pdoc, Node* node);
34 static char* s_chtml10_start_pre_tag (void* pdoc, Node* node);
35 static char* s_chtml10_end_pre_tag (void* pdoc, Node* node);
36 static char* s_chtml10_start_ul_tag (void* pdoc, Node* node);
37 static char* s_chtml10_end_ul_tag (void* pdoc, Node* node);
38 static char* s_chtml10_start_li_tag (void* pdoc, Node* node);
39 static char* s_chtml10_end_li_tag (void* pdoc, Node* node);
40 static char* s_chtml10_start_ol_tag (void* pdoc, Node* node);
41 static char* s_chtml10_end_ol_tag (void* pdoc, Node* node);
42 static char* s_chtml10_start_h1_tag (void* pdoc, Node* node);
43 static char* s_chtml10_end_h1_tag (void* pdoc, Node* node);
44 static char* s_chtml10_start_h2_tag (void* pdoc, Node* node);
45 static char* s_chtml10_end_h2_tag (void* pdoc, Node* node);
46 static char* s_chtml10_start_h3_tag (void* pdoc, Node* node);
47 static char* s_chtml10_end_h3_tag (void* pdoc, Node* node);
48 static char* s_chtml10_start_h4_tag (void* pdoc, Node* node);
49 static char* s_chtml10_end_h4_tag (void* pdoc, Node* node);
50 static char* s_chtml10_start_h5_tag (void* pdoc, Node* node);
51 static char* s_chtml10_end_h5_tag (void* pdoc, Node* node);
52 static char* s_chtml10_start_h6_tag (void* pdoc, Node* node);
53 static char* s_chtml10_end_h6_tag (void* pdoc, Node* node);
54 static char* s_chtml10_start_head_tag (void* pdoc, Node* node);
55 static char* s_chtml10_end_head_tag (void* pdoc, Node* node);
56 static char* s_chtml10_start_title_tag (void* pdoc, Node* node);
57 static char* s_chtml10_end_title_tag (void* pdoc, Node* node);
58 static char* s_chtml10_start_base_tag (void* pdoc, Node* node);
59 static char* s_chtml10_end_base_tag (void* pdoc, Node* node);
60 static char* s_chtml10_start_body_tag (void* pdoc, Node* node);
61 static char* s_chtml10_end_body_tag (void* pdoc, Node* node);
62 static char* s_chtml10_start_a_tag (void* pdoc, Node* node);
63 static char* s_chtml10_end_a_tag (void* pdoc, Node* node);
64 static char* s_chtml10_start_br_tag (void* pdoc, Node* node);
65 static char* s_chtml10_end_br_tag (void* pdoc, Node* node);
66 static char* s_chtml10_start_tr_tag (void* pdoc, Node* node);
67 static char* s_chtml10_end_tr_tag (void* pdoc, Node* node);
68 static char* s_chtml10_start_font_tag (void* pdoc, Node* node);
69 static char* s_chtml10_end_font_tag (void* pdoc, Node* node);
70 static char* s_chtml10_start_input_tag (void* pdoc, Node* node);
71 static char* s_chtml10_end_input_tag (void* pdoc, Node* node);
72 static char* s_chtml10_start_form_tag (void* pdoc, Node* node);
73 static char* s_chtml10_end_form_tag (void* pdoc, Node* node);
74 static char* s_chtml10_start_center_tag (void* pdoc, Node* node);
75 static char* s_chtml10_end_center_tag (void* pdoc, Node* node);
76 static char* s_chtml10_start_hr_tag (void* pdoc, Node* node);
77 static char* s_chtml10_end_hr_tag (void* pdoc, Node* node);
78 static char* s_chtml10_start_img_tag (void* pdoc, Node* node);
79 static char* s_chtml10_end_img_tag (void* pdoc, Node* node);
80 static char* s_chtml10_start_select_tag (void* pdoc, Node* node);
81 static char* s_chtml10_end_select_tag (void* pdoc, Node* node);
82 static char* s_chtml10_start_option_tag (void* pdoc, Node* node);
83 static char* s_chtml10_end_option_tag (void* pdoc, Node* node);
84 static char* s_chtml10_start_div_tag (void* pdoc, Node* node);
85 static char* s_chtml10_end_div_tag (void* pdoc, Node* node);
87 static void s_init_chtml10(chtml10_t* chtml, Doc* doc, request_rec* r, device_table* spec);
89 static int s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
90 static char* s_chtml10_chxjif_tag (void* pdoc, Node* node);
91 static char* s_chtml10_text (void* pdoc, Node* node);
93 tag_handler chtml10_handler[] = {
96 s_chtml10_start_html_tag,
97 s_chtml10_end_html_tag,
101 s_chtml10_start_meta_tag,
102 s_chtml10_end_meta_tag,
106 s_chtml10_start_textarea_tag,
107 s_chtml10_end_textarea_tag,
111 s_chtml10_start_p_tag,
116 s_chtml10_start_pre_tag,
117 s_chtml10_end_pre_tag,
121 s_chtml10_start_ul_tag,
122 s_chtml10_end_ul_tag,
126 s_chtml10_start_li_tag,
127 s_chtml10_end_li_tag,
131 s_chtml10_start_ol_tag,
132 s_chtml10_end_ol_tag,
136 s_chtml10_start_h1_tag,
137 s_chtml10_end_h1_tag,
141 s_chtml10_start_h2_tag,
142 s_chtml10_end_h2_tag,
146 s_chtml10_start_h3_tag,
147 s_chtml10_end_h3_tag,
151 s_chtml10_start_h4_tag,
152 s_chtml10_end_h4_tag,
156 s_chtml10_start_h5_tag,
157 s_chtml10_end_h5_tag,
161 s_chtml10_start_h6_tag,
162 s_chtml10_end_h6_tag,
166 s_chtml10_start_head_tag,
167 s_chtml10_end_head_tag,
171 s_chtml10_start_title_tag,
172 s_chtml10_end_title_tag,
176 s_chtml10_start_base_tag,
177 s_chtml10_end_base_tag,
181 s_chtml10_start_body_tag,
182 s_chtml10_end_body_tag,
186 s_chtml10_start_a_tag,
191 s_chtml10_start_br_tag,
192 s_chtml10_end_br_tag,
201 s_chtml10_start_tr_tag,
202 s_chtml10_end_tr_tag,
216 s_chtml10_start_font_tag,
217 s_chtml10_end_font_tag,
221 s_chtml10_start_form_tag,
222 s_chtml10_end_form_tag,
226 s_chtml10_start_input_tag,
227 s_chtml10_end_input_tag,
231 s_chtml10_start_center_tag,
232 s_chtml10_end_center_tag,
236 s_chtml10_start_hr_tag,
237 s_chtml10_end_hr_tag,
241 s_chtml10_start_img_tag,
242 s_chtml10_end_img_tag,
246 s_chtml10_start_select_tag,
247 s_chtml10_end_select_tag,
251 s_chtml10_start_option_tag,
252 s_chtml10_end_option_tag,
256 s_chtml10_start_div_tag,
257 s_chtml10_end_div_tag,
261 s_chtml10_chxjif_tag,
303 * converts from CHTML5.0 to CHTML1.0.
305 * @param r [i] Requet_rec is appointed.
306 * @param spec [i] The result of the device specification processing which
307 * was done in advance is appointed.
308 * @param src [i] The character string before the converting is appointed.
309 * @return The character string after the converting is returned.
312 chxj_exchange_chtml10(
318 chxjconvrule_entry* entryp,
319 const char* cookie_id
329 DBG1(r, "start chxj_exchange_chtml10() cookie_id=[%s]", cookie_id);
331 /*--------------------------------------------------------------------------*/
333 /*--------------------------------------------------------------------------*/
335 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
337 DBG(r,"i found qrcode xml");
340 DBG(r,"not found qrcode xml");
342 /*--------------------------------------------------------------------------*/
343 /* The CHTML structure is initialized. */
344 /*--------------------------------------------------------------------------*/
345 s_init_chtml10(&chtml10, &doc, r, spec);
346 chtml10.entryp = entryp;
347 chtml10.cookie_id = (char*)cookie_id;
349 ap_set_content_type(r, "text/html; charset=Windows-31J");
351 /*--------------------------------------------------------------------------*/
352 /* The character string of the input is analyzed. */
353 /*--------------------------------------------------------------------------*/
354 qs_init_malloc(&doc);
355 qs_init_root_node(&doc);
357 ss = apr_pcalloc(r->pool, srclen + 1);
358 memset(ss, 0, srclen + 1);
359 memcpy(ss, src, srclen);
362 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
365 qs_parse_string(&doc,ss, strlen(ss));
367 /*--------------------------------------------------------------------------*/
368 /* It converts it from CHTML to CHTML. */
369 /*--------------------------------------------------------------------------*/
370 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
374 qs_all_free(&doc,QX_LOGMARK);
377 return apr_pstrdup(r->pool,ss);
379 if (strlen(dst) == 0) {
380 dst = apr_psprintf(r->pool, "\n");
382 *dstlen = strlen(dst);
385 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
388 DBG1(r, "end chxj_exchange_chtml10() cookie_id=[%s]", cookie_id);
395 * The CHTML structure is initialized.
397 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
398 * initialized is specified.
399 * @param doc [i] The Doc structure that should be set to the initialized
400 * HDML structure is specified.
401 * @param r [i] To use POOL, the pointer to request_rec is specified.
402 * @param spec [i] The pointer to the device_table
411 memset(doc, 0, sizeof(Doc));
412 memset(chtml10, 0, sizeof(chtml10_t));
416 chtml10->spec = spec;
417 chtml10->out = qs_alloc_zero_byte_string(r);
418 chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
419 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
424 * Corresponding EMOJI to a current character-code is retrieved.
425 * The substitution character string is stored in the rslt pointer if agreeing.
427 * @param chtml10 [i] The pointer to the CHTML structure is specified.
428 * @param txt [i] The character string to want to examine whether it is
429 * EMOJI is specified.
430 * @param rslt [o] The pointer to the pointer that stores the result is
432 * @return When corresponding EMOJI exists, it returns it excluding 0.
435 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
442 spec = chtml10->spec;
448 DBG(r,"spec is NULL");
451 for (ee = chtml10->conf->emoji;
456 DBG(r,"emoji->imode is NULL");
460 if (ee->imode->string
462 && strlen(ee->imode->string) > 0
463 && *ee->imode->string == *txt
464 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
465 if (!spec || !spec->emoji_type) {
466 *rslt = apr_palloc(r->pool, 3);
467 (*rslt)[0] = ee->imode->hex1byte & 0xff;
468 (*rslt)[1] = ee->imode->hex2byte & 0xff;
470 return strlen(ee->imode->string);
481 * It is a handler who processes the HTML tag.
483 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
484 * destination is specified.
485 * @param node [i] The HTML tag node is specified.
486 * @return The conversion result is returned.
489 s_chtml10_start_html_tag(void* pdoc, Node* node)
495 chtml10 = GET_CHTML10(pdoc);
499 /*--------------------------------------------------------------------------*/
501 /*--------------------------------------------------------------------------*/
502 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
509 * It is a handler who processes the HTML tag.
511 * @param pdoc [i/o] The pointer to the CHTML structure at the output
512 * destination is specified.
513 * @param node [i] The HTML tag node is specified.
514 * @return The conversion result is returned.
517 s_chtml10_end_html_tag(void* pdoc, Node* child)
524 chtml10 = GET_CHTML10(pdoc);
528 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
535 * It is a handler who processes the META tag.
537 * @param pdoc [i/o] The pointer to the CHTML structure at the output
538 * destination is specified.
539 * @param node [i] The META tag node is specified.
540 * @return The conversion result is returned.
543 s_chtml10_start_meta_tag(void* pdoc, Node* node)
547 chtml10 = GET_CHTML10(pdoc);
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_end_meta_tag(void* pdoc, Node* child)
568 chtml10 = GET_CHTML10(pdoc);
575 * It is a handler who processes the HEAD tag.
577 * @param pdoc [i/o] The pointer to the CHTML structure at the output
578 * destination is specified.
579 * @param node [i] The HEAD tag node is specified.
580 * @return The conversion result is returned.
583 s_chtml10_start_head_tag(void* pdoc, Node* node)
589 chtml10 = GET_CHTML10(pdoc);
593 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
600 * It is a handler who processes the HEAD tag.
602 * @param pdoc [i/o] The pointer to the CHTML structure at the output
603 * destination is specified.
604 * @param node [i] The HEAD tag node is specified.
605 * @return The conversion result is returned.
608 s_chtml10_end_head_tag(void* pdoc, Node* child)
614 chtml10 = GET_CHTML10(pdoc);
618 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
625 * It is a handler who processes the OL tag.
627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
628 * destination is specified.
629 * @param node [i] The OL tag node is specified.
630 * @return The conversion result is returned.
633 s_chtml10_start_ol_tag(void* pdoc, Node* node)
639 chtml10 = GET_CHTML10(pdoc);
643 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ol>\r\n", NULL);
650 * It is a handler who processes the OL tag.
652 * @param pdoc [i/o] The pointer to the CHTML structure at the output
653 * destination is specified.
654 * @param node [i] The OL tag node is specified.
655 * @return The conversion result is returned.
658 s_chtml10_end_ol_tag(void* pdoc, Node* child)
664 chtml10 = GET_CHTML10(pdoc);
668 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ol>\r\n", NULL);
675 * It is a handler who processes the UL tag.
677 * @param pdoc [i/o] The pointer to the CHTML structure at the output
678 * destination is specified.
679 * @param node [i] The UL tag node is specified.
680 * @return The conversion result is returned.
683 s_chtml10_start_ul_tag(void* pdoc, Node* node)
689 chtml10 = GET_CHTML10(pdoc);
693 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<ul>\r\n", NULL);
700 * It is a handler who processes the UL tag.
702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
703 * destination is specified.
704 * @param node [i] The UL tag node is specified.
705 * @return The conversion result is returned.
708 s_chtml10_end_ul_tag(void* pdoc, Node* child)
714 chtml10 = GET_CHTML10(pdoc);
718 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</ul>\r\n", NULL);
725 * It is a handler who processes the LI tag.
727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
728 * destination is specified.
729 * @param node [i] The LI tag node is specified.
730 * @return The conversion result is returned.
733 s_chtml10_start_li_tag(void* pdoc, Node* node)
739 chtml10 = GET_CHTML10(pdoc);
743 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<li>\r\n", NULL);
750 * It is a handler who processes the LI tag.
752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
753 * destination is specified.
754 * @param node [i] The LI tag node is specified.
755 * @return The conversion result is returned.
758 s_chtml10_end_li_tag(void* pdoc, Node* child)
764 chtml10 = GET_CHTML10(pdoc);
768 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</li>\r\n", NULL);
775 * It is a handler who processes the H1 tag.
777 * @param pdoc [i/o] The pointer to the CHTML structure at the output
778 * destination is specified.
779 * @param node [i] The H1 tag node is specified.
780 * @return The conversion result is returned.
783 s_chtml10_start_h1_tag(void* pdoc, Node* node)
789 chtml10 = GET_CHTML10(pdoc);
793 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h1>\r\n", NULL);
800 * It is a handler who processes the H1 tag.
802 * @param pdoc [i/o] The pointer to the CHTML structure at the output
803 * destination is specified.
804 * @param node [i] The H1 tag node is specified.
805 * @return The conversion result is returned.
808 s_chtml10_end_h1_tag(void* pdoc, Node* child)
814 chtml10 = GET_CHTML10(pdoc);
818 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h1>\r\n", NULL);
825 * It is a handler who processes the H2 tag.
827 * @param pdoc [i/o] The pointer to the CHTML structure at the output
828 * destination is specified.
829 * @param node [i] The H2 tag node is specified.
830 * @return The conversion result is returned.
833 s_chtml10_start_h2_tag(void* pdoc, Node* node)
839 chtml10 = GET_CHTML10(pdoc);
843 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h2>\r\n", NULL);
850 * It is a handler who processes the H2 tag.
852 * @param pdoc [i/o] The pointer to the CHTML structure at the output
853 * destination is specified.
854 * @param node [i] The H2 tag node is specified.
855 * @return The conversion result is returned.
858 s_chtml10_end_h2_tag(void* pdoc, Node* child)
864 chtml10 = GET_CHTML10(pdoc);
868 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h2>\r\n", NULL);
875 * It is a handler who processes the H3 tag.
877 * @param pdoc [i/o] The pointer to the CHTML structure at the output
878 * destination is specified.
879 * @param node [i] The H3 tag node is specified.
880 * @return The conversion result is returned.
883 s_chtml10_start_h3_tag(void* pdoc, Node* node)
889 chtml10 = GET_CHTML10(pdoc);
893 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h3>\r\n", NULL);
900 * It is a handler who processes the H3 tag.
902 * @param pdoc [i/o] The pointer to the CHTML structure at the output
903 * destination is specified.
904 * @param node [i] The H3 tag node is specified.
905 * @return The conversion result is returned.
908 s_chtml10_end_h3_tag(void* pdoc, Node* child)
914 chtml10 = GET_CHTML10(pdoc);
918 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h3>\r\n", NULL);
925 * It is a handler who processes the H4 tag.
927 * @param pdoc [i/o] The pointer to the CHTML structure at the output
928 * destination is specified.
929 * @param node [i] The H4 tag node is specified.
930 * @return The conversion result is returned.
933 s_chtml10_start_h4_tag(void* pdoc, Node* node)
939 chtml10 = GET_CHTML10(pdoc);
943 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h4>\r\n", NULL);
950 * It is a handler who processes the H4 tag.
952 * @param pdoc [i/o] The pointer to the CHTML structure at the output
953 * destination is specified.
954 * @param node [i] The H4 tag node is specified.
955 * @return The conversion result is returned.
958 s_chtml10_end_h4_tag(void* pdoc, Node* child)
964 chtml10 = GET_CHTML10(pdoc);
968 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h4>\r\n", NULL);
975 * It is a handler who processes the H5 tag.
977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
978 * destination is specified.
979 * @param node [i] The H5 tag node is specified.
980 * @return The conversion result is returned.
983 s_chtml10_start_h5_tag(void* pdoc, Node* node)
989 chtml10 = GET_CHTML10(pdoc);
993 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h5>\r\n", NULL);
1000 * It is a handler who processes the H5 tag.
1002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The H5 tag node is specified.
1005 * @return The conversion result is returned.
1008 s_chtml10_end_h5_tag(void* pdoc, Node* child)
1014 chtml10 = GET_CHTML10(pdoc);
1018 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h5>\r\n", NULL);
1020 return chtml10->out;
1025 * It is a handler who processes the H6 tag.
1027 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1028 * destination is specified.
1029 * @param node [i] The H6 tag node is specified.
1030 * @return The conversion result is returned.
1033 s_chtml10_start_h6_tag(void* pdoc, Node* node)
1039 chtml10 = GET_CHTML10(pdoc);
1043 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<h6>\r\n", NULL);
1045 return chtml10->out;
1050 * It is a handler who processes the H6 tag.
1052 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1053 * destination is specified.
1054 * @param node [i] The H6 tag node is specified.
1055 * @return The conversion result is returned.
1058 s_chtml10_end_h6_tag(void* pdoc, Node* child)
1064 chtml10 = GET_CHTML10(pdoc);
1068 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</h6>\r\n", NULL);
1070 return chtml10->out;
1075 * It is a handler who processes the TITLE tag.
1077 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1078 * destination is specified.
1079 * @param node [i] The TITLE tag node is specified.
1080 * @return The conversion result is returned.
1083 s_chtml10_start_title_tag(void* pdoc, Node* node)
1089 chtml10 = GET_CHTML10(pdoc);
1093 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
1095 return chtml10->out;
1100 * It is a handler who processes the TITLE tag.
1102 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1103 * destination is specified.
1104 * @param node [i] The TITLE tag node is specified.
1105 * @return The conversion result is returned.
1108 s_chtml10_end_title_tag(void* pdoc, Node* child)
1114 chtml10 = GET_CHTML10(pdoc);
1118 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
1120 return chtml10->out;
1125 * It is a handler who processes the BASE tag.
1127 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1128 * destination is specified.
1129 * @param node [i] The BASE tag node is specified.
1130 * @return The conversion result is returned.
1133 s_chtml10_start_base_tag(void* pdoc, Node* node)
1140 chtml10 = GET_CHTML10(pdoc);
1145 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
1147 /*--------------------------------------------------------------------------*/
1148 /* Get Attributes */
1149 /*--------------------------------------------------------------------------*/
1150 for (attr = qs_get_attr(doc,node);
1152 attr = qs_get_next_attr(doc,attr)) {
1153 char* name = qs_get_attr_name(doc,attr);
1154 char* value = qs_get_attr_value(doc,attr);
1155 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1156 chtml10->out = apr_pstrcat(r->pool,
1165 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1167 return chtml10->out;
1172 * It is a handler who processes the BASE tag.
1174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1175 * destination is specified.
1176 * @param node [i] The BASE tag node is specified.
1177 * @return The conversion result is returned.
1180 s_chtml10_end_base_tag(void* pdoc, Node* child)
1182 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1184 return chtml10->out;
1189 * It is a handler who processes the BODY tag.
1191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1192 * destination is specified.
1193 * @param node [i] The BODY tag node is specified.
1194 * @return The conversion result is returned.
1197 s_chtml10_start_body_tag(void* pdoc, Node* node)
1204 chtml10 = GET_CHTML10(pdoc);
1208 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1210 /*--------------------------------------------------------------------------*/
1211 /* Get Attributes */
1212 /*--------------------------------------------------------------------------*/
1213 for (attr = qs_get_attr(doc,node);
1215 attr = qs_get_next_attr(doc,attr)) {
1216 char* name = qs_get_attr_name(doc,attr);
1218 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
1219 /*----------------------------------------------------------------------*/
1221 /*----------------------------------------------------------------------*/
1225 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
1226 /*----------------------------------------------------------------------*/
1228 /*----------------------------------------------------------------------*/
1232 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
1233 /*----------------------------------------------------------------------*/
1235 /*----------------------------------------------------------------------*/
1239 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
1240 /*----------------------------------------------------------------------*/
1242 /*----------------------------------------------------------------------*/
1246 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
1247 /*----------------------------------------------------------------------*/
1249 /*----------------------------------------------------------------------*/
1253 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1255 return chtml10->out;
1260 * It is a handler who processes the BODY tag.
1262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1263 * destination is specified.
1264 * @param node [i] The BODY tag node is specified.
1265 * @return The conversion result is returned.
1268 s_chtml10_end_body_tag(void* pdoc, Node* child)
1274 chtml10 = GET_CHTML10(pdoc);
1278 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1280 return chtml10->out;
1285 * It is a handler who processes the A tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The A tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml10_start_a_tag(void* pdoc, Node* node)
1300 chtml10 = GET_CHTML10(pdoc);
1304 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1306 /*--------------------------------------------------------------------------*/
1307 /* Get Attributes */
1308 /*--------------------------------------------------------------------------*/
1309 for (attr = qs_get_attr(doc,node);
1311 attr = qs_get_next_attr(doc,attr)) {
1312 char* name = qs_get_attr_name(doc,attr);
1313 char* value = qs_get_attr_value(doc,attr);
1315 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1316 /*----------------------------------------------------------------------*/
1318 /*----------------------------------------------------------------------*/
1319 chtml10->out = apr_pstrcat(r->pool,
1327 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1328 /*----------------------------------------------------------------------*/
1330 /*----------------------------------------------------------------------*/
1331 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
1333 chtml10->out = apr_pstrcat(r->pool,
1341 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1342 /*----------------------------------------------------------------------*/
1344 /*----------------------------------------------------------------------*/
1345 chtml10->out = apr_pstrcat(r->pool,
1353 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
1354 /*----------------------------------------------------------------------*/
1356 /*----------------------------------------------------------------------*/
1360 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
1361 /*----------------------------------------------------------------------*/
1363 /*----------------------------------------------------------------------*/
1367 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1368 /*----------------------------------------------------------------------*/
1370 /*----------------------------------------------------------------------*/
1374 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1375 /*----------------------------------------------------------------------*/
1377 /*----------------------------------------------------------------------*/
1381 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1382 /*----------------------------------------------------------------------*/
1384 /*----------------------------------------------------------------------*/
1388 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1389 /*----------------------------------------------------------------------*/
1391 /*----------------------------------------------------------------------*/
1395 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1396 /*----------------------------------------------------------------------*/
1398 /*----------------------------------------------------------------------*/
1402 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1403 /*----------------------------------------------------------------------*/
1405 /*----------------------------------------------------------------------*/
1409 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1410 /*----------------------------------------------------------------------*/
1412 /*----------------------------------------------------------------------*/
1416 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1417 /*----------------------------------------------------------------------*/
1419 /*----------------------------------------------------------------------*/
1424 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1426 return chtml10->out;
1431 * It is a handler who processes the A tag.
1433 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1434 * destination is specified.
1435 * @param node [i] The A tag node is specified.
1436 * @return The conversion result is returned.
1439 s_chtml10_end_a_tag(void* pdoc, Node* child)
1445 chtml10 = GET_CHTML10(pdoc);
1449 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1451 return chtml10->out;
1456 * It is a handler who processes the BR tag.
1458 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1459 * destination is specified.
1460 * @param node [i] The BR tag node is specified.
1461 * @return The conversion result is returned.
1464 s_chtml10_start_br_tag(void* pdoc, Node* node)
1470 chtml10 = GET_CHTML10(pdoc);
1474 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1476 return chtml10->out;
1481 * It is a handler who processes the BR tag.
1483 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1484 * destination is specified.
1485 * @param node [i] The BR tag node is specified.
1486 * @return The conversion result is returned.
1489 s_chtml10_end_br_tag(void* pdoc, Node* child)
1491 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1493 return chtml10->out;
1498 * It is a handler who processes the TR tag.
1500 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1501 * destination is specified.
1502 * @param node [i] The TR tag node is specified.
1503 * @return The conversion result is returned.
1506 s_chtml10_start_tr_tag(void* pdoc, Node* node)
1508 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1510 return chtml10->out;
1515 * It is a handler who processes the TR tag.
1517 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1518 * destination is specified.
1519 * @param node [i] The TR tag node is specified.
1520 * @return The conversion result is returned.
1523 s_chtml10_end_tr_tag(void* pdoc, Node* child)
1529 chtml10 = GET_CHTML10(pdoc);
1533 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1535 return chtml10->out;
1540 * It is a handler who processes the FONT tag.
1542 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1543 * destination is specified.
1544 * @param node [i] The FONT tag node is specified.
1545 * @return The conversion result is returned.
1548 s_chtml10_start_font_tag(void* pdoc, Node* node)
1550 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1554 return chtml10->out;
1559 * It is a handler who processes the FONT tag.
1561 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1562 * destination is specified.
1563 * @param node [i] The FONT tag node is specified.
1564 * @return The conversion result is returned.
1567 s_chtml10_end_font_tag(void* pdoc, Node* child)
1569 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1573 return chtml10->out;
1578 * It is a handler who processes the FORM tag.
1580 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1581 * destination is specified.
1582 * @param node [i] The FORM tag node is specified.
1583 * @return The conversion result is returned.
1586 s_chtml10_start_form_tag(void* pdoc, Node* node)
1593 chtml10 = GET_CHTML10(pdoc);
1597 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1599 /*--------------------------------------------------------------------------*/
1600 /* Get Attributes */
1601 /*--------------------------------------------------------------------------*/
1602 for (attr = qs_get_attr(doc,node);
1604 attr = qs_get_next_attr(doc,attr)) {
1605 char* name = qs_get_attr_name(doc,attr);
1606 char* value = qs_get_attr_value(doc,attr);
1607 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1608 /*----------------------------------------------------------------------*/
1610 /*----------------------------------------------------------------------*/
1611 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
1613 chtml10->out = apr_pstrcat(r->pool,
1621 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "method") == 0) {
1622 /*----------------------------------------------------------------------*/
1624 /*----------------------------------------------------------------------*/
1625 chtml10->out = apr_pstrcat(r->pool,
1633 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1634 /*----------------------------------------------------------------------*/
1636 /*----------------------------------------------------------------------*/
1641 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1643 return chtml10->out;
1648 * It is a handler who processes the FORM tag.
1650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1651 * destination is specified.
1652 * @param node [i] The FORM tag node is specified.
1653 * @return The conversion result is returned.
1656 s_chtml10_end_form_tag(void* pdoc, Node* child)
1662 chtml10 = GET_CHTML10(pdoc);
1666 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1668 return chtml10->out;
1673 * It is a handler who processes the INPUT tag.
1675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1676 * destination is specified.
1677 * @param node [i] The INPUT tag node is specified.
1678 * @return The conversion result is returned.
1681 s_chtml10_start_input_tag(void* pdoc, Node* node)
1695 chtml10 = GET_CHTML10(pdoc);
1708 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1710 /*--------------------------------------------------------------------------*/
1711 /* Get Attributes */
1712 /*--------------------------------------------------------------------------*/
1714 type = qs_get_type_attr(doc, node, r);
1715 name = qs_get_name_attr(doc, node, r);
1716 value = qs_get_value_attr(doc,node,r);
1717 istyle = qs_get_istyle_attr(doc,node,r);
1718 max_length = qs_get_maxlength_attr(doc,node,r);
1719 checked = qs_get_checked_attr(doc,node,r);
1720 accesskey = qs_get_accesskey_attr(doc, node, r);
1721 size = qs_get_size_attr(doc, node, r);
1724 chtml10->out = apr_pstrcat(r->pool,
1732 chtml10->out = apr_pstrcat(r->pool,
1740 chtml10->out = apr_pstrcat(r->pool,
1748 chtml10->out = apr_pstrcat(r->pool,
1756 chtml10->out = apr_pstrcat(r->pool,
1763 /*------------------------------------------------------------------------*/
1765 /*------------------------------------------------------------------------*/
1768 /*--------------------------------------------------------------------------*/
1769 /* The figure is default for the password. */
1770 /*--------------------------------------------------------------------------*/
1772 chtml10->out = apr_pstrcat(r->pool,
1780 chtml10->out = apr_pstrcat(r->pool,
1781 chtml10->out, " checked ", NULL);
1783 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1785 return chtml10->out;
1790 * It is a handler who processes the INPUT tag.
1792 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1793 * destination is specified.
1794 * @param node [i] The INPUT tag node is specified.
1795 * @return The conversion result is returned.
1798 s_chtml10_end_input_tag(void* pdoc, Node* child)
1800 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1802 return chtml10->out;
1807 * It is a handler who processes the CENTER tag.
1809 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1810 * destination is specified.
1811 * @param node [i] The CENTER tag node is specified.
1812 * @return The conversion result is returned.
1815 s_chtml10_start_center_tag(void* pdoc, Node* node)
1821 chtml10 = GET_CHTML10(pdoc);
1825 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1827 return chtml10->out;
1832 * It is a handler who processes the CENTER tag.
1834 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1835 * destination is specified.
1836 * @param node [i] The CENTER tag node is specified.
1837 * @return The conversion result is returned.
1840 s_chtml10_end_center_tag(void* pdoc, Node* child)
1846 chtml10 = GET_CHTML10(pdoc);
1850 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1852 return chtml10->out;
1857 * It is a handler who processes the HR tag.
1859 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1860 * destination is specified.
1861 * @param node [i] The HR tag node is specified.
1862 * @return The conversion result is returned.
1865 s_chtml10_start_hr_tag(void* pdoc, Node* node)
1872 chtml10 = GET_CHTML10(pdoc);
1876 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1878 for (attr = qs_get_attr(doc,node);
1880 attr = qs_get_next_attr(doc,attr)) {
1884 name = qs_get_attr_name (doc,attr);
1885 value = qs_get_attr_value(doc,attr);
1887 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
1888 /*----------------------------------------------------------------------*/
1890 /*----------------------------------------------------------------------*/
1891 chtml10->out = apr_pstrcat(r->pool,
1893 " align=\"", value, "\" ", NULL);
1896 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1897 /*----------------------------------------------------------------------*/
1899 /*----------------------------------------------------------------------*/
1900 chtml10->out = apr_pstrcat(r->pool,
1902 " size=\"", value, "\" ", NULL);
1905 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
1906 /*----------------------------------------------------------------------*/
1908 /*----------------------------------------------------------------------*/
1909 chtml10->out = apr_pstrcat(r->pool,
1911 " width=\"", value, "\" ", NULL);
1914 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
1915 /*----------------------------------------------------------------------*/
1917 /*----------------------------------------------------------------------*/
1918 chtml10->out = apr_pstrcat(r->pool,
1923 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1924 /*----------------------------------------------------------------------*/
1926 /*----------------------------------------------------------------------*/
1931 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1933 return chtml10->out;
1938 * It is a handler who processes the HR tag.
1940 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1941 * destination is specified.
1942 * @param node [i] The HR tag node is specified.
1943 * @return The conversion result is returned.
1946 s_chtml10_end_hr_tag(void* pdoc, Node* child)
1950 chtml10 = GET_CHTML10(pdoc);
1952 return chtml10->out;
1957 * It is a handler who processes the IMG tag.
1959 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1960 * destination is specified.
1961 * @param node [i] The IMG tag node is specified.
1962 * @return The conversion result is returned.
1965 s_chtml10_start_img_tag(void* pdoc, Node* node)
1971 #ifndef IMG_NOT_CONVERT_FILENAME
1972 device_table_t* spec;
1975 chtml10 = GET_CHTML10(pdoc);
1976 #ifndef IMG_NOT_CONVERT_FILENAME
1977 spec = chtml10->spec;
1982 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
1985 /*--------------------------------------------------------------------------*/
1986 /* Get Attributes */
1987 /*--------------------------------------------------------------------------*/
1988 for (attr = qs_get_attr(doc,node);
1990 attr = qs_get_next_attr(doc,attr)) {
1994 name = qs_get_attr_name (doc,attr);
1995 value = qs_get_attr_value(doc,attr);
1997 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
1998 /*----------------------------------------------------------------------*/
2000 /*----------------------------------------------------------------------*/
2001 #ifdef IMG_NOT_CONVERT_FILENAME
2002 chtml10->out = apr_pstrcat(r->pool,
2003 chtml10->out, " src=\"",value,"\"", NULL);
2005 chtml10->out = apr_pstrcat(r->pool,
2006 chtml10->out, " src=\"",
2007 chxj_img_conv(r, spec, value), NULL);
2008 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2012 if (*name == 'a' || *name == 'A') {
2013 if (strcasecmp(name, "align" ) == 0) {
2014 /*--------------------------------------------------------------------*/
2016 /*--------------------------------------------------------------------*/
2017 /*--------------------------------------------------------------------*/
2019 /*--------------------------------------------------------------------*/
2020 chtml10->out = apr_pstrcat(r->pool,
2021 chtml10->out, " align=\"",value,"\"", NULL);
2024 if (strcasecmp(name, "alt" ) == 0) {
2025 /*--------------------------------------------------------------------*/
2027 /*--------------------------------------------------------------------*/
2028 chtml10->out = apr_pstrcat(r->pool,
2029 chtml10->out, " alt=\"",value,"\"", NULL);
2033 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2034 /*----------------------------------------------------------------------*/
2036 /*----------------------------------------------------------------------*/
2037 chtml10->out = apr_pstrcat(r->pool,
2038 chtml10->out, " width=\"",value,"\"", NULL);
2041 if (*name == 'h' || *name == 'H') {
2042 if (strcasecmp(name, "height") == 0) {
2043 /*--------------------------------------------------------------------*/
2045 /*--------------------------------------------------------------------*/
2046 chtml10->out = apr_pstrcat(r->pool,
2047 chtml10->out, " height=\"",value,"\"", NULL);
2050 if (strcasecmp(name, "hspace") == 0) {
2051 /*--------------------------------------------------------------------*/
2053 /*--------------------------------------------------------------------*/
2054 chtml10->out = apr_pstrcat(r->pool,
2055 chtml10->out, " hspace=\"",value,"\"", NULL);
2059 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2060 /*----------------------------------------------------------------------*/
2062 /*----------------------------------------------------------------------*/
2063 chtml10->out = apr_pstrcat(r->pool,
2064 chtml10->out, " vspace=\"",value,"\"", NULL);
2068 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2070 return chtml10->out;
2075 * It is a handler who processes the IMG tag.
2077 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2078 * destination is specified.
2079 * @param node [i] The IMG tag node is specified.
2080 * @return The conversion result is returned.
2083 s_chtml10_end_img_tag(void* pdoc, Node* child)
2087 chtml10 = GET_CHTML10(pdoc);
2089 return chtml10->out;
2094 * It is a handler who processes the SELECT tag.
2096 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2097 * destination is specified.
2098 * @param node [i] The SELECT tag node is specified.
2099 * @return The conversion result is returned.
2102 s_chtml10_start_select_tag(void* pdoc, Node* child)
2112 chtml10 = GET_CHTML10(pdoc);
2119 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2120 for (attr = qs_get_attr(doc,child);
2122 attr = qs_get_next_attr(doc,attr)) {
2126 nm = qs_get_attr_name (doc,attr);
2127 val = qs_get_attr_value(doc,attr);
2129 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "size") == 0) {
2130 /*----------------------------------------------------------------------*/
2131 /* CHTML 1.0 version 2.0 */
2132 /*----------------------------------------------------------------------*/
2133 size = apr_pstrdup(r->pool, val);
2136 if ((*nm == 'n' || *nm == 'N') && strcasecmp(nm, "name") == 0) {
2137 /*----------------------------------------------------------------------*/
2138 /* CHTML 1.0 version 2.0 */
2139 /*----------------------------------------------------------------------*/
2140 name = apr_pstrdup(r->pool, val);
2143 if ((*nm == 'm' || *nm == 'M') && strcasecmp(nm, "multiple") == 0) {
2144 /*----------------------------------------------------------------------*/
2145 /* CHTML 1.0 version 2.0 */
2146 /*----------------------------------------------------------------------*/
2152 chtml10->out = apr_pstrcat(r->pool,
2160 chtml10->out = apr_pstrcat(r->pool,
2167 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2168 return chtml10->out;
2173 * It is a handler who processes the SELECT tag.
2175 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2176 * destination is specified.
2177 * @param node [i] The SELECT tag node is specified.
2178 * @return The conversion result is returned.
2181 s_chtml10_end_select_tag(void* pdoc, Node* child)
2187 chtml10 = GET_CHTML10(pdoc);
2191 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2193 return chtml10->out;
2198 * It is a handler who processes the OPTION tag.
2200 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2201 * destination is specified.
2202 * @param node [i] The OPTION tag node is specified.
2203 * @return The conversion result is returned.
2206 s_chtml10_start_option_tag(void* pdoc, Node* child)
2213 char* selected = NULL;
2216 chtml10 = GET_CHTML10(pdoc);
2220 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2221 for (attr = qs_get_attr(doc,child);
2223 attr = qs_get_next_attr(doc,attr)) {
2224 char* nm = qs_get_attr_name(doc,attr);
2225 char* val = qs_get_attr_value(doc,attr);
2227 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
2228 /*----------------------------------------------------------------------*/
2229 /* CHTML 1.0 version 2.0 */
2230 /*----------------------------------------------------------------------*/
2231 selected = apr_pstrdup(r->pool, val);
2234 if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
2235 /*----------------------------------------------------------------------*/
2236 /* CHTML 1.0 version 2.0 */
2237 /*----------------------------------------------------------------------*/
2238 value = apr_pstrdup(r->pool, val);
2243 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " value=\"",value,"\"", NULL);
2245 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " value=\"\"", NULL);
2248 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " selected ", NULL);
2250 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2252 return chtml10->out;
2257 * It is a handler who processes the OPTION tag.
2259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2260 * destination is specified.
2261 * @param node [i] The OPTION tag node is specified.
2262 * @return The conversion result is returned.
2265 s_chtml10_end_option_tag(void* pdoc, Node* child)
2269 chtml10 = GET_CHTML10(pdoc);
2273 return chtml10->out;
2278 * It is a handler who processes the DIV tag.
2280 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2281 * destination is specified.
2282 * @param node [i] The DIV tag node is specified.
2283 * @return The conversion result is returned.
2286 s_chtml10_start_div_tag(void* pdoc, Node* child)
2295 chtml10 = GET_CHTML10(pdoc);
2299 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2300 for (attr = qs_get_attr(doc,child);
2302 attr = qs_get_next_attr(doc,attr)) {
2303 char* nm = qs_get_attr_name(doc,attr);
2304 char* val = qs_get_attr_value(doc,attr);
2306 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2307 /*----------------------------------------------------------------------*/
2308 /* CHTML 1.0 (W3C version 3.2) */
2309 /*----------------------------------------------------------------------*/
2310 align = apr_pstrdup(r->pool, val);
2315 chtml10->out = apr_pstrcat(r->pool,
2316 chtml10->out, " align=\"", align, "\"", NULL);
2318 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2320 return chtml10->out;
2324 * It is a handler who processes the DIV tag.
2326 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2327 * destination is specified.
2328 * @param node [i] The DIV tag node is specified.
2329 * @return The conversion result is returned.
2332 s_chtml10_end_div_tag(void* pdoc, Node* child)
2338 chtml10 = GET_CHTML10(pdoc);
2342 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2344 return chtml10->out;
2349 * It is a handler who processes the CHXJ:IF tag.
2351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2352 * destination is specified.
2353 * @param node [i] The CHXJ:IF tag node is specified.
2354 * @return The conversion result is returned.
2357 s_chtml10_chxjif_tag(void* pdoc, Node* node)
2364 chtml10 = GET_CHTML10(pdoc);
2368 for (child = qs_get_child_node(doc, node);
2370 child = qs_get_next_node(doc, child)) {
2371 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2372 s_chtml10_chxjif_tag(chtml10, child);
2375 return chtml10->out;
2380 * It is a handler who processes the PRE tag.
2382 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2383 * destination is specified.
2384 * @param node [i] The PRE tag node is specified.
2385 * @return The conversion result is returned.
2388 s_chtml10_start_pre_tag(void* pdoc, Node* node)
2394 chtml10 = GET_CHTML10(pdoc);
2398 chtml10->pre_flag++;
2399 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2401 return chtml10->out;
2406 * It is a handler who processes the PRE tag.
2408 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2409 * destination is specified.
2410 * @param node [i] The PRE tag node is specified.
2411 * @return The conversion result is returned.
2414 s_chtml10_end_pre_tag(void* pdoc, Node* child)
2420 chtml10 = GET_CHTML10(pdoc);
2424 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2425 chtml10->pre_flag--;
2427 return chtml10->out;
2431 * It is a handler who processes the P tag.
2433 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2434 * destination is specified.
2435 * @param node [i] The P tag node is specified.
2436 * @return The conversion result is returned.
2439 s_chtml10_start_p_tag(void* pdoc, Node* node)
2445 chtml10 = GET_CHTML10(pdoc);
2449 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2451 return chtml10->out;
2455 * It is a handler who processes the P tag.
2457 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2458 * destination is specified.
2459 * @param node [i] The P tag node is specified.
2460 * @return The conversion result is returned.
2463 s_chtml10_end_p_tag(void* pdoc, Node* child)
2469 chtml10 = GET_CHTML10(pdoc);
2473 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2475 return chtml10->out;
2479 * It is a handler who processes the TEXTARE tag.
2481 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2482 * destination is specified.
2483 * @param node [i] The TEXTAREA tag node is specified.
2484 * @return The conversion result is returned.
2487 s_chtml10_start_textarea_tag(void* pdoc, Node* node)
2494 chtml10 = GET_CHTML10(pdoc);
2499 chtml10->textarea_flag++;
2500 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2502 for (attr = qs_get_attr(doc,node);
2504 attr = qs_get_next_attr(doc,attr)) {
2506 char* name = qs_get_attr_name(doc,attr);
2507 char* value = qs_get_attr_value(doc,attr);
2509 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2510 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " name=\"",value,"\"", NULL);
2513 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2514 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " rows=\"",value,"\"", NULL);
2517 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2518 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " cols=\"",value,"\"", NULL);
2522 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2524 return chtml10->out;
2528 * It is a handler who processes the TEXTAREA tag.
2530 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2531 * destination is specified.
2532 * @param node [i] The TEXTAREA tag node is specified.
2533 * @return The conversion result is returned.
2536 s_chtml10_end_textarea_tag(void* pdoc, Node* child)
2542 chtml10 = GET_CHTML10(pdoc);
2546 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2547 chtml10->textarea_flag--;
2549 return chtml10->out;
2554 s_chtml10_text(void* pdoc, Node* child)
2566 chtml10 = GET_CHTML10(pdoc);
2570 textval = qs_get_node_value(doc,child);
2571 textval = qs_trim_string(r, textval);
2572 if (strlen(textval) == 0)
2573 return chtml10->out;
2575 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2576 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2578 tdst = qs_alloc_zero_byte_string(r);
2579 memset(one_byte, 0, sizeof(one_byte));
2582 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2584 int rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2586 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2591 if (is_sjis_kanji(textval[ii])) {
2592 one_byte[0] = textval[ii+0];
2593 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2594 one_byte[0] = textval[ii+1];
2595 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2599 if (chtml10->pre_flag) {
2600 one_byte[0] = textval[ii+0];
2601 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2604 if (chtml10->textarea_flag) {
2605 one_byte[0] = textval[ii+0];
2606 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2609 if (textval[ii] != '\r' && textval[ii] != '\n') {
2610 one_byte[0] = textval[ii+0];
2611 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2614 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2616 return chtml10->out;