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)) {
1156 name = qs_get_attr_name(doc,attr);
1157 value = qs_get_attr_value(doc,attr);
1159 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1160 chtml10->out = apr_pstrcat(r->pool,
1169 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
1171 return chtml10->out;
1176 * It is a handler who processes the BASE tag.
1178 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1179 * destination is specified.
1180 * @param node [i] The BASE tag node is specified.
1181 * @return The conversion result is returned.
1184 s_chtml10_end_base_tag(void* pdoc, Node* child)
1186 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1188 return chtml10->out;
1193 * It is a handler who processes the BODY tag.
1195 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1196 * destination is specified.
1197 * @param node [i] The BODY tag node is specified.
1198 * @return The conversion result is returned.
1201 s_chtml10_start_body_tag(void* pdoc, Node* node)
1208 chtml10 = GET_CHTML10(pdoc);
1212 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
1214 /*--------------------------------------------------------------------------*/
1215 /* Get Attributes */
1216 /*--------------------------------------------------------------------------*/
1217 for (attr = qs_get_attr(doc,node);
1219 attr = qs_get_next_attr(doc,attr)) {
1223 name = qs_get_attr_name(doc,attr);
1228 if (strcasecmp(name, "alink") == 0) {
1229 /*----------------------------------------------------------------------*/
1231 /*----------------------------------------------------------------------*/
1238 if (strcasecmp(name, "bgcolor") == 0) {
1239 /*----------------------------------------------------------------------*/
1241 /*----------------------------------------------------------------------*/
1248 if (strcasecmp(name, "text") == 0) {
1249 /*----------------------------------------------------------------------*/
1251 /*----------------------------------------------------------------------*/
1258 if (strcasecmp(name, "link") == 0) {
1259 /*----------------------------------------------------------------------*/
1261 /*----------------------------------------------------------------------*/
1268 if (strcasecmp(name, "vlink") == 0) {
1269 /*----------------------------------------------------------------------*/
1271 /*----------------------------------------------------------------------*/
1281 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
1283 return chtml10->out;
1288 * It is a handler who processes the BODY tag.
1290 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1291 * destination is specified.
1292 * @param node [i] The BODY tag node is specified.
1293 * @return The conversion result is returned.
1296 s_chtml10_end_body_tag(void* pdoc, Node* child)
1302 chtml10 = GET_CHTML10(pdoc);
1306 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
1308 return chtml10->out;
1313 * It is a handler who processes the A tag.
1315 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1316 * destination is specified.
1317 * @param node [i] The A tag node is specified.
1318 * @return The conversion result is returned.
1321 s_chtml10_start_a_tag(void* pdoc, Node* node)
1328 chtml10 = GET_CHTML10(pdoc);
1332 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
1334 /*--------------------------------------------------------------------------*/
1335 /* Get Attributes */
1336 /*--------------------------------------------------------------------------*/
1337 for (attr = qs_get_attr(doc,node);
1339 attr = qs_get_next_attr(doc,attr)) {
1344 name = qs_get_attr_name(doc,attr);
1345 value = qs_get_attr_value(doc,attr);
1350 if (strcasecmp(name, "name") == 0) {
1351 /*----------------------------------------------------------------------*/
1353 /*----------------------------------------------------------------------*/
1354 chtml10->out = apr_pstrcat(r->pool,
1365 if (strcasecmp(name, "href") == 0) {
1366 /*----------------------------------------------------------------------*/
1368 /*----------------------------------------------------------------------*/
1369 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
1371 chtml10->out = apr_pstrcat(r->pool,
1382 if (strcasecmp(name, "accesskey") == 0) {
1383 /*----------------------------------------------------------------------*/
1385 /*----------------------------------------------------------------------*/
1386 chtml10->out = apr_pstrcat(r->pool,
1397 if (strcasecmp(name, "cti") == 0) {
1398 /*----------------------------------------------------------------------*/
1400 /*----------------------------------------------------------------------*/
1407 if (strcasecmp(name, "utn") == 0) {
1408 /*----------------------------------------------------------------------*/
1410 /*----------------------------------------------------------------------*/
1417 if (strcasecmp(name, "telbook") == 0) {
1418 /*----------------------------------------------------------------------*/
1420 /*----------------------------------------------------------------------*/
1427 if (strcasecmp(name, "kana") == 0) {
1428 /*----------------------------------------------------------------------*/
1430 /*----------------------------------------------------------------------*/
1437 if (strcasecmp(name, "email") == 0) {
1438 /*----------------------------------------------------------------------*/
1440 /*----------------------------------------------------------------------*/
1447 if (strcasecmp(name, "ista") == 0) {
1448 /*----------------------------------------------------------------------*/
1450 /*----------------------------------------------------------------------*/
1454 if (strcasecmp(name, "ilet") == 0) {
1455 /*----------------------------------------------------------------------*/
1457 /*----------------------------------------------------------------------*/
1461 if (strcasecmp(name, "iswf") == 0) {
1462 /*----------------------------------------------------------------------*/
1464 /*----------------------------------------------------------------------*/
1468 if (strcasecmp(name, "irst") == 0) {
1469 /*----------------------------------------------------------------------*/
1471 /*----------------------------------------------------------------------*/
1475 if (strcasecmp(name, "ijam") == 0) {
1476 /*----------------------------------------------------------------------*/
1478 /*----------------------------------------------------------------------*/
1488 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1490 return chtml10->out;
1495 * It is a handler who processes the A tag.
1497 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1498 * destination is specified.
1499 * @param node [i] The A tag node is specified.
1500 * @return The conversion result is returned.
1503 s_chtml10_end_a_tag(void* pdoc, Node* child)
1509 chtml10 = GET_CHTML10(pdoc);
1513 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
1515 return chtml10->out;
1520 * It is a handler who processes the BR tag.
1522 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1523 * destination is specified.
1524 * @param node [i] The BR tag node is specified.
1525 * @return The conversion result is returned.
1528 s_chtml10_start_br_tag(void* pdoc, Node* node)
1534 chtml10 = GET_CHTML10(pdoc);
1538 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1540 return chtml10->out;
1545 * It is a handler who processes the BR tag.
1547 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1548 * destination is specified.
1549 * @param node [i] The BR tag node is specified.
1550 * @return The conversion result is returned.
1553 s_chtml10_end_br_tag(void* pdoc, Node* child)
1555 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1557 return chtml10->out;
1562 * It is a handler who processes the TR tag.
1564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1565 * destination is specified.
1566 * @param node [i] The TR tag node is specified.
1567 * @return The conversion result is returned.
1570 s_chtml10_start_tr_tag(void* pdoc, Node* node)
1572 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1574 return chtml10->out;
1579 * It is a handler who processes the TR tag.
1581 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1582 * destination is specified.
1583 * @param node [i] The TR tag node is specified.
1584 * @return The conversion result is returned.
1587 s_chtml10_end_tr_tag(void* pdoc, Node* child)
1593 chtml10 = GET_CHTML10(pdoc);
1597 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
1599 return chtml10->out;
1604 * It is a handler who processes the FONT tag.
1606 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1607 * destination is specified.
1608 * @param node [i] The FONT tag node is specified.
1609 * @return The conversion result is returned.
1612 s_chtml10_start_font_tag(void* pdoc, Node* node)
1614 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1618 return chtml10->out;
1623 * It is a handler who processes the FONT tag.
1625 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1626 * destination is specified.
1627 * @param node [i] The FONT tag node is specified.
1628 * @return The conversion result is returned.
1631 s_chtml10_end_font_tag(void* pdoc, Node* child)
1633 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1637 return chtml10->out;
1642 * It is a handler who processes the FORM tag.
1644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1645 * destination is specified.
1646 * @param node [i] The FORM tag node is specified.
1647 * @return The conversion result is returned.
1650 s_chtml10_start_form_tag(void* pdoc, Node* node)
1657 chtml10 = GET_CHTML10(pdoc);
1661 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
1663 /*--------------------------------------------------------------------------*/
1664 /* Get Attributes */
1665 /*--------------------------------------------------------------------------*/
1666 for (attr = qs_get_attr(doc,node);
1668 attr = qs_get_next_attr(doc,attr)) {
1672 name = qs_get_attr_name(doc,attr);
1673 value = qs_get_attr_value(doc,attr);
1678 if (strcasecmp(name, "action") == 0) {
1679 /*----------------------------------------------------------------------*/
1681 /*----------------------------------------------------------------------*/
1682 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
1684 chtml10->out = apr_pstrcat(r->pool,
1695 if (strcasecmp(name, "method") == 0) {
1696 /*----------------------------------------------------------------------*/
1698 /*----------------------------------------------------------------------*/
1699 chtml10->out = apr_pstrcat(r->pool,
1710 if (strcasecmp(name, "utn") == 0) {
1711 /*----------------------------------------------------------------------*/
1713 /*----------------------------------------------------------------------*/
1723 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
1725 return chtml10->out;
1730 * It is a handler who processes the FORM tag.
1732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1733 * destination is specified.
1734 * @param node [i] The FORM tag node is specified.
1735 * @return The conversion result is returned.
1738 s_chtml10_end_form_tag(void* pdoc, Node* child)
1744 chtml10 = GET_CHTML10(pdoc);
1748 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
1750 return chtml10->out;
1755 * It is a handler who processes the INPUT tag.
1757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1758 * destination is specified.
1759 * @param node [i] The INPUT tag node is specified.
1760 * @return The conversion result is returned.
1763 s_chtml10_start_input_tag(void* pdoc, Node* node)
1777 chtml10 = GET_CHTML10(pdoc);
1790 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
1792 /*--------------------------------------------------------------------------*/
1793 /* Get Attributes */
1794 /*--------------------------------------------------------------------------*/
1796 type = qs_get_type_attr(doc, node, r);
1797 name = qs_get_name_attr(doc, node, r);
1798 value = qs_get_value_attr(doc,node,r);
1799 istyle = qs_get_istyle_attr(doc,node,r);
1800 max_length = qs_get_maxlength_attr(doc,node,r);
1801 checked = qs_get_checked_attr(doc,node,r);
1802 accesskey = qs_get_accesskey_attr(doc, node, r);
1803 size = qs_get_size_attr(doc, node, r);
1806 chtml10->out = apr_pstrcat(r->pool,
1814 chtml10->out = apr_pstrcat(r->pool,
1822 chtml10->out = apr_pstrcat(r->pool,
1830 chtml10->out = apr_pstrcat(r->pool,
1838 chtml10->out = apr_pstrcat(r->pool,
1845 /*------------------------------------------------------------------------*/
1847 /*------------------------------------------------------------------------*/
1850 /*--------------------------------------------------------------------------*/
1851 /* The figure is default for the password. */
1852 /*--------------------------------------------------------------------------*/
1854 chtml10->out = apr_pstrcat(r->pool,
1862 chtml10->out = apr_pstrcat(r->pool,
1863 chtml10->out, " checked ", NULL);
1865 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
1867 return chtml10->out;
1872 * It is a handler who processes the INPUT tag.
1874 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1875 * destination is specified.
1876 * @param node [i] The INPUT tag node is specified.
1877 * @return The conversion result is returned.
1880 s_chtml10_end_input_tag(void* pdoc, Node* child)
1882 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1884 return chtml10->out;
1889 * It is a handler who processes the CENTER tag.
1891 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1892 * destination is specified.
1893 * @param node [i] The CENTER tag node is specified.
1894 * @return The conversion result is returned.
1897 s_chtml10_start_center_tag(void* pdoc, Node* node)
1903 chtml10 = GET_CHTML10(pdoc);
1907 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
1909 return chtml10->out;
1914 * It is a handler who processes the CENTER tag.
1916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1917 * destination is specified.
1918 * @param node [i] The CENTER tag node is specified.
1919 * @return The conversion result is returned.
1922 s_chtml10_end_center_tag(void* pdoc, Node* child)
1928 chtml10 = GET_CHTML10(pdoc);
1932 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
1934 return chtml10->out;
1939 * It is a handler who processes the HR tag.
1941 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1942 * destination is specified.
1943 * @param node [i] The HR tag node is specified.
1944 * @return The conversion result is returned.
1947 s_chtml10_start_hr_tag(void* pdoc, Node* node)
1954 chtml10 = GET_CHTML10(pdoc);
1958 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
1960 for (attr = qs_get_attr(doc,node);
1962 attr = qs_get_next_attr(doc,attr)) {
1967 name = qs_get_attr_name (doc,attr);
1968 value = qs_get_attr_value(doc,attr);
1973 if (strcasecmp(name, "align") == 0) {
1974 /*----------------------------------------------------------------------*/
1976 /*----------------------------------------------------------------------*/
1977 chtml10->out = apr_pstrcat(r->pool,
1979 " align=\"", value, "\" ", NULL);
1985 if (strcasecmp(name, "size") == 0) {
1986 /*----------------------------------------------------------------------*/
1988 /*----------------------------------------------------------------------*/
1989 chtml10->out = apr_pstrcat(r->pool,
1991 " size=\"", value, "\" ", NULL);
1997 if (strcasecmp(name, "width") == 0) {
1998 /*----------------------------------------------------------------------*/
2000 /*----------------------------------------------------------------------*/
2001 chtml10->out = apr_pstrcat(r->pool,
2003 " width=\"", value, "\" ", NULL);
2009 if (strcasecmp(name, "noshade") == 0) {
2010 /*----------------------------------------------------------------------*/
2012 /*----------------------------------------------------------------------*/
2013 chtml10->out = apr_pstrcat(r->pool,
2021 if (strcasecmp(name, "color") == 0) {
2022 /*----------------------------------------------------------------------*/
2024 /*----------------------------------------------------------------------*/
2034 chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
2036 return chtml10->out;
2041 * It is a handler who processes the HR tag.
2043 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2044 * destination is specified.
2045 * @param node [i] The HR tag node is specified.
2046 * @return The conversion result is returned.
2049 s_chtml10_end_hr_tag(void* pdoc, Node* child)
2053 chtml10 = GET_CHTML10(pdoc);
2055 return chtml10->out;
2060 * It is a handler who processes the IMG tag.
2062 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2063 * destination is specified.
2064 * @param node [i] The IMG tag node is specified.
2065 * @return The conversion result is returned.
2068 s_chtml10_start_img_tag(void* pdoc, Node* node)
2074 #ifndef IMG_NOT_CONVERT_FILENAME
2075 device_table_t* spec;
2078 chtml10 = GET_CHTML10(pdoc);
2079 #ifndef IMG_NOT_CONVERT_FILENAME
2080 spec = chtml10->spec;
2085 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
2088 /*--------------------------------------------------------------------------*/
2089 /* Get Attributes */
2090 /*--------------------------------------------------------------------------*/
2091 for (attr = qs_get_attr(doc,node);
2093 attr = qs_get_next_attr(doc,attr)) {
2097 name = qs_get_attr_name (doc,attr);
2098 value = qs_get_attr_value(doc,attr);
2103 if (strcasecmp(name, "src") == 0) {
2104 /*----------------------------------------------------------------------*/
2106 /*----------------------------------------------------------------------*/
2107 #ifdef IMG_NOT_CONVERT_FILENAME
2108 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
2109 chtml10->out = apr_pstrcat(r->pool,
2110 chtml10->out, " src=\"",value,"\"", NULL);
2112 value = chxj_img_conv(r, spec, value);
2113 value = chxj_add_cookie_parameter(r, value, chtml10->cookie_id);
2114 chtml10->out = apr_pstrcat(r->pool,
2115 chtml10->out, " src=\"",
2118 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
2125 if (strcasecmp(name, "align" ) == 0) {
2126 /*--------------------------------------------------------------------*/
2128 /*--------------------------------------------------------------------*/
2129 /*--------------------------------------------------------------------*/
2131 /*--------------------------------------------------------------------*/
2132 chtml10->out = apr_pstrcat(r->pool,
2133 chtml10->out, " align=\"",value,"\"", NULL);
2136 if (strcasecmp(name, "alt" ) == 0) {
2137 /*--------------------------------------------------------------------*/
2139 /*--------------------------------------------------------------------*/
2140 chtml10->out = apr_pstrcat(r->pool,
2141 chtml10->out, " alt=\"",value,"\"", NULL);
2147 if (strcasecmp(name, "width" ) == 0) {
2148 /*----------------------------------------------------------------------*/
2150 /*----------------------------------------------------------------------*/
2151 chtml10->out = apr_pstrcat(r->pool,
2152 chtml10->out, " width=\"",value,"\"", NULL);
2158 if (strcasecmp(name, "height") == 0) {
2159 /*--------------------------------------------------------------------*/
2161 /*--------------------------------------------------------------------*/
2162 chtml10->out = apr_pstrcat(r->pool,
2163 chtml10->out, " height=\"",value,"\"", NULL);
2166 if (strcasecmp(name, "hspace") == 0) {
2167 /*--------------------------------------------------------------------*/
2169 /*--------------------------------------------------------------------*/
2170 chtml10->out = apr_pstrcat(r->pool,
2171 chtml10->out, " hspace=\"",value,"\"", NULL);
2177 if (strcasecmp(name, "vspace") == 0) {
2178 /*----------------------------------------------------------------------*/
2180 /*----------------------------------------------------------------------*/
2181 chtml10->out = apr_pstrcat(r->pool,
2182 chtml10->out, " vspace=\"",value,"\"", NULL);
2191 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2193 return chtml10->out;
2198 * It is a handler who processes the IMG tag.
2200 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2201 * destination is specified.
2202 * @param node [i] The IMG tag node is specified.
2203 * @return The conversion result is returned.
2206 s_chtml10_end_img_tag(void* pdoc, Node* child)
2210 chtml10 = GET_CHTML10(pdoc);
2212 return chtml10->out;
2217 * It is a handler who processes the SELECT tag.
2219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2220 * destination is specified.
2221 * @param node [i] The SELECT tag node is specified.
2222 * @return The conversion result is returned.
2225 s_chtml10_start_select_tag(void* pdoc, Node* child)
2235 chtml10 = GET_CHTML10(pdoc);
2242 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
2243 for (attr = qs_get_attr(doc,child);
2245 attr = qs_get_next_attr(doc,attr)) {
2249 nm = qs_get_attr_name (doc,attr);
2250 val = qs_get_attr_value(doc,attr);
2252 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "size") == 0) {
2253 /*----------------------------------------------------------------------*/
2254 /* CHTML 1.0 version 2.0 */
2255 /*----------------------------------------------------------------------*/
2256 size = apr_pstrdup(r->pool, val);
2259 if ((*nm == 'n' || *nm == 'N') && strcasecmp(nm, "name") == 0) {
2260 /*----------------------------------------------------------------------*/
2261 /* CHTML 1.0 version 2.0 */
2262 /*----------------------------------------------------------------------*/
2263 name = apr_pstrdup(r->pool, val);
2266 if ((*nm == 'm' || *nm == 'M') && strcasecmp(nm, "multiple") == 0) {
2267 /*----------------------------------------------------------------------*/
2268 /* CHTML 1.0 version 2.0 */
2269 /*----------------------------------------------------------------------*/
2275 chtml10->out = apr_pstrcat(r->pool,
2283 chtml10->out = apr_pstrcat(r->pool,
2290 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
2292 return chtml10->out;
2297 * It is a handler who processes the SELECT tag.
2299 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2300 * destination is specified.
2301 * @param node [i] The SELECT tag node is specified.
2302 * @return The conversion result is returned.
2305 s_chtml10_end_select_tag(void* pdoc, Node* child)
2311 chtml10 = GET_CHTML10(pdoc);
2315 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
2317 return chtml10->out;
2322 * It is a handler who processes the OPTION tag.
2324 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2325 * destination is specified.
2326 * @param node [i] The OPTION tag node is specified.
2327 * @return The conversion result is returned.
2330 s_chtml10_start_option_tag(void* pdoc, Node* child)
2340 chtml10 = GET_CHTML10(pdoc);
2347 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
2348 for (attr = qs_get_attr(doc,child);
2350 attr = qs_get_next_attr(doc,attr)) {
2354 nm = qs_get_attr_name (doc,attr);
2355 val = qs_get_attr_value(doc,attr);
2357 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
2358 /*----------------------------------------------------------------------*/
2359 /* CHTML 1.0 version 2.0 */
2360 /*----------------------------------------------------------------------*/
2361 selected = apr_pstrdup(r->pool, val);
2364 if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
2365 /*----------------------------------------------------------------------*/
2366 /* CHTML 1.0 version 2.0 */
2367 /*----------------------------------------------------------------------*/
2368 value = apr_pstrdup(r->pool, val);
2373 chtml10->out = apr_pstrcat(r->pool,
2380 chtml10->out = apr_pstrcat(r->pool,
2386 chtml10->out = apr_pstrcat(r->pool,
2391 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2393 return chtml10->out;
2398 * It is a handler who processes the OPTION tag.
2400 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2401 * destination is specified.
2402 * @param node [i] The OPTION tag node is specified.
2403 * @return The conversion result is returned.
2406 s_chtml10_end_option_tag(void* pdoc, Node* child)
2410 chtml10 = GET_CHTML10(pdoc);
2414 return chtml10->out;
2419 * It is a handler who processes the DIV tag.
2421 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2422 * destination is specified.
2423 * @param node [i] The DIV tag node is specified.
2424 * @return The conversion result is returned.
2427 s_chtml10_start_div_tag(void* pdoc, Node* child)
2436 chtml10 = GET_CHTML10(pdoc);
2442 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
2443 for (attr = qs_get_attr(doc,child);
2445 attr = qs_get_next_attr(doc,attr)) {
2449 nm = qs_get_attr_name(doc,attr);
2450 val = qs_get_attr_value(doc,attr);
2452 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2453 /*----------------------------------------------------------------------*/
2454 /* CHTML 1.0 (W3C version 3.2) */
2455 /*----------------------------------------------------------------------*/
2456 align = apr_pstrdup(r->pool, val);
2461 chtml10->out = apr_pstrcat(r->pool,
2462 chtml10->out, " align=\"", align, "\"", NULL);
2464 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
2466 return chtml10->out;
2471 * It is a handler who processes the DIV tag.
2473 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2474 * destination is specified.
2475 * @param node [i] The DIV tag node is specified.
2476 * @return The conversion result is returned.
2479 s_chtml10_end_div_tag(void* pdoc, Node* child)
2485 chtml10 = GET_CHTML10(pdoc);
2489 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
2491 return chtml10->out;
2496 * It is a handler who processes the CHXJ:IF tag.
2498 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2499 * destination is specified.
2500 * @param node [i] The CHXJ:IF tag node is specified.
2501 * @return The conversion result is returned.
2504 s_chtml10_chxjif_tag(void* pdoc, Node* node)
2511 chtml10 = GET_CHTML10(pdoc);
2515 for (child = qs_get_child_node(doc, node);
2517 child = qs_get_next_node(doc, child)) {
2518 chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
2519 s_chtml10_chxjif_tag(chtml10, child);
2522 return chtml10->out;
2527 * It is a handler who processes the PRE tag.
2529 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2530 * destination is specified.
2531 * @param node [i] The PRE tag node is specified.
2532 * @return The conversion result is returned.
2535 s_chtml10_start_pre_tag(void* pdoc, Node* node)
2541 chtml10 = GET_CHTML10(pdoc);
2545 chtml10->pre_flag++;
2546 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
2548 return chtml10->out;
2553 * It is a handler who processes the PRE tag.
2555 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2556 * destination is specified.
2557 * @param node [i] The PRE tag node is specified.
2558 * @return The conversion result is returned.
2561 s_chtml10_end_pre_tag(void* pdoc, Node* child)
2567 chtml10 = GET_CHTML10(pdoc);
2571 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
2572 chtml10->pre_flag--;
2574 return chtml10->out;
2579 * It is a handler who processes the P tag.
2581 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2582 * destination is specified.
2583 * @param node [i] The P tag node is specified.
2584 * @return The conversion result is returned.
2587 s_chtml10_start_p_tag(void* pdoc, Node* node)
2593 chtml10 = GET_CHTML10(pdoc);
2597 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<p>", NULL);
2599 return chtml10->out;
2604 * It is a handler who processes the P tag.
2606 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2607 * destination is specified.
2608 * @param node [i] The P tag node is specified.
2609 * @return The conversion result is returned.
2612 s_chtml10_end_p_tag(void* pdoc, Node* child)
2618 chtml10 = GET_CHTML10(pdoc);
2622 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</p>", NULL);
2624 return chtml10->out;
2629 * It is a handler who processes the TEXTARE tag.
2631 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2632 * destination is specified.
2633 * @param node [i] The TEXTAREA tag node is specified.
2634 * @return The conversion result is returned.
2637 s_chtml10_start_textarea_tag(void* pdoc, Node* node)
2644 chtml10 = GET_CHTML10(pdoc);
2649 chtml10->textarea_flag++;
2650 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<textarea ", NULL);
2652 for (attr = qs_get_attr(doc,node);
2654 attr = qs_get_next_attr(doc,attr)) {
2659 name = qs_get_attr_name (doc,attr);
2660 value = qs_get_attr_value(doc,attr);
2662 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2663 chtml10->out = apr_pstrcat(r->pool,
2671 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2672 chtml10->out = apr_pstrcat(r->pool,
2680 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2681 chtml10->out = apr_pstrcat(r->pool,
2690 chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
2692 return chtml10->out;
2697 * It is a handler who processes the TEXTAREA tag.
2699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2700 * destination is specified.
2701 * @param node [i] The TEXTAREA tag node is specified.
2702 * @return The conversion result is returned.
2705 s_chtml10_end_textarea_tag(void* pdoc, Node* child)
2711 chtml10 = GET_CHTML10(pdoc);
2715 chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</textarea>\r\n", NULL);
2716 chtml10->textarea_flag--;
2718 return chtml10->out;
2723 s_chtml10_text(void* pdoc, Node* child)
2735 chtml10 = GET_CHTML10(pdoc);
2739 textval = qs_get_node_value(doc,child);
2740 textval = qs_trim_string(r, textval);
2742 if (strlen(textval) == 0)
2743 return chtml10->out;
2745 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2746 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2748 tdst = qs_alloc_zero_byte_string(r);
2749 memset(one_byte, 0, sizeof(one_byte));
2752 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2756 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2758 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2763 if (is_sjis_kanji(textval[ii])) {
2764 one_byte[0] = textval[ii+0];
2765 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2766 one_byte[0] = textval[ii+1];
2767 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2771 if (chtml10->pre_flag) {
2772 one_byte[0] = textval[ii+0];
2773 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2776 if (chtml10->textarea_flag) {
2777 one_byte[0] = textval[ii+0];
2778 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2781 if (textval[ii] != '\r' && textval[ii] != '\n') {
2782 one_byte[0] = textval[ii+0];
2783 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2787 chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
2789 return chtml10->out;