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);
1993 W10_L(" accesskey=\"");
1999 /*------------------------------------------------------------------------*/
2001 /*------------------------------------------------------------------------*/
2004 /*--------------------------------------------------------------------------*/
2005 /* The figure is default for the password. */
2006 /*--------------------------------------------------------------------------*/
2008 W10_L(" maxlength=\"");
2018 return chtml10->out;
2023 * It is a handler who processes the INPUT tag.
2025 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2026 * destination is specified.
2027 * @param node [i] The INPUT tag node is specified.
2028 * @return The conversion result is returned.
2031 s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child))
2033 chtml10_t* chtml10 = GET_CHTML10(pdoc);
2035 return chtml10->out;
2040 * It is a handler who processes the CENTER tag.
2042 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2043 * destination is specified.
2044 * @param node [i] The CENTER tag node is specified.
2045 * @return The conversion result is returned.
2048 s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node))
2054 chtml10 = GET_CHTML10(pdoc);
2060 return chtml10->out;
2065 * It is a handler who processes the CENTER tag.
2067 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2068 * destination is specified.
2069 * @param node [i] The CENTER tag node is specified.
2070 * @return The conversion result is returned.
2073 s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child))
2079 chtml10 = GET_CHTML10(pdoc);
2085 return chtml10->out;
2090 * It is a handler who processes the HR tag.
2092 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2093 * destination is specified.
2094 * @param node [i] The HR tag node is specified.
2095 * @return The conversion result is returned.
2098 s_chtml10_start_hr_tag(void* pdoc, Node* node)
2105 chtml10 = GET_CHTML10(pdoc);
2111 for (attr = qs_get_attr(doc,node);
2113 attr = qs_get_next_attr(doc,attr)) {
2118 name = qs_get_attr_name (doc,attr);
2119 value = qs_get_attr_value(doc,attr);
2124 if (strcasecmp(name, "align") == 0) {
2125 /*--------------------------------------------------------------------*/
2127 /*--------------------------------------------------------------------*/
2128 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2138 if (strcasecmp(name, "size") == 0) {
2139 /*--------------------------------------------------------------------*/
2141 /*--------------------------------------------------------------------*/
2142 if (value && value[0] != '\0') {
2152 if (strcasecmp(name, "width") == 0) {
2153 /*--------------------------------------------------------------------*/
2155 /*--------------------------------------------------------------------*/
2156 if (value && value[0] != '\0') {
2166 if (strcasecmp(name, "noshade") == 0) {
2167 /*--------------------------------------------------------------------*/
2169 /*--------------------------------------------------------------------*/
2176 if (strcasecmp(name, "color") == 0) {
2177 /*--------------------------------------------------------------------*/
2179 /*--------------------------------------------------------------------*/
2189 return chtml10->out;
2194 * It is a handler who processes the HR tag.
2196 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2197 * destination is specified.
2198 * @param node [i] The HR tag node is specified.
2199 * @return The conversion result is returned.
2202 s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child))
2206 chtml10 = GET_CHTML10(pdoc);
2208 return chtml10->out;
2213 * It is a handler who processes the IMG tag.
2215 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2216 * destination is specified.
2217 * @param node [i] The IMG tag node is specified.
2218 * @return The conversion result is returned.
2221 s_chtml10_start_img_tag(void* pdoc, Node* node)
2227 #ifndef IMG_NOT_CONVERT_FILENAME
2231 chtml10 = GET_CHTML10(pdoc);
2232 #ifndef IMG_NOT_CONVERT_FILENAME
2233 spec = chtml10->spec;
2239 /*--------------------------------------------------------------------------*/
2240 /* Get Attributes */
2241 /*--------------------------------------------------------------------------*/
2242 for (attr = qs_get_attr(doc,node);
2244 attr = qs_get_next_attr(doc,attr)) {
2249 name = qs_get_attr_name (doc,attr);
2250 value = qs_get_attr_value(doc,attr);
2255 if (strcasecmp(name, "src") == 0) {
2256 /*--------------------------------------------------------------------*/
2258 /*--------------------------------------------------------------------*/
2259 #ifdef IMG_NOT_CONVERT_FILENAME
2260 value = chxj_encoding_parameter(r, value);
2261 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2263 value = apr_psprintf(doc->buf.pool,
2266 (strchr(value, '?')) ? '&' : '?',
2267 CHXJ_COOKIE_NOUPDATE_PARAM);
2273 value = chxj_img_conv(r, spec, value);
2274 value = chxj_encoding_parameter(r, value);
2275 value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2277 value = apr_psprintf(doc->buf.pool,
2280 (strchr(value, '?')) ? '&' : '?',
2281 CHXJ_COOKIE_NOUPDATE_PARAM);
2292 if (strcasecmp(name, "align" ) == 0) {
2293 /*--------------------------------------------------------------------*/
2295 /*--------------------------------------------------------------------*/
2296 /*--------------------------------------------------------------------*/
2298 /*--------------------------------------------------------------------*/
2299 if (value && (STRCASEEQ('t','T',"top", value) ||
2300 STRCASEEQ('m','M',"middle",value) ||
2301 STRCASEEQ('b','B',"bottom",value) ||
2302 STRCASEEQ('l','L',"left", value) ||
2303 STRCASEEQ('r','R',"right", value))) {
2309 else if (strcasecmp(name, "alt" ) == 0) {
2310 /*--------------------------------------------------------------------*/
2312 /*--------------------------------------------------------------------*/
2321 if (strcasecmp(name, "width" ) == 0) {
2322 /*--------------------------------------------------------------------*/
2324 /*--------------------------------------------------------------------*/
2333 if (strcasecmp(name, "height") == 0) {
2334 /*--------------------------------------------------------------------*/
2336 /*--------------------------------------------------------------------*/
2337 W10_L(" height=\"");
2342 if (strcasecmp(name, "hspace") == 0) {
2343 /*--------------------------------------------------------------------*/
2345 /*--------------------------------------------------------------------*/
2346 W10_L(" hspace=\"");
2354 if (strcasecmp(name, "vspace") == 0) {
2355 /*--------------------------------------------------------------------*/
2357 /*--------------------------------------------------------------------*/
2358 W10_L(" vspace=\"");
2370 return chtml10->out;
2375 * It is a handler who processes the IMG tag.
2377 * @param chtml10 [i/o] The pointer to the CHTML structure at the output
2378 * destination is specified.
2379 * @param node [i] The IMG tag node is specified.
2380 * @return The conversion result is returned.
2383 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
2387 chtml10 = GET_CHTML10(pdoc);
2389 return chtml10->out;
2394 * It is a handler who processes the SELECT tag.
2396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2397 * destination is specified.
2398 * @param node [i] The SELECT tag node is specified.
2399 * @return The conversion result is returned.
2402 s_chtml10_start_select_tag(void *pdoc, Node *child)
2412 chtml10 = GET_CHTML10(pdoc);
2420 for (attr = qs_get_attr(doc,child);
2422 attr = qs_get_next_attr(doc,attr)) {
2426 nm = qs_get_attr_name (doc,attr);
2427 val = qs_get_attr_value(doc,attr);
2432 if (strcasecmp(nm, "size") == 0) {
2433 /*--------------------------------------------------------------------*/
2434 /* CHTML 1.0 version 2.0 */
2435 /*--------------------------------------------------------------------*/
2436 size = apr_pstrdup(doc->buf.pool, val);
2442 if (strcasecmp(nm, "name") == 0) {
2443 /*--------------------------------------------------------------------*/
2444 /* CHTML 1.0 version 2.0 */
2445 /*--------------------------------------------------------------------*/
2446 name = apr_pstrdup(doc->buf.pool, val);
2452 if (strcasecmp(nm, "multiple") == 0) {
2453 /*--------------------------------------------------------------------*/
2454 /* CHTML 1.0 version 2.0 */
2455 /*--------------------------------------------------------------------*/
2478 return chtml10->out;
2483 * It is a handler who processes the SELECT tag.
2485 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2486 * destination is specified.
2487 * @param node [i] The SELECT tag node is specified.
2488 * @return The conversion result is returned.
2491 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2497 chtml10 = GET_CHTML10(pdoc);
2501 W10_L("</select>\r\n");
2502 return chtml10->out;
2507 * It is a handler who processes the OPTION tag.
2509 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2510 * destination is specified.
2511 * @param node [i] The OPTION tag node is specified.
2512 * @return The conversion result is returned.
2515 s_chtml10_start_option_tag(void *pdoc, Node *child)
2525 chtml10 = GET_CHTML10(pdoc);
2534 for (attr = qs_get_attr(doc,child);
2536 attr = qs_get_next_attr(doc,attr)) {
2540 nm = qs_get_attr_name (doc,attr);
2541 val = qs_get_attr_value(doc,attr);
2546 if (strcasecmp(nm, "selected") == 0) {
2547 /*--------------------------------------------------------------------*/
2548 /* CHTML 1.0 version 2.0 */
2549 /*--------------------------------------------------------------------*/
2550 selected = apr_pstrdup(doc->buf.pool, val);
2556 if (strcasecmp(nm, "value") == 0) {
2557 /*--------------------------------------------------------------------*/
2558 /* CHTML 1.0 version 2.0 */
2559 /*--------------------------------------------------------------------*/
2560 value = apr_pstrdup(doc->buf.pool, val);
2575 W10_L(" value=\"\"");
2579 W10_L(" selected ");
2583 return chtml10->out;
2588 * It is a handler who processes the OPTION tag.
2590 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2591 * destination is specified.
2592 * @param node [i] The OPTION tag node is specified.
2593 * @return The conversion result is returned.
2596 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2600 chtml10 = GET_CHTML10(pdoc);
2604 return chtml10->out;
2609 * It is a handler who processes the DIV tag.
2611 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2612 * destination is specified.
2613 * @param node [i] The DIV tag node is specified.
2614 * @return The conversion result is returned.
2617 s_chtml10_start_div_tag(void *pdoc, Node *child)
2626 chtml10 = GET_CHTML10(pdoc);
2634 for (attr = qs_get_attr(doc,child);
2636 attr = qs_get_next_attr(doc,attr)) {
2641 nm = qs_get_attr_name(doc,attr);
2642 val = qs_get_attr_value(doc,attr);
2644 if (STRCASEEQ('a','A',"align", nm)) {
2645 /*----------------------------------------------------------------------*/
2646 /* CHTML 1.0 (W3C version 3.2) */
2647 /*----------------------------------------------------------------------*/
2648 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2649 align = apr_pstrdup(doc->buf.pool, val);
2661 return chtml10->out;
2666 * It is a handler who processes the DIV tag.
2668 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2669 * destination is specified.
2670 * @param node [i] The DIV tag node is specified.
2671 * @return The conversion result is returned.
2674 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2680 chtml10 = GET_CHTML10(pdoc);
2685 return chtml10->out;
2690 * It is a handler who processes the CHXJ:IF tag.
2692 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2693 * destination is specified.
2694 * @param node [i] The CHXJ:IF tag node is specified.
2695 * @return The conversion result is returned.
2698 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2705 chtml10 = GET_CHTML10(pdoc);
2709 for (child = qs_get_child_node(doc, node);
2711 child = qs_get_next_node(doc, child)) {
2712 W10_V(child->otext);
2713 s_chtml10_chxjif_tag(chtml10, child);
2716 return chtml10->out;
2721 * It is a handler who processes the PRE tag.
2723 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2724 * destination is specified.
2725 * @param node [i] The PRE tag node is specified.
2726 * @return The conversion result is returned.
2729 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
2735 chtml10 = GET_CHTML10(pdoc);
2739 chtml10->pre_flag++;
2741 return chtml10->out;
2746 * It is a handler who processes the PRE tag.
2748 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2749 * destination is specified.
2750 * @param node [i] The PRE tag node is specified.
2751 * @return The conversion result is returned.
2754 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
2760 chtml10 = GET_CHTML10(pdoc);
2765 chtml10->pre_flag--;
2767 return chtml10->out;
2772 * It is a handler who processes the P tag.
2774 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2775 * destination is specified.
2776 * @param node [i] The P tag node is specified.
2777 * @return The conversion result is returned.
2780 s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
2786 chtml10 = GET_CHTML10(pdoc);
2791 return chtml10->out;
2796 * It is a handler who processes the P tag.
2798 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2799 * destination is specified.
2800 * @param node [i] The P tag node is specified.
2801 * @return The conversion result is returned.
2804 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
2810 chtml10 = GET_CHTML10(pdoc);
2815 return chtml10->out;
2820 * It is a handler who processes the TEXTARE tag.
2822 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2823 * destination is specified.
2824 * @param node [i] The TEXTAREA tag node is specified.
2825 * @return The conversion result is returned.
2828 s_chtml10_start_textarea_tag(void *pdoc, Node *node)
2835 chtml10 = GET_CHTML10(pdoc);
2840 chtml10->textarea_flag++;
2842 W10_L("<textarea ");
2844 for (attr = qs_get_attr(doc,node);
2846 attr = qs_get_next_attr(doc,attr)) {
2851 name = qs_get_attr_name (doc,attr);
2852 value = qs_get_attr_value(doc,attr);
2857 if (strcasecmp(name, "name") == 0) {
2866 if (strcasecmp(name, "rows") == 0) {
2875 if (strcasecmp(name, "cols") == 0) {
2888 return chtml10->out;
2893 * It is a handler who processes the TEXTAREA tag.
2895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2896 * destination is specified.
2897 * @param node [i] The TEXTAREA tag node is specified.
2898 * @return The conversion result is returned.
2901 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2907 chtml10 = GET_CHTML10(pdoc);
2911 W10_L("</textarea>\r\n");
2912 chtml10->textarea_flag--;
2914 return chtml10->out;
2919 s_chtml10_text(void *pdoc, Node *child)
2931 chtml10 = GET_CHTML10(pdoc);
2935 textval = qs_get_node_value(doc,child);
2936 textval = qs_trim_string(r, textval);
2938 if (strlen(textval) == 0)
2939 return chtml10->out;
2941 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2942 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2944 tdst = qs_alloc_zero_byte_string(r);
2945 memset(one_byte, 0, sizeof(one_byte));
2948 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2952 rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
2954 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2959 if (is_sjis_kanji(textval[ii])) {
2960 one_byte[0] = textval[ii+0];
2961 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2962 one_byte[0] = textval[ii+1];
2963 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2967 if (chtml10->pre_flag) {
2968 one_byte[0] = textval[ii+0];
2969 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2972 if (chtml10->textarea_flag) {
2973 one_byte[0] = textval[ii+0];
2974 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2977 if (textval[ii] != '\r' && textval[ii] != '\n') {
2978 one_byte[0] = textval[ii+0];
2979 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2984 return chtml10->out;
2989 * It is a handler who processes the BLOCKQUOTE tag.
2991 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2992 * destination is specified.
2993 * @param node [i] The BLOCKQUOTE tag node is specified.
2994 * @return The conversion result is returned.
2997 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3001 chtml10 = GET_CHTML10(pdoc);
3003 W10_L("<blockquote>");
3004 return chtml10->out;
3009 * It is a handler who processes the BLOCKQUOTE tag.
3011 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3012 * destination is specified.
3013 * @param node [i] The BLOCKQUOTE tag node is specified.
3014 * @return The conversion result is returned.
3017 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3022 chtml10 = GET_CHTML10(pdoc);
3024 W10_L("</blockquote>");
3025 return chtml10->out;
3030 * It is a handler who processes the DIR tag.
3032 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3033 * destination is specified.
3034 * @param node [i] The DIR tag node is specified.
3035 * @return The conversion result is returned.
3038 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3042 chtml10 = GET_CHTML10(pdoc);
3045 return chtml10->out;
3050 * It is a handler who processes the DIR tag.
3052 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3053 * destination is specified.
3054 * @param node [i] The DIR tag node is specified.
3055 * @return The conversion result is returned.
3058 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3063 chtml10 = GET_CHTML10(pdoc);
3066 return chtml10->out;
3071 * It is a handler who processes the DL tag.
3073 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3074 * destination is specified.
3075 * @param node [i] The DL tag node is specified.
3076 * @return The conversion result is returned.
3079 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3083 chtml10 = GET_CHTML10(pdoc);
3086 return chtml10->out;
3091 * It is a handler who processes the DL tag.
3093 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3094 * destination is specified.
3095 * @param node [i] The DL tag node is specified.
3096 * @return The conversion result is returned.
3099 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3103 chtml10 = GET_CHTML10(pdoc);
3106 return chtml10->out;
3111 * It is a handter who processes the DT tag.
3113 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3114 * destination is specified.
3115 * @param node [i] The DT tag node is specified.
3116 * @return The conversion result is returned.
3119 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3123 chtml10 = GET_CHTML10(pdoc);
3126 return chtml10->out;
3131 * It is a handter who processes the DT tag.
3133 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3134 * destination is specified.
3135 * @param node [i] The DT tag node is specified.
3136 * @return The conversion result is returned.
3139 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3142 chtml10 = GET_CHTML10(pdoc);
3143 return chtml10->out;
3148 * It is a handder who processes the DD tag.
3150 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3151 * destination is specified.
3152 * @param node [i] The DD tag node is specified.
3153 * @return The conversion result is returned.
3156 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3160 chtml10 = GET_CHTML10(pdoc);
3163 return chtml10->out;
3168 * It is a handder who processes the DD tag.
3170 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3171 * destination is specified.
3172 * @param node [i] The DD tag node is specified.
3173 * @return The conversion result is returned.
3176 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3179 chtml10 = GET_CHTML10(pdoc);
3180 return chtml10->out;