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_chtml30.h"
18 #include "chxj_hdml.h"
19 #include "chxj_str_util.h"
20 #include "chxj_dump.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_qr_code.h"
23 #include "chxj_encoding.h"
25 #define GET_CHTML30(X) ((chtml30_t*)(X))
27 static char* s_chtml30_start_html_tag (void* pdoc, Node* node);
28 static char* s_chtml30_end_html_tag (void* pdoc, Node* node);
29 static char* s_chtml30_start_meta_tag (void* pdoc, Node* node);
30 static char* s_chtml30_end_meta_tag (void* pdoc, Node* node);
31 static char* s_chtml30_start_textarea_tag (void* pdoc, Node* node);
32 static char* s_chtml30_end_textarea_tag (void* pdoc, Node* node);
33 static char* s_chtml30_start_p_tag (void* pdoc, Node* node);
34 static char* s_chtml30_end_p_tag (void* pdoc, Node* node);
35 static char* s_chtml30_start_pre_tag (void* pdoc, Node* node);
36 static char* s_chtml30_end_pre_tag (void* pdoc, Node* node);
37 static char* s_chtml30_start_h1_tag (void* pdoc, Node* node);
38 static char* s_chtml30_end_h1_tag (void* pdoc, Node* node);
39 static char* s_chtml30_start_h2_tag (void* pdoc, Node* node);
40 static char* s_chtml30_end_h2_tag (void* pdoc, Node* node);
41 static char* s_chtml30_start_h3_tag (void* pdoc, Node* node);
42 static char* s_chtml30_end_h3_tag (void* pdoc, Node* node);
43 static char* s_chtml30_start_h4_tag (void* pdoc, Node* node);
44 static char* s_chtml30_end_h4_tag (void* pdoc, Node* node);
45 static char* s_chtml30_start_h5_tag (void* pdoc, Node* node);
46 static char* s_chtml30_end_h5_tag (void* pdoc, Node* node);
47 static char* s_chtml30_start_h6_tag (void* pdoc, Node* node);
48 static char* s_chtml30_end_h6_tag (void* pdoc, Node* node);
49 static char* s_chtml30_start_ul_tag (void* pdoc, Node* node);
50 static char* s_chtml30_end_ul_tag (void* pdoc, Node* node);
51 static char* s_chtml30_start_ol_tag (void* pdoc, Node* node);
52 static char* s_chtml30_end_ol_tag (void* pdoc, Node* node);
53 static char* s_chtml30_start_li_tag (void* pdoc, Node* node);
54 static char* s_chtml30_end_li_tag (void* pdoc, Node* node);
55 static char* s_chtml30_start_head_tag (void* pdoc, Node* node);
56 static char* s_chtml30_end_head_tag (void* pdoc, Node* node);
57 static char* s_chtml30_start_title_tag (void* pdoc, Node* node);
58 static char* s_chtml30_end_title_tag (void* pdoc, Node* node);
59 static char* s_chtml30_start_base_tag (void* pdoc, Node* node);
60 static char* s_chtml30_end_base_tag (void* pdoc, Node* node);
61 static char* s_chtml30_start_body_tag (void* pdoc, Node* node);
62 static char* s_chtml30_end_body_tag (void* pdoc, Node* node);
63 static char* s_chtml30_start_a_tag (void* pdoc, Node* node);
64 static char* s_chtml30_end_a_tag (void* pdoc, Node* node);
65 static char* s_chtml30_start_br_tag (void* pdoc, Node* node);
66 static char* s_chtml30_end_br_tag (void* pdoc, Node* node);
67 static char* s_chtml30_start_tr_tag (void* pdoc, Node* node);
68 static char* s_chtml30_end_tr_tag (void* pdoc, Node* node);
69 static char* s_chtml30_start_font_tag (void* pdoc, Node* node);
70 static char* s_chtml30_end_font_tag (void* pdoc, Node* node);
71 static char* s_chtml30_start_form_tag (void* pdoc, Node* node);
72 static char* s_chtml30_end_form_tag (void* pdoc, Node* node);
73 static char* s_chtml30_start_input_tag (void* pdoc, Node* node);
74 static char* s_chtml30_end_input_tag (void* pdoc, Node* node);
75 static char* s_chtml30_start_center_tag (void* pdoc, Node* node);
76 static char* s_chtml30_end_center_tag (void* pdoc, Node* node);
77 static char* s_chtml30_start_hr_tag (void* pdoc, Node* node);
78 static char* s_chtml30_end_hr_tag (void* pdoc, Node* node);
79 static char* s_chtml30_start_img_tag (void* pdoc, Node* node);
80 static char* s_chtml30_end_img_tag (void* pdoc, Node* node);
81 static char* s_chtml30_start_select_tag (void* pdoc, Node* node);
82 static char* s_chtml30_end_select_tag (void* pdoc, Node* node);
83 static char* s_chtml30_start_option_tag (void* pdoc, Node* node);
84 static char* s_chtml30_end_option_tag (void* pdoc, Node* node);
85 static char* s_chtml30_start_div_tag (void* pdoc, Node* node);
86 static char* s_chtml30_end_div_tag (void* pdoc, Node* node);
87 static char* s_chtml30_chxjif_tag (void* pdoc, Node* node);
88 static char* s_chtml30_text_tag (void* pdoc, Node* node);
90 static void s_init_chtml30(chtml30_t* chtml, Doc* doc, request_rec* r, device_table* spec);
92 static int s_chtml30_search_emoji(chtml30_t* chtml, char* txt, char** rslt);
95 tag_handler chtml30_handler[] = {
98 s_chtml30_start_html_tag,
99 s_chtml30_end_html_tag,
103 s_chtml30_start_meta_tag,
104 s_chtml30_end_meta_tag,
108 s_chtml30_start_textarea_tag,
109 s_chtml30_end_textarea_tag,
113 s_chtml30_start_p_tag,
118 s_chtml30_start_pre_tag,
119 s_chtml30_end_pre_tag,
123 s_chtml30_start_ul_tag,
124 s_chtml30_end_ul_tag,
128 s_chtml30_start_li_tag,
129 s_chtml30_end_li_tag,
133 s_chtml30_start_ol_tag,
134 s_chtml30_end_ol_tag,
138 s_chtml30_start_h1_tag,
139 s_chtml30_end_h1_tag,
143 s_chtml30_start_h2_tag,
144 s_chtml30_end_h2_tag,
148 s_chtml30_start_h3_tag,
149 s_chtml30_end_h3_tag,
153 s_chtml30_start_h4_tag,
154 s_chtml30_end_h4_tag,
158 s_chtml30_start_h5_tag,
159 s_chtml30_end_h5_tag,
163 s_chtml30_start_h6_tag,
164 s_chtml30_end_h6_tag,
168 s_chtml30_start_head_tag,
169 s_chtml30_end_head_tag,
173 s_chtml30_start_title_tag,
174 s_chtml30_end_title_tag,
178 s_chtml30_start_base_tag,
179 s_chtml30_end_base_tag,
183 s_chtml30_start_body_tag,
184 s_chtml30_end_body_tag,
188 s_chtml30_start_a_tag,
193 s_chtml30_start_br_tag,
194 s_chtml30_end_br_tag,
203 s_chtml30_start_tr_tag,
204 s_chtml30_end_tr_tag,
218 s_chtml30_start_font_tag,
219 s_chtml30_end_font_tag,
223 s_chtml30_start_form_tag,
224 s_chtml30_end_form_tag,
228 s_chtml30_start_input_tag,
229 s_chtml30_end_input_tag,
233 s_chtml30_start_center_tag,
234 s_chtml30_end_center_tag,
238 s_chtml30_start_hr_tag,
239 s_chtml30_end_hr_tag,
243 s_chtml30_start_img_tag,
244 s_chtml30_end_img_tag,
248 s_chtml30_start_select_tag,
249 s_chtml30_end_select_tag,
253 s_chtml30_start_option_tag,
254 s_chtml30_end_option_tag,
258 s_chtml30_start_div_tag,
259 s_chtml30_end_div_tag,
263 s_chtml30_chxjif_tag,
310 * converts from CHTML5.0 to CHTML3.0.
312 * @param r [i] Requet_rec is appointed.
313 * @param spec [i] The result of the device specification processing which
314 * was done in advance is appointed.
315 * @param src [i] The character string before the converting is appointed.
316 * @return The character string after the converting is returned.
319 chxj_exchange_chtml30(
325 chxjconvrule_entry* entryp,
335 /*--------------------------------------------------------------------------*/
337 /*--------------------------------------------------------------------------*/
339 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
341 DBG(r,"i found qrcode xml");
344 DBG(r,"not found qrcode xml");
346 /*--------------------------------------------------------------------------*/
347 /* The CHTML structure is initialized. */
348 /*--------------------------------------------------------------------------*/
349 s_init_chtml30(&chtml30, &doc, r, spec);
351 chtml30.entryp = entryp;
352 chtml30.cookie = cookie;
354 ap_set_content_type(r, "text/html; charset=Windows-31J");
356 /*--------------------------------------------------------------------------*/
357 /* The character string of the input is analyzed. */
358 /*--------------------------------------------------------------------------*/
359 qs_init_malloc(&doc);
360 qs_init_root_node(&doc);
362 ss = apr_pcalloc(r->pool, srclen + 1);
363 memset(ss, 0, srclen + 1);
364 memcpy(ss, src, srclen);
367 chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
370 qs_parse_string(&doc,ss, strlen(ss));
372 /*--------------------------------------------------------------------------*/
373 /* It converts it from CHTML to CHTML. */
374 /*--------------------------------------------------------------------------*/
375 chxj_node_exchange(spec,r,(void*)&chtml30, &doc, qs_get_root(&doc), 0);
378 qs_all_free(&doc,QX_LOGMARK);
381 return apr_pstrdup(r->pool,ss);
383 if (strlen(dst) == 0)
384 dst = apr_psprintf(r->pool, "\n");
386 *dstlen = strlen(dst);
389 chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
397 * The CHTML structure is initialized.
399 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
400 * initialized is specified.
401 * @param doc [i] The Doc structure that should be set to the initialized
402 * HDML structure is specified.
403 * @param r [i] To use POOL, the pointer to request_rec is specified.
404 * @param spec [i] The pointer to the device_table
407 s_init_chtml30(chtml30_t* chtml30, Doc* doc, request_rec* r, device_table* spec)
409 memset(doc, 0, sizeof(Doc));
410 memset(chtml30, 0, sizeof(chtml30_t));
414 chtml30->spec = spec;
415 chtml30->out = qs_alloc_zero_byte_string(r);
416 chtml30->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
417 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
422 * Corresponding EMOJI to a current character-code is retrieved.
423 * The substitution character string is stored in the rslt pointer if agreeing.
425 * @param chtml30 [i] The pointer to the CHTML structure is specified.
426 * @param txt [i] The character string to want to examine whether it is
427 * EMOJI is specified.
428 * @param rslt [o] The pointer to the pointer that stores the result is
430 * @return When corresponding EMOJI exists, it returns it excluding 0.
433 s_chtml30_search_emoji(chtml30_t* chtml30, char* txt, char** rslt)
440 spec = chtml30->spec;
446 DBG(r,"spec is NULL");
448 for (ee = chtml30->conf->emoji;
452 if (ee->imode == NULL) {
453 DBG(r, "emoji->imode is NULL");
457 if (ee->imode->string != NULL
458 && strlen(ee->imode->string) > 0
459 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
461 if (spec == NULL || spec->emoji_type == NULL) {
462 *rslt = apr_palloc(r->pool, 3);
463 (*rslt)[0] = ee->imode->hex1byte & 0xff;
464 (*rslt)[1] = ee->imode->hex2byte & 0xff;
466 return strlen(ee->imode->string);
478 * It is a handler who processes the HTML tag.
480 * @param pdoc [i/o] The pointer to the CHTML structure at the output
481 * destination is specified.
482 * @param node [i] The HTML tag node is specified.
483 * @return The conversion result is returned.
486 s_chtml30_start_html_tag(void* pdoc, Node* node)
492 chtml30 = GET_CHTML30(pdoc);
496 /*--------------------------------------------------------------------------*/
498 /*--------------------------------------------------------------------------*/
499 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<html>\n", NULL);
506 * It is a handler who processes the HTML tag.
508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
509 * destination is specified.
510 * @param node [i] The HTML tag node is specified.
511 * @return The conversion result is returned.
514 s_chtml30_end_html_tag(void* pdoc, Node* child)
520 chtml30 = GET_CHTML30(pdoc);
524 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</html>\n", NULL);
531 * It is a handler who processes the META tag.
533 * @param pdoc [i/o] The pointer to the CHTML structure at the output
534 * destination is specified.
535 * @param node [i] The META tag node is specified.
536 * @return The conversion result is returned.
539 s_chtml30_start_meta_tag(void* pdoc, Node* node)
545 int content_type_flag;
548 chtml30 = GET_CHTML30(pdoc);
552 content_type_flag = 0;
555 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<meta", NULL);
557 /*--------------------------------------------------------------------------*/
559 /*--------------------------------------------------------------------------*/
560 for (attr = qs_get_attr(doc,node);
562 attr = qs_get_next_attr(doc,attr)) {
567 name = qs_get_attr_name(doc,attr);
568 value = qs_get_attr_value(doc,attr);
570 if (strcasecmp(name, "http-equiv") == 0) {
571 /*----------------------------------------------------------------------*/
573 /*----------------------------------------------------------------------*/
574 chtml30->out = apr_pstrcat(r->pool,
581 if ((*value == 'c' || *value == 'C')
582 && strcasecmp(value, "content-type") == 0)
583 content_type_flag = 1;
585 if ((*value == 'r' || *value == 'R')
586 && strcasecmp(value, "refresh") == 0)
590 if (strcasecmp(name, "content") == 0) {
591 if (content_type_flag) {
592 chtml30->out = apr_pstrcat(r->pool,
597 "text/html; charset=Windows-31J",
607 buf = apr_pstrdup(r->pool, value);
609 url = strchr(buf, ';');
611 sec = apr_pstrdup(r->pool, buf);
614 url = chxj_encoding_parameter(r, url);
615 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
616 chtml30->out = apr_pstrcat(r->pool,
629 chtml30->out = apr_pstrcat(r->pool,
641 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
648 * It is a handler who processes the META tag.
650 * @param pdoc [i/o] The pointer to the CHTML structure at the output
651 * destination is specified.
652 * @param node [i] The META tag node is specified.
653 * @return The conversion result is returned.
656 s_chtml30_end_meta_tag(void* pdoc, Node* child)
660 chtml30 = GET_CHTML30(pdoc);
667 * It is a handler who processes the HEAD tag.
669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
670 * destination is specified.
671 * @param node [i] The HEAD tag node is specified.
672 * @return The conversion result is returned.
675 s_chtml30_start_head_tag(void* pdoc, Node* node)
681 chtml30 = GET_CHTML30(pdoc);
685 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<head>\r\n", NULL);
692 * It is a handler who processes the HEAD tag.
694 * @param pdoc [i/o] The pointer to the CHTML structure at the output
695 * destination is specified.
696 * @param node [i] The HEAD tag node is specified.
697 * @return The conversion result is returned.
700 s_chtml30_end_head_tag(void* pdoc, Node* node)
706 chtml30 = GET_CHTML30(pdoc);
710 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</head>\r\n", NULL);
717 * It is a handler who processes the TITLE tag.
719 * @param pdoc [i/o] The pointer to the CHTML structure at the output
720 * destination is specified.
721 * @param node [i] The TITLE tag node is specified.
722 * @return The conversion result is returned.
725 s_chtml30_start_title_tag(void* pdoc, Node* node)
731 chtml30 = GET_CHTML30(pdoc);
735 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<title>", NULL);
742 * It is a handler who processes the TITLE tag.
744 * @param pdoc [i/o] The pointer to the CHTML structure at the output
745 * destination is specified.
746 * @param node [i] The TITLE tag node is specified.
747 * @return The conversion result is returned.
750 s_chtml30_end_title_tag(void* pdoc, Node* child)
756 chtml30 = GET_CHTML30(pdoc);
760 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</title>\r\n", NULL);
767 * It is a handler who processes the BASE tag.
769 * @param pdoc [i/o] The pointer to the CHTML structure at the output
770 * destination is specified.
771 * @param node [i] The BASE tag node is specified.
772 * @return The conversion result is returned.
775 s_chtml30_start_base_tag(void* pdoc, Node* node)
782 chtml30 = GET_CHTML30(pdoc);
786 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<base", NULL);
788 /*--------------------------------------------------------------------------*/
790 /*--------------------------------------------------------------------------*/
791 for (attr = qs_get_attr(doc,node);
793 attr = qs_get_next_attr(doc,attr)) {
798 name = qs_get_attr_name(doc,attr);
799 value = qs_get_attr_value(doc,attr);
801 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
802 chtml30->out = apr_pstrcat(r->pool,
811 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >\r\n", NULL);
818 * It is a handler who processes the BASE tag.
820 * @param pdoc [i/o] The pointer to the CHTML structure at the output
821 * destination is specified.
822 * @param node [i] The BASE tag node is specified.
823 * @return The conversion result is returned.
826 s_chtml30_end_base_tag(void* pdoc, Node* child)
830 chtml30 = GET_CHTML30(pdoc);
837 * It is a handler who processes the BODY tag.
839 * @param pdoc [i/o] The pointer to the CHTML structure at the output
840 * destination is specified.
841 * @param node [i] The BODY tag node is specified.
842 * @return The conversion result is returned.
845 s_chtml30_start_body_tag(void* pdoc, Node* node)
852 chtml30 = GET_CHTML30(pdoc);
856 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<body", NULL);
858 /*--------------------------------------------------------------------------*/
860 /*--------------------------------------------------------------------------*/
861 for (attr = qs_get_attr(doc,node);
863 attr = qs_get_next_attr(doc,attr)) {
867 name = qs_get_attr_name(doc,attr);
868 value = qs_get_attr_value(doc,attr);
870 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
871 /*----------------------------------------------------------------------*/
873 /*----------------------------------------------------------------------*/
874 chtml30->out = apr_pstrcat(r->pool,
882 if (strcasecmp(name, "text") == 0) {
883 /*----------------------------------------------------------------------*/
885 /*----------------------------------------------------------------------*/
886 chtml30->out = apr_pstrcat(r->pool,
894 if (strcasecmp(name, "link") == 0) {
895 /*----------------------------------------------------------------------*/
897 /*----------------------------------------------------------------------*/
898 chtml30->out = apr_pstrcat(r->pool,
906 if (strcasecmp(name, "alink") == 0) {
907 /*----------------------------------------------------------------------*/
909 /*----------------------------------------------------------------------*/
913 if (strcasecmp(name, "vlink") == 0) {
914 /*----------------------------------------------------------------------*/
916 /*----------------------------------------------------------------------*/
921 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
928 * It is a handler who processes the BODY tag.
930 * @param pdoc [i/o] The pointer to the CHTML structure at the output
931 * destination is specified.
932 * @param node [i] The BODY tag node is specified.
933 * @return The conversion result is returned.
936 s_chtml30_end_body_tag(void* pdoc, Node* child)
942 chtml30 = GET_CHTML30(pdoc);
946 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</body>\r\n", NULL);
953 * It is a handler who processes the A tag.
955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
956 * destination is specified.
957 * @param node [i] The A tag node is specified.
958 * @return The conversion result is returned.
961 s_chtml30_start_a_tag(void* pdoc, Node* node)
968 chtml30 = GET_CHTML30(pdoc);
972 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<a", NULL);
974 /*--------------------------------------------------------------------------*/
976 /*--------------------------------------------------------------------------*/
977 for (attr = qs_get_attr(doc,node);
979 attr = qs_get_next_attr(doc,attr)) {
984 name = qs_get_attr_name(doc,attr);
985 value = qs_get_attr_value(doc,attr);
987 if (strcasecmp(name, "name") == 0) {
988 /*----------------------------------------------------------------------*/
990 /*----------------------------------------------------------------------*/
991 chtml30->out = apr_pstrcat(r->pool,
999 if (strcasecmp(name, "href") == 0) {
1000 /*----------------------------------------------------------------------*/
1002 /*----------------------------------------------------------------------*/
1003 value = chxj_encoding_parameter(r, value);
1004 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1005 chtml30->out = apr_pstrcat(r->pool,
1013 if (strcasecmp(name, "accesskey") == 0) {
1014 /*----------------------------------------------------------------------*/
1016 /*----------------------------------------------------------------------*/
1017 chtml30->out = apr_pstrcat(r->pool,
1025 if (strcasecmp(name, "cti") == 0) {
1026 /*----------------------------------------------------------------------*/
1028 /*----------------------------------------------------------------------*/
1029 chtml30->out = apr_pstrcat(r->pool,
1037 if (strcasecmp(name, "ijam") == 0) {
1038 /*----------------------------------------------------------------------*/
1040 /*----------------------------------------------------------------------*/
1044 if (strcasecmp(name, "utn") == 0) {
1045 /*----------------------------------------------------------------------*/
1047 /* It is special only for CHTML. */
1048 /*----------------------------------------------------------------------*/
1049 chtml30->out = apr_pstrcat(r->pool,
1055 if (strcasecmp(name, "telbook") == 0) {
1056 /*----------------------------------------------------------------------*/
1058 /*----------------------------------------------------------------------*/
1062 if (strcasecmp(name, "kana") == 0) {
1063 /*----------------------------------------------------------------------*/
1065 /*----------------------------------------------------------------------*/
1069 if (strcasecmp(name, "email") == 0) {
1070 /*----------------------------------------------------------------------*/
1072 /*----------------------------------------------------------------------*/
1076 if (strcasecmp(name, "ista") == 0) {
1077 /*----------------------------------------------------------------------*/
1079 /*----------------------------------------------------------------------*/
1083 if (strcasecmp(name, "ilet") == 0) {
1084 /*----------------------------------------------------------------------*/
1086 /*----------------------------------------------------------------------*/
1090 if (strcasecmp(name, "iswf") == 0) {
1091 /*----------------------------------------------------------------------*/
1093 /*----------------------------------------------------------------------*/
1097 if (strcasecmp(name, "irst") == 0) {
1098 /*----------------------------------------------------------------------*/
1100 /*----------------------------------------------------------------------*/
1105 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1107 return chtml30->out;
1112 * It is a handler who processes the A tag.
1114 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1115 * destination is specified.
1116 * @param node [i] The A tag node is specified.
1117 * @return The conversion result is returned.
1120 s_chtml30_end_a_tag(void* pdoc, Node* child)
1126 chtml30 = GET_CHTML30(pdoc);
1130 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</a>", NULL);
1132 return chtml30->out;
1137 * It is a handler who processes the BR tag.
1139 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1140 * destination is specified.
1141 * @param node [i] The BR tag node is specified.
1142 * @return The conversion result is returned.
1145 s_chtml30_start_br_tag(void* pdoc, Node* node)
1151 chtml30 = GET_CHTML30(pdoc);
1155 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1157 return chtml30->out;
1162 * It is a handler who processes the BR tag.
1164 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1165 * destination is specified.
1166 * @param node [i] The BR tag node is specified.
1167 * @return The conversion result is returned.
1170 s_chtml30_end_br_tag(void* pdoc, Node* child)
1174 chtml30 = GET_CHTML30(pdoc);
1176 return chtml30->out;
1181 * It is a handler who processes the TR tag.
1183 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1184 * destination is specified.
1185 * @param node [i] The TR tag node is specified.
1186 * @return The conversion result is returned.
1189 s_chtml30_start_tr_tag(void* pdoc, Node* node)
1193 chtml30 = GET_CHTML30(pdoc);
1195 return chtml30->out;
1200 * It is a handler who processes the TR tag.
1202 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1203 * destination is specified.
1204 * @param node [i] The TR tag node is specified.
1205 * @return The conversion result is returned.
1208 s_chtml30_end_tr_tag(void* pdoc, Node* child)
1214 chtml30 = GET_CHTML30(pdoc);
1218 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1220 return chtml30->out;
1225 * It is a handler who processes the FONT tag.
1227 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1228 * destination is specified.
1229 * @param node [i] The FONT tag node is specified.
1230 * @return The conversion result is returned.
1233 s_chtml30_start_font_tag(void* pdoc, Node* node)
1240 chtml30 = GET_CHTML30(pdoc);
1244 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<font", NULL);
1246 /*--------------------------------------------------------------------------*/
1247 /* Get Attributes */
1248 /*--------------------------------------------------------------------------*/
1249 for (attr = qs_get_attr(doc,node);
1251 attr = qs_get_next_attr(doc,attr)) {
1252 char* name = qs_get_attr_name(doc,attr);
1253 char* value = qs_get_attr_value(doc,attr);
1255 if (strcasecmp(name, "color") == 0) {
1256 chtml30->out = apr_pstrcat(r->pool,
1264 if (strcasecmp(name, "size") == 0) {
1265 /*----------------------------------------------------------------------*/
1267 /*----------------------------------------------------------------------*/
1272 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1274 return chtml30->out;
1279 * It is a handler who processes the FONT tag.
1281 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1282 * destination is specified.
1283 * @param node [i] The FONT tag node is specified.
1284 * @return The conversion result is returned.
1287 s_chtml30_end_font_tag(void* pdoc, Node* child)
1293 chtml30 = GET_CHTML30(pdoc);
1297 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</font>", NULL);
1299 return chtml30->out;
1304 * It is a handler who processes the FORM tag.
1306 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1307 * destination is specified.
1308 * @param node [i] The FORM tag node is specified.
1309 * @return The conversion result is returned.
1312 s_chtml30_start_form_tag(void* pdoc, Node* node)
1319 chtml30 = GET_CHTML30(pdoc);
1323 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<form", NULL);
1325 /*--------------------------------------------------------------------------*/
1326 /* Get Attributes */
1327 /*--------------------------------------------------------------------------*/
1328 for (attr = qs_get_attr(doc,node);
1330 attr = qs_get_next_attr(doc,attr)) {
1331 char* name = qs_get_attr_name(doc,attr);
1332 char* value = qs_get_attr_value(doc,attr);
1333 if (strcasecmp(name, "action") == 0) {
1334 /*----------------------------------------------------------------------*/
1336 /*----------------------------------------------------------------------*/
1337 value = chxj_encoding_parameter(r, value);
1338 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1339 chtml30->out = apr_pstrcat(r->pool,
1347 if (strcasecmp(name, "method") == 0) {
1348 /*----------------------------------------------------------------------*/
1350 /*----------------------------------------------------------------------*/
1351 chtml30->out = apr_pstrcat(r->pool,
1359 if (strcasecmp(name, "utn") == 0) {
1360 /*----------------------------------------------------------------------*/
1362 /* It is special only for CHTML. */
1363 /*----------------------------------------------------------------------*/
1364 chtml30->out = apr_pstrcat(r->pool,
1370 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1372 return chtml30->out;
1377 * It is a handler who processes the FORM tag.
1379 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1380 * destination is specified.
1381 * @param node [i] The FORM tag node is specified.
1382 * @return The conversion result is returned.
1385 s_chtml30_end_form_tag(void* pdoc, Node* child)
1391 chtml30 = GET_CHTML30(pdoc);
1395 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</form>", NULL);
1397 return chtml30->out;
1402 * It is a handler who processes the INPUT tag.
1404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1405 * destination is specified.
1406 * @param node [i] The INPUT tag node is specified.
1407 * @return The conversion result is returned.
1410 s_chtml30_start_input_tag(void* pdoc, Node* node)
1415 char* max_length = NULL;
1419 char* istyle = NULL;
1421 char* checked = NULL;
1422 char* accesskey = NULL;
1424 chtml30 = GET_CHTML30(pdoc);
1429 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<input", NULL);
1431 /*--------------------------------------------------------------------------*/
1432 /* Get Attributes */
1433 /*--------------------------------------------------------------------------*/
1435 type = qs_get_type_attr(doc, node, r);
1436 name = qs_get_name_attr(doc, node, r);
1437 value = qs_get_value_attr(doc,node,r);
1438 istyle = qs_get_istyle_attr(doc,node,r);
1439 max_length = qs_get_maxlength_attr(doc,node,r);
1440 checked = qs_get_checked_attr(doc,node,r);
1441 accesskey = qs_get_accesskey_attr(doc, node, r);
1442 size = qs_get_size_attr(doc, node, r);
1445 chtml30->out = apr_pstrcat(r->pool,
1453 chtml30->out = apr_pstrcat(r->pool,
1460 chtml30->out = apr_pstrcat(r->pool,
1468 chtml30->out = apr_pstrcat(r->pool,
1476 chtml30->out = apr_pstrcat(r->pool,
1483 /*------------------------------------------------------------------------*/
1485 /*------------------------------------------------------------------------*/
1486 chtml30->out = apr_pstrcat(r->pool,
1492 /*--------------------------------------------------------------------------*/
1493 /* The figure is default for the password. */
1494 /*--------------------------------------------------------------------------*/
1496 if (chxj_chk_numeric(max_length) != 0)
1497 max_length = apr_psprintf(r->pool, "0");
1499 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1500 chtml30->out = apr_pstrcat(r->pool,
1502 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2),
1505 chtml30->out = apr_pstrcat(r->pool,
1507 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)),
1512 chtml30->out = apr_pstrcat(r->pool,
1513 chtml30->out, " checked ", NULL);
1515 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1517 return chtml30->out;
1522 * It is a handler who processes the INPUT tag.
1524 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1525 * destination is specified.
1526 * @param node [i] The INPUT tag node is specified.
1527 * @return The conversion result is returned.
1530 s_chtml30_end_input_tag(void* pdoc, Node* child)
1534 chtml30 = GET_CHTML30(pdoc);
1536 return chtml30->out;
1541 * It is a handler who processes the CENTER tag.
1543 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1544 * destination is specified.
1545 * @param node [i] The CENTER tag node is specified.
1546 * @return The conversion result is returned.
1549 s_chtml30_start_center_tag(void* pdoc, Node* node)
1555 chtml30 = GET_CHTML30(pdoc);
1559 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<center>", NULL);
1561 return chtml30->out;
1566 * It is a handler who processes the CENTER tag.
1568 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1569 * destination is specified.
1570 * @param node [i] The CENTER tag node is specified.
1571 * @return The conversion result is returned.
1574 s_chtml30_end_center_tag(void* pdoc, Node* child)
1580 chtml30 = GET_CHTML30(pdoc);
1584 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</center>", NULL);
1586 return chtml30->out;
1591 * It is a handler who processes the HR tag.
1593 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1594 * destination is specified.
1595 * @param node [i] The HR tag node is specified.
1596 * @return The conversion result is returned.
1599 s_chtml30_start_hr_tag(void* pdoc, Node* node)
1606 chtml30 = GET_CHTML30(pdoc);
1610 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<hr ", NULL);
1612 for (attr = qs_get_attr(doc,node);
1614 attr = qs_get_next_attr(doc,attr)) {
1615 char* name = qs_get_attr_name(doc,attr);
1616 char* value = qs_get_attr_value(doc,attr);
1617 if (strcasecmp(name, "align") == 0) {
1618 /*----------------------------------------------------------------------*/
1620 /*----------------------------------------------------------------------*/
1621 chtml30->out = apr_pstrcat(r->pool,
1623 " align=\"", value, "\" ", NULL);
1626 if (strcasecmp(name, "size") == 0) {
1627 /*----------------------------------------------------------------------*/
1629 /*----------------------------------------------------------------------*/
1630 chtml30->out = apr_pstrcat(r->pool,
1632 " size=\"", value, "\" ", NULL);
1635 if (strcasecmp(name, "width") == 0) {
1636 /*----------------------------------------------------------------------*/
1638 /*----------------------------------------------------------------------*/
1639 chtml30->out = apr_pstrcat(r->pool,
1641 " width=\"", value, "\" ", NULL);
1644 if (strcasecmp(name, "noshade") == 0) {
1645 /*----------------------------------------------------------------------*/
1647 /*----------------------------------------------------------------------*/
1648 chtml30->out = apr_pstrcat(r->pool,
1653 if (strcasecmp(name, "color") == 0) {
1654 /*----------------------------------------------------------------------*/
1656 /*----------------------------------------------------------------------*/
1660 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1662 return chtml30->out;
1667 * It is a handler who processes the HR tag.
1669 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1670 * destination is specified.
1671 * @param node [i] The HR tag node is specified.
1672 * @return The conversion result is returned.
1675 s_chtml30_end_hr_tag(void* pdoc, Node* child)
1679 chtml30 = GET_CHTML30(pdoc);
1681 return chtml30->out;
1686 * It is a handler who processes the IMG tag.
1688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1689 * destination is specified.
1690 * @param node [i] The IMG tag node is specified.
1691 * @return The conversion result is returned.
1694 s_chtml30_start_img_tag(void* pdoc, Node* node)
1696 #ifndef IMG_NOT_CONVERT_FILENAME
1704 chtml30 = GET_CHTML30(pdoc);
1707 #ifndef IMG_NOT_CONVERT_FILENAME
1708 spec = chtml30->spec;
1711 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<img", NULL);
1714 /*--------------------------------------------------------------------------*/
1715 /* Get Attributes */
1716 /*--------------------------------------------------------------------------*/
1717 for (attr = qs_get_attr(doc,node);
1719 attr = qs_get_next_attr(doc,attr)) {
1720 char* name = qs_get_attr_name(doc,attr);
1721 char* value = qs_get_attr_value(doc,attr);
1723 if (strcasecmp(name, "src") == 0) {
1724 /*----------------------------------------------------------------------*/
1726 /*----------------------------------------------------------------------*/
1727 #ifdef IMG_NOT_CONVERT_FILENAME
1728 value = chxj_encoding_parameter(r, value);
1729 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1731 chtml30->out = apr_pstrcat(r->pool,
1732 chtml30->out, " src=\"",value,"\"", NULL);
1734 value = chxj_img_conv(r,spec,value);
1735 value = chxj_encoding_parameter(r, value);
1736 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1738 chtml30->out = apr_pstrcat(r->pool,
1739 chtml30->out, " src=\"",
1742 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "\"", NULL);
1746 if (strcasecmp(name, "align" ) == 0) {
1747 /*----------------------------------------------------------------------*/
1749 /*----------------------------------------------------------------------*/
1750 chtml30->out = apr_pstrcat(r->pool,
1751 chtml30->out, " align=\"",value,"\"", NULL);
1754 if (strcasecmp(name, "width" ) == 0) {
1755 /*----------------------------------------------------------------------*/
1757 /*----------------------------------------------------------------------*/
1758 chtml30->out = apr_pstrcat(r->pool,
1759 chtml30->out, " width=\"",value,"\"", NULL);
1762 if (strcasecmp(name, "height") == 0) {
1763 /*----------------------------------------------------------------------*/
1765 /*----------------------------------------------------------------------*/
1766 chtml30->out = apr_pstrcat(r->pool,
1767 chtml30->out, " height=\"",value,"\"", NULL);
1770 if (strcasecmp(name, "hspace") == 0) {
1771 /*----------------------------------------------------------------------*/
1773 /*----------------------------------------------------------------------*/
1774 chtml30->out = apr_pstrcat(r->pool,
1775 chtml30->out, " hspace=\"",value,"\"", NULL);
1778 if (strcasecmp(name, "vspace") == 0) {
1779 /*----------------------------------------------------------------------*/
1781 /*----------------------------------------------------------------------*/
1782 chtml30->out = apr_pstrcat(r->pool,
1783 chtml30->out, " vspace=\"",value,"\"", NULL);
1786 if (strcasecmp(name, "alt" ) == 0) {
1787 /*----------------------------------------------------------------------*/
1789 /*----------------------------------------------------------------------*/
1790 chtml30->out = apr_pstrcat(r->pool,
1791 chtml30->out, " alt=\"",value,"\"", NULL);
1794 if (strcasecmp(name, "align" ) == 0) {
1795 /*----------------------------------------------------------------------*/
1797 /*----------------------------------------------------------------------*/
1802 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1804 return chtml30->out;
1809 * It is a handler who processes the IMG tag.
1811 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1812 * destination is specified.
1813 * @param node [i] The IMG tag node is specified.
1814 * @return The conversion result is returned.
1817 s_chtml30_end_img_tag(void* pdoc, Node* child)
1821 chtml30 = GET_CHTML30(pdoc);
1823 return chtml30->out;
1828 * It is a handler who processes the SELECT tag.
1830 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1831 * destination is specified.
1832 * @param node [i] The SELECT tag node is specified.
1833 * @return The conversion result is returned.
1836 s_chtml30_start_select_tag(void* pdoc, Node* child)
1846 chtml30 = GET_CHTML30(pdoc);
1852 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<select", NULL);
1853 for (attr = qs_get_attr(doc,child);
1855 attr = qs_get_next_attr(doc,attr)) {
1856 char* nm = qs_get_attr_name(doc,attr);
1857 char* val = qs_get_attr_value(doc,attr);
1859 if (strcasecmp(nm, "size") == 0) {
1860 /*----------------------------------------------------------------------*/
1861 /* CHTML 1.0 version 2.0 */
1862 /*----------------------------------------------------------------------*/
1863 size = apr_pstrdup(r->pool, val);
1866 if (strcasecmp(nm, "name") == 0) {
1867 /*----------------------------------------------------------------------*/
1868 /* CHTML 1.0 version 2.0 */
1869 /*----------------------------------------------------------------------*/
1870 name = apr_pstrdup(r->pool, val);
1873 if (strcasecmp(nm, "multiple") == 0) {
1874 /*----------------------------------------------------------------------*/
1875 /* CHTML 1.0 version 2.0 */
1876 /*----------------------------------------------------------------------*/
1882 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " size=\"",size,"\"", NULL);
1885 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",name,"\"", NULL);
1887 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\n", NULL);
1889 return chtml30->out;
1894 * It is a handler who processes the SELECT tag.
1896 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1897 * destination is specified.
1898 * @param node [i] The SELECT tag node is specified.
1899 * @return The conversion result is returned.
1902 s_chtml30_end_select_tag(void* pdoc, Node* child)
1908 chtml30 = GET_CHTML30(pdoc);
1912 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</select>\n", NULL);
1914 return chtml30->out;
1919 * It is a handler who processes the OPTION tag.
1921 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1922 * destination is specified.
1923 * @param node [i] The OPTION tag node is specified.
1924 * @return The conversion result is returned.
1927 s_chtml30_start_option_tag(void* pdoc, Node* child)
1936 chtml30 = GET_CHTML30(pdoc);
1942 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<option", NULL);
1943 for (attr = qs_get_attr(doc,child);
1945 attr = qs_get_next_attr(doc,attr)) {
1946 char* nm = qs_get_attr_name(doc,attr);
1947 char* val = qs_get_attr_value(doc,attr);
1949 if (strcasecmp(nm, "selected") == 0) {
1950 /*----------------------------------------------------------------------*/
1951 /* CHTML 1.0 version 2.0 */
1952 /*----------------------------------------------------------------------*/
1953 selected = apr_pstrdup(r->pool, val);
1956 if (strcasecmp(nm, "value") == 0) {
1957 /*----------------------------------------------------------------------*/
1958 /* CHTML 1.0 version 2.0 */
1959 /*----------------------------------------------------------------------*/
1960 value = apr_pstrdup(r->pool, val);
1965 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"",value,"\"", NULL);
1967 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"\"", NULL);
1970 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " selected ", NULL);
1972 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1974 return chtml30->out;
1979 * It is a handler who processes the OPTION tag.
1981 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1982 * destination is specified.
1983 * @param node [i] The OPTION tag node is specified.
1984 * @return The conversion result is returned.
1987 s_chtml30_end_option_tag(void* pdoc, Node* child)
1991 chtml30 = GET_CHTML30(pdoc);
1995 return chtml30->out;
2000 * It is a handler who processes the DIV tag.
2002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2003 * destination is specified.
2004 * @param node [i] The DIV tag node is specified.
2005 * @return The conversion result is returned.
2008 s_chtml30_start_div_tag(void* pdoc, Node* child)
2016 chtml30 = GET_CHTML30(pdoc);
2022 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<div", NULL);
2023 for (attr = qs_get_attr(doc,child);
2025 attr = qs_get_next_attr(doc,attr)) {
2026 char* nm = qs_get_attr_name(doc,attr);
2027 char* val = qs_get_attr_value(doc,attr);
2029 if (strcasecmp(nm, "align") == 0) {
2030 /*----------------------------------------------------------------------*/
2031 /* CHTML 1.0 (W3C version 3.2) */
2032 /*----------------------------------------------------------------------*/
2033 align = apr_pstrdup(r->pool, val);
2038 chtml30->out = apr_pstrcat(r->pool,
2039 chtml30->out, " align=\"", align, "\"", NULL);
2041 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
2043 return chtml30->out;
2048 * It is a handler who processes the DIV tag.
2050 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2051 * destination is specified.
2052 * @param node [i] The DIV tag node is specified.
2053 * @return The conversion result is returned.
2056 s_chtml30_end_div_tag(void* pdoc, Node* node)
2062 chtml30 = GET_CHTML30(pdoc);
2066 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</div>\n", NULL);
2068 return chtml30->out;
2073 * It is a handler who processes the UL tag.
2075 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2076 * destination is specified.
2077 * @param node [i] The UL tag node is specified.
2078 * @return The conversion result is returned.
2081 s_chtml30_start_ul_tag(void* pdoc, Node* node)
2087 chtml30 = GET_CHTML30(pdoc);
2091 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ul>", NULL);
2093 return chtml30->out;
2098 * It is a handler who processes the UL tag.
2100 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2101 * destination is specified.
2102 * @param node [i] The UL tag node is specified.
2103 * @return The conversion result is returned.
2106 s_chtml30_end_ul_tag(void* pdoc, Node* child)
2112 chtml30 = GET_CHTML30(pdoc);
2116 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ul>", NULL);
2118 return chtml30->out;
2123 * It is a handler who processes the PRE tag.
2125 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2126 * destination is specified.
2127 * @param node [i] The PRE tag node is specified.
2128 * @return The conversion result is returned.
2131 s_chtml30_start_pre_tag(void* pdoc, Node* node)
2137 chtml30 = GET_CHTML30(pdoc);
2141 chtml30->pre_flag++;
2142 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<pre>", NULL);
2144 return chtml30->out;
2148 * It is a handler who processes the PRE tag.
2150 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2151 * destination is specified.
2152 * @param node [i] The PRE tag node is specified.
2153 * @return The conversion result is returned.
2156 s_chtml30_end_pre_tag(void* pdoc, Node* child)
2162 chtml30 = GET_CHTML30(pdoc);
2166 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</pre>", NULL);
2167 chtml30->pre_flag--;
2169 return chtml30->out;
2174 * It is a handler who processes the P tag.
2176 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2177 * destination is specified.
2178 * @param node [i] The P tag node is specified.
2179 * @return The conversion result is returned.
2182 s_chtml30_start_p_tag(void* pdoc, Node* node)
2188 chtml30 = GET_CHTML30(pdoc);
2192 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<p>", NULL);
2194 return chtml30->out;
2199 * It is a handler who processes the P tag.
2201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2202 * destination is specified.
2203 * @param node [i] The P tag node is specified.
2204 * @return The conversion result is returned.
2207 s_chtml30_end_p_tag(void* pdoc, Node* child)
2213 chtml30 = GET_CHTML30(pdoc);
2217 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</p>", NULL);
2219 return chtml30->out;
2224 * It is a handler who processes the OL tag.
2226 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2227 * destination is specified.
2228 * @param node [i] The OL tag node is specified.
2229 * @return The conversion result is returned.
2232 s_chtml30_start_ol_tag(void* pdoc, Node* node)
2238 chtml30 = GET_CHTML30(pdoc);
2242 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ol>", NULL);
2244 return chtml30->out;
2249 * It is a handler who processes the OL tag.
2251 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2252 * destination is specified.
2253 * @param node [i] The OL tag node is specified.
2254 * @return The conversion result is returned.
2257 s_chtml30_end_ol_tag(void* pdoc, Node* node)
2263 chtml30 = GET_CHTML30(pdoc);
2267 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ol>", NULL);
2269 return chtml30->out;
2274 * It is a handler who processes the LI tag.
2276 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2277 * destination is specified.
2278 * @param node [i] The LI tag node is specified.
2279 * @return The conversion result is returned.
2282 s_chtml30_start_li_tag(void* pdoc, Node* node)
2288 chtml30 = GET_CHTML30(pdoc);
2292 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<li>", NULL);
2294 return chtml30->out;
2299 * It is a handler who processes the LI tag.
2301 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2302 * destination is specified.
2303 * @param node [i] The LI tag node is specified.
2304 * @return The conversion result is returned.
2307 s_chtml30_end_li_tag(void* pdoc, Node* child)
2313 chtml30 = GET_CHTML30(pdoc);
2317 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</li>", NULL);
2319 return chtml30->out;
2324 * It is a handler who processes the H1 tag.
2326 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2327 * destination is specified.
2328 * @param node [i] The H1 tag node is specified.
2329 * @return The conversion result is returned.
2332 s_chtml30_start_h1_tag(void* pdoc, Node* node)
2338 chtml30 = GET_CHTML30(pdoc);
2342 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h1>\r\n", NULL);
2344 return chtml30->out;
2349 * It is a handler who processes the H1 tag.
2351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2352 * destination is specified.
2353 * @param node [i] The H1 tag node is specified.
2354 * @return The conversion result is returned.
2357 s_chtml30_end_h1_tag(void* pdoc, Node* child)
2363 chtml30 = GET_CHTML30(pdoc);
2367 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h1>\r\n", NULL);
2369 return chtml30->out;
2374 * It is a handler who processes the H2 tag.
2376 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2377 * destination is specified.
2378 * @param node [i] The H2 tag node is specified.
2379 * @return The conversion result is returned.
2382 s_chtml30_start_h2_tag(void* pdoc, Node* node)
2388 chtml30 = GET_CHTML30(pdoc);
2392 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h2>\r\n", NULL);
2394 return chtml30->out;
2399 * It is a handler who processes the H2 tag.
2401 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2402 * destination is specified.
2403 * @param node [i] The H2 tag node is specified.
2404 * @return The conversion result is returned.
2407 s_chtml30_end_h2_tag(void* pdoc, Node* child)
2413 chtml30 = GET_CHTML30(pdoc);
2417 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h2>\r\n", NULL);
2419 return chtml30->out;
2424 * It is a handler who processes the H3 tag.
2426 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2427 * destination is specified.
2428 * @param node [i] The H3 tag node is specified.
2429 * @return The conversion result is returned.
2432 s_chtml30_start_h3_tag(void* pdoc, Node* node)
2438 chtml30 = GET_CHTML30(pdoc);
2442 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h3>\r\n", NULL);
2444 return chtml30->out;
2449 * It is a handler who processes the H3 tag.
2451 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2452 * destination is specified.
2453 * @param node [i] The H3 tag node is specified.
2454 * @return The conversion result is returned.
2457 s_chtml30_end_h3_tag(void* pdoc, Node* child)
2463 chtml30 = GET_CHTML30(pdoc);
2467 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h3>\r\n", NULL);
2469 return chtml30->out;
2474 * It is a handler who processes the H4 tag.
2476 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2477 * destination is specified.
2478 * @param node [i] The H4 tag node is specified.
2479 * @return The conversion result is returned.
2482 s_chtml30_start_h4_tag(void* pdoc, Node* node)
2488 chtml30 = GET_CHTML30(pdoc);
2492 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h4>\r\n", NULL);
2494 return chtml30->out;
2499 * It is a handler who processes the H4 tag.
2501 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2502 * destination is specified.
2503 * @param node [i] The H4 tag node is specified.
2504 * @return The conversion result is returned.
2507 s_chtml30_end_h4_tag(void* pdoc, Node* child)
2513 chtml30 = GET_CHTML30(pdoc);
2517 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h4>\r\n", NULL);
2519 return chtml30->out;
2524 * It is a handler who processes the H5 tag.
2526 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2527 * destination is specified.
2528 * @param node [i] The H5 tag node is specified.
2529 * @return The conversion result is returned.
2532 s_chtml30_start_h5_tag(void* pdoc, Node* node)
2538 chtml30 = GET_CHTML30(pdoc);
2542 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h5>\r\n", NULL);
2544 return chtml30->out;
2549 * It is a handler who processes the H5 tag.
2551 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2552 * destination is specified.
2553 * @param node [i] The H5 tag node is specified.
2554 * @return The conversion result is returned.
2557 s_chtml30_end_h5_tag(void* pdoc, Node* child)
2563 chtml30 = GET_CHTML30(pdoc);
2567 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h5>\r\n", NULL);
2569 return chtml30->out;
2574 * It is a handler who processes the H6 tag.
2576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2577 * destination is specified.
2578 * @param node [i] The H6 tag node is specified.
2579 * @return The conversion result is returned.
2582 s_chtml30_start_h6_tag(void* pdoc, Node* node)
2588 chtml30 = GET_CHTML30(pdoc);
2592 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h6>\r\n", NULL);
2594 return chtml30->out;
2599 * It is a handler who processes the H6 tag.
2601 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2602 * destination is specified.
2603 * @param node [i] The H6 tag node is specified.
2604 * @return The conversion result is returned.
2607 s_chtml30_end_h6_tag(void* pdoc, Node* child)
2613 chtml30 = GET_CHTML30(pdoc);
2617 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h6>\r\n", NULL);
2619 return chtml30->out;
2624 * It is a handler who processes the TEXTARE tag.
2626 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2627 * destination is specified.
2628 * @param node [i] The TEXTAREA tag node is specified.
2629 * @return The conversion result is returned.
2632 s_chtml30_start_textarea_tag(void* pdoc, Node* node)
2639 chtml30 = GET_CHTML30(pdoc);
2643 chtml30->textarea_flag++;
2644 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<textarea ", NULL);
2646 for (attr = qs_get_attr(doc,node);
2648 attr = qs_get_next_attr(doc,attr)) {
2650 char* name = qs_get_attr_name(doc,attr);
2651 char* value = qs_get_attr_value(doc,attr);
2653 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2654 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",value,"\"", NULL);
2657 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2658 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " rows=\"",value,"\"", NULL);
2661 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2662 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " cols=\"",value,"\"", NULL);
2666 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
2668 return chtml30->out;
2673 * It is a handler who processes the TEXTAREA tag.
2675 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2676 * destination is specified.
2677 * @param node [i] The TEXTAREA tag node is specified.
2678 * @return The conversion result is returned.
2681 s_chtml30_end_textarea_tag(void* pdoc, Node* child)
2687 chtml30 = GET_CHTML30(pdoc);
2691 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</textarea>\r\n", NULL);
2692 chtml30->textarea_flag--;
2694 return chtml30->out;
2699 s_chtml30_chxjif_tag(void* pdoc, Node* node)
2706 chtml30 = GET_CHTML30(pdoc);
2710 for (child = qs_get_child_node(doc, node);
2712 child = qs_get_next_node(doc, child)) {
2713 chtml30->out = apr_pstrcat(r->pool, chtml30->out, child->otext, NULL);
2714 s_chtml30_chxjif_tag(chtml30, child);
2721 s_chtml30_text_tag(void* pdoc, Node* child)
2734 chtml30 = GET_CHTML30(pdoc);
2738 textval = qs_get_node_value(doc,child);
2739 textval = qs_trim_string(chtml30->doc->r, textval);
2740 if (strlen(textval) == 0)
2741 return chtml30->out;
2743 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2744 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2746 tdst = qs_alloc_zero_byte_string(r);
2747 memset(one_byte, 0, sizeof(one_byte));
2750 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2752 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
2754 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2759 if (is_sjis_kanji(textval[ii])) {
2760 one_byte[0] = textval[ii+0];
2761 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2762 one_byte[0] = textval[ii+1];
2763 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2766 else if (chtml30->pre_flag) {
2767 one_byte[0] = textval[ii+0];
2768 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2770 else if (chtml30->textarea_flag) {
2771 one_byte[0] = textval[ii+0];
2772 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2774 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2775 one_byte[0] = textval[ii+0];
2776 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2779 chtml30->out = apr_pstrcat(r->pool, chtml30->out, tdst, NULL);
2781 return chtml30->out;