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;
1856 * It is a handler who processes the HR tag.
1858 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1859 * destination is specified.
1860 * @param node [i] The HR tag node is specified.
1861 * @return The conversion result is returned.
1864 s_chtml10_start_hr_tag(void* pdoc, Node* node)
1871 chtml10 = GET_CHTML10(pdoc);
1875 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1877 for (attr = qs_get_attr(doc,node);
1879 attr = qs_get_next_attr(doc,attr)) {
1880 char* name = qs_get_attr_name(doc,attr);
1881 char* value = qs_get_attr_value(doc,attr);
1882 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
1883 /*----------------------------------------------------------------------*/
1885 /*----------------------------------------------------------------------*/
1886 chtml10->out = apr_pstrcat(r->pool,
1888 " align=\"", value, "\" ", NULL);
1891 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1892 /*----------------------------------------------------------------------*/
1894 /*----------------------------------------------------------------------*/
1895 chtml10->out = apr_pstrcat(r->pool,
1897 " size=\"", value, "\" ", NULL);
1900 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
1901 /*----------------------------------------------------------------------*/
1903 /*----------------------------------------------------------------------*/
1904 chtml10->out = apr_pstrcat(r->pool,
1906 " width=\"", value, "\" ", NULL);
1909 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
1910 /*----------------------------------------------------------------------*/
1912 /*----------------------------------------------------------------------*/
1913 chtml10->out = apr_pstrcat(r->pool,
1918 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1919 /*----------------------------------------------------------------------*/
1921 /*----------------------------------------------------------------------*/
1925 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1927 return chtml10->out;
1932 * It is a handler who processes the HR tag.
1934 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1935 * destination is specified.
1936 * @param node [i] The HR tag node is specified.
1937 * @return The conversion result is returned.
1940 s_chtml10_end_hr_tag(void* pdoc, Node* child)
1942 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1944 return chtml10->out;
1949 * It is a handler who processes the IMG tag.
1951 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1952 * destination is specified.
1953 * @param node [i] The IMG tag node is specified.
1954 * @return The conversion result is returned.
1957 s_chtml10_start_img_tag(void* pdoc, Node* node)
1963 #ifndef IMG_NOT_CONVERT_FILENAME
1964 device_table_t* spec;
1967 chtml10 = GET_CHTML10(pdoc);
1968 #ifndef IMG_NOT_CONVERT_FILENAME
1969 spec = chtml10->spec;
1974 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
1977 /*--------------------------------------------------------------------------*/
1978 /* Get Attributes */
1979 /*--------------------------------------------------------------------------*/
1980 for (attr = qs_get_attr(doc,node);
1982 attr = qs_get_next_attr(doc,attr)) {
1983 char* name = qs_get_attr_name(doc,attr);
1984 char* value = qs_get_attr_value(doc,attr);
1986 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
1987 /*----------------------------------------------------------------------*/
1989 /*----------------------------------------------------------------------*/
1990 #ifdef IMG_NOT_CONVERT_FILENAME
1991 chtml10->out = apr_pstrcat(r->pool,
1992 chtml10->out, " src=\"",value,"\"", NULL);
1994 chtml10->out = apr_pstrcat(r->pool,
1995 chtml10->out, " src=\"",
1996 chxj_img_conv(r, spec, value), NULL);
1997 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2001 if (*name == 'a' || *name == 'A') {
2002 if (strcasecmp(name, "align" ) == 0) {
2003 /*----------------------------------------------------------------------*/
2005 /*----------------------------------------------------------------------*/
2006 /*----------------------------------------------------------------------*/
2008 /*----------------------------------------------------------------------*/
2009 chtml10->out = apr_pstrcat(r->pool,
2010 chtml10->out, " align=\"",value,"\"", NULL);
2013 if (strcasecmp(name, "alt" ) == 0) {
2014 /*----------------------------------------------------------------------*/
2016 /*----------------------------------------------------------------------*/
2017 chtml10->out = apr_pstrcat(r->pool,
2018 chtml10->out, " alt=\"",value,"\"", NULL);
2022 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2023 /*----------------------------------------------------------------------*/
2025 /*----------------------------------------------------------------------*/
2026 chtml10->out = apr_pstrcat(r->pool,
2027 chtml10->out, " width=\"",value,"\"", NULL);
2030 if (*name == 'h' || *name == 'H') {
2031 if (strcasecmp(name, "height") == 0) {
2032 /*----------------------------------------------------------------------*/
2034 /*----------------------------------------------------------------------*/
2035 chtml10->out = apr_pstrcat(r->pool,
2036 chtml10->out, " height=\"",value,"\"", NULL);
2039 if (strcasecmp(name, "hspace") == 0) {
2040 /*----------------------------------------------------------------------*/
2042 /*----------------------------------------------------------------------*/
2043 chtml10->out = apr_pstrcat(r->pool,
2044 chtml10->out, " hspace=\"",value,"\"", NULL);
2048 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2049 /*----------------------------------------------------------------------*/
2051 /*----------------------------------------------------------------------*/
2052 chtml10->out = apr_pstrcat(r->pool,
2053 chtml10->out, " vspace=\"",value,"\"", NULL);
2057 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2059 return chtml10->out;
2064 * It is a handler who processes the IMG tag.
2066 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2067 * destination is specified.
2068 * @param node [i] The IMG tag node is specified.
2069 * @return The conversion result is returned.
2072 s_chtml10_end_img_tag(void* pdoc, Node* child)
2074 chtml10_t* chtml10 = GET_CHTML10(pdoc);
2076 return chtml10->out;
2081 * It is a handler who processes the SELECT tag.
2083 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2084 * destination is specified.
2085 * @param node [i] The SELECT tag node is specified.
2086 * @return The conversion result is returned.
2089 s_chtml10_start_select_tag(void* pdoc, Node* child)
2099 chtml10 = GET_CHTML10(pdoc);
2103 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2104 for (attr = qs_get_attr(doc,child);
2106 attr = qs_get_next_attr(doc,attr)) {
2107 char* nm = qs_get_attr_name(doc,attr);
2108 char* val = qs_get_attr_value(doc,attr);
2110 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "size") == 0) {
2111 /*----------------------------------------------------------------------*/
2112 /* CHTML 1.0 version 2.0 */
2113 /*----------------------------------------------------------------------*/
2114 size = apr_pstrdup(r->pool, val);
2117 if ((*nm == 'n' || *nm == 'N') && strcasecmp(nm, "name") == 0) {
2118 /*----------------------------------------------------------------------*/
2119 /* CHTML 1.0 version 2.0 */
2120 /*----------------------------------------------------------------------*/
2121 name = apr_pstrdup(r->pool, val);
2124 if ((*nm == 'm' || *nm == 'M') && strcasecmp(nm, "multiple") == 0) {
2125 /*----------------------------------------------------------------------*/
2126 /* CHTML 1.0 version 2.0 */
2127 /*----------------------------------------------------------------------*/
2133 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " size=\"",size,"\"", NULL);
2136 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " name=\"",name,"\"", NULL);
2138 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2139 return chtml10->out;
2144 * It is a handler who processes the SELECT tag.
2146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2147 * destination is specified.
2148 * @param node [i] The SELECT tag node is specified.
2149 * @return The conversion result is returned.
2152 s_chtml10_end_select_tag(void* pdoc, Node* child)
2158 chtml10 = GET_CHTML10(pdoc);
2162 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2164 return chtml10->out;
2169 * It is a handler who processes the OPTION tag.
2171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2172 * destination is specified.
2173 * @param node [i] The OPTION tag node is specified.
2174 * @return The conversion result is returned.
2177 s_chtml10_start_option_tag(void* pdoc, Node* child)
2184 char* selected = NULL;
2187 chtml10 = GET_CHTML10(pdoc);
2191 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2192 for (attr = qs_get_attr(doc,child);
2194 attr = qs_get_next_attr(doc,attr)) {
2195 char* nm = qs_get_attr_name(doc,attr);
2196 char* val = qs_get_attr_value(doc,attr);
2198 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
2199 /*----------------------------------------------------------------------*/
2200 /* CHTML 1.0 version 2.0 */
2201 /*----------------------------------------------------------------------*/
2202 selected = apr_pstrdup(r->pool, val);
2205 if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
2206 /*----------------------------------------------------------------------*/
2207 /* CHTML 1.0 version 2.0 */
2208 /*----------------------------------------------------------------------*/
2209 value = apr_pstrdup(r->pool, val);
2214 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " value=\"",value,"\"", NULL);
2216 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " value=\"\"", NULL);
2219 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " selected ", NULL);
2221 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2223 return chtml10->out;
2228 * It is a handler who processes the OPTION tag.
2230 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2231 * destination is specified.
2232 * @param node [i] The OPTION tag node is specified.
2233 * @return The conversion result is returned.
2236 s_chtml10_end_option_tag(void* pdoc, Node* child)
2240 chtml10 = GET_CHTML10(pdoc);
2244 return chtml10->out;
2249 * It is a handler who processes the DIV tag.
2251 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2252 * destination is specified.
2253 * @param node [i] The DIV tag node is specified.
2254 * @return The conversion result is returned.
2257 s_chtml10_start_div_tag(void* pdoc, Node* child)
2266 chtml10 = GET_CHTML10(pdoc);
2270 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2271 for (attr = qs_get_attr(doc,child);
2273 attr = qs_get_next_attr(doc,attr)) {
2274 char* nm = qs_get_attr_name(doc,attr);
2275 char* val = qs_get_attr_value(doc,attr);
2277 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2278 /*----------------------------------------------------------------------*/
2279 /* CHTML 1.0 (W3C version 3.2) */
2280 /*----------------------------------------------------------------------*/
2281 align = apr_pstrdup(r->pool, val);
2286 chtml10->out = apr_pstrcat(r->pool,
2287 chtml10->out, " align=\"", align, "\"", NULL);
2289 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2291 return chtml10->out;
2295 * It is a handler who processes the DIV tag.
2297 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2298 * destination is specified.
2299 * @param node [i] The DIV tag node is specified.
2300 * @return The conversion result is returned.
2303 s_chtml10_end_div_tag(void* pdoc, Node* child)
2309 chtml10 = GET_CHTML10(pdoc);
2313 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2315 return chtml10->out;
2320 * It is a handler who processes the CHXJ:IF tag.
2322 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2323 * destination is specified.
2324 * @param node [i] The CHXJ:IF tag node is specified.
2325 * @return The conversion result is returned.
2328 s_chtml10_chxjif_tag(void* pdoc, Node* node)
2335 chtml10 = GET_CHTML10(pdoc);
2339 for (child = qs_get_child_node(doc, node);
2341 child = qs_get_next_node(doc, child)) {
2342 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2343 s_chtml10_chxjif_tag(chtml10, child);
2346 return chtml10->out;
2351 * It is a handler who processes the PRE tag.
2353 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2354 * destination is specified.
2355 * @param node [i] The PRE tag node is specified.
2356 * @return The conversion result is returned.
2359 s_chtml10_start_pre_tag(void* pdoc, Node* node)
2365 chtml10 = GET_CHTML10(pdoc);
2369 chtml10->pre_flag++;
2370 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2372 return chtml10->out;
2377 * It is a handler who processes the PRE tag.
2379 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2380 * destination is specified.
2381 * @param node [i] The PRE tag node is specified.
2382 * @return The conversion result is returned.
2385 s_chtml10_end_pre_tag(void* pdoc, Node* child)
2391 chtml10 = GET_CHTML10(pdoc);
2395 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2396 chtml10->pre_flag--;
2398 return chtml10->out;
2402 * It is a handler who processes the P tag.
2404 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2405 * destination is specified.
2406 * @param node [i] The P tag node is specified.
2407 * @return The conversion result is returned.
2410 s_chtml10_start_p_tag(void* pdoc, Node* node)
2416 chtml10 = GET_CHTML10(pdoc);
2420 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2422 return chtml10->out;
2426 * It is a handler who processes the P tag.
2428 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2429 * destination is specified.
2430 * @param node [i] The P tag node is specified.
2431 * @return The conversion result is returned.
2434 s_chtml10_end_p_tag(void* pdoc, Node* child)
2440 chtml10 = GET_CHTML10(pdoc);
2444 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2446 return chtml10->out;
2450 * It is a handler who processes the TEXTARE tag.
2452 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2453 * destination is specified.
2454 * @param node [i] The TEXTAREA tag node is specified.
2455 * @return The conversion result is returned.
2458 s_chtml10_start_textarea_tag(void* pdoc, Node* node)
2465 chtml10 = GET_CHTML10(pdoc);
2470 chtml10->textarea_flag++;
2471 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2473 for (attr = qs_get_attr(doc,node);
2475 attr = qs_get_next_attr(doc,attr)) {
2477 char* name = qs_get_attr_name(doc,attr);
2478 char* value = qs_get_attr_value(doc,attr);
2480 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2481 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " name=\"",value,"\"", NULL);
2484 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2485 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " rows=\"",value,"\"", NULL);
2488 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2489 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " cols=\"",value,"\"", NULL);
2493 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2495 return chtml10->out;
2499 * It is a handler who processes the TEXTAREA tag.
2501 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2502 * destination is specified.
2503 * @param node [i] The TEXTAREA tag node is specified.
2504 * @return The conversion result is returned.
2507 s_chtml10_end_textarea_tag(void* pdoc, Node* child)
2513 chtml10 = GET_CHTML10(pdoc);
2517 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2518 chtml10->textarea_flag--;
2520 return chtml10->out;
2525 s_chtml10_text(void* pdoc, Node* child)
2537 chtml10 = GET_CHTML10(pdoc);
2541 textval = qs_get_node_value(doc,child);
2542 textval = qs_trim_string(r, textval);
2543 if (strlen(textval) == 0)
2544 return chtml10->out;
2546 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2547 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2549 tdst = qs_alloc_zero_byte_string(r);
2550 memset(one_byte, 0, sizeof(one_byte));
2553 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2555 int rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2557 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2562 if (is_sjis_kanji(textval[ii])) {
2563 one_byte[0] = textval[ii+0];
2564 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2565 one_byte[0] = textval[ii+1];
2566 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2570 if (chtml10->pre_flag) {
2571 one_byte[0] = textval[ii+0];
2572 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2575 if (chtml10->textarea_flag) {
2576 one_byte[0] = textval[ii+0];
2577 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2580 if (textval[ii] != '\r' && textval[ii] != '\n') {
2581 one_byte[0] = textval[ii+0];
2582 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2585 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2587 return chtml10->out;