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 (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)) {
980 char* name = qs_get_attr_name(doc,attr);
981 char* value = qs_get_attr_value(doc,attr);
983 if (strcasecmp(name, "name") == 0) {
984 /*----------------------------------------------------------------------*/
986 /*----------------------------------------------------------------------*/
987 chtml30->out = apr_pstrcat(r->pool,
995 if (strcasecmp(name, "href") == 0) {
996 /*----------------------------------------------------------------------*/
998 /*----------------------------------------------------------------------*/
999 value = chxj_encoding_parameter(r, value);
1000 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1001 chtml30->out = apr_pstrcat(r->pool,
1009 if (strcasecmp(name, "accesskey") == 0) {
1010 /*----------------------------------------------------------------------*/
1012 /*----------------------------------------------------------------------*/
1013 chtml30->out = apr_pstrcat(r->pool,
1021 if (strcasecmp(name, "cti") == 0) {
1022 /*----------------------------------------------------------------------*/
1024 /*----------------------------------------------------------------------*/
1025 chtml30->out = apr_pstrcat(r->pool,
1033 if (strcasecmp(name, "ijam") == 0) {
1034 /*----------------------------------------------------------------------*/
1036 /*----------------------------------------------------------------------*/
1040 if (strcasecmp(name, "utn") == 0) {
1041 /*----------------------------------------------------------------------*/
1043 /* It is special only for CHTML. */
1044 /*----------------------------------------------------------------------*/
1045 chtml30->out = apr_pstrcat(r->pool,
1051 if (strcasecmp(name, "telbook") == 0) {
1052 /*----------------------------------------------------------------------*/
1054 /*----------------------------------------------------------------------*/
1058 if (strcasecmp(name, "kana") == 0) {
1059 /*----------------------------------------------------------------------*/
1061 /*----------------------------------------------------------------------*/
1065 if (strcasecmp(name, "email") == 0) {
1066 /*----------------------------------------------------------------------*/
1068 /*----------------------------------------------------------------------*/
1072 if (strcasecmp(name, "ista") == 0) {
1073 /*----------------------------------------------------------------------*/
1075 /*----------------------------------------------------------------------*/
1079 if (strcasecmp(name, "ilet") == 0) {
1080 /*----------------------------------------------------------------------*/
1082 /*----------------------------------------------------------------------*/
1086 if (strcasecmp(name, "iswf") == 0) {
1087 /*----------------------------------------------------------------------*/
1089 /*----------------------------------------------------------------------*/
1093 if (strcasecmp(name, "irst") == 0) {
1094 /*----------------------------------------------------------------------*/
1096 /*----------------------------------------------------------------------*/
1100 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1102 return chtml30->out;
1107 * It is a handler who processes the A tag.
1109 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1110 * destination is specified.
1111 * @param node [i] The A tag node is specified.
1112 * @return The conversion result is returned.
1115 s_chtml30_end_a_tag(void* pdoc, Node* child)
1121 chtml30 = GET_CHTML30(pdoc);
1125 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</a>", NULL);
1127 return chtml30->out;
1132 * It is a handler who processes the BR tag.
1134 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1135 * destination is specified.
1136 * @param node [i] The BR tag node is specified.
1137 * @return The conversion result is returned.
1140 s_chtml30_start_br_tag(void* pdoc, Node* node)
1146 chtml30 = GET_CHTML30(pdoc);
1150 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1152 return chtml30->out;
1157 * It is a handler who processes the BR tag.
1159 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1160 * destination is specified.
1161 * @param node [i] The BR tag node is specified.
1162 * @return The conversion result is returned.
1165 s_chtml30_end_br_tag(void* pdoc, Node* child)
1169 chtml30 = GET_CHTML30(pdoc);
1171 return chtml30->out;
1176 * It is a handler who processes the TR tag.
1178 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1179 * destination is specified.
1180 * @param node [i] The TR tag node is specified.
1181 * @return The conversion result is returned.
1184 s_chtml30_start_tr_tag(void* pdoc, Node* node)
1188 chtml30 = GET_CHTML30(pdoc);
1190 return chtml30->out;
1195 * It is a handler who processes the TR tag.
1197 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1198 * destination is specified.
1199 * @param node [i] The TR tag node is specified.
1200 * @return The conversion result is returned.
1203 s_chtml30_end_tr_tag(void* pdoc, Node* child)
1209 chtml30 = GET_CHTML30(pdoc);
1213 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1215 return chtml30->out;
1220 * It is a handler who processes the FONT tag.
1222 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1223 * destination is specified.
1224 * @param node [i] The FONT tag node is specified.
1225 * @return The conversion result is returned.
1228 s_chtml30_start_font_tag(void* pdoc, Node* node)
1235 chtml30 = GET_CHTML30(pdoc);
1239 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<font", NULL);
1241 /*--------------------------------------------------------------------------*/
1242 /* Get Attributes */
1243 /*--------------------------------------------------------------------------*/
1244 for (attr = qs_get_attr(doc,node);
1246 attr = qs_get_next_attr(doc,attr)) {
1247 char* name = qs_get_attr_name(doc,attr);
1248 char* value = qs_get_attr_value(doc,attr);
1250 if (strcasecmp(name, "color") == 0) {
1251 chtml30->out = apr_pstrcat(r->pool,
1259 if (strcasecmp(name, "size") == 0) {
1260 /*----------------------------------------------------------------------*/
1262 /*----------------------------------------------------------------------*/
1267 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1269 return chtml30->out;
1274 * It is a handler who processes the FONT tag.
1276 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1277 * destination is specified.
1278 * @param node [i] The FONT tag node is specified.
1279 * @return The conversion result is returned.
1282 s_chtml30_end_font_tag(void* pdoc, Node* child)
1288 chtml30 = GET_CHTML30(pdoc);
1292 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</font>", NULL);
1294 return chtml30->out;
1299 * It is a handler who processes the FORM tag.
1301 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1302 * destination is specified.
1303 * @param node [i] The FORM tag node is specified.
1304 * @return The conversion result is returned.
1307 s_chtml30_start_form_tag(void* pdoc, Node* node)
1314 chtml30 = GET_CHTML30(pdoc);
1318 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<form", NULL);
1320 /*--------------------------------------------------------------------------*/
1321 /* Get Attributes */
1322 /*--------------------------------------------------------------------------*/
1323 for (attr = qs_get_attr(doc,node);
1325 attr = qs_get_next_attr(doc,attr)) {
1326 char* name = qs_get_attr_name(doc,attr);
1327 char* value = qs_get_attr_value(doc,attr);
1328 if (strcasecmp(name, "action") == 0) {
1329 /*----------------------------------------------------------------------*/
1331 /*----------------------------------------------------------------------*/
1332 value = chxj_encoding_parameter(r, value);
1333 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1334 chtml30->out = apr_pstrcat(r->pool,
1342 if (strcasecmp(name, "method") == 0) {
1343 /*----------------------------------------------------------------------*/
1345 /*----------------------------------------------------------------------*/
1346 chtml30->out = apr_pstrcat(r->pool,
1354 if (strcasecmp(name, "utn") == 0) {
1355 /*----------------------------------------------------------------------*/
1357 /* It is special only for CHTML. */
1358 /*----------------------------------------------------------------------*/
1359 chtml30->out = apr_pstrcat(r->pool,
1365 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1367 return chtml30->out;
1372 * It is a handler who processes the FORM tag.
1374 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1375 * destination is specified.
1376 * @param node [i] The FORM tag node is specified.
1377 * @return The conversion result is returned.
1380 s_chtml30_end_form_tag(void* pdoc, Node* child)
1386 chtml30 = GET_CHTML30(pdoc);
1390 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</form>", NULL);
1392 return chtml30->out;
1397 * It is a handler who processes the INPUT tag.
1399 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1400 * destination is specified.
1401 * @param node [i] The INPUT tag node is specified.
1402 * @return The conversion result is returned.
1405 s_chtml30_start_input_tag(void* pdoc, Node* node)
1410 char* max_length = NULL;
1414 char* istyle = NULL;
1416 char* checked = NULL;
1417 char* accesskey = NULL;
1419 chtml30 = GET_CHTML30(pdoc);
1424 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<input", NULL);
1426 /*--------------------------------------------------------------------------*/
1427 /* Get Attributes */
1428 /*--------------------------------------------------------------------------*/
1430 type = qs_get_type_attr(doc, node, r);
1431 name = qs_get_name_attr(doc, node, r);
1432 value = qs_get_value_attr(doc,node,r);
1433 istyle = qs_get_istyle_attr(doc,node,r);
1434 max_length = qs_get_maxlength_attr(doc,node,r);
1435 checked = qs_get_checked_attr(doc,node,r);
1436 accesskey = qs_get_accesskey_attr(doc, node, r);
1437 size = qs_get_size_attr(doc, node, r);
1440 chtml30->out = apr_pstrcat(r->pool,
1448 chtml30->out = apr_pstrcat(r->pool,
1455 chtml30->out = apr_pstrcat(r->pool,
1463 chtml30->out = apr_pstrcat(r->pool,
1471 chtml30->out = apr_pstrcat(r->pool,
1478 /*------------------------------------------------------------------------*/
1480 /*------------------------------------------------------------------------*/
1481 chtml30->out = apr_pstrcat(r->pool,
1487 /*--------------------------------------------------------------------------*/
1488 /* The figure is default for the password. */
1489 /*--------------------------------------------------------------------------*/
1491 if (chxj_chk_numeric(max_length) != 0)
1492 max_length = apr_psprintf(r->pool, "0");
1494 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1495 chtml30->out = apr_pstrcat(r->pool,
1497 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2),
1500 chtml30->out = apr_pstrcat(r->pool,
1502 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)),
1507 chtml30->out = apr_pstrcat(r->pool,
1508 chtml30->out, " checked ", NULL);
1510 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1512 return chtml30->out;
1517 * It is a handler who processes the INPUT tag.
1519 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1520 * destination is specified.
1521 * @param node [i] The INPUT tag node is specified.
1522 * @return The conversion result is returned.
1525 s_chtml30_end_input_tag(void* pdoc, Node* child)
1529 chtml30 = GET_CHTML30(pdoc);
1531 return chtml30->out;
1536 * It is a handler who processes the CENTER tag.
1538 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1539 * destination is specified.
1540 * @param node [i] The CENTER tag node is specified.
1541 * @return The conversion result is returned.
1544 s_chtml30_start_center_tag(void* pdoc, Node* node)
1550 chtml30 = GET_CHTML30(pdoc);
1554 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<center>", NULL);
1556 return chtml30->out;
1561 * It is a handler who processes the CENTER tag.
1563 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1564 * destination is specified.
1565 * @param node [i] The CENTER tag node is specified.
1566 * @return The conversion result is returned.
1569 s_chtml30_end_center_tag(void* pdoc, Node* child)
1575 chtml30 = GET_CHTML30(pdoc);
1579 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</center>", NULL);
1581 return chtml30->out;
1586 * It is a handler who processes the HR tag.
1588 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1589 * destination is specified.
1590 * @param node [i] The HR tag node is specified.
1591 * @return The conversion result is returned.
1594 s_chtml30_start_hr_tag(void* pdoc, Node* node)
1601 chtml30 = GET_CHTML30(pdoc);
1605 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<hr ", NULL);
1607 for (attr = qs_get_attr(doc,node);
1609 attr = qs_get_next_attr(doc,attr)) {
1610 char* name = qs_get_attr_name(doc,attr);
1611 char* value = qs_get_attr_value(doc,attr);
1612 if (strcasecmp(name, "align") == 0) {
1613 /*----------------------------------------------------------------------*/
1615 /*----------------------------------------------------------------------*/
1616 chtml30->out = apr_pstrcat(r->pool,
1618 " align=\"", value, "\" ", NULL);
1621 if (strcasecmp(name, "size") == 0) {
1622 /*----------------------------------------------------------------------*/
1624 /*----------------------------------------------------------------------*/
1625 chtml30->out = apr_pstrcat(r->pool,
1627 " size=\"", value, "\" ", NULL);
1630 if (strcasecmp(name, "width") == 0) {
1631 /*----------------------------------------------------------------------*/
1633 /*----------------------------------------------------------------------*/
1634 chtml30->out = apr_pstrcat(r->pool,
1636 " width=\"", value, "\" ", NULL);
1639 if (strcasecmp(name, "noshade") == 0) {
1640 /*----------------------------------------------------------------------*/
1642 /*----------------------------------------------------------------------*/
1643 chtml30->out = apr_pstrcat(r->pool,
1648 if (strcasecmp(name, "color") == 0) {
1649 /*----------------------------------------------------------------------*/
1651 /*----------------------------------------------------------------------*/
1655 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1657 return chtml30->out;
1662 * It is a handler who processes the HR tag.
1664 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1665 * destination is specified.
1666 * @param node [i] The HR tag node is specified.
1667 * @return The conversion result is returned.
1670 s_chtml30_end_hr_tag(void* pdoc, Node* child)
1674 chtml30 = GET_CHTML30(pdoc);
1676 return chtml30->out;
1681 * It is a handler who processes the IMG tag.
1683 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1684 * destination is specified.
1685 * @param node [i] The IMG tag node is specified.
1686 * @return The conversion result is returned.
1689 s_chtml30_start_img_tag(void* pdoc, Node* node)
1691 #ifndef IMG_NOT_CONVERT_FILENAME
1699 chtml30 = GET_CHTML30(pdoc);
1702 #ifndef IMG_NOT_CONVERT_FILENAME
1703 spec = chtml30->spec;
1706 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<img", NULL);
1709 /*--------------------------------------------------------------------------*/
1710 /* Get Attributes */
1711 /*--------------------------------------------------------------------------*/
1712 for (attr = qs_get_attr(doc,node);
1714 attr = qs_get_next_attr(doc,attr)) {
1715 char* name = qs_get_attr_name(doc,attr);
1716 char* value = qs_get_attr_value(doc,attr);
1718 if (strcasecmp(name, "src") == 0) {
1719 /*----------------------------------------------------------------------*/
1721 /*----------------------------------------------------------------------*/
1722 #ifdef IMG_NOT_CONVERT_FILENAME
1723 value = chxj_encoding_parameter(r, value);
1724 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1726 chtml30->out = apr_pstrcat(r->pool,
1727 chtml30->out, " src=\"",value,"\"", NULL);
1729 value = chxj_img_conv(r,spec,value);
1730 value = chxj_encoding_parameter(r, value);
1731 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1733 chtml30->out = apr_pstrcat(r->pool,
1734 chtml30->out, " src=\"",
1737 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "\"", NULL);
1741 if (strcasecmp(name, "align" ) == 0) {
1742 /*----------------------------------------------------------------------*/
1744 /*----------------------------------------------------------------------*/
1745 chtml30->out = apr_pstrcat(r->pool,
1746 chtml30->out, " align=\"",value,"\"", NULL);
1749 if (strcasecmp(name, "width" ) == 0) {
1750 /*----------------------------------------------------------------------*/
1752 /*----------------------------------------------------------------------*/
1753 chtml30->out = apr_pstrcat(r->pool,
1754 chtml30->out, " width=\"",value,"\"", NULL);
1757 if (strcasecmp(name, "height") == 0) {
1758 /*----------------------------------------------------------------------*/
1760 /*----------------------------------------------------------------------*/
1761 chtml30->out = apr_pstrcat(r->pool,
1762 chtml30->out, " height=\"",value,"\"", NULL);
1765 if (strcasecmp(name, "hspace") == 0) {
1766 /*----------------------------------------------------------------------*/
1768 /*----------------------------------------------------------------------*/
1769 chtml30->out = apr_pstrcat(r->pool,
1770 chtml30->out, " hspace=\"",value,"\"", NULL);
1773 if (strcasecmp(name, "vspace") == 0) {
1774 /*----------------------------------------------------------------------*/
1776 /*----------------------------------------------------------------------*/
1777 chtml30->out = apr_pstrcat(r->pool,
1778 chtml30->out, " vspace=\"",value,"\"", NULL);
1781 if (strcasecmp(name, "alt" ) == 0) {
1782 /*----------------------------------------------------------------------*/
1784 /*----------------------------------------------------------------------*/
1785 chtml30->out = apr_pstrcat(r->pool,
1786 chtml30->out, " alt=\"",value,"\"", NULL);
1789 if (strcasecmp(name, "align" ) == 0) {
1790 /*----------------------------------------------------------------------*/
1792 /*----------------------------------------------------------------------*/
1797 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1799 return chtml30->out;
1804 * It is a handler who processes the IMG tag.
1806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1807 * destination is specified.
1808 * @param node [i] The IMG tag node is specified.
1809 * @return The conversion result is returned.
1812 s_chtml30_end_img_tag(void* pdoc, Node* child)
1816 chtml30 = GET_CHTML30(pdoc);
1818 return chtml30->out;
1823 * It is a handler who processes the SELECT tag.
1825 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1826 * destination is specified.
1827 * @param node [i] The SELECT tag node is specified.
1828 * @return The conversion result is returned.
1831 s_chtml30_start_select_tag(void* pdoc, Node* child)
1841 chtml30 = GET_CHTML30(pdoc);
1847 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<select", NULL);
1848 for (attr = qs_get_attr(doc,child);
1850 attr = qs_get_next_attr(doc,attr)) {
1851 char* nm = qs_get_attr_name(doc,attr);
1852 char* val = qs_get_attr_value(doc,attr);
1854 if (strcasecmp(nm, "size") == 0) {
1855 /*----------------------------------------------------------------------*/
1856 /* CHTML 1.0 version 2.0 */
1857 /*----------------------------------------------------------------------*/
1858 size = apr_pstrdup(r->pool, val);
1861 if (strcasecmp(nm, "name") == 0) {
1862 /*----------------------------------------------------------------------*/
1863 /* CHTML 1.0 version 2.0 */
1864 /*----------------------------------------------------------------------*/
1865 name = apr_pstrdup(r->pool, val);
1868 if (strcasecmp(nm, "multiple") == 0) {
1869 /*----------------------------------------------------------------------*/
1870 /* CHTML 1.0 version 2.0 */
1871 /*----------------------------------------------------------------------*/
1877 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " size=\"",size,"\"", NULL);
1880 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",name,"\"", NULL);
1882 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\n", NULL);
1884 return chtml30->out;
1889 * It is a handler who processes the SELECT tag.
1891 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1892 * destination is specified.
1893 * @param node [i] The SELECT tag node is specified.
1894 * @return The conversion result is returned.
1897 s_chtml30_end_select_tag(void* pdoc, Node* child)
1903 chtml30 = GET_CHTML30(pdoc);
1907 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</select>\n", NULL);
1909 return chtml30->out;
1914 * It is a handler who processes the OPTION tag.
1916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1917 * destination is specified.
1918 * @param node [i] The OPTION tag node is specified.
1919 * @return The conversion result is returned.
1922 s_chtml30_start_option_tag(void* pdoc, Node* child)
1931 chtml30 = GET_CHTML30(pdoc);
1937 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<option", NULL);
1938 for (attr = qs_get_attr(doc,child);
1940 attr = qs_get_next_attr(doc,attr)) {
1941 char* nm = qs_get_attr_name(doc,attr);
1942 char* val = qs_get_attr_value(doc,attr);
1944 if (strcasecmp(nm, "selected") == 0) {
1945 /*----------------------------------------------------------------------*/
1946 /* CHTML 1.0 version 2.0 */
1947 /*----------------------------------------------------------------------*/
1948 selected = apr_pstrdup(r->pool, val);
1951 if (strcasecmp(nm, "value") == 0) {
1952 /*----------------------------------------------------------------------*/
1953 /* CHTML 1.0 version 2.0 */
1954 /*----------------------------------------------------------------------*/
1955 value = apr_pstrdup(r->pool, val);
1960 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"",value,"\"", NULL);
1962 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"\"", NULL);
1965 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " selected ", NULL);
1967 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1969 return chtml30->out;
1974 * It is a handler who processes the OPTION tag.
1976 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1977 * destination is specified.
1978 * @param node [i] The OPTION tag node is specified.
1979 * @return The conversion result is returned.
1982 s_chtml30_end_option_tag(void* pdoc, Node* child)
1986 chtml30 = GET_CHTML30(pdoc);
1990 return chtml30->out;
1995 * It is a handler who processes the DIV tag.
1997 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1998 * destination is specified.
1999 * @param node [i] The DIV tag node is specified.
2000 * @return The conversion result is returned.
2003 s_chtml30_start_div_tag(void* pdoc, Node* child)
2011 chtml30 = GET_CHTML30(pdoc);
2017 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<div", NULL);
2018 for (attr = qs_get_attr(doc,child);
2020 attr = qs_get_next_attr(doc,attr)) {
2021 char* nm = qs_get_attr_name(doc,attr);
2022 char* val = qs_get_attr_value(doc,attr);
2024 if (strcasecmp(nm, "align") == 0) {
2025 /*----------------------------------------------------------------------*/
2026 /* CHTML 1.0 (W3C version 3.2) */
2027 /*----------------------------------------------------------------------*/
2028 align = apr_pstrdup(r->pool, val);
2033 chtml30->out = apr_pstrcat(r->pool,
2034 chtml30->out, " align=\"", align, "\"", NULL);
2036 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
2038 return chtml30->out;
2043 * It is a handler who processes the DIV tag.
2045 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2046 * destination is specified.
2047 * @param node [i] The DIV tag node is specified.
2048 * @return The conversion result is returned.
2051 s_chtml30_end_div_tag(void* pdoc, Node* node)
2057 chtml30 = GET_CHTML30(pdoc);
2061 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</div>\n", NULL);
2063 return chtml30->out;
2068 * It is a handler who processes the UL tag.
2070 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2071 * destination is specified.
2072 * @param node [i] The UL tag node is specified.
2073 * @return The conversion result is returned.
2076 s_chtml30_start_ul_tag(void* pdoc, Node* node)
2082 chtml30 = GET_CHTML30(pdoc);
2086 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ul>", NULL);
2088 return chtml30->out;
2093 * It is a handler who processes the UL tag.
2095 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2096 * destination is specified.
2097 * @param node [i] The UL tag node is specified.
2098 * @return The conversion result is returned.
2101 s_chtml30_end_ul_tag(void* pdoc, Node* child)
2107 chtml30 = GET_CHTML30(pdoc);
2111 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ul>", NULL);
2113 return chtml30->out;
2118 * It is a handler who processes the PRE tag.
2120 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2121 * destination is specified.
2122 * @param node [i] The PRE tag node is specified.
2123 * @return The conversion result is returned.
2126 s_chtml30_start_pre_tag(void* pdoc, Node* node)
2132 chtml30 = GET_CHTML30(pdoc);
2136 chtml30->pre_flag++;
2137 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<pre>", NULL);
2139 return chtml30->out;
2143 * It is a handler who processes the PRE tag.
2145 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2146 * destination is specified.
2147 * @param node [i] The PRE tag node is specified.
2148 * @return The conversion result is returned.
2151 s_chtml30_end_pre_tag(void* pdoc, Node* child)
2157 chtml30 = GET_CHTML30(pdoc);
2161 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</pre>", NULL);
2162 chtml30->pre_flag--;
2164 return chtml30->out;
2169 * It is a handler who processes the P tag.
2171 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2172 * destination is specified.
2173 * @param node [i] The P tag node is specified.
2174 * @return The conversion result is returned.
2177 s_chtml30_start_p_tag(void* pdoc, Node* node)
2183 chtml30 = GET_CHTML30(pdoc);
2187 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<p>", NULL);
2189 return chtml30->out;
2194 * It is a handler who processes the P tag.
2196 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2197 * destination is specified.
2198 * @param node [i] The P tag node is specified.
2199 * @return The conversion result is returned.
2202 s_chtml30_end_p_tag(void* pdoc, Node* child)
2208 chtml30 = GET_CHTML30(pdoc);
2212 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</p>", NULL);
2214 return chtml30->out;
2219 * It is a handler who processes the OL tag.
2221 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2222 * destination is specified.
2223 * @param node [i] The OL tag node is specified.
2224 * @return The conversion result is returned.
2227 s_chtml30_start_ol_tag(void* pdoc, Node* node)
2233 chtml30 = GET_CHTML30(pdoc);
2237 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ol>", NULL);
2239 return chtml30->out;
2244 * It is a handler who processes the OL tag.
2246 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2247 * destination is specified.
2248 * @param node [i] The OL tag node is specified.
2249 * @return The conversion result is returned.
2252 s_chtml30_end_ol_tag(void* pdoc, Node* node)
2258 chtml30 = GET_CHTML30(pdoc);
2262 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ol>", NULL);
2264 return chtml30->out;
2269 * It is a handler who processes the LI tag.
2271 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2272 * destination is specified.
2273 * @param node [i] The LI tag node is specified.
2274 * @return The conversion result is returned.
2277 s_chtml30_start_li_tag(void* pdoc, Node* node)
2283 chtml30 = GET_CHTML30(pdoc);
2287 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<li>", NULL);
2289 return chtml30->out;
2294 * It is a handler who processes the LI tag.
2296 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2297 * destination is specified.
2298 * @param node [i] The LI tag node is specified.
2299 * @return The conversion result is returned.
2302 s_chtml30_end_li_tag(void* pdoc, Node* child)
2308 chtml30 = GET_CHTML30(pdoc);
2312 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</li>", NULL);
2314 return chtml30->out;
2319 * It is a handler who processes the H1 tag.
2321 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2322 * destination is specified.
2323 * @param node [i] The H1 tag node is specified.
2324 * @return The conversion result is returned.
2327 s_chtml30_start_h1_tag(void* pdoc, Node* node)
2333 chtml30 = GET_CHTML30(pdoc);
2337 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h1>\r\n", NULL);
2339 return chtml30->out;
2344 * It is a handler who processes the H1 tag.
2346 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2347 * destination is specified.
2348 * @param node [i] The H1 tag node is specified.
2349 * @return The conversion result is returned.
2352 s_chtml30_end_h1_tag(void* pdoc, Node* child)
2358 chtml30 = GET_CHTML30(pdoc);
2362 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h1>\r\n", NULL);
2364 return chtml30->out;
2369 * It is a handler who processes the H2 tag.
2371 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2372 * destination is specified.
2373 * @param node [i] The H2 tag node is specified.
2374 * @return The conversion result is returned.
2377 s_chtml30_start_h2_tag(void* pdoc, Node* node)
2383 chtml30 = GET_CHTML30(pdoc);
2387 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h2>\r\n", NULL);
2389 return chtml30->out;
2394 * It is a handler who processes the H2 tag.
2396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2397 * destination is specified.
2398 * @param node [i] The H2 tag node is specified.
2399 * @return The conversion result is returned.
2402 s_chtml30_end_h2_tag(void* pdoc, Node* child)
2408 chtml30 = GET_CHTML30(pdoc);
2412 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h2>\r\n", NULL);
2414 return chtml30->out;
2419 * It is a handler who processes the H3 tag.
2421 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2422 * destination is specified.
2423 * @param node [i] The H3 tag node is specified.
2424 * @return The conversion result is returned.
2427 s_chtml30_start_h3_tag(void* pdoc, Node* node)
2433 chtml30 = GET_CHTML30(pdoc);
2437 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h3>\r\n", NULL);
2439 return chtml30->out;
2444 * It is a handler who processes the H3 tag.
2446 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2447 * destination is specified.
2448 * @param node [i] The H3 tag node is specified.
2449 * @return The conversion result is returned.
2452 s_chtml30_end_h3_tag(void* pdoc, Node* child)
2458 chtml30 = GET_CHTML30(pdoc);
2462 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h3>\r\n", NULL);
2464 return chtml30->out;
2469 * It is a handler who processes the H4 tag.
2471 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2472 * destination is specified.
2473 * @param node [i] The H4 tag node is specified.
2474 * @return The conversion result is returned.
2477 s_chtml30_start_h4_tag(void* pdoc, Node* node)
2483 chtml30 = GET_CHTML30(pdoc);
2487 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h4>\r\n", NULL);
2489 return chtml30->out;
2494 * It is a handler who processes the H4 tag.
2496 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2497 * destination is specified.
2498 * @param node [i] The H4 tag node is specified.
2499 * @return The conversion result is returned.
2502 s_chtml30_end_h4_tag(void* pdoc, Node* child)
2508 chtml30 = GET_CHTML30(pdoc);
2512 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h4>\r\n", NULL);
2514 return chtml30->out;
2519 * It is a handler who processes the H5 tag.
2521 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2522 * destination is specified.
2523 * @param node [i] The H5 tag node is specified.
2524 * @return The conversion result is returned.
2527 s_chtml30_start_h5_tag(void* pdoc, Node* node)
2533 chtml30 = GET_CHTML30(pdoc);
2537 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h5>\r\n", NULL);
2539 return chtml30->out;
2544 * It is a handler who processes the H5 tag.
2546 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2547 * destination is specified.
2548 * @param node [i] The H5 tag node is specified.
2549 * @return The conversion result is returned.
2552 s_chtml30_end_h5_tag(void* pdoc, Node* child)
2558 chtml30 = GET_CHTML30(pdoc);
2562 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h5>\r\n", NULL);
2564 return chtml30->out;
2569 * It is a handler who processes the H6 tag.
2571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2572 * destination is specified.
2573 * @param node [i] The H6 tag node is specified.
2574 * @return The conversion result is returned.
2577 s_chtml30_start_h6_tag(void* pdoc, Node* node)
2583 chtml30 = GET_CHTML30(pdoc);
2587 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h6>\r\n", NULL);
2589 return chtml30->out;
2594 * It is a handler who processes the H6 tag.
2596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2597 * destination is specified.
2598 * @param node [i] The H6 tag node is specified.
2599 * @return The conversion result is returned.
2602 s_chtml30_end_h6_tag(void* pdoc, Node* child)
2608 chtml30 = GET_CHTML30(pdoc);
2612 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h6>\r\n", NULL);
2614 return chtml30->out;
2619 * It is a handler who processes the TEXTARE tag.
2621 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2622 * destination is specified.
2623 * @param node [i] The TEXTAREA tag node is specified.
2624 * @return The conversion result is returned.
2627 s_chtml30_start_textarea_tag(void* pdoc, Node* node)
2634 chtml30 = GET_CHTML30(pdoc);
2638 chtml30->textarea_flag++;
2639 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<textarea ", NULL);
2641 for (attr = qs_get_attr(doc,node);
2643 attr = qs_get_next_attr(doc,attr)) {
2645 char* name = qs_get_attr_name(doc,attr);
2646 char* value = qs_get_attr_value(doc,attr);
2648 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2649 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",value,"\"", NULL);
2652 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2653 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " rows=\"",value,"\"", NULL);
2656 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2657 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " cols=\"",value,"\"", NULL);
2661 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
2663 return chtml30->out;
2668 * It is a handler who processes the TEXTAREA tag.
2670 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2671 * destination is specified.
2672 * @param node [i] The TEXTAREA tag node is specified.
2673 * @return The conversion result is returned.
2676 s_chtml30_end_textarea_tag(void* pdoc, Node* child)
2682 chtml30 = GET_CHTML30(pdoc);
2686 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</textarea>\r\n", NULL);
2687 chtml30->textarea_flag--;
2689 return chtml30->out;
2694 s_chtml30_chxjif_tag(void* pdoc, Node* node)
2701 chtml30 = GET_CHTML30(pdoc);
2705 for (child = qs_get_child_node(doc, node);
2707 child = qs_get_next_node(doc, child)) {
2708 chtml30->out = apr_pstrcat(r->pool, chtml30->out, child->otext, NULL);
2709 s_chtml30_chxjif_tag(chtml30, child);
2716 s_chtml30_text_tag(void* pdoc, Node* child)
2729 chtml30 = GET_CHTML30(pdoc);
2733 textval = qs_get_node_value(doc,child);
2734 textval = qs_trim_string(chtml30->doc->r, textval);
2735 if (strlen(textval) == 0)
2736 return chtml30->out;
2738 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2739 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2741 tdst = qs_alloc_zero_byte_string(r);
2742 memset(one_byte, 0, sizeof(one_byte));
2745 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2747 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
2749 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2754 if (is_sjis_kanji(textval[ii])) {
2755 one_byte[0] = textval[ii+0];
2756 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2757 one_byte[0] = textval[ii+1];
2758 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2761 else if (chtml30->pre_flag) {
2762 one_byte[0] = textval[ii+0];
2763 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2765 else if (chtml30->textarea_flag) {
2766 one_byte[0] = textval[ii+0];
2767 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2769 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2770 one_byte[0] = textval[ii+0];
2771 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2774 chtml30->out = apr_pstrcat(r->pool, chtml30->out, tdst, NULL);
2776 return chtml30->out;