2 * Copyright (C) 2005-2009 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"
26 #include "chxj_header_inf.h"
28 #define GET_XHTML(X) ((xhtml_t*)(X))
31 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
35 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
37 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
38 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node);
101 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_start_plaintext_tag (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_end_plaintext_tag (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_start_blink_tag (void *pdoc, Node *node);
116 static char *s_xhtml_1_0_end_blink_tag (void *pdoc, Node *node);
117 static char *s_xhtml_1_0_start_marquee_tag (void *pdoc, Node *node);
118 static char *s_xhtml_1_0_end_marquee_tag (void *pdoc, Node *node);
119 static char *s_xhtml_1_0_newline_mark (void *pdoc, Node *node);
121 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
122 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
123 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
126 tag_handler xhtml_handler[] = {
129 s_xhtml_1_0_start_html_tag,
130 s_xhtml_1_0_end_html_tag,
134 s_xhtml_1_0_start_meta_tag,
135 s_xhtml_1_0_end_meta_tag,
139 s_xhtml_1_0_start_textarea_tag,
140 s_xhtml_1_0_end_textarea_tag,
144 s_xhtml_1_0_start_p_tag,
145 s_xhtml_1_0_end_p_tag,
149 s_xhtml_1_0_start_pre_tag,
150 s_xhtml_1_0_end_pre_tag,
154 s_xhtml_1_0_start_ul_tag,
155 s_xhtml_1_0_end_ul_tag,
159 s_xhtml_1_0_start_li_tag,
160 s_xhtml_1_0_end_li_tag,
164 s_xhtml_1_0_start_ol_tag,
165 s_xhtml_1_0_end_ol_tag,
169 s_xhtml_1_0_start_h1_tag,
170 s_xhtml_1_0_end_h1_tag,
174 s_xhtml_1_0_start_h2_tag,
175 s_xhtml_1_0_end_h2_tag,
179 s_xhtml_1_0_start_h3_tag,
180 s_xhtml_1_0_end_h3_tag,
184 s_xhtml_1_0_start_h4_tag,
185 s_xhtml_1_0_end_h4_tag,
189 s_xhtml_1_0_start_h5_tag,
190 s_xhtml_1_0_end_h5_tag,
194 s_xhtml_1_0_start_h6_tag,
195 s_xhtml_1_0_end_h6_tag,
199 s_xhtml_1_0_start_head_tag,
200 s_xhtml_1_0_end_head_tag,
204 s_xhtml_1_0_start_title_tag,
205 s_xhtml_1_0_end_title_tag,
209 s_xhtml_1_0_start_base_tag,
210 s_xhtml_1_0_end_base_tag,
214 s_xhtml_1_0_start_body_tag,
215 s_xhtml_1_0_end_body_tag,
219 s_xhtml_1_0_start_a_tag,
220 s_xhtml_1_0_end_a_tag,
224 s_xhtml_1_0_start_br_tag,
225 s_xhtml_1_0_end_br_tag,
234 s_xhtml_1_0_start_tr_tag,
235 s_xhtml_1_0_end_tr_tag,
249 s_xhtml_1_0_start_font_tag,
250 s_xhtml_1_0_end_font_tag,
254 s_xhtml_1_0_start_form_tag,
255 s_xhtml_1_0_end_form_tag,
259 s_xhtml_1_0_start_input_tag,
260 s_xhtml_1_0_end_input_tag,
264 s_xhtml_1_0_start_center_tag,
265 s_xhtml_1_0_end_center_tag,
269 s_xhtml_1_0_start_hr_tag,
270 s_xhtml_1_0_end_hr_tag,
274 s_xhtml_1_0_start_img_tag,
275 s_xhtml_1_0_end_img_tag,
279 s_xhtml_1_0_start_select_tag,
280 s_xhtml_1_0_end_select_tag,
284 s_xhtml_1_0_start_option_tag,
285 s_xhtml_1_0_end_option_tag,
289 s_xhtml_1_0_start_div_tag,
290 s_xhtml_1_0_end_div_tag,
294 s_xhtml_1_0_chxjif_tag,
319 s_xhtml_1_0_text_tag,
329 s_xhtml_1_0_start_b_tag,
330 s_xhtml_1_0_end_b_tag,
339 s_xhtml_1_0_start_dt_tag,
340 s_xhtml_1_0_end_dt_tag,
354 s_xhtml_1_0_start_blockquote_tag,
355 s_xhtml_1_0_end_blockquote_tag,
359 s_xhtml_1_0_start_dir_tag,
360 s_xhtml_1_0_end_dir_tag,
364 s_xhtml_1_0_start_dl_tag,
365 s_xhtml_1_0_end_dl_tag,
369 s_xhtml_1_0_start_dd_tag,
370 s_xhtml_1_0_end_dd_tag,
374 s_xhtml_1_0_start_menu_tag,
375 s_xhtml_1_0_end_menu_tag,
379 s_xhtml_1_0_start_plaintext_tag,
380 s_xhtml_1_0_end_plaintext_tag,
384 s_xhtml_1_0_start_blink_tag,
385 s_xhtml_1_0_end_blink_tag,
389 s_xhtml_1_0_start_marquee_tag,
390 s_xhtml_1_0_end_marquee_tag,
394 s_xhtml_1_0_newline_mark,
400 * converts from CHTML to XHTML.
402 * @param r [i] Requet_rec is appointed.
403 * @param spec [i] The result of the device specification processing which
404 * was done in advance is appointed.
405 * @param src [i] The character string before the converting is appointed.
406 * @return The character string after the converting is returned.
409 chxj_convert_xhtml_mobile_1_0(
415 chxjconvrule_entry *entryp,
424 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
425 /*--------------------------------------------------------------------------*/
427 /*--------------------------------------------------------------------------*/
429 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
431 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
435 /*--------------------------------------------------------------------------*/
436 /* The XHTML structure is initialized. */
437 /*--------------------------------------------------------------------------*/
438 s_init_xhtml(&xhtml, &doc, r, spec);
440 xhtml.entryp = entryp;
441 xhtml.cookie = cookie;
443 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
445 /*--------------------------------------------------------------------------*/
446 /* The character string of the input is analyzed. */
447 /*--------------------------------------------------------------------------*/
448 qs_init_malloc(&doc);
449 qs_init_root_node(&doc);
451 ss = apr_pcalloc(r->pool, srclen + 1);
452 memset(ss, 0, srclen + 1);
453 memcpy(ss, src, srclen);
456 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
458 qs_parse_string(&doc,ss, strlen(ss));
460 chxj_buffered_write_init(r->pool, &doc.buf);
461 /*--------------------------------------------------------------------------*/
462 /* It converts it from CHTML to XHTML. */
463 /*--------------------------------------------------------------------------*/
464 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
465 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
466 dst = apr_pstrdup(r->pool, xhtml.out);
467 chxj_buffered_write_terminate(&doc.buf);
469 qs_all_free(&doc,QX_LOGMARK);
472 return apr_pstrdup(r->pool,ss);
476 dst = apr_psprintf(r->pool, "\n");
478 *dstlen = strlen(dst);
481 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
484 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
490 * The XHTML structure is initialized.
492 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
493 * initialized is specified.
494 * @param doc [i] The Doc structure that should be set to the initialized
495 * HDML structure is specified.
496 * @param r [i] To use POOL, the pointer to request_rec is specified.
497 * @param spec [i] The pointer to the device_table
500 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
502 memset(doc, 0, sizeof(Doc));
503 memset(xhtml, 0, sizeof(xhtml_t));
508 xhtml->out = qs_alloc_zero_byte_string(r->pool);
509 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
510 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
515 * Corresponding EMOJI to a current character-code is retrieved.
516 * The substitution character string is stored in the rslt pointer if agreeing.
518 * @param xhtml [i] The pointer to the XHTML structure is specified.
519 * @param txt [i] The character string to want to examine whether it is
520 * EMOJI is specified.
521 * @param rslt [o] The pointer to the pointer that stores the result is
523 * @return When corresponding EMOJI exists, it returns it excluding 0.
526 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
539 DBG(r,"spec is NULL");
542 for (ee = xhtml->conf->emoji;
545 unsigned char hex1byte;
546 unsigned char hex2byte;
548 DBG(r,"emoji->imode is NULL");
552 if (ee->imode->string != NULL
553 && strlen(ee->imode->string) > 0
554 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
555 if (spec == NULL || spec->emoji_type == NULL) {
556 *rslt = apr_psprintf(r->pool,
559 return strlen(ee->imode->string);
562 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
563 *rslt = apr_psprintf(r->pool,
566 return strlen(ee->imode->string);
569 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
570 *rslt = apr_psprintf(r->pool,
573 return strlen(ee->imode->string);
576 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
577 *rslt = apr_psprintf(r->pool,
580 return strlen(ee->imode->string);
583 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
584 *rslt = apr_psprintf(r->pool,
587 return strlen(ee->imode->string);
590 *rslt = apr_psprintf(r->pool,
593 return strlen(ee->imode->string);
597 hex1byte = ee->imode->hex1byte & 0xff;
598 hex2byte = ee->imode->hex2byte & 0xff;
600 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
601 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
602 if (spec == NULL || spec->emoji_type == NULL) {
603 *rslt = apr_psprintf(r->pool,
604 "<img localsrc=\"%s\">",
609 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
610 *rslt = apr_psprintf(r->pool,
611 "<img localsrc=\"%s\">",
616 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
617 *rslt = apr_psprintf(r->pool,
618 "<img localsrc=\"%s\">",
623 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
624 *rslt = apr_psprintf(r->pool,
625 "<img localsrc=\"%s\">",
630 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
631 *rslt = apr_psprintf(r->pool,
632 "<img localsrc=\"%s\">",
637 *rslt = apr_psprintf(r->pool,
638 "<img localsrc=\"%s\">",
650 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
664 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
665 memset(doc, 0, sizeof(Doc));
666 memset(xhtml, 0, sizeof(xhtml_t));
671 xhtml->out = qs_alloc_zero_byte_string(r->pool);
672 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
673 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
675 apr_pool_create(&pool, r->pool);
677 chxj_buffered_write_init(pool, &doc->buf);
679 for (ii=0; ii<len; ii++) {
683 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
690 if (is_sjis_kanji(src[ii])) {
691 two_byte[0] = src[ii+0];
692 two_byte[1] = src[ii+1];
698 one_byte[0] = src[ii+0];
703 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
705 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
711 * It is a handler who processes the HTML tag.
713 * @param pdoc [i/o] The pointer to the XHTML structure at the output
714 * destination is specified.
715 * @param node [i] The HTML tag node is specified.
716 * @return The conversion result is returned.
719 s_xhtml_1_0_start_html_tag(void *pdoc, Node *node)
721 xhtml_t *xhtml = GET_XHTML(pdoc);
723 Doc *doc = xhtml->doc;
725 /*--------------------------------------------------------------------------*/
726 /* Add XML Declare */
727 /*--------------------------------------------------------------------------*/
728 W_L("<?xml version=\"1.0\" encoding=\"Windows-31J\"?>");
730 /*--------------------------------------------------------------------------*/
732 /*--------------------------------------------------------------------------*/
733 W_L("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"");
735 W_L(" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">");
737 /*--------------------------------------------------------------------------*/
739 /*--------------------------------------------------------------------------*/
740 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\"");
741 /*--------------------------------------------------------------------------*/
743 /*--------------------------------------------------------------------------*/
744 for (attr = qs_get_attr(doc,node);
746 attr = qs_get_next_attr(doc,attr)) {
747 char* name = qs_get_attr_name(doc,attr);
748 char* value = qs_get_attr_value(doc,attr);
749 if (STRCASEEQ('l','L',"lang", name)) {
754 else if (STRCASEEQ('v','V',"version", name)) {
755 W_L(" version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"");
764 * It is a handler who processes the HTML tag.
766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
767 * destination is specified.
768 * @param node [i] The HTML tag node is specified.
769 * @return The conversion result is returned.
772 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
774 xhtml_t *xhtml = GET_XHTML(pdoc);
775 Doc *doc = xhtml->doc;
782 * It is a handler who processes the META tag.
784 * @param pdoc [i/o] The pointer to the XHTML structure at the output
785 * destination is specified.
786 * @param node [i] The META tag node is specified.
787 * @return The conversion result is returned.
790 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
792 xhtml_t *xhtml = GET_XHTML(pdoc);
794 Doc *doc = xhtml->doc;
795 int content_type_flag = 0;
796 request_rec *r = doc->r;
799 /*--------------------------------------------------------------------------*/
801 /*--------------------------------------------------------------------------*/
802 for (attr = qs_get_attr(doc,node);
804 attr = qs_get_next_attr(doc,attr)) {
805 char *name = qs_get_attr_name(doc,attr);
806 char *value = qs_get_attr_value(doc,attr);
807 if (STRCASEEQ('n','N',"name", name) && value && *value) {
814 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
820 if (STRCASEEQ('c','C', "content-type", value)) {
821 content_type_flag = 1;
824 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
825 if (content_type_flag) {
829 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
847 * It is a handler who processes the META tag.
849 * @param pdoc [i/o] The pointer to the XHTML structure at the output
850 * destination is specified.
851 * @param node [i] The META tag node is specified.
852 * @return The conversion result is returned.
855 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
857 xhtml_t *xhtml = GET_XHTML(pdoc);
864 * It is a handler who processes the HEAD tag.
866 * @param pdoc [i/o] The pointer to the XHTML structure at the output
867 * destination is specified.
868 * @param node [i] The HEAD tag node is specified.
869 * @return The conversion result is returned.
872 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
874 xhtml_t *xhtml = GET_XHTML(pdoc);
875 Doc *doc = xhtml->doc;
883 * It is a handler who processes the HEAD tag.
885 * @param pdoc [i/o] The pointer to the XHTML structure at the output
886 * destination is specified.
887 * @param node [i] The HEAD tag node is specified.
888 * @return The conversion result is returned.
891 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
893 xhtml_t *xhtml = GET_XHTML(pdoc);
894 Doc *doc = xhtml->doc;
902 * It is a handler who processes the TITLE tag.
904 * @param pdoc [i/o] The pointer to the XHTML structure at the output
905 * destination is specified.
906 * @param node [i] The TITLE tag node is specified.
907 * @return The conversion result is returned.
910 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
912 xhtml_t *xhtml = GET_XHTML(pdoc);
913 Doc *doc = xhtml->doc;
921 * It is a handler who processes the TITLE tag.
923 * @param pdoc [i/o] The pointer to the XHTML structure at the output
924 * destination is specified.
925 * @param node [i] The TITLE tag node is specified.
926 * @return The conversion result is returned.
929 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
931 xhtml_t *xhtml = GET_XHTML(pdoc);
932 Doc *doc = xhtml->doc;
941 * It is a handler who processes the BASE tag.
943 * @param pdoc [i/o] The pointer to the XHTML structure at the output
944 * destination is specified.
945 * @param node [i] The BASE tag node is specified.
946 * @return The conversion result is returned.
949 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
951 xhtml_t *xhtml = GET_XHTML(pdoc);
953 Doc *doc = xhtml->doc;
956 /*--------------------------------------------------------------------------*/
958 /*--------------------------------------------------------------------------*/
959 for (attr = qs_get_attr(doc,node);
961 attr = qs_get_next_attr(doc,attr)) {
962 char *name = qs_get_attr_name(doc,attr);
963 char *value = qs_get_attr_value(doc,attr);
964 if (STRCASEEQ('h','H',"href",name)) {
978 * It is a handler who processes the BASE tag.
980 * @param pdoc [i/o] The pointer to the XHTML structure at the output
981 * destination is specified.
982 * @param node [i] The BASE tag node is specified.
983 * @return The conversion result is returned.
986 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
988 xhtml_t *xhtml = GET_XHTML(pdoc);
995 * It is a handler who processes the BODY tag.
997 * @param pdoc [i/o] The pointer to the XHTML structure at the output
998 * destination is specified.
999 * @param node [i] The BODY tag node is specified.
1000 * @return The conversion result is returned.
1003 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1005 xhtml_t *xhtml = GET_XHTML(pdoc);
1006 Doc *doc = xhtml->doc;
1010 /*--------------------------------------------------------------------------*/
1011 /* Get Attributes */
1012 /*--------------------------------------------------------------------------*/
1013 for (attr = qs_get_attr(doc,node);
1015 attr = qs_get_next_attr(doc,attr)) {
1016 char *name = qs_get_attr_name(doc,attr);
1017 char *value = qs_get_attr_value(doc,attr);
1018 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1023 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1028 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1033 else if (STRCASEEQ('a','A',"alink", name)) {
1036 else if (STRCASEEQ('v','V',"vlink",name)) {
1046 * It is a handler who processes the BODY tag.
1048 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1049 * destination is specified.
1050 * @param node [i] The BODY tag node is specified.
1051 * @return The conversion result is returned.
1054 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1056 xhtml_t *xhtml = GET_XHTML(pdoc);
1057 Doc *doc = xhtml->doc;
1065 * It is a handler who processes the A tag.
1067 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1068 * destination is specified.
1069 * @param node [i] The A tag node is specified.
1070 * @return The conversion result is returned.
1073 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1075 xhtml_t *xhtml = GET_XHTML(pdoc);
1076 Doc *doc = xhtml->doc;
1077 request_rec *r = doc->r;
1081 /*--------------------------------------------------------------------------*/
1082 /* Get Attributes */
1083 /*--------------------------------------------------------------------------*/
1084 for (attr = qs_get_attr(doc,node);
1086 attr = qs_get_next_attr(doc,attr)) {
1087 char* name = qs_get_attr_name(doc,attr);
1088 char* value = qs_get_attr_value(doc,attr);
1089 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1094 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1095 value = chxj_encoding_parameter(r, value);
1096 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1097 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1103 else if (STRCASEEQ('a','A',"accesskey", name)) {
1104 W_L(" accesskey=\"");
1108 else if (STRCASEEQ('c','C',"cti",name)) {
1111 else if (STRCASEEQ('i','I',"ijam", name)) {
1114 else if (STRCASEEQ('u','U',"utn", name)) {
1117 else if (STRCASEEQ('t','T',"telbook",name)) {
1120 else if (STRCASEEQ('k','K',"kana",name)) {
1123 else if (STRCASEEQ('e','E',"email",name)) {
1126 else if (STRCASEEQ('i','I',"ista",name)) {
1129 else if (STRCASEEQ('i','I',"ilet",name)) {
1132 else if (STRCASEEQ('i','I',"iswf",name)) {
1135 else if (STRCASEEQ('i','I',"irst",name)) {
1145 * It is a handler who processes the A tag.
1147 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1148 * destination is specified.
1149 * @param node [i] The A tag node is specified.
1150 * @return The conversion result is returned.
1153 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1155 xhtml_t *xhtml = GET_XHTML(pdoc);
1156 Doc *doc = xhtml->doc;
1165 * It is a handler who processes the BR tag.
1167 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1168 * destination is specified.
1169 * @param node [i] The BR tag node is specified.
1170 * @return The conversion result is returned.
1173 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1175 xhtml_t *xhtml = GET_XHTML(pdoc);
1176 Doc *doc = xhtml->doc;
1180 /*--------------------------------------------------------------------------*/
1181 /* Get Attributes */
1182 /*--------------------------------------------------------------------------*/
1183 for (attr = qs_get_attr(doc,node);
1185 attr = qs_get_next_attr(doc,attr)) {
1186 char *name = qs_get_attr_name(doc,attr);
1187 char *value = qs_get_attr_value(doc,attr);
1188 if (STRCASEEQ('c','C',"clear",name)) {
1189 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1203 * It is a handler who processes the BR tag.
1205 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1206 * destination is specified.
1207 * @param node [i] The BR tag node is specified.
1208 * @return The conversion result is returned.
1211 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1213 xhtml_t *xhtml = GET_XHTML(pdoc);
1220 * It is a handler who processes the TR tag.
1222 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1223 * destination is specified.
1224 * @param node [i] The TR tag node is specified.
1225 * @return The conversion result is returned.
1228 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1230 xhtml_t *xhtml = GET_XHTML(pdoc);
1231 Doc *doc = xhtml->doc;
1240 * It is a handler who processes the TR tag.
1242 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1243 * destination is specified.
1244 * @param node [i] The TR tag node is specified.
1245 * @return The conversion result is returned.
1248 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1250 xhtml_t *xhtml = GET_XHTML(pdoc);
1257 * It is a handler who processes the FONT tag.
1259 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1260 * destination is specified.
1261 * @param node [i] The FONT tag node is specified.
1262 * @return The conversion result is returned.
1265 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1267 xhtml_t *xhtml = GET_XHTML(pdoc);
1268 Doc *doc = xhtml->doc;
1273 /*=========================================================================*/
1274 /* Get Attributes */
1275 /*=========================================================================*/
1276 for (attr = qs_get_attr(doc,node);
1278 attr = qs_get_next_attr(doc,attr)) {
1279 char *name = qs_get_attr_name(doc,attr);
1280 char *value = qs_get_attr_value(doc,attr);
1281 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1282 color = apr_pstrdup(doc->buf.pool, value);
1284 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1285 size = apr_pstrdup(doc->buf.pool, value);
1289 W_L("<font color=\"");
1292 xhtml->font_color_flag++;
1295 xhtml->font_size_flag++;
1297 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1298 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1299 case '3': W_L("<span style=\"font-size: small\">"); break;
1300 case '4': W_L("<span style=\"font-size: medium\">"); break;
1301 case '5': W_L("<span style=\"font-size: large\">"); break;
1302 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1303 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1305 if (*(size + 1) == '1') {
1306 W_L("<span style=\"font-size: small\">");
1309 if (*(size + 1) == '2') {
1310 W_L("<span style=\"font-size: x-small\">");
1313 if (*(size + 1) == '3') {
1314 W_L("<span style=\"font-size: xx-small\">");
1317 xhtml->font_size_flag--;
1321 if (*(size + 1) == '1') {
1322 W_L("<span style=\"font-size: large\">");
1325 if (*(size + 1) == '2') {
1326 W_L("<span style=\"font-size: x-large\">");
1329 if (*(size + 1) == '3') {
1330 W_L("<span style=\"font-size: xx-large\">");
1333 xhtml->font_size_flag--;
1337 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", size);
1338 xhtml->font_size_flag--;
1346 * It is a handler who processes the FONT tag.
1348 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1349 * destination is specified.
1350 * @param node [i] The FONT tag node is specified.
1351 * @return The conversion result is returned.
1354 s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child))
1356 xhtml_t *xhtml = GET_XHTML(pdoc);
1357 Doc *doc = xhtml->doc;
1359 if (xhtml->font_size_flag) {
1361 xhtml->font_size_flag--;
1363 if (xhtml->font_color_flag) {
1365 xhtml->font_color_flag--;
1372 * It is a handler who processes the FORM tag.
1374 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1375 * destination is specified.
1376 * @param node [i] The FORM tag node is specified.
1377 * @return The conversion result is returned.
1380 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1382 xhtml_t *xhtml = GET_XHTML(pdoc);
1383 Doc *doc = xhtml->doc;
1384 request_rec *r = doc->r;
1386 char *new_hidden_tag = NULL;
1387 char *attr_action = NULL;
1388 char *attr_method = NULL;
1389 char *attr_name = NULL;
1391 /*--------------------------------------------------------------------------*/
1392 /* Get Attributes */
1393 /*--------------------------------------------------------------------------*/
1394 for (attr = qs_get_attr(doc,node);
1396 attr = qs_get_next_attr(doc,attr)) {
1397 char *name = qs_get_attr_name(doc,attr);
1398 char *value = qs_get_attr_value(doc,attr);
1399 if (STRCASEEQ('a','A',"action",name)) {
1400 attr_action = chxj_encoding_parameter(r, value);
1401 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1403 else if (STRCASEEQ('m','M',"method",name)) {
1404 attr_method = apr_pstrdup(doc->pool, value);
1406 else if (STRCASEEQ('u','U',"utn",name)) {
1409 else if (STRCASEEQ('n','N',"name",name)) {
1410 attr_name = apr_pstrdup(doc->pool, value);
1414 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1419 char *old_qs = NULL;
1420 q = strchr(attr_action, '?');
1422 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_FALSE, xhtml->entryp);
1423 if (new_hidden_tag || old_qs) {
1446 if (new_hidden_tag) {
1447 W_V(new_hidden_tag);
1454 * It is a handler who processes the FORM tag.
1456 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1457 * destination is specified.
1458 * @param node [i] The FORM tag node is specified.
1459 * @return The conversion result is returned.
1462 s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child))
1464 xhtml_t *xhtml = GET_XHTML(pdoc);
1465 Doc *doc = xhtml->doc;
1474 * It is a handler who processes the INPUT tag.
1476 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1477 * destination is specified.
1478 * @param node [i] The INPUT tag node is specified.
1479 * @return The conversion result is returned.
1482 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1484 xhtml_t *xhtml = GET_XHTML(pdoc);
1485 Doc *doc = xhtml->doc;
1486 request_rec *r = doc->r;
1487 char *max_length = NULL;
1491 char *istyle = NULL;
1493 char *checked = NULL;
1494 char *accesskey = NULL;
1497 /*--------------------------------------------------------------------------*/
1498 /* Get Attributes */
1499 /*--------------------------------------------------------------------------*/
1500 type = qs_get_type_attr(doc, node, doc->buf.pool);
1501 name = qs_get_name_attr(doc, node, doc->buf.pool);
1502 value = qs_get_value_attr(doc,node, doc->buf.pool);
1503 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1504 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1505 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1506 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1507 size = qs_get_size_attr(doc, node, doc->buf.pool);
1510 type = qs_trim_string(doc->buf.pool, type);
1511 if (type && (STRCASEEQ('t','T',"text", type) ||
1512 STRCASEEQ('p','P',"password",type) ||
1513 STRCASEEQ('c','C',"checkbox",type) ||
1514 STRCASEEQ('r','R',"radio", type) ||
1515 STRCASEEQ('h','H',"hidden", type) ||
1516 STRCASEEQ('s','S',"submit", type) ||
1517 STRCASEEQ('r','R',"reset", type))) {
1523 if (size && *size) {
1528 if (name && *name) {
1533 if (value && *value) {
1535 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1538 if (accesskey && *accesskey) {
1539 W_L(" accesskey=\"");
1543 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1544 char *fmt = qs_conv_istyle_to_format(r,istyle);
1545 if (max_length && *max_length) {
1547 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1548 if (max_length[ii] < '0' || max_length[ii] > '9') {
1549 max_length = apr_psprintf(r->pool, "0");
1554 if (strcmp(max_length, "0")) {
1555 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1567 if (max_length && *max_length) {
1568 if (chxj_chk_numeric(max_length) != 0) {
1569 max_length = apr_psprintf(r->pool, "0");
1571 if (strcmp(max_length, "0")) {
1572 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1577 /*--------------------------------------------------------------------------*/
1578 /* The figure is default for the password. */
1579 /*--------------------------------------------------------------------------*/
1580 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1587 W_L(" FORMAT=\"*N\"");
1591 W_L(" checked=\"checked\"");
1600 * It is a handler who processes the INPUT tag.
1602 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1603 * destination is specified.
1604 * @param node [i] The INPUT tag node is specified.
1605 * @return The conversion result is returned.
1608 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1610 xhtml_t *xhtml = GET_XHTML(pdoc);
1617 * It is a handler who processes the CENTER tag.
1619 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1620 * destination is specified.
1621 * @param node [i] The CENTER tag node is specified.
1622 * @return The conversion result is returned.
1625 s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node))
1627 xhtml_t *xhtml = GET_XHTML(pdoc);
1628 Doc *doc = xhtml->doc;
1636 * It is a handler who processes the CENTER tag.
1638 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1639 * destination is specified.
1640 * @param node [i] The CENTER tag node is specified.
1641 * @return The conversion result is returned.
1644 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child))
1646 xhtml_t *xhtml = GET_XHTML(pdoc);
1647 Doc *doc = xhtml->doc;
1655 * It is a handler who processes the HR tag.
1657 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1658 * destination is specified.
1659 * @param node [i] The HR tag node is specified.
1660 * @return The conversion result is returned.
1663 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
1665 xhtml_t *xhtml = GET_XHTML(pdoc);
1666 Doc *doc = xhtml->doc;
1671 for (attr = qs_get_attr(doc,node);
1673 attr = qs_get_next_attr(doc,attr)) {
1674 char *name = qs_get_attr_name(doc,attr);
1675 char *value = qs_get_attr_value(doc,attr);
1676 if (STRCASEEQ('a','A',"align", name)) {
1677 /*----------------------------------------------------------------------*/
1679 /*----------------------------------------------------------------------*/
1680 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1686 else if (STRCASEEQ('s','S',"size", name)) {
1687 /*----------------------------------------------------------------------*/
1689 /*----------------------------------------------------------------------*/
1690 if (value && *value) {
1696 else if (STRCASEEQ('w','W',"width", name)) {
1697 /*----------------------------------------------------------------------*/
1699 /*----------------------------------------------------------------------*/
1700 if (value && *value) {
1706 else if (STRCASEEQ('n','N',"noshade", name)) {
1707 /*----------------------------------------------------------------------*/
1709 /*----------------------------------------------------------------------*/
1712 else if (STRCASEEQ('c','C',"color", name) && value && *value) {
1713 /*----------------------------------------------------------------------*/
1715 /*----------------------------------------------------------------------*/
1727 * It is a handler who processes the HR tag.
1729 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1730 * destination is specified.
1731 * @param node [i] The HR tag node is specified.
1732 * @return The conversion result is returned.
1735 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
1737 xhtml_t *xhtml = GET_XHTML(pdoc);
1744 * It is a handler who processes the PRE tag.
1746 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1747 * destination is specified.
1748 * @param node [i] The PRE tag node is specified.
1749 * @return The conversion result is returned.
1752 s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node))
1754 xhtml_t *xhtml = GET_XHTML(pdoc);
1755 Doc *doc = xhtml->doc;
1764 * It is a handler who processes the PRE tag.
1766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1767 * destination is specified.
1768 * @param node [i] The PRE tag node is specified.
1769 * @return The conversion result is returned.
1772 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
1774 xhtml_t *xhtml = GET_XHTML(pdoc);
1775 Doc *doc = xhtml->doc;
1785 * It is a handler who processes the P tag.
1787 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1788 * destination is specified.
1789 * @param node [i] The P tag node is specified.
1790 * @return The conversion result is returned.
1793 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
1795 xhtml_t *xhtml = GET_XHTML(pdoc);
1796 Doc *doc = xhtml->doc;
1801 for (attr = qs_get_attr(doc,node);
1803 attr = qs_get_next_attr(doc,attr)) {
1804 char *nm = qs_get_attr_name(doc,attr);
1805 char *val = qs_get_attr_value(doc,attr);
1806 if (STRCASEEQ('a','A',"align", nm)) {
1807 /*----------------------------------------------------------------------*/
1808 /* CHTML 1.0 (W3C version 3.2) */
1809 /*----------------------------------------------------------------------*/
1810 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1811 align = apr_pstrdup(doc->buf.pool, val);
1827 * It is a handler who processes the P tag.
1829 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1830 * destination is specified.
1831 * @param node [i] The P tag node is specified.
1832 * @return The conversion result is returned.
1835 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
1837 xhtml_t *xhtml = GET_XHTML(pdoc);
1838 Doc *doc = xhtml->doc;
1846 * It is a handler who processes the UL tag.
1848 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1849 * destination is specified.
1850 * @param node [i] The UL tag node is specified.
1851 * @return The conversion result is returned.
1854 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
1856 xhtml_t *xhtml = GET_XHTML(pdoc);
1857 Doc *doc = xhtml->doc;
1860 /*--------------------------------------------------------------------------*/
1861 /* Get Attributes */
1862 /*--------------------------------------------------------------------------*/
1863 for (attr = qs_get_attr(doc,node);
1865 attr = qs_get_next_attr(doc,attr)) {
1866 char *name = qs_get_attr_name(doc,attr);
1867 char *value = qs_get_attr_value(doc,attr);
1868 if (STRCASEEQ('t','T',"type",name)) {
1869 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
1882 * It is a handler who processes the UL tag.
1884 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1885 * destination is specified.
1886 * @param node [i] The UL tag node is specified.
1887 * @return The conversion result is returned.
1890 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
1892 xhtml_t *xhtml = GET_XHTML(pdoc);
1893 Doc *doc = xhtml->doc;
1901 * It is a handler who processes the H1 tag.
1903 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1904 * destination is specified.
1905 * @param node [i] The H1 tag node is specified.
1906 * @return The conversion result is returned.
1909 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
1911 xhtml_t *xhtml = GET_XHTML(pdoc);
1912 Doc *doc = xhtml->doc;
1916 for (attr = qs_get_attr(doc,node);
1918 attr = qs_get_next_attr(doc,attr)) {
1921 name = qs_get_attr_name(doc,attr);
1922 value = qs_get_attr_value(doc,attr);
1923 if (STRCASEEQ('a','A',"align", name)) {
1925 if (STRCASEEQ('l','L',"left",value)) {
1927 W_L("text-align:left");
1930 else if (STRCASEEQ('r','R',"right",value)) {
1932 W_L("text-align:right");
1935 else if (STRCASEEQ('c','C',"center",value)) {
1937 W_L("text-align:center");
1950 * It is a handler who processes the H1 tag.
1952 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1953 * destination is specified.
1954 * @param node [i] The H1 tag node is specified.
1955 * @return The conversion result is returned.
1958 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
1960 xhtml_t *xhtml = GET_XHTML(pdoc);
1961 Doc *doc = xhtml->doc;
1969 * It is a handler who processes the H2 tag.
1971 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1972 * destination is specified.
1973 * @param node [i] The H2 tag node is specified.
1974 * @return The conversion result is returned.
1977 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
1979 xhtml_t *xhtml = GET_XHTML(pdoc);
1980 Doc *doc = xhtml->doc;
1984 for (attr = qs_get_attr(doc,node);
1986 attr = qs_get_next_attr(doc,attr)) {
1989 name = qs_get_attr_name(doc,attr);
1990 value = qs_get_attr_value(doc,attr);
1991 if (STRCASEEQ('a','A',"align", name)) {
1993 if (STRCASEEQ('l','L',"left",value)) {
1995 W_L("text-align:left");
1998 else if (STRCASEEQ('r','R',"right",value)) {
2000 W_L("text-align:right");
2003 else if (STRCASEEQ('c','C',"center",value)) {
2005 W_L("text-align:center");
2018 * It is a handler who processes the H2 tag.
2020 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2021 * destination is specified.
2022 * @param node [i] The H2 tag node is specified.
2023 * @return The conversion result is returned.
2026 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2028 xhtml_t *xhtml = GET_XHTML(pdoc);
2029 Doc *doc = xhtml->doc;
2037 * It is a handler who processes the H3 tag.
2039 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2040 * destination is specified.
2041 * @param node [i] The H3 tag node is specified.
2042 * @return The conversion result is returned.
2045 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2047 xhtml_t *xhtml = GET_XHTML(pdoc);
2048 Doc *doc = xhtml->doc;
2052 for (attr = qs_get_attr(doc,node);
2054 attr = qs_get_next_attr(doc,attr)) {
2057 name = qs_get_attr_name(doc,attr);
2058 value = qs_get_attr_value(doc,attr);
2059 if (STRCASEEQ('a','A',"align", name)) {
2061 if (STRCASEEQ('l','L',"left",value)) {
2063 W_L("text-align:left");
2066 else if (STRCASEEQ('r','R',"right",value)) {
2068 W_L("text-align:right");
2071 else if (STRCASEEQ('c','C',"center",value)) {
2073 W_L("text-align:center");
2086 * It is a handler who processes the H3 tag.
2088 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2089 * destination is specified.
2090 * @param node [i] The H3 tag node is specified.
2091 * @return The conversion result is returned.
2094 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2096 xhtml_t *xhtml = GET_XHTML(pdoc);
2097 Doc *doc = xhtml->doc;
2105 * It is a handler who processes the H4 tag.
2107 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2108 * destination is specified.
2109 * @param node [i] The H4 tag node is specified.
2110 * @return The conversion result is returned.
2113 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2115 xhtml_t *xhtml = GET_XHTML(pdoc);
2116 Doc *doc = xhtml->doc;
2120 for (attr = qs_get_attr(doc,node);
2122 attr = qs_get_next_attr(doc,attr)) {
2125 name = qs_get_attr_name(doc,attr);
2126 value = qs_get_attr_value(doc,attr);
2127 if (STRCASEEQ('a','A',"align", name)) {
2129 if (STRCASEEQ('l','L',"left",value)) {
2131 W_L("text-align:left");
2134 else if (STRCASEEQ('r','R',"right",value)) {
2136 W_L("text-align:right");
2139 else if (STRCASEEQ('c','C',"center",value)) {
2141 W_L("text-align:center");
2154 * It is a handler who processes the H4 tag.
2156 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2157 * destination is specified.
2158 * @param node [i] The H4 tag node is specified.
2159 * @return The conversion result is returned.
2162 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
2164 xhtml_t *xhtml = GET_XHTML(pdoc);
2165 Doc *doc = xhtml->doc;
2173 * It is a handler who processes the H5 tag.
2175 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2176 * destination is specified.
2177 * @param node [i] The H5 tag node is specified.
2178 * @return The conversion result is returned.
2181 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
2183 xhtml_t *xhtml = GET_XHTML(pdoc);
2184 Doc *doc = xhtml->doc;
2188 for (attr = qs_get_attr(doc,node);
2190 attr = qs_get_next_attr(doc,attr)) {
2193 name = qs_get_attr_name(doc,attr);
2194 value = qs_get_attr_value(doc,attr);
2195 if (STRCASEEQ('a','A',"align", name)) {
2197 if (STRCASEEQ('l','L',"left",value)) {
2199 W_L("text-align:left");
2202 else if (STRCASEEQ('r','R',"right",value)) {
2204 W_L("text-align:right");
2207 else if (STRCASEEQ('c','C',"center",value)) {
2209 W_L("text-align:center");
2222 * It is a handler who processes the H5 tag.
2224 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2225 * destination is specified.
2226 * @param node [i] The H5 tag node is specified.
2227 * @return The conversion result is returned.
2230 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2232 xhtml_t *xhtml = GET_XHTML(pdoc);
2233 Doc *doc = xhtml->doc;
2241 * It is a handler who processes the H6 tag.
2243 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2244 * destination is specified.
2245 * @param node [i] The H6 tag node is specified.
2246 * @return The conversion result is returned.
2249 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2251 xhtml_t *xhtml = GET_XHTML(pdoc);
2252 Doc *doc = xhtml->doc;
2256 for (attr = qs_get_attr(doc,node);
2258 attr = qs_get_next_attr(doc,attr)) {
2261 name = qs_get_attr_name(doc,attr);
2262 value = qs_get_attr_value(doc,attr);
2263 if (STRCASEEQ('a','A',"align", name)) {
2265 if (STRCASEEQ('l','L',"left",value)) {
2267 W_L("text-align:left");
2270 else if (STRCASEEQ('r','R',"right",value)) {
2272 W_L("text-align:right");
2275 else if (STRCASEEQ('c','C',"center",value)) {
2277 W_L("text-align:center");
2290 * It is a handler who processes the H6 tag.
2292 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2293 * destination is specified.
2294 * @param node [i] The H6 tag node is specified.
2295 * @return The conversion result is returned.
2298 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
2300 xhtml_t *xhtml = GET_XHTML(pdoc);
2301 Doc *doc = xhtml->doc;
2309 * It is a handler who processes the OL tag.
2311 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2312 * destination is specified.
2313 * @param node [i] The OL tag node is specified.
2314 * @return The conversion result is returned.
2317 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
2319 xhtml_t *xhtml = GET_XHTML(pdoc);
2320 Doc *doc = xhtml->doc;
2324 /*--------------------------------------------------------------------------*/
2325 /* Get Attributes */
2326 /*--------------------------------------------------------------------------*/
2327 for (attr = qs_get_attr(doc,node);
2329 attr = qs_get_next_attr(doc,attr)) {
2330 char *name = qs_get_attr_name(doc,attr);
2331 char *value = qs_get_attr_value(doc,attr);
2332 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2337 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2349 * It is a handler who processes the OL tag.
2351 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2352 * destination is specified.
2353 * @param node [i] The OL tag node is specified.
2354 * @return The conversion result is returned.
2357 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
2359 xhtml_t *xhtml = GET_XHTML(pdoc);
2360 Doc *doc = xhtml->doc;
2368 * It is a handler who processes the LI tag.
2370 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2371 * destination is specified.
2372 * @param node [i] The LI tag node is specified.
2373 * @return The conversion result is returned.
2376 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
2378 xhtml_t *xhtml = GET_XHTML(pdoc);
2379 Doc *doc = xhtml->doc;
2383 /*--------------------------------------------------------------------------*/
2384 /* Get Attributes */
2385 /*--------------------------------------------------------------------------*/
2386 for (attr = qs_get_attr(doc,node);
2388 attr = qs_get_next_attr(doc,attr)) {
2389 char *name = qs_get_attr_name(doc,attr);
2390 char *value = qs_get_attr_value(doc,attr);
2391 if (STRCASEEQ('t','T',"type",name)) {
2392 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2398 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2410 ** It is a handler who processes the LI tag.
2412 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2413 * destination is specified.
2414 * @param node [i] The LI tag node is specified.
2415 * @return The conversion result is returned.
2418 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
2420 xhtml_t *xhtml = GET_XHTML(pdoc);
2421 Doc *doc = xhtml->doc;
2428 * It is a handler who processes the IMG tag.
2430 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2431 * destination is specified.
2432 * @param node [i] The IMG tag node is specified.
2433 * @return The conversion result is returned.
2436 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
2438 xhtml_t *xhtml = GET_XHTML(pdoc);
2439 Doc *doc = xhtml->doc;
2440 request_rec *r = doc->r;
2443 #ifndef IMG_NOT_CONVERT_FILENAME
2444 device_table *spec = xhtml->spec;
2448 /*--------------------------------------------------------------------------*/
2449 /* Get Attributes */
2450 /*--------------------------------------------------------------------------*/
2451 for (attr = qs_get_attr(doc,node);
2453 attr = qs_get_next_attr(doc,attr)) {
2454 char *name = qs_get_attr_name(doc,attr);
2455 char *value = qs_get_attr_value(doc,attr);
2457 if (STRCASEEQ('s','S',"src",name)) {
2458 value = chxj_encoding_parameter(r, value);
2459 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
2460 value = chxj_add_cookie_no_update_parameter(r, value);
2461 #ifdef IMG_NOT_CONVERT_FILENAME
2471 char *vv = chxj_img_conv(r,spec,value);
2479 if (STRCASEEQ('a','A',"align",name)) {
2481 if (STRCASEEQ('t','T',"top", value) ||
2482 STRCASEEQ('m','M',"middle",value) ||
2483 STRCASEEQ('b','B',"bottom",value) ||
2484 STRCASEEQ('l','L',"left", value) ||
2485 STRCASEEQ('r','R',"right", value)) {
2490 else if (STRCASEEQ('c','C',"center", value)) {
2497 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2502 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2507 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2512 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
2517 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
2529 * It is a handler who processes the IMG tag.
2531 * @param xhtml [i/o] The pointer to the XHTML structure at the output
2532 * destination is specified.
2533 * @param node [i] The IMG tag node is specified.
2534 * @return The conversion result is returned.
2537 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
2539 xhtml_t *xhtml = GET_XHTML(pdoc);
2546 * It is a handler who processes the SELECT tag.
2548 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2549 * destination is specified.
2550 * @param node [i] The SELECT tag node is specified.
2551 * @return The conversion result is returned.
2554 s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
2556 xhtml_t *xhtml = GET_XHTML(pdoc);
2557 Doc *doc = xhtml->doc;
2560 char *multiple = NULL;
2565 for (attr = qs_get_attr(doc,child);
2567 attr = qs_get_next_attr(doc,attr)) {
2568 char *nm = qs_get_attr_name(doc,attr);
2569 char *val = qs_get_attr_value(doc,attr);
2570 if (STRCASEEQ('s','S',"size",nm)) {
2571 /*----------------------------------------------------------------------*/
2572 /* CHTML 1.0 version 2.0 */
2573 /*----------------------------------------------------------------------*/
2574 size = apr_pstrdup(doc->buf.pool, val);
2576 else if (STRCASEEQ('n','N',"name",nm)) {
2577 /*----------------------------------------------------------------------*/
2578 /* CHTML 1.0 version 2.0 */
2579 /*----------------------------------------------------------------------*/
2580 name = apr_pstrdup(doc->buf.pool, val);
2582 else if (STRCASEEQ('m','M',"multiple",nm)) {
2583 /*----------------------------------------------------------------------*/
2584 /* CHTML 1.0 version 2.0 */
2585 /*----------------------------------------------------------------------*/
2586 multiple = apr_pstrdup(doc->buf.pool, val);
2589 if (size && *size) {
2594 if (name && *name) {
2600 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
2601 W_L(" multiple=\"true\"");
2609 * It is a handler who processes the SELECT tag.
2611 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2612 * destination is specified.
2613 * @param node [i] The SELECT tag node is specified.
2614 * @return The conversion result is returned.
2617 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
2619 xhtml_t *xhtml = GET_XHTML(pdoc);
2620 Doc *doc = xhtml->doc;
2628 * It is a handler who processes the OPTION tag.
2630 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2631 * destination is specified.
2632 * @param node [i] The OPTION tag node is specified.
2633 * @return The conversion result is returned.
2636 s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
2638 xhtml_t *xhtml = GET_XHTML(pdoc);
2639 Doc *doc = xhtml->doc;
2642 char *selected = NULL;
2646 for (attr = qs_get_attr(doc,child);
2648 attr = qs_get_next_attr(doc,attr)) {
2649 char *nm = qs_get_attr_name(doc,attr);
2650 char *val = qs_get_attr_value(doc,attr);
2651 if (STRCASEEQ('s','S',"selected",nm)) {
2652 /* CHTML version 2.0 */
2653 selected = apr_pstrdup(doc->buf.pool, val);
2655 else if (STRCASEEQ('v','V',"value",nm)) {
2656 /* CHTML version 2.0 */
2657 value = apr_pstrdup(doc->buf.pool, val);
2666 W_L(" selected=\"selected\"");
2674 * It is a handler who processes the OPTION tag.
2676 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2677 * destination is specified.
2678 * @param node [i] The OPTION tag node is specified.
2679 * @return The conversion result is returned.
2682 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
2684 xhtml_t *xhtml = GET_XHTML(pdoc);
2685 Doc *doc = xhtml->doc;
2693 * It is a handler who processes the DIV tag.
2695 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2696 * destination is specified.
2697 * @param node [i] The DIV tag node is specified.
2698 * @return The conversion result is returned.
2701 s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
2703 xhtml_t *xhtml = GET_XHTML(pdoc);
2704 Doc *doc = xhtml->doc;
2709 for (attr = qs_get_attr(doc,child);
2711 attr = qs_get_next_attr(doc,attr)) {
2712 char *nm = qs_get_attr_name(doc,attr);
2713 char *val = qs_get_attr_value(doc,attr);
2714 if (STRCASEEQ('a','A',"align",nm)) {
2715 /*=====================================================================*/
2716 /* CHTML version 3.2 */
2717 /*=====================================================================*/
2718 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2719 align = apr_pstrdup(doc->buf.pool, val);
2734 * It is a handler who processes the DIV tag.
2736 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2737 * destination is specified.
2738 * @param node [i] The DIV tag node is specified.
2739 * @return The conversion result is returned.
2742 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
2744 xhtml_t *xhtml = GET_XHTML(pdoc);
2745 Doc *doc = xhtml->doc;
2752 * It is a handler who processes the B tag.
2754 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2755 * destination is specified.
2756 * @param node [i] The B tag node is specified.
2757 * @return The conversion result is returned.
2760 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
2762 xhtml_t *xhtml = GET_XHTML(pdoc);
2763 Doc *doc = xhtml->doc;
2765 W_L("<div style=\"font-weight:bold\">");
2771 * It is a handler who processes the B tag.
2773 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2774 * destination is specified.
2775 * @param node [i] The B tag node is specified.
2776 * @return The conversion result is returned.
2779 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
2781 xhtml_t *xhtml = GET_XHTML(pdoc);
2782 Doc *doc = xhtml->doc;
2790 * It is a handler who processes the CHXJ:IF tag.
2792 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2793 * destination is specified.
2794 * @param node [i] The CHXJ:IF tag node is specified.
2797 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
2799 xhtml_t *xhtml = GET_XHTML(pdoc);
2800 Doc *doc = xhtml->doc;
2803 for (child = qs_get_child_node(doc, node);
2805 child = qs_get_next_node(doc, child)) {
2807 s_xhtml_1_0_chxjif_tag(xhtml, child);
2815 * It is a handler who processes the TEXTARE tag.
2817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2818 * destination is specified.
2819 * @param node [i] The TEXTAREA tag node is specified.
2820 * @return The conversion result is returned.
2823 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
2825 xhtml_t *xhtml = GET_XHTML(pdoc);
2826 Doc *doc = xhtml->doc;
2829 xhtml->textarea_flag++;
2831 for (attr = qs_get_attr(doc,node);
2833 attr = qs_get_next_attr(doc,attr)) {
2834 char *name = qs_get_attr_name(doc,attr);
2835 char *value = qs_get_attr_value(doc,attr);
2836 if (STRCASEEQ('n','N',"name",name) && value && *value) {
2841 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
2846 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
2851 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
2852 char *fmt = qs_conv_istyle_to_format(doc->r,value);
2857 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
2858 W_L(" accesskey=\"");
2869 * It is a handler who processes the TEXTAREA tag.
2871 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2872 * destination is specified.
2873 * @param node [i] The TEXTAREA tag node is specified.
2874 * @return The conversion result is returned.
2877 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2879 xhtml_t *xhtml = GET_XHTML(pdoc);
2880 Doc *doc = xhtml->doc;
2883 xhtml->textarea_flag--;
2889 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
2891 xhtml_t *xhtml = GET_XHTML(pdoc);
2892 Doc *doc = xhtml->doc;
2893 request_rec *r = doc->r;
2901 textval = qs_get_node_value(doc,child);
2902 if (strlen(textval) == 0) {
2906 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2907 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2909 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
2910 memset(one_byte, 0, sizeof(one_byte));
2913 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2915 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
2917 DBG(r,"[%s][%d]", out, rtn);
2918 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2922 if (is_sjis_kanji(textval[ii])) {
2923 one_byte[0] = textval[ii+0];
2924 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2925 one_byte[0] = textval[ii+1];
2926 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2929 else if (xhtml->pre_flag) {
2930 one_byte[0] = textval[ii+0];
2931 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2933 else if (xhtml->textarea_flag) {
2934 one_byte[0] = textval[ii+0];
2935 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2937 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2938 one_byte[0] = textval[ii+0];
2939 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2948 * It is a handler who processes the BLOCKQUOTE tag.
2950 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2951 * destination is specified.
2952 * @param node [i] The BLOCKQUOTE tag node is specified.
2953 * @return The conversion result is returned.
2956 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2958 xhtml_t *xhtml = GET_XHTML(pdoc);
2959 Doc *doc = xhtml->doc;
2960 W_L("<blockquote>");
2966 * It is a handler who processes the BLOCKQUOTE tag.
2968 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2969 * destination is specified.
2970 * @param node [i] The BLOCKQUOTE tag node is specified.
2971 * @return The conversion result is returned.
2974 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2976 xhtml_t *xhtml = GET_XHTML(pdoc);
2977 Doc *doc = xhtml->doc;
2978 W_L("</blockquote>");
2984 * It is a handler who processes the DIR tag.
2986 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2987 * destination is specified.
2988 * @param node [i] The DIR tag node is specified.
2989 * @return The conversion result is returned.
2992 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
2994 xhtml_t *xhtml = GET_XHTML(pdoc);
2995 Doc *doc = xhtml->doc;
2998 for (attr = qs_get_attr(doc,node);
3000 attr = qs_get_next_attr(doc,attr)) {
3001 char *name = qs_get_attr_name(doc,attr);
3002 char *value = qs_get_attr_value(doc,attr);
3003 if (STRCASEEQ('t','T',"type",name)) {
3004 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3017 * It is a handler who processes the DIR tag.
3019 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3020 * destination is specified.
3021 * @param node [i] The DIR tag node is specified.
3022 * @return The conversion result is returned.
3025 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
3027 xhtml_t *xhtml = GET_XHTML(pdoc);
3028 Doc *doc = xhtml->doc;
3035 * It is a handler who processes the DL tag.
3037 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3038 * destination is specified.
3039 * @param node [i] The DL tag node is specified.
3040 * @return The conversion result is returned.
3043 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
3045 xhtml_t *xhtml = GET_XHTML(pdoc);
3046 Doc *doc = xhtml->doc;
3053 * It is a handler who processes the DL tag.
3055 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3056 * destination is specified.
3057 * @param node [i] The DL tag node is specified.
3058 * @return The conversion result is returned.
3061 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
3063 xhtml_t *xhtml = GET_XHTML(pdoc);
3064 Doc *doc = xhtml->doc;
3071 * It is a handter who processes the DT tag.
3073 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3074 * destination is specified.
3075 * @param node [i] The DT tag node is specified.
3076 * @return The conversion result is returned.
3079 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *UNUSED(child))
3081 xhtml_t *xhtml = GET_XHTML(pdoc);
3082 Doc *doc = xhtml->doc;
3089 * It is a handter who processes the DT tag.
3091 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3092 * destination is specified.
3093 * @param node [i] The DT tag node is specified.
3094 * @return The conversion result is returned.
3097 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
3099 xhtml_t *xhtml = GET_XHTML(pdoc);
3100 Doc *doc = xhtml->doc;
3107 * It is a handder who processes the DD tag.
3109 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3110 * destination is specified.
3111 * @param node [i] The DD tag node is specified.
3112 * @return The conversion result is returned.
3115 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *UNUSED(child))
3117 xhtml_t *xhtml = GET_XHTML(pdoc);
3118 Doc *doc = xhtml->doc;
3125 * It is a handder who processes the DD tag.
3127 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3128 * destination is specified.
3129 * @param node [i] The DD tag node is specified.
3130 * @return The conversion result is returned.
3133 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
3135 xhtml_t *xhtml = GET_XHTML(pdoc);
3136 Doc *doc = xhtml->doc;
3143 * It is a handler who processes the MENU tag.
3145 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3146 * destination is specified.
3147 * @param node [i] The MENU tag node is specified.
3148 * @return The conversion result is returned.
3151 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
3153 xhtml_t *xhtml = GET_XHTML(pdoc);
3154 Doc *doc = xhtml->doc;
3157 /*--------------------------------------------------------------------------*/
3158 /* Get Attributes */
3159 /*--------------------------------------------------------------------------*/
3160 for (attr = qs_get_attr(doc,node);
3162 attr = qs_get_next_attr(doc,attr)) {
3163 char *name = qs_get_attr_name(doc,attr);
3164 char *value = qs_get_attr_value(doc,attr);
3165 if (STRCASEEQ('t','T',"type",name)) {
3166 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3179 * It is a hanmenuer who processes the MENU tag.
3181 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3182 * destination is specified.
3183 * @param node [i] The MENU tag node is specified.
3184 * @return The conversion result is returned.
3187 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
3189 xhtml_t *xhtml = GET_XHTML(pdoc);
3190 Doc *doc = xhtml->doc;
3197 * It is a handler who processes the PLAINTEXT tag.
3199 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3200 * destination is specified.
3201 * @param node [i] The PLAINTEXT tag node is specified.
3202 * @return The conversion result is returned.
3205 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
3207 xhtml_t *xhtml = GET_XHTML(pdoc);
3208 Doc *doc = xhtml->doc;
3210 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
3215 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
3217 xhtml_t *xhtml = GET_XHTML(pdoc);
3218 Doc *doc = xhtml->doc;
3220 for (child = qs_get_child_node(doc, node);
3222 child = qs_get_next_node(doc, child)) {
3224 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
3231 * It is a handler who processes the PLAINTEXT tag.
3233 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3234 * destination is specified.
3235 * @param node [i] The PLAINTEXT tag node is specified.
3236 * @return The conversion result is returned.
3239 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3241 xhtml_t *xhtml = GET_XHTML(pdoc);
3242 Doc *doc = xhtml->doc;
3243 W_L("</plaintext>");
3249 * It is a hanblinker who processes the BLINK tag.
3251 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3252 * destination is specified.
3253 * @param node [i] The BLINK tag node is specified.
3254 * @return The conversion result is returned.
3257 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *UNUSED(child))
3259 xhtml_t *xhtml = GET_XHTML(pdoc);
3260 Doc *doc = xhtml->doc;
3267 * It is a hanblinker who processes the BLINK tag.
3269 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3270 * destination is specified.
3271 * @param node [i] The BLINK tag node is specified.
3272 * @return The conversion result is returned.
3275 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(child))
3277 xhtml_t *xhtml = GET_XHTML(pdoc);
3278 Doc *doc = xhtml->doc;
3285 * It is a handler who processes the MARQUEE tag.
3287 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3288 * destination is specified.
3289 * @param node [i] The MARQUEE tag node is specified.
3290 * @return The conversion result is returned.
3293 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
3295 xhtml_t *xhtml = GET_XHTML(pdoc);
3296 Doc *doc = xhtml->doc;
3299 /*--------------------------------------------------------------------------*/
3300 /* Get Attributes */
3301 /*--------------------------------------------------------------------------*/
3302 for (attr = qs_get_attr(doc,node);
3304 attr = qs_get_next_attr(doc,attr)) {
3305 char *name = qs_get_attr_name(doc,attr);
3306 char *value = qs_get_attr_value(doc,attr);
3307 if (STRCASEEQ('d','D',"direction", name)) {
3308 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3309 W_L(" direction=\"");
3314 else if (STRCASEEQ('b','B',"behavior",name)) {
3315 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
3316 W_L(" behavior=\"");
3321 else if (STRCASEEQ('l','L',"loop",name)) {
3322 if (value && *value) {
3328 else if (STRCASEEQ('b','B',"bgcolor",name)) {
3329 if (value && *value) {
3342 * It is a handler who processes the MARQUEE tag.
3344 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3345 * destination is specified.
3346 * @param node [i] The MARQUEE tag node is specified.
3347 * @return The conversion result is returned.
3350 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3352 xhtml_t *xhtml = GET_XHTML(pdoc);
3353 Doc *doc = xhtml->doc;
3360 * It is handler who processes the New Line Code.
3363 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
3365 xhtml_t *xhtml = GET_XHTML(pdoc);
3366 Doc *doc = xhtml->doc;