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.
18 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
26 #define GET_XHTML(X) ((xhtml_t*)(X))
29 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
30 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
31 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
33 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
34 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
35 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
36 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
37 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
38 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node);
97 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
107 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
108 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
109 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
112 tag_handler xhtml_handler[] = {
115 s_xhtml_1_0_start_html_tag,
116 s_xhtml_1_0_end_html_tag,
120 s_xhtml_1_0_start_meta_tag,
121 s_xhtml_1_0_end_meta_tag,
125 s_xhtml_1_0_start_textarea_tag,
126 s_xhtml_1_0_end_textarea_tag,
130 s_xhtml_1_0_start_p_tag,
131 s_xhtml_1_0_end_p_tag,
135 s_xhtml_1_0_start_pre_tag,
136 s_xhtml_1_0_end_pre_tag,
140 s_xhtml_1_0_start_ul_tag,
141 s_xhtml_1_0_end_ul_tag,
145 s_xhtml_1_0_start_li_tag,
146 s_xhtml_1_0_end_li_tag,
150 s_xhtml_1_0_start_ol_tag,
151 s_xhtml_1_0_end_ol_tag,
155 s_xhtml_1_0_start_h1_tag,
156 s_xhtml_1_0_end_h1_tag,
160 s_xhtml_1_0_start_h2_tag,
161 s_xhtml_1_0_end_h2_tag,
165 s_xhtml_1_0_start_h3_tag,
166 s_xhtml_1_0_end_h3_tag,
170 s_xhtml_1_0_start_h4_tag,
171 s_xhtml_1_0_end_h4_tag,
175 s_xhtml_1_0_start_h5_tag,
176 s_xhtml_1_0_end_h5_tag,
180 s_xhtml_1_0_start_h6_tag,
181 s_xhtml_1_0_end_h6_tag,
185 s_xhtml_1_0_start_head_tag,
186 s_xhtml_1_0_end_head_tag,
190 s_xhtml_1_0_start_title_tag,
191 s_xhtml_1_0_end_title_tag,
195 s_xhtml_1_0_start_base_tag,
196 s_xhtml_1_0_end_base_tag,
200 s_xhtml_1_0_start_body_tag,
201 s_xhtml_1_0_end_body_tag,
205 s_xhtml_1_0_start_a_tag,
206 s_xhtml_1_0_end_a_tag,
210 s_xhtml_1_0_start_br_tag,
211 s_xhtml_1_0_end_br_tag,
220 s_xhtml_1_0_start_tr_tag,
221 s_xhtml_1_0_end_tr_tag,
235 s_xhtml_1_0_start_font_tag,
236 s_xhtml_1_0_end_font_tag,
240 s_xhtml_1_0_start_form_tag,
241 s_xhtml_1_0_end_form_tag,
245 s_xhtml_1_0_start_input_tag,
246 s_xhtml_1_0_end_input_tag,
250 s_xhtml_1_0_start_center_tag,
251 s_xhtml_1_0_end_center_tag,
255 s_xhtml_1_0_start_hr_tag,
256 s_xhtml_1_0_end_hr_tag,
260 s_xhtml_1_0_start_img_tag,
261 s_xhtml_1_0_end_img_tag,
265 s_xhtml_1_0_start_select_tag,
266 s_xhtml_1_0_end_select_tag,
270 s_xhtml_1_0_start_option_tag,
271 s_xhtml_1_0_end_option_tag,
275 s_xhtml_1_0_start_div_tag,
276 s_xhtml_1_0_end_div_tag,
280 s_xhtml_1_0_chxjif_tag,
305 s_xhtml_1_0_text_tag,
315 s_xhtml_1_0_start_b_tag,
316 s_xhtml_1_0_end_b_tag,
325 s_xhtml_1_0_start_dt_tag,
326 s_xhtml_1_0_end_dt_tag,
340 s_xhtml_1_0_start_blockquote_tag,
341 s_xhtml_1_0_end_blockquote_tag,
345 s_xhtml_1_0_start_dir_tag,
346 s_xhtml_1_0_end_dir_tag,
350 s_xhtml_1_0_start_dl_tag,
351 s_xhtml_1_0_end_dl_tag,
355 s_xhtml_1_0_start_dd_tag,
356 s_xhtml_1_0_end_dd_tag,
381 * converts from CHTML to XHTML.
383 * @param r [i] Requet_rec is appointed.
384 * @param spec [i] The result of the device specification processing which
385 * was done in advance is appointed.
386 * @param src [i] The character string before the converting is appointed.
387 * @return The character string after the converting is returned.
390 chxj_exchange_xhtml_mobile_1_0(
396 chxjconvrule_entry *entryp,
397 cookie_t *UNUSED(cookie)
405 DBG(r,"start chxj_exchange_xhtml_mobile_1_0()");
406 /*--------------------------------------------------------------------------*/
408 /*--------------------------------------------------------------------------*/
410 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
412 DBG(r,"end chxj_exchange_xhtml_mobile_1_0() (found qrcode.xml)");
416 /*--------------------------------------------------------------------------*/
417 /* The XHTML structure is initialized. */
418 /*--------------------------------------------------------------------------*/
419 s_init_xhtml(&xhtml, &doc, r, spec);
421 xhtml.entryp = entryp;
423 chxj_set_content_type(r, "text/html; charset=Windows-31J");
425 /*--------------------------------------------------------------------------*/
426 /* The character string of the input is analyzed. */
427 /*--------------------------------------------------------------------------*/
428 qs_init_malloc(&doc);
429 qs_init_root_node(&doc);
431 ss = apr_pcalloc(r->pool, srclen + 1);
432 memset(ss, 0, srclen + 1);
433 memcpy(ss, src, srclen);
436 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
438 qs_parse_string(&doc,ss, strlen(ss));
440 chxj_buffered_write_init(r->pool, &doc.buf);
441 /*--------------------------------------------------------------------------*/
442 /* It converts it from CHTML to XHTML. */
443 /*--------------------------------------------------------------------------*/
444 chxj_node_exchange(spec,r,(void*)&xhtml, &doc, qs_get_root(&doc), 0);
445 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
446 dst = apr_pstrdup(r->pool, xhtml.out);
447 chxj_buffered_write_terminate(&doc.buf);
449 qs_all_free(&doc,QX_LOGMARK);
452 return apr_pstrdup(r->pool,ss);
456 dst = apr_psprintf(r->pool, "\n");
458 *dstlen = strlen(dst);
461 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
464 DBG(r,"end chxj_exchange_xhtml_mobile_1_0()");
470 * The XHTML structure is initialized.
472 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
473 * initialized is specified.
474 * @param doc [i] The Doc structure that should be set to the initialized
475 * HDML structure is specified.
476 * @param r [i] To use POOL, the pointer to request_rec is specified.
477 * @param spec [i] The pointer to the device_table
480 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
482 memset(doc, 0, sizeof(Doc));
483 memset(xhtml, 0, sizeof(xhtml_t));
488 xhtml->out = qs_alloc_zero_byte_string(r);
489 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
490 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
495 * Corresponding EMOJI to a current character-code is retrieved.
496 * The substitution character string is stored in the rslt pointer if agreeing.
498 * @param xhtml [i] The pointer to the XHTML structure is specified.
499 * @param txt [i] The character string to want to examine whether it is
500 * EMOJI is specified.
501 * @param rslt [o] The pointer to the pointer that stores the result is
503 * @return When corresponding EMOJI exists, it returns it excluding 0.
506 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
519 DBG(r,"spec is NULL");
522 for (ee = xhtml->conf->emoji;
525 unsigned char hex1byte;
526 unsigned char hex2byte;
528 DBG(r,"emoji->imode is NULL");
532 if (ee->imode->string != NULL
533 && strlen(ee->imode->string) > 0
534 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
535 if (spec == NULL || spec->emoji_type == NULL) {
536 *rslt = apr_psprintf(r->pool,
539 return strlen(ee->imode->string);
542 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
543 *rslt = apr_psprintf(r->pool,
546 return strlen(ee->imode->string);
549 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
550 *rslt = apr_psprintf(r->pool,
553 return strlen(ee->imode->string);
556 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
557 *rslt = apr_psprintf(r->pool,
560 return strlen(ee->imode->string);
563 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
564 *rslt = apr_psprintf(r->pool,
567 return strlen(ee->imode->string);
570 *rslt = apr_psprintf(r->pool,
573 return strlen(ee->imode->string);
577 hex1byte = ee->imode->hex1byte & 0xff;
578 hex2byte = ee->imode->hex2byte & 0xff;
580 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
581 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
582 if (spec == NULL || spec->emoji_type == NULL) {
583 *rslt = apr_psprintf(r->pool,
584 "<img localsrc=\"%s\">",
589 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
590 *rslt = apr_psprintf(r->pool,
591 "<img localsrc=\"%s\">",
596 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
597 *rslt = apr_psprintf(r->pool,
598 "<img localsrc=\"%s\">",
603 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
604 *rslt = apr_psprintf(r->pool,
605 "<img localsrc=\"%s\">",
610 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
611 *rslt = apr_psprintf(r->pool,
612 "<img localsrc=\"%s\">",
617 *rslt = apr_psprintf(r->pool,
618 "<img localsrc=\"%s\">",
630 * It is a handler who processes the HTML tag.
632 * @param pdoc [i/o] The pointer to the XHTML structure at the output
633 * destination is specified.
634 * @param node [i] The HTML tag node is specified.
635 * @return The conversion result is returned.
638 s_xhtml_1_0_start_html_tag(void *pdoc, Node *node)
640 xhtml_t *xhtml = GET_XHTML(pdoc);
642 Doc *doc = xhtml->doc;
644 /*--------------------------------------------------------------------------*/
645 /* Add XML Declare */
646 /*--------------------------------------------------------------------------*/
647 W_L("<?xml version=\"1.0\" encoding=\"Windows-31J\"?>\r\n");
648 /*--------------------------------------------------------------------------*/
650 /*--------------------------------------------------------------------------*/
651 W_L("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"\r\n");
652 W_L(" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">\r\n");
653 /*--------------------------------------------------------------------------*/
655 /*--------------------------------------------------------------------------*/
656 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\"");
657 /*--------------------------------------------------------------------------*/
659 /*--------------------------------------------------------------------------*/
660 for (attr = qs_get_attr(doc,node);
662 attr = qs_get_next_attr(doc,attr)) {
663 char* name = qs_get_attr_name(doc,attr);
664 char* value = qs_get_attr_value(doc,attr);
665 if (STRCASEEQ('l','L',"lang", name)) {
670 else if (STRCASEEQ('v','V',"version", name)) {
671 W_L(" version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"");
680 * It is a handler who processes the HTML tag.
682 * @param pdoc [i/o] The pointer to the XHTML structure at the output
683 * destination is specified.
684 * @param node [i] The HTML tag node is specified.
685 * @return The conversion result is returned.
688 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
690 xhtml_t *xhtml = GET_XHTML(pdoc);
691 Doc *doc = xhtml->doc;
698 * It is a handler who processes the META tag.
700 * @param pdoc [i/o] The pointer to the XHTML structure at the output
701 * destination is specified.
702 * @param node [i] The META tag node is specified.
703 * @return The conversion result is returned.
706 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
708 xhtml_t *xhtml = GET_XHTML(pdoc);
710 Doc *doc = xhtml->doc;
711 int content_type_flag = 0;
714 /*--------------------------------------------------------------------------*/
716 /*--------------------------------------------------------------------------*/
717 for (attr = qs_get_attr(doc,node);
719 attr = qs_get_next_attr(doc,attr)) {
720 char *name = qs_get_attr_name(doc,attr);
721 char *value = qs_get_attr_value(doc,attr);
722 if (STRCASEEQ('n','N',"name", name)) {
729 else if (STRCASEEQ('h','H',"http-equiv", name)) {
735 if (STRCASEEQ('c','C', "content-type", value)) {
736 content_type_flag = 1;
739 else if (STRCASEEQ('c','C',"content", name)) {
740 if (content_type_flag) {
744 W_L("text/html; charset=Windows-31J");
762 * It is a handler who processes the META tag.
764 * @param pdoc [i/o] The pointer to the XHTML structure at the output
765 * destination is specified.
766 * @param node [i] The META tag node is specified.
767 * @return The conversion result is returned.
770 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
772 xhtml_t *xhtml = GET_XHTML(pdoc);
779 * It is a handler who processes the HEAD tag.
781 * @param pdoc [i/o] The pointer to the XHTML structure at the output
782 * destination is specified.
783 * @param node [i] The HEAD tag node is specified.
784 * @return The conversion result is returned.
787 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
789 xhtml_t *xhtml = GET_XHTML(pdoc);
790 Doc *doc = xhtml->doc;
798 * It is a handler who processes the HEAD tag.
800 * @param pdoc [i/o] The pointer to the XHTML structure at the output
801 * destination is specified.
802 * @param node [i] The HEAD tag node is specified.
803 * @return The conversion result is returned.
806 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
808 xhtml_t *xhtml = GET_XHTML(pdoc);
809 Doc *doc = xhtml->doc;
817 * It is a handler who processes the TITLE tag.
819 * @param pdoc [i/o] The pointer to the XHTML structure at the output
820 * destination is specified.
821 * @param node [i] The TITLE tag node is specified.
822 * @return The conversion result is returned.
825 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
827 xhtml_t *xhtml = GET_XHTML(pdoc);
828 Doc *doc = xhtml->doc;
836 * It is a handler who processes the TITLE tag.
838 * @param pdoc [i/o] The pointer to the XHTML structure at the output
839 * destination is specified.
840 * @param node [i] The TITLE tag node is specified.
841 * @return The conversion result is returned.
844 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
846 xhtml_t *xhtml = GET_XHTML(pdoc);
847 Doc *doc = xhtml->doc;
855 * It is a handler who processes the BASE tag.
857 * @param pdoc [i/o] The pointer to the XHTML structure at the output
858 * destination is specified.
859 * @param node [i] The BASE tag node is specified.
860 * @return The conversion result is returned.
863 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
865 xhtml_t *xhtml = GET_XHTML(pdoc);
867 Doc *doc = xhtml->doc;
870 /*--------------------------------------------------------------------------*/
872 /*--------------------------------------------------------------------------*/
873 for (attr = qs_get_attr(doc,node);
875 attr = qs_get_next_attr(doc,attr)) {
876 char *name = qs_get_attr_name(doc,attr);
877 char *value = qs_get_attr_value(doc,attr);
878 if (STRCASEEQ('h','H',"href",name)) {
891 * It is a handler who processes the BASE tag.
893 * @param pdoc [i/o] The pointer to the XHTML structure at the output
894 * destination is specified.
895 * @param node [i] The BASE tag node is specified.
896 * @return The conversion result is returned.
899 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
901 xhtml_t *xhtml = GET_XHTML(pdoc);
908 * It is a handler who processes the BODY tag.
910 * @param pdoc [i/o] The pointer to the XHTML structure at the output
911 * destination is specified.
912 * @param node [i] The BODY tag node is specified.
913 * @return The conversion result is returned.
916 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
918 xhtml_t *xhtml = GET_XHTML(pdoc);
919 Doc *doc = xhtml->doc;
923 /*--------------------------------------------------------------------------*/
925 /*--------------------------------------------------------------------------*/
926 for (attr = qs_get_attr(doc,node);
928 attr = qs_get_next_attr(doc,attr)) {
929 char *name = qs_get_attr_name(doc,attr);
930 char *value = qs_get_attr_value(doc,attr);
931 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
936 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
941 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
946 else if (STRCASEEQ('a','A',"alink", name)) {
949 else if (STRCASEEQ('v','V',"vlink",name)) {
959 * It is a handler who processes the BODY tag.
961 * @param pdoc [i/o] The pointer to the XHTML structure at the output
962 * destination is specified.
963 * @param node [i] The BODY tag node is specified.
964 * @return The conversion result is returned.
967 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
969 xhtml_t *xhtml = GET_XHTML(pdoc);
970 Doc *doc = xhtml->doc;
978 * It is a handler who processes the A tag.
980 * @param pdoc [i/o] The pointer to the XHTML structure at the output
981 * destination is specified.
982 * @param node [i] The A tag node is specified.
983 * @return The conversion result is returned.
986 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
988 xhtml_t *xhtml = GET_XHTML(pdoc);
989 Doc *doc = xhtml->doc;
990 request_rec *r = doc->r;
994 /*--------------------------------------------------------------------------*/
996 /*--------------------------------------------------------------------------*/
997 for (attr = qs_get_attr(doc,node);
999 attr = qs_get_next_attr(doc,attr)) {
1000 char* name = qs_get_attr_name(doc,attr);
1001 char* value = qs_get_attr_value(doc,attr);
1002 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1007 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1008 value = chxj_encoding_parameter(r, value);
1013 else if (STRCASEEQ('a','A',"accesskey", name)) {
1014 W_L(" accesskey=\"");
1018 else if (STRCASEEQ('c','C',"cti",name)) {
1021 else if (STRCASEEQ('i','I',"ijam", name)) {
1024 else if (STRCASEEQ('u','U',"utn", name)) {
1027 else if (STRCASEEQ('t','T',"telbook",name)) {
1030 else if (STRCASEEQ('k','K',"kana",name)) {
1033 else if (STRCASEEQ('e','E',"email",name)) {
1036 else if (STRCASEEQ('i','I',"ista",name)) {
1039 else if (STRCASEEQ('i','I',"ilet",name)) {
1042 else if (STRCASEEQ('i','I',"iswf",name)) {
1045 else if (STRCASEEQ('i','I',"irst",name)) {
1055 * It is a handler who processes the A tag.
1057 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1058 * destination is specified.
1059 * @param node [i] The A tag node is specified.
1060 * @return The conversion result is returned.
1063 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1065 xhtml_t *xhtml = GET_XHTML(pdoc);
1066 Doc *doc = xhtml->doc;
1074 * It is a handler who processes the BR tag.
1076 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1077 * destination is specified.
1078 * @param node [i] The BR tag node is specified.
1079 * @return The conversion result is returned.
1082 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1084 xhtml_t *xhtml = GET_XHTML(pdoc);
1085 Doc *doc = xhtml->doc;
1089 /*--------------------------------------------------------------------------*/
1090 /* Get Attributes */
1091 /*--------------------------------------------------------------------------*/
1092 for (attr = qs_get_attr(doc,node);
1094 attr = qs_get_next_attr(doc,attr)) {
1095 char *name = qs_get_attr_name(doc,attr);
1096 char *value = qs_get_attr_value(doc,attr);
1097 if (STRCASEEQ('c','C',"clear",name)) {
1098 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1111 * It is a handler who processes the BR tag.
1113 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1114 * destination is specified.
1115 * @param node [i] The BR tag node is specified.
1116 * @return The conversion result is returned.
1119 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1121 xhtml_t *xhtml = GET_XHTML(pdoc);
1128 * It is a handler who processes the TR tag.
1130 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1131 * destination is specified.
1132 * @param node [i] The TR tag node is specified.
1133 * @return The conversion result is returned.
1136 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1138 xhtml_t *xhtml = GET_XHTML(pdoc);
1139 Doc *doc = xhtml->doc;
1147 * It is a handler who processes the TR tag.
1149 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1150 * destination is specified.
1151 * @param node [i] The TR tag node is specified.
1152 * @return The conversion result is returned.
1155 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1157 xhtml_t *xhtml = GET_XHTML(pdoc);
1164 * It is a handler who processes the FONT tag.
1166 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1167 * destination is specified.
1168 * @param node [i] The FONT tag node is specified.
1169 * @return The conversion result is returned.
1172 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1174 xhtml_t *xhtml = GET_XHTML(pdoc);
1175 Doc *doc = xhtml->doc;
1179 /*=========================================================================*/
1180 /* Get Attributes */
1181 /*=========================================================================*/
1182 for (attr = qs_get_attr(doc,node);
1184 attr = qs_get_next_attr(doc,attr)) {
1185 char *name = qs_get_attr_name(doc,attr);
1186 char *value = qs_get_attr_value(doc,attr);
1187 if (STRCASEEQ('c','C',"color",name)) {
1192 else if (STRCASEEQ('s','S',"size",name)) {
1204 * It is a handler who processes the FONT tag.
1206 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1207 * destination is specified.
1208 * @param node [i] The FONT tag node is specified.
1209 * @return The conversion result is returned.
1212 s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child))
1214 xhtml_t *xhtml = GET_XHTML(pdoc);
1215 Doc *doc = xhtml->doc;
1223 * It is a handler who processes the FORM tag.
1225 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1226 * destination is specified.
1227 * @param node [i] The FORM tag node is specified.
1228 * @return The conversion result is returned.
1231 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1233 xhtml_t *xhtml = GET_XHTML(pdoc);
1234 Doc *doc = xhtml->doc;
1235 request_rec *r = doc->r;
1239 /*--------------------------------------------------------------------------*/
1240 /* Get Attributes */
1241 /*--------------------------------------------------------------------------*/
1242 for (attr = qs_get_attr(doc,node);
1244 attr = qs_get_next_attr(doc,attr)) {
1245 char *name = qs_get_attr_name(doc,attr);
1246 char *value = qs_get_attr_value(doc,attr);
1247 if (STRCASEEQ('a','A',"action",name)) {
1248 value = chxj_encoding_parameter(r, value);
1253 else if (STRCASEEQ('m','M',"method",name)) {
1258 else if (STRCASEEQ('u','U',"utn",name)) {
1268 * It is a handler who processes the FORM tag.
1270 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1271 * destination is specified.
1272 * @param node [i] The FORM tag node is specified.
1273 * @return The conversion result is returned.
1276 s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child))
1278 xhtml_t *xhtml = GET_XHTML(pdoc);
1279 Doc *doc = xhtml->doc;
1287 * It is a handler who processes the INPUT tag.
1289 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1290 * destination is specified.
1291 * @param node [i] The INPUT tag node is specified.
1292 * @return The conversion result is returned.
1295 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1297 xhtml_t *xhtml = GET_XHTML(pdoc);
1298 Doc *doc = xhtml->doc;
1299 request_rec *r = doc->r;
1300 char *max_length = NULL;
1304 char *istyle = NULL;
1306 char *checked = NULL;
1307 char *accesskey = NULL;
1310 /*--------------------------------------------------------------------------*/
1311 /* Get Attributes */
1312 /*--------------------------------------------------------------------------*/
1313 type = qs_get_type_attr(doc, node, r);
1314 name = qs_get_name_attr(doc, node, r);
1315 value = qs_get_value_attr(doc,node,r);
1316 istyle = qs_get_istyle_attr(doc,node,r);
1317 max_length = qs_get_maxlength_attr(doc,node,r);
1318 checked = qs_get_checked_attr(doc,node,r);
1319 accesskey = qs_get_accesskey_attr(doc, node, r);
1320 size = qs_get_size_attr(doc, node, r);
1343 W_L(" accesskey=\"");
1348 char* fmt = qs_conv_istyle_to_format(r,istyle);
1351 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1352 if (max_length[ii] < '0' || max_length[ii] > '9') {
1353 max_length = apr_psprintf(r->pool, "0");
1359 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1370 /*--------------------------------------------------------------------------*/
1371 /* The figure is default for the password. */
1372 /*--------------------------------------------------------------------------*/
1373 if (type && istyle == NULL
1374 && (*type == 'p' || *type == 'P')
1375 && strcasecmp(type, "password") == 0
1376 && ! xhtml->entryp->pc_flag) {
1383 W_L(" FORMAT=\"*N\"");
1387 W_L(" checked=\"checked\"");
1395 * It is a handler who processes the INPUT tag.
1397 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1398 * destination is specified.
1399 * @param node [i] The INPUT tag node is specified.
1400 * @return The conversion result is returned.
1403 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1405 xhtml_t *xhtml = GET_XHTML(pdoc);
1412 * It is a handler who processes the CENTER tag.
1414 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1415 * destination is specified.
1416 * @param node [i] The CENTER tag node is specified.
1417 * @return The conversion result is returned.
1420 s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node))
1422 xhtml_t *xhtml = GET_XHTML(pdoc);
1423 Doc *doc = xhtml->doc;
1431 * It is a handler who processes the CENTER tag.
1433 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1434 * destination is specified.
1435 * @param node [i] The CENTER tag node is specified.
1436 * @return The conversion result is returned.
1439 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child))
1441 xhtml_t *xhtml = GET_XHTML(pdoc);
1442 Doc *doc = xhtml->doc;
1450 * It is a handler who processes the HR tag.
1452 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1453 * destination is specified.
1454 * @param node [i] The HR tag node is specified.
1455 * @return The conversion result is returned.
1458 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *UNUSED(node))
1460 xhtml_t *xhtml = GET_XHTML(pdoc);
1461 Doc *doc = xhtml->doc;
1469 * It is a handler who processes the HR tag.
1471 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1472 * destination is specified.
1473 * @param node [i] The HR tag node is specified.
1474 * @return The conversion result is returned.
1477 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
1479 xhtml_t *xhtml = GET_XHTML(pdoc);
1486 * It is a handler who processes the PRE tag.
1488 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1489 * destination is specified.
1490 * @param node [i] The PRE tag node is specified.
1491 * @return The conversion result is returned.
1494 s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node))
1496 xhtml_t *xhtml = GET_XHTML(pdoc);
1497 Doc *doc = xhtml->doc;
1506 * It is a handler who processes the PRE tag.
1508 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1509 * destination is specified.
1510 * @param node [i] The PRE tag node is specified.
1511 * @return The conversion result is returned.
1514 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
1516 xhtml_t *xhtml = GET_XHTML(pdoc);
1517 Doc *doc = xhtml->doc;
1527 * It is a handler who processes the P tag.
1529 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1530 * destination is specified.
1531 * @param node [i] The P tag node is specified.
1532 * @return The conversion result is returned.
1535 s_xhtml_1_0_start_p_tag(void *pdoc, Node *UNUSED(node))
1537 xhtml_t *xhtml = GET_XHTML(pdoc);
1538 Doc *doc = xhtml->doc;
1546 * It is a handler who processes the P tag.
1548 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1549 * destination is specified.
1550 * @param node [i] The P tag node is specified.
1551 * @return The conversion result is returned.
1554 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
1556 xhtml_t *xhtml = GET_XHTML(pdoc);
1557 Doc *doc = xhtml->doc;
1565 * It is a handler who processes the UL tag.
1567 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1568 * destination is specified.
1569 * @param node [i] The UL tag node is specified.
1570 * @return The conversion result is returned.
1573 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *UNUSED(node))
1575 xhtml_t *xhtml = GET_XHTML(pdoc);
1576 Doc *doc = xhtml->doc;
1584 * It is a handler who processes the UL tag.
1586 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1587 * destination is specified.
1588 * @param node [i] The UL tag node is specified.
1589 * @return The conversion result is returned.
1592 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
1594 xhtml_t *xhtml = GET_XHTML(pdoc);
1595 Doc *doc = xhtml->doc;
1603 * It is a handler who processes the H1 tag.
1605 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1606 * destination is specified.
1607 * @param node [i] The H1 tag node is specified.
1608 * @return The conversion result is returned.
1611 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
1613 xhtml_t *xhtml = GET_XHTML(pdoc);
1614 Doc *doc = xhtml->doc;
1618 for (attr = qs_get_attr(doc,node);
1620 attr = qs_get_next_attr(doc,attr)) {
1623 name = qs_get_attr_name(doc,attr);
1624 value = qs_get_attr_value(doc,attr);
1625 if (STRCASEEQ('a','A',"align", name)) {
1627 if (STRCASEEQ('l','L',"left",value)) {
1629 W_L("text-align:left");
1632 else if (STRCASEEQ('r','R',"right",value)) {
1634 W_L("text-align:right");
1637 else if (STRCASEEQ('c','C',"center",value)) {
1639 W_L("text-align:center");
1652 * It is a handler who processes the H1 tag.
1654 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1655 * destination is specified.
1656 * @param node [i] The H1 tag node is specified.
1657 * @return The conversion result is returned.
1660 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
1662 xhtml_t *xhtml = GET_XHTML(pdoc);
1663 Doc *doc = xhtml->doc;
1671 * It is a handler who processes the H2 tag.
1673 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1674 * destination is specified.
1675 * @param node [i] The H2 tag node is specified.
1676 * @return The conversion result is returned.
1679 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
1681 xhtml_t *xhtml = GET_XHTML(pdoc);
1682 Doc *doc = xhtml->doc;
1686 for (attr = qs_get_attr(doc,node);
1688 attr = qs_get_next_attr(doc,attr)) {
1691 name = qs_get_attr_name(doc,attr);
1692 value = qs_get_attr_value(doc,attr);
1693 if (STRCASEEQ('a','A',"align", name)) {
1695 if (STRCASEEQ('l','L',"left",value)) {
1697 W_L("text-align:left");
1700 else if (STRCASEEQ('r','R',"right",value)) {
1702 W_L("text-align:right");
1705 else if (STRCASEEQ('c','C',"center",value)) {
1707 W_L("text-align:center");
1720 * It is a handler who processes the H2 tag.
1722 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1723 * destination is specified.
1724 * @param node [i] The H2 tag node is specified.
1725 * @return The conversion result is returned.
1728 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
1730 xhtml_t *xhtml = GET_XHTML(pdoc);
1731 Doc *doc = xhtml->doc;
1739 * It is a handler who processes the H3 tag.
1741 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1742 * destination is specified.
1743 * @param node [i] The H3 tag node is specified.
1744 * @return The conversion result is returned.
1747 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
1749 xhtml_t *xhtml = GET_XHTML(pdoc);
1750 Doc *doc = xhtml->doc;
1754 for (attr = qs_get_attr(doc,node);
1756 attr = qs_get_next_attr(doc,attr)) {
1759 name = qs_get_attr_name(doc,attr);
1760 value = qs_get_attr_value(doc,attr);
1761 if (STRCASEEQ('a','A',"align", name)) {
1763 if (STRCASEEQ('l','L',"left",value)) {
1765 W_L("text-align:left");
1768 else if (STRCASEEQ('r','R',"right",value)) {
1770 W_L("text-align:right");
1773 else if (STRCASEEQ('c','C',"center",value)) {
1775 W_L("text-align:center");
1788 * It is a handler who processes the H3 tag.
1790 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1791 * destination is specified.
1792 * @param node [i] The H3 tag node is specified.
1793 * @return The conversion result is returned.
1796 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
1798 xhtml_t *xhtml = GET_XHTML(pdoc);
1799 Doc *doc = xhtml->doc;
1807 * It is a handler who processes the H4 tag.
1809 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1810 * destination is specified.
1811 * @param node [i] The H4 tag node is specified.
1812 * @return The conversion result is returned.
1815 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
1817 xhtml_t *xhtml = GET_XHTML(pdoc);
1818 Doc *doc = xhtml->doc;
1822 for (attr = qs_get_attr(doc,node);
1824 attr = qs_get_next_attr(doc,attr)) {
1827 name = qs_get_attr_name(doc,attr);
1828 value = qs_get_attr_value(doc,attr);
1829 if (STRCASEEQ('a','A',"align", name)) {
1831 if (STRCASEEQ('l','L',"left",value)) {
1833 W_L("text-align:left");
1836 else if (STRCASEEQ('r','R',"right",value)) {
1838 W_L("text-align:right");
1841 else if (STRCASEEQ('c','C',"center",value)) {
1843 W_L("text-align:center");
1856 * It is a handler who processes the H4 tag.
1858 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1859 * destination is specified.
1860 * @param node [i] The H4 tag node is specified.
1861 * @return The conversion result is returned.
1864 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
1866 xhtml_t *xhtml = GET_XHTML(pdoc);
1867 Doc *doc = xhtml->doc;
1875 * It is a handler who processes the H5 tag.
1877 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1878 * destination is specified.
1879 * @param node [i] The H5 tag node is specified.
1880 * @return The conversion result is returned.
1883 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
1885 xhtml_t *xhtml = GET_XHTML(pdoc);
1886 Doc *doc = xhtml->doc;
1890 for (attr = qs_get_attr(doc,node);
1892 attr = qs_get_next_attr(doc,attr)) {
1895 name = qs_get_attr_name(doc,attr);
1896 value = qs_get_attr_value(doc,attr);
1897 if (STRCASEEQ('a','A',"align", name)) {
1899 if (STRCASEEQ('l','L',"left",value)) {
1901 W_L("text-align:left");
1904 else if (STRCASEEQ('r','R',"right",value)) {
1906 W_L("text-align:right");
1909 else if (STRCASEEQ('c','C',"center",value)) {
1911 W_L("text-align:center");
1924 * It is a handler who processes the H5 tag.
1926 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1927 * destination is specified.
1928 * @param node [i] The H5 tag node is specified.
1929 * @return The conversion result is returned.
1932 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
1934 xhtml_t *xhtml = GET_XHTML(pdoc);
1935 Doc *doc = xhtml->doc;
1943 * It is a handler who processes the H6 tag.
1945 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1946 * destination is specified.
1947 * @param node [i] The H6 tag node is specified.
1948 * @return The conversion result is returned.
1951 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *UNUSED(node))
1953 xhtml_t *xhtml = GET_XHTML(pdoc);
1954 Doc *doc = xhtml->doc;
1962 * It is a handler who processes the H6 tag.
1964 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1965 * destination is specified.
1966 * @param node [i] The H6 tag node is specified.
1967 * @return The conversion result is returned.
1970 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
1972 xhtml_t *xhtml = GET_XHTML(pdoc);
1973 Doc *doc = xhtml->doc;
1981 * It is a handler who processes the OL tag.
1983 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1984 * destination is specified.
1985 * @param node [i] The OL tag node is specified.
1986 * @return The conversion result is returned.
1989 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *UNUSED(node))
1991 xhtml_t *xhtml = GET_XHTML(pdoc);
1992 Doc *doc = xhtml->doc;
2000 * It is a handler who processes the OL tag.
2002 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2003 * destination is specified.
2004 * @param node [i] The OL tag node is specified.
2005 * @return The conversion result is returned.
2008 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
2010 xhtml_t *xhtml = GET_XHTML(pdoc);
2011 Doc *doc = xhtml->doc;
2019 * It is a handler who processes the LI tag.
2021 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2022 * destination is specified.
2023 * @param node [i] The LI tag node is specified.
2024 * @return The conversion result is returned.
2027 s_xhtml_1_0_start_li_tag(void *pdoc, Node *UNUSED(node))
2029 xhtml_t *xhtml = GET_XHTML(pdoc);
2030 Doc *doc = xhtml->doc;
2038 ** It is a handler who processes the LI tag.
2040 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2041 * destination is specified.
2042 * @param node [i] The LI tag node is specified.
2043 * @return The conversion result is returned.
2046 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
2048 xhtml_t *xhtml = GET_XHTML(pdoc);
2049 Doc *doc = xhtml->doc;
2056 * It is a handler who processes the IMG tag.
2058 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2059 * destination is specified.
2060 * @param node [i] The IMG tag node is specified.
2061 * @return The conversion result is returned.
2064 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
2066 xhtml_t *xhtml = GET_XHTML(pdoc);
2067 Doc *doc = xhtml->doc;
2068 request_rec *r = doc->r;
2071 #ifndef IMG_NOT_CONVERT_FILENAME
2072 device_table *spec = xhtml->spec;
2076 /*--------------------------------------------------------------------------*/
2077 /* Get Attributes */
2078 /*--------------------------------------------------------------------------*/
2079 for (attr = qs_get_attr(doc,node);
2081 attr = qs_get_next_attr(doc,attr)) {
2082 char *name = qs_get_attr_name(doc,attr);
2083 char *value = qs_get_attr_value(doc,attr);
2085 if (STRCASEEQ('s','S',"src",name)) {
2086 value = chxj_encoding_parameter(r, value);
2087 #ifdef IMG_NOT_CONVERT_FILENAME
2097 char *vv = chxj_img_conv(r,spec,value);
2105 if (*name == 'a' || *name == 'A') {
2106 if (strcasecmp(name, "align" ) == 0) {
2112 if (strcasecmp(name, "alt" ) == 0) {
2118 else if (STRCASEEQ('w','W',"width",name)) {
2124 if (*name == 'h' || *name == 'H') {
2125 if (strcasecmp(name, "height") == 0) {
2131 if (strcasecmp(name, "hspace") == 0) {
2137 else if (STRCASEEQ('v','V',"vspace",name)) {
2149 * It is a handler who processes the IMG tag.
2151 * @param xhtml [i/o] The pointer to the XHTML structure at the output
2152 * destination is specified.
2153 * @param node [i] The IMG tag node is specified.
2154 * @return The conversion result is returned.
2157 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
2159 xhtml_t *xhtml = GET_XHTML(pdoc);
2166 * It is a handler who processes the SELECT tag.
2168 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2169 * destination is specified.
2170 * @param node [i] The SELECT tag node is specified.
2171 * @return The conversion result is returned.
2174 s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
2176 xhtml_t *xhtml = GET_XHTML(pdoc);
2177 Doc *doc = xhtml->doc;
2184 for (attr = qs_get_attr(doc,child);
2186 attr = qs_get_next_attr(doc,attr)) {
2187 char *nm = qs_get_attr_name(doc,attr);
2188 char *val = qs_get_attr_value(doc,attr);
2189 if (STRCASEEQ('s','S',"size",nm)) {
2190 /* CHTML version 2.0 */
2191 size = apr_pstrdup(doc->buf.pool, val);
2193 else if (STRCASEEQ('n','N',"name",nm)) {
2194 /* CHTML version 2.0 */
2195 name = apr_pstrdup(doc->buf.pool, val);
2197 else if (STRCASEEQ('m','M',"multiple",nm)) {
2198 /* CHTML version 2.0 */
2218 * It is a handler who processes the SELECT tag.
2220 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2221 * destination is specified.
2222 * @param node [i] The SELECT tag node is specified.
2223 * @return The conversion result is returned.
2226 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
2228 xhtml_t *xhtml = GET_XHTML(pdoc);
2229 Doc *doc = xhtml->doc;
2237 * It is a handler who processes the OPTION tag.
2239 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2240 * destination is specified.
2241 * @param node [i] The OPTION tag node is specified.
2242 * @return The conversion result is returned.
2245 s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
2247 xhtml_t *xhtml = GET_XHTML(pdoc);
2248 Doc *doc = xhtml->doc;
2251 char *selected = NULL;
2255 for (attr = qs_get_attr(doc,child);
2257 attr = qs_get_next_attr(doc,attr)) {
2258 char *nm = qs_get_attr_name(doc,attr);
2259 char *val = qs_get_attr_value(doc,attr);
2260 if (STRCASEEQ('s','S',"selected",nm)) {
2261 /* CHTML version 2.0 */
2262 selected = apr_pstrdup(doc->buf.pool, val);
2264 else if (STRCASEEQ('v','V',"value",nm)) {
2265 /* CHTML version 2.0 */
2266 value = apr_pstrdup(doc->buf.pool, val);
2278 W_L(" selected=\"selected\"");
2286 * It is a handler who processes the OPTION tag.
2288 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2289 * destination is specified.
2290 * @param node [i] The OPTION tag node is specified.
2291 * @return The conversion result is returned.
2294 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
2296 xhtml_t *xhtml = GET_XHTML(pdoc);
2297 Doc *doc = xhtml->doc;
2305 * It is a handler who processes the DIV tag.
2307 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2308 * destination is specified.
2309 * @param node [i] The DIV tag node is specified.
2310 * @return The conversion result is returned.
2313 s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
2315 xhtml_t *xhtml = GET_XHTML(pdoc);
2316 Doc *doc = xhtml->doc;
2321 for (attr = qs_get_attr(doc,child);
2323 attr = qs_get_next_attr(doc,attr)) {
2324 char *nm = qs_get_attr_name(doc,attr);
2325 char *val = qs_get_attr_value(doc,attr);
2326 if (STRCASEEQ('a','A',"align",nm)) {
2327 /*=====================================================================*/
2328 /* CHTML version 3.2 */
2329 /*=====================================================================*/
2330 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2331 align = apr_pstrdup(doc->buf.pool, val);
2346 * It is a handler who processes the DIV tag.
2348 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2349 * destination is specified.
2350 * @param node [i] The DIV tag node is specified.
2351 * @return The conversion result is returned.
2354 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
2356 xhtml_t *xhtml = GET_XHTML(pdoc);
2357 Doc *doc = xhtml->doc;
2364 * It is a handler who processes the B tag.
2366 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2367 * destination is specified.
2368 * @param node [i] The B tag node is specified.
2369 * @return The conversion result is returned.
2372 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
2374 xhtml_t *xhtml = GET_XHTML(pdoc);
2375 Doc *doc = xhtml->doc;
2377 W_L("<div style=\"font-weight:bold\">");
2383 * It is a handler who processes the B tag.
2385 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2386 * destination is specified.
2387 * @param node [i] The B tag node is specified.
2388 * @return The conversion result is returned.
2391 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
2393 xhtml_t *xhtml = GET_XHTML(pdoc);
2394 Doc *doc = xhtml->doc;
2402 * It is a handler who processes the CHXJ:IF tag.
2404 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2405 * destination is specified.
2406 * @param node [i] The CHXJ:IF tag node is specified.
2409 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
2411 xhtml_t *xhtml = GET_XHTML(pdoc);
2412 Doc *doc = xhtml->doc;
2415 for (child = qs_get_child_node(doc, node);
2417 child = qs_get_next_node(doc, child)) {
2419 s_xhtml_1_0_chxjif_tag(xhtml, child);
2427 * It is a handler who processes the TEXTARE tag.
2429 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2430 * destination is specified.
2431 * @param node [i] The TEXTAREA tag node is specified.
2432 * @return The conversion result is returned.
2435 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
2437 xhtml_t *xhtml = GET_XHTML(pdoc);
2438 Doc *doc = xhtml->doc;
2441 xhtml->textarea_flag++;
2443 for (attr = qs_get_attr(doc,node);
2445 attr = qs_get_next_attr(doc,attr)) {
2446 char *name = qs_get_attr_name(doc,attr);
2447 char *value = qs_get_attr_value(doc,attr);
2448 if (STRCASEEQ('n','N',"name",name)) {
2453 else if (STRCASEEQ('r','R',"rows",name)) {
2458 else if (STRCASEEQ('c','C',"cols",name)) {
2470 * It is a handler who processes the TEXTAREA tag.
2472 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2473 * destination is specified.
2474 * @param node [i] The TEXTAREA tag node is specified.
2475 * @return The conversion result is returned.
2478 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2480 xhtml_t *xhtml = GET_XHTML(pdoc);
2481 Doc *doc = xhtml->doc;
2483 W_L("</textarea>\r\n");
2484 xhtml->textarea_flag--;
2490 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
2492 xhtml_t *xhtml = GET_XHTML(pdoc);
2493 Doc *doc = xhtml->doc;
2494 request_rec *r = doc->r;
2502 textval = qs_get_node_value(doc,child);
2503 textval = qs_trim_string(doc->buf.pool, textval);
2504 if (strlen(textval) == 0)
2507 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2508 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2510 tdst = qs_alloc_zero_byte_string(r);
2511 memset(one_byte, 0, sizeof(one_byte));
2514 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2516 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
2518 DBG(r,"[%s][%d]", out, rtn);
2519 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2523 if (is_sjis_kanji(textval[ii])) {
2524 one_byte[0] = textval[ii+0];
2525 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2526 one_byte[0] = textval[ii+1];
2527 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2530 else if (xhtml->pre_flag) {
2531 one_byte[0] = textval[ii+0];
2532 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2534 else if (xhtml->textarea_flag) {
2535 one_byte[0] = textval[ii+0];
2536 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2538 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2539 one_byte[0] = textval[ii+0];
2540 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2549 * It is a handler who processes the BLOCKQUOTE tag.
2551 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2552 * destination is specified.
2553 * @param node [i] The BLOCKQUOTE tag node is specified.
2554 * @return The conversion result is returned.
2557 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2559 xhtml_t *xhtml = GET_XHTML(pdoc);
2560 Doc *doc = xhtml->doc;
2561 W_L("<blockquote>");
2567 * It is a handler who processes the BLOCKQUOTE tag.
2569 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2570 * destination is specified.
2571 * @param node [i] The BLOCKQUOTE tag node is specified.
2572 * @return The conversion result is returned.
2575 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2577 xhtml_t *xhtml = GET_XHTML(pdoc);
2578 Doc *doc = xhtml->doc;
2579 W_L("</blockquote>");
2585 * It is a handler who processes the DIR tag.
2587 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2588 * destination is specified.
2589 * @param node [i] The DIR tag node is specified.
2590 * @return The conversion result is returned.
2593 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *UNUSED(child))
2595 xhtml_t *xhtml = GET_XHTML(pdoc);
2596 Doc *doc = xhtml->doc;
2603 * It is a handler who processes the DIR tag.
2605 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2606 * destination is specified.
2607 * @param node [i] The DIR tag node is specified.
2608 * @return The conversion result is returned.
2611 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
2613 xhtml_t *xhtml = GET_XHTML(pdoc);
2614 Doc *doc = xhtml->doc;
2621 * It is a handler who processes the DL tag.
2623 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2624 * destination is specified.
2625 * @param node [i] The DL tag node is specified.
2626 * @return The conversion result is returned.
2629 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
2631 xhtml_t *xhtml = GET_XHTML(pdoc);
2632 Doc *doc = xhtml->doc;
2639 * It is a handler who processes the DL tag.
2641 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2642 * destination is specified.
2643 * @param node [i] The DL tag node is specified.
2644 * @return The conversion result is returned.
2647 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
2649 xhtml_t *xhtml = GET_XHTML(pdoc);
2650 Doc *doc = xhtml->doc;
2657 * It is a handter who processes the DT tag.
2659 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2660 * destination is specified.
2661 * @param node [i] The DT tag node is specified.
2662 * @return The conversion result is returned.
2665 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *UNUSED(child))
2667 xhtml_t *xhtml = GET_XHTML(pdoc);
2668 Doc *doc = xhtml->doc;
2675 * It is a handter who processes the DT tag.
2677 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2678 * destination is specified.
2679 * @param node [i] The DT tag node is specified.
2680 * @return The conversion result is returned.
2683 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
2685 xhtml_t *xhtml = GET_XHTML(pdoc);
2686 Doc *doc = xhtml->doc;
2693 * It is a handder who processes the DD tag.
2695 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2696 * destination is specified.
2697 * @param node [i] The DD tag node is specified.
2698 * @return The conversion result is returned.
2701 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *UNUSED(child))
2703 xhtml_t *xhtml = GET_XHTML(pdoc);
2704 Doc *doc = xhtml->doc;
2711 * It is a handder who processes the DD tag.
2713 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2714 * destination is specified.
2715 * @param node [i] The DD tag node is specified.
2716 * @return The conversion result is returned.
2719 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
2721 xhtml_t *xhtml = GET_XHTML(pdoc);
2722 Doc *doc = xhtml->doc;