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 /*----------------------------------------------------------------------*/
1104 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1106 return chtml30->out;
1111 * It is a handler who processes the A tag.
1113 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1114 * destination is specified.
1115 * @param node [i] The A tag node is specified.
1116 * @return The conversion result is returned.
1119 s_chtml30_end_a_tag(void* pdoc, Node* child)
1125 chtml30 = GET_CHTML30(pdoc);
1129 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</a>", NULL);
1131 return chtml30->out;
1136 * It is a handler who processes the BR tag.
1138 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1139 * destination is specified.
1140 * @param node [i] The BR tag node is specified.
1141 * @return The conversion result is returned.
1144 s_chtml30_start_br_tag(void* pdoc, Node* node)
1150 chtml30 = GET_CHTML30(pdoc);
1154 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1156 return chtml30->out;
1161 * It is a handler who processes the BR tag.
1163 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1164 * destination is specified.
1165 * @param node [i] The BR tag node is specified.
1166 * @return The conversion result is returned.
1169 s_chtml30_end_br_tag(void* pdoc, Node* child)
1173 chtml30 = GET_CHTML30(pdoc);
1175 return chtml30->out;
1180 * It is a handler who processes the TR tag.
1182 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1183 * destination is specified.
1184 * @param node [i] The TR tag node is specified.
1185 * @return The conversion result is returned.
1188 s_chtml30_start_tr_tag(void* pdoc, Node* node)
1192 chtml30 = GET_CHTML30(pdoc);
1194 return chtml30->out;
1199 * It is a handler who processes the TR tag.
1201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1202 * destination is specified.
1203 * @param node [i] The TR tag node is specified.
1204 * @return The conversion result is returned.
1207 s_chtml30_end_tr_tag(void* pdoc, Node* child)
1213 chtml30 = GET_CHTML30(pdoc);
1217 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
1219 return chtml30->out;
1224 * It is a handler who processes the FONT tag.
1226 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1227 * destination is specified.
1228 * @param node [i] The FONT tag node is specified.
1229 * @return The conversion result is returned.
1232 s_chtml30_start_font_tag(void* pdoc, Node* node)
1239 chtml30 = GET_CHTML30(pdoc);
1243 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<font", NULL);
1245 /*--------------------------------------------------------------------------*/
1246 /* Get Attributes */
1247 /*--------------------------------------------------------------------------*/
1248 for (attr = qs_get_attr(doc,node);
1250 attr = qs_get_next_attr(doc,attr)) {
1251 char* name = qs_get_attr_name(doc,attr);
1252 char* value = qs_get_attr_value(doc,attr);
1254 if (strcasecmp(name, "color") == 0) {
1255 chtml30->out = apr_pstrcat(r->pool,
1263 if (strcasecmp(name, "size") == 0) {
1264 /*----------------------------------------------------------------------*/
1266 /*----------------------------------------------------------------------*/
1271 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1273 return chtml30->out;
1278 * It is a handler who processes the FONT tag.
1280 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1281 * destination is specified.
1282 * @param node [i] The FONT tag node is specified.
1283 * @return The conversion result is returned.
1286 s_chtml30_end_font_tag(void* pdoc, Node* child)
1292 chtml30 = GET_CHTML30(pdoc);
1296 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</font>", NULL);
1298 return chtml30->out;
1303 * It is a handler who processes the FORM tag.
1305 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1306 * destination is specified.
1307 * @param node [i] The FORM tag node is specified.
1308 * @return The conversion result is returned.
1311 s_chtml30_start_form_tag(void* pdoc, Node* node)
1318 chtml30 = GET_CHTML30(pdoc);
1322 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<form", NULL);
1324 /*--------------------------------------------------------------------------*/
1325 /* Get Attributes */
1326 /*--------------------------------------------------------------------------*/
1327 for (attr = qs_get_attr(doc,node);
1329 attr = qs_get_next_attr(doc,attr)) {
1330 char* name = qs_get_attr_name(doc,attr);
1331 char* value = qs_get_attr_value(doc,attr);
1332 if (strcasecmp(name, "action") == 0) {
1333 /*----------------------------------------------------------------------*/
1335 /*----------------------------------------------------------------------*/
1336 value = chxj_encoding_parameter(r, value);
1337 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1338 chtml30->out = apr_pstrcat(r->pool,
1346 if (strcasecmp(name, "method") == 0) {
1347 /*----------------------------------------------------------------------*/
1349 /*----------------------------------------------------------------------*/
1350 chtml30->out = apr_pstrcat(r->pool,
1358 if (strcasecmp(name, "utn") == 0) {
1359 /*----------------------------------------------------------------------*/
1361 /* It is special only for CHTML. */
1362 /*----------------------------------------------------------------------*/
1363 chtml30->out = apr_pstrcat(r->pool,
1369 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1371 return chtml30->out;
1376 * It is a handler who processes the FORM tag.
1378 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1379 * destination is specified.
1380 * @param node [i] The FORM tag node is specified.
1381 * @return The conversion result is returned.
1384 s_chtml30_end_form_tag(void* pdoc, Node* child)
1390 chtml30 = GET_CHTML30(pdoc);
1394 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</form>", NULL);
1396 return chtml30->out;
1401 * It is a handler who processes the INPUT tag.
1403 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1404 * destination is specified.
1405 * @param node [i] The INPUT tag node is specified.
1406 * @return The conversion result is returned.
1409 s_chtml30_start_input_tag(void* pdoc, Node* node)
1414 char* max_length = NULL;
1418 char* istyle = NULL;
1420 char* checked = NULL;
1421 char* accesskey = NULL;
1423 chtml30 = GET_CHTML30(pdoc);
1428 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<input", NULL);
1430 /*--------------------------------------------------------------------------*/
1431 /* Get Attributes */
1432 /*--------------------------------------------------------------------------*/
1434 type = qs_get_type_attr(doc, node, r);
1435 name = qs_get_name_attr(doc, node, r);
1436 value = qs_get_value_attr(doc,node,r);
1437 istyle = qs_get_istyle_attr(doc,node,r);
1438 max_length = qs_get_maxlength_attr(doc,node,r);
1439 checked = qs_get_checked_attr(doc,node,r);
1440 accesskey = qs_get_accesskey_attr(doc, node, r);
1441 size = qs_get_size_attr(doc, node, r);
1444 chtml30->out = apr_pstrcat(r->pool,
1452 chtml30->out = apr_pstrcat(r->pool,
1459 chtml30->out = apr_pstrcat(r->pool,
1467 chtml30->out = apr_pstrcat(r->pool,
1475 chtml30->out = apr_pstrcat(r->pool,
1482 /*------------------------------------------------------------------------*/
1484 /*------------------------------------------------------------------------*/
1485 chtml30->out = apr_pstrcat(r->pool,
1491 /*--------------------------------------------------------------------------*/
1492 /* The figure is default for the password. */
1493 /*--------------------------------------------------------------------------*/
1495 if (chxj_chk_numeric(max_length) != 0)
1496 max_length = apr_psprintf(r->pool, "0");
1498 if (istyle != NULL && strcasecmp(istyle, "1") == 0)
1499 chtml30->out = apr_pstrcat(r->pool,
1501 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2),
1504 chtml30->out = apr_pstrcat(r->pool,
1506 apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)),
1511 chtml30->out = apr_pstrcat(r->pool,
1512 chtml30->out, " checked ", NULL);
1514 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1516 return chtml30->out;
1521 * It is a handler who processes the INPUT tag.
1523 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1524 * destination is specified.
1525 * @param node [i] The INPUT tag node is specified.
1526 * @return The conversion result is returned.
1529 s_chtml30_end_input_tag(void* pdoc, Node* child)
1533 chtml30 = GET_CHTML30(pdoc);
1535 return chtml30->out;
1540 * It is a handler who processes the CENTER tag.
1542 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1543 * destination is specified.
1544 * @param node [i] The CENTER tag node is specified.
1545 * @return The conversion result is returned.
1548 s_chtml30_start_center_tag(void* pdoc, Node* node)
1554 chtml30 = GET_CHTML30(pdoc);
1558 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<center>", NULL);
1560 return chtml30->out;
1565 * It is a handler who processes the CENTER tag.
1567 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1568 * destination is specified.
1569 * @param node [i] The CENTER tag node is specified.
1570 * @return The conversion result is returned.
1573 s_chtml30_end_center_tag(void* pdoc, Node* child)
1579 chtml30 = GET_CHTML30(pdoc);
1583 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</center>", NULL);
1585 return chtml30->out;
1590 * It is a handler who processes the HR tag.
1592 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1593 * destination is specified.
1594 * @param node [i] The HR tag node is specified.
1595 * @return The conversion result is returned.
1598 s_chtml30_start_hr_tag(void* pdoc, Node* node)
1605 chtml30 = GET_CHTML30(pdoc);
1609 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<hr ", NULL);
1611 for (attr = qs_get_attr(doc,node);
1613 attr = qs_get_next_attr(doc,attr)) {
1614 char* name = qs_get_attr_name(doc,attr);
1615 char* value = qs_get_attr_value(doc,attr);
1616 if (strcasecmp(name, "align") == 0) {
1617 /*----------------------------------------------------------------------*/
1619 /*----------------------------------------------------------------------*/
1620 chtml30->out = apr_pstrcat(r->pool,
1622 " align=\"", value, "\" ", NULL);
1625 if (strcasecmp(name, "size") == 0) {
1626 /*----------------------------------------------------------------------*/
1628 /*----------------------------------------------------------------------*/
1629 chtml30->out = apr_pstrcat(r->pool,
1631 " size=\"", value, "\" ", NULL);
1634 if (strcasecmp(name, "width") == 0) {
1635 /*----------------------------------------------------------------------*/
1637 /*----------------------------------------------------------------------*/
1638 chtml30->out = apr_pstrcat(r->pool,
1640 " width=\"", value, "\" ", NULL);
1643 if (strcasecmp(name, "noshade") == 0) {
1644 /*----------------------------------------------------------------------*/
1646 /*----------------------------------------------------------------------*/
1647 chtml30->out = apr_pstrcat(r->pool,
1652 if (strcasecmp(name, "color") == 0) {
1653 /*----------------------------------------------------------------------*/
1655 /*----------------------------------------------------------------------*/
1659 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
1661 return chtml30->out;
1666 * It is a handler who processes the HR tag.
1668 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1669 * destination is specified.
1670 * @param node [i] The HR tag node is specified.
1671 * @return The conversion result is returned.
1674 s_chtml30_end_hr_tag(void* pdoc, Node* child)
1678 chtml30 = GET_CHTML30(pdoc);
1680 return chtml30->out;
1685 * It is a handler who processes the IMG tag.
1687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1688 * destination is specified.
1689 * @param node [i] The IMG tag node is specified.
1690 * @return The conversion result is returned.
1693 s_chtml30_start_img_tag(void* pdoc, Node* node)
1695 #ifndef IMG_NOT_CONVERT_FILENAME
1703 chtml30 = GET_CHTML30(pdoc);
1706 #ifndef IMG_NOT_CONVERT_FILENAME
1707 spec = chtml30->spec;
1710 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<img", NULL);
1713 /*--------------------------------------------------------------------------*/
1714 /* Get Attributes */
1715 /*--------------------------------------------------------------------------*/
1716 for (attr = qs_get_attr(doc,node);
1718 attr = qs_get_next_attr(doc,attr)) {
1719 char* name = qs_get_attr_name(doc,attr);
1720 char* value = qs_get_attr_value(doc,attr);
1722 if (strcasecmp(name, "src") == 0) {
1723 /*----------------------------------------------------------------------*/
1725 /*----------------------------------------------------------------------*/
1726 #ifdef IMG_NOT_CONVERT_FILENAME
1727 value = chxj_encoding_parameter(r, value);
1728 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1730 chtml30->out = apr_pstrcat(r->pool,
1731 chtml30->out, " src=\"",value,"\"", NULL);
1733 value = chxj_img_conv(r,spec,value);
1734 value = chxj_encoding_parameter(r, value);
1735 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1737 chtml30->out = apr_pstrcat(r->pool,
1738 chtml30->out, " src=\"",
1741 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "\"", NULL);
1745 if (strcasecmp(name, "align" ) == 0) {
1746 /*----------------------------------------------------------------------*/
1748 /*----------------------------------------------------------------------*/
1749 chtml30->out = apr_pstrcat(r->pool,
1750 chtml30->out, " align=\"",value,"\"", NULL);
1753 if (strcasecmp(name, "width" ) == 0) {
1754 /*----------------------------------------------------------------------*/
1756 /*----------------------------------------------------------------------*/
1757 chtml30->out = apr_pstrcat(r->pool,
1758 chtml30->out, " width=\"",value,"\"", NULL);
1761 if (strcasecmp(name, "height") == 0) {
1762 /*----------------------------------------------------------------------*/
1764 /*----------------------------------------------------------------------*/
1765 chtml30->out = apr_pstrcat(r->pool,
1766 chtml30->out, " height=\"",value,"\"", NULL);
1769 if (strcasecmp(name, "hspace") == 0) {
1770 /*----------------------------------------------------------------------*/
1772 /*----------------------------------------------------------------------*/
1773 chtml30->out = apr_pstrcat(r->pool,
1774 chtml30->out, " hspace=\"",value,"\"", NULL);
1777 if (strcasecmp(name, "vspace") == 0) {
1778 /*----------------------------------------------------------------------*/
1780 /*----------------------------------------------------------------------*/
1781 chtml30->out = apr_pstrcat(r->pool,
1782 chtml30->out, " vspace=\"",value,"\"", NULL);
1785 if (strcasecmp(name, "alt" ) == 0) {
1786 /*----------------------------------------------------------------------*/
1788 /*----------------------------------------------------------------------*/
1789 chtml30->out = apr_pstrcat(r->pool,
1790 chtml30->out, " alt=\"",value,"\"", NULL);
1793 if (strcasecmp(name, "align" ) == 0) {
1794 /*----------------------------------------------------------------------*/
1796 /*----------------------------------------------------------------------*/
1801 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1803 return chtml30->out;
1808 * It is a handler who processes the IMG tag.
1810 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1811 * destination is specified.
1812 * @param node [i] The IMG tag node is specified.
1813 * @return The conversion result is returned.
1816 s_chtml30_end_img_tag(void* pdoc, Node* child)
1820 chtml30 = GET_CHTML30(pdoc);
1822 return chtml30->out;
1827 * It is a handler who processes the SELECT tag.
1829 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1830 * destination is specified.
1831 * @param node [i] The SELECT tag node is specified.
1832 * @return The conversion result is returned.
1835 s_chtml30_start_select_tag(void* pdoc, Node* child)
1845 chtml30 = GET_CHTML30(pdoc);
1851 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<select", NULL);
1852 for (attr = qs_get_attr(doc,child);
1854 attr = qs_get_next_attr(doc,attr)) {
1855 char* nm = qs_get_attr_name(doc,attr);
1856 char* val = qs_get_attr_value(doc,attr);
1858 if (strcasecmp(nm, "size") == 0) {
1859 /*----------------------------------------------------------------------*/
1860 /* CHTML 1.0 version 2.0 */
1861 /*----------------------------------------------------------------------*/
1862 size = apr_pstrdup(r->pool, val);
1865 if (strcasecmp(nm, "name") == 0) {
1866 /*----------------------------------------------------------------------*/
1867 /* CHTML 1.0 version 2.0 */
1868 /*----------------------------------------------------------------------*/
1869 name = apr_pstrdup(r->pool, val);
1872 if (strcasecmp(nm, "multiple") == 0) {
1873 /*----------------------------------------------------------------------*/
1874 /* CHTML 1.0 version 2.0 */
1875 /*----------------------------------------------------------------------*/
1881 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " size=\"",size,"\"", NULL);
1884 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",name,"\"", NULL);
1886 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\n", NULL);
1888 return chtml30->out;
1893 * It is a handler who processes the SELECT tag.
1895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1896 * destination is specified.
1897 * @param node [i] The SELECT tag node is specified.
1898 * @return The conversion result is returned.
1901 s_chtml30_end_select_tag(void* pdoc, Node* child)
1907 chtml30 = GET_CHTML30(pdoc);
1911 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</select>\n", NULL);
1913 return chtml30->out;
1918 * It is a handler who processes the OPTION tag.
1920 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1921 * destination is specified.
1922 * @param node [i] The OPTION tag node is specified.
1923 * @return The conversion result is returned.
1926 s_chtml30_start_option_tag(void* pdoc, Node* child)
1935 chtml30 = GET_CHTML30(pdoc);
1941 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<option", NULL);
1942 for (attr = qs_get_attr(doc,child);
1944 attr = qs_get_next_attr(doc,attr)) {
1945 char* nm = qs_get_attr_name(doc,attr);
1946 char* val = qs_get_attr_value(doc,attr);
1948 if (strcasecmp(nm, "selected") == 0) {
1949 /*----------------------------------------------------------------------*/
1950 /* CHTML 1.0 version 2.0 */
1951 /*----------------------------------------------------------------------*/
1952 selected = apr_pstrdup(r->pool, val);
1955 if (strcasecmp(nm, "value") == 0) {
1956 /*----------------------------------------------------------------------*/
1957 /* CHTML 1.0 version 2.0 */
1958 /*----------------------------------------------------------------------*/
1959 value = apr_pstrdup(r->pool, val);
1964 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"",value,"\"", NULL);
1966 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"\"", NULL);
1969 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " selected ", NULL);
1971 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
1973 return chtml30->out;
1978 * It is a handler who processes the OPTION tag.
1980 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1981 * destination is specified.
1982 * @param node [i] The OPTION tag node is specified.
1983 * @return The conversion result is returned.
1986 s_chtml30_end_option_tag(void* pdoc, Node* child)
1990 chtml30 = GET_CHTML30(pdoc);
1994 return chtml30->out;
1999 * It is a handler who processes the DIV tag.
2001 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2002 * destination is specified.
2003 * @param node [i] The DIV tag node is specified.
2004 * @return The conversion result is returned.
2007 s_chtml30_start_div_tag(void* pdoc, Node* child)
2015 chtml30 = GET_CHTML30(pdoc);
2021 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<div", NULL);
2022 for (attr = qs_get_attr(doc,child);
2024 attr = qs_get_next_attr(doc,attr)) {
2025 char* nm = qs_get_attr_name(doc,attr);
2026 char* val = qs_get_attr_value(doc,attr);
2028 if (strcasecmp(nm, "align") == 0) {
2029 /*----------------------------------------------------------------------*/
2030 /* CHTML 1.0 (W3C version 3.2) */
2031 /*----------------------------------------------------------------------*/
2032 align = apr_pstrdup(r->pool, val);
2037 chtml30->out = apr_pstrcat(r->pool,
2038 chtml30->out, " align=\"", align, "\"", NULL);
2040 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
2042 return chtml30->out;
2047 * It is a handler who processes the DIV tag.
2049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2050 * destination is specified.
2051 * @param node [i] The DIV tag node is specified.
2052 * @return The conversion result is returned.
2055 s_chtml30_end_div_tag(void* pdoc, Node* node)
2061 chtml30 = GET_CHTML30(pdoc);
2065 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</div>\n", NULL);
2067 return chtml30->out;
2072 * It is a handler who processes the UL tag.
2074 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2075 * destination is specified.
2076 * @param node [i] The UL tag node is specified.
2077 * @return The conversion result is returned.
2080 s_chtml30_start_ul_tag(void* pdoc, Node* node)
2086 chtml30 = GET_CHTML30(pdoc);
2090 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ul>", NULL);
2092 return chtml30->out;
2097 * It is a handler who processes the UL tag.
2099 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2100 * destination is specified.
2101 * @param node [i] The UL tag node is specified.
2102 * @return The conversion result is returned.
2105 s_chtml30_end_ul_tag(void* pdoc, Node* child)
2111 chtml30 = GET_CHTML30(pdoc);
2115 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ul>", NULL);
2117 return chtml30->out;
2122 * It is a handler who processes the PRE tag.
2124 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2125 * destination is specified.
2126 * @param node [i] The PRE tag node is specified.
2127 * @return The conversion result is returned.
2130 s_chtml30_start_pre_tag(void* pdoc, Node* node)
2136 chtml30 = GET_CHTML30(pdoc);
2140 chtml30->pre_flag++;
2141 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<pre>", NULL);
2143 return chtml30->out;
2147 * It is a handler who processes the PRE tag.
2149 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2150 * destination is specified.
2151 * @param node [i] The PRE tag node is specified.
2152 * @return The conversion result is returned.
2155 s_chtml30_end_pre_tag(void* pdoc, Node* child)
2161 chtml30 = GET_CHTML30(pdoc);
2165 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</pre>", NULL);
2166 chtml30->pre_flag--;
2168 return chtml30->out;
2173 * It is a handler who processes the P tag.
2175 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2176 * destination is specified.
2177 * @param node [i] The P tag node is specified.
2178 * @return The conversion result is returned.
2181 s_chtml30_start_p_tag(void* pdoc, Node* node)
2187 chtml30 = GET_CHTML30(pdoc);
2191 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<p>", NULL);
2193 return chtml30->out;
2198 * It is a handler who processes the P tag.
2200 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2201 * destination is specified.
2202 * @param node [i] The P tag node is specified.
2203 * @return The conversion result is returned.
2206 s_chtml30_end_p_tag(void* pdoc, Node* child)
2212 chtml30 = GET_CHTML30(pdoc);
2216 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</p>", NULL);
2218 return chtml30->out;
2223 * It is a handler who processes the OL tag.
2225 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2226 * destination is specified.
2227 * @param node [i] The OL tag node is specified.
2228 * @return The conversion result is returned.
2231 s_chtml30_start_ol_tag(void* pdoc, Node* node)
2237 chtml30 = GET_CHTML30(pdoc);
2241 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<ol>", NULL);
2243 return chtml30->out;
2248 * It is a handler who processes the OL tag.
2250 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2251 * destination is specified.
2252 * @param node [i] The OL tag node is specified.
2253 * @return The conversion result is returned.
2256 s_chtml30_end_ol_tag(void* pdoc, Node* node)
2262 chtml30 = GET_CHTML30(pdoc);
2266 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</ol>", NULL);
2268 return chtml30->out;
2273 * It is a handler who processes the LI tag.
2275 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2276 * destination is specified.
2277 * @param node [i] The LI tag node is specified.
2278 * @return The conversion result is returned.
2281 s_chtml30_start_li_tag(void* pdoc, Node* node)
2287 chtml30 = GET_CHTML30(pdoc);
2291 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<li>", NULL);
2293 return chtml30->out;
2298 * It is a handler who processes the LI tag.
2300 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2301 * destination is specified.
2302 * @param node [i] The LI tag node is specified.
2303 * @return The conversion result is returned.
2306 s_chtml30_end_li_tag(void* pdoc, Node* child)
2312 chtml30 = GET_CHTML30(pdoc);
2316 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</li>", NULL);
2318 return chtml30->out;
2323 * It is a handler who processes the H1 tag.
2325 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2326 * destination is specified.
2327 * @param node [i] The H1 tag node is specified.
2328 * @return The conversion result is returned.
2331 s_chtml30_start_h1_tag(void* pdoc, Node* node)
2337 chtml30 = GET_CHTML30(pdoc);
2341 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h1>\r\n", NULL);
2343 return chtml30->out;
2348 * It is a handler who processes the H1 tag.
2350 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2351 * destination is specified.
2352 * @param node [i] The H1 tag node is specified.
2353 * @return The conversion result is returned.
2356 s_chtml30_end_h1_tag(void* pdoc, Node* child)
2362 chtml30 = GET_CHTML30(pdoc);
2366 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h1>\r\n", NULL);
2368 return chtml30->out;
2373 * It is a handler who processes the H2 tag.
2375 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2376 * destination is specified.
2377 * @param node [i] The H2 tag node is specified.
2378 * @return The conversion result is returned.
2381 s_chtml30_start_h2_tag(void* pdoc, Node* node)
2387 chtml30 = GET_CHTML30(pdoc);
2391 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h2>\r\n", NULL);
2393 return chtml30->out;
2398 * It is a handler who processes the H2 tag.
2400 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2401 * destination is specified.
2402 * @param node [i] The H2 tag node is specified.
2403 * @return The conversion result is returned.
2406 s_chtml30_end_h2_tag(void* pdoc, Node* child)
2412 chtml30 = GET_CHTML30(pdoc);
2416 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h2>\r\n", NULL);
2418 return chtml30->out;
2423 * It is a handler who processes the H3 tag.
2425 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2426 * destination is specified.
2427 * @param node [i] The H3 tag node is specified.
2428 * @return The conversion result is returned.
2431 s_chtml30_start_h3_tag(void* pdoc, Node* node)
2437 chtml30 = GET_CHTML30(pdoc);
2441 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h3>\r\n", NULL);
2443 return chtml30->out;
2448 * It is a handler who processes the H3 tag.
2450 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2451 * destination is specified.
2452 * @param node [i] The H3 tag node is specified.
2453 * @return The conversion result is returned.
2456 s_chtml30_end_h3_tag(void* pdoc, Node* child)
2462 chtml30 = GET_CHTML30(pdoc);
2466 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h3>\r\n", NULL);
2468 return chtml30->out;
2473 * It is a handler who processes the H4 tag.
2475 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2476 * destination is specified.
2477 * @param node [i] The H4 tag node is specified.
2478 * @return The conversion result is returned.
2481 s_chtml30_start_h4_tag(void* pdoc, Node* node)
2487 chtml30 = GET_CHTML30(pdoc);
2491 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h4>\r\n", NULL);
2493 return chtml30->out;
2498 * It is a handler who processes the H4 tag.
2500 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2501 * destination is specified.
2502 * @param node [i] The H4 tag node is specified.
2503 * @return The conversion result is returned.
2506 s_chtml30_end_h4_tag(void* pdoc, Node* child)
2512 chtml30 = GET_CHTML30(pdoc);
2516 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h4>\r\n", NULL);
2518 return chtml30->out;
2523 * It is a handler who processes the H5 tag.
2525 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2526 * destination is specified.
2527 * @param node [i] The H5 tag node is specified.
2528 * @return The conversion result is returned.
2531 s_chtml30_start_h5_tag(void* pdoc, Node* node)
2537 chtml30 = GET_CHTML30(pdoc);
2541 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h5>\r\n", NULL);
2543 return chtml30->out;
2548 * It is a handler who processes the H5 tag.
2550 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2551 * destination is specified.
2552 * @param node [i] The H5 tag node is specified.
2553 * @return The conversion result is returned.
2556 s_chtml30_end_h5_tag(void* pdoc, Node* child)
2562 chtml30 = GET_CHTML30(pdoc);
2566 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h5>\r\n", NULL);
2568 return chtml30->out;
2573 * It is a handler who processes the H6 tag.
2575 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2576 * destination is specified.
2577 * @param node [i] The H6 tag node is specified.
2578 * @return The conversion result is returned.
2581 s_chtml30_start_h6_tag(void* pdoc, Node* node)
2587 chtml30 = GET_CHTML30(pdoc);
2591 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<h6>\r\n", NULL);
2593 return chtml30->out;
2598 * It is a handler who processes the H6 tag.
2600 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2601 * destination is specified.
2602 * @param node [i] The H6 tag node is specified.
2603 * @return The conversion result is returned.
2606 s_chtml30_end_h6_tag(void* pdoc, Node* child)
2612 chtml30 = GET_CHTML30(pdoc);
2616 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</h6>\r\n", NULL);
2618 return chtml30->out;
2623 * It is a handler who processes the TEXTARE tag.
2625 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2626 * destination is specified.
2627 * @param node [i] The TEXTAREA tag node is specified.
2628 * @return The conversion result is returned.
2631 s_chtml30_start_textarea_tag(void* pdoc, Node* node)
2638 chtml30 = GET_CHTML30(pdoc);
2642 chtml30->textarea_flag++;
2643 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<textarea ", NULL);
2645 for (attr = qs_get_attr(doc,node);
2647 attr = qs_get_next_attr(doc,attr)) {
2649 char* name = qs_get_attr_name(doc,attr);
2650 char* value = qs_get_attr_value(doc,attr);
2652 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2653 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",value,"\"", NULL);
2656 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2657 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " rows=\"",value,"\"", NULL);
2660 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2661 chtml30->out = apr_pstrcat(r->pool, chtml30->out, " cols=\"",value,"\"", NULL);
2665 chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
2667 return chtml30->out;
2672 * It is a handler who processes the TEXTAREA tag.
2674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2675 * destination is specified.
2676 * @param node [i] The TEXTAREA tag node is specified.
2677 * @return The conversion result is returned.
2680 s_chtml30_end_textarea_tag(void* pdoc, Node* child)
2686 chtml30 = GET_CHTML30(pdoc);
2690 chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</textarea>\r\n", NULL);
2691 chtml30->textarea_flag--;
2693 return chtml30->out;
2698 s_chtml30_chxjif_tag(void* pdoc, Node* node)
2705 chtml30 = GET_CHTML30(pdoc);
2709 for (child = qs_get_child_node(doc, node);
2711 child = qs_get_next_node(doc, child)) {
2712 chtml30->out = apr_pstrcat(r->pool, chtml30->out, child->otext, NULL);
2713 s_chtml30_chxjif_tag(chtml30, child);
2720 s_chtml30_text_tag(void* pdoc, Node* child)
2733 chtml30 = GET_CHTML30(pdoc);
2737 textval = qs_get_node_value(doc,child);
2738 textval = qs_trim_string(chtml30->doc->r, textval);
2739 if (strlen(textval) == 0)
2740 return chtml30->out;
2742 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2743 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2745 tdst = qs_alloc_zero_byte_string(r);
2746 memset(one_byte, 0, sizeof(one_byte));
2749 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2751 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
2753 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2758 if (is_sjis_kanji(textval[ii])) {
2759 one_byte[0] = textval[ii+0];
2760 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2761 one_byte[0] = textval[ii+1];
2762 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2765 else if (chtml30->pre_flag) {
2766 one_byte[0] = textval[ii+0];
2767 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2769 else if (chtml30->textarea_flag) {
2770 one_byte[0] = textval[ii+0];
2771 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2773 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2774 one_byte[0] = textval[ii+0];
2775 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2778 chtml30->out = apr_pstrcat(r->pool, chtml30->out, tdst, NULL);
2780 return chtml30->out;