2 * Copyright (C) 2005-2011 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"
27 #include "chxj_conv_z2h.h"
29 #define GET_XHTML(X) ((xhtml_t*)(X))
32 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
38 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node);
102 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_start_plaintext_tag (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_end_plaintext_tag (void *pdoc, Node *node);
116 static char *s_xhtml_1_0_start_blink_tag (void *pdoc, Node *node);
117 static char *s_xhtml_1_0_end_blink_tag (void *pdoc, Node *node);
118 static char *s_xhtml_1_0_start_marquee_tag (void *pdoc, Node *node);
119 static char *s_xhtml_1_0_end_marquee_tag (void *pdoc, Node *node);
120 static char *s_xhtml_1_0_newline_mark (void *pdoc, Node *node);
122 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
123 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
124 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
127 tag_handler xhtml_handler[] = {
130 s_xhtml_1_0_start_html_tag,
131 s_xhtml_1_0_end_html_tag,
135 s_xhtml_1_0_start_meta_tag,
136 s_xhtml_1_0_end_meta_tag,
140 s_xhtml_1_0_start_textarea_tag,
141 s_xhtml_1_0_end_textarea_tag,
145 s_xhtml_1_0_start_p_tag,
146 s_xhtml_1_0_end_p_tag,
150 s_xhtml_1_0_start_pre_tag,
151 s_xhtml_1_0_end_pre_tag,
155 s_xhtml_1_0_start_ul_tag,
156 s_xhtml_1_0_end_ul_tag,
160 s_xhtml_1_0_start_li_tag,
161 s_xhtml_1_0_end_li_tag,
165 s_xhtml_1_0_start_ol_tag,
166 s_xhtml_1_0_end_ol_tag,
170 s_xhtml_1_0_start_h1_tag,
171 s_xhtml_1_0_end_h1_tag,
175 s_xhtml_1_0_start_h2_tag,
176 s_xhtml_1_0_end_h2_tag,
180 s_xhtml_1_0_start_h3_tag,
181 s_xhtml_1_0_end_h3_tag,
185 s_xhtml_1_0_start_h4_tag,
186 s_xhtml_1_0_end_h4_tag,
190 s_xhtml_1_0_start_h5_tag,
191 s_xhtml_1_0_end_h5_tag,
195 s_xhtml_1_0_start_h6_tag,
196 s_xhtml_1_0_end_h6_tag,
200 s_xhtml_1_0_start_head_tag,
201 s_xhtml_1_0_end_head_tag,
205 s_xhtml_1_0_start_title_tag,
206 s_xhtml_1_0_end_title_tag,
210 s_xhtml_1_0_start_base_tag,
211 s_xhtml_1_0_end_base_tag,
215 s_xhtml_1_0_start_body_tag,
216 s_xhtml_1_0_end_body_tag,
220 s_xhtml_1_0_start_a_tag,
221 s_xhtml_1_0_end_a_tag,
225 s_xhtml_1_0_start_br_tag,
226 s_xhtml_1_0_end_br_tag,
235 s_xhtml_1_0_start_tr_tag,
236 s_xhtml_1_0_end_tr_tag,
250 s_xhtml_1_0_start_font_tag,
251 s_xhtml_1_0_end_font_tag,
255 s_xhtml_1_0_start_form_tag,
256 s_xhtml_1_0_end_form_tag,
260 s_xhtml_1_0_start_input_tag,
261 s_xhtml_1_0_end_input_tag,
265 s_xhtml_1_0_start_center_tag,
266 s_xhtml_1_0_end_center_tag,
270 s_xhtml_1_0_start_hr_tag,
271 s_xhtml_1_0_end_hr_tag,
275 s_xhtml_1_0_start_img_tag,
276 s_xhtml_1_0_end_img_tag,
280 s_xhtml_1_0_start_select_tag,
281 s_xhtml_1_0_end_select_tag,
285 s_xhtml_1_0_start_option_tag,
286 s_xhtml_1_0_end_option_tag,
290 s_xhtml_1_0_start_div_tag,
291 s_xhtml_1_0_end_div_tag,
295 s_xhtml_1_0_chxjif_tag,
300 s_xhtml_1_0_chxjif_tag,
325 s_xhtml_1_0_text_tag,
335 s_xhtml_1_0_start_b_tag,
336 s_xhtml_1_0_end_b_tag,
345 s_xhtml_1_0_start_dt_tag,
346 s_xhtml_1_0_end_dt_tag,
360 s_xhtml_1_0_start_blockquote_tag,
361 s_xhtml_1_0_end_blockquote_tag,
365 s_xhtml_1_0_start_dir_tag,
366 s_xhtml_1_0_end_dir_tag,
370 s_xhtml_1_0_start_dl_tag,
371 s_xhtml_1_0_end_dl_tag,
375 s_xhtml_1_0_start_dd_tag,
376 s_xhtml_1_0_end_dd_tag,
380 s_xhtml_1_0_start_menu_tag,
381 s_xhtml_1_0_end_menu_tag,
385 s_xhtml_1_0_start_plaintext_tag,
386 s_xhtml_1_0_end_plaintext_tag,
390 s_xhtml_1_0_start_blink_tag,
391 s_xhtml_1_0_end_blink_tag,
395 s_xhtml_1_0_start_marquee_tag,
396 s_xhtml_1_0_end_marquee_tag,
400 s_xhtml_1_0_newline_mark,
406 * converts from CHTML to XHTML.
408 * @param r [i] Requet_rec is appointed.
409 * @param spec [i] The result of the device specification processing which
410 * was done in advance is appointed.
411 * @param src [i] The character string before the converting is appointed.
412 * @return The character string after the converting is returned.
415 chxj_convert_xhtml_mobile_1_0(
421 chxjconvrule_entry *entryp,
430 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
431 /*--------------------------------------------------------------------------*/
433 /*--------------------------------------------------------------------------*/
435 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
437 DBG(r,"REQ[%X] found qrcode.xml", TO_ADDR(r));
438 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
442 /*--------------------------------------------------------------------------*/
443 /* The XHTML structure is initialized. */
444 /*--------------------------------------------------------------------------*/
445 s_init_xhtml(&xhtml, &doc, r, spec);
447 xhtml.entryp = entryp;
448 xhtml.cookie = cookie;
450 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
452 /*--------------------------------------------------------------------------*/
453 /* The character string of the input is analyzed. */
454 /*--------------------------------------------------------------------------*/
455 qs_init_malloc(&doc);
456 qs_init_root_node(&doc);
458 ss = apr_pcalloc(r->pool, srclen + 1);
459 memset(ss, 0, srclen + 1);
460 memcpy(ss, src, srclen);
463 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
465 qs_parse_string(&doc,ss, strlen(ss));
467 chxj_buffered_write_init(r->pool, &doc.buf);
468 /*--------------------------------------------------------------------------*/
469 /* It converts it from CHTML to XHTML. */
470 /*--------------------------------------------------------------------------*/
471 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
472 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
473 dst = apr_pstrdup(r->pool, xhtml.out);
474 chxj_buffered_write_terminate(&doc.buf);
476 qs_all_free(&doc,QX_LOGMARK);
479 return apr_pstrdup(r->pool,ss);
483 dst = apr_psprintf(r->pool, "\n");
485 *dstlen = strlen(dst);
488 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
491 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
497 * The XHTML structure is initialized.
499 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
500 * initialized is specified.
501 * @param doc [i] The Doc structure that should be set to the initialized
502 * HDML structure is specified.
503 * @param r [i] To use POOL, the pointer to request_rec is specified.
504 * @param spec [i] The pointer to the device_table
507 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
509 memset(doc, 0, sizeof(Doc));
510 memset(xhtml, 0, sizeof(xhtml_t));
515 xhtml->out = qs_alloc_zero_byte_string(r->pool);
516 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
517 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
522 * Corresponding EMOJI to a current character-code is retrieved.
523 * The substitution character string is stored in the rslt pointer if agreeing.
525 * @param xhtml [i] The pointer to the XHTML structure is specified.
526 * @param txt [i] The character string to want to examine whether it is
527 * EMOJI is specified.
528 * @param rslt [o] The pointer to the pointer that stores the result is
530 * @return When corresponding EMOJI exists, it returns it excluding 0.
533 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
546 DBG(r,"REQ[%X] spec is NULL", TO_ADDR(r));
549 for (ee = xhtml->conf->emoji;
552 unsigned char hex1byte;
553 unsigned char hex2byte;
555 DBG(r,"REQ[%X] emoji->imode is NULL", TO_ADDR(r));
559 if (ee->imode->string != NULL
560 && strlen(ee->imode->string) > 0
561 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
562 if (spec == NULL || spec->emoji_type == NULL) {
563 *rslt = apr_psprintf(r->pool,
566 return strlen(ee->imode->string);
569 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
570 *rslt = apr_psprintf(r->pool,
573 return strlen(ee->imode->string);
576 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
577 *rslt = apr_psprintf(r->pool,
580 return strlen(ee->imode->string);
583 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
584 *rslt = apr_psprintf(r->pool,
587 return strlen(ee->imode->string);
590 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
591 *rslt = apr_psprintf(r->pool,
594 return strlen(ee->imode->string);
597 *rslt = apr_psprintf(r->pool,
600 return strlen(ee->imode->string);
604 hex1byte = ee->imode->hex1byte & 0xff;
605 hex2byte = ee->imode->hex2byte & 0xff;
607 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
608 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
609 if (spec == NULL || spec->emoji_type == NULL) {
610 *rslt = apr_psprintf(r->pool,
611 "<img localsrc=\"%s\">",
616 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
617 *rslt = apr_psprintf(r->pool,
618 "<img localsrc=\"%s\">",
623 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
624 *rslt = apr_psprintf(r->pool,
625 "<img localsrc=\"%s\">",
630 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
631 *rslt = apr_psprintf(r->pool,
632 "<img localsrc=\"%s\">",
637 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
638 *rslt = apr_psprintf(r->pool,
639 "<img localsrc=\"%s\">",
644 *rslt = apr_psprintf(r->pool,
645 "<img localsrc=\"%s\">",
657 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
671 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
672 memset(doc, 0, sizeof(Doc));
673 memset(xhtml, 0, sizeof(xhtml_t));
678 xhtml->out = qs_alloc_zero_byte_string(r->pool);
679 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
680 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
682 apr_pool_create(&pool, r->pool);
684 chxj_buffered_write_init(pool, &doc->buf);
686 for (ii=0; ii<len; ii++) {
690 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
697 if (is_sjis_kanji(src[ii])) {
698 two_byte[0] = src[ii+0];
699 two_byte[1] = src[ii+1];
705 one_byte[0] = src[ii+0];
710 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
712 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
718 * It is a handler who processes the HTML tag.
720 * @param pdoc [i/o] The pointer to the XHTML structure at the output
721 * destination is specified.
722 * @param node [i] The HTML tag node is specified.
723 * @return The conversion result is returned.
726 s_xhtml_1_0_start_html_tag(void *pdoc, Node *node)
728 xhtml_t *xhtml = GET_XHTML(pdoc);
730 Doc *doc = xhtml->doc;
732 /*--------------------------------------------------------------------------*/
733 /* Add XML Declare */
734 /*--------------------------------------------------------------------------*/
735 W_L("<?xml version=\"1.0\" encoding=\"Windows-31J\"?>");
737 /*--------------------------------------------------------------------------*/
739 /*--------------------------------------------------------------------------*/
740 W_L("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"");
742 W_L(" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">");
744 /*--------------------------------------------------------------------------*/
746 /*--------------------------------------------------------------------------*/
747 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\"");
748 /*--------------------------------------------------------------------------*/
750 /*--------------------------------------------------------------------------*/
751 for (attr = qs_get_attr(doc,node);
753 attr = qs_get_next_attr(doc,attr)) {
754 char* name = qs_get_attr_name(doc,attr);
755 char* value = qs_get_attr_value(doc,attr);
756 if (STRCASEEQ('l','L',"lang", name)) {
761 else if (STRCASEEQ('v','V',"version", name)) {
762 W_L(" version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"");
771 * It is a handler who processes the HTML tag.
773 * @param pdoc [i/o] The pointer to the XHTML structure at the output
774 * destination is specified.
775 * @param node [i] The HTML tag node is specified.
776 * @return The conversion result is returned.
779 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
781 xhtml_t *xhtml = GET_XHTML(pdoc);
782 Doc *doc = xhtml->doc;
789 * It is a handler who processes the META tag.
791 * @param pdoc [i/o] The pointer to the XHTML structure at the output
792 * destination is specified.
793 * @param node [i] The META tag node is specified.
794 * @return The conversion result is returned.
797 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
799 xhtml_t *xhtml = GET_XHTML(pdoc);
801 Doc *doc = xhtml->doc;
802 int content_type_flag = 0;
803 request_rec *r = doc->r;
806 /*--------------------------------------------------------------------------*/
808 /*--------------------------------------------------------------------------*/
809 for (attr = qs_get_attr(doc,node);
811 attr = qs_get_next_attr(doc,attr)) {
812 char *name = qs_get_attr_name(doc,attr);
813 char *value = qs_get_attr_value(doc,attr);
814 if (STRCASEEQ('n','N',"name", name) && value && *value) {
821 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
827 if (STRCASEEQ('c','C', "content-type", value)) {
828 content_type_flag = 1;
831 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
832 if (content_type_flag) {
836 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
854 * It is a handler who processes the META tag.
856 * @param pdoc [i/o] The pointer to the XHTML structure at the output
857 * destination is specified.
858 * @param node [i] The META tag node is specified.
859 * @return The conversion result is returned.
862 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
864 xhtml_t *xhtml = GET_XHTML(pdoc);
871 * It is a handler who processes the HEAD tag.
873 * @param pdoc [i/o] The pointer to the XHTML structure at the output
874 * destination is specified.
875 * @param node [i] The HEAD tag node is specified.
876 * @return The conversion result is returned.
879 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
881 xhtml_t *xhtml = GET_XHTML(pdoc);
882 Doc *doc = xhtml->doc;
890 * It is a handler who processes the HEAD tag.
892 * @param pdoc [i/o] The pointer to the XHTML structure at the output
893 * destination is specified.
894 * @param node [i] The HEAD tag node is specified.
895 * @return The conversion result is returned.
898 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
900 xhtml_t *xhtml = GET_XHTML(pdoc);
901 Doc *doc = xhtml->doc;
909 * It is a handler who processes the TITLE tag.
911 * @param pdoc [i/o] The pointer to the XHTML structure at the output
912 * destination is specified.
913 * @param node [i] The TITLE tag node is specified.
914 * @return The conversion result is returned.
917 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
919 xhtml_t *xhtml = GET_XHTML(pdoc);
920 Doc *doc = xhtml->doc;
928 * It is a handler who processes the TITLE tag.
930 * @param pdoc [i/o] The pointer to the XHTML structure at the output
931 * destination is specified.
932 * @param node [i] The TITLE tag node is specified.
933 * @return The conversion result is returned.
936 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
938 xhtml_t *xhtml = GET_XHTML(pdoc);
939 Doc *doc = xhtml->doc;
948 * It is a handler who processes the BASE tag.
950 * @param pdoc [i/o] The pointer to the XHTML structure at the output
951 * destination is specified.
952 * @param node [i] The BASE tag node is specified.
953 * @return The conversion result is returned.
956 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
958 xhtml_t *xhtml = GET_XHTML(pdoc);
960 Doc *doc = xhtml->doc;
963 /*--------------------------------------------------------------------------*/
965 /*--------------------------------------------------------------------------*/
966 for (attr = qs_get_attr(doc,node);
968 attr = qs_get_next_attr(doc,attr)) {
969 char *name = qs_get_attr_name(doc,attr);
970 char *value = qs_get_attr_value(doc,attr);
971 if (STRCASEEQ('h','H',"href",name)) {
985 * It is a handler who processes the BASE tag.
987 * @param pdoc [i/o] The pointer to the XHTML structure at the output
988 * destination is specified.
989 * @param node [i] The BASE tag node is specified.
990 * @return The conversion result is returned.
993 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
995 xhtml_t *xhtml = GET_XHTML(pdoc);
1002 * It is a handler who processes the BODY tag.
1004 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1005 * destination is specified.
1006 * @param node [i] The BODY tag node is specified.
1007 * @return The conversion result is returned.
1010 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1012 xhtml_t *xhtml = GET_XHTML(pdoc);
1013 Doc *doc = xhtml->doc;
1017 /*--------------------------------------------------------------------------*/
1018 /* Get Attributes */
1019 /*--------------------------------------------------------------------------*/
1020 for (attr = qs_get_attr(doc,node);
1022 attr = qs_get_next_attr(doc,attr)) {
1023 char *name = qs_get_attr_name(doc,attr);
1024 char *value = qs_get_attr_value(doc,attr);
1025 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1030 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1035 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1040 else if (STRCASEEQ('a','A',"alink", name)) {
1043 else if (STRCASEEQ('v','V',"vlink",name)) {
1053 * It is a handler who processes the BODY tag.
1055 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1056 * destination is specified.
1057 * @param node [i] The BODY tag node is specified.
1058 * @return The conversion result is returned.
1061 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1063 xhtml_t *xhtml = GET_XHTML(pdoc);
1064 Doc *doc = xhtml->doc;
1072 * It is a handler who processes the A tag.
1074 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1075 * destination is specified.
1076 * @param node [i] The A tag node is specified.
1077 * @return The conversion result is returned.
1080 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1082 xhtml_t *xhtml = GET_XHTML(pdoc);
1083 Doc *doc = xhtml->doc;
1084 request_rec *r = doc->r;
1088 /*--------------------------------------------------------------------------*/
1089 /* Get Attributes */
1090 /*--------------------------------------------------------------------------*/
1091 for (attr = qs_get_attr(doc,node);
1093 attr = qs_get_next_attr(doc,attr)) {
1094 char* name = qs_get_attr_name(doc,attr);
1095 char* value = qs_get_attr_value(doc,attr);
1096 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1101 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1102 value = chxj_encoding_parameter(r, value);
1103 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1104 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1110 else if (STRCASEEQ('a','A',"accesskey", name)) {
1111 W_L(" accesskey=\"");
1115 else if (STRCASEEQ('c','C',"cti",name)) {
1118 else if (STRCASEEQ('i','I',"ijam", name)) {
1121 else if (STRCASEEQ('u','U',"utn", name)) {
1124 else if (STRCASEEQ('t','T',"telbook",name)) {
1127 else if (STRCASEEQ('k','K',"kana",name)) {
1130 else if (STRCASEEQ('e','E',"email",name)) {
1133 else if (STRCASEEQ('i','I',"ista",name)) {
1136 else if (STRCASEEQ('i','I',"ilet",name)) {
1139 else if (STRCASEEQ('i','I',"iswf",name)) {
1142 else if (STRCASEEQ('i','I',"irst",name)) {
1152 * It is a handler who processes the A tag.
1154 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1155 * destination is specified.
1156 * @param node [i] The A tag node is specified.
1157 * @return The conversion result is returned.
1160 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1162 xhtml_t *xhtml = GET_XHTML(pdoc);
1163 Doc *doc = xhtml->doc;
1172 * It is a handler who processes the BR tag.
1174 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1175 * destination is specified.
1176 * @param node [i] The BR tag node is specified.
1177 * @return The conversion result is returned.
1180 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1182 xhtml_t *xhtml = GET_XHTML(pdoc);
1183 Doc *doc = xhtml->doc;
1187 /*--------------------------------------------------------------------------*/
1188 /* Get Attributes */
1189 /*--------------------------------------------------------------------------*/
1190 for (attr = qs_get_attr(doc,node);
1192 attr = qs_get_next_attr(doc,attr)) {
1193 char *name = qs_get_attr_name(doc,attr);
1194 char *value = qs_get_attr_value(doc,attr);
1195 if (STRCASEEQ('c','C',"clear",name)) {
1196 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1210 * It is a handler who processes the BR tag.
1212 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1213 * destination is specified.
1214 * @param node [i] The BR tag node is specified.
1215 * @return The conversion result is returned.
1218 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1220 xhtml_t *xhtml = GET_XHTML(pdoc);
1227 * It is a handler who processes the TR tag.
1229 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1230 * destination is specified.
1231 * @param node [i] The TR tag node is specified.
1232 * @return The conversion result is returned.
1235 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1237 xhtml_t *xhtml = GET_XHTML(pdoc);
1238 Doc *doc = xhtml->doc;
1247 * It is a handler who processes the TR tag.
1249 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1250 * destination is specified.
1251 * @param node [i] The TR tag node is specified.
1252 * @return The conversion result is returned.
1255 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1257 xhtml_t *xhtml = GET_XHTML(pdoc);
1264 * It is a handler who processes the FONT tag.
1266 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1267 * destination is specified.
1268 * @param node [i] The FONT tag node is specified.
1269 * @return The conversion result is returned.
1272 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1274 xhtml_t *xhtml = GET_XHTML(pdoc);
1275 Doc *doc = xhtml->doc;
1280 /*=========================================================================*/
1281 /* Get Attributes */
1282 /*=========================================================================*/
1283 for (attr = qs_get_attr(doc,node);
1285 attr = qs_get_next_attr(doc,attr)) {
1286 char *name = qs_get_attr_name(doc,attr);
1287 char *value = qs_get_attr_value(doc,attr);
1288 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1289 color = apr_pstrdup(doc->buf.pool, value);
1291 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1292 size = apr_pstrdup(doc->buf.pool, value);
1296 W_L("<font color=\"");
1299 xhtml->font_color_flag++;
1302 xhtml->font_size_flag++;
1304 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1305 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1306 case '3': W_L("<span style=\"font-size: small\">"); break;
1307 case '4': W_L("<span style=\"font-size: medium\">"); break;
1308 case '5': W_L("<span style=\"font-size: large\">"); break;
1309 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1310 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1312 if (*(size + 1) == '1') {
1313 W_L("<span style=\"font-size: small\">");
1316 if (*(size + 1) == '2') {
1317 W_L("<span style=\"font-size: x-small\">");
1320 if (*(size + 1) == '3') {
1321 W_L("<span style=\"font-size: xx-small\">");
1324 xhtml->font_size_flag--;
1328 if (*(size + 1) == '1') {
1329 W_L("<span style=\"font-size: large\">");
1332 if (*(size + 1) == '2') {
1333 W_L("<span style=\"font-size: x-large\">");
1336 if (*(size + 1) == '3') {
1337 W_L("<span style=\"font-size: xx-large\">");
1340 xhtml->font_size_flag--;
1344 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", size);
1345 xhtml->font_size_flag--;
1353 * It is a handler who processes the FONT tag.
1355 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1356 * destination is specified.
1357 * @param node [i] The FONT tag node is specified.
1358 * @return The conversion result is returned.
1361 s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child))
1363 xhtml_t *xhtml = GET_XHTML(pdoc);
1364 Doc *doc = xhtml->doc;
1366 if (xhtml->font_size_flag) {
1368 xhtml->font_size_flag--;
1370 if (xhtml->font_color_flag) {
1372 xhtml->font_color_flag--;
1379 * It is a handler who processes the FORM tag.
1381 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1382 * destination is specified.
1383 * @param node [i] The FORM tag node is specified.
1384 * @return The conversion result is returned.
1387 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1389 xhtml_t *xhtml = GET_XHTML(pdoc);
1390 Doc *doc = xhtml->doc;
1391 request_rec *r = doc->r;
1393 char *new_hidden_tag = NULL;
1394 char *attr_action = NULL;
1395 char *attr_method = NULL;
1396 char *attr_name = NULL;
1398 /*--------------------------------------------------------------------------*/
1399 /* Get Attributes */
1400 /*--------------------------------------------------------------------------*/
1401 for (attr = qs_get_attr(doc,node);
1403 attr = qs_get_next_attr(doc,attr)) {
1404 char *name = qs_get_attr_name(doc,attr);
1405 char *value = qs_get_attr_value(doc,attr);
1406 if (STRCASEEQ('a','A',"action",name)) {
1407 attr_action = chxj_encoding_parameter(r, value);
1408 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1410 else if (STRCASEEQ('m','M',"method",name)) {
1411 attr_method = apr_pstrdup(doc->pool, value);
1413 else if (STRCASEEQ('u','U',"utn",name)) {
1416 else if (STRCASEEQ('n','N',"name",name)) {
1417 attr_name = apr_pstrdup(doc->pool, value);
1421 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1426 char *old_qs = NULL;
1427 q = strchr(attr_action, '?');
1429 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);
1430 if (new_hidden_tag || old_qs) {
1453 if (new_hidden_tag) {
1454 W_V(new_hidden_tag);
1461 * It is a handler who processes the FORM tag.
1463 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1464 * destination is specified.
1465 * @param node [i] The FORM tag node is specified.
1466 * @return The conversion result is returned.
1469 s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child))
1471 xhtml_t *xhtml = GET_XHTML(pdoc);
1472 Doc *doc = xhtml->doc;
1481 * It is a handler who processes the INPUT tag.
1483 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1484 * destination is specified.
1485 * @param node [i] The INPUT tag node is specified.
1486 * @return The conversion result is returned.
1489 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1491 xhtml_t *xhtml = GET_XHTML(pdoc);
1492 Doc *doc = xhtml->doc;
1493 request_rec *r = doc->r;
1494 char *max_length = NULL;
1498 char *istyle = NULL;
1500 char *checked = NULL;
1501 char *accesskey = NULL;
1504 /*--------------------------------------------------------------------------*/
1505 /* Get Attributes */
1506 /*--------------------------------------------------------------------------*/
1507 type = qs_get_type_attr(doc, node, doc->buf.pool);
1508 name = qs_get_name_attr(doc, node, doc->buf.pool);
1509 value = qs_get_value_attr(doc,node, doc->buf.pool);
1510 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1511 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1512 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1513 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1514 size = qs_get_size_attr(doc, node, doc->buf.pool);
1517 type = qs_trim_string(doc->buf.pool, type);
1518 if (type && (STRCASEEQ('t','T',"text", type) ||
1519 STRCASEEQ('p','P',"password",type) ||
1520 STRCASEEQ('c','C',"checkbox",type) ||
1521 STRCASEEQ('r','R',"radio", type) ||
1522 STRCASEEQ('h','H',"hidden", type) ||
1523 STRCASEEQ('s','S',"submit", type) ||
1524 STRCASEEQ('r','R',"reset", type))) {
1530 if (size && *size) {
1535 if (name && *name) {
1540 if (value && *value) {
1541 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
1542 apr_size_t value_len = strlen(value);
1543 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
1547 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1550 if (accesskey && *accesskey) {
1551 W_L(" accesskey=\"");
1555 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1556 char *fmt = qs_conv_istyle_to_format(r,istyle);
1557 if (max_length && *max_length) {
1559 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1560 if (max_length[ii] < '0' || max_length[ii] > '9') {
1561 max_length = apr_psprintf(r->pool, "0");
1566 if (strcmp(max_length, "0")) {
1567 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1579 if (max_length && *max_length) {
1580 if (chxj_chk_numeric(max_length) != 0) {
1581 max_length = apr_psprintf(r->pool, "0");
1583 if (strcmp(max_length, "0")) {
1584 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1589 /*--------------------------------------------------------------------------*/
1590 /* The figure is default for the password. */
1591 /*--------------------------------------------------------------------------*/
1592 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1599 W_L(" FORMAT=\"*N\"");
1603 W_L(" checked=\"checked\"");
1612 * It is a handler who processes the INPUT tag.
1614 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1615 * destination is specified.
1616 * @param node [i] The INPUT tag node is specified.
1617 * @return The conversion result is returned.
1620 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1622 xhtml_t *xhtml = GET_XHTML(pdoc);
1629 * It is a handler who processes the CENTER tag.
1631 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1632 * destination is specified.
1633 * @param node [i] The CENTER tag node is specified.
1634 * @return The conversion result is returned.
1637 s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node))
1639 xhtml_t *xhtml = GET_XHTML(pdoc);
1640 Doc *doc = xhtml->doc;
1648 * It is a handler who processes the CENTER tag.
1650 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1651 * destination is specified.
1652 * @param node [i] The CENTER tag node is specified.
1653 * @return The conversion result is returned.
1656 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child))
1658 xhtml_t *xhtml = GET_XHTML(pdoc);
1659 Doc *doc = xhtml->doc;
1667 * It is a handler who processes the HR tag.
1669 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1670 * destination is specified.
1671 * @param node [i] The HR tag node is specified.
1672 * @return The conversion result is returned.
1675 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
1677 xhtml_t *xhtml = GET_XHTML(pdoc);
1678 Doc *doc = xhtml->doc;
1683 for (attr = qs_get_attr(doc,node);
1685 attr = qs_get_next_attr(doc,attr)) {
1686 char *name = qs_get_attr_name(doc,attr);
1687 char *value = qs_get_attr_value(doc,attr);
1688 if (STRCASEEQ('a','A',"align", name)) {
1689 /*----------------------------------------------------------------------*/
1691 /*----------------------------------------------------------------------*/
1692 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1698 else if (STRCASEEQ('s','S',"size", name)) {
1699 /*----------------------------------------------------------------------*/
1701 /*----------------------------------------------------------------------*/
1702 if (value && *value) {
1708 else if (STRCASEEQ('w','W',"width", name)) {
1709 /*----------------------------------------------------------------------*/
1711 /*----------------------------------------------------------------------*/
1712 if (value && *value) {
1718 else if (STRCASEEQ('n','N',"noshade", name)) {
1719 /*----------------------------------------------------------------------*/
1721 /*----------------------------------------------------------------------*/
1724 else if (STRCASEEQ('c','C',"color", name) && value && *value) {
1725 /*----------------------------------------------------------------------*/
1727 /*----------------------------------------------------------------------*/
1739 * It is a handler who processes the HR tag.
1741 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1742 * destination is specified.
1743 * @param node [i] The HR tag node is specified.
1744 * @return The conversion result is returned.
1747 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
1749 xhtml_t *xhtml = GET_XHTML(pdoc);
1756 * It is a handler who processes the PRE tag.
1758 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1759 * destination is specified.
1760 * @param node [i] The PRE tag node is specified.
1761 * @return The conversion result is returned.
1764 s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node))
1766 xhtml_t *xhtml = GET_XHTML(pdoc);
1767 Doc *doc = xhtml->doc;
1776 * It is a handler who processes the PRE tag.
1778 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1779 * destination is specified.
1780 * @param node [i] The PRE tag node is specified.
1781 * @return The conversion result is returned.
1784 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
1786 xhtml_t *xhtml = GET_XHTML(pdoc);
1787 Doc *doc = xhtml->doc;
1797 * It is a handler who processes the P tag.
1799 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1800 * destination is specified.
1801 * @param node [i] The P tag node is specified.
1802 * @return The conversion result is returned.
1805 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
1807 xhtml_t *xhtml = GET_XHTML(pdoc);
1808 Doc *doc = xhtml->doc;
1813 for (attr = qs_get_attr(doc,node);
1815 attr = qs_get_next_attr(doc,attr)) {
1816 char *nm = qs_get_attr_name(doc,attr);
1817 char *val = qs_get_attr_value(doc,attr);
1818 if (STRCASEEQ('a','A',"align", nm)) {
1819 /*----------------------------------------------------------------------*/
1820 /* CHTML 1.0 (W3C version 3.2) */
1821 /*----------------------------------------------------------------------*/
1822 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1823 align = apr_pstrdup(doc->buf.pool, val);
1839 * It is a handler who processes the P tag.
1841 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1842 * destination is specified.
1843 * @param node [i] The P tag node is specified.
1844 * @return The conversion result is returned.
1847 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
1849 xhtml_t *xhtml = GET_XHTML(pdoc);
1850 Doc *doc = xhtml->doc;
1858 * It is a handler who processes the UL tag.
1860 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1861 * destination is specified.
1862 * @param node [i] The UL tag node is specified.
1863 * @return The conversion result is returned.
1866 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
1868 xhtml_t *xhtml = GET_XHTML(pdoc);
1869 Doc *doc = xhtml->doc;
1872 /*--------------------------------------------------------------------------*/
1873 /* Get Attributes */
1874 /*--------------------------------------------------------------------------*/
1875 for (attr = qs_get_attr(doc,node);
1877 attr = qs_get_next_attr(doc,attr)) {
1878 char *name = qs_get_attr_name(doc,attr);
1879 char *value = qs_get_attr_value(doc,attr);
1880 if (STRCASEEQ('t','T',"type",name)) {
1881 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
1894 * It is a handler who processes the UL tag.
1896 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1897 * destination is specified.
1898 * @param node [i] The UL tag node is specified.
1899 * @return The conversion result is returned.
1902 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
1904 xhtml_t *xhtml = GET_XHTML(pdoc);
1905 Doc *doc = xhtml->doc;
1913 * It is a handler who processes the H1 tag.
1915 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1916 * destination is specified.
1917 * @param node [i] The H1 tag node is specified.
1918 * @return The conversion result is returned.
1921 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
1923 xhtml_t *xhtml = GET_XHTML(pdoc);
1924 Doc *doc = xhtml->doc;
1928 for (attr = qs_get_attr(doc,node);
1930 attr = qs_get_next_attr(doc,attr)) {
1933 name = qs_get_attr_name(doc,attr);
1934 value = qs_get_attr_value(doc,attr);
1935 if (STRCASEEQ('a','A',"align", name)) {
1937 if (STRCASEEQ('l','L',"left",value)) {
1939 W_L("text-align:left");
1942 else if (STRCASEEQ('r','R',"right",value)) {
1944 W_L("text-align:right");
1947 else if (STRCASEEQ('c','C',"center",value)) {
1949 W_L("text-align:center");
1962 * It is a handler who processes the H1 tag.
1964 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1965 * destination is specified.
1966 * @param node [i] The H1 tag node is specified.
1967 * @return The conversion result is returned.
1970 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
1972 xhtml_t *xhtml = GET_XHTML(pdoc);
1973 Doc *doc = xhtml->doc;
1981 * It is a handler who processes the H2 tag.
1983 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1984 * destination is specified.
1985 * @param node [i] The H2 tag node is specified.
1986 * @return The conversion result is returned.
1989 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
1991 xhtml_t *xhtml = GET_XHTML(pdoc);
1992 Doc *doc = xhtml->doc;
1996 for (attr = qs_get_attr(doc,node);
1998 attr = qs_get_next_attr(doc,attr)) {
2001 name = qs_get_attr_name(doc,attr);
2002 value = qs_get_attr_value(doc,attr);
2003 if (STRCASEEQ('a','A',"align", name)) {
2005 if (STRCASEEQ('l','L',"left",value)) {
2007 W_L("text-align:left");
2010 else if (STRCASEEQ('r','R',"right",value)) {
2012 W_L("text-align:right");
2015 else if (STRCASEEQ('c','C',"center",value)) {
2017 W_L("text-align:center");
2030 * It is a handler who processes the H2 tag.
2032 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2033 * destination is specified.
2034 * @param node [i] The H2 tag node is specified.
2035 * @return The conversion result is returned.
2038 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2040 xhtml_t *xhtml = GET_XHTML(pdoc);
2041 Doc *doc = xhtml->doc;
2049 * It is a handler who processes the H3 tag.
2051 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2052 * destination is specified.
2053 * @param node [i] The H3 tag node is specified.
2054 * @return The conversion result is returned.
2057 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2059 xhtml_t *xhtml = GET_XHTML(pdoc);
2060 Doc *doc = xhtml->doc;
2064 for (attr = qs_get_attr(doc,node);
2066 attr = qs_get_next_attr(doc,attr)) {
2069 name = qs_get_attr_name(doc,attr);
2070 value = qs_get_attr_value(doc,attr);
2071 if (STRCASEEQ('a','A',"align", name)) {
2073 if (STRCASEEQ('l','L',"left",value)) {
2075 W_L("text-align:left");
2078 else if (STRCASEEQ('r','R',"right",value)) {
2080 W_L("text-align:right");
2083 else if (STRCASEEQ('c','C',"center",value)) {
2085 W_L("text-align:center");
2098 * It is a handler who processes the H3 tag.
2100 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2101 * destination is specified.
2102 * @param node [i] The H3 tag node is specified.
2103 * @return The conversion result is returned.
2106 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2108 xhtml_t *xhtml = GET_XHTML(pdoc);
2109 Doc *doc = xhtml->doc;
2117 * It is a handler who processes the H4 tag.
2119 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2120 * destination is specified.
2121 * @param node [i] The H4 tag node is specified.
2122 * @return The conversion result is returned.
2125 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2127 xhtml_t *xhtml = GET_XHTML(pdoc);
2128 Doc *doc = xhtml->doc;
2132 for (attr = qs_get_attr(doc,node);
2134 attr = qs_get_next_attr(doc,attr)) {
2137 name = qs_get_attr_name(doc,attr);
2138 value = qs_get_attr_value(doc,attr);
2139 if (STRCASEEQ('a','A',"align", name)) {
2141 if (STRCASEEQ('l','L',"left",value)) {
2143 W_L("text-align:left");
2146 else if (STRCASEEQ('r','R',"right",value)) {
2148 W_L("text-align:right");
2151 else if (STRCASEEQ('c','C',"center",value)) {
2153 W_L("text-align:center");
2166 * It is a handler who processes the H4 tag.
2168 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2169 * destination is specified.
2170 * @param node [i] The H4 tag node is specified.
2171 * @return The conversion result is returned.
2174 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
2176 xhtml_t *xhtml = GET_XHTML(pdoc);
2177 Doc *doc = xhtml->doc;
2185 * It is a handler who processes the H5 tag.
2187 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2188 * destination is specified.
2189 * @param node [i] The H5 tag node is specified.
2190 * @return The conversion result is returned.
2193 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
2195 xhtml_t *xhtml = GET_XHTML(pdoc);
2196 Doc *doc = xhtml->doc;
2200 for (attr = qs_get_attr(doc,node);
2202 attr = qs_get_next_attr(doc,attr)) {
2205 name = qs_get_attr_name(doc,attr);
2206 value = qs_get_attr_value(doc,attr);
2207 if (STRCASEEQ('a','A',"align", name)) {
2209 if (STRCASEEQ('l','L',"left",value)) {
2211 W_L("text-align:left");
2214 else if (STRCASEEQ('r','R',"right",value)) {
2216 W_L("text-align:right");
2219 else if (STRCASEEQ('c','C',"center",value)) {
2221 W_L("text-align:center");
2234 * It is a handler who processes the H5 tag.
2236 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2237 * destination is specified.
2238 * @param node [i] The H5 tag node is specified.
2239 * @return The conversion result is returned.
2242 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2244 xhtml_t *xhtml = GET_XHTML(pdoc);
2245 Doc *doc = xhtml->doc;
2253 * It is a handler who processes the H6 tag.
2255 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2256 * destination is specified.
2257 * @param node [i] The H6 tag node is specified.
2258 * @return The conversion result is returned.
2261 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2263 xhtml_t *xhtml = GET_XHTML(pdoc);
2264 Doc *doc = xhtml->doc;
2268 for (attr = qs_get_attr(doc,node);
2270 attr = qs_get_next_attr(doc,attr)) {
2273 name = qs_get_attr_name(doc,attr);
2274 value = qs_get_attr_value(doc,attr);
2275 if (STRCASEEQ('a','A',"align", name)) {
2277 if (STRCASEEQ('l','L',"left",value)) {
2279 W_L("text-align:left");
2282 else if (STRCASEEQ('r','R',"right",value)) {
2284 W_L("text-align:right");
2287 else if (STRCASEEQ('c','C',"center",value)) {
2289 W_L("text-align:center");
2302 * It is a handler who processes the H6 tag.
2304 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2305 * destination is specified.
2306 * @param node [i] The H6 tag node is specified.
2307 * @return The conversion result is returned.
2310 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
2312 xhtml_t *xhtml = GET_XHTML(pdoc);
2313 Doc *doc = xhtml->doc;
2321 * It is a handler who processes the OL tag.
2323 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2324 * destination is specified.
2325 * @param node [i] The OL tag node is specified.
2326 * @return The conversion result is returned.
2329 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
2331 xhtml_t *xhtml = GET_XHTML(pdoc);
2332 Doc *doc = xhtml->doc;
2336 /*--------------------------------------------------------------------------*/
2337 /* Get Attributes */
2338 /*--------------------------------------------------------------------------*/
2339 for (attr = qs_get_attr(doc,node);
2341 attr = qs_get_next_attr(doc,attr)) {
2342 char *name = qs_get_attr_name(doc,attr);
2343 char *value = qs_get_attr_value(doc,attr);
2344 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2349 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2361 * It is a handler who processes the OL tag.
2363 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2364 * destination is specified.
2365 * @param node [i] The OL tag node is specified.
2366 * @return The conversion result is returned.
2369 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
2371 xhtml_t *xhtml = GET_XHTML(pdoc);
2372 Doc *doc = xhtml->doc;
2380 * It is a handler who processes the LI tag.
2382 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2383 * destination is specified.
2384 * @param node [i] The LI tag node is specified.
2385 * @return The conversion result is returned.
2388 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
2390 xhtml_t *xhtml = GET_XHTML(pdoc);
2391 Doc *doc = xhtml->doc;
2395 /*--------------------------------------------------------------------------*/
2396 /* Get Attributes */
2397 /*--------------------------------------------------------------------------*/
2398 for (attr = qs_get_attr(doc,node);
2400 attr = qs_get_next_attr(doc,attr)) {
2401 char *name = qs_get_attr_name(doc,attr);
2402 char *value = qs_get_attr_value(doc,attr);
2403 if (STRCASEEQ('t','T',"type",name)) {
2404 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2410 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2422 ** It is a handler who processes the LI tag.
2424 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2425 * destination is specified.
2426 * @param node [i] The LI tag node is specified.
2427 * @return The conversion result is returned.
2430 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
2432 xhtml_t *xhtml = GET_XHTML(pdoc);
2433 Doc *doc = xhtml->doc;
2440 * It is a handler who processes the IMG tag.
2442 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2443 * destination is specified.
2444 * @param node [i] The IMG tag node is specified.
2445 * @return The conversion result is returned.
2448 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
2450 xhtml_t *xhtml = GET_XHTML(pdoc);
2451 Doc *doc = xhtml->doc;
2452 request_rec *r = doc->r;
2455 #ifndef IMG_NOT_CONVERT_FILENAME
2456 device_table *spec = xhtml->spec;
2460 /*--------------------------------------------------------------------------*/
2461 /* Get Attributes */
2462 /*--------------------------------------------------------------------------*/
2463 for (attr = qs_get_attr(doc,node);
2465 attr = qs_get_next_attr(doc,attr)) {
2466 char *name = qs_get_attr_name(doc,attr);
2467 char *value = qs_get_attr_value(doc,attr);
2469 if (STRCASEEQ('s','S',"src",name)) {
2470 value = chxj_encoding_parameter(r, value);
2471 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
2472 value = chxj_add_cookie_no_update_parameter(r, value);
2473 #ifdef IMG_NOT_CONVERT_FILENAME
2483 char *vv = chxj_img_conv(r,spec,value);
2491 if (STRCASEEQ('a','A',"align",name)) {
2493 if (STRCASEEQ('t','T',"top", value) ||
2494 STRCASEEQ('m','M',"middle",value) ||
2495 STRCASEEQ('b','B',"bottom",value) ||
2496 STRCASEEQ('l','L',"left", value) ||
2497 STRCASEEQ('r','R',"right", value)) {
2502 else if (STRCASEEQ('c','C',"center", value)) {
2509 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2514 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2519 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2524 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
2529 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
2541 * It is a handler who processes the IMG tag.
2543 * @param xhtml [i/o] The pointer to the XHTML structure at the output
2544 * destination is specified.
2545 * @param node [i] The IMG tag node is specified.
2546 * @return The conversion result is returned.
2549 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
2551 xhtml_t *xhtml = GET_XHTML(pdoc);
2558 * It is a handler who processes the SELECT tag.
2560 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2561 * destination is specified.
2562 * @param node [i] The SELECT tag node is specified.
2563 * @return The conversion result is returned.
2566 s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
2568 xhtml_t *xhtml = GET_XHTML(pdoc);
2569 Doc *doc = xhtml->doc;
2572 char *multiple = NULL;
2577 for (attr = qs_get_attr(doc,child);
2579 attr = qs_get_next_attr(doc,attr)) {
2580 char *nm = qs_get_attr_name(doc,attr);
2581 char *val = qs_get_attr_value(doc,attr);
2582 if (STRCASEEQ('s','S',"size",nm)) {
2583 /*----------------------------------------------------------------------*/
2584 /* CHTML 1.0 version 2.0 */
2585 /*----------------------------------------------------------------------*/
2586 size = apr_pstrdup(doc->buf.pool, val);
2588 else if (STRCASEEQ('n','N',"name",nm)) {
2589 /*----------------------------------------------------------------------*/
2590 /* CHTML 1.0 version 2.0 */
2591 /*----------------------------------------------------------------------*/
2592 name = apr_pstrdup(doc->buf.pool, val);
2594 else if (STRCASEEQ('m','M',"multiple",nm)) {
2595 /*----------------------------------------------------------------------*/
2596 /* CHTML 1.0 version 2.0 */
2597 /*----------------------------------------------------------------------*/
2598 multiple = apr_pstrdup(doc->buf.pool, val);
2601 if (size && *size) {
2606 if (name && *name) {
2612 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
2613 W_L(" multiple=\"true\"");
2621 * It is a handler who processes the SELECT tag.
2623 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2624 * destination is specified.
2625 * @param node [i] The SELECT tag node is specified.
2626 * @return The conversion result is returned.
2629 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
2631 xhtml_t *xhtml = GET_XHTML(pdoc);
2632 Doc *doc = xhtml->doc;
2640 * It is a handler who processes the OPTION tag.
2642 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2643 * destination is specified.
2644 * @param node [i] The OPTION tag node is specified.
2645 * @return The conversion result is returned.
2648 s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
2650 xhtml_t *xhtml = GET_XHTML(pdoc);
2651 Doc *doc = xhtml->doc;
2654 char *selected = NULL;
2658 for (attr = qs_get_attr(doc,child);
2660 attr = qs_get_next_attr(doc,attr)) {
2661 char *nm = qs_get_attr_name(doc,attr);
2662 char *val = qs_get_attr_value(doc,attr);
2663 if (STRCASEEQ('s','S',"selected",nm)) {
2664 /* CHTML version 2.0 */
2665 selected = apr_pstrdup(doc->buf.pool, val);
2667 else if (STRCASEEQ('v','V',"value",nm)) {
2668 /* CHTML version 2.0 */
2669 value = apr_pstrdup(doc->buf.pool, val);
2678 W_L(" selected=\"selected\"");
2686 * It is a handler who processes the OPTION tag.
2688 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2689 * destination is specified.
2690 * @param node [i] The OPTION tag node is specified.
2691 * @return The conversion result is returned.
2694 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
2696 xhtml_t *xhtml = GET_XHTML(pdoc);
2697 Doc *doc = xhtml->doc;
2705 * It is a handler who processes the DIV tag.
2707 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2708 * destination is specified.
2709 * @param node [i] The DIV tag node is specified.
2710 * @return The conversion result is returned.
2713 s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
2715 xhtml_t *xhtml = GET_XHTML(pdoc);
2716 Doc *doc = xhtml->doc;
2721 for (attr = qs_get_attr(doc,child);
2723 attr = qs_get_next_attr(doc,attr)) {
2724 char *nm = qs_get_attr_name(doc,attr);
2725 char *val = qs_get_attr_value(doc,attr);
2726 if (STRCASEEQ('a','A',"align",nm)) {
2727 /*=====================================================================*/
2728 /* CHTML version 3.2 */
2729 /*=====================================================================*/
2730 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2731 align = apr_pstrdup(doc->buf.pool, val);
2746 * It is a handler who processes the DIV tag.
2748 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2749 * destination is specified.
2750 * @param node [i] The DIV tag node is specified.
2751 * @return The conversion result is returned.
2754 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
2756 xhtml_t *xhtml = GET_XHTML(pdoc);
2757 Doc *doc = xhtml->doc;
2764 * It is a handler who processes the B tag.
2766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2767 * destination is specified.
2768 * @param node [i] The B tag node is specified.
2769 * @return The conversion result is returned.
2772 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
2774 xhtml_t *xhtml = GET_XHTML(pdoc);
2775 Doc *doc = xhtml->doc;
2777 W_L("<div style=\"font-weight:bold\">");
2783 * It is a handler who processes the B tag.
2785 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2786 * destination is specified.
2787 * @param node [i] The B tag node is specified.
2788 * @return The conversion result is returned.
2791 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
2793 xhtml_t *xhtml = GET_XHTML(pdoc);
2794 Doc *doc = xhtml->doc;
2802 * It is a handler who processes the CHXJ:IF tag.
2804 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2805 * destination is specified.
2806 * @param node [i] The CHXJ:IF tag node is specified.
2809 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
2811 xhtml_t *xhtml = GET_XHTML(pdoc);
2812 Doc *doc = xhtml->doc;
2815 for (child = qs_get_child_node(doc, node);
2817 child = qs_get_next_node(doc, child)) {
2819 s_xhtml_1_0_chxjif_tag(xhtml, child);
2827 * It is a handler who processes the TEXTARE tag.
2829 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2830 * destination is specified.
2831 * @param node [i] The TEXTAREA tag node is specified.
2832 * @return The conversion result is returned.
2835 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
2837 xhtml_t *xhtml = GET_XHTML(pdoc);
2838 Doc *doc = xhtml->doc;
2841 xhtml->textarea_flag++;
2843 for (attr = qs_get_attr(doc,node);
2845 attr = qs_get_next_attr(doc,attr)) {
2846 char *name = qs_get_attr_name(doc,attr);
2847 char *value = qs_get_attr_value(doc,attr);
2848 if (STRCASEEQ('n','N',"name",name) && value && *value) {
2853 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
2858 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
2863 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
2864 char *fmt = qs_conv_istyle_to_format(doc->r,value);
2869 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
2870 W_L(" accesskey=\"");
2881 * It is a handler who processes the TEXTAREA tag.
2883 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2884 * destination is specified.
2885 * @param node [i] The TEXTAREA tag node is specified.
2886 * @return The conversion result is returned.
2889 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2891 xhtml_t *xhtml = GET_XHTML(pdoc);
2892 Doc *doc = xhtml->doc;
2895 xhtml->textarea_flag--;
2901 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
2903 xhtml_t *xhtml = GET_XHTML(pdoc);
2904 Doc *doc = xhtml->doc;
2905 request_rec *r = doc->r;
2912 apr_size_t z2h_input_len;
2914 textval = qs_get_node_value(doc,child);
2915 if (strlen(textval) == 0) {
2919 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2920 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2922 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
2923 memset(one_byte, 0, sizeof(one_byte));
2926 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2928 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
2930 DBG(r,"REQ[%X] [%s][%d]", TO_ADDR(r), out, rtn);
2931 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2935 if (is_sjis_kanji(textval[ii])) {
2936 one_byte[0] = textval[ii+0];
2937 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2938 one_byte[0] = textval[ii+1];
2939 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2942 else if (xhtml->pre_flag) {
2943 one_byte[0] = textval[ii+0];
2944 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2946 else if (xhtml->textarea_flag) {
2947 one_byte[0] = textval[ii+0];
2948 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2950 else if (textval[ii] != '\r' && textval[ii] != '\n') {
2951 one_byte[0] = textval[ii+0];
2952 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2955 z2h_input_len = strlen(tdst);
2956 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
2964 * It is a handler who processes the BLOCKQUOTE tag.
2966 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2967 * destination is specified.
2968 * @param node [i] The BLOCKQUOTE tag node is specified.
2969 * @return The conversion result is returned.
2972 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2974 xhtml_t *xhtml = GET_XHTML(pdoc);
2975 Doc *doc = xhtml->doc;
2976 W_L("<blockquote>");
2982 * It is a handler who processes the BLOCKQUOTE tag.
2984 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2985 * destination is specified.
2986 * @param node [i] The BLOCKQUOTE tag node is specified.
2987 * @return The conversion result is returned.
2990 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2992 xhtml_t *xhtml = GET_XHTML(pdoc);
2993 Doc *doc = xhtml->doc;
2994 W_L("</blockquote>");
3000 * It is a handler who processes the DIR tag.
3002 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3003 * destination is specified.
3004 * @param node [i] The DIR tag node is specified.
3005 * @return The conversion result is returned.
3008 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
3010 xhtml_t *xhtml = GET_XHTML(pdoc);
3011 Doc *doc = xhtml->doc;
3014 for (attr = qs_get_attr(doc,node);
3016 attr = qs_get_next_attr(doc,attr)) {
3017 char *name = qs_get_attr_name(doc,attr);
3018 char *value = qs_get_attr_value(doc,attr);
3019 if (STRCASEEQ('t','T',"type",name)) {
3020 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3033 * It is a handler who processes the DIR tag.
3035 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3036 * destination is specified.
3037 * @param node [i] The DIR tag node is specified.
3038 * @return The conversion result is returned.
3041 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
3043 xhtml_t *xhtml = GET_XHTML(pdoc);
3044 Doc *doc = xhtml->doc;
3051 * It is a handler who processes the DL tag.
3053 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3054 * destination is specified.
3055 * @param node [i] The DL tag node is specified.
3056 * @return The conversion result is returned.
3059 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
3061 xhtml_t *xhtml = GET_XHTML(pdoc);
3062 Doc *doc = xhtml->doc;
3069 * It is a handler who processes the DL tag.
3071 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3072 * destination is specified.
3073 * @param node [i] The DL tag node is specified.
3074 * @return The conversion result is returned.
3077 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
3079 xhtml_t *xhtml = GET_XHTML(pdoc);
3080 Doc *doc = xhtml->doc;
3087 * It is a handter who processes the DT tag.
3089 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3090 * destination is specified.
3091 * @param node [i] The DT tag node is specified.
3092 * @return The conversion result is returned.
3095 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *UNUSED(child))
3097 xhtml_t *xhtml = GET_XHTML(pdoc);
3098 Doc *doc = xhtml->doc;
3105 * It is a handter who processes the DT tag.
3107 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3108 * destination is specified.
3109 * @param node [i] The DT tag node is specified.
3110 * @return The conversion result is returned.
3113 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
3115 xhtml_t *xhtml = GET_XHTML(pdoc);
3116 Doc *doc = xhtml->doc;
3123 * It is a handder who processes the DD tag.
3125 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3126 * destination is specified.
3127 * @param node [i] The DD tag node is specified.
3128 * @return The conversion result is returned.
3131 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *UNUSED(child))
3133 xhtml_t *xhtml = GET_XHTML(pdoc);
3134 Doc *doc = xhtml->doc;
3141 * It is a handder who processes the DD tag.
3143 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3144 * destination is specified.
3145 * @param node [i] The DD tag node is specified.
3146 * @return The conversion result is returned.
3149 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
3151 xhtml_t *xhtml = GET_XHTML(pdoc);
3152 Doc *doc = xhtml->doc;
3159 * It is a handler who processes the MENU tag.
3161 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3162 * destination is specified.
3163 * @param node [i] The MENU tag node is specified.
3164 * @return The conversion result is returned.
3167 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
3169 xhtml_t *xhtml = GET_XHTML(pdoc);
3170 Doc *doc = xhtml->doc;
3173 /*--------------------------------------------------------------------------*/
3174 /* Get Attributes */
3175 /*--------------------------------------------------------------------------*/
3176 for (attr = qs_get_attr(doc,node);
3178 attr = qs_get_next_attr(doc,attr)) {
3179 char *name = qs_get_attr_name(doc,attr);
3180 char *value = qs_get_attr_value(doc,attr);
3181 if (STRCASEEQ('t','T',"type",name)) {
3182 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3195 * It is a hanmenuer who processes the MENU tag.
3197 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3198 * destination is specified.
3199 * @param node [i] The MENU tag node is specified.
3200 * @return The conversion result is returned.
3203 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
3205 xhtml_t *xhtml = GET_XHTML(pdoc);
3206 Doc *doc = xhtml->doc;
3213 * It is a handler who processes the PLAINTEXT tag.
3215 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3216 * destination is specified.
3217 * @param node [i] The PLAINTEXT tag node is specified.
3218 * @return The conversion result is returned.
3221 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
3223 xhtml_t *xhtml = GET_XHTML(pdoc);
3224 Doc *doc = xhtml->doc;
3226 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
3231 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
3233 xhtml_t *xhtml = GET_XHTML(pdoc);
3234 Doc *doc = xhtml->doc;
3236 for (child = qs_get_child_node(doc, node);
3238 child = qs_get_next_node(doc, child)) {
3240 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
3247 * It is a handler who processes the PLAINTEXT tag.
3249 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3250 * destination is specified.
3251 * @param node [i] The PLAINTEXT tag node is specified.
3252 * @return The conversion result is returned.
3255 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3257 xhtml_t *xhtml = GET_XHTML(pdoc);
3258 Doc *doc = xhtml->doc;
3259 W_L("</plaintext>");
3265 * It is a hanblinker who processes the BLINK tag.
3267 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3268 * destination is specified.
3269 * @param node [i] The BLINK tag node is specified.
3270 * @return The conversion result is returned.
3273 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *UNUSED(child))
3275 xhtml_t *xhtml = GET_XHTML(pdoc);
3276 Doc *doc = xhtml->doc;
3283 * It is a hanblinker who processes the BLINK tag.
3285 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3286 * destination is specified.
3287 * @param node [i] The BLINK tag node is specified.
3288 * @return The conversion result is returned.
3291 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(child))
3293 xhtml_t *xhtml = GET_XHTML(pdoc);
3294 Doc *doc = xhtml->doc;
3301 * It is a handler who processes the MARQUEE tag.
3303 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3304 * destination is specified.
3305 * @param node [i] The MARQUEE tag node is specified.
3306 * @return The conversion result is returned.
3309 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
3311 xhtml_t *xhtml = GET_XHTML(pdoc);
3312 Doc *doc = xhtml->doc;
3315 /*--------------------------------------------------------------------------*/
3316 /* Get Attributes */
3317 /*--------------------------------------------------------------------------*/
3318 for (attr = qs_get_attr(doc,node);
3320 attr = qs_get_next_attr(doc,attr)) {
3321 char *name = qs_get_attr_name(doc,attr);
3322 char *value = qs_get_attr_value(doc,attr);
3323 if (STRCASEEQ('d','D',"direction", name)) {
3324 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3325 W_L(" direction=\"");
3330 else if (STRCASEEQ('b','B',"behavior",name)) {
3331 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
3332 W_L(" behavior=\"");
3337 else if (STRCASEEQ('l','L',"loop",name)) {
3338 if (value && *value) {
3344 else if (STRCASEEQ('b','B',"bgcolor",name)) {
3345 if (value && *value) {
3358 * It is a handler who processes the MARQUEE tag.
3360 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3361 * destination is specified.
3362 * @param node [i] The MARQUEE tag node is specified.
3363 * @return The conversion result is returned.
3366 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3368 xhtml_t *xhtml = GET_XHTML(pdoc);
3369 Doc *doc = xhtml->doc;
3376 * It is handler who processes the New Line Code.
3379 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
3381 xhtml_t *xhtml = GET_XHTML(pdoc);
3382 Doc *doc = xhtml->doc;