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"
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);
121 static char *s_xhtml_1_0_link_tag (void *pdoc, Node *node);
122 static char *s_xhtml_1_0_start_span_tag (void *pdoc, Node *node);
123 static char *s_xhtml_1_0_end_span_tag (void *pdoc, Node *node);
124 static char *s_xhtml_1_0_style_tag (void *pdoc, Node *node);
126 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
127 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
128 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
129 static css_prop_list_t *s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
130 static css_prop_list_t *s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
134 tag_handler xhtml_handler[] = {
137 s_xhtml_1_0_start_html_tag,
138 s_xhtml_1_0_end_html_tag,
142 s_xhtml_1_0_start_meta_tag,
143 s_xhtml_1_0_end_meta_tag,
147 s_xhtml_1_0_start_textarea_tag,
148 s_xhtml_1_0_end_textarea_tag,
152 s_xhtml_1_0_start_p_tag,
153 s_xhtml_1_0_end_p_tag,
157 s_xhtml_1_0_start_pre_tag,
158 s_xhtml_1_0_end_pre_tag,
162 s_xhtml_1_0_start_ul_tag,
163 s_xhtml_1_0_end_ul_tag,
167 s_xhtml_1_0_start_li_tag,
168 s_xhtml_1_0_end_li_tag,
172 s_xhtml_1_0_start_ol_tag,
173 s_xhtml_1_0_end_ol_tag,
177 s_xhtml_1_0_start_h1_tag,
178 s_xhtml_1_0_end_h1_tag,
182 s_xhtml_1_0_start_h2_tag,
183 s_xhtml_1_0_end_h2_tag,
187 s_xhtml_1_0_start_h3_tag,
188 s_xhtml_1_0_end_h3_tag,
192 s_xhtml_1_0_start_h4_tag,
193 s_xhtml_1_0_end_h4_tag,
197 s_xhtml_1_0_start_h5_tag,
198 s_xhtml_1_0_end_h5_tag,
202 s_xhtml_1_0_start_h6_tag,
203 s_xhtml_1_0_end_h6_tag,
207 s_xhtml_1_0_start_head_tag,
208 s_xhtml_1_0_end_head_tag,
212 s_xhtml_1_0_start_title_tag,
213 s_xhtml_1_0_end_title_tag,
217 s_xhtml_1_0_start_base_tag,
218 s_xhtml_1_0_end_base_tag,
222 s_xhtml_1_0_start_body_tag,
223 s_xhtml_1_0_end_body_tag,
227 s_xhtml_1_0_start_a_tag,
228 s_xhtml_1_0_end_a_tag,
232 s_xhtml_1_0_start_br_tag,
233 s_xhtml_1_0_end_br_tag,
242 s_xhtml_1_0_start_tr_tag,
243 s_xhtml_1_0_end_tr_tag,
257 s_xhtml_1_0_start_font_tag,
258 s_xhtml_1_0_end_font_tag,
262 s_xhtml_1_0_start_form_tag,
263 s_xhtml_1_0_end_form_tag,
267 s_xhtml_1_0_start_input_tag,
268 s_xhtml_1_0_end_input_tag,
272 s_xhtml_1_0_start_center_tag,
273 s_xhtml_1_0_end_center_tag,
277 s_xhtml_1_0_start_hr_tag,
278 s_xhtml_1_0_end_hr_tag,
282 s_xhtml_1_0_start_img_tag,
283 s_xhtml_1_0_end_img_tag,
287 s_xhtml_1_0_start_select_tag,
288 s_xhtml_1_0_end_select_tag,
292 s_xhtml_1_0_start_option_tag,
293 s_xhtml_1_0_end_option_tag,
297 s_xhtml_1_0_start_div_tag,
298 s_xhtml_1_0_end_div_tag,
302 s_xhtml_1_0_chxjif_tag,
307 s_xhtml_1_0_chxjif_tag,
322 s_xhtml_1_0_style_tag,
327 s_xhtml_1_0_start_span_tag,
328 s_xhtml_1_0_end_span_tag,
332 s_xhtml_1_0_text_tag,
342 s_xhtml_1_0_start_b_tag,
343 s_xhtml_1_0_end_b_tag,
352 s_xhtml_1_0_start_dt_tag,
353 s_xhtml_1_0_end_dt_tag,
367 s_xhtml_1_0_start_blockquote_tag,
368 s_xhtml_1_0_end_blockquote_tag,
372 s_xhtml_1_0_start_dir_tag,
373 s_xhtml_1_0_end_dir_tag,
377 s_xhtml_1_0_start_dl_tag,
378 s_xhtml_1_0_end_dl_tag,
382 s_xhtml_1_0_start_dd_tag,
383 s_xhtml_1_0_end_dd_tag,
387 s_xhtml_1_0_start_menu_tag,
388 s_xhtml_1_0_end_menu_tag,
392 s_xhtml_1_0_start_plaintext_tag,
393 s_xhtml_1_0_end_plaintext_tag,
397 s_xhtml_1_0_start_blink_tag,
398 s_xhtml_1_0_end_blink_tag,
402 s_xhtml_1_0_start_marquee_tag,
403 s_xhtml_1_0_end_marquee_tag,
407 s_xhtml_1_0_link_tag,
412 s_xhtml_1_0_newline_mark,
418 * converts from CHTML to XHTML.
420 * @param r [i] Requet_rec is appointed.
421 * @param spec [i] The result of the device specification processing which
422 * was done in advance is appointed.
423 * @param src [i] The character string before the converting is appointed.
424 * @return The character string after the converting is returned.
427 chxj_convert_xhtml_mobile_1_0(
433 chxjconvrule_entry *entryp,
442 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
443 /*--------------------------------------------------------------------------*/
445 /*--------------------------------------------------------------------------*/
447 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
449 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
453 /*--------------------------------------------------------------------------*/
454 /* The XHTML structure is initialized. */
455 /*--------------------------------------------------------------------------*/
456 s_init_xhtml(&xhtml, &doc, r, spec);
458 xhtml.entryp = entryp;
459 xhtml.cookie = cookie;
461 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
463 /*--------------------------------------------------------------------------*/
464 /* The character string of the input is analyzed. */
465 /*--------------------------------------------------------------------------*/
466 qs_init_malloc(&doc);
467 qs_init_root_node(&doc);
469 ss = apr_pcalloc(r->pool, srclen + 1);
470 memset(ss, 0, srclen + 1);
471 memcpy(ss, src, srclen);
473 if (IS_CSS_ON(xhtml.entryp)) {
474 /* current property list */
475 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
478 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
480 qs_parse_string(&doc,ss, strlen(ss));
482 chxj_buffered_write_init(r->pool, &doc.buf);
483 /*--------------------------------------------------------------------------*/
484 /* It converts it from CHTML to XHTML. */
485 /*--------------------------------------------------------------------------*/
486 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
487 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
488 dst = apr_pstrdup(r->pool, xhtml.out);
489 chxj_buffered_write_terminate(&doc.buf);
491 qs_all_free(&doc,QX_LOGMARK);
494 return apr_pstrdup(r->pool,ss);
498 dst = apr_psprintf(r->pool, "\n");
500 *dstlen = strlen(dst);
503 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
506 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
512 * The XHTML structure is initialized.
514 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
515 * initialized is specified.
516 * @param doc [i] The Doc structure that should be set to the initialized
517 * HDML structure is specified.
518 * @param r [i] To use POOL, the pointer to request_rec is specified.
519 * @param spec [i] The pointer to the device_table
522 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
524 memset(doc, 0, sizeof(Doc));
525 memset(xhtml, 0, sizeof(xhtml_t));
530 xhtml->out = qs_alloc_zero_byte_string(r->pool);
531 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
532 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
537 * Corresponding EMOJI to a current character-code is retrieved.
538 * The substitution character string is stored in the rslt pointer if agreeing.
540 * @param xhtml [i] The pointer to the XHTML structure is specified.
541 * @param txt [i] The character string to want to examine whether it is
542 * EMOJI is specified.
543 * @param rslt [o] The pointer to the pointer that stores the result is
545 * @return When corresponding EMOJI exists, it returns it excluding 0.
548 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
561 DBG(r,"spec is NULL");
564 for (ee = xhtml->conf->emoji;
567 unsigned char hex1byte;
568 unsigned char hex2byte;
570 DBG(r,"emoji->imode is NULL");
574 if (ee->imode->string != NULL
575 && strlen(ee->imode->string) > 0
576 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
577 if (spec == NULL || spec->emoji_type == NULL) {
578 *rslt = apr_psprintf(r->pool,
581 return strlen(ee->imode->string);
584 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
585 *rslt = apr_psprintf(r->pool,
588 return strlen(ee->imode->string);
591 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
592 *rslt = apr_psprintf(r->pool,
595 return strlen(ee->imode->string);
598 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
599 *rslt = apr_psprintf(r->pool,
602 return strlen(ee->imode->string);
605 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
606 *rslt = apr_psprintf(r->pool,
609 return strlen(ee->imode->string);
612 *rslt = apr_psprintf(r->pool,
615 return strlen(ee->imode->string);
619 hex1byte = ee->imode->hex1byte & 0xff;
620 hex2byte = ee->imode->hex2byte & 0xff;
622 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
623 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
624 if (spec == NULL || spec->emoji_type == NULL) {
625 *rslt = apr_psprintf(r->pool,
626 "<img localsrc=\"%s\">",
631 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
632 *rslt = apr_psprintf(r->pool,
633 "<img localsrc=\"%s\">",
638 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
639 *rslt = apr_psprintf(r->pool,
640 "<img localsrc=\"%s\">",
645 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
646 *rslt = apr_psprintf(r->pool,
647 "<img localsrc=\"%s\">",
652 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
653 *rslt = apr_psprintf(r->pool,
654 "<img localsrc=\"%s\">",
659 *rslt = apr_psprintf(r->pool,
660 "<img localsrc=\"%s\">",
672 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
686 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
687 memset(doc, 0, sizeof(Doc));
688 memset(xhtml, 0, sizeof(xhtml_t));
693 xhtml->out = qs_alloc_zero_byte_string(r->pool);
694 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
695 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
697 apr_pool_create(&pool, r->pool);
699 chxj_buffered_write_init(pool, &doc->buf);
701 for (ii=0; ii<len; ii++) {
705 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
712 if (is_sjis_kanji(src[ii])) {
713 two_byte[0] = src[ii+0];
714 two_byte[1] = src[ii+1];
720 one_byte[0] = src[ii+0];
725 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
727 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
733 * It is a handler who processes the HTML tag.
735 * @param pdoc [i/o] The pointer to the XHTML structure at the output
736 * destination is specified.
737 * @param node [i] The HTML tag node is specified.
738 * @return The conversion result is returned.
741 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
743 xhtml_t *xhtml = GET_XHTML(pdoc);
744 Doc *doc = xhtml->doc;
746 /*--------------------------------------------------------------------------*/
747 /* Add XML Declare */
748 /*--------------------------------------------------------------------------*/
749 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
751 /*--------------------------------------------------------------------------*/
753 /*--------------------------------------------------------------------------*/
754 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
756 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
758 /*--------------------------------------------------------------------------*/
760 /*--------------------------------------------------------------------------*/
761 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
763 xhtml->start_html_flag = 1;
769 * It is a handler who processes the HTML tag.
771 * @param pdoc [i/o] The pointer to the XHTML structure at the output
772 * destination is specified.
773 * @param node [i] The HTML tag node is specified.
774 * @return The conversion result is returned.
777 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
779 xhtml_t *xhtml = GET_XHTML(pdoc);
780 Doc *doc = xhtml->doc;
787 * It is a handler who processes the META tag.
789 * @param pdoc [i/o] The pointer to the XHTML structure at the output
790 * destination is specified.
791 * @param node [i] The META tag node is specified.
792 * @return The conversion result is returned.
795 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
797 xhtml_t *xhtml = GET_XHTML(pdoc);
799 Doc *doc = xhtml->doc;
800 int content_type_flag = 0;
801 request_rec *r = doc->r;
804 /*--------------------------------------------------------------------------*/
806 /*--------------------------------------------------------------------------*/
807 for (attr = qs_get_attr(doc,node);
809 attr = qs_get_next_attr(doc,attr)) {
810 char *name = qs_get_attr_name(doc,attr);
811 char *value = qs_get_attr_value(doc,attr);
812 if (STRCASEEQ('n','N',"name", name) && value && *value) {
819 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
825 if (STRCASEEQ('c','C', "content-type", value)) {
826 content_type_flag = 1;
829 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
830 if (content_type_flag) {
834 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
852 * It is a handler who processes the META tag.
854 * @param pdoc [i/o] The pointer to the XHTML structure at the output
855 * destination is specified.
856 * @param node [i] The META tag node is specified.
857 * @return The conversion result is returned.
860 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
862 xhtml_t *xhtml = GET_XHTML(pdoc);
869 * It is a handler who processes the HEAD tag.
871 * @param pdoc [i/o] The pointer to the XHTML structure at the output
872 * destination is specified.
873 * @param node [i] The HEAD tag node is specified.
874 * @return The conversion result is returned.
877 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
879 xhtml_t *xhtml = GET_XHTML(pdoc);
880 Doc *doc = xhtml->doc;
888 * It is a handler who processes the HEAD tag.
890 * @param pdoc [i/o] The pointer to the XHTML structure at the output
891 * destination is specified.
892 * @param node [i] The HEAD tag node is specified.
893 * @return The conversion result is returned.
896 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
898 xhtml_t *xhtml = GET_XHTML(pdoc);
899 Doc *doc = xhtml->doc;
907 * It is a handler who processes the TITLE tag.
909 * @param pdoc [i/o] The pointer to the XHTML structure at the output
910 * destination is specified.
911 * @param node [i] The TITLE tag node is specified.
912 * @return The conversion result is returned.
915 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
917 xhtml_t *xhtml = GET_XHTML(pdoc);
918 Doc *doc = xhtml->doc;
926 * It is a handler who processes the TITLE tag.
928 * @param pdoc [i/o] The pointer to the XHTML structure at the output
929 * destination is specified.
930 * @param node [i] The TITLE tag node is specified.
931 * @return The conversion result is returned.
934 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
936 xhtml_t *xhtml = GET_XHTML(pdoc);
937 Doc *doc = xhtml->doc;
946 * It is a handler who processes the BASE tag.
948 * @param pdoc [i/o] The pointer to the XHTML structure at the output
949 * destination is specified.
950 * @param node [i] The BASE tag node is specified.
951 * @return The conversion result is returned.
954 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
956 xhtml_t *xhtml = GET_XHTML(pdoc);
958 Doc *doc = xhtml->doc;
961 /*--------------------------------------------------------------------------*/
963 /*--------------------------------------------------------------------------*/
964 for (attr = qs_get_attr(doc,node);
966 attr = qs_get_next_attr(doc,attr)) {
967 char *name = qs_get_attr_name(doc,attr);
968 char *value = qs_get_attr_value(doc,attr);
969 if (STRCASEEQ('h','H',"href",name)) {
983 * It is a handler who processes the BASE tag.
985 * @param pdoc [i/o] The pointer to the XHTML structure at the output
986 * destination is specified.
987 * @param node [i] The BASE tag node is specified.
988 * @return The conversion result is returned.
991 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
993 xhtml_t *xhtml = GET_XHTML(pdoc);
1000 * It is a handler who processes the BODY tag.
1002 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The BODY tag node is specified.
1005 * @return The conversion result is returned.
1008 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1010 xhtml_t *xhtml = GET_XHTML(pdoc);
1011 Doc *doc = xhtml->doc;
1013 char *attr_bgcolor = NULL;
1014 char *attr_text = NULL;
1015 char *attr_link = NULL;
1016 char *attr_style = NULL;
1018 /*--------------------------------------------------------------------------*/
1019 /* Get Attributes */
1020 /*--------------------------------------------------------------------------*/
1021 for (attr = qs_get_attr(doc,node);
1023 attr = qs_get_next_attr(doc,attr)) {
1024 char *name = qs_get_attr_name(doc,attr);
1025 char *value = qs_get_attr_value(doc,attr);
1026 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1027 attr_bgcolor = value;
1029 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1032 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1035 else if (STRCASEEQ('a','A',"alink", name)) {
1038 else if (STRCASEEQ('v','V',"vlink",name)) {
1041 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1046 if (IS_CSS_ON(xhtml->entryp)) {
1047 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1049 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1050 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1051 css_property_t *cur;
1052 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1053 if (cur->value && *cur->value) {
1054 attr_text = apr_pstrdup(doc->pool, cur->value);
1057 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1058 if (cur->value && *cur->value) {
1059 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1064 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1065 css_selector_t *cur_sel;
1066 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1067 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1068 css_property_t *cur;
1069 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1070 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1071 attr_link = apr_pstrdup(doc->pool, cur->value);
1080 if (attr_bgcolor || attr_text) {
1083 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1084 W_L("background-color:");
1089 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1097 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1109 * It is a handler who processes the BODY tag.
1111 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1112 * destination is specified.
1113 * @param node [i] The BODY tag node is specified.
1114 * @return The conversion result is returned.
1117 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1119 xhtml_t *xhtml = GET_XHTML(pdoc);
1120 Doc *doc = xhtml->doc;
1123 if (IS_CSS_ON(xhtml->entryp)) {
1124 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1132 * It is a handler who processes the A tag.
1134 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1135 * destination is specified.
1136 * @param node [i] The A tag node is specified.
1137 * @return The conversion result is returned.
1140 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1142 xhtml_t *xhtml = GET_XHTML(pdoc);
1143 Doc *doc = xhtml->doc;
1144 request_rec *r = doc->r;
1146 char *attr_style = NULL;
1149 /*--------------------------------------------------------------------------*/
1150 /* Get Attributes */
1151 /*--------------------------------------------------------------------------*/
1152 for (attr = qs_get_attr(doc,node);
1154 attr = qs_get_next_attr(doc,attr)) {
1155 char* name = qs_get_attr_name(doc,attr);
1156 char* value = qs_get_attr_value(doc,attr);
1157 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1162 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1163 value = chxj_encoding_parameter(r, value, 1);
1164 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1165 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1171 else if (STRCASEEQ('a','A',"accesskey", name)) {
1172 W_L(" accesskey=\"");
1176 else if (STRCASEEQ('c','C',"cti",name)) {
1179 else if (STRCASEEQ('i','I',"ijam", name)) {
1182 else if (STRCASEEQ('u','U',"utn", name)) {
1185 else if (STRCASEEQ('t','T',"telbook",name)) {
1188 else if (STRCASEEQ('k','K',"kana",name)) {
1191 else if (STRCASEEQ('e','E',"email",name)) {
1194 else if (STRCASEEQ('i','I',"ista",name)) {
1197 else if (STRCASEEQ('i','I',"ilet",name)) {
1200 else if (STRCASEEQ('i','I',"iswf",name)) {
1203 else if (STRCASEEQ('i','I',"irst",name)) {
1206 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1212 if (IS_CSS_ON(xhtml->entryp)) {
1213 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1221 * It is a handler who processes the A tag.
1223 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1224 * destination is specified.
1225 * @param node [i] The A tag node is specified.
1226 * @return The conversion result is returned.
1229 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1231 xhtml_t *xhtml = GET_XHTML(pdoc);
1232 Doc *doc = xhtml->doc;
1236 if (IS_CSS_ON(xhtml->entryp)) {
1237 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1245 * It is a handler who processes the BR tag.
1247 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1248 * destination is specified.
1249 * @param node [i] The BR tag node is specified.
1250 * @return The conversion result is returned.
1253 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1255 xhtml_t *xhtml = GET_XHTML(pdoc);
1256 Doc *doc = xhtml->doc;
1260 /*--------------------------------------------------------------------------*/
1261 /* Get Attributes */
1262 /*--------------------------------------------------------------------------*/
1263 for (attr = qs_get_attr(doc,node);
1265 attr = qs_get_next_attr(doc,attr)) {
1266 char *name = qs_get_attr_name(doc,attr);
1267 char *value = qs_get_attr_value(doc,attr);
1268 if (STRCASEEQ('c','C',"clear",name)) {
1269 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1283 * It is a handler who processes the BR tag.
1285 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1286 * destination is specified.
1287 * @param node [i] The BR tag node is specified.
1288 * @return The conversion result is returned.
1291 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1293 xhtml_t *xhtml = GET_XHTML(pdoc);
1300 * It is a handler who processes the TR tag.
1302 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1303 * destination is specified.
1304 * @param node [i] The TR tag node is specified.
1305 * @return The conversion result is returned.
1308 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1310 xhtml_t *xhtml = GET_XHTML(pdoc);
1311 Doc *doc = xhtml->doc;
1320 * It is a handler who processes the TR tag.
1322 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1323 * destination is specified.
1324 * @param node [i] The TR tag node is specified.
1325 * @return The conversion result is returned.
1328 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1330 xhtml_t *xhtml = GET_XHTML(pdoc);
1337 * It is a handler who processes the FONT tag.
1339 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1340 * destination is specified.
1341 * @param node [i] The FONT tag node is specified.
1342 * @return The conversion result is returned.
1345 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1347 xhtml_t *xhtml = GET_XHTML(pdoc);
1348 Doc *doc = xhtml->doc;
1350 char *attr_color = NULL;
1351 char *attr_size = NULL;
1352 char *attr_style = NULL;
1354 /*--------------------------------------------------------------------------*/
1355 /* Get Attributes */
1356 /*--------------------------------------------------------------------------*/
1357 for (attr = qs_get_attr(doc,node);
1359 attr = qs_get_next_attr(doc,attr)) {
1360 char *name = qs_get_attr_name(doc,attr);
1361 char *value = qs_get_attr_value(doc,attr);
1362 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1363 attr_color = apr_pstrdup(doc->buf.pool, value);
1365 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1366 /*----------------------------------------------------------------------*/
1368 /*----------------------------------------------------------------------*/
1369 attr_size = apr_pstrdup(doc->buf.pool, value);
1371 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1372 attr_style = apr_pstrdup(doc->buf.pool, value);
1375 if (IS_CSS_ON(xhtml->entryp)) {
1376 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1378 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1379 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1380 css_property_t *cur;
1381 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1382 if (cur->value && *cur->value) {
1383 attr_color = apr_pstrdup(doc->pool, cur->value);
1386 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1387 if (cur->value && *cur->value) {
1388 attr_size = apr_pstrdup(doc->pool, cur->value);
1389 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1390 attr_size = apr_pstrdup(doc->pool, "1");
1392 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1393 attr_size = apr_pstrdup(doc->pool, "2");
1395 else if (STRCASEEQ('s','S',"small",attr_size)) {
1396 attr_size = apr_pstrdup(doc->pool, "3");
1398 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1399 attr_size = apr_pstrdup(doc->pool, "4");
1401 else if (STRCASEEQ('l','L',"large",attr_size)) {
1402 attr_size = apr_pstrdup(doc->pool, "5");
1404 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1405 attr_size = apr_pstrdup(doc->pool, "6");
1407 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1408 attr_size = apr_pstrdup(doc->pool, "7");
1415 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1416 memset(flg, 0, sizeof(*flg));
1418 W_L("<font color=\"");
1421 flg->font_color_flag = 1;
1424 flg->font_size_flag = 1;
1425 switch(*attr_size) {
1426 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1427 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1428 case '3': W_L("<span style=\"font-size: small\">"); break;
1429 case '4': W_L("<span style=\"font-size: medium\">"); break;
1430 case '5': W_L("<span style=\"font-size: large\">"); break;
1431 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1432 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1434 if (*(attr_size + 1) == '1') {
1435 W_L("<span style=\"font-size: small\">");
1438 if (*(attr_size + 1) == '2') {
1439 W_L("<span style=\"font-size: x-small\">");
1442 if (*(attr_size + 1) == '3') {
1443 W_L("<span style=\"font-size: xx-small\">");
1446 flg->font_size_flag = 0;
1450 if (*(attr_size + 1) == '1') {
1451 W_L("<span style=\"font-size: large\">");
1454 if (*(attr_size + 1) == '2') {
1455 W_L("<span style=\"font-size: x-large\">");
1458 if (*(attr_size + 1) == '3') {
1459 W_L("<span style=\"font-size: xx-large\">");
1462 flg->font_size_flag = 0;
1466 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1467 flg->font_size_flag = 0;
1470 node->userData = flg;
1477 * It is a handler who processes the FONT tag.
1479 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1480 * destination is specified.
1481 * @param node [i] The FONT tag node is specified.
1482 * @return The conversion result is returned.
1485 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
1487 xhtml_t *xhtml = GET_XHTML(pdoc);
1488 Doc *doc = xhtml->doc;
1490 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1491 if (flg && flg->font_size_flag) {
1494 if (flg && flg->font_color_flag) {
1497 if (IS_CSS_ON(xhtml->entryp)) {
1498 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1505 * It is a handler who processes the FORM tag.
1507 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1508 * destination is specified.
1509 * @param node [i] The FORM tag node is specified.
1510 * @return The conversion result is returned.
1513 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1515 xhtml_t *xhtml = GET_XHTML(pdoc);
1516 Doc *doc = xhtml->doc;
1517 request_rec *r = doc->r;
1519 char *attr_action = NULL;
1520 char *attr_method = NULL;
1521 char *attr_style = NULL;
1522 char *attr_color = NULL;
1523 char *attr_align = NULL;
1524 char *attr_name = NULL;
1525 char *new_hidden_tag = NULL;
1527 /*--------------------------------------------------------------------------*/
1528 /* Get Attributes */
1529 /*--------------------------------------------------------------------------*/
1530 for (attr = qs_get_attr(doc,node);
1532 attr = qs_get_next_attr(doc,attr)) {
1533 char *name = qs_get_attr_name(doc,attr);
1534 char *value = qs_get_attr_value(doc,attr);
1538 if (strcasecmp(name, "action") == 0) {
1539 /*--------------------------------------------------------------------*/
1541 /*--------------------------------------------------------------------*/
1542 attr_action = value;
1548 if (strcasecmp(name, "method") == 0) {
1549 /*--------------------------------------------------------------------*/
1551 /*--------------------------------------------------------------------*/
1552 attr_method = value;
1558 if (strcasecmp(name, "name") == 0) {
1559 /*--------------------------------------------------------------------*/
1561 /*--------------------------------------------------------------------*/
1568 if (strcasecmp(name, "style") == 0) {
1577 if (IS_CSS_ON(xhtml->entryp)) {
1578 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1580 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1581 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1582 css_property_t *cur;
1583 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1584 if (STRCASEEQ('l','L',"left", cur->value)) {
1585 attr_align = apr_pstrdup(doc->pool, "left");
1587 else if (STRCASEEQ('c','C',"center",cur->value)) {
1588 attr_align = apr_pstrdup(doc->pool, "center");
1590 else if (STRCASEEQ('r','R',"right",cur->value)) {
1591 attr_align = apr_pstrdup(doc->pool, "right");
1594 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1595 attr_color = apr_pstrdup(doc->pool, cur->value);
1600 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1604 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1605 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1607 char *old_qs = NULL;
1608 q = strchr(attr_action, '?');
1610 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);
1611 if (new_hidden_tag || old_qs) {
1635 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
1636 memset(flg, 0, sizeof(*flg));
1638 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1639 W_L("<font color=\"");
1642 flg->with_font_flag = 1;
1645 W_L("<div align=\"");
1648 flg->with_div_flag = 1;
1650 node->userData = flg;
1651 if (new_hidden_tag) {
1652 W_V(new_hidden_tag);
1659 * It is a handler who processes the FORM tag.
1661 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1662 * destination is specified.
1663 * @param node [i] The FORM tag node is specified.
1664 * @return The conversion result is returned.
1667 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
1669 xhtml_t *xhtml = GET_XHTML(pdoc);
1670 Doc *doc = xhtml->doc;
1672 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1673 if (flg && flg->with_div_flag) {
1676 if (flg && flg->with_font_flag) {
1680 if (IS_CSS_ON(xhtml->entryp)) {
1681 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1689 * It is a handler who processes the INPUT tag.
1691 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1692 * destination is specified.
1693 * @param node [i] The INPUT tag node is specified.
1694 * @return The conversion result is returned.
1697 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1699 xhtml_t *xhtml = GET_XHTML(pdoc);
1700 Doc *doc = xhtml->doc;
1701 request_rec *r = doc->r;
1703 char *attr_max_length = NULL;
1704 char *attr_type = NULL;
1705 char *attr_name = NULL;
1706 char *attr_value = NULL;
1707 char *attr_istyle = NULL;
1708 char *attr_size = NULL;
1709 char *attr_checked = NULL;
1710 char *attr_accesskey = NULL;
1711 char *attr_style = NULL;
1713 /*--------------------------------------------------------------------------*/
1714 /* Get Attributes */
1715 /*--------------------------------------------------------------------------*/
1716 for (attr = qs_get_attr(doc,node);
1718 attr = qs_get_next_attr(doc,attr)) {
1719 char *name = qs_get_attr_name(doc,attr);
1720 char *value = qs_get_attr_value(doc,attr);
1721 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1722 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1723 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1724 STRCASEEQ('p','P',"password",tmp_type) ||
1725 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1726 STRCASEEQ('r','R',"radio", tmp_type) ||
1727 STRCASEEQ('h','H',"hidden", tmp_type) ||
1728 STRCASEEQ('s','S',"submit", tmp_type) ||
1729 STRCASEEQ('r','R',"reset", tmp_type))) {
1730 attr_type = tmp_type;
1733 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1736 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1739 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1740 attr_istyle = value;
1742 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1743 attr_max_length = value;
1745 else if (STRCASEEQ('c','C',"checked", name)) {
1746 attr_checked = value;
1748 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1749 attr_accesskey = value;
1751 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1754 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1759 if (IS_CSS_ON(xhtml->entryp)) {
1760 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1762 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1763 css_property_t *cur;
1764 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1765 if (strcasestr(cur->value, "<ja:n>")) {
1768 else if (strcasestr(cur->value, "<ja:en>")) {
1771 else if (strcasestr(cur->value, "<ja:hk>")) {
1774 else if (strcasestr(cur->value, "<ja:h>")) {
1782 attr_type = qs_trim_string(doc->buf.pool, attr_type);
1783 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
1784 STRCASEEQ('p','P',"password",attr_type) ||
1785 STRCASEEQ('c','C',"checkbox",attr_type) ||
1786 STRCASEEQ('r','R',"radio", attr_type) ||
1787 STRCASEEQ('h','H',"hidden", attr_type) ||
1788 STRCASEEQ('s','S',"submit", attr_type) ||
1789 STRCASEEQ('r','R',"reset", attr_type))) {
1795 if (attr_size && *attr_size) {
1800 if (attr_name && *attr_name) {
1805 if (attr_value && *attr_value) {
1807 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1810 if (attr_accesskey && *attr_accesskey) {
1811 W_L(" accesskey=\"");
1812 W_V(attr_accesskey);
1815 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1816 char *fmt = qs_conv_istyle_to_format(r->pool,attr_istyle);
1817 if (attr_max_length && *attr_max_length) {
1819 for (ii=0; (unsigned int)ii<strlen(attr_max_length); ii++) {
1820 if (attr_max_length[ii] < '0' || attr_max_length[ii] > '9') {
1821 attr_max_length = apr_psprintf(r->pool, "0");
1826 if (strcmp(attr_max_length, "0")) {
1827 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(attr_max_length), fmt);
1839 if (attr_max_length && *attr_max_length) {
1840 if (chxj_chk_numeric(attr_max_length) != 0) {
1841 attr_max_length = apr_psprintf(r->pool, "0");
1843 if (strcmp(attr_max_length, "0")) {
1844 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(attr_max_length));
1849 /*--------------------------------------------------------------------------*/
1850 /* The figure is default for the password. */
1851 /*--------------------------------------------------------------------------*/
1852 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
1853 if (attr_max_length) {
1855 W_V(attr_max_length);
1859 W_L(" FORMAT=\"*N\"");
1863 W_L(" checked=\"checked\"");
1868 /*--------------------------------------------------------------------------*/
1869 /* Get Attributes */
1870 /*--------------------------------------------------------------------------*/
1871 type = qs_get_type_attr(doc, node, doc->buf.pool);
1872 name = qs_get_name_attr(doc, node, doc->buf.pool);
1873 value = qs_get_value_attr(doc,node, doc->buf.pool);
1874 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1875 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1876 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1877 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1878 size = qs_get_size_attr(doc, node, doc->buf.pool);
1881 type = qs_trim_string(doc->buf.pool, type);
1882 if (type && (STRCASEEQ('t','T',"text", type) ||
1883 STRCASEEQ('p','P',"password",type) ||
1884 STRCASEEQ('c','C',"checkbox",type) ||
1885 STRCASEEQ('r','R',"radio", type) ||
1886 STRCASEEQ('h','H',"hidden", type) ||
1887 STRCASEEQ('s','S',"submit", type) ||
1888 STRCASEEQ('r','R',"reset", type))) {
1894 if (size && *size) {
1899 if (name && *name) {
1904 if (value && *value) {
1905 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
1906 apr_size_t value_len = strlen(value);
1907 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
1911 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1914 if (accesskey && *accesskey) {
1915 W_L(" accesskey=\"");
1919 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1920 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
1921 if (max_length && *max_length) {
1923 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1924 if (max_length[ii] < '0' || max_length[ii] > '9') {
1925 max_length = apr_psprintf(r->pool, "0");
1930 if (strcmp(max_length, "0")) {
1931 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1943 if (max_length && *max_length) {
1944 if (chxj_chk_numeric(max_length) != 0) {
1945 max_length = apr_psprintf(r->pool, "0");
1947 if (strcmp(max_length, "0")) {
1948 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1953 /*--------------------------------------------------------------------------*/
1954 /* The figure is default for the password. */
1955 /*--------------------------------------------------------------------------*/
1956 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1963 W_L(" FORMAT=\"*N\"");
1967 W_L(" checked=\"checked\"");
1977 * It is a handler who processes the INPUT tag.
1979 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1980 * destination is specified.
1981 * @param node [i] The INPUT tag node is specified.
1982 * @return The conversion result is returned.
1985 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1987 xhtml_t *xhtml = GET_XHTML(pdoc);
1994 * It is a handler who processes the CENTER tag.
1996 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1997 * destination is specified.
1998 * @param node [i] The CENTER tag node is specified.
1999 * @return The conversion result is returned.
2002 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2007 char *attr_style = NULL;
2008 char *attr_color = NULL;
2009 char *attr_size = NULL;
2011 xhtml = GET_XHTML(pdoc);
2014 for (attr = qs_get_attr(doc,node);
2016 attr = qs_get_next_attr(doc,attr)) {
2017 char *name = qs_get_attr_name(doc,attr);
2018 char *value = qs_get_attr_value(doc,attr);
2019 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2023 if (IS_CSS_ON(xhtml->entryp)) {
2024 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2026 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2027 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2028 css_property_t *cur;
2029 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2030 if (cur->value && *cur->value) {
2031 attr_color = apr_pstrdup(doc->pool, cur->value);
2034 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2035 if (cur->value && *cur->value) {
2036 attr_size = apr_pstrdup(doc->pool, cur->value);
2043 if (attr_size || attr_color) {
2051 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2065 * It is a handler who processes the CENTER tag.
2067 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2068 * destination is specified.
2069 * @param node [i] The CENTER tag node is specified.
2070 * @return The conversion result is returned.
2073 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2075 xhtml_t *xhtml = GET_XHTML(pdoc);
2076 Doc *doc = xhtml->doc;
2079 if (IS_CSS_ON(xhtml->entryp)) {
2080 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2087 * It is a handler who processes the HR tag.
2089 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2090 * destination is specified.
2091 * @param node [i] The HR tag node is specified.
2092 * @return The conversion result is returned.
2095 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2101 char *attr_align = NULL;
2102 char *attr_size = NULL;
2103 char *attr_width = NULL;
2104 char *attr_noshade = NULL;
2105 char *attr_style = NULL;
2106 char *attr_color = NULL;
2108 xhtml = GET_XHTML(pdoc);
2112 for (attr = qs_get_attr(doc,node);
2114 attr = qs_get_next_attr(doc,attr)) {
2115 char *name = qs_get_attr_name (doc,attr);
2116 char *value = qs_get_attr_value(doc,attr);
2120 if (strcasecmp(name, "align") == 0) {
2121 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2124 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2132 if (strcasecmp(name, "size") == 0) {
2133 /*--------------------------------------------------------------------*/
2135 /*--------------------------------------------------------------------*/
2136 if (value && *value) {
2140 else if (strcasecmp(name, "style") == 0) {
2141 if (value && *value) {
2149 if (strcasecmp(name, "width") == 0) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2153 if (value && *value) {
2161 if (strcasecmp(name, "noshade") == 0) {
2162 /*--------------------------------------------------------------------*/
2164 /*--------------------------------------------------------------------*/
2165 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2171 if (strcasecmp(name, "color") == 0 && value && *value) {
2172 /*--------------------------------------------------------------------*/
2174 /*--------------------------------------------------------------------*/
2183 if (IS_CSS_ON(xhtml->entryp)) {
2184 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2186 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2187 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2188 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2189 css_property_t *cur;
2190 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2191 if (STRCASEEQ('s','S',"solid",cur->value)) {
2192 attr_noshade = "noshade";
2195 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2196 char *tmp = apr_pstrdup(doc->pool, cur->value);
2197 char *tmpp = strstr(tmp, "px");
2199 attr_size = apr_pstrdup(doc->pool, tmp);
2202 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2203 char *tmp = apr_pstrdup(doc->pool, cur->value);
2204 char *tmpp = strstr(tmp, "px");
2206 attr_width = apr_pstrdup(doc->pool, tmp);
2209 tmpp = strstr(tmp, "%");
2211 attr_width = apr_pstrdup(doc->pool, tmp);
2223 if (attr_size || attr_width || attr_noshade) {
2228 if (!strstr(attr_size, "px")) {
2236 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2242 W_L("border-style:solid;");
2258 * It is a handler who processes the HR tag.
2260 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2261 * destination is specified.
2262 * @param node [i] The HR tag node is specified.
2263 * @return The conversion result is returned.
2266 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2268 xhtml_t *xhtml = GET_XHTML(pdoc);
2275 * It is a handler who processes the PRE tag.
2277 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2278 * destination is specified.
2279 * @param node [i] The PRE tag node is specified.
2280 * @return The conversion result is returned.
2283 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2285 xhtml_t *xhtml = GET_XHTML(pdoc);
2286 Doc *doc = xhtml->doc;
2288 char *attr_style = NULL;
2290 for (attr = qs_get_attr(doc,node);
2292 attr = qs_get_next_attr(doc,attr)) {
2293 char *nm = qs_get_attr_name(doc,attr);
2294 char *val = qs_get_attr_value(doc,attr);
2295 if (val && STRCASEEQ('s','S',"style", nm)) {
2300 if (IS_CSS_ON(xhtml->entryp)) {
2301 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2311 * It is a handler who processes the PRE tag.
2313 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2314 * destination is specified.
2315 * @param node [i] The PRE tag node is specified.
2316 * @return The conversion result is returned.
2319 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2321 xhtml_t *xhtml = GET_XHTML(pdoc);
2322 Doc *doc = xhtml->doc;
2326 if (IS_CSS_ON(xhtml->entryp)) {
2327 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2335 * It is a handler who processes the P tag.
2337 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2338 * destination is specified.
2339 * @param node [i] The P tag node is specified.
2340 * @return The conversion result is returned.
2343 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2345 xhtml_t *xhtml = GET_XHTML(pdoc);
2346 Doc *doc = xhtml->doc;
2348 char *attr_align = NULL;
2349 char *attr_style = NULL;
2350 char *attr_color = NULL;
2351 char *attr_blink = NULL;
2353 for (attr = qs_get_attr(doc,node);
2355 attr = qs_get_next_attr(doc,attr)) {
2356 char *nm = qs_get_attr_name(doc,attr);
2357 char *val = qs_get_attr_value(doc,attr);
2358 if (STRCASEEQ('a','A',"align", nm)) {
2359 /*----------------------------------------------------------------------*/
2360 /* CHTML 1.0 (W3C version 3.2) */
2361 /*----------------------------------------------------------------------*/
2362 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2363 attr_align = apr_pstrdup(doc->buf.pool, val);
2367 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2368 attr_style = apr_pstrdup(doc->buf.pool, val);
2371 if (IS_CSS_ON(xhtml->entryp)) {
2372 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2374 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2375 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2376 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2377 css_property_t *cur;
2378 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2379 if (STRCASEEQ('l','L',"left",cur->value)) {
2380 attr_align = apr_pstrdup(doc->pool, "left");
2382 else if (STRCASEEQ('c','C',"center",cur->value)) {
2383 attr_align = apr_pstrdup(doc->pool, "center");
2385 else if (STRCASEEQ('r','R',"right",cur->value)) {
2386 attr_align = apr_pstrdup(doc->pool, "right");
2389 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2390 if (cur->value && *cur->value) {
2391 attr_color = apr_pstrdup(doc->pool, cur->value);
2394 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2395 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2396 attr_blink = apr_pstrdup(doc->pool, cur->value);
2402 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2410 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2416 W_L("text-decoration:");
2428 * It is a handler who processes the P tag.
2430 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2431 * destination is specified.
2432 * @param node [i] The P tag node is specified.
2433 * @return The conversion result is returned.
2436 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
2438 xhtml_t *xhtml = GET_XHTML(pdoc);
2439 Doc *doc = xhtml->doc;
2442 if (IS_CSS_ON(xhtml->entryp)) {
2443 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2450 * It is a handler who processes the UL tag.
2452 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2453 * destination is specified.
2454 * @param node [i] The UL tag node is specified.
2455 * @return The conversion result is returned.
2458 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
2460 xhtml_t *xhtml = GET_XHTML(pdoc);
2461 Doc *doc = xhtml->doc;
2463 char *attr_type = NULL;
2464 char *attr_style = NULL;
2465 /*--------------------------------------------------------------------------*/
2466 /* Get Attributes */
2467 /*--------------------------------------------------------------------------*/
2468 for (attr = qs_get_attr(doc,node);
2470 attr = qs_get_next_attr(doc,attr)) {
2471 char *name = qs_get_attr_name(doc,attr);
2472 char *value = qs_get_attr_value(doc,attr);
2473 if (STRCASEEQ('t','T',"type",name)) {
2474 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2478 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2482 if (IS_CSS_ON(xhtml->entryp)) {
2483 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2485 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2486 css_property_t *cur;
2487 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2488 if (STRCASEEQ('d','D',"disc",cur->value)) {
2489 attr_type = apr_pstrdup(doc->pool, "disc");
2491 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2492 attr_type = apr_pstrdup(doc->pool, "circle");
2494 else if (STRCASEEQ('s','S',"square",cur->value)) {
2495 attr_type = apr_pstrdup(doc->pool, "square");
2503 W_L("list-style-type:");
2514 * It is a handler who processes the UL tag.
2516 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2517 * destination is specified.
2518 * @param node [i] The UL tag node is specified.
2519 * @return The conversion result is returned.
2522 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
2524 xhtml_t *xhtml = GET_XHTML(pdoc);
2525 Doc *doc = xhtml->doc;
2528 if (IS_CSS_ON(xhtml->entryp)) {
2529 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2536 * It is a handler who processes the H1 tag.
2538 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2539 * destination is specified.
2540 * @param node [i] The H1 tag node is specified.
2541 * @return The conversion result is returned.
2544 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
2546 xhtml_t *xhtml = GET_XHTML(pdoc);
2547 Doc *doc = xhtml->doc;
2549 char *attr_style = NULL;
2550 char *attr_align = NULL;
2552 for (attr = qs_get_attr(doc,node);
2554 attr = qs_get_next_attr(doc,attr)) {
2555 char *name = qs_get_attr_name(doc,attr);
2556 char *value = qs_get_attr_value(doc,attr);
2557 if (STRCASEEQ('a','A',"align", name)) {
2558 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2562 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2566 if (IS_CSS_ON(xhtml->entryp)) {
2567 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2569 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2570 css_property_t *cur;
2571 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2572 if (STRCASEEQ('l','L',"left", cur->value)) {
2573 attr_align = apr_pstrdup(doc->pool, "left");
2575 else if (STRCASEEQ('c','C',"center",cur->value)) {
2576 attr_align = apr_pstrdup(doc->pool, "center");
2578 else if (STRCASEEQ('r','R',"right",cur->value)) {
2579 attr_align = apr_pstrdup(doc->pool, "right");
2599 * It is a handler who processes the H1 tag.
2601 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2602 * destination is specified.
2603 * @param node [i] The H1 tag node is specified.
2604 * @return The conversion result is returned.
2607 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
2609 xhtml_t *xhtml = GET_XHTML(pdoc);
2610 Doc *doc = xhtml->doc;
2613 if (IS_CSS_ON(xhtml->entryp)) {
2614 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2621 * It is a handler who processes the H2 tag.
2623 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2624 * destination is specified.
2625 * @param node [i] The H2 tag node is specified.
2626 * @return The conversion result is returned.
2629 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
2631 xhtml_t *xhtml = GET_XHTML(pdoc);
2632 Doc *doc = xhtml->doc;
2634 char *attr_style = NULL;
2635 char *attr_align = NULL;
2637 for (attr = qs_get_attr(doc,node);
2639 attr = qs_get_next_attr(doc,attr)) {
2640 char *name = qs_get_attr_name(doc,attr);
2641 char *value = qs_get_attr_value(doc,attr);
2642 if (STRCASEEQ('a','A',"align", name)) {
2643 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2647 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2651 if (IS_CSS_ON(xhtml->entryp)) {
2652 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2654 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2655 css_property_t *cur;
2656 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2657 if (STRCASEEQ('l','L',"left", cur->value)) {
2658 attr_align = apr_pstrdup(doc->pool, "left");
2660 else if (STRCASEEQ('c','C',"center",cur->value)) {
2661 attr_align = apr_pstrdup(doc->pool, "center");
2663 else if (STRCASEEQ('r','R',"right",cur->value)) {
2664 attr_align = apr_pstrdup(doc->pool, "right");
2684 * It is a handler who processes the H2 tag.
2686 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2687 * destination is specified.
2688 * @param node [i] The H2 tag node is specified.
2689 * @return The conversion result is returned.
2692 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2694 xhtml_t *xhtml = GET_XHTML(pdoc);
2695 Doc *doc = xhtml->doc;
2698 if (IS_CSS_ON(xhtml->entryp)) {
2699 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2706 * It is a handler who processes the H3 tag.
2708 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2709 * destination is specified.
2710 * @param node [i] The H3 tag node is specified.
2711 * @return The conversion result is returned.
2714 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2716 xhtml_t *xhtml = GET_XHTML(pdoc);
2717 Doc *doc = xhtml->doc;
2719 char *attr_style = NULL;
2720 char *attr_align = NULL;
2722 for (attr = qs_get_attr(doc,node);
2724 attr = qs_get_next_attr(doc,attr)) {
2725 char *name = qs_get_attr_name(doc,attr);
2726 char *value = qs_get_attr_value(doc,attr);
2727 if (STRCASEEQ('a','A',"align", name)) {
2728 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2732 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2736 if (IS_CSS_ON(xhtml->entryp)) {
2737 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2739 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2740 css_property_t *cur;
2741 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2742 if (STRCASEEQ('l','L',"left", cur->value)) {
2743 attr_align = apr_pstrdup(doc->pool, "left");
2745 else if (STRCASEEQ('c','C',"center",cur->value)) {
2746 attr_align = apr_pstrdup(doc->pool, "center");
2748 else if (STRCASEEQ('r','R',"right",cur->value)) {
2749 attr_align = apr_pstrdup(doc->pool, "right");
2769 * It is a handler who processes the H3 tag.
2771 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2772 * destination is specified.
2773 * @param node [i] The H3 tag node is specified.
2774 * @return The conversion result is returned.
2777 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2779 xhtml_t *xhtml = GET_XHTML(pdoc);
2780 Doc *doc = xhtml->doc;
2783 if (IS_CSS_ON(xhtml->entryp)) {
2784 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2792 * It is a handler who processes the H4 tag.
2794 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2795 * destination is specified.
2796 * @param node [i] The H4 tag node is specified.
2797 * @return The conversion result is returned.
2800 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2802 xhtml_t *xhtml = GET_XHTML(pdoc);
2803 Doc *doc = xhtml->doc;
2805 char *attr_style = NULL;
2806 char *attr_align = NULL;
2808 for (attr = qs_get_attr(doc,node);
2810 attr = qs_get_next_attr(doc,attr)) {
2811 char *name = qs_get_attr_name(doc,attr);
2812 char *value = qs_get_attr_value(doc,attr);
2813 if (STRCASEEQ('a','A',"align", name)) {
2814 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2818 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2822 if (IS_CSS_ON(xhtml->entryp)) {
2823 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2825 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2826 css_property_t *cur;
2827 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2828 if (STRCASEEQ('l','L',"left", cur->value)) {
2829 attr_align = apr_pstrdup(doc->pool, "left");
2831 else if (STRCASEEQ('c','C',"center",cur->value)) {
2832 attr_align = apr_pstrdup(doc->pool, "center");
2834 else if (STRCASEEQ('r','R',"right",cur->value)) {
2835 attr_align = apr_pstrdup(doc->pool, "right");
2855 * It is a handler who processes the H4 tag.
2857 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2858 * destination is specified.
2859 * @param node [i] The H4 tag node is specified.
2860 * @return The conversion result is returned.
2863 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
2865 xhtml_t *xhtml = GET_XHTML(pdoc);
2866 Doc *doc = xhtml->doc;
2869 if (IS_CSS_ON(xhtml->entryp)) {
2870 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2878 * It is a handler who processes the H5 tag.
2880 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2881 * destination is specified.
2882 * @param node [i] The H5 tag node is specified.
2883 * @return The conversion result is returned.
2886 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
2888 xhtml_t *xhtml = GET_XHTML(pdoc);
2889 Doc *doc = xhtml->doc;
2891 char *attr_style = NULL;
2892 char *attr_align = NULL;
2894 for (attr = qs_get_attr(doc,node);
2896 attr = qs_get_next_attr(doc,attr)) {
2897 char *name = qs_get_attr_name(doc,attr);
2898 char *value = qs_get_attr_value(doc,attr);
2899 if (STRCASEEQ('a','A',"align", name)) {
2900 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2904 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2908 if (IS_CSS_ON(xhtml->entryp)) {
2909 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2911 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2912 css_property_t *cur;
2913 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2914 if (STRCASEEQ('l','L',"left", cur->value)) {
2915 attr_align = apr_pstrdup(doc->pool, "left");
2917 else if (STRCASEEQ('c','C',"center",cur->value)) {
2918 attr_align = apr_pstrdup(doc->pool, "center");
2920 else if (STRCASEEQ('r','R',"right",cur->value)) {
2921 attr_align = apr_pstrdup(doc->pool, "right");
2941 * It is a handler who processes the H5 tag.
2943 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2944 * destination is specified.
2945 * @param node [i] The H5 tag node is specified.
2946 * @return The conversion result is returned.
2949 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2951 xhtml_t *xhtml = GET_XHTML(pdoc);
2952 Doc *doc = xhtml->doc;
2955 if (IS_CSS_ON(xhtml->entryp)) {
2956 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2964 * It is a handler who processes the H6 tag.
2966 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2967 * destination is specified.
2968 * @param node [i] The H6 tag node is specified.
2969 * @return The conversion result is returned.
2972 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2974 xhtml_t *xhtml = GET_XHTML(pdoc);
2975 Doc *doc = xhtml->doc;
2977 char *attr_style = NULL;
2978 char *attr_align = NULL;
2980 for (attr = qs_get_attr(doc,node);
2982 attr = qs_get_next_attr(doc,attr)) {
2983 char *name = qs_get_attr_name(doc,attr);
2984 char *value = qs_get_attr_value(doc,attr);
2985 if (STRCASEEQ('a','A',"align", name)) {
2986 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2990 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2994 if (IS_CSS_ON(xhtml->entryp)) {
2995 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2997 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2998 css_property_t *cur;
2999 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3000 if (STRCASEEQ('l','L',"left", cur->value)) {
3001 attr_align = apr_pstrdup(doc->pool, "left");
3003 else if (STRCASEEQ('c','C',"center",cur->value)) {
3004 attr_align = apr_pstrdup(doc->pool, "center");
3006 else if (STRCASEEQ('r','R',"right",cur->value)) {
3007 attr_align = apr_pstrdup(doc->pool, "right");
3027 * It is a handler who processes the H6 tag.
3029 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3030 * destination is specified.
3031 * @param node [i] The H6 tag node is specified.
3032 * @return The conversion result is returned.
3035 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3037 xhtml_t *xhtml = GET_XHTML(pdoc);
3038 Doc *doc = xhtml->doc;
3041 if (IS_CSS_ON(xhtml->entryp)) {
3042 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3050 * It is a handler who processes the OL tag.
3052 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3053 * destination is specified.
3054 * @param node [i] The OL tag node is specified.
3055 * @return The conversion result is returned.
3058 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3060 xhtml_t *xhtml = GET_XHTML(pdoc);
3061 Doc *doc = xhtml->doc;
3063 char *attr_style = NULL;
3064 char *attr_start = NULL;
3065 char *attr_type = NULL;
3067 /*--------------------------------------------------------------------------*/
3068 /* Get Attributes */
3069 /*--------------------------------------------------------------------------*/
3070 for (attr = qs_get_attr(doc,node);
3072 attr = qs_get_next_attr(doc,attr)) {
3073 char *name = qs_get_attr_name(doc,attr);
3074 char *value = qs_get_attr_value(doc,attr);
3075 if (STRCASEEQ('t','T',"type",name) && value) {
3076 if (*value == '1') {
3077 attr_type = apr_pstrdup(doc->pool, "decimal");
3079 else if (*value == 'a') {
3080 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3082 else if (*value == 'A') {
3083 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3086 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3089 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3093 if (IS_CSS_ON(xhtml->entryp)) {
3094 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3096 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3097 css_property_t *cur;
3098 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3099 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3100 attr_type = apr_pstrdup(doc->pool, "decimal");
3102 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3103 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3105 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3106 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3114 W_L("list-style-type:");
3131 * It is a handler who processes the OL tag.
3133 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3134 * destination is specified.
3135 * @param node [i] The OL tag node is specified.
3136 * @return The conversion result is returned.
3139 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3141 xhtml_t *xhtml = GET_XHTML(pdoc);
3142 Doc *doc = xhtml->doc;
3145 if (IS_CSS_ON(xhtml->entryp)) {
3146 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3154 * It is a handler who processes the LI tag.
3156 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3157 * destination is specified.
3158 * @param node [i] The LI tag node is specified.
3159 * @return The conversion result is returned.
3162 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3164 xhtml_t *xhtml = GET_XHTML(pdoc);
3165 Doc *doc = xhtml->doc;
3167 char *attr_type = NULL;
3168 char *attr_value = NULL;
3169 char *attr_style = NULL;
3171 for (attr = qs_get_attr(doc,node);
3173 attr = qs_get_next_attr(doc,attr)) {
3174 char *name = qs_get_attr_name(doc,attr);
3175 char *value = qs_get_attr_value(doc,attr);
3176 if (STRCASEEQ('t','T',"type",name)) {
3177 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3178 if (*value == '1') {
3179 attr_type = apr_pstrdup(doc->pool, "decimal");
3181 else if (*value == 'a') {
3182 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3184 else if (*value == 'A') {
3185 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3192 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3195 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3199 if (IS_CSS_ON(xhtml->entryp)) {
3200 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3202 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3203 css_property_t *cur;
3204 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3205 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3206 attr_type = apr_pstrdup(doc->pool, "decimal");
3208 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3209 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3211 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3212 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3214 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3215 attr_type = apr_pstrdup(doc->pool, "disc");
3217 else if (STRCASEEQ('s','S',"square", cur->value)) {
3218 attr_type = apr_pstrdup(doc->pool, "square");
3220 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3221 attr_type = apr_pstrdup(doc->pool, "circle");
3231 W_L("list-style-type:");
3247 ** It is a handler who processes the LI tag.
3249 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3250 * destination is specified.
3251 * @param node [i] The LI tag node is specified.
3252 * @return The conversion result is returned.
3255 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
3257 xhtml_t *xhtml = GET_XHTML(pdoc);
3258 Doc *doc = xhtml->doc;
3261 if (IS_CSS_ON(xhtml->entryp)) {
3262 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3268 * It is a handler who processes the IMG tag.
3270 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3271 * destination is specified.
3272 * @param node [i] The IMG tag node is specified.
3273 * @return The conversion result is returned.
3276 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
3278 xhtml_t *xhtml = GET_XHTML(pdoc);
3279 Doc *doc = xhtml->doc;
3280 request_rec *r = doc->r;
3282 char *attr_src = NULL;
3283 char *attr_alt = NULL;
3284 char *attr_height = NULL;
3285 char *attr_width = NULL;
3286 char *attr_align = NULL;
3287 char *attr_style = NULL;
3288 char *attr_hspace = NULL;
3289 char *attr_vspace = NULL;
3291 #ifndef IMG_NOT_CONVERT_FILENAME
3292 device_table *spec = xhtml->spec;
3295 /*--------------------------------------------------------------------------*/
3296 /* Get Attributes */
3297 /*--------------------------------------------------------------------------*/
3298 for (attr = qs_get_attr(doc,node);
3300 attr = qs_get_next_attr(doc,attr)) {
3301 char *name = qs_get_attr_name(doc,attr);
3302 char *value = qs_get_attr_value(doc,attr);
3304 if (STRCASEEQ('s','S',"src",name)) {
3305 value = chxj_encoding_parameter(r, value, 1);
3306 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
3307 value = chxj_add_cookie_no_update_parameter(r, value);
3308 #ifdef IMG_NOT_CONVERT_FILENAME
3314 attr_src = chxj_img_conv(r,spec,value);
3320 if (STRCASEEQ('a','A',"align",name)) {
3322 if (STRCASEEQ('t','T',"top", value) ||
3323 STRCASEEQ('m','M',"middle",value) ||
3324 STRCASEEQ('b','B',"bottom",value) ||
3325 STRCASEEQ('l','L',"left", value) ||
3326 STRCASEEQ('r','R',"right", value)) {
3329 else if (STRCASEEQ('c','C',"center", value)) {
3330 attr_align = apr_pstrdup(doc->pool, "middle");
3334 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3337 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3340 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3341 attr_height = value;
3343 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3344 attr_hspace = value;
3346 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3347 attr_vspace = value;
3349 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3354 if (IS_CSS_ON(xhtml->entryp)) {
3355 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3357 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3358 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3359 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3360 css_property_t *cur;
3361 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3362 attr_height = apr_pstrdup(doc->pool, cur->value);
3364 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3365 attr_width = apr_pstrdup(doc->pool, cur->value);
3367 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3368 attr_align = apr_pstrdup(doc->pool, cur->value);
3418 * It is a handler who processes the IMG tag.
3420 * @param xhtml [i/o] The pointer to the XHTML structure at the output
3421 * destination is specified.
3422 * @param node [i] The IMG tag node is specified.
3423 * @return The conversion result is returned.
3426 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
3428 xhtml_t *xhtml = GET_XHTML(pdoc);
3435 * It is a handler who processes the SELECT tag.
3437 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3438 * destination is specified.
3439 * @param node [i] The SELECT tag node is specified.
3440 * @return The conversion result is returned.
3443 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
3445 xhtml_t *xhtml = GET_XHTML(pdoc);
3446 Doc *doc = xhtml->doc;
3449 char *multiple = NULL;
3451 char *attr_style = NULL;
3454 for (attr = qs_get_attr(doc,node);
3456 attr = qs_get_next_attr(doc,attr)) {
3457 char *nm = qs_get_attr_name(doc,attr);
3458 char *val = qs_get_attr_value(doc,attr);
3459 if (STRCASEEQ('s','S',"size",nm)) {
3460 /*----------------------------------------------------------------------*/
3461 /* CHTML 1.0 version 2.0 */
3462 /*----------------------------------------------------------------------*/
3463 size = apr_pstrdup(doc->buf.pool, val);
3465 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3466 /*----------------------------------------------------------------------*/
3467 /* CHTML 1.0 version 2.0 */
3468 /*----------------------------------------------------------------------*/
3469 attr_style = apr_pstrdup(doc->buf.pool, val);
3471 else if (STRCASEEQ('n','N',"name",nm)) {
3472 /*----------------------------------------------------------------------*/
3473 /* CHTML 1.0 version 2.0 */
3474 /*----------------------------------------------------------------------*/
3475 name = apr_pstrdup(doc->buf.pool, val);
3477 else if (STRCASEEQ('m','M',"multiple",nm)) {
3478 /*----------------------------------------------------------------------*/
3479 /* CHTML 1.0 version 2.0 */
3480 /*----------------------------------------------------------------------*/
3481 multiple = apr_pstrdup(doc->buf.pool, val);
3484 if (size && *size) {
3489 if (name && *name) {
3495 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
3496 W_L(" multiple=\"true\"");
3499 if (IS_CSS_ON(xhtml->entryp)) {
3500 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3508 * It is a handler who processes the SELECT tag.
3510 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3511 * destination is specified.
3512 * @param node [i] The SELECT tag node is specified.
3513 * @return The conversion result is returned.
3516 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
3518 xhtml_t *xhtml = GET_XHTML(pdoc);
3519 Doc *doc = xhtml->doc;
3522 if (IS_CSS_ON(xhtml->entryp)) {
3523 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3530 * It is a handler who processes the OPTION tag.
3532 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3533 * destination is specified.
3534 * @param node [i] The OPTION tag node is specified.
3535 * @return The conversion result is returned.
3538 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
3540 xhtml_t *xhtml = GET_XHTML(pdoc);
3541 Doc *doc = xhtml->doc;
3543 char *attr_style = NULL;
3545 char *selected = NULL;
3549 for (attr = qs_get_attr(doc,node);
3551 attr = qs_get_next_attr(doc,attr)) {
3552 char *nm = qs_get_attr_name(doc,attr);
3553 char *val = qs_get_attr_value(doc,attr);
3554 if (STRCASEEQ('s','S',"selected",nm)) {
3555 /* CHTML version 2.0 */
3556 selected = apr_pstrdup(doc->buf.pool, val);
3558 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3559 /* CHTML version 2.0 */
3560 attr_style = apr_pstrdup(doc->buf.pool, val);
3562 else if (STRCASEEQ('v','V',"value",nm)) {
3563 /* CHTML version 2.0 */
3564 value = apr_pstrdup(doc->buf.pool, val);
3573 W_L(" selected=\"selected\"");
3576 if (IS_CSS_ON(xhtml->entryp)) {
3577 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3584 * It is a handler who processes the OPTION tag.
3586 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3587 * destination is specified.
3588 * @param node [i] The OPTION tag node is specified.
3589 * @return The conversion result is returned.
3592 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
3594 xhtml_t *xhtml = GET_XHTML(pdoc);
3595 Doc *doc = xhtml->doc;
3598 if (IS_CSS_ON(xhtml->entryp)) {
3599 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3607 * It is a handler who processes the DIV tag.
3609 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3610 * destination is specified.
3611 * @param node [i] The DIV tag node is specified.
3612 * @return The conversion result is returned.
3615 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
3617 xhtml_t *xhtml = GET_XHTML(pdoc);
3618 Doc *doc = xhtml->doc;
3620 char *attr_style = NULL;
3621 char *attr_align = NULL;
3622 char *attr_display = NULL;
3623 char *attr_decoration = NULL;
3624 char *attr_wap_marquee_style = NULL;
3625 char *attr_wap_marquee_dir = NULL;
3626 char *attr_wap_marquee_loop = NULL;
3627 char *attr_color = NULL;
3628 char *attr_bgcolor = NULL;
3629 char *attr_font_size = NULL;
3631 for (attr = qs_get_attr(doc,node);
3633 attr = qs_get_next_attr(doc,attr)) {
3634 char *nm = qs_get_attr_name(doc,attr);
3635 char *val = qs_get_attr_value(doc,attr);
3636 if (STRCASEEQ('a','A',"align",nm)) {
3637 /*----------------------------------------------------------------------*/
3638 /* CHTML 1.0 (W3C version 3.2) */
3639 /*----------------------------------------------------------------------*/
3640 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3641 attr_align = apr_pstrdup(doc->buf.pool, val);
3644 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3645 attr_style = apr_pstrdup(doc->buf.pool, val);
3649 if (IS_CSS_ON(xhtml->entryp)) {
3650 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3652 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3653 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3654 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3655 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3656 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3657 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3658 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3660 css_property_t *cur;
3661 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3662 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3663 attr_display = apr_pstrdup(doc->pool, cur->value);
3666 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3667 if (STRCASEEQ('b','B',"blink", cur->value)) {
3668 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3671 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3672 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3673 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3675 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3676 char *ss = strchr(cur->value, '#');
3678 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3679 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3682 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3683 attr_color = apr_pstrdup(doc->pool, cur->value);
3685 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3686 attr_align = apr_pstrdup(doc->pool, cur->value);
3688 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3689 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3690 || STRCASEEQ('x','X',"x-small",cur->value)
3691 || STRCASEEQ('s','S',"small",cur->value)
3692 || STRCASEEQ('m','M',"medium",cur->value)
3693 || STRCASEEQ('l','L',"large",cur->value)
3694 || STRCASEEQ('x','X',"x-large",cur->value)
3695 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3696 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3700 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3701 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3702 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3703 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3704 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3705 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3708 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3709 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3710 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3712 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3713 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3716 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3717 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3726 || attr_wap_marquee_style
3727 || attr_wap_marquee_dir
3728 || attr_wap_marquee_loop
3731 || attr_font_size) {
3743 if (attr_decoration) {
3744 W_L("text-decoration:");
3745 W_V(attr_decoration);
3748 if (attr_wap_marquee_style) {
3749 W_L("-wap-marquee-style:");
3750 W_V(attr_wap_marquee_style);
3753 if (attr_wap_marquee_dir) {
3754 W_L("-wap-marquee-dir:");
3755 W_V(attr_wap_marquee_dir);
3758 if (attr_wap_marquee_loop) {
3759 W_L("-wap-marquee-loop:");
3760 W_V(attr_wap_marquee_loop);
3769 W_L("background-color:");
3773 if (attr_font_size) {
3775 W_V(attr_font_size);
3786 * It is a handler who processes the DIV tag.
3788 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3789 * destination is specified.
3790 * @param node [i] The DIV tag node is specified.
3791 * @return The conversion result is returned.
3794 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
3796 xhtml_t *xhtml = GET_XHTML(pdoc);
3797 Doc *doc = xhtml->doc;
3799 if (IS_CSS_ON(xhtml->entryp)) {
3800 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3807 * It is a handler who processes the B tag.
3809 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3810 * destination is specified.
3811 * @param node [i] The B tag node is specified.
3812 * @return The conversion result is returned.
3815 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
3817 xhtml_t *xhtml = GET_XHTML(pdoc);
3818 Doc *doc = xhtml->doc;
3820 W_L("<div style=\"font-weight:bold\">");
3826 * It is a handler who processes the B tag.
3828 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3829 * destination is specified.
3830 * @param node [i] The B tag node is specified.
3831 * @return The conversion result is returned.
3834 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
3836 xhtml_t *xhtml = GET_XHTML(pdoc);
3837 Doc *doc = xhtml->doc;
3845 * It is a handler who processes the CHXJ:IF tag.
3847 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3848 * destination is specified.
3849 * @param node [i] The CHXJ:IF tag node is specified.
3852 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
3854 xhtml_t *xhtml = GET_XHTML(pdoc);
3855 Doc *doc = xhtml->doc;
3858 for (child = qs_get_child_node(doc, node);
3860 child = qs_get_next_node(doc, child)) {
3862 s_xhtml_1_0_chxjif_tag(xhtml, child);
3870 * It is a handler who processes the TEXTARE tag.
3872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3873 * destination is specified.
3874 * @param node [i] The TEXTAREA tag node is specified.
3875 * @return The conversion result is returned.
3878 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
3880 xhtml_t *xhtml = GET_XHTML(pdoc);
3881 Doc *doc = xhtml->doc;
3883 char *attr_accesskey = NULL;
3884 char *attr_name = NULL;
3885 char *attr_rows = NULL;
3886 char *attr_cols = NULL;
3887 char *attr_istyle = NULL;
3888 char *attr_style = NULL;
3890 xhtml->textarea_flag++;
3891 for (attr = qs_get_attr(doc,node);
3893 attr = qs_get_next_attr(doc,attr)) {
3894 char *name = qs_get_attr_name(doc,attr);
3895 char *value = qs_get_attr_value(doc,attr);
3896 if (STRCASEEQ('n','N',"name",name) && value && *value) {
3899 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
3902 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
3905 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3906 attr_istyle = value;
3908 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
3914 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3915 attr_accesskey = value;
3917 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
3921 if (IS_CSS_ON(xhtml->entryp)) {
3922 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3924 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3925 css_property_t *cur;
3926 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3927 if (strcasestr(cur->value, "<ja:n>")) {
3930 else if (strcasestr(cur->value, "<ja:en>")) {
3933 else if (strcasestr(cur->value, "<ja:hk>")) {
3936 else if (strcasestr(cur->value, "<ja:h>")) {
3943 if (attr_accesskey) {
3944 W_L(" accesskey=\"");
3945 W_V(attr_accesskey);
3964 char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
3975 * It is a handler who processes the TEXTAREA tag.
3977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3978 * destination is specified.
3979 * @param node [i] The TEXTAREA tag node is specified.
3980 * @return The conversion result is returned.
3983 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3985 xhtml_t *xhtml = GET_XHTML(pdoc);
3986 Doc *doc = xhtml->doc;
3989 xhtml->textarea_flag--;
3995 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
3997 xhtml_t *xhtml = GET_XHTML(pdoc);
3998 Doc *doc = xhtml->doc;
3999 request_rec *r = doc->r;
4006 apr_size_t z2h_input_len;
4008 textval = qs_get_node_value(doc,child);
4009 if (strlen(textval) == 0) {
4013 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4014 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4016 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4017 memset(one_byte, 0, sizeof(one_byte));
4020 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4022 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4024 DBG(r,"[%s][%d]", out, rtn);
4025 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4029 if (is_sjis_kanji(textval[ii])) {
4030 one_byte[0] = textval[ii+0];
4031 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4032 one_byte[0] = textval[ii+1];
4033 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4036 else if (xhtml->pre_flag) {
4037 one_byte[0] = textval[ii+0];
4038 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4040 else if (xhtml->textarea_flag) {
4041 one_byte[0] = textval[ii+0];
4042 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4044 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4045 one_byte[0] = textval[ii+0];
4046 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4049 z2h_input_len = strlen(tdst);
4050 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4058 * It is a handler who processes the BLOCKQUOTE tag.
4060 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4061 * destination is specified.
4062 * @param node [i] The BLOCKQUOTE tag node is specified.
4063 * @return The conversion result is returned.
4066 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4071 char *attr_style = NULL;
4072 char *attr_color = NULL;
4073 char *attr_size = NULL;
4075 xhtml = GET_XHTML(pdoc);
4077 for (attr = qs_get_attr(doc,node);
4079 attr = qs_get_next_attr(doc,attr)) {
4080 char *nm = qs_get_attr_name(doc,attr);
4081 char *val = qs_get_attr_value(doc,attr);
4082 if (val && STRCASEEQ('s','S',"style", nm)) {
4086 if (IS_CSS_ON(xhtml->entryp)) {
4087 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4089 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4090 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4091 css_property_t *cur;
4092 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4093 if (cur->value && *cur->value) {
4094 attr_color = apr_pstrdup(doc->pool, cur->value);
4097 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4098 if (cur->value && *cur->value) {
4099 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4100 attr_size = apr_pstrdup(doc->pool, cur->value);
4102 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4103 attr_size = apr_pstrdup(doc->pool, cur->value);
4105 else if (STRCASEEQ('s','S',"small",cur->value)) {
4106 attr_size = apr_pstrdup(doc->pool, cur->value);
4108 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4109 attr_size = apr_pstrdup(doc->pool, cur->value);
4111 else if (STRCASEEQ('l','L',"large",cur->value)) {
4112 attr_size = apr_pstrdup(doc->pool, cur->value);
4114 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4115 attr_size = apr_pstrdup(doc->pool, cur->value);
4117 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4118 attr_size = apr_pstrdup(doc->pool, cur->value);
4125 if (attr_color || attr_size) {
4128 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4146 * It is a handler who processes the BLOCKQUOTE tag.
4148 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4149 * destination is specified.
4150 * @param node [i] The BLOCKQUOTE tag node is specified.
4151 * @return The conversion result is returned.
4154 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4156 xhtml_t *xhtml = GET_XHTML(pdoc);
4157 Doc *doc = xhtml->doc;
4158 W_L("</blockquote>");
4159 if (IS_CSS_ON(xhtml->entryp)) {
4160 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4167 * It is a handler who processes the DIR tag.
4169 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4170 * destination is specified.
4171 * @param node [i] The DIR tag node is specified.
4172 * @return The conversion result is returned.
4175 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
4177 xhtml_t *xhtml = GET_XHTML(pdoc);
4178 Doc *doc = xhtml->doc;
4180 char *attr_style = NULL;
4181 char *attr_color = NULL;
4182 char *attr_type = NULL;
4183 char *attr_size = NULL;
4184 for (attr = qs_get_attr(doc,node);
4186 attr = qs_get_next_attr(doc,attr)) {
4187 char *name = qs_get_attr_name(doc,attr);
4188 char *value = qs_get_attr_value(doc,attr);
4189 if (STRCASEEQ('t','T',"type",name)) {
4190 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4194 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4198 if (IS_CSS_ON(xhtml->entryp)) {
4199 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4201 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4202 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4203 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4204 css_property_t *cur;
4205 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4206 if (cur->value && *cur->value) {
4207 attr_color = apr_pstrdup(doc->pool, cur->value);
4210 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4211 if (cur->value && *cur->value) {
4212 attr_type = apr_pstrdup(doc->pool, cur->value);
4215 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4216 if (cur->value && *cur->value) {
4217 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4218 attr_size = apr_pstrdup(doc->pool, cur->value);
4220 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4221 attr_size = apr_pstrdup(doc->pool, cur->value);
4223 else if (STRCASEEQ('s','S',"small",cur->value)) {
4224 attr_size = apr_pstrdup(doc->pool, cur->value);
4226 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4227 attr_size = apr_pstrdup(doc->pool, cur->value);
4229 else if (STRCASEEQ('l','L',"large",cur->value)) {
4230 attr_size = apr_pstrdup(doc->pool, cur->value);
4232 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4233 attr_size = apr_pstrdup(doc->pool, cur->value);
4235 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4236 attr_size = apr_pstrdup(doc->pool, cur->value);
4243 if (attr_type || attr_color || attr_size) {
4246 W_L("list-style-type:");
4251 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4269 * It is a handler who processes the DIR tag.
4271 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4272 * destination is specified.
4273 * @param node [i] The DIR tag node is specified.
4274 * @return The conversion result is returned.
4277 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
4279 xhtml_t *xhtml = GET_XHTML(pdoc);
4280 Doc *doc = xhtml->doc;
4282 if (IS_CSS_ON(xhtml->entryp)) {
4283 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4290 * It is a handler who processes the DL tag.
4292 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4293 * destination is specified.
4294 * @param node [i] The DL tag node is specified.
4295 * @return The conversion result is returned.
4298 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
4300 xhtml_t *xhtml = GET_XHTML(pdoc);
4301 Doc *doc = xhtml->doc;
4303 char *attr_style = NULL;
4304 char *attr_color = NULL;
4305 char *attr_size = NULL;
4307 for (attr = qs_get_attr(doc,node);
4309 attr = qs_get_next_attr(doc,attr)) {
4310 char *name = qs_get_attr_name(doc,attr);
4311 char *value = qs_get_attr_value(doc,attr);
4312 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4316 if (IS_CSS_ON(xhtml->entryp)) {
4317 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4319 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4320 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4321 css_property_t *cur;
4322 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4323 if (cur->value && *cur->value) {
4324 attr_color = apr_pstrdup(doc->pool, cur->value);
4327 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4328 if (cur->value && *cur->value) {
4329 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4330 attr_size = apr_pstrdup(doc->pool, cur->value);
4332 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4333 attr_size = apr_pstrdup(doc->pool, cur->value);
4335 else if (STRCASEEQ('s','S',"small",cur->value)) {
4336 attr_size = apr_pstrdup(doc->pool, cur->value);
4338 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4339 attr_size = apr_pstrdup(doc->pool, cur->value);
4341 else if (STRCASEEQ('l','L',"large",cur->value)) {
4342 attr_size = apr_pstrdup(doc->pool, cur->value);
4344 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4345 attr_size = apr_pstrdup(doc->pool, cur->value);
4347 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4348 attr_size = apr_pstrdup(doc->pool, cur->value);
4355 if (attr_color || attr_size) {
4358 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4376 * It is a handler who processes the DL tag.
4378 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4379 * destination is specified.
4380 * @param node [i] The DL tag node is specified.
4381 * @return The conversion result is returned.
4384 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
4386 xhtml_t *xhtml = GET_XHTML(pdoc);
4387 Doc *doc = xhtml->doc;
4389 if (IS_CSS_ON(xhtml->entryp)) {
4390 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4397 * It is a handter who processes the DT tag.
4399 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4400 * destination is specified.
4401 * @param node [i] The DT tag node is specified.
4402 * @return The conversion result is returned.
4405 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
4407 xhtml_t *xhtml = GET_XHTML(pdoc);
4408 Doc *doc = xhtml->doc;
4410 char *attr_style = NULL;
4411 char *attr_color = NULL;
4412 char *attr_size = NULL;
4414 for (attr = qs_get_attr(doc,node);
4416 attr = qs_get_next_attr(doc,attr)) {
4417 char *name = qs_get_attr_name(doc,attr);
4418 char *value = qs_get_attr_value(doc,attr);
4419 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4423 if (IS_CSS_ON(xhtml->entryp)) {
4424 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4426 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4427 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4428 css_property_t *cur;
4429 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4430 if (cur->value && *cur->value) {
4431 attr_color = apr_pstrdup(doc->pool, cur->value);
4434 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4435 if (cur->value && *cur->value) {
4436 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4437 attr_size = apr_pstrdup(doc->pool, cur->value);
4439 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4440 attr_size = apr_pstrdup(doc->pool, cur->value);
4442 else if (STRCASEEQ('s','S',"small",cur->value)) {
4443 attr_size = apr_pstrdup(doc->pool, cur->value);
4445 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4446 attr_size = apr_pstrdup(doc->pool, cur->value);
4448 else if (STRCASEEQ('l','L',"large",cur->value)) {
4449 attr_size = apr_pstrdup(doc->pool, cur->value);
4451 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4452 attr_size = apr_pstrdup(doc->pool, cur->value);
4454 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4455 attr_size = apr_pstrdup(doc->pool, cur->value);
4462 if (attr_color || attr_size) {
4465 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4483 * It is a handter who processes the DT tag.
4485 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4486 * destination is specified.
4487 * @param node [i] The DT tag node is specified.
4488 * @return The conversion result is returned.
4491 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
4493 xhtml_t *xhtml = GET_XHTML(pdoc);
4494 Doc *doc = xhtml->doc;
4496 if (IS_CSS_ON(xhtml->entryp)) {
4497 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4504 * It is a handder who processes the DD tag.
4506 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4507 * destination is specified.
4508 * @param node [i] The DD tag node is specified.
4509 * @return The conversion result is returned.
4512 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
4514 xhtml_t *xhtml = GET_XHTML(pdoc);
4515 Doc *doc = xhtml->doc;
4517 char *attr_style = NULL;
4518 char *attr_color = NULL;
4519 char *attr_size = NULL;
4521 for (attr = qs_get_attr(doc,node);
4523 attr = qs_get_next_attr(doc,attr)) {
4524 char *name = qs_get_attr_name(doc,attr);
4525 char *value = qs_get_attr_value(doc,attr);
4526 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4530 if (IS_CSS_ON(xhtml->entryp)) {
4531 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4533 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4534 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4535 css_property_t *cur;
4536 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4537 if (cur->value && *cur->value) {
4538 attr_color = apr_pstrdup(doc->pool, cur->value);
4541 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4542 if (cur->value && *cur->value) {
4543 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4544 attr_size = apr_pstrdup(doc->pool, cur->value);
4546 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4547 attr_size = apr_pstrdup(doc->pool, cur->value);
4549 else if (STRCASEEQ('s','S',"small",cur->value)) {
4550 attr_size = apr_pstrdup(doc->pool, cur->value);
4552 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4553 attr_size = apr_pstrdup(doc->pool, cur->value);
4555 else if (STRCASEEQ('l','L',"large",cur->value)) {
4556 attr_size = apr_pstrdup(doc->pool, cur->value);
4558 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4559 attr_size = apr_pstrdup(doc->pool, cur->value);
4561 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4562 attr_size = apr_pstrdup(doc->pool, cur->value);
4569 if (attr_color || attr_size) {
4572 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4590 * It is a handler who processes the DD tag.
4592 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4593 * destination is specified.
4594 * @param node [i] The DD tag node is specified.
4595 * @return The conversion result is returned.
4598 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
4600 xhtml_t *xhtml = GET_XHTML(pdoc);
4601 Doc *doc = xhtml->doc;
4603 if (IS_CSS_ON(xhtml->entryp)) {
4604 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4611 * It is a handler who processes the MENU tag.
4613 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4614 * destination is specified.
4615 * @param node [i] The MENU tag node is specified.
4616 * @return The conversion result is returned.
4619 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
4621 xhtml_t *xhtml = GET_XHTML(pdoc);
4622 Doc *doc = xhtml->doc;
4624 char *attr_style = NULL;
4625 char *attr_color = NULL;
4626 char *attr_type = NULL;
4627 char *attr_size = NULL;
4628 for (attr = qs_get_attr(doc,node);
4630 attr = qs_get_next_attr(doc,attr)) {
4631 char *name = qs_get_attr_name(doc,attr);
4632 char *value = qs_get_attr_value(doc,attr);
4633 if (STRCASEEQ('t','T',"type",name)) {
4634 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4638 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4642 if (IS_CSS_ON(xhtml->entryp)) {
4643 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4645 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4646 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4647 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4648 css_property_t *cur;
4649 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4650 if (cur->value && *cur->value) {
4651 attr_color = apr_pstrdup(doc->pool, cur->value);
4654 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4655 if (cur->value && *cur->value) {
4656 attr_type = apr_pstrdup(doc->pool, cur->value);
4659 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4660 if (cur->value && *cur->value) {
4661 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4662 attr_size = apr_pstrdup(doc->pool, cur->value);
4664 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4665 attr_size = apr_pstrdup(doc->pool, cur->value);
4667 else if (STRCASEEQ('s','S',"small",cur->value)) {
4668 attr_size = apr_pstrdup(doc->pool, cur->value);
4670 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4671 attr_size = apr_pstrdup(doc->pool, cur->value);
4673 else if (STRCASEEQ('l','L',"large",cur->value)) {
4674 attr_size = apr_pstrdup(doc->pool, cur->value);
4676 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4677 attr_size = apr_pstrdup(doc->pool, cur->value);
4679 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4680 attr_size = apr_pstrdup(doc->pool, cur->value);
4687 if (attr_type || attr_color || attr_size) {
4690 W_L("list-style-type:");
4695 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4713 * It is a hanmenuer who processes the MENU tag.
4715 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4716 * destination is specified.
4717 * @param node [i] The MENU tag node is specified.
4718 * @return The conversion result is returned.
4721 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
4723 xhtml_t *xhtml = GET_XHTML(pdoc);
4724 Doc *doc = xhtml->doc;
4726 if (IS_CSS_ON(xhtml->entryp)) {
4727 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4734 * It is a handler who processes the PLAINTEXT tag.
4736 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4737 * destination is specified.
4738 * @param node [i] The PLAINTEXT tag node is specified.
4739 * @return The conversion result is returned.
4742 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
4744 xhtml_t *xhtml = GET_XHTML(pdoc);
4745 Doc *doc = xhtml->doc;
4747 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
4752 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
4754 xhtml_t *xhtml = GET_XHTML(pdoc);
4755 Doc *doc = xhtml->doc;
4757 for (child = qs_get_child_node(doc, node);
4759 child = qs_get_next_node(doc, child)) {
4761 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
4768 * It is a handler who processes the PLAINTEXT tag.
4770 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4771 * destination is specified.
4772 * @param node [i] The PLAINTEXT tag node is specified.
4773 * @return The conversion result is returned.
4776 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4778 xhtml_t *xhtml = GET_XHTML(pdoc);
4779 Doc *doc = xhtml->doc;
4780 W_L("</plaintext>");
4786 * It is a handler who processes the BLINK tag.
4788 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4789 * destination is specified.
4790 * @param node [i] The BLINK tag node is specified.
4791 * @return The conversion result is returned.
4794 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
4796 xhtml_t *xhtml = GET_XHTML(pdoc);
4797 Doc *doc = xhtml->doc;
4799 char *attr_style = NULL;
4800 char *attr_color = NULL;
4801 char *attr_size = NULL;
4803 for (attr = qs_get_attr(doc,node);
4805 attr = qs_get_next_attr(doc,attr)) {
4806 char *name = qs_get_attr_name(doc,attr);
4807 char *value = qs_get_attr_value(doc,attr);
4808 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4812 if (IS_CSS_ON(xhtml->entryp)) {
4813 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4815 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4816 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4817 css_property_t *cur;
4818 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4819 if (cur->value && *cur->value) {
4820 attr_color = apr_pstrdup(doc->pool, cur->value);
4823 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4824 if (cur->value && *cur->value) {
4825 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4826 attr_size = apr_pstrdup(doc->pool, cur->value);
4828 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4829 attr_size = apr_pstrdup(doc->pool, cur->value);
4831 else if (STRCASEEQ('s','S',"small",cur->value)) {
4832 attr_size = apr_pstrdup(doc->pool, cur->value);
4834 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4835 attr_size = apr_pstrdup(doc->pool, cur->value);
4837 else if (STRCASEEQ('l','L',"large",cur->value)) {
4838 attr_size = apr_pstrdup(doc->pool, cur->value);
4840 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4841 attr_size = apr_pstrdup(doc->pool, cur->value);
4843 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4844 attr_size = apr_pstrdup(doc->pool, cur->value);
4851 if (attr_color || attr_size) {
4854 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4872 * It is a handler who processes the BLINK tag.
4874 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4875 * destination is specified.
4876 * @param node [i] The BLINK tag node is specified.
4877 * @return The conversion result is returned.
4880 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
4882 xhtml_t *xhtml = GET_XHTML(pdoc);
4883 Doc *doc = xhtml->doc;
4885 if (IS_CSS_ON(xhtml->entryp)) {
4886 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4893 * It is a handler who processes the MARQUEE tag.
4895 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4896 * destination is specified.
4897 * @param node [i] The MARQUEE tag node is specified.
4898 * @return The conversion result is returned.
4901 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
4903 xhtml_t *xhtml = GET_XHTML(pdoc);
4904 Doc *doc = xhtml->doc;
4906 char *attr_direction = NULL;
4907 char *attr_behavior = NULL;
4908 char *attr_loop = NULL;
4909 char *attr_style = NULL;
4910 char *attr_color = NULL;
4911 char *attr_size = NULL;
4912 char *attr_bgcolor = NULL;
4913 /*--------------------------------------------------------------------------*/
4914 /* Get Attributes */
4915 /*--------------------------------------------------------------------------*/
4916 for (attr = qs_get_attr(doc,node);
4918 attr = qs_get_next_attr(doc,attr)) {
4919 char *name = qs_get_attr_name(doc,attr);
4920 char *value = qs_get_attr_value(doc,attr);
4921 if (STRCASEEQ('d','D',"direction", name)) {
4923 if (STRCASEEQ('l','L',"left",value)) {
4924 attr_direction = "rtl";
4926 else if (STRCASEEQ('r','R',"right",value)) {
4927 attr_direction = "ltr";
4931 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
4932 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
4933 attr_behavior = value;
4936 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
4939 else if (STRCASEEQ('b','B',"bgcolor",name)) {
4940 if (value && *value) {
4941 attr_bgcolor = value;
4944 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4948 if (IS_CSS_ON(xhtml->entryp)) {
4949 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4951 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4952 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4953 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
4954 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4955 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4956 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4957 css_property_t *cur;
4958 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4959 if (cur->value && *cur->value) {
4960 attr_color = apr_pstrdup(doc->pool, cur->value);
4963 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
4964 if (cur->value && *cur->value) {
4965 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4968 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4969 if (cur->value && *cur->value) {
4970 attr_direction = apr_pstrdup(doc->pool, cur->value);
4973 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
4974 if (cur->value && *cur->value) {
4975 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4976 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4980 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4981 if (cur->value && *cur->value) {
4982 attr_loop = apr_pstrdup(doc->pool, cur->value);
4985 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4986 if (cur->value && *cur->value) {
4987 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4988 attr_size = apr_pstrdup(doc->pool, cur->value);
4990 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4991 attr_size = apr_pstrdup(doc->pool, cur->value);
4993 else if (STRCASEEQ('s','S',"small",cur->value)) {
4994 attr_size = apr_pstrdup(doc->pool, cur->value);
4996 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4997 attr_size = apr_pstrdup(doc->pool, cur->value);
4999 else if (STRCASEEQ('l','L',"large",cur->value)) {
5000 attr_size = apr_pstrdup(doc->pool, cur->value);
5002 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5003 attr_size = apr_pstrdup(doc->pool, cur->value);
5005 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5006 attr_size = apr_pstrdup(doc->pool, cur->value);
5013 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5015 if (attr_direction) {
5016 W_L("-wap-marquee-dir:");
5017 W_V(attr_direction);
5020 if (attr_behavior) {
5021 W_L("-wap-marquee-style:");
5026 W_L("-wap-marquee-loop:");
5031 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5032 W_L("background-color:");
5037 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5056 * It is a handler who processes the MARQUEE tag.
5058 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5059 * destination is specified.
5060 * @param node [i] The MARQUEE tag node is specified.
5061 * @return The conversion result is returned.
5064 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5066 xhtml_t *xhtml = GET_XHTML(pdoc);
5067 Doc *doc = xhtml->doc;
5069 if (IS_CSS_ON(xhtml->entryp)) {
5070 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5077 * It is handler who processes the New Line Code.
5080 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5082 xhtml_t *xhtml = GET_XHTML(pdoc);
5083 Doc *doc = xhtml->doc;
5084 if (xhtml->start_html_flag) {
5092 * It is a handler who processes the LINK tag.
5094 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5095 * destination is specified.
5096 * @param node [i] The LINK tag node is specified.
5097 * @return The conversion result is returned.
5100 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5109 xhtml = GET_XHTML(pdoc);
5112 if (! IS_CSS_ON(xhtml->entryp)) {
5116 for (attr = qs_get_attr(doc,node);
5118 attr = qs_get_next_attr(doc,attr)) {
5119 char *name = qs_get_attr_name(doc,attr);
5120 char *value = qs_get_attr_value(doc,attr);
5121 if (STRCASEEQ('r','R',"rel", name)) {
5122 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5126 else if (STRCASEEQ('h','H',"href", name)) {
5127 if (value && *value) {
5131 else if (STRCASEEQ('t','T',"type", name)) {
5132 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5138 if (rel && href && type) {
5139 DBG(doc->r, "start load CSS. url:[%s]", href);
5140 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
5141 DBG(doc->r, "end load CSS. url:[%s]", href);
5147 static css_prop_list_t *
5148 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5150 xhtml_t *xhtml = GET_XHTML(pdoc);
5151 Doc *doc = xhtml->doc;
5152 css_prop_list_t *last_css = NULL;
5153 if (IS_CSS_ON(xhtml->entryp)) {
5154 css_prop_list_t *dup_css;
5155 css_selector_t *selector;
5157 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5158 dup_css = chxj_dup_css_prop_list(doc, last_css);
5159 selector = chxj_css_find_selector(doc, xhtml->style, node);
5161 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5163 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
5164 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5166 if (style_attr_value) {
5167 css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
5169 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5177 static css_prop_list_t *
5178 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5180 xhtml_t *xhtml = GET_XHTML(pdoc);
5181 Doc *doc = xhtml->doc;
5182 css_prop_list_t *last_css = NULL;
5183 if (IS_CSS_ON(xhtml->entryp)) {
5184 css_prop_list_t *dup_css;
5185 css_selector_t *selector;
5187 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5188 dup_css = chxj_dup_css_prop_list(doc, last_css);
5189 selector = chxj_css_find_selector(doc, xhtml->style, node);
5191 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5195 if (style_attr_value) {
5196 css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
5198 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5207 * It is a handler who processes the SPAN tag.
5209 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5210 * destination is specified.
5211 * @param node [i] The SPAN tag node is specified.
5212 * @return The conversion result is returned.
5215 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
5220 char *attr_style = NULL;
5221 char *attr_color = NULL;
5222 char *attr_size = NULL;
5223 char *attr_align = NULL;
5224 char *attr_blink = NULL;
5225 char *attr_marquee = NULL;
5226 char *attr_marquee_dir = NULL;
5227 char *attr_marquee_style = NULL;
5228 char *attr_marquee_loop = NULL;
5230 xhtml = GET_XHTML(pdoc);
5233 for (attr = qs_get_attr(doc,node);
5235 attr = qs_get_next_attr(doc,attr)) {
5236 char *nm = qs_get_attr_name(doc,attr);
5237 char *val = qs_get_attr_value(doc,attr);
5238 if (val && STRCASEEQ('s','S',"style", nm)) {
5242 if (IS_CSS_ON(xhtml->entryp)) {
5243 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5245 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5246 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5247 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5248 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5249 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5250 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5251 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5252 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5253 css_property_t *cur;
5254 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5255 attr_color = apr_pstrdup(doc->pool, cur->value);
5257 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5258 if (cur->value && *cur->value) {
5259 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5260 || STRCASEEQ('x','X',"x-small", cur->value)
5261 || STRCASEEQ('s','S',"small", cur->value)
5262 || STRCASEEQ('m','M',"medium", cur->value)
5263 || STRCASEEQ('l','L',"large", cur->value)
5264 || STRCASEEQ('x','X',"x-large", cur->value)
5265 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5266 attr_size = apr_pstrdup(doc->pool, cur->value);
5270 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5271 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5272 attr_blink = apr_pstrdup(doc->pool, cur->value);
5275 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5276 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5277 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5280 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5281 if (cur->value && *cur->value) {
5282 if ( STRCASEEQ('l','L',"ltr",cur->value)
5283 || STRCASEEQ('r','R',"rtl",cur->value)) {
5284 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5288 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5289 if (cur->value && *cur->value) {
5290 if ( STRCASEEQ('s','S',"scroll",cur->value)
5291 || STRCASEEQ('s','S',"slide",cur->value)
5292 || STRCASEEQ('a','A',"alternate",cur->value)) {
5293 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5297 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5298 if (cur->value && *cur->value) {
5299 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5302 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5303 if (STRCASEEQ('l','L',"left", cur->value)) {
5304 attr_align = apr_pstrdup(doc->pool, "left");
5306 else if (STRCASEEQ('c','C',"center",cur->value)) {
5307 attr_align = apr_pstrdup(doc->pool, "center");
5309 else if (STRCASEEQ('r','R',"right",cur->value)) {
5310 attr_align = apr_pstrdup(doc->pool, "right");
5317 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5320 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5336 W_L("text-decoration:");
5341 W_L("display:-wap-marquee;");
5342 if (attr_marquee_dir) {
5343 W_L("-wap-marquee-dir:");
5344 W_V(attr_marquee_dir);
5347 if (attr_marquee_style) {
5348 W_L("-wap-marquee-style:");
5349 W_V(attr_marquee_style);
5352 if (attr_marquee_loop) {
5353 W_L("-wap-marquee-loop:");
5354 W_V(attr_marquee_loop);
5366 * It is a handler who processes the SPAN tag.
5368 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5369 * destination is specified.
5370 * @param node [i] The SPAN tag node is specified.
5371 * @return The conversion result is returned.
5374 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
5376 xhtml_t *xhtml = GET_XHTML(pdoc);
5377 Doc *doc = xhtml->doc;
5380 if (IS_CSS_ON(xhtml->entryp)) {
5381 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5388 * It is a handler who processes the STYLE tag.
5390 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5391 * destination is specified.
5392 * @param node [i] The STYLE tag node is specified.
5393 * @return The conversion result is returned.
5396 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
5403 xhtml = GET_XHTML(pdoc);
5406 if (! IS_CSS_ON(xhtml->entryp)) {
5410 for (attr = qs_get_attr(doc,node);
5412 attr = qs_get_next_attr(doc,attr)) {
5413 char *name = qs_get_attr_name(doc,attr);
5414 char *value = qs_get_attr_value(doc,attr);
5415 if (STRCASEEQ('t','T',"type", name)) {
5416 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5422 Node *child = qs_get_child_node(doc, node);
5423 if (type && child) {
5424 char *name = qs_get_node_name(doc, child);
5425 if (STRCASEEQ('t','T',"text", name)) {
5426 char *value = qs_get_node_value(doc, child);
5427 DBG(doc->r, "start load CSS. buf:[%s]", value);
5428 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
5429 DBG(doc->r, "end load CSS. value:[%s]", value);