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"
25 #include "chxj_str_util.h"
27 #define GET_XHTML(X) ((xhtml_t*)(X))
30 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
31 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
32 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
34 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
35 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
36 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
37 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
38 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node);
98 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
110 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
111 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
112 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
115 tag_handler xhtml_handler[] = {
118 s_xhtml_1_0_start_html_tag,
119 s_xhtml_1_0_end_html_tag,
123 s_xhtml_1_0_start_meta_tag,
124 s_xhtml_1_0_end_meta_tag,
128 s_xhtml_1_0_start_textarea_tag,
129 s_xhtml_1_0_end_textarea_tag,
133 s_xhtml_1_0_start_p_tag,
134 s_xhtml_1_0_end_p_tag,
138 s_xhtml_1_0_start_pre_tag,
139 s_xhtml_1_0_end_pre_tag,
143 s_xhtml_1_0_start_ul_tag,
144 s_xhtml_1_0_end_ul_tag,
148 s_xhtml_1_0_start_li_tag,
149 s_xhtml_1_0_end_li_tag,
153 s_xhtml_1_0_start_ol_tag,
154 s_xhtml_1_0_end_ol_tag,
158 s_xhtml_1_0_start_h1_tag,
159 s_xhtml_1_0_end_h1_tag,
163 s_xhtml_1_0_start_h2_tag,
164 s_xhtml_1_0_end_h2_tag,
168 s_xhtml_1_0_start_h3_tag,
169 s_xhtml_1_0_end_h3_tag,
173 s_xhtml_1_0_start_h4_tag,
174 s_xhtml_1_0_end_h4_tag,
178 s_xhtml_1_0_start_h5_tag,
179 s_xhtml_1_0_end_h5_tag,
183 s_xhtml_1_0_start_h6_tag,
184 s_xhtml_1_0_end_h6_tag,
188 s_xhtml_1_0_start_head_tag,
189 s_xhtml_1_0_end_head_tag,
193 s_xhtml_1_0_start_title_tag,
194 s_xhtml_1_0_end_title_tag,
198 s_xhtml_1_0_start_base_tag,
199 s_xhtml_1_0_end_base_tag,
203 s_xhtml_1_0_start_body_tag,
204 s_xhtml_1_0_end_body_tag,
208 s_xhtml_1_0_start_a_tag,
209 s_xhtml_1_0_end_a_tag,
213 s_xhtml_1_0_start_br_tag,
214 s_xhtml_1_0_end_br_tag,
223 s_xhtml_1_0_start_tr_tag,
224 s_xhtml_1_0_end_tr_tag,
238 s_xhtml_1_0_start_font_tag,
239 s_xhtml_1_0_end_font_tag,
243 s_xhtml_1_0_start_form_tag,
244 s_xhtml_1_0_end_form_tag,
248 s_xhtml_1_0_start_input_tag,
249 s_xhtml_1_0_end_input_tag,
253 s_xhtml_1_0_start_center_tag,
254 s_xhtml_1_0_end_center_tag,
258 s_xhtml_1_0_start_hr_tag,
259 s_xhtml_1_0_end_hr_tag,
263 s_xhtml_1_0_start_img_tag,
264 s_xhtml_1_0_end_img_tag,
268 s_xhtml_1_0_start_select_tag,
269 s_xhtml_1_0_end_select_tag,
273 s_xhtml_1_0_start_option_tag,
274 s_xhtml_1_0_end_option_tag,
278 s_xhtml_1_0_start_div_tag,
279 s_xhtml_1_0_end_div_tag,
283 s_xhtml_1_0_chxjif_tag,
308 s_xhtml_1_0_text_tag,
318 s_xhtml_1_0_start_b_tag,
319 s_xhtml_1_0_end_b_tag,
328 s_xhtml_1_0_start_dt_tag,
329 s_xhtml_1_0_end_dt_tag,
343 s_xhtml_1_0_start_blockquote_tag,
344 s_xhtml_1_0_end_blockquote_tag,
348 s_xhtml_1_0_start_dir_tag,
349 s_xhtml_1_0_end_dir_tag,
353 s_xhtml_1_0_start_dl_tag,
354 s_xhtml_1_0_end_dl_tag,
358 s_xhtml_1_0_start_dd_tag,
359 s_xhtml_1_0_end_dd_tag,
363 s_xhtml_1_0_start_menu_tag,
364 s_xhtml_1_0_end_menu_tag,
384 * converts from CHTML to XHTML.
386 * @param r [i] Requet_rec is appointed.
387 * @param spec [i] The result of the device specification processing which
388 * was done in advance is appointed.
389 * @param src [i] The character string before the converting is appointed.
390 * @return The character string after the converting is returned.
393 chxj_exchange_xhtml_mobile_1_0(
399 chxjconvrule_entry *entryp,
400 cookie_t *UNUSED(cookie)
408 DBG(r,"start chxj_exchange_xhtml_mobile_1_0()");
409 /*--------------------------------------------------------------------------*/
411 /*--------------------------------------------------------------------------*/
413 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
415 DBG(r,"end chxj_exchange_xhtml_mobile_1_0() (found qrcode.xml)");
419 /*--------------------------------------------------------------------------*/
420 /* The XHTML structure is initialized. */
421 /*--------------------------------------------------------------------------*/
422 s_init_xhtml(&xhtml, &doc, r, spec);
424 xhtml.entryp = entryp;
426 chxj_set_content_type(r, "text/html; charset=Windows-31J");
428 /*--------------------------------------------------------------------------*/
429 /* The character string of the input is analyzed. */
430 /*--------------------------------------------------------------------------*/
431 qs_init_malloc(&doc);
432 qs_init_root_node(&doc);
434 ss = apr_pcalloc(r->pool, srclen + 1);
435 memset(ss, 0, srclen + 1);
436 memcpy(ss, src, srclen);
439 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
441 qs_parse_string(&doc,ss, strlen(ss));
443 chxj_buffered_write_init(r->pool, &doc.buf);
444 /*--------------------------------------------------------------------------*/
445 /* It converts it from CHTML to XHTML. */
446 /*--------------------------------------------------------------------------*/
447 chxj_node_exchange(spec,r,(void*)&xhtml, &doc, qs_get_root(&doc), 0);
448 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
449 dst = apr_pstrdup(r->pool, xhtml.out);
450 chxj_buffered_write_terminate(&doc.buf);
452 qs_all_free(&doc,QX_LOGMARK);
455 return apr_pstrdup(r->pool,ss);
459 dst = apr_psprintf(r->pool, "\n");
461 *dstlen = strlen(dst);
464 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
467 DBG(r,"end chxj_exchange_xhtml_mobile_1_0()");
473 * The XHTML structure is initialized.
475 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
476 * initialized is specified.
477 * @param doc [i] The Doc structure that should be set to the initialized
478 * HDML structure is specified.
479 * @param r [i] To use POOL, the pointer to request_rec is specified.
480 * @param spec [i] The pointer to the device_table
483 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
485 memset(doc, 0, sizeof(Doc));
486 memset(xhtml, 0, sizeof(xhtml_t));
491 xhtml->out = qs_alloc_zero_byte_string(r);
492 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
493 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
498 * Corresponding EMOJI to a current character-code is retrieved.
499 * The substitution character string is stored in the rslt pointer if agreeing.
501 * @param xhtml [i] The pointer to the XHTML structure is specified.
502 * @param txt [i] The character string to want to examine whether it is
503 * EMOJI is specified.
504 * @param rslt [o] The pointer to the pointer that stores the result is
506 * @return When corresponding EMOJI exists, it returns it excluding 0.
509 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
522 DBG(r,"spec is NULL");
525 for (ee = xhtml->conf->emoji;
528 unsigned char hex1byte;
529 unsigned char hex2byte;
531 DBG(r,"emoji->imode is NULL");
535 if (ee->imode->string != NULL
536 && strlen(ee->imode->string) > 0
537 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
538 if (spec == NULL || spec->emoji_type == NULL) {
539 *rslt = apr_psprintf(r->pool,
542 return strlen(ee->imode->string);
545 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
546 *rslt = apr_psprintf(r->pool,
549 return strlen(ee->imode->string);
552 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
553 *rslt = apr_psprintf(r->pool,
556 return strlen(ee->imode->string);
559 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
560 *rslt = apr_psprintf(r->pool,
563 return strlen(ee->imode->string);
566 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
567 *rslt = apr_psprintf(r->pool,
570 return strlen(ee->imode->string);
573 *rslt = apr_psprintf(r->pool,
576 return strlen(ee->imode->string);
580 hex1byte = ee->imode->hex1byte & 0xff;
581 hex2byte = ee->imode->hex2byte & 0xff;
583 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
584 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
585 if (spec == NULL || spec->emoji_type == NULL) {
586 *rslt = apr_psprintf(r->pool,
587 "<img localsrc=\"%s\">",
592 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
593 *rslt = apr_psprintf(r->pool,
594 "<img localsrc=\"%s\">",
599 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
600 *rslt = apr_psprintf(r->pool,
601 "<img localsrc=\"%s\">",
606 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
607 *rslt = apr_psprintf(r->pool,
608 "<img localsrc=\"%s\">",
613 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
614 *rslt = apr_psprintf(r->pool,
615 "<img localsrc=\"%s\">",
620 *rslt = apr_psprintf(r->pool,
621 "<img localsrc=\"%s\">",
633 * It is a handler who processes the HTML tag.
635 * @param pdoc [i/o] The pointer to the XHTML structure at the output
636 * destination is specified.
637 * @param node [i] The HTML tag node is specified.
638 * @return The conversion result is returned.
641 s_xhtml_1_0_start_html_tag(void *pdoc, Node *node)
643 xhtml_t *xhtml = GET_XHTML(pdoc);
645 Doc *doc = xhtml->doc;
647 /*--------------------------------------------------------------------------*/
648 /* Add XML Declare */
649 /*--------------------------------------------------------------------------*/
650 W_L("<?xml version=\"1.0\" encoding=\"Windows-31J\"?>\r\n");
651 /*--------------------------------------------------------------------------*/
653 /*--------------------------------------------------------------------------*/
654 W_L("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"\r\n");
655 W_L(" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">\r\n");
656 /*--------------------------------------------------------------------------*/
658 /*--------------------------------------------------------------------------*/
659 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\"");
660 /*--------------------------------------------------------------------------*/
662 /*--------------------------------------------------------------------------*/
663 for (attr = qs_get_attr(doc,node);
665 attr = qs_get_next_attr(doc,attr)) {
666 char* name = qs_get_attr_name(doc,attr);
667 char* value = qs_get_attr_value(doc,attr);
668 if (STRCASEEQ('l','L',"lang", name)) {
673 else if (STRCASEEQ('v','V',"version", name)) {
674 W_L(" version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"");
683 * It is a handler who processes the HTML tag.
685 * @param pdoc [i/o] The pointer to the XHTML structure at the output
686 * destination is specified.
687 * @param node [i] The HTML tag node is specified.
688 * @return The conversion result is returned.
691 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
693 xhtml_t *xhtml = GET_XHTML(pdoc);
694 Doc *doc = xhtml->doc;
701 * It is a handler who processes the META tag.
703 * @param pdoc [i/o] The pointer to the XHTML structure at the output
704 * destination is specified.
705 * @param node [i] The META tag node is specified.
706 * @return The conversion result is returned.
709 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
711 xhtml_t *xhtml = GET_XHTML(pdoc);
713 Doc *doc = xhtml->doc;
714 int content_type_flag = 0;
717 /*--------------------------------------------------------------------------*/
719 /*--------------------------------------------------------------------------*/
720 for (attr = qs_get_attr(doc,node);
722 attr = qs_get_next_attr(doc,attr)) {
723 char *name = qs_get_attr_name(doc,attr);
724 char *value = qs_get_attr_value(doc,attr);
725 if (STRCASEEQ('n','N',"name", name)) {
732 else if (STRCASEEQ('h','H',"http-equiv", name)) {
738 if (STRCASEEQ('c','C', "content-type", value)) {
739 content_type_flag = 1;
742 else if (STRCASEEQ('c','C',"content", name)) {
743 if (content_type_flag) {
747 W_L("text/html; charset=Windows-31J");
765 * It is a handler who processes the META tag.
767 * @param pdoc [i/o] The pointer to the XHTML structure at the output
768 * destination is specified.
769 * @param node [i] The META tag node is specified.
770 * @return The conversion result is returned.
773 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
775 xhtml_t *xhtml = GET_XHTML(pdoc);
782 * It is a handler who processes the HEAD tag.
784 * @param pdoc [i/o] The pointer to the XHTML structure at the output
785 * destination is specified.
786 * @param node [i] The HEAD tag node is specified.
787 * @return The conversion result is returned.
790 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
792 xhtml_t *xhtml = GET_XHTML(pdoc);
793 Doc *doc = xhtml->doc;
801 * It is a handler who processes the HEAD tag.
803 * @param pdoc [i/o] The pointer to the XHTML structure at the output
804 * destination is specified.
805 * @param node [i] The HEAD tag node is specified.
806 * @return The conversion result is returned.
809 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
811 xhtml_t *xhtml = GET_XHTML(pdoc);
812 Doc *doc = xhtml->doc;
820 * It is a handler who processes the TITLE tag.
822 * @param pdoc [i/o] The pointer to the XHTML structure at the output
823 * destination is specified.
824 * @param node [i] The TITLE tag node is specified.
825 * @return The conversion result is returned.
828 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
830 xhtml_t *xhtml = GET_XHTML(pdoc);
831 Doc *doc = xhtml->doc;
839 * It is a handler who processes the TITLE tag.
841 * @param pdoc [i/o] The pointer to the XHTML structure at the output
842 * destination is specified.
843 * @param node [i] The TITLE tag node is specified.
844 * @return The conversion result is returned.
847 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
849 xhtml_t *xhtml = GET_XHTML(pdoc);
850 Doc *doc = xhtml->doc;
858 * It is a handler who processes the BASE tag.
860 * @param pdoc [i/o] The pointer to the XHTML structure at the output
861 * destination is specified.
862 * @param node [i] The BASE tag node is specified.
863 * @return The conversion result is returned.
866 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
868 xhtml_t *xhtml = GET_XHTML(pdoc);
870 Doc *doc = xhtml->doc;
873 /*--------------------------------------------------------------------------*/
875 /*--------------------------------------------------------------------------*/
876 for (attr = qs_get_attr(doc,node);
878 attr = qs_get_next_attr(doc,attr)) {
879 char *name = qs_get_attr_name(doc,attr);
880 char *value = qs_get_attr_value(doc,attr);
881 if (STRCASEEQ('h','H',"href",name)) {
894 * It is a handler who processes the BASE tag.
896 * @param pdoc [i/o] The pointer to the XHTML structure at the output
897 * destination is specified.
898 * @param node [i] The BASE tag node is specified.
899 * @return The conversion result is returned.
902 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
904 xhtml_t *xhtml = GET_XHTML(pdoc);
911 * It is a handler who processes the BODY tag.
913 * @param pdoc [i/o] The pointer to the XHTML structure at the output
914 * destination is specified.
915 * @param node [i] The BODY tag node is specified.
916 * @return The conversion result is returned.
919 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
921 xhtml_t *xhtml = GET_XHTML(pdoc);
922 Doc *doc = xhtml->doc;
926 /*--------------------------------------------------------------------------*/
928 /*--------------------------------------------------------------------------*/
929 for (attr = qs_get_attr(doc,node);
931 attr = qs_get_next_attr(doc,attr)) {
932 char *name = qs_get_attr_name(doc,attr);
933 char *value = qs_get_attr_value(doc,attr);
934 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
939 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
944 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
949 else if (STRCASEEQ('a','A',"alink", name)) {
952 else if (STRCASEEQ('v','V',"vlink",name)) {
962 * It is a handler who processes the BODY tag.
964 * @param pdoc [i/o] The pointer to the XHTML structure at the output
965 * destination is specified.
966 * @param node [i] The BODY tag node is specified.
967 * @return The conversion result is returned.
970 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
972 xhtml_t *xhtml = GET_XHTML(pdoc);
973 Doc *doc = xhtml->doc;
981 * It is a handler who processes the A tag.
983 * @param pdoc [i/o] The pointer to the XHTML structure at the output
984 * destination is specified.
985 * @param node [i] The A tag node is specified.
986 * @return The conversion result is returned.
989 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
991 xhtml_t *xhtml = GET_XHTML(pdoc);
992 Doc *doc = xhtml->doc;
993 request_rec *r = doc->r;
997 /*--------------------------------------------------------------------------*/
999 /*--------------------------------------------------------------------------*/
1000 for (attr = qs_get_attr(doc,node);
1002 attr = qs_get_next_attr(doc,attr)) {
1003 char* name = qs_get_attr_name(doc,attr);
1004 char* value = qs_get_attr_value(doc,attr);
1005 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1010 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1011 value = chxj_encoding_parameter(r, value);
1016 else if (STRCASEEQ('a','A',"accesskey", name)) {
1017 W_L(" accesskey=\"");
1021 else if (STRCASEEQ('c','C',"cti",name)) {
1024 else if (STRCASEEQ('i','I',"ijam", name)) {
1027 else if (STRCASEEQ('u','U',"utn", name)) {
1030 else if (STRCASEEQ('t','T',"telbook",name)) {
1033 else if (STRCASEEQ('k','K',"kana",name)) {
1036 else if (STRCASEEQ('e','E',"email",name)) {
1039 else if (STRCASEEQ('i','I',"ista",name)) {
1042 else if (STRCASEEQ('i','I',"ilet",name)) {
1045 else if (STRCASEEQ('i','I',"iswf",name)) {
1048 else if (STRCASEEQ('i','I',"irst",name)) {
1058 * It is a handler who processes the A tag.
1060 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1061 * destination is specified.
1062 * @param node [i] The A tag node is specified.
1063 * @return The conversion result is returned.
1066 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1068 xhtml_t *xhtml = GET_XHTML(pdoc);
1069 Doc *doc = xhtml->doc;
1077 * It is a handler who processes the BR tag.
1079 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1080 * destination is specified.
1081 * @param node [i] The BR tag node is specified.
1082 * @return The conversion result is returned.
1085 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1087 xhtml_t *xhtml = GET_XHTML(pdoc);
1088 Doc *doc = xhtml->doc;
1092 /*--------------------------------------------------------------------------*/
1093 /* Get Attributes */
1094 /*--------------------------------------------------------------------------*/
1095 for (attr = qs_get_attr(doc,node);
1097 attr = qs_get_next_attr(doc,attr)) {
1098 char *name = qs_get_attr_name(doc,attr);
1099 char *value = qs_get_attr_value(doc,attr);
1100 if (STRCASEEQ('c','C',"clear",name)) {
1101 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1114 * It is a handler who processes the BR tag.
1116 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1117 * destination is specified.
1118 * @param node [i] The BR tag node is specified.
1119 * @return The conversion result is returned.
1122 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1124 xhtml_t *xhtml = GET_XHTML(pdoc);
1131 * It is a handler who processes the TR tag.
1133 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1134 * destination is specified.
1135 * @param node [i] The TR tag node is specified.
1136 * @return The conversion result is returned.
1139 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1141 xhtml_t *xhtml = GET_XHTML(pdoc);
1142 Doc *doc = xhtml->doc;
1150 * It is a handler who processes the TR tag.
1152 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1153 * destination is specified.
1154 * @param node [i] The TR tag node is specified.
1155 * @return The conversion result is returned.
1158 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1160 xhtml_t *xhtml = GET_XHTML(pdoc);
1167 * It is a handler who processes the FONT tag.
1169 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1170 * destination is specified.
1171 * @param node [i] The FONT tag node is specified.
1172 * @return The conversion result is returned.
1175 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1177 xhtml_t *xhtml = GET_XHTML(pdoc);
1178 Doc *doc = xhtml->doc;
1182 /*=========================================================================*/
1183 /* Get Attributes */
1184 /*=========================================================================*/
1185 for (attr = qs_get_attr(doc,node);
1187 attr = qs_get_next_attr(doc,attr)) {
1188 char *name = qs_get_attr_name(doc,attr);
1189 char *value = qs_get_attr_value(doc,attr);
1190 if (STRCASEEQ('c','C',"color",name)) {
1195 else if (STRCASEEQ('s','S',"size",name)) {
1207 * It is a handler who processes the FONT tag.
1209 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1210 * destination is specified.
1211 * @param node [i] The FONT tag node is specified.
1212 * @return The conversion result is returned.
1215 s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child))
1217 xhtml_t *xhtml = GET_XHTML(pdoc);
1218 Doc *doc = xhtml->doc;
1226 * It is a handler who processes the FORM tag.
1228 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1229 * destination is specified.
1230 * @param node [i] The FORM tag node is specified.
1231 * @return The conversion result is returned.
1234 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1236 xhtml_t *xhtml = GET_XHTML(pdoc);
1237 Doc *doc = xhtml->doc;
1238 request_rec *r = doc->r;
1242 /*--------------------------------------------------------------------------*/
1243 /* Get Attributes */
1244 /*--------------------------------------------------------------------------*/
1245 for (attr = qs_get_attr(doc,node);
1247 attr = qs_get_next_attr(doc,attr)) {
1248 char *name = qs_get_attr_name(doc,attr);
1249 char *value = qs_get_attr_value(doc,attr);
1250 if (STRCASEEQ('a','A',"action",name)) {
1251 value = chxj_encoding_parameter(r, value);
1256 else if (STRCASEEQ('m','M',"method",name)) {
1261 else if (STRCASEEQ('u','U',"utn",name)) {
1271 * It is a handler who processes the FORM tag.
1273 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1274 * destination is specified.
1275 * @param node [i] The FORM tag node is specified.
1276 * @return The conversion result is returned.
1279 s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child))
1281 xhtml_t *xhtml = GET_XHTML(pdoc);
1282 Doc *doc = xhtml->doc;
1290 * It is a handler who processes the INPUT tag.
1292 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1293 * destination is specified.
1294 * @param node [i] The INPUT tag node is specified.
1295 * @return The conversion result is returned.
1298 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1300 xhtml_t *xhtml = GET_XHTML(pdoc);
1301 Doc *doc = xhtml->doc;
1302 request_rec *r = doc->r;
1303 char *max_length = NULL;
1307 char *istyle = NULL;
1309 char *checked = NULL;
1310 char *accesskey = NULL;
1313 /*--------------------------------------------------------------------------*/
1314 /* Get Attributes */
1315 /*--------------------------------------------------------------------------*/
1316 type = qs_get_type_attr(doc, node, r);
1317 name = qs_get_name_attr(doc, node, r);
1318 value = qs_get_value_attr(doc,node,r);
1319 istyle = qs_get_istyle_attr(doc,node,r);
1320 max_length = qs_get_maxlength_attr(doc,node,r);
1321 checked = qs_get_checked_attr(doc,node,r);
1322 accesskey = qs_get_accesskey_attr(doc, node, r);
1323 size = qs_get_size_attr(doc, node, r);
1326 type = qs_trim_string(doc->buf.pool, type);
1327 if (type && (STRCASEEQ('t','T',"text", type) ||
1328 STRCASEEQ('p','P',"password",type) ||
1329 STRCASEEQ('c','C',"checkbox",type) ||
1330 STRCASEEQ('r','R',"radio", type) ||
1331 STRCASEEQ('h','H',"hidden", type) ||
1332 STRCASEEQ('s','S',"submit", type) ||
1333 STRCASEEQ('r','R',"reset", type))) {
1339 if (size && *size) {
1344 if (name && *name) {
1349 if (value && *value) {
1354 if (accesskey && *accesskey) {
1355 W_L(" accesskey=\"");
1359 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1360 char *fmt = qs_conv_istyle_to_format(r,istyle);
1361 if (max_length && *max_length) {
1363 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1364 if (max_length[ii] < '0' || max_length[ii] > '9') {
1365 max_length = apr_psprintf(r->pool, "0");
1370 if (strcmp(max_length, "0")) {
1371 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1383 if (max_length && *max_length) {
1384 if (chxj_chk_numeric(max_length) != 0) {
1385 max_length = apr_psprintf(r->pool, "0");
1387 if (strcmp(max_length, "0")) {
1388 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1393 /*--------------------------------------------------------------------------*/
1394 /* The figure is default for the password. */
1395 /*--------------------------------------------------------------------------*/
1396 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1403 W_L(" FORMAT=\"*N\"");
1407 W_L(" checked=\"checked\"");
1415 * It is a handler who processes the INPUT tag.
1417 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1418 * destination is specified.
1419 * @param node [i] The INPUT tag node is specified.
1420 * @return The conversion result is returned.
1423 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1425 xhtml_t *xhtml = GET_XHTML(pdoc);
1432 * It is a handler who processes the CENTER tag.
1434 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1435 * destination is specified.
1436 * @param node [i] The CENTER tag node is specified.
1437 * @return The conversion result is returned.
1440 s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node))
1442 xhtml_t *xhtml = GET_XHTML(pdoc);
1443 Doc *doc = xhtml->doc;
1451 * It is a handler who processes the CENTER tag.
1453 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1454 * destination is specified.
1455 * @param node [i] The CENTER tag node is specified.
1456 * @return The conversion result is returned.
1459 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child))
1461 xhtml_t *xhtml = GET_XHTML(pdoc);
1462 Doc *doc = xhtml->doc;
1470 * It is a handler who processes the HR tag.
1472 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1473 * destination is specified.
1474 * @param node [i] The HR tag node is specified.
1475 * @return The conversion result is returned.
1478 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
1480 xhtml_t *xhtml = GET_XHTML(pdoc);
1481 Doc *doc = xhtml->doc;
1486 for (attr = qs_get_attr(doc,node);
1488 attr = qs_get_next_attr(doc,attr)) {
1489 char *name = qs_get_attr_name(doc,attr);
1490 char *value = qs_get_attr_value(doc,attr);
1491 if (STRCASEEQ('a','A',"align", name)) {
1492 /*----------------------------------------------------------------------*/
1494 /*----------------------------------------------------------------------*/
1495 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1501 else if (STRCASEEQ('s','S',"size", name)) {
1502 /*----------------------------------------------------------------------*/
1504 /*----------------------------------------------------------------------*/
1505 if (value && *value) {
1511 else if (STRCASEEQ('w','W',"width", name)) {
1512 /*----------------------------------------------------------------------*/
1514 /*----------------------------------------------------------------------*/
1515 if (value && *value) {
1521 else if (STRCASEEQ('n','N',"noshade", name)) {
1522 /*----------------------------------------------------------------------*/
1524 /*----------------------------------------------------------------------*/
1527 else if (STRCASEEQ('c','C',"color", name)) {
1528 /*----------------------------------------------------------------------*/
1530 /*----------------------------------------------------------------------*/
1540 * It is a handler who processes the HR tag.
1542 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1543 * destination is specified.
1544 * @param node [i] The HR tag node is specified.
1545 * @return The conversion result is returned.
1548 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
1550 xhtml_t *xhtml = GET_XHTML(pdoc);
1557 * It is a handler who processes the PRE tag.
1559 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1560 * destination is specified.
1561 * @param node [i] The PRE tag node is specified.
1562 * @return The conversion result is returned.
1565 s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node))
1567 xhtml_t *xhtml = GET_XHTML(pdoc);
1568 Doc *doc = xhtml->doc;
1577 * It is a handler who processes the PRE tag.
1579 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1580 * destination is specified.
1581 * @param node [i] The PRE tag node is specified.
1582 * @return The conversion result is returned.
1585 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
1587 xhtml_t *xhtml = GET_XHTML(pdoc);
1588 Doc *doc = xhtml->doc;
1598 * It is a handler who processes the P tag.
1600 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1601 * destination is specified.
1602 * @param node [i] The P tag node is specified.
1603 * @return The conversion result is returned.
1606 s_xhtml_1_0_start_p_tag(void *pdoc, Node *UNUSED(node))
1608 xhtml_t *xhtml = GET_XHTML(pdoc);
1609 Doc *doc = xhtml->doc;
1617 * It is a handler who processes the P tag.
1619 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1620 * destination is specified.
1621 * @param node [i] The P tag node is specified.
1622 * @return The conversion result is returned.
1625 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
1627 xhtml_t *xhtml = GET_XHTML(pdoc);
1628 Doc *doc = xhtml->doc;
1636 * It is a handler who processes the UL tag.
1638 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1639 * destination is specified.
1640 * @param node [i] The UL tag node is specified.
1641 * @return The conversion result is returned.
1644 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *UNUSED(node))
1646 xhtml_t *xhtml = GET_XHTML(pdoc);
1647 Doc *doc = xhtml->doc;
1655 * It is a handler who processes the UL tag.
1657 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1658 * destination is specified.
1659 * @param node [i] The UL tag node is specified.
1660 * @return The conversion result is returned.
1663 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
1665 xhtml_t *xhtml = GET_XHTML(pdoc);
1666 Doc *doc = xhtml->doc;
1674 * It is a handler who processes the H1 tag.
1676 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1677 * destination is specified.
1678 * @param node [i] The H1 tag node is specified.
1679 * @return The conversion result is returned.
1682 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
1684 xhtml_t *xhtml = GET_XHTML(pdoc);
1685 Doc *doc = xhtml->doc;
1689 for (attr = qs_get_attr(doc,node);
1691 attr = qs_get_next_attr(doc,attr)) {
1694 name = qs_get_attr_name(doc,attr);
1695 value = qs_get_attr_value(doc,attr);
1696 if (STRCASEEQ('a','A',"align", name)) {
1698 if (STRCASEEQ('l','L',"left",value)) {
1700 W_L("text-align:left");
1703 else if (STRCASEEQ('r','R',"right",value)) {
1705 W_L("text-align:right");
1708 else if (STRCASEEQ('c','C',"center",value)) {
1710 W_L("text-align:center");
1723 * It is a handler who processes the H1 tag.
1725 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1726 * destination is specified.
1727 * @param node [i] The H1 tag node is specified.
1728 * @return The conversion result is returned.
1731 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
1733 xhtml_t *xhtml = GET_XHTML(pdoc);
1734 Doc *doc = xhtml->doc;
1742 * It is a handler who processes the H2 tag.
1744 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1745 * destination is specified.
1746 * @param node [i] The H2 tag node is specified.
1747 * @return The conversion result is returned.
1750 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
1752 xhtml_t *xhtml = GET_XHTML(pdoc);
1753 Doc *doc = xhtml->doc;
1757 for (attr = qs_get_attr(doc,node);
1759 attr = qs_get_next_attr(doc,attr)) {
1762 name = qs_get_attr_name(doc,attr);
1763 value = qs_get_attr_value(doc,attr);
1764 if (STRCASEEQ('a','A',"align", name)) {
1766 if (STRCASEEQ('l','L',"left",value)) {
1768 W_L("text-align:left");
1771 else if (STRCASEEQ('r','R',"right",value)) {
1773 W_L("text-align:right");
1776 else if (STRCASEEQ('c','C',"center",value)) {
1778 W_L("text-align:center");
1791 * It is a handler who processes the H2 tag.
1793 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1794 * destination is specified.
1795 * @param node [i] The H2 tag node is specified.
1796 * @return The conversion result is returned.
1799 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
1801 xhtml_t *xhtml = GET_XHTML(pdoc);
1802 Doc *doc = xhtml->doc;
1810 * It is a handler who processes the H3 tag.
1812 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1813 * destination is specified.
1814 * @param node [i] The H3 tag node is specified.
1815 * @return The conversion result is returned.
1818 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
1820 xhtml_t *xhtml = GET_XHTML(pdoc);
1821 Doc *doc = xhtml->doc;
1825 for (attr = qs_get_attr(doc,node);
1827 attr = qs_get_next_attr(doc,attr)) {
1830 name = qs_get_attr_name(doc,attr);
1831 value = qs_get_attr_value(doc,attr);
1832 if (STRCASEEQ('a','A',"align", name)) {
1834 if (STRCASEEQ('l','L',"left",value)) {
1836 W_L("text-align:left");
1839 else if (STRCASEEQ('r','R',"right",value)) {
1841 W_L("text-align:right");
1844 else if (STRCASEEQ('c','C',"center",value)) {
1846 W_L("text-align:center");
1859 * It is a handler who processes the H3 tag.
1861 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1862 * destination is specified.
1863 * @param node [i] The H3 tag node is specified.
1864 * @return The conversion result is returned.
1867 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
1869 xhtml_t *xhtml = GET_XHTML(pdoc);
1870 Doc *doc = xhtml->doc;
1878 * It is a handler who processes the H4 tag.
1880 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1881 * destination is specified.
1882 * @param node [i] The H4 tag node is specified.
1883 * @return The conversion result is returned.
1886 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
1888 xhtml_t *xhtml = GET_XHTML(pdoc);
1889 Doc *doc = xhtml->doc;
1893 for (attr = qs_get_attr(doc,node);
1895 attr = qs_get_next_attr(doc,attr)) {
1898 name = qs_get_attr_name(doc,attr);
1899 value = qs_get_attr_value(doc,attr);
1900 if (STRCASEEQ('a','A',"align", name)) {
1902 if (STRCASEEQ('l','L',"left",value)) {
1904 W_L("text-align:left");
1907 else if (STRCASEEQ('r','R',"right",value)) {
1909 W_L("text-align:right");
1912 else if (STRCASEEQ('c','C',"center",value)) {
1914 W_L("text-align:center");
1927 * It is a handler who processes the H4 tag.
1929 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1930 * destination is specified.
1931 * @param node [i] The H4 tag node is specified.
1932 * @return The conversion result is returned.
1935 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
1937 xhtml_t *xhtml = GET_XHTML(pdoc);
1938 Doc *doc = xhtml->doc;
1946 * It is a handler who processes the H5 tag.
1948 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1949 * destination is specified.
1950 * @param node [i] The H5 tag node is specified.
1951 * @return The conversion result is returned.
1954 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
1956 xhtml_t *xhtml = GET_XHTML(pdoc);
1957 Doc *doc = xhtml->doc;
1961 for (attr = qs_get_attr(doc,node);
1963 attr = qs_get_next_attr(doc,attr)) {
1966 name = qs_get_attr_name(doc,attr);
1967 value = qs_get_attr_value(doc,attr);
1968 if (STRCASEEQ('a','A',"align", name)) {
1970 if (STRCASEEQ('l','L',"left",value)) {
1972 W_L("text-align:left");
1975 else if (STRCASEEQ('r','R',"right",value)) {
1977 W_L("text-align:right");
1980 else if (STRCASEEQ('c','C',"center",value)) {
1982 W_L("text-align:center");
1995 * It is a handler who processes the H5 tag.
1997 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1998 * destination is specified.
1999 * @param node [i] The H5 tag node is specified.
2000 * @return The conversion result is returned.
2003 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2005 xhtml_t *xhtml = GET_XHTML(pdoc);
2006 Doc *doc = xhtml->doc;
2014 * It is a handler who processes the H6 tag.
2016 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2017 * destination is specified.
2018 * @param node [i] The H6 tag node is specified.
2019 * @return The conversion result is returned.
2022 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2024 xhtml_t *xhtml = GET_XHTML(pdoc);
2025 Doc *doc = xhtml->doc;
2029 for (attr = qs_get_attr(doc,node);
2031 attr = qs_get_next_attr(doc,attr)) {
2034 name = qs_get_attr_name(doc,attr);
2035 value = qs_get_attr_value(doc,attr);
2036 if (STRCASEEQ('a','A',"align", name)) {
2038 if (STRCASEEQ('l','L',"left",value)) {
2040 W_L("text-align:left");
2043 else if (STRCASEEQ('r','R',"right",value)) {
2045 W_L("text-align:right");
2048 else if (STRCASEEQ('c','C',"center",value)) {
2050 W_L("text-align:center");
2063 * It is a handler who processes the H6 tag.
2065 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2066 * destination is specified.
2067 * @param node [i] The H6 tag node is specified.
2068 * @return The conversion result is returned.
2071 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
2073 xhtml_t *xhtml = GET_XHTML(pdoc);
2074 Doc *doc = xhtml->doc;
2082 * It is a handler who processes the OL tag.
2084 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2085 * destination is specified.
2086 * @param node [i] The OL tag node is specified.
2087 * @return The conversion result is returned.
2090 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
2092 xhtml_t *xhtml = GET_XHTML(pdoc);
2093 Doc *doc = xhtml->doc;
2097 /*--------------------------------------------------------------------------*/
2098 /* Get Attributes */
2099 /*--------------------------------------------------------------------------*/
2100 for (attr = qs_get_attr(doc,node);
2102 attr = qs_get_next_attr(doc,attr)) {
2103 char *name = qs_get_attr_name(doc,attr);
2104 char *value = qs_get_attr_value(doc,attr);
2105 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2110 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2122 * It is a handler who processes the OL tag.
2124 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2125 * destination is specified.
2126 * @param node [i] The OL tag node is specified.
2127 * @return The conversion result is returned.
2130 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
2132 xhtml_t *xhtml = GET_XHTML(pdoc);
2133 Doc *doc = xhtml->doc;
2141 * It is a handler who processes the LI tag.
2143 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2144 * destination is specified.
2145 * @param node [i] The LI tag node is specified.
2146 * @return The conversion result is returned.
2149 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
2151 xhtml_t *xhtml = GET_XHTML(pdoc);
2152 Doc *doc = xhtml->doc;
2156 /*--------------------------------------------------------------------------*/
2157 /* Get Attributes */
2158 /*--------------------------------------------------------------------------*/
2159 for (attr = qs_get_attr(doc,node);
2161 attr = qs_get_next_attr(doc,attr)) {
2162 char *name = qs_get_attr_name(doc,attr);
2163 char *value = qs_get_attr_value(doc,attr);
2164 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2169 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2181 ** It is a handler who processes the LI tag.
2183 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2184 * destination is specified.
2185 * @param node [i] The LI tag node is specified.
2186 * @return The conversion result is returned.
2189 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
2191 xhtml_t *xhtml = GET_XHTML(pdoc);
2192 Doc *doc = xhtml->doc;
2199 * It is a handler who processes the IMG tag.
2201 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2202 * destination is specified.
2203 * @param node [i] The IMG tag node is specified.
2204 * @return The conversion result is returned.
2207 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
2209 xhtml_t *xhtml = GET_XHTML(pdoc);
2210 Doc *doc = xhtml->doc;
2211 request_rec *r = doc->r;
2214 #ifndef IMG_NOT_CONVERT_FILENAME
2215 device_table *spec = xhtml->spec;
2219 /*--------------------------------------------------------------------------*/
2220 /* Get Attributes */
2221 /*--------------------------------------------------------------------------*/
2222 for (attr = qs_get_attr(doc,node);
2224 attr = qs_get_next_attr(doc,attr)) {
2225 char *name = qs_get_attr_name(doc,attr);
2226 char *value = qs_get_attr_value(doc,attr);
2228 if (STRCASEEQ('s','S',"src",name)) {
2229 value = chxj_encoding_parameter(r, value);
2230 #ifdef IMG_NOT_CONVERT_FILENAME
2240 char *vv = chxj_img_conv(r,spec,value);
2248 if (STRCASEEQ('a','A',"align",name)) {
2249 if (value && (STRCASEEQ('t','T',"top", value) ||
2250 STRCASEEQ('m','M',"middle",value) ||
2251 STRCASEEQ('b','B',"bottom",value) ||
2252 STRCASEEQ('l','L',"left", value) ||
2253 STRCASEEQ('r','R',"right", value))) {
2259 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2264 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2269 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2274 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
2279 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
2291 * It is a handler who processes the IMG tag.
2293 * @param xhtml [i/o] The pointer to the XHTML structure at the output
2294 * destination is specified.
2295 * @param node [i] The IMG tag node is specified.
2296 * @return The conversion result is returned.
2299 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
2301 xhtml_t *xhtml = GET_XHTML(pdoc);
2308 * It is a handler who processes the SELECT tag.
2310 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2311 * destination is specified.
2312 * @param node [i] The SELECT tag node is specified.
2313 * @return The conversion result is returned.
2316 s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
2318 xhtml_t *xhtml = GET_XHTML(pdoc);
2319 Doc *doc = xhtml->doc;
2326 for (attr = qs_get_attr(doc,child);
2328 attr = qs_get_next_attr(doc,attr)) {
2329 char *nm = qs_get_attr_name(doc,attr);
2330 char *val = qs_get_attr_value(doc,attr);
2331 if (STRCASEEQ('s','S',"size",nm)) {
2332 /* CHTML version 2.0 */
2333 size = apr_pstrdup(doc->buf.pool, val);
2335 else if (STRCASEEQ('n','N',"name",nm)) {
2336 /* CHTML version 2.0 */
2337 name = apr_pstrdup(doc->buf.pool, val);
2339 else if (STRCASEEQ('m','M',"multiple",nm)) {
2340 /* CHTML version 2.0 */
2360 * It is a handler who processes the SELECT tag.
2362 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2363 * destination is specified.
2364 * @param node [i] The SELECT tag node is specified.
2365 * @return The conversion result is returned.
2368 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
2370 xhtml_t *xhtml = GET_XHTML(pdoc);
2371 Doc *doc = xhtml->doc;
2379 * It is a handler who processes the OPTION tag.
2381 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2382 * destination is specified.
2383 * @param node [i] The OPTION tag node is specified.
2384 * @return The conversion result is returned.
2387 s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
2389 xhtml_t *xhtml = GET_XHTML(pdoc);
2390 Doc *doc = xhtml->doc;
2393 char *selected = NULL;
2397 for (attr = qs_get_attr(doc,child);
2399 attr = qs_get_next_attr(doc,attr)) {
2400 char *nm = qs_get_attr_name(doc,attr);
2401 char *val = qs_get_attr_value(doc,attr);
2402 if (STRCASEEQ('s','S',"selected",nm)) {
2403 /* CHTML version 2.0 */
2404 selected = apr_pstrdup(doc->buf.pool, val);
2406 else if (STRCASEEQ('v','V',"value",nm)) {
2407 /* CHTML version 2.0 */
2408 value = apr_pstrdup(doc->buf.pool, val);
2420 W_L(" selected=\"selected\"");
2428 * It is a handler who processes the OPTION tag.
2430 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2431 * destination is specified.
2432 * @param node [i] The OPTION tag node is specified.
2433 * @return The conversion result is returned.
2436 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
2438 xhtml_t *xhtml = GET_XHTML(pdoc);
2439 Doc *doc = xhtml->doc;
2447 * It is a handler who processes the DIV tag.
2449 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2450 * destination is specified.
2451 * @param node [i] The DIV tag node is specified.
2452 * @return The conversion result is returned.
2455 s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
2457 xhtml_t *xhtml = GET_XHTML(pdoc);
2458 Doc *doc = xhtml->doc;
2463 for (attr = qs_get_attr(doc,child);
2465 attr = qs_get_next_attr(doc,attr)) {
2466 char *nm = qs_get_attr_name(doc,attr);
2467 char *val = qs_get_attr_value(doc,attr);
2468 if (STRCASEEQ('a','A',"align",nm)) {
2469 /*=====================================================================*/
2470 /* CHTML version 3.2 */
2471 /*=====================================================================*/
2472 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2473 align = apr_pstrdup(doc->buf.pool, val);
2488 * It is a handler who processes the DIV tag.
2490 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2491 * destination is specified.
2492 * @param node [i] The DIV tag node is specified.
2493 * @return The conversion result is returned.
2496 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
2498 xhtml_t *xhtml = GET_XHTML(pdoc);
2499 Doc *doc = xhtml->doc;
2506 * It is a handler who processes the B tag.
2508 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2509 * destination is specified.
2510 * @param node [i] The B tag node is specified.
2511 * @return The conversion result is returned.
2514 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
2516 xhtml_t *xhtml = GET_XHTML(pdoc);
2517 Doc *doc = xhtml->doc;
2519 W_L("<div style=\"font-weight:bold\">");
2525 * It is a handler who processes the B tag.
2527 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2528 * destination is specified.
2529 * @param node [i] The B tag node is specified.
2530 * @return The conversion result is returned.
2533 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
2535 xhtml_t *xhtml = GET_XHTML(pdoc);
2536 Doc *doc = xhtml->doc;
2544 * It is a handler who processes the CHXJ:IF tag.
2546 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2547 * destination is specified.
2548 * @param node [i] The CHXJ:IF tag node is specified.
2551 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
2553 xhtml_t *xhtml = GET_XHTML(pdoc);
2554 Doc *doc = xhtml->doc;
2557 for (child = qs_get_child_node(doc, node);
2559 child = qs_get_next_node(doc, child)) {
2561 s_xhtml_1_0_chxjif_tag(xhtml, child);
2569 * It is a handler who processes the TEXTARE tag.
2571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2572 * destination is specified.
2573 * @param node [i] The TEXTAREA tag node is specified.
2574 * @return The conversion result is returned.
2577 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
2579 xhtml_t *xhtml = GET_XHTML(pdoc);
2580 Doc *doc = xhtml->doc;
2583 xhtml->textarea_flag++;
2585 for (attr = qs_get_attr(doc,node);
2587 attr = qs_get_next_attr(doc,attr)) {
2588 char *name = qs_get_attr_name(doc,attr);
2589 char *value = qs_get_attr_value(doc,attr);
2590 if (STRCASEEQ('n','N',"name",name)) {
2595 else if (STRCASEEQ('r','R',"rows",name)) {
2600 else if (STRCASEEQ('c','C',"cols",name)) {
2612 * It is a handler who processes the TEXTAREA tag.
2614 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2615 * destination is specified.
2616 * @param node [i] The TEXTAREA tag node is specified.
2617 * @return The conversion result is returned.
2620 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2622 xhtml_t *xhtml = GET_XHTML(pdoc);
2623 Doc *doc = xhtml->doc;
2625 W_L("</textarea>\r\n");
2626 xhtml->textarea_flag--;
2632 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
2634 xhtml_t *xhtml = GET_XHTML(pdoc);
2635 Doc *doc = xhtml->doc;
2636 request_rec *r = doc->r;
2644 textval = qs_get_node_value(doc,child);
2645 textval = qs_trim_string(doc->buf.pool, textval);
2646 if (strlen(textval) == 0)
2649 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2650 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2652 tdst = qs_alloc_zero_byte_string(r);
2653 memset(one_byte, 0, sizeof(one_byte));
2656 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2658 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
2660 DBG(r,"[%s][%d]", out, rtn);
2661 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2665 if (is_sjis_kanji(textval[ii])) {
2666 one_byte[0] = textval[ii+0];
2667 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2668 one_byte[0] = textval[ii+1];
2669 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2672 else if (xhtml->pre_flag) {
2673 one_byte[0] = textval[ii+0];
2674 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2676 else if (xhtml->textarea_flag) {
2677 one_byte[0] = textval[ii+0];
2678 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2680 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2681 one_byte[0] = textval[ii+0];
2682 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2691 * It is a handler who processes the BLOCKQUOTE tag.
2693 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2694 * destination is specified.
2695 * @param node [i] The BLOCKQUOTE tag node is specified.
2696 * @return The conversion result is returned.
2699 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2701 xhtml_t *xhtml = GET_XHTML(pdoc);
2702 Doc *doc = xhtml->doc;
2703 W_L("<blockquote>");
2709 * It is a handler who processes the BLOCKQUOTE tag.
2711 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2712 * destination is specified.
2713 * @param node [i] The BLOCKQUOTE tag node is specified.
2714 * @return The conversion result is returned.
2717 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2719 xhtml_t *xhtml = GET_XHTML(pdoc);
2720 Doc *doc = xhtml->doc;
2721 W_L("</blockquote>");
2727 * It is a handler who processes the DIR tag.
2729 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2730 * destination is specified.
2731 * @param node [i] The DIR tag node is specified.
2732 * @return The conversion result is returned.
2735 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *UNUSED(child))
2737 xhtml_t *xhtml = GET_XHTML(pdoc);
2738 Doc *doc = xhtml->doc;
2745 * It is a handler who processes the DIR tag.
2747 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2748 * destination is specified.
2749 * @param node [i] The DIR tag node is specified.
2750 * @return The conversion result is returned.
2753 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
2755 xhtml_t *xhtml = GET_XHTML(pdoc);
2756 Doc *doc = xhtml->doc;
2763 * It is a handler who processes the DL tag.
2765 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2766 * destination is specified.
2767 * @param node [i] The DL tag node is specified.
2768 * @return The conversion result is returned.
2771 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
2773 xhtml_t *xhtml = GET_XHTML(pdoc);
2774 Doc *doc = xhtml->doc;
2781 * It is a handler who processes the DL tag.
2783 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2784 * destination is specified.
2785 * @param node [i] The DL tag node is specified.
2786 * @return The conversion result is returned.
2789 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
2791 xhtml_t *xhtml = GET_XHTML(pdoc);
2792 Doc *doc = xhtml->doc;
2799 * It is a handter who processes the DT tag.
2801 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2802 * destination is specified.
2803 * @param node [i] The DT tag node is specified.
2804 * @return The conversion result is returned.
2807 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *UNUSED(child))
2809 xhtml_t *xhtml = GET_XHTML(pdoc);
2810 Doc *doc = xhtml->doc;
2817 * It is a handter who processes the DT tag.
2819 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2820 * destination is specified.
2821 * @param node [i] The DT tag node is specified.
2822 * @return The conversion result is returned.
2825 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
2827 xhtml_t *xhtml = GET_XHTML(pdoc);
2828 Doc *doc = xhtml->doc;
2835 * It is a handder who processes the DD tag.
2837 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2838 * destination is specified.
2839 * @param node [i] The DD tag node is specified.
2840 * @return The conversion result is returned.
2843 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *UNUSED(child))
2845 xhtml_t *xhtml = GET_XHTML(pdoc);
2846 Doc *doc = xhtml->doc;
2853 * It is a handder who processes the DD tag.
2855 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2856 * destination is specified.
2857 * @param node [i] The DD tag node is specified.
2858 * @return The conversion result is returned.
2861 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
2863 xhtml_t *xhtml = GET_XHTML(pdoc);
2864 Doc *doc = xhtml->doc;
2871 * It is a handler who processes the MENU tag.
2873 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2874 * destination is specified.
2875 * @param node [i] The MENU tag node is specified.
2876 * @return The conversion result is returned.
2879 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *UNUSED(child))
2883 xhtml = GET_XHTML(pdoc);
2891 * It is a hanmenuer who processes the MENU tag.
2893 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2894 * destination is specified.
2895 * @param node [i] The MENU tag node is specified.
2896 * @return The conversion result is returned.
2899 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
2901 xhtml_t *xhtml = GET_XHTML(pdoc);
2902 Doc *doc = xhtml->doc;