2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_chtml10.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_cookie.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
26 #define GET_CHTML10(X) ((chtml10_t*)(X))
27 #define W10_L(X) do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
28 #define W10_V(X) do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X)) \
29 : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
31 static char* s_chtml10_start_html_tag (void* pdoc, Node* node);
32 static char* s_chtml10_end_html_tag (void* pdoc, Node* node);
33 static char* s_chtml10_start_meta_tag (void* pdoc, Node* node);
34 static char* s_chtml10_end_meta_tag (void* pdoc, Node* node);
35 static char* s_chtml10_start_textarea_tag (void* pdoc, Node* node);
36 static char* s_chtml10_end_textarea_tag (void* pdoc, Node* node);
37 static char* s_chtml10_start_p_tag (void* pdoc, Node* node);
38 static char* s_chtml10_end_p_tag (void* pdoc, Node* node);
39 static char* s_chtml10_start_pre_tag (void* pdoc, Node* node);
40 static char* s_chtml10_end_pre_tag (void* pdoc, Node* node);
41 static char* s_chtml10_start_ul_tag (void* pdoc, Node* node);
42 static char* s_chtml10_end_ul_tag (void* pdoc, Node* node);
43 static char* s_chtml10_start_li_tag (void* pdoc, Node* node);
44 static char* s_chtml10_end_li_tag (void* pdoc, Node* node);
45 static char* s_chtml10_start_ol_tag (void* pdoc, Node* node);
46 static char* s_chtml10_end_ol_tag (void* pdoc, Node* node);
47 static char* s_chtml10_start_h1_tag (void* pdoc, Node* node);
48 static char* s_chtml10_end_h1_tag (void* pdoc, Node* node);
49 static char* s_chtml10_start_h2_tag (void* pdoc, Node* node);
50 static char* s_chtml10_end_h2_tag (void* pdoc, Node* node);
51 static char* s_chtml10_start_h3_tag (void* pdoc, Node* node);
52 static char* s_chtml10_end_h3_tag (void* pdoc, Node* node);
53 static char* s_chtml10_start_h4_tag (void* pdoc, Node* node);
54 static char* s_chtml10_end_h4_tag (void* pdoc, Node* node);
55 static char* s_chtml10_start_h5_tag (void* pdoc, Node* node);
56 static char* s_chtml10_end_h5_tag (void* pdoc, Node* node);
57 static char* s_chtml10_start_h6_tag (void* pdoc, Node* node);
58 static char* s_chtml10_end_h6_tag (void* pdoc, Node* node);
59 static char* s_chtml10_start_head_tag (void* pdoc, Node* node);
60 static char* s_chtml10_end_head_tag (void* pdoc, Node* node);
61 static char* s_chtml10_start_title_tag (void* pdoc, Node* node);
62 static char* s_chtml10_end_title_tag (void* pdoc, Node* node);
63 static char* s_chtml10_start_base_tag (void* pdoc, Node* node);
64 static char* s_chtml10_end_base_tag (void* pdoc, Node* node);
65 static char* s_chtml10_start_body_tag (void* pdoc, Node* node);
66 static char* s_chtml10_end_body_tag (void* pdoc, Node* node);
67 static char* s_chtml10_start_a_tag (void* pdoc, Node* node);
68 static char* s_chtml10_end_a_tag (void* pdoc, Node* node);
69 static char* s_chtml10_start_br_tag (void* pdoc, Node* node);
70 static char* s_chtml10_end_br_tag (void* pdoc, Node* node);
71 static char* s_chtml10_start_tr_tag (void* pdoc, Node* node);
72 static char* s_chtml10_end_tr_tag (void* pdoc, Node* node);
73 static char* s_chtml10_start_font_tag (void* pdoc, Node* node);
74 static char* s_chtml10_end_font_tag (void* pdoc, Node* node);
75 static char* s_chtml10_start_input_tag (void* pdoc, Node* node);
76 static char* s_chtml10_end_input_tag (void* pdoc, Node* node);
77 static char* s_chtml10_start_form_tag (void* pdoc, Node* node);
78 static char* s_chtml10_end_form_tag (void* pdoc, Node* node);
79 static char* s_chtml10_start_center_tag (void* pdoc, Node* node);
80 static char* s_chtml10_end_center_tag (void* pdoc, Node* node);
81 static char* s_chtml10_start_hr_tag (void* pdoc, Node* node);
82 static char* s_chtml10_end_hr_tag (void* pdoc, Node* node);
83 static char* s_chtml10_start_img_tag (void* pdoc, Node* node);
84 static char* s_chtml10_end_img_tag (void* pdoc, Node* node);
85 static char* s_chtml10_start_select_tag (void* pdoc, Node* node);
86 static char* s_chtml10_end_select_tag (void* pdoc, Node* node);
87 static char* s_chtml10_start_option_tag (void* pdoc, Node* node);
88 static char* s_chtml10_end_option_tag (void* pdoc, Node* node);
89 static char* s_chtml10_start_div_tag (void* pdoc, Node* node);
90 static char* s_chtml10_end_div_tag (void* pdoc, Node* node);
91 static char* s_chtml10_start_blockquote_tag (void* pdoc, Node* node);
92 static char* s_chtml10_end_blockquote_tag (void* pdoc, Node* node);
93 static char* s_chtml10_start_dir_tag (void* pdoc, Node* node);
94 static char* s_chtml10_end_dir_tag (void* pdoc, Node* node);
95 static char* s_chtml10_start_dl_tag (void* pdoc, Node* node);
96 static char* s_chtml10_end_dl_tag (void* pdoc, Node* node);
97 static char* s_chtml10_start_dt_tag (void* pdoc, Node* node);
98 static char* s_chtml10_end_dt_tag (void* pdoc, Node* node);
99 static char* s_chtml10_start_dd_tag (void* pdoc, Node* node);
100 static char* s_chtml10_end_dd_tag (void* pdoc, Node* node);
102 static void s_init_chtml10(chtml10_t* chtml, Doc* doc, request_rec* r, device_table* spec);
104 static int s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
105 static char* s_chtml10_chxjif_tag (void* pdoc, Node* node);
106 static char* s_chtml10_text (void* pdoc, Node* node);
108 tag_handler chtml10_handler[] = {
111 s_chtml10_start_html_tag,
112 s_chtml10_end_html_tag,
116 s_chtml10_start_meta_tag,
117 s_chtml10_end_meta_tag,
121 s_chtml10_start_textarea_tag,
122 s_chtml10_end_textarea_tag,
126 s_chtml10_start_p_tag,
131 s_chtml10_start_pre_tag,
132 s_chtml10_end_pre_tag,
136 s_chtml10_start_ul_tag,
137 s_chtml10_end_ul_tag,
141 s_chtml10_start_li_tag,
142 s_chtml10_end_li_tag,
146 s_chtml10_start_ol_tag,
147 s_chtml10_end_ol_tag,
151 s_chtml10_start_h1_tag,
152 s_chtml10_end_h1_tag,
156 s_chtml10_start_h2_tag,
157 s_chtml10_end_h2_tag,
161 s_chtml10_start_h3_tag,
162 s_chtml10_end_h3_tag,
166 s_chtml10_start_h4_tag,
167 s_chtml10_end_h4_tag,
171 s_chtml10_start_h5_tag,
172 s_chtml10_end_h5_tag,
176 s_chtml10_start_h6_tag,
177 s_chtml10_end_h6_tag,
181 s_chtml10_start_head_tag,
182 s_chtml10_end_head_tag,
186 s_chtml10_start_title_tag,
187 s_chtml10_end_title_tag,
191 s_chtml10_start_base_tag,
192 s_chtml10_end_base_tag,
196 s_chtml10_start_body_tag,
197 s_chtml10_end_body_tag,
201 s_chtml10_start_a_tag,
206 s_chtml10_start_br_tag,
207 s_chtml10_end_br_tag,
216 s_chtml10_start_tr_tag,
217 s_chtml10_end_tr_tag,
231 s_chtml10_start_font_tag,
232 s_chtml10_end_font_tag,
236 s_chtml10_start_form_tag,
237 s_chtml10_end_form_tag,
241 s_chtml10_start_input_tag,
242 s_chtml10_end_input_tag,
246 s_chtml10_start_center_tag,
247 s_chtml10_end_center_tag,
251 s_chtml10_start_hr_tag,
252 s_chtml10_end_hr_tag,
256 s_chtml10_start_img_tag,
257 s_chtml10_end_img_tag,
261 s_chtml10_start_select_tag,
262 s_chtml10_end_select_tag,
266 s_chtml10_start_option_tag,
267 s_chtml10_end_option_tag,
271 s_chtml10_start_div_tag,
272 s_chtml10_end_div_tag,
276 s_chtml10_chxjif_tag,
321 s_chtml10_start_dt_tag,
322 s_chtml10_end_dt_tag,
336 s_chtml10_start_blockquote_tag,
337 s_chtml10_end_blockquote_tag,
341 s_chtml10_start_dir_tag,
342 s_chtml10_end_dir_tag,
346 s_chtml10_start_dl_tag,
347 s_chtml10_end_dl_tag,
351 s_chtml10_start_dd_tag,
352 s_chtml10_end_dd_tag,
358 * converts from CHTML5.0 to CHTML1.0.
360 * @param r [i] Requet_rec is appointed.
361 * @param spec [i] The result of the device specification processing which
362 * was done in advance is appointed.
363 * @param src [i] The character string before the converting is appointed.
364 * @return The character string after the converting is returned.
367 chxj_exchange_chtml10(
373 chxjconvrule_entry* entryp,
386 DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
388 /*--------------------------------------------------------------------------*/
390 /*--------------------------------------------------------------------------*/
392 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
394 DBG(r,"i found qrcode xml");
397 DBG(r,"not found qrcode xml");
399 /*--------------------------------------------------------------------------*/
400 /* The CHTML structure is initialized. */
401 /*--------------------------------------------------------------------------*/
402 s_init_chtml10(&chtml10, &doc, r, spec);
403 chtml10.entryp = entryp;
404 chtml10.cookie = cookie;
406 chxj_set_content_type(r, "text/html; charset=Windows-31J");
408 /*--------------------------------------------------------------------------*/
409 /* The character string of the input is analyzed. */
410 /*--------------------------------------------------------------------------*/
411 qs_init_malloc(&doc);
412 qs_init_root_node(&doc);
414 ss = apr_pcalloc(r->pool, srclen + 1);
415 memset(ss, 0, srclen + 1);
416 memcpy(ss, src, srclen);
419 chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
422 qs_parse_string(&doc,ss, strlen(ss));
424 chxj_buffered_write_init(r->pool, &doc.buf);
425 /*--------------------------------------------------------------------------*/
426 /* It converts it from CHTML to CHTML. */
427 /*--------------------------------------------------------------------------*/
428 chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
429 chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
430 dst = apr_pstrdup(r->pool, chtml10.out);
431 chxj_buffered_write_terminate(&doc.buf);
433 qs_all_free(&doc,QX_LOGMARK);
436 return apr_pstrdup(r->pool,ss);
439 if (strlen(dst) == 0) {
440 dst = apr_psprintf(r->pool, "\n");
442 *dstlen = strlen(dst);
445 chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
448 DBG(r, "end chxj_exchange_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
455 * The CHTML structure is initialized.
457 * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
458 * initialized is specified.
459 * @param doc [i] The Doc structure that should be set to the initialized
460 * HDML structure is specified.
461 * @param r [i] To use POOL, the pointer to request_rec is specified.
462 * @param spec [i] The pointer to the device_table
471 memset(doc, 0, sizeof(Doc));
472 memset(chtml10, 0, sizeof(chtml10_t));
476 chtml10->spec = spec;
477 chtml10->out = qs_alloc_zero_byte_string(r);
478 chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
479 chtml10->doc->parse_mode = PARSE_MODE_CHTML;
484 * Corresponding EMOJI to a current character-code is retrieved.
485 * The substitution character string is stored in the rslt pointer if agreeing.
487 * @param chtml10 [i] The pointer to the CHTML structure is specified.
488 * @param txt [i] The character string to want to examine whether it is
489 * EMOJI is specified.
490 * @param rslt [o] The pointer to the pointer that stores the result is
492 * @return When corresponding EMOJI exists, it returns it excluding 0.
495 s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
502 spec = chtml10->spec;
508 DBG(r,"spec is NULL");
511 for (ee = chtml10->conf->emoji;
516 DBG(r,"emoji->imode is NULL");
520 if (ee->imode->string
522 && strlen(ee->imode->string) > 0
523 && *ee->imode->string == *txt
524 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
525 if (!spec || !spec->emoji_type) {
526 *rslt = apr_palloc(r->pool, 3);
527 (*rslt)[0] = ee->imode->hex1byte & 0xff;
528 (*rslt)[1] = ee->imode->hex2byte & 0xff;
530 return strlen(ee->imode->string);
541 * It is a handler who processes the HTML tag.
543 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
544 * destination is specified.
545 * @param node [i] The HTML tag node is specified.
546 * @return The conversion result is returned.
549 s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node))
555 chtml10 = GET_CHTML10(pdoc);
559 /*--------------------------------------------------------------------------*/
561 /*--------------------------------------------------------------------------*/
569 * It is a handler who processes the HTML tag.
571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
572 * destination is specified.
573 * @param node [i] The HTML tag node is specified.
574 * @return The conversion result is returned.
577 s_chtml10_end_html_tag(void* pdoc, Node* UNUSED(child))
584 chtml10 = GET_CHTML10(pdoc);
595 * It is a handler who processes the META tag.
597 * @param pdoc [i/o] The pointer to the CHTML structure at the output
598 * destination is specified.
599 * @param node [i] The META tag node is specified.
600 * @return The conversion result is returned.
603 s_chtml10_start_meta_tag(void* pdoc, Node* UNUSED(node))
607 chtml10 = GET_CHTML10(pdoc);
616 * It is a handler who processes the META tag.
618 * @param pdoc [i/o] The pointer to the CHTML structure at the output
619 * destination is specified.
620 * @param node [i] The META tag node is specified.
621 * @return The conversion result is returned.
624 s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child))
628 chtml10 = GET_CHTML10(pdoc);
635 * It is a handler who processes the HEAD tag.
637 * @param pdoc [i/o] The pointer to the CHTML structure at the output
638 * destination is specified.
639 * @param node [i] The HEAD tag node is specified.
640 * @return The conversion result is returned.
643 s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node))
649 chtml10 = GET_CHTML10(pdoc);
660 * It is a handler who processes the HEAD tag.
662 * @param pdoc [i/o] The pointer to the CHTML structure at the output
663 * destination is specified.
664 * @param node [i] The HEAD tag node is specified.
665 * @return The conversion result is returned.
668 s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child))
674 chtml10 = GET_CHTML10(pdoc);
685 * It is a handler who processes the OL tag.
687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
688 * destination is specified.
689 * @param node [i] The OL tag node is specified.
690 * @return The conversion result is returned.
693 s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node))
699 chtml10 = GET_CHTML10(pdoc);
710 * It is a handler who processes the OL tag.
712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
713 * destination is specified.
714 * @param node [i] The OL tag node is specified.
715 * @return The conversion result is returned.
718 s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child))
724 chtml10 = GET_CHTML10(pdoc);
735 * It is a handler who processes the UL tag.
737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
738 * destination is specified.
739 * @param node [i] The UL tag node is specified.
740 * @return The conversion result is returned.
743 s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node))
749 chtml10 = GET_CHTML10(pdoc);
760 * It is a handler who processes the UL tag.
762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
763 * destination is specified.
764 * @param node [i] The UL tag node is specified.
765 * @return The conversion result is returned.
768 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
774 chtml10 = GET_CHTML10(pdoc);
785 * It is a handler who processes the LI tag.
787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
788 * destination is specified.
789 * @param node [i] The LI tag node is specified.
790 * @return The conversion result is returned.
793 s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node))
799 chtml10 = GET_CHTML10(pdoc);
810 * It is a handler who processes the LI tag.
812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
813 * destination is specified.
814 * @param node [i] The LI tag node is specified.
815 * @return The conversion result is returned.
818 s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child))
821 chtml10 = GET_CHTML10(pdoc);
827 * It is a handler who processes the H1 tag.
829 * @param pdoc [i/o] The pointer to the CHTML structure at the output
830 * destination is specified.
831 * @param node [i] The H1 tag node is specified.
832 * @return The conversion result is returned.
835 s_chtml10_start_h1_tag(void* pdoc, Node* node)
842 chtml10 = GET_CHTML10(pdoc);
847 for (attr = qs_get_attr(doc,node);
849 attr = qs_get_next_attr(doc,attr)) {
852 name = qs_get_attr_name(doc,attr);
853 value = qs_get_attr_value(doc,attr);
854 if (STRCASEEQ('a','A',"align", name)) {
855 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
870 * It is a handler who processes the H1 tag.
872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
873 * destination is specified.
874 * @param node [i] The H1 tag node is specified.
875 * @return The conversion result is returned.
878 s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child))
884 chtml10 = GET_CHTML10(pdoc);
895 * It is a handler who processes the H2 tag.
897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
898 * destination is specified.
899 * @param node [i] The H2 tag node is specified.
900 * @return The conversion result is returned.
903 s_chtml10_start_h2_tag(void *pdoc, Node *node)
910 chtml10 = GET_CHTML10(pdoc);
915 for (attr = qs_get_attr(doc,node);
917 attr = qs_get_next_attr(doc,attr)) {
920 name = qs_get_attr_name(doc,attr);
921 value = qs_get_attr_value(doc,attr);
922 if (STRCASEEQ('a','A',"align", name)) {
923 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
938 * It is a handler who processes the H2 tag.
940 * @param pdoc [i/o] The pointer to the CHTML structure at the output
941 * destination is specified.
942 * @param node [i] The H2 tag node is specified.
943 * @return The conversion result is returned.
946 s_chtml10_end_h2_tag(void* pdoc, Node* UNUSED(child))
952 chtml10 = GET_CHTML10(pdoc);
963 * It is a handler who processes the H3 tag.
965 * @param pdoc [i/o] The pointer to the CHTML structure at the output
966 * destination is specified.
967 * @param node [i] The H3 tag node is specified.
968 * @return The conversion result is returned.
971 s_chtml10_start_h3_tag(void *pdoc, Node *node)
978 chtml10 = GET_CHTML10(pdoc);
983 for (attr = qs_get_attr(doc,node);
985 attr = qs_get_next_attr(doc,attr)) {
988 name = qs_get_attr_name(doc,attr);
989 value = qs_get_attr_value(doc,attr);
990 if (STRCASEEQ('a','A',"align", name)) {
991 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1001 return chtml10->out;
1006 * It is a handler who processes the H3 tag.
1008 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1009 * destination is specified.
1010 * @param node [i] The H3 tag node is specified.
1011 * @return The conversion result is returned.
1014 s_chtml10_end_h3_tag(void* pdoc, Node* UNUSED(child))
1020 chtml10 = GET_CHTML10(pdoc);
1026 return chtml10->out;
1031 * It is a handler who processes the H4 tag.
1033 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1034 * destination is specified.
1035 * @param node [i] The H4 tag node is specified.
1036 * @return The conversion result is returned.
1039 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1046 chtml10 = GET_CHTML10(pdoc);
1051 for (attr = qs_get_attr(doc,node);
1053 attr = qs_get_next_attr(doc,attr)) {
1056 name = qs_get_attr_name(doc,attr);
1057 value = qs_get_attr_value(doc,attr);
1058 if (STRCASEEQ('a','A',"align", name)) {
1059 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1069 return chtml10->out;
1074 * It is a handler who processes the H4 tag.
1076 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1077 * destination is specified.
1078 * @param node [i] The H4 tag node is specified.
1079 * @return The conversion result is returned.
1082 s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child))
1088 chtml10 = GET_CHTML10(pdoc);
1094 return chtml10->out;
1099 * It is a handler who processes the H5 tag.
1101 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1102 * destination is specified.
1103 * @param node [i] The H5 tag node is specified.
1104 * @return The conversion result is returned.
1107 s_chtml10_start_h5_tag(void *pdoc, Node *node)
1114 chtml10 = GET_CHTML10(pdoc);
1119 for (attr = qs_get_attr(doc,node);
1121 attr = qs_get_next_attr(doc,attr)) {
1124 name = qs_get_attr_name(doc,attr);
1125 value = qs_get_attr_value(doc,attr);
1126 if (STRCASEEQ('a','A',"align", name)) {
1127 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1137 return chtml10->out;
1142 * It is a handler who processes the H5 tag.
1144 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1145 * destination is specified.
1146 * @param node [i] The H5 tag node is specified.
1147 * @return The conversion result is returned.
1150 s_chtml10_end_h5_tag(void* pdoc, Node* UNUSED(child))
1156 chtml10 = GET_CHTML10(pdoc);
1162 return chtml10->out;
1167 * It is a handler who processes the H6 tag.
1169 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1170 * destination is specified.
1171 * @param node [i] The H6 tag node is specified.
1172 * @return The conversion result is returned.
1175 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1182 chtml10 = GET_CHTML10(pdoc);
1187 for (attr = qs_get_attr(doc,node);
1189 attr = qs_get_next_attr(doc,attr)) {
1192 name = qs_get_attr_name(doc,attr);
1193 value = qs_get_attr_value(doc,attr);
1194 if (STRCASEEQ('a','A',"align", name)) {
1195 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1205 return chtml10->out;
1210 * It is a handler who processes the H6 tag.
1212 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1213 * destination is specified.
1214 * @param node [i] The H6 tag node is specified.
1215 * @return The conversion result is returned.
1218 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
1224 chtml10 = GET_CHTML10(pdoc);
1230 return chtml10->out;
1235 * It is a handler who processes the TITLE tag.
1237 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1238 * destination is specified.
1239 * @param node [i] The TITLE tag node is specified.
1240 * @return The conversion result is returned.
1243 s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node))
1249 chtml10 = GET_CHTML10(pdoc);
1255 return chtml10->out;
1260 * It is a handler who processes the TITLE tag.
1262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1263 * destination is specified.
1264 * @param node [i] The TITLE tag node is specified.
1265 * @return The conversion result is returned.
1268 s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child))
1274 chtml10 = GET_CHTML10(pdoc);
1280 return chtml10->out;
1285 * It is a handler who processes the BASE tag.
1287 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The BASE tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml10_start_base_tag(void* pdoc, Node* node)
1300 chtml10 = GET_CHTML10(pdoc);
1306 /*--------------------------------------------------------------------------*/
1307 /* Get Attributes */
1308 /*--------------------------------------------------------------------------*/
1309 for (attr = qs_get_attr(doc,node);
1311 attr = qs_get_next_attr(doc,attr)) {
1315 name = qs_get_attr_name(doc,attr);
1316 value = qs_get_attr_value(doc,attr);
1318 if (STRCASEEQ('h','H',"href", name)) {
1327 return chtml10->out;
1332 * It is a handler who processes the BASE tag.
1334 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1335 * destination is specified.
1336 * @param node [i] The BASE tag node is specified.
1337 * @return The conversion result is returned.
1340 s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child))
1342 chtml10_t* chtml10 = GET_CHTML10(pdoc);
1344 return chtml10->out;
1349 * It is a handler who processes the BODY tag.
1351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1352 * destination is specified.
1353 * @param node [i] The BODY tag node is specified.
1354 * @return The conversion result is returned.
1357 s_chtml10_start_body_tag(void* pdoc, Node* node)
1364 chtml10 = GET_CHTML10(pdoc);
1371 /*--------------------------------------------------------------------------*/
1372 /* Get Attributes */
1373 /*--------------------------------------------------------------------------*/
1374 for (attr = qs_get_attr(doc,node);
1376 attr = qs_get_next_attr(doc,attr)) {
1380 name = qs_get_attr_name(doc,attr);
1385 if (strcasecmp(name, "alink") == 0) {
1386 /*----------------------------------------------------------------------*/
1388 /*----------------------------------------------------------------------*/
1395 if (strcasecmp(name, "bgcolor") == 0) {
1396 /*----------------------------------------------------------------------*/
1398 /*----------------------------------------------------------------------*/
1405 if (strcasecmp(name, "text") == 0) {
1406 /*----------------------------------------------------------------------*/
1408 /*----------------------------------------------------------------------*/
1415 if (strcasecmp(name, "link") == 0) {
1416 /*----------------------------------------------------------------------*/
1418 /*----------------------------------------------------------------------*/
1425 if (strcasecmp(name, "vlink") == 0) {
1426 /*----------------------------------------------------------------------*/
1428 /*----------------------------------------------------------------------*/
1440 return chtml10->out;
1445 * It is a handler who processes the BODY tag.
1447 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1448 * destination is specified.
1449 * @param node [i] The BODY tag node is specified.
1450 * @return The conversion result is returned.
1453 s_chtml10_end_body_tag(void* pdoc, Node* UNUSED(child))
1459 chtml10 = GET_CHTML10(pdoc);
1465 return chtml10->out;
1470 * It is a handler who processes the A tag.
1472 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1473 * destination is specified.
1474 * @param node [i] The A tag node is specified.
1475 * @return The conversion result is returned.
1478 s_chtml10_start_a_tag(void *pdoc, Node *node)
1485 chtml10 = GET_CHTML10(pdoc);
1491 /*--------------------------------------------------------------------------*/
1492 /* Get Attributes */
1493 /*--------------------------------------------------------------------------*/
1494 for (attr = qs_get_attr(doc,node);
1496 attr = qs_get_next_attr(doc,attr)) {
1501 name = qs_get_attr_name(doc,attr);
1502 value = qs_get_attr_value(doc,attr);
1507 if (strcasecmp(name, "name") == 0) {
1508 /*--------------------------------------------------------------------*/
1510 /*--------------------------------------------------------------------*/
1519 if (strcasecmp(name, "href") == 0) {
1520 /*--------------------------------------------------------------------*/
1522 /*--------------------------------------------------------------------*/
1523 value = chxj_encoding_parameter(r, value);
1524 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1533 if (strcasecmp(name, "accesskey") == 0) {
1534 /*--------------------------------------------------------------------*/
1536 /*--------------------------------------------------------------------*/
1537 W10_L(" accesskey=\"");
1545 if (strcasecmp(name, "cti") == 0) {
1546 /*--------------------------------------------------------------------*/
1548 /*--------------------------------------------------------------------*/
1555 if (strcasecmp(name, "utn") == 0) {
1556 /*--------------------------------------------------------------------*/
1558 /*--------------------------------------------------------------------*/
1565 if (strcasecmp(name, "telbook") == 0) {
1566 /*--------------------------------------------------------------------*/
1568 /*--------------------------------------------------------------------*/
1575 if (strcasecmp(name, "kana") == 0) {
1576 /*--------------------------------------------------------------------*/
1578 /*--------------------------------------------------------------------*/
1585 if (strcasecmp(name, "email") == 0) {
1586 /*--------------------------------------------------------------------*/
1588 /*--------------------------------------------------------------------*/
1595 if (strcasecmp(name, "ista") == 0) {
1596 /*--------------------------------------------------------------------*/
1598 /*--------------------------------------------------------------------*/
1602 if (strcasecmp(name, "ilet") == 0) {
1603 /*--------------------------------------------------------------------*/
1605 /*--------------------------------------------------------------------*/
1609 if (strcasecmp(name, "iswf") == 0) {
1610 /*--------------------------------------------------------------------*/
1612 /*--------------------------------------------------------------------*/
1616 if (strcasecmp(name, "irst") == 0) {
1617 /*--------------------------------------------------------------------*/
1619 /*--------------------------------------------------------------------*/
1623 if (strcasecmp(name, "ijam") == 0) {
1624 /*--------------------------------------------------------------------*/
1626 /*--------------------------------------------------------------------*/
1637 return chtml10->out;
1642 * It is a handler who processes the A tag.
1644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1645 * destination is specified.
1646 * @param node [i] The A tag node is specified.
1647 * @return The conversion result is returned.
1650 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1656 chtml10 = GET_CHTML10(pdoc);
1661 return chtml10->out;
1666 * It is a handler who processes the BR tag.
1668 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1669 * destination is specified.
1670 * @param node [i] The BR tag node is specified.
1671 * @return The conversion result is returned.
1674 s_chtml10_start_br_tag(void *pdoc, Node *node)
1681 chtml10 = GET_CHTML10(pdoc);
1687 /*--------------------------------------------------------------------------*/
1688 /* Get Attributes */
1689 /*--------------------------------------------------------------------------*/
1690 for (attr = qs_get_attr(doc,node);
1692 attr = qs_get_next_attr(doc,attr)) {
1696 name = qs_get_attr_name(doc,attr);
1697 value = qs_get_attr_value(doc,attr);
1699 if (STRCASEEQ('c','C',"clear",name)) {
1700 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1708 return chtml10->out;
1713 * It is a handler who processes the BR tag.
1715 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1716 * destination is specified.
1717 * @param node [i] The BR tag node is specified.
1718 * @return The conversion result is returned.
1721 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1723 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1725 return chtml10->out;
1730 * It is a handler who processes the TR tag.
1732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1733 * destination is specified.
1734 * @param node [i] The TR tag node is specified.
1735 * @return The conversion result is returned.
1738 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node))
1740 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1742 return chtml10->out;
1747 * It is a handler who processes the TR tag.
1749 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1750 * destination is specified.
1751 * @param node [i] The TR tag node is specified.
1752 * @return The conversion result is returned.
1755 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1761 chtml10 = GET_CHTML10(pdoc);
1767 return chtml10->out;
1772 * It is a handler who processes the FONT tag.
1774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1775 * destination is specified.
1776 * @param node [i] The FONT tag node is specified.
1777 * @return The conversion result is returned.
1780 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node))
1782 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1786 return chtml10->out;
1791 * It is a handler who processes the FONT tag.
1793 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1794 * destination is specified.
1795 * @param node [i] The FONT tag node is specified.
1796 * @return The conversion result is returned.
1799 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child))
1801 chtml10_t *chtml10 = GET_CHTML10(pdoc);
1805 return chtml10->out;
1810 * It is a handler who processes the FORM tag.
1812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1813 * destination is specified.
1814 * @param node [i] The FORM tag node is specified.
1815 * @return The conversion result is returned.
1818 s_chtml10_start_form_tag(void *pdoc, Node *node)
1825 chtml10 = GET_CHTML10(pdoc);
1831 /*--------------------------------------------------------------------------*/
1832 /* Get Attributes */
1833 /*--------------------------------------------------------------------------*/
1834 for (attr = qs_get_attr(doc,node);
1836 attr = qs_get_next_attr(doc,attr)) {
1840 name = qs_get_attr_name(doc,attr);
1841 value = qs_get_attr_value(doc,attr);
1846 if (strcasecmp(name, "action") == 0) {
1847 /*--------------------------------------------------------------------*/
1849 /*--------------------------------------------------------------------*/
1850 value = chxj_encoding_parameter(r, value);
1851 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1853 W10_L(" action=\"");
1861 if (strcasecmp(name, "method") == 0) {
1862 /*--------------------------------------------------------------------*/
1864 /*--------------------------------------------------------------------*/
1865 W10_L(" method=\"");
1873 if (strcasecmp(name, "utn") == 0) {
1874 /*--------------------------------------------------------------------*/
1876 /*--------------------------------------------------------------------*/
1888 return chtml10->out;
1893 * It is a handler who processes the FORM tag.
1895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1896 * destination is specified.
1897 * @param node [i] The FORM tag node is specified.
1898 * @return The conversion result is returned.
1901 s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child))
1907 chtml10 = GET_CHTML10(pdoc);
1913 return chtml10->out;
1918 * It is a handler who processes the INPUT tag.
1920 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1921 * destination is specified.
1922 * @param node [i] The INPUT tag node is specified.
1923 * @return The conversion result is returned.
1926 s_chtml10_start_input_tag(void* pdoc, Node* node)
1940 chtml10 = GET_CHTML10(pdoc);
1955 /*--------------------------------------------------------------------------*/
1956 /* Get Attributes */
1957 /*--------------------------------------------------------------------------*/
1959 type = qs_get_type_attr(doc, node, r);
1960 name = qs_get_name_attr(doc, node, r);
1961 value = qs_get_value_attr(doc,node,r);
1962 istyle = qs_get_istyle_attr(doc,node,r);
1963 max_length = qs_get_maxlength_attr(doc,node,r);
1964 checked = qs_get_checked_attr(doc,node,r);
1965 accesskey = qs_get_accesskey_attr(doc, node, r);
1966 size = qs_get_size_attr(doc, node, r);
1969 type = qs_trim_string(doc->buf.pool, type);
1970 if (type && (STRCASEEQ('t','T',"text", type) ||
1971 STRCASEEQ('p','P',"password",type) ||
1972 STRCASEEQ('c','C',"checkbox",type) ||
1973 STRCASEEQ('r','R',"radio", type) ||
1974 STRCASEEQ('h','H',"hidden", type) ||
1975 STRCASEEQ('s','S',"submit", type) ||
1976 STRCASEEQ('r','R',"reset", type))) {
1989 if (name && *name != 0) {
1995 if (value && *value != 0) {
2002 W10_L(" accesskey=\"");
2008 /*------------------------------------------------------------------------*/
2010 /*------------------------------------------------------------------------*/
2013 /*--------------------------------------------------------------------------*/
2014 /* The figure is default for the password. */
2015 /*--------------------------------------------------------------------------*/
2017 W10_L(" maxlength=\"");
2027 return chtml10->out;
2032 * It is a handler who processes the INPUT tag.
2034 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2035 * destination is specified.
2036 * @param node [i] The INPUT tag node is specified.
2037 * @return The conversion result is returned.
2040 s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child))
2042 chtml10_t* chtml10 = GET_CHTML10(pdoc);
2044 return chtml10->out;
2049 * It is a handler who processes the CENTER tag.
2051 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2052 * destination is specified.
2053 * @param node [i] The CENTER tag node is specified.
2054 * @return The conversion result is returned.
2057 s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node))
2063 chtml10 = GET_CHTML10(pdoc);
2069 return chtml10->out;
2074 * It is a handler who processes the CENTER tag.
2076 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2077 * destination is specified.
2078 * @param node [i] The CENTER tag node is specified.
2079 * @return The conversion result is returned.
2082 s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child))
2088 chtml10 = GET_CHTML10(pdoc);
2094 return chtml10->out;
2099 * It is a handler who processes the HR tag.
2101 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2102 * destination is specified.
2103 * @param node [i] The HR tag node is specified.
2104 * @return The conversion result is returned.
2107 s_chtml10_start_hr_tag(void* pdoc, Node* node)
2114 chtml10 = GET_CHTML10(pdoc);
2120 for (attr = qs_get_attr(doc,node);
2122 attr = qs_get_next_attr(doc,attr)) {
2127 name = qs_get_attr_name (doc,attr);
2128 value = qs_get_attr_value(doc,attr);
2133 if (strcasecmp(name, "align") == 0) {
2134 /*--------------------------------------------------------------------*/
2136 /*--------------------------------------------------------------------*/
2137 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2147 if (strcasecmp(name, "size") == 0) {
2148 /*--------------------------------------------------------------------*/
2150 /*--------------------------------------------------------------------*/
2151 if (value && value[0] != '\0') {
2161 if (strcasecmp(name, "width") == 0) {
2162 /*--------------------------------------------------------------------*/
2164 /*--------------------------------------------------------------------*/
2165 if (value && value[0] != '\0') {
2175 if (strcasecmp(name, "noshade") == 0) {
2176 /*--------------------------------------------------------------------*/
2178 /*--------------------------------------------------------------------*/
2185 if (strcasecmp(name, "color") == 0) {
2186 /*--------------------------------------------------------------------*/
2188 /*--------------------------------------------------------------------*/
2198 return chtml10->out;
2203 * It is a handler who processes the HR tag.
2205 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2206 * destination is specified.
2207 * @param node [i] The HR tag node is specified.
2208 * @return The conversion result is returned.
2211 s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child))
2215 chtml10 = GET_CHTML10(pdoc);
2217 return chtml10->out;
2222 * It is a handler who processes the IMG tag.
2224 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2225 * destination is specified.
2226 * @param node [i] The IMG tag node is specified.
2227 * @return The conversion result is returned.
2230 s_chtml10_start_img_tag(void* pdoc, Node* node)
2236 #ifndef IMG_NOT_CONVERT_FILENAME
2240 chtml10 = GET_CHTML10(pdoc);
2241 #ifndef IMG_NOT_CONVERT_FILENAME
2242 spec = chtml10->spec;
2248 /*--------------------------------------------------------------------------*/
2249 /* Get Attributes */
2250 /*--------------------------------------------------------------------------*/
2251 for (attr = qs_get_attr(doc,node);
2253 attr = qs_get_next_attr(doc,attr)) {
2258 name = qs_get_attr_name (doc,attr);
2259 value = qs_get_attr_value(doc,attr);
2264 if (strcasecmp(name, "src") == 0) {
2265 /*--------------------------------------------------------------------*/
2267 /*--------------------------------------------------------------------*/
2268 #ifdef IMG_NOT_CONVERT_FILENAME
2269 value = chxj_encoding_parameter(r, value);
2270 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2272 value = apr_psprintf(doc->buf.pool,
2275 (strchr(value, '?')) ? '&' : '?',
2276 CHXJ_COOKIE_NOUPDATE_PARAM);
2282 value = chxj_img_conv(r, spec, value);
2283 value = chxj_encoding_parameter(r, value);
2284 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2286 value = apr_psprintf(doc->buf.pool,
2289 (strchr(value, '?')) ? '&' : '?',
2290 CHXJ_COOKIE_NOUPDATE_PARAM);
2301 if (strcasecmp(name, "align" ) == 0) {
2302 /*--------------------------------------------------------------------*/
2304 /*--------------------------------------------------------------------*/
2305 /*--------------------------------------------------------------------*/
2307 /*--------------------------------------------------------------------*/
2308 if (value && (STRCASEEQ('t','T',"top", value) ||
2309 STRCASEEQ('m','M',"middle",value) ||
2310 STRCASEEQ('b','B',"bottom",value) ||
2311 STRCASEEQ('l','L',"left", value) ||
2312 STRCASEEQ('r','R',"right", value))) {
2318 else if (strcasecmp(name, "alt" ) == 0) {
2319 /*--------------------------------------------------------------------*/
2321 /*--------------------------------------------------------------------*/
2322 if (value && value[0] != '\0') {
2332 if (strcasecmp(name, "width" ) == 0) {
2333 /*--------------------------------------------------------------------*/
2335 /*--------------------------------------------------------------------*/
2336 if (value && value[0] != '\0') {
2346 if (strcasecmp(name, "height") == 0) {
2347 /*--------------------------------------------------------------------*/
2349 /*--------------------------------------------------------------------*/
2350 if (value && value[0] != '\0') {
2351 W10_L(" height=\"");
2357 if (strcasecmp(name, "hspace") == 0) {
2358 /*--------------------------------------------------------------------*/
2360 /*--------------------------------------------------------------------*/
2361 if (value && value[0] != '\0') {
2362 W10_L(" hspace=\"");
2371 if (strcasecmp(name, "vspace") == 0) {
2372 /*--------------------------------------------------------------------*/
2374 /*--------------------------------------------------------------------*/
2375 if (value && value[0] != '\0') {
2376 W10_L(" vspace=\"");
2389 return chtml10->out;
2394 * It is a handler who processes the IMG tag.
2396 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2397 * destination is specified.
2398 * @param node [i] The IMG tag node is specified.
2399 * @return The conversion result is returned.
2402 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2406 chtml10 = GET_CHTML10(pdoc);
2408 return chtml10->out;
2413 * It is a handler who processes the SELECT tag.
2415 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2416 * destination is specified.
2417 * @param node [i] The SELECT tag node is specified.
2418 * @return The conversion result is returned.
2421 s_chtml10_start_select_tag(void *pdoc, Node *child)
2431 chtml10 = GET_CHTML10(pdoc);
2439 for (attr = qs_get_attr(doc,child);
2441 attr = qs_get_next_attr(doc,attr)) {
2445 nm = qs_get_attr_name (doc,attr);
2446 val = qs_get_attr_value(doc,attr);
2451 if (strcasecmp(nm, "size") == 0) {
2452 /*--------------------------------------------------------------------*/
2453 /* CHTML 1.0 version 2.0 */
2454 /*--------------------------------------------------------------------*/
2455 size = apr_pstrdup(doc->buf.pool, val);
2461 if (strcasecmp(nm, "name") == 0) {
2462 /*--------------------------------------------------------------------*/
2463 /* CHTML 1.0 version 2.0 */
2464 /*--------------------------------------------------------------------*/
2465 name = apr_pstrdup(doc->buf.pool, val);
2471 if (strcasecmp(nm, "multiple") == 0) {
2472 /*--------------------------------------------------------------------*/
2473 /* CHTML 1.0 version 2.0 */
2474 /*--------------------------------------------------------------------*/
2497 return chtml10->out;
2502 * It is a handler who processes the SELECT tag.
2504 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2505 * destination is specified.
2506 * @param node [i] The SELECT tag node is specified.
2507 * @return The conversion result is returned.
2510 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2516 chtml10 = GET_CHTML10(pdoc);
2520 W10_L("</select>\r\n");
2521 return chtml10->out;
2526 * It is a handler who processes the OPTION tag.
2528 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2529 * destination is specified.
2530 * @param node [i] The OPTION tag node is specified.
2531 * @return The conversion result is returned.
2534 s_chtml10_start_option_tag(void *pdoc, Node *child)
2544 chtml10 = GET_CHTML10(pdoc);
2553 for (attr = qs_get_attr(doc,child);
2555 attr = qs_get_next_attr(doc,attr)) {
2559 nm = qs_get_attr_name (doc,attr);
2560 val = qs_get_attr_value(doc,attr);
2565 if (strcasecmp(nm, "selected") == 0) {
2566 /*--------------------------------------------------------------------*/
2567 /* CHTML 1.0 version 2.0 */
2568 /*--------------------------------------------------------------------*/
2569 selected = apr_pstrdup(doc->buf.pool, val);
2575 if (strcasecmp(nm, "value") == 0) {
2576 /*--------------------------------------------------------------------*/
2577 /* CHTML 1.0 version 2.0 */
2578 /*--------------------------------------------------------------------*/
2579 value = apr_pstrdup(doc->buf.pool, val);
2594 W10_L(" value=\"\"");
2598 W10_L(" selected ");
2602 return chtml10->out;
2607 * It is a handler who processes the OPTION tag.
2609 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2610 * destination is specified.
2611 * @param node [i] The OPTION tag node is specified.
2612 * @return The conversion result is returned.
2615 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2619 chtml10 = GET_CHTML10(pdoc);
2623 return chtml10->out;
2628 * It is a handler who processes the DIV tag.
2630 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2631 * destination is specified.
2632 * @param node [i] The DIV tag node is specified.
2633 * @return The conversion result is returned.
2636 s_chtml10_start_div_tag(void *pdoc, Node *child)
2645 chtml10 = GET_CHTML10(pdoc);
2653 for (attr = qs_get_attr(doc,child);
2655 attr = qs_get_next_attr(doc,attr)) {
2660 nm = qs_get_attr_name(doc,attr);
2661 val = qs_get_attr_value(doc,attr);
2663 if (STRCASEEQ('a','A',"align", nm)) {
2664 /*----------------------------------------------------------------------*/
2665 /* CHTML 1.0 (W3C version 3.2) */
2666 /*----------------------------------------------------------------------*/
2667 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2668 align = apr_pstrdup(doc->buf.pool, val);
2680 return chtml10->out;
2685 * It is a handler who processes the DIV tag.
2687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2688 * destination is specified.
2689 * @param node [i] The DIV tag node is specified.
2690 * @return The conversion result is returned.
2693 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2699 chtml10 = GET_CHTML10(pdoc);
2704 return chtml10->out;
2709 * It is a handler who processes the CHXJ:IF tag.
2711 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2712 * destination is specified.
2713 * @param node [i] The CHXJ:IF tag node is specified.
2714 * @return The conversion result is returned.
2717 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2724 chtml10 = GET_CHTML10(pdoc);
2728 for (child = qs_get_child_node(doc, node);
2730 child = qs_get_next_node(doc, child)) {
2731 W10_V(child->otext);
2732 s_chtml10_chxjif_tag(chtml10, child);
2735 return chtml10->out;
2740 * It is a handler who processes the PRE tag.
2742 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2743 * destination is specified.
2744 * @param node [i] The PRE tag node is specified.
2745 * @return The conversion result is returned.
2748 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2754 chtml10 = GET_CHTML10(pdoc);
2758 chtml10->pre_flag++;
2760 return chtml10->out;
2765 * It is a handler who processes the PRE tag.
2767 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2768 * destination is specified.
2769 * @param node [i] The PRE tag node is specified.
2770 * @return The conversion result is returned.
2773 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2779 chtml10 = GET_CHTML10(pdoc);
2784 chtml10->pre_flag--;
2786 return chtml10->out;
2791 * It is a handler who processes the P tag.
2793 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2794 * destination is specified.
2795 * @param node [i] The P tag node is specified.
2796 * @return The conversion result is returned.
2799 s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
2805 chtml10 = GET_CHTML10(pdoc);
2810 return chtml10->out;
2815 * It is a handler who processes the P tag.
2817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2818 * destination is specified.
2819 * @param node [i] The P tag node is specified.
2820 * @return The conversion result is returned.
2823 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2829 chtml10 = GET_CHTML10(pdoc);
2834 return chtml10->out;
2839 * It is a handler who processes the TEXTARE tag.
2841 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2842 * destination is specified.
2843 * @param node [i] The TEXTAREA tag node is specified.
2844 * @return The conversion result is returned.
2847 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2854 chtml10 = GET_CHTML10(pdoc);
2859 chtml10->textarea_flag++;
2861 W10_L("<textarea ");
2863 for (attr = qs_get_attr(doc,node);
2865 attr = qs_get_next_attr(doc,attr)) {
2870 name = qs_get_attr_name (doc,attr);
2871 value = qs_get_attr_value(doc,attr);
2876 if (strcasecmp(name, "name") == 0) {
2885 if (strcasecmp(name, "rows") == 0) {
2894 if (strcasecmp(name, "cols") == 0) {
2907 return chtml10->out;
2912 * It is a handler who processes the TEXTAREA tag.
2914 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2915 * destination is specified.
2916 * @param node [i] The TEXTAREA tag node is specified.
2917 * @return The conversion result is returned.
2920 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2926 chtml10 = GET_CHTML10(pdoc);
2930 W10_L("</textarea>\r\n");
2931 chtml10->textarea_flag--;
2933 return chtml10->out;
2938 s_chtml10_text(void *pdoc, Node *child)
2950 chtml10 = GET_CHTML10(pdoc);
2954 textval = qs_get_node_value(doc,child);
2955 textval = qs_trim_string(doc->buf.pool, textval);
2957 if (strlen(textval) == 0)
2958 return chtml10->out;
2960 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2961 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2963 tdst = qs_alloc_zero_byte_string(r);
2964 memset(one_byte, 0, sizeof(one_byte));
2967 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2971 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2973 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2978 if (is_sjis_kanji(textval[ii])) {
2979 one_byte[0] = textval[ii+0];
2980 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2981 one_byte[0] = textval[ii+1];
2982 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2986 if (chtml10->pre_flag) {
2987 one_byte[0] = textval[ii+0];
2988 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2991 if (chtml10->textarea_flag) {
2992 one_byte[0] = textval[ii+0];
2993 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2996 if (textval[ii] != '\r' && textval[ii] != '\n') {
2997 one_byte[0] = textval[ii+0];
2998 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3003 return chtml10->out;
3008 * It is a handler who processes the BLOCKQUOTE tag.
3010 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3011 * destination is specified.
3012 * @param node [i] The BLOCKQUOTE tag node is specified.
3013 * @return The conversion result is returned.
3016 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3020 chtml10 = GET_CHTML10(pdoc);
3022 W10_L("<blockquote>");
3023 return chtml10->out;
3028 * It is a handler who processes the BLOCKQUOTE tag.
3030 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3031 * destination is specified.
3032 * @param node [i] The BLOCKQUOTE tag node is specified.
3033 * @return The conversion result is returned.
3036 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3041 chtml10 = GET_CHTML10(pdoc);
3043 W10_L("</blockquote>");
3044 return chtml10->out;
3049 * It is a handler who processes the DIR tag.
3051 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3052 * destination is specified.
3053 * @param node [i] The DIR tag node is specified.
3054 * @return The conversion result is returned.
3057 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3061 chtml10 = GET_CHTML10(pdoc);
3064 return chtml10->out;
3069 * It is a handler who processes the DIR tag.
3071 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3072 * destination is specified.
3073 * @param node [i] The DIR tag node is specified.
3074 * @return The conversion result is returned.
3077 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3082 chtml10 = GET_CHTML10(pdoc);
3085 return chtml10->out;
3090 * It is a handler who processes the DL tag.
3092 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3093 * destination is specified.
3094 * @param node [i] The DL tag node is specified.
3095 * @return The conversion result is returned.
3098 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3102 chtml10 = GET_CHTML10(pdoc);
3105 return chtml10->out;
3110 * It is a handler who processes the DL tag.
3112 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3113 * destination is specified.
3114 * @param node [i] The DL tag node is specified.
3115 * @return The conversion result is returned.
3118 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3122 chtml10 = GET_CHTML10(pdoc);
3125 return chtml10->out;
3130 * It is a handter who processes the DT tag.
3132 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3133 * destination is specified.
3134 * @param node [i] The DT tag node is specified.
3135 * @return The conversion result is returned.
3138 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3142 chtml10 = GET_CHTML10(pdoc);
3145 return chtml10->out;
3150 * It is a handter who processes the DT tag.
3152 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3153 * destination is specified.
3154 * @param node [i] The DT tag node is specified.
3155 * @return The conversion result is returned.
3158 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3161 chtml10 = GET_CHTML10(pdoc);
3162 return chtml10->out;
3167 * It is a handder who processes the DD tag.
3169 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3170 * destination is specified.
3171 * @param node [i] The DD tag node is specified.
3172 * @return The conversion result is returned.
3175 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3179 chtml10 = GET_CHTML10(pdoc);
3182 return chtml10->out;
3187 * It is a handder who processes the DD tag.
3189 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3190 * destination is specified.
3191 * @param node [i] The DD tag node is specified.
3192 * @return The conversion result is returned.
3195 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3198 chtml10 = GET_CHTML10(pdoc);
3199 return chtml10->out;