2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
28 #define GET_XHTML(X) ((xhtml_t*)(X))
31 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
35 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
37 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
38 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_start_blockquote_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_start_plaintext_tag (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_end_plaintext_tag (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_start_blink_tag (void *pdoc, Node *node);
116 static char *s_xhtml_1_0_end_blink_tag (void *pdoc, Node *node);
117 static char *s_xhtml_1_0_start_marquee_tag (void *pdoc, Node *node);
118 static char *s_xhtml_1_0_end_marquee_tag (void *pdoc, Node *node);
119 static char *s_xhtml_1_0_newline_mark (void *pdoc, Node *node);
120 static char *s_xhtml_1_0_link_tag (void *pdoc, Node *node);
121 static char *s_xhtml_1_0_start_span_tag (void *pdoc, Node *node);
122 static char *s_xhtml_1_0_end_span_tag (void *pdoc, Node *node);
123 static char *s_xhtml_1_0_style_tag (void *pdoc, Node *node);
125 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
126 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
127 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
128 static css_prop_list_t *s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
129 static css_prop_list_t *s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
133 tag_handler xhtml_handler[] = {
136 s_xhtml_1_0_start_html_tag,
137 s_xhtml_1_0_end_html_tag,
141 s_xhtml_1_0_start_meta_tag,
142 s_xhtml_1_0_end_meta_tag,
146 s_xhtml_1_0_start_textarea_tag,
147 s_xhtml_1_0_end_textarea_tag,
151 s_xhtml_1_0_start_p_tag,
152 s_xhtml_1_0_end_p_tag,
156 s_xhtml_1_0_start_pre_tag,
157 s_xhtml_1_0_end_pre_tag,
161 s_xhtml_1_0_start_ul_tag,
162 s_xhtml_1_0_end_ul_tag,
166 s_xhtml_1_0_start_li_tag,
167 s_xhtml_1_0_end_li_tag,
171 s_xhtml_1_0_start_ol_tag,
172 s_xhtml_1_0_end_ol_tag,
176 s_xhtml_1_0_start_h1_tag,
177 s_xhtml_1_0_end_h1_tag,
181 s_xhtml_1_0_start_h2_tag,
182 s_xhtml_1_0_end_h2_tag,
186 s_xhtml_1_0_start_h3_tag,
187 s_xhtml_1_0_end_h3_tag,
191 s_xhtml_1_0_start_h4_tag,
192 s_xhtml_1_0_end_h4_tag,
196 s_xhtml_1_0_start_h5_tag,
197 s_xhtml_1_0_end_h5_tag,
201 s_xhtml_1_0_start_h6_tag,
202 s_xhtml_1_0_end_h6_tag,
206 s_xhtml_1_0_start_head_tag,
207 s_xhtml_1_0_end_head_tag,
211 s_xhtml_1_0_start_title_tag,
212 s_xhtml_1_0_end_title_tag,
216 s_xhtml_1_0_start_base_tag,
217 s_xhtml_1_0_end_base_tag,
221 s_xhtml_1_0_start_body_tag,
222 s_xhtml_1_0_end_body_tag,
226 s_xhtml_1_0_start_a_tag,
227 s_xhtml_1_0_end_a_tag,
231 s_xhtml_1_0_start_br_tag,
232 s_xhtml_1_0_end_br_tag,
241 s_xhtml_1_0_start_tr_tag,
242 s_xhtml_1_0_end_tr_tag,
256 s_xhtml_1_0_start_font_tag,
257 s_xhtml_1_0_end_font_tag,
261 s_xhtml_1_0_start_form_tag,
262 s_xhtml_1_0_end_form_tag,
266 s_xhtml_1_0_start_input_tag,
267 s_xhtml_1_0_end_input_tag,
271 s_xhtml_1_0_start_center_tag,
272 s_xhtml_1_0_end_center_tag,
276 s_xhtml_1_0_start_hr_tag,
277 s_xhtml_1_0_end_hr_tag,
281 s_xhtml_1_0_start_img_tag,
282 s_xhtml_1_0_end_img_tag,
286 s_xhtml_1_0_start_select_tag,
287 s_xhtml_1_0_end_select_tag,
291 s_xhtml_1_0_start_option_tag,
292 s_xhtml_1_0_end_option_tag,
296 s_xhtml_1_0_start_div_tag,
297 s_xhtml_1_0_end_div_tag,
301 s_xhtml_1_0_chxjif_tag,
316 s_xhtml_1_0_style_tag,
321 s_xhtml_1_0_start_span_tag,
322 s_xhtml_1_0_end_span_tag,
326 s_xhtml_1_0_text_tag,
336 s_xhtml_1_0_start_b_tag,
337 s_xhtml_1_0_end_b_tag,
346 s_xhtml_1_0_start_dt_tag,
347 s_xhtml_1_0_end_dt_tag,
361 s_xhtml_1_0_start_blockquote_tag,
362 s_xhtml_1_0_end_blockquote_tag,
366 s_xhtml_1_0_start_dir_tag,
367 s_xhtml_1_0_end_dir_tag,
371 s_xhtml_1_0_start_dl_tag,
372 s_xhtml_1_0_end_dl_tag,
376 s_xhtml_1_0_start_dd_tag,
377 s_xhtml_1_0_end_dd_tag,
381 s_xhtml_1_0_start_menu_tag,
382 s_xhtml_1_0_end_menu_tag,
386 s_xhtml_1_0_start_plaintext_tag,
387 s_xhtml_1_0_end_plaintext_tag,
391 s_xhtml_1_0_start_blink_tag,
392 s_xhtml_1_0_end_blink_tag,
396 s_xhtml_1_0_start_marquee_tag,
397 s_xhtml_1_0_end_marquee_tag,
401 s_xhtml_1_0_link_tag,
406 s_xhtml_1_0_newline_mark,
412 * converts from CHTML to XHTML.
414 * @param r [i] Requet_rec is appointed.
415 * @param spec [i] The result of the device specification processing which
416 * was done in advance is appointed.
417 * @param src [i] The character string before the converting is appointed.
418 * @return The character string after the converting is returned.
421 chxj_convert_xhtml_mobile_1_0(
427 chxjconvrule_entry *entryp,
436 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
437 /*--------------------------------------------------------------------------*/
439 /*--------------------------------------------------------------------------*/
441 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
443 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
447 /*--------------------------------------------------------------------------*/
448 /* The XHTML structure is initialized. */
449 /*--------------------------------------------------------------------------*/
450 s_init_xhtml(&xhtml, &doc, r, spec);
452 xhtml.entryp = entryp;
453 xhtml.cookie = cookie;
455 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
457 /*--------------------------------------------------------------------------*/
458 /* The character string of the input is analyzed. */
459 /*--------------------------------------------------------------------------*/
460 qs_init_malloc(&doc);
461 qs_init_root_node(&doc);
463 ss = apr_pcalloc(r->pool, srclen + 1);
464 memset(ss, 0, srclen + 1);
465 memcpy(ss, src, srclen);
467 if (IS_CSS_ON(xhtml.entryp)) {
468 /* current property list */
469 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
472 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
474 qs_parse_string(&doc,ss, strlen(ss));
476 chxj_buffered_write_init(r->pool, &doc.buf);
477 /*--------------------------------------------------------------------------*/
478 /* It converts it from CHTML to XHTML. */
479 /*--------------------------------------------------------------------------*/
480 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
481 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
482 dst = apr_pstrdup(r->pool, xhtml.out);
483 chxj_buffered_write_terminate(&doc.buf);
485 qs_all_free(&doc,QX_LOGMARK);
488 return apr_pstrdup(r->pool,ss);
492 dst = apr_psprintf(r->pool, "\n");
494 *dstlen = strlen(dst);
497 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
500 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
506 * The XHTML structure is initialized.
508 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
509 * initialized is specified.
510 * @param doc [i] The Doc structure that should be set to the initialized
511 * HDML structure is specified.
512 * @param r [i] To use POOL, the pointer to request_rec is specified.
513 * @param spec [i] The pointer to the device_table
516 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
518 memset(doc, 0, sizeof(Doc));
519 memset(xhtml, 0, sizeof(xhtml_t));
524 xhtml->out = qs_alloc_zero_byte_string(r->pool);
525 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
526 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
531 * Corresponding EMOJI to a current character-code is retrieved.
532 * The substitution character string is stored in the rslt pointer if agreeing.
534 * @param xhtml [i] The pointer to the XHTML structure is specified.
535 * @param txt [i] The character string to want to examine whether it is
536 * EMOJI is specified.
537 * @param rslt [o] The pointer to the pointer that stores the result is
539 * @return When corresponding EMOJI exists, it returns it excluding 0.
542 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
555 DBG(r,"spec is NULL");
558 for (ee = xhtml->conf->emoji;
561 unsigned char hex1byte;
562 unsigned char hex2byte;
564 DBG(r,"emoji->imode is NULL");
568 if (ee->imode->string != NULL
569 && strlen(ee->imode->string) > 0
570 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
571 if (spec == NULL || spec->emoji_type == NULL) {
572 *rslt = apr_psprintf(r->pool,
575 return strlen(ee->imode->string);
578 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
579 *rslt = apr_psprintf(r->pool,
582 return strlen(ee->imode->string);
585 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
586 *rslt = apr_psprintf(r->pool,
589 return strlen(ee->imode->string);
592 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
593 *rslt = apr_psprintf(r->pool,
596 return strlen(ee->imode->string);
599 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
600 *rslt = apr_psprintf(r->pool,
603 return strlen(ee->imode->string);
606 *rslt = apr_psprintf(r->pool,
609 return strlen(ee->imode->string);
613 hex1byte = ee->imode->hex1byte & 0xff;
614 hex2byte = ee->imode->hex2byte & 0xff;
616 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
617 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
618 if (spec == NULL || spec->emoji_type == NULL) {
619 *rslt = apr_psprintf(r->pool,
620 "<img localsrc=\"%s\">",
625 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
626 *rslt = apr_psprintf(r->pool,
627 "<img localsrc=\"%s\">",
632 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
633 *rslt = apr_psprintf(r->pool,
634 "<img localsrc=\"%s\">",
639 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
640 *rslt = apr_psprintf(r->pool,
641 "<img localsrc=\"%s\">",
646 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
647 *rslt = apr_psprintf(r->pool,
648 "<img localsrc=\"%s\">",
653 *rslt = apr_psprintf(r->pool,
654 "<img localsrc=\"%s\">",
666 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
680 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
681 memset(doc, 0, sizeof(Doc));
682 memset(xhtml, 0, sizeof(xhtml_t));
687 xhtml->out = qs_alloc_zero_byte_string(r->pool);
688 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
689 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
691 apr_pool_create(&pool, r->pool);
693 chxj_buffered_write_init(pool, &doc->buf);
695 for (ii=0; ii<len; ii++) {
699 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
706 if (is_sjis_kanji(src[ii])) {
707 two_byte[0] = src[ii+0];
708 two_byte[1] = src[ii+1];
714 one_byte[0] = src[ii+0];
719 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
721 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
727 * It is a handler who processes the HTML tag.
729 * @param pdoc [i/o] The pointer to the XHTML structure at the output
730 * destination is specified.
731 * @param node [i] The HTML tag node is specified.
732 * @return The conversion result is returned.
735 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
737 xhtml_t *xhtml = GET_XHTML(pdoc);
738 Doc *doc = xhtml->doc;
740 /*--------------------------------------------------------------------------*/
741 /* Add XML Declare */
742 /*--------------------------------------------------------------------------*/
743 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
745 /*--------------------------------------------------------------------------*/
747 /*--------------------------------------------------------------------------*/
748 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
750 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
752 /*--------------------------------------------------------------------------*/
754 /*--------------------------------------------------------------------------*/
755 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
757 xhtml->start_html_flag = 1;
763 * It is a handler who processes the HTML tag.
765 * @param pdoc [i/o] The pointer to the XHTML structure at the output
766 * destination is specified.
767 * @param node [i] The HTML tag node is specified.
768 * @return The conversion result is returned.
771 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
773 xhtml_t *xhtml = GET_XHTML(pdoc);
774 Doc *doc = xhtml->doc;
781 * It is a handler who processes the META tag.
783 * @param pdoc [i/o] The pointer to the XHTML structure at the output
784 * destination is specified.
785 * @param node [i] The META tag node is specified.
786 * @return The conversion result is returned.
789 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
791 xhtml_t *xhtml = GET_XHTML(pdoc);
793 Doc *doc = xhtml->doc;
794 int content_type_flag = 0;
795 request_rec *r = doc->r;
798 /*--------------------------------------------------------------------------*/
800 /*--------------------------------------------------------------------------*/
801 for (attr = qs_get_attr(doc,node);
803 attr = qs_get_next_attr(doc,attr)) {
804 char *name = qs_get_attr_name(doc,attr);
805 char *value = qs_get_attr_value(doc,attr);
806 if (STRCASEEQ('n','N',"name", name) && value && *value) {
813 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
819 if (STRCASEEQ('c','C', "content-type", value)) {
820 content_type_flag = 1;
823 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
824 if (content_type_flag) {
828 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
846 * It is a handler who processes the META tag.
848 * @param pdoc [i/o] The pointer to the XHTML structure at the output
849 * destination is specified.
850 * @param node [i] The META tag node is specified.
851 * @return The conversion result is returned.
854 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
856 xhtml_t *xhtml = GET_XHTML(pdoc);
863 * It is a handler who processes the HEAD tag.
865 * @param pdoc [i/o] The pointer to the XHTML structure at the output
866 * destination is specified.
867 * @param node [i] The HEAD tag node is specified.
868 * @return The conversion result is returned.
871 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
873 xhtml_t *xhtml = GET_XHTML(pdoc);
874 Doc *doc = xhtml->doc;
882 * It is a handler who processes the HEAD tag.
884 * @param pdoc [i/o] The pointer to the XHTML structure at the output
885 * destination is specified.
886 * @param node [i] The HEAD tag node is specified.
887 * @return The conversion result is returned.
890 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
892 xhtml_t *xhtml = GET_XHTML(pdoc);
893 Doc *doc = xhtml->doc;
901 * It is a handler who processes the TITLE tag.
903 * @param pdoc [i/o] The pointer to the XHTML structure at the output
904 * destination is specified.
905 * @param node [i] The TITLE tag node is specified.
906 * @return The conversion result is returned.
909 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
911 xhtml_t *xhtml = GET_XHTML(pdoc);
912 Doc *doc = xhtml->doc;
920 * It is a handler who processes the TITLE tag.
922 * @param pdoc [i/o] The pointer to the XHTML structure at the output
923 * destination is specified.
924 * @param node [i] The TITLE tag node is specified.
925 * @return The conversion result is returned.
928 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
930 xhtml_t *xhtml = GET_XHTML(pdoc);
931 Doc *doc = xhtml->doc;
940 * It is a handler who processes the BASE tag.
942 * @param pdoc [i/o] The pointer to the XHTML structure at the output
943 * destination is specified.
944 * @param node [i] The BASE tag node is specified.
945 * @return The conversion result is returned.
948 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
950 xhtml_t *xhtml = GET_XHTML(pdoc);
952 Doc *doc = xhtml->doc;
955 /*--------------------------------------------------------------------------*/
957 /*--------------------------------------------------------------------------*/
958 for (attr = qs_get_attr(doc,node);
960 attr = qs_get_next_attr(doc,attr)) {
961 char *name = qs_get_attr_name(doc,attr);
962 char *value = qs_get_attr_value(doc,attr);
963 if (STRCASEEQ('h','H',"href",name)) {
977 * It is a handler who processes the BASE tag.
979 * @param pdoc [i/o] The pointer to the XHTML structure at the output
980 * destination is specified.
981 * @param node [i] The BASE tag node is specified.
982 * @return The conversion result is returned.
985 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
987 xhtml_t *xhtml = GET_XHTML(pdoc);
994 * It is a handler who processes the BODY tag.
996 * @param pdoc [i/o] The pointer to the XHTML structure at the output
997 * destination is specified.
998 * @param node [i] The BODY tag node is specified.
999 * @return The conversion result is returned.
1002 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1004 xhtml_t *xhtml = GET_XHTML(pdoc);
1005 Doc *doc = xhtml->doc;
1007 char *attr_bgcolor = NULL;
1008 char *attr_text = NULL;
1009 char *attr_link = NULL;
1010 char *attr_style = NULL;
1012 /*--------------------------------------------------------------------------*/
1013 /* Get Attributes */
1014 /*--------------------------------------------------------------------------*/
1015 for (attr = qs_get_attr(doc,node);
1017 attr = qs_get_next_attr(doc,attr)) {
1018 char *name = qs_get_attr_name(doc,attr);
1019 char *value = qs_get_attr_value(doc,attr);
1020 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1021 attr_bgcolor = value;
1023 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1026 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1029 else if (STRCASEEQ('a','A',"alink", name)) {
1032 else if (STRCASEEQ('v','V',"vlink",name)) {
1035 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1040 if (IS_CSS_ON(xhtml->entryp)) {
1041 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1043 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1044 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1045 css_property_t *cur;
1046 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1047 if (cur->value && *cur->value) {
1048 attr_text = apr_pstrdup(doc->pool, cur->value);
1051 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1052 if (cur->value && *cur->value) {
1053 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1058 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1059 css_selector_t *cur_sel;
1060 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1061 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1062 css_property_t *cur;
1063 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1064 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1065 attr_link = apr_pstrdup(doc->pool, cur->value);
1074 if (attr_bgcolor || attr_text) {
1077 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1078 W_L("background-color:");
1083 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1091 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1103 * It is a handler who processes the BODY tag.
1105 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1106 * destination is specified.
1107 * @param node [i] The BODY tag node is specified.
1108 * @return The conversion result is returned.
1111 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1113 xhtml_t *xhtml = GET_XHTML(pdoc);
1114 Doc *doc = xhtml->doc;
1117 if (IS_CSS_ON(xhtml->entryp)) {
1118 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1126 * It is a handler who processes the A tag.
1128 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1129 * destination is specified.
1130 * @param node [i] The A tag node is specified.
1131 * @return The conversion result is returned.
1134 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1136 xhtml_t *xhtml = GET_XHTML(pdoc);
1137 Doc *doc = xhtml->doc;
1138 request_rec *r = doc->r;
1140 char *attr_style = NULL;
1143 /*--------------------------------------------------------------------------*/
1144 /* Get Attributes */
1145 /*--------------------------------------------------------------------------*/
1146 for (attr = qs_get_attr(doc,node);
1148 attr = qs_get_next_attr(doc,attr)) {
1149 char* name = qs_get_attr_name(doc,attr);
1150 char* value = qs_get_attr_value(doc,attr);
1151 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1156 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1157 value = chxj_encoding_parameter(r, value, 1);
1158 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1159 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1165 else if (STRCASEEQ('a','A',"accesskey", name)) {
1166 W_L(" accesskey=\"");
1170 else if (STRCASEEQ('c','C',"cti",name)) {
1173 else if (STRCASEEQ('i','I',"ijam", name)) {
1176 else if (STRCASEEQ('u','U',"utn", name)) {
1179 else if (STRCASEEQ('t','T',"telbook",name)) {
1182 else if (STRCASEEQ('k','K',"kana",name)) {
1185 else if (STRCASEEQ('e','E',"email",name)) {
1188 else if (STRCASEEQ('i','I',"ista",name)) {
1191 else if (STRCASEEQ('i','I',"ilet",name)) {
1194 else if (STRCASEEQ('i','I',"iswf",name)) {
1197 else if (STRCASEEQ('i','I',"irst",name)) {
1200 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1206 if (IS_CSS_ON(xhtml->entryp)) {
1207 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1215 * It is a handler who processes the A tag.
1217 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1218 * destination is specified.
1219 * @param node [i] The A tag node is specified.
1220 * @return The conversion result is returned.
1223 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1225 xhtml_t *xhtml = GET_XHTML(pdoc);
1226 Doc *doc = xhtml->doc;
1230 if (IS_CSS_ON(xhtml->entryp)) {
1231 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1239 * It is a handler who processes the BR tag.
1241 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1242 * destination is specified.
1243 * @param node [i] The BR tag node is specified.
1244 * @return The conversion result is returned.
1247 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1249 xhtml_t *xhtml = GET_XHTML(pdoc);
1250 Doc *doc = xhtml->doc;
1254 /*--------------------------------------------------------------------------*/
1255 /* Get Attributes */
1256 /*--------------------------------------------------------------------------*/
1257 for (attr = qs_get_attr(doc,node);
1259 attr = qs_get_next_attr(doc,attr)) {
1260 char *name = qs_get_attr_name(doc,attr);
1261 char *value = qs_get_attr_value(doc,attr);
1262 if (STRCASEEQ('c','C',"clear",name)) {
1263 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1277 * It is a handler who processes the BR tag.
1279 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1280 * destination is specified.
1281 * @param node [i] The BR tag node is specified.
1282 * @return The conversion result is returned.
1285 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1287 xhtml_t *xhtml = GET_XHTML(pdoc);
1294 * It is a handler who processes the TR tag.
1296 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1297 * destination is specified.
1298 * @param node [i] The TR tag node is specified.
1299 * @return The conversion result is returned.
1302 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1304 xhtml_t *xhtml = GET_XHTML(pdoc);
1305 Doc *doc = xhtml->doc;
1314 * It is a handler who processes the TR tag.
1316 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1317 * destination is specified.
1318 * @param node [i] The TR tag node is specified.
1319 * @return The conversion result is returned.
1322 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1324 xhtml_t *xhtml = GET_XHTML(pdoc);
1331 * It is a handler who processes the FONT tag.
1333 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1334 * destination is specified.
1335 * @param node [i] The FONT tag node is specified.
1336 * @return The conversion result is returned.
1339 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1341 xhtml_t *xhtml = GET_XHTML(pdoc);
1342 Doc *doc = xhtml->doc;
1344 char *attr_color = NULL;
1345 char *attr_size = NULL;
1346 char *attr_style = NULL;
1348 /*--------------------------------------------------------------------------*/
1349 /* Get Attributes */
1350 /*--------------------------------------------------------------------------*/
1351 for (attr = qs_get_attr(doc,node);
1353 attr = qs_get_next_attr(doc,attr)) {
1354 char *name = qs_get_attr_name(doc,attr);
1355 char *value = qs_get_attr_value(doc,attr);
1356 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1357 attr_color = apr_pstrdup(doc->buf.pool, value);
1359 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1360 /*----------------------------------------------------------------------*/
1362 /*----------------------------------------------------------------------*/
1363 attr_size = apr_pstrdup(doc->buf.pool, value);
1365 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1366 attr_style = apr_pstrdup(doc->buf.pool, value);
1369 if (IS_CSS_ON(xhtml->entryp)) {
1370 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1372 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1373 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1374 css_property_t *cur;
1375 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1376 if (cur->value && *cur->value) {
1377 attr_color = apr_pstrdup(doc->pool, cur->value);
1380 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1381 if (cur->value && *cur->value) {
1382 attr_size = apr_pstrdup(doc->pool, cur->value);
1383 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1384 attr_size = apr_pstrdup(doc->pool, "1");
1386 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1387 attr_size = apr_pstrdup(doc->pool, "2");
1389 else if (STRCASEEQ('s','S',"small",attr_size)) {
1390 attr_size = apr_pstrdup(doc->pool, "3");
1392 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1393 attr_size = apr_pstrdup(doc->pool, "4");
1395 else if (STRCASEEQ('l','L',"large",attr_size)) {
1396 attr_size = apr_pstrdup(doc->pool, "5");
1398 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1399 attr_size = apr_pstrdup(doc->pool, "6");
1401 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1402 attr_size = apr_pstrdup(doc->pool, "7");
1409 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1410 memset(flg, 0, sizeof(*flg));
1412 W_L("<font color=\"");
1415 flg->font_color_flag = 1;
1418 flg->font_size_flag = 1;
1419 switch(*attr_size) {
1420 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1421 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1422 case '3': W_L("<span style=\"font-size: small\">"); break;
1423 case '4': W_L("<span style=\"font-size: medium\">"); break;
1424 case '5': W_L("<span style=\"font-size: large\">"); break;
1425 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1426 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1428 if (*(attr_size + 1) == '1') {
1429 W_L("<span style=\"font-size: small\">");
1432 if (*(attr_size + 1) == '2') {
1433 W_L("<span style=\"font-size: x-small\">");
1436 if (*(attr_size + 1) == '3') {
1437 W_L("<span style=\"font-size: xx-small\">");
1440 flg->font_size_flag = 0;
1444 if (*(attr_size + 1) == '1') {
1445 W_L("<span style=\"font-size: large\">");
1448 if (*(attr_size + 1) == '2') {
1449 W_L("<span style=\"font-size: x-large\">");
1452 if (*(attr_size + 1) == '3') {
1453 W_L("<span style=\"font-size: xx-large\">");
1456 flg->font_size_flag = 0;
1460 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1461 flg->font_size_flag = 0;
1464 node->userData = flg;
1471 * It is a handler who processes the FONT tag.
1473 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1474 * destination is specified.
1475 * @param node [i] The FONT tag node is specified.
1476 * @return The conversion result is returned.
1479 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
1481 xhtml_t *xhtml = GET_XHTML(pdoc);
1482 Doc *doc = xhtml->doc;
1484 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1485 if (flg && flg->font_size_flag) {
1488 if (flg && flg->font_color_flag) {
1491 if (IS_CSS_ON(xhtml->entryp)) {
1492 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1499 * It is a handler who processes the FORM tag.
1501 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1502 * destination is specified.
1503 * @param node [i] The FORM tag node is specified.
1504 * @return The conversion result is returned.
1507 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1509 xhtml_t *xhtml = GET_XHTML(pdoc);
1510 Doc *doc = xhtml->doc;
1511 request_rec *r = doc->r;
1513 char *attr_action = NULL;
1514 char *attr_method = NULL;
1515 char *attr_style = NULL;
1516 char *attr_color = NULL;
1517 char *attr_align = NULL;
1518 char *attr_name = NULL;
1519 char *new_hidden_tag = NULL;
1521 /*--------------------------------------------------------------------------*/
1522 /* Get Attributes */
1523 /*--------------------------------------------------------------------------*/
1524 for (attr = qs_get_attr(doc,node);
1526 attr = qs_get_next_attr(doc,attr)) {
1527 char *name = qs_get_attr_name(doc,attr);
1528 char *value = qs_get_attr_value(doc,attr);
1532 if (strcasecmp(name, "action") == 0) {
1533 /*--------------------------------------------------------------------*/
1535 /*--------------------------------------------------------------------*/
1536 attr_action = value;
1542 if (strcasecmp(name, "method") == 0) {
1543 /*--------------------------------------------------------------------*/
1545 /*--------------------------------------------------------------------*/
1546 attr_method = value;
1552 if (strcasecmp(name, "name") == 0) {
1553 /*--------------------------------------------------------------------*/
1555 /*--------------------------------------------------------------------*/
1562 if (strcasecmp(name, "style") == 0) {
1571 if (IS_CSS_ON(xhtml->entryp)) {
1572 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1574 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1575 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1576 css_property_t *cur;
1577 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1578 if (STRCASEEQ('l','L',"left", cur->value)) {
1579 attr_align = apr_pstrdup(doc->pool, "left");
1581 else if (STRCASEEQ('c','C',"center",cur->value)) {
1582 attr_align = apr_pstrdup(doc->pool, "center");
1584 else if (STRCASEEQ('r','R',"right",cur->value)) {
1585 attr_align = apr_pstrdup(doc->pool, "right");
1588 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1589 attr_color = apr_pstrdup(doc->pool, cur->value);
1594 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1598 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1599 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1601 char *old_qs = NULL;
1602 q = strchr(attr_action, '?');
1604 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);
1605 if (new_hidden_tag || old_qs) {
1629 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
1630 memset(flg, 0, sizeof(*flg));
1632 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1633 W_L("<font color=\"");
1636 flg->with_font_flag = 1;
1639 W_L("<div align=\"");
1642 flg->with_div_flag = 1;
1644 node->userData = flg;
1645 if (new_hidden_tag) {
1646 W_V(new_hidden_tag);
1653 * It is a handler who processes the FORM tag.
1655 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1656 * destination is specified.
1657 * @param node [i] The FORM tag node is specified.
1658 * @return The conversion result is returned.
1661 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
1663 xhtml_t *xhtml = GET_XHTML(pdoc);
1664 Doc *doc = xhtml->doc;
1666 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1667 if (flg && flg->with_div_flag) {
1670 if (flg && flg->with_font_flag) {
1674 if (IS_CSS_ON(xhtml->entryp)) {
1675 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1683 * It is a handler who processes the INPUT tag.
1685 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1686 * destination is specified.
1687 * @param node [i] The INPUT tag node is specified.
1688 * @return The conversion result is returned.
1691 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1693 xhtml_t *xhtml = GET_XHTML(pdoc);
1694 Doc *doc = xhtml->doc;
1695 request_rec *r = doc->r;
1697 char *attr_max_length = NULL;
1698 char *attr_type = NULL;
1699 char *attr_name = NULL;
1700 char *attr_value = NULL;
1701 char *attr_istyle = NULL;
1702 char *attr_size = NULL;
1703 char *attr_checked = NULL;
1704 char *attr_accesskey = NULL;
1705 char *attr_style = NULL;
1707 /*--------------------------------------------------------------------------*/
1708 /* Get Attributes */
1709 /*--------------------------------------------------------------------------*/
1710 for (attr = qs_get_attr(doc,node);
1712 attr = qs_get_next_attr(doc,attr)) {
1713 char *name = qs_get_attr_name(doc,attr);
1714 char *value = qs_get_attr_value(doc,attr);
1715 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1716 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1717 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1718 STRCASEEQ('p','P',"password",tmp_type) ||
1719 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1720 STRCASEEQ('r','R',"radio", tmp_type) ||
1721 STRCASEEQ('h','H',"hidden", tmp_type) ||
1722 STRCASEEQ('s','S',"submit", tmp_type) ||
1723 STRCASEEQ('r','R',"reset", tmp_type))) {
1724 attr_type = tmp_type;
1727 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1730 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1733 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1734 attr_istyle = value;
1736 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1737 attr_max_length = value;
1739 else if (STRCASEEQ('c','C',"checked", name)) {
1740 attr_checked = value;
1742 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1743 attr_accesskey = value;
1745 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1748 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1753 if (IS_CSS_ON(xhtml->entryp)) {
1754 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1756 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1757 css_property_t *cur;
1758 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1759 if (strcasestr(cur->value, "<ja:n>")) {
1762 else if (strcasestr(cur->value, "<ja:en>")) {
1765 else if (strcasestr(cur->value, "<ja:hk>")) {
1768 else if (strcasestr(cur->value, "<ja:h>")) {
1776 attr_type = qs_trim_string(doc->buf.pool, attr_type);
1777 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
1778 STRCASEEQ('p','P',"password",attr_type) ||
1779 STRCASEEQ('c','C',"checkbox",attr_type) ||
1780 STRCASEEQ('r','R',"radio", attr_type) ||
1781 STRCASEEQ('h','H',"hidden", attr_type) ||
1782 STRCASEEQ('s','S',"submit", attr_type) ||
1783 STRCASEEQ('r','R',"reset", attr_type))) {
1789 if (attr_size && *attr_size) {
1794 if (attr_name && *attr_name) {
1799 if (attr_value && *attr_value) {
1801 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1804 if (attr_accesskey && *attr_accesskey) {
1805 W_L(" accesskey=\"");
1806 W_V(attr_accesskey);
1809 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1810 char *fmt = qs_conv_istyle_to_format(r->pool,attr_istyle);
1811 if (attr_max_length && *attr_max_length) {
1813 for (ii=0; (unsigned int)ii<strlen(attr_max_length); ii++) {
1814 if (attr_max_length[ii] < '0' || attr_max_length[ii] > '9') {
1815 attr_max_length = apr_psprintf(r->pool, "0");
1820 if (strcmp(attr_max_length, "0")) {
1821 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(attr_max_length), fmt);
1833 if (attr_max_length && *attr_max_length) {
1834 if (chxj_chk_numeric(attr_max_length) != 0) {
1835 attr_max_length = apr_psprintf(r->pool, "0");
1837 if (strcmp(attr_max_length, "0")) {
1838 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(attr_max_length));
1843 /*--------------------------------------------------------------------------*/
1844 /* The figure is default for the password. */
1845 /*--------------------------------------------------------------------------*/
1846 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
1847 if (attr_max_length) {
1849 W_V(attr_max_length);
1853 W_L(" FORMAT=\"*N\"");
1857 W_L(" checked=\"checked\"");
1862 /*--------------------------------------------------------------------------*/
1863 /* Get Attributes */
1864 /*--------------------------------------------------------------------------*/
1865 type = qs_get_type_attr(doc, node, doc->buf.pool);
1866 name = qs_get_name_attr(doc, node, doc->buf.pool);
1867 value = qs_get_value_attr(doc,node, doc->buf.pool);
1868 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1869 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1870 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1871 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1872 size = qs_get_size_attr(doc, node, doc->buf.pool);
1875 type = qs_trim_string(doc->buf.pool, type);
1876 if (type && (STRCASEEQ('t','T',"text", type) ||
1877 STRCASEEQ('p','P',"password",type) ||
1878 STRCASEEQ('c','C',"checkbox",type) ||
1879 STRCASEEQ('r','R',"radio", type) ||
1880 STRCASEEQ('h','H',"hidden", type) ||
1881 STRCASEEQ('s','S',"submit", type) ||
1882 STRCASEEQ('r','R',"reset", type))) {
1888 if (size && *size) {
1893 if (name && *name) {
1898 if (value && *value) {
1900 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1903 if (accesskey && *accesskey) {
1904 W_L(" accesskey=\"");
1908 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1909 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
1910 if (max_length && *max_length) {
1912 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1913 if (max_length[ii] < '0' || max_length[ii] > '9') {
1914 max_length = apr_psprintf(r->pool, "0");
1919 if (strcmp(max_length, "0")) {
1920 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1932 if (max_length && *max_length) {
1933 if (chxj_chk_numeric(max_length) != 0) {
1934 max_length = apr_psprintf(r->pool, "0");
1936 if (strcmp(max_length, "0")) {
1937 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1942 /*--------------------------------------------------------------------------*/
1943 /* The figure is default for the password. */
1944 /*--------------------------------------------------------------------------*/
1945 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1952 W_L(" FORMAT=\"*N\"");
1956 W_L(" checked=\"checked\"");
1966 * It is a handler who processes the INPUT tag.
1968 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1969 * destination is specified.
1970 * @param node [i] The INPUT tag node is specified.
1971 * @return The conversion result is returned.
1974 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1976 xhtml_t *xhtml = GET_XHTML(pdoc);
1983 * It is a handler who processes the CENTER tag.
1985 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1986 * destination is specified.
1987 * @param node [i] The CENTER tag node is specified.
1988 * @return The conversion result is returned.
1991 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
1996 char *attr_style = NULL;
1997 char *attr_color = NULL;
1998 char *attr_size = NULL;
2000 xhtml = GET_XHTML(pdoc);
2003 for (attr = qs_get_attr(doc,node);
2005 attr = qs_get_next_attr(doc,attr)) {
2006 char *name = qs_get_attr_name(doc,attr);
2007 char *value = qs_get_attr_value(doc,attr);
2008 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2012 if (IS_CSS_ON(xhtml->entryp)) {
2013 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2015 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2016 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2017 css_property_t *cur;
2018 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2019 if (cur->value && *cur->value) {
2020 attr_color = apr_pstrdup(doc->pool, cur->value);
2023 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2024 if (cur->value && *cur->value) {
2025 attr_size = apr_pstrdup(doc->pool, cur->value);
2032 if (attr_size || attr_color) {
2040 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2054 * It is a handler who processes the CENTER tag.
2056 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2057 * destination is specified.
2058 * @param node [i] The CENTER tag node is specified.
2059 * @return The conversion result is returned.
2062 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2064 xhtml_t *xhtml = GET_XHTML(pdoc);
2065 Doc *doc = xhtml->doc;
2068 if (IS_CSS_ON(xhtml->entryp)) {
2069 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2076 * It is a handler who processes the HR tag.
2078 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2079 * destination is specified.
2080 * @param node [i] The HR tag node is specified.
2081 * @return The conversion result is returned.
2084 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2090 char *attr_align = NULL;
2091 char *attr_size = NULL;
2092 char *attr_width = NULL;
2093 char *attr_noshade = NULL;
2094 char *attr_style = NULL;
2095 char *attr_color = NULL;
2097 xhtml = GET_XHTML(pdoc);
2101 for (attr = qs_get_attr(doc,node);
2103 attr = qs_get_next_attr(doc,attr)) {
2104 char *name = qs_get_attr_name (doc,attr);
2105 char *value = qs_get_attr_value(doc,attr);
2109 if (strcasecmp(name, "align") == 0) {
2110 /*--------------------------------------------------------------------*/
2112 /*--------------------------------------------------------------------*/
2113 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2121 if (strcasecmp(name, "size") == 0) {
2122 /*--------------------------------------------------------------------*/
2124 /*--------------------------------------------------------------------*/
2125 if (value && *value) {
2129 else if (strcasecmp(name, "style") == 0) {
2130 if (value && *value) {
2138 if (strcasecmp(name, "width") == 0) {
2139 /*--------------------------------------------------------------------*/
2141 /*--------------------------------------------------------------------*/
2142 if (value && *value) {
2150 if (strcasecmp(name, "noshade") == 0) {
2151 /*--------------------------------------------------------------------*/
2153 /*--------------------------------------------------------------------*/
2154 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2160 if (strcasecmp(name, "color") == 0 && value && *value) {
2161 /*--------------------------------------------------------------------*/
2163 /*--------------------------------------------------------------------*/
2172 if (IS_CSS_ON(xhtml->entryp)) {
2173 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2175 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2176 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2177 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2178 css_property_t *cur;
2179 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2180 if (STRCASEEQ('s','S',"solid",cur->value)) {
2181 attr_noshade = "noshade";
2184 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2185 char *tmp = apr_pstrdup(doc->pool, cur->value);
2186 char *tmpp = strstr(tmp, "px");
2188 attr_size = apr_pstrdup(doc->pool, tmp);
2191 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2192 char *tmp = apr_pstrdup(doc->pool, cur->value);
2193 char *tmpp = strstr(tmp, "px");
2195 attr_width = apr_pstrdup(doc->pool, tmp);
2198 tmpp = strstr(tmp, "%");
2200 attr_width = apr_pstrdup(doc->pool, tmp);
2212 if (attr_size || attr_width || attr_noshade) {
2217 if (!strstr(attr_size, "px")) {
2225 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2231 W_L("border-style:solid;");
2247 * It is a handler who processes the HR tag.
2249 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2250 * destination is specified.
2251 * @param node [i] The HR tag node is specified.
2252 * @return The conversion result is returned.
2255 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2257 xhtml_t *xhtml = GET_XHTML(pdoc);
2264 * It is a handler who processes the PRE tag.
2266 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2267 * destination is specified.
2268 * @param node [i] The PRE tag node is specified.
2269 * @return The conversion result is returned.
2272 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2274 xhtml_t *xhtml = GET_XHTML(pdoc);
2275 Doc *doc = xhtml->doc;
2277 char *attr_style = NULL;
2279 for (attr = qs_get_attr(doc,node);
2281 attr = qs_get_next_attr(doc,attr)) {
2282 char *nm = qs_get_attr_name(doc,attr);
2283 char *val = qs_get_attr_value(doc,attr);
2284 if (val && STRCASEEQ('s','S',"style", nm)) {
2289 if (IS_CSS_ON(xhtml->entryp)) {
2290 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2300 * It is a handler who processes the PRE tag.
2302 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2303 * destination is specified.
2304 * @param node [i] The PRE tag node is specified.
2305 * @return The conversion result is returned.
2308 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2310 xhtml_t *xhtml = GET_XHTML(pdoc);
2311 Doc *doc = xhtml->doc;
2315 if (IS_CSS_ON(xhtml->entryp)) {
2316 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2324 * It is a handler who processes the P tag.
2326 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2327 * destination is specified.
2328 * @param node [i] The P tag node is specified.
2329 * @return The conversion result is returned.
2332 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2334 xhtml_t *xhtml = GET_XHTML(pdoc);
2335 Doc *doc = xhtml->doc;
2337 char *attr_align = NULL;
2338 char *attr_style = NULL;
2339 char *attr_color = NULL;
2340 char *attr_blink = NULL;
2342 for (attr = qs_get_attr(doc,node);
2344 attr = qs_get_next_attr(doc,attr)) {
2345 char *nm = qs_get_attr_name(doc,attr);
2346 char *val = qs_get_attr_value(doc,attr);
2347 if (STRCASEEQ('a','A',"align", nm)) {
2348 /*----------------------------------------------------------------------*/
2349 /* CHTML 1.0 (W3C version 3.2) */
2350 /*----------------------------------------------------------------------*/
2351 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2352 attr_align = apr_pstrdup(doc->buf.pool, val);
2356 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2357 attr_style = apr_pstrdup(doc->buf.pool, val);
2360 if (IS_CSS_ON(xhtml->entryp)) {
2361 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2363 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2364 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2365 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2366 css_property_t *cur;
2367 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2368 if (STRCASEEQ('l','L',"left",cur->value)) {
2369 attr_align = apr_pstrdup(doc->pool, "left");
2371 else if (STRCASEEQ('c','C',"center",cur->value)) {
2372 attr_align = apr_pstrdup(doc->pool, "center");
2374 else if (STRCASEEQ('r','R',"right",cur->value)) {
2375 attr_align = apr_pstrdup(doc->pool, "right");
2378 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2379 if (cur->value && *cur->value) {
2380 attr_color = apr_pstrdup(doc->pool, cur->value);
2383 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2384 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2385 attr_blink = apr_pstrdup(doc->pool, cur->value);
2391 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2399 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2405 W_L("text-decoration:");
2417 * It is a handler who processes the P tag.
2419 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2420 * destination is specified.
2421 * @param node [i] The P tag node is specified.
2422 * @return The conversion result is returned.
2425 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
2427 xhtml_t *xhtml = GET_XHTML(pdoc);
2428 Doc *doc = xhtml->doc;
2431 if (IS_CSS_ON(xhtml->entryp)) {
2432 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2439 * It is a handler who processes the UL tag.
2441 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2442 * destination is specified.
2443 * @param node [i] The UL tag node is specified.
2444 * @return The conversion result is returned.
2447 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
2449 xhtml_t *xhtml = GET_XHTML(pdoc);
2450 Doc *doc = xhtml->doc;
2452 char *attr_type = NULL;
2453 char *attr_style = NULL;
2454 /*--------------------------------------------------------------------------*/
2455 /* Get Attributes */
2456 /*--------------------------------------------------------------------------*/
2457 for (attr = qs_get_attr(doc,node);
2459 attr = qs_get_next_attr(doc,attr)) {
2460 char *name = qs_get_attr_name(doc,attr);
2461 char *value = qs_get_attr_value(doc,attr);
2462 if (STRCASEEQ('t','T',"type",name)) {
2463 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2467 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2471 if (IS_CSS_ON(xhtml->entryp)) {
2472 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2474 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2475 css_property_t *cur;
2476 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2477 if (STRCASEEQ('d','D',"disc",cur->value)) {
2478 attr_type = apr_pstrdup(doc->pool, "disc");
2480 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2481 attr_type = apr_pstrdup(doc->pool, "circle");
2483 else if (STRCASEEQ('s','S',"square",cur->value)) {
2484 attr_type = apr_pstrdup(doc->pool, "square");
2492 W_L("list-style-type:");
2503 * It is a handler who processes the UL tag.
2505 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2506 * destination is specified.
2507 * @param node [i] The UL tag node is specified.
2508 * @return The conversion result is returned.
2511 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
2513 xhtml_t *xhtml = GET_XHTML(pdoc);
2514 Doc *doc = xhtml->doc;
2517 if (IS_CSS_ON(xhtml->entryp)) {
2518 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2525 * It is a handler who processes the H1 tag.
2527 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2528 * destination is specified.
2529 * @param node [i] The H1 tag node is specified.
2530 * @return The conversion result is returned.
2533 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
2535 xhtml_t *xhtml = GET_XHTML(pdoc);
2536 Doc *doc = xhtml->doc;
2538 char *attr_style = NULL;
2539 char *attr_align = NULL;
2541 for (attr = qs_get_attr(doc,node);
2543 attr = qs_get_next_attr(doc,attr)) {
2544 char *name = qs_get_attr_name(doc,attr);
2545 char *value = qs_get_attr_value(doc,attr);
2546 if (STRCASEEQ('a','A',"align", name)) {
2547 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2551 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2555 if (IS_CSS_ON(xhtml->entryp)) {
2556 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2558 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2559 css_property_t *cur;
2560 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2561 if (STRCASEEQ('l','L',"left", cur->value)) {
2562 attr_align = apr_pstrdup(doc->pool, "left");
2564 else if (STRCASEEQ('c','C',"center",cur->value)) {
2565 attr_align = apr_pstrdup(doc->pool, "center");
2567 else if (STRCASEEQ('r','R',"right",cur->value)) {
2568 attr_align = apr_pstrdup(doc->pool, "right");
2588 * It is a handler who processes the H1 tag.
2590 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2591 * destination is specified.
2592 * @param node [i] The H1 tag node is specified.
2593 * @return The conversion result is returned.
2596 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
2598 xhtml_t *xhtml = GET_XHTML(pdoc);
2599 Doc *doc = xhtml->doc;
2602 if (IS_CSS_ON(xhtml->entryp)) {
2603 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2610 * It is a handler who processes the H2 tag.
2612 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2613 * destination is specified.
2614 * @param node [i] The H2 tag node is specified.
2615 * @return The conversion result is returned.
2618 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
2620 xhtml_t *xhtml = GET_XHTML(pdoc);
2621 Doc *doc = xhtml->doc;
2623 char *attr_style = NULL;
2624 char *attr_align = NULL;
2626 for (attr = qs_get_attr(doc,node);
2628 attr = qs_get_next_attr(doc,attr)) {
2629 char *name = qs_get_attr_name(doc,attr);
2630 char *value = qs_get_attr_value(doc,attr);
2631 if (STRCASEEQ('a','A',"align", name)) {
2632 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2636 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2640 if (IS_CSS_ON(xhtml->entryp)) {
2641 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2643 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2644 css_property_t *cur;
2645 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2646 if (STRCASEEQ('l','L',"left", cur->value)) {
2647 attr_align = apr_pstrdup(doc->pool, "left");
2649 else if (STRCASEEQ('c','C',"center",cur->value)) {
2650 attr_align = apr_pstrdup(doc->pool, "center");
2652 else if (STRCASEEQ('r','R',"right",cur->value)) {
2653 attr_align = apr_pstrdup(doc->pool, "right");
2673 * It is a handler who processes the H2 tag.
2675 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2676 * destination is specified.
2677 * @param node [i] The H2 tag node is specified.
2678 * @return The conversion result is returned.
2681 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2683 xhtml_t *xhtml = GET_XHTML(pdoc);
2684 Doc *doc = xhtml->doc;
2687 if (IS_CSS_ON(xhtml->entryp)) {
2688 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2695 * It is a handler who processes the H3 tag.
2697 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2698 * destination is specified.
2699 * @param node [i] The H3 tag node is specified.
2700 * @return The conversion result is returned.
2703 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2705 xhtml_t *xhtml = GET_XHTML(pdoc);
2706 Doc *doc = xhtml->doc;
2708 char *attr_style = NULL;
2709 char *attr_align = NULL;
2711 for (attr = qs_get_attr(doc,node);
2713 attr = qs_get_next_attr(doc,attr)) {
2714 char *name = qs_get_attr_name(doc,attr);
2715 char *value = qs_get_attr_value(doc,attr);
2716 if (STRCASEEQ('a','A',"align", name)) {
2717 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2721 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2725 if (IS_CSS_ON(xhtml->entryp)) {
2726 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2728 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2729 css_property_t *cur;
2730 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2731 if (STRCASEEQ('l','L',"left", cur->value)) {
2732 attr_align = apr_pstrdup(doc->pool, "left");
2734 else if (STRCASEEQ('c','C',"center",cur->value)) {
2735 attr_align = apr_pstrdup(doc->pool, "center");
2737 else if (STRCASEEQ('r','R',"right",cur->value)) {
2738 attr_align = apr_pstrdup(doc->pool, "right");
2758 * It is a handler who processes the H3 tag.
2760 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2761 * destination is specified.
2762 * @param node [i] The H3 tag node is specified.
2763 * @return The conversion result is returned.
2766 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2768 xhtml_t *xhtml = GET_XHTML(pdoc);
2769 Doc *doc = xhtml->doc;
2772 if (IS_CSS_ON(xhtml->entryp)) {
2773 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2781 * It is a handler who processes the H4 tag.
2783 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2784 * destination is specified.
2785 * @param node [i] The H4 tag node is specified.
2786 * @return The conversion result is returned.
2789 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2791 xhtml_t *xhtml = GET_XHTML(pdoc);
2792 Doc *doc = xhtml->doc;
2794 char *attr_style = NULL;
2795 char *attr_align = NULL;
2797 for (attr = qs_get_attr(doc,node);
2799 attr = qs_get_next_attr(doc,attr)) {
2800 char *name = qs_get_attr_name(doc,attr);
2801 char *value = qs_get_attr_value(doc,attr);
2802 if (STRCASEEQ('a','A',"align", name)) {
2803 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2807 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2811 if (IS_CSS_ON(xhtml->entryp)) {
2812 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2814 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2815 css_property_t *cur;
2816 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2817 if (STRCASEEQ('l','L',"left", cur->value)) {
2818 attr_align = apr_pstrdup(doc->pool, "left");
2820 else if (STRCASEEQ('c','C',"center",cur->value)) {
2821 attr_align = apr_pstrdup(doc->pool, "center");
2823 else if (STRCASEEQ('r','R',"right",cur->value)) {
2824 attr_align = apr_pstrdup(doc->pool, "right");
2844 * It is a handler who processes the H4 tag.
2846 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2847 * destination is specified.
2848 * @param node [i] The H4 tag node is specified.
2849 * @return The conversion result is returned.
2852 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
2854 xhtml_t *xhtml = GET_XHTML(pdoc);
2855 Doc *doc = xhtml->doc;
2858 if (IS_CSS_ON(xhtml->entryp)) {
2859 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2867 * It is a handler who processes the H5 tag.
2869 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2870 * destination is specified.
2871 * @param node [i] The H5 tag node is specified.
2872 * @return The conversion result is returned.
2875 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
2877 xhtml_t *xhtml = GET_XHTML(pdoc);
2878 Doc *doc = xhtml->doc;
2880 char *attr_style = NULL;
2881 char *attr_align = NULL;
2883 for (attr = qs_get_attr(doc,node);
2885 attr = qs_get_next_attr(doc,attr)) {
2886 char *name = qs_get_attr_name(doc,attr);
2887 char *value = qs_get_attr_value(doc,attr);
2888 if (STRCASEEQ('a','A',"align", name)) {
2889 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2893 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2897 if (IS_CSS_ON(xhtml->entryp)) {
2898 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2900 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2901 css_property_t *cur;
2902 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2903 if (STRCASEEQ('l','L',"left", cur->value)) {
2904 attr_align = apr_pstrdup(doc->pool, "left");
2906 else if (STRCASEEQ('c','C',"center",cur->value)) {
2907 attr_align = apr_pstrdup(doc->pool, "center");
2909 else if (STRCASEEQ('r','R',"right",cur->value)) {
2910 attr_align = apr_pstrdup(doc->pool, "right");
2930 * It is a handler who processes the H5 tag.
2932 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2933 * destination is specified.
2934 * @param node [i] The H5 tag node is specified.
2935 * @return The conversion result is returned.
2938 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2940 xhtml_t *xhtml = GET_XHTML(pdoc);
2941 Doc *doc = xhtml->doc;
2944 if (IS_CSS_ON(xhtml->entryp)) {
2945 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2953 * It is a handler who processes the H6 tag.
2955 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2956 * destination is specified.
2957 * @param node [i] The H6 tag node is specified.
2958 * @return The conversion result is returned.
2961 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2963 xhtml_t *xhtml = GET_XHTML(pdoc);
2964 Doc *doc = xhtml->doc;
2966 char *attr_style = NULL;
2967 char *attr_align = NULL;
2969 for (attr = qs_get_attr(doc,node);
2971 attr = qs_get_next_attr(doc,attr)) {
2972 char *name = qs_get_attr_name(doc,attr);
2973 char *value = qs_get_attr_value(doc,attr);
2974 if (STRCASEEQ('a','A',"align", name)) {
2975 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2979 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2983 if (IS_CSS_ON(xhtml->entryp)) {
2984 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2986 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2987 css_property_t *cur;
2988 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2989 if (STRCASEEQ('l','L',"left", cur->value)) {
2990 attr_align = apr_pstrdup(doc->pool, "left");
2992 else if (STRCASEEQ('c','C',"center",cur->value)) {
2993 attr_align = apr_pstrdup(doc->pool, "center");
2995 else if (STRCASEEQ('r','R',"right",cur->value)) {
2996 attr_align = apr_pstrdup(doc->pool, "right");
3016 * It is a handler who processes the H6 tag.
3018 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3019 * destination is specified.
3020 * @param node [i] The H6 tag node is specified.
3021 * @return The conversion result is returned.
3024 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3026 xhtml_t *xhtml = GET_XHTML(pdoc);
3027 Doc *doc = xhtml->doc;
3030 if (IS_CSS_ON(xhtml->entryp)) {
3031 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3039 * It is a handler who processes the OL tag.
3041 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3042 * destination is specified.
3043 * @param node [i] The OL tag node is specified.
3044 * @return The conversion result is returned.
3047 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3049 xhtml_t *xhtml = GET_XHTML(pdoc);
3050 Doc *doc = xhtml->doc;
3052 char *attr_style = NULL;
3053 char *attr_start = NULL;
3054 char *attr_type = NULL;
3056 /*--------------------------------------------------------------------------*/
3057 /* Get Attributes */
3058 /*--------------------------------------------------------------------------*/
3059 for (attr = qs_get_attr(doc,node);
3061 attr = qs_get_next_attr(doc,attr)) {
3062 char *name = qs_get_attr_name(doc,attr);
3063 char *value = qs_get_attr_value(doc,attr);
3064 if (STRCASEEQ('t','T',"type",name) && value) {
3065 if (*value == '1') {
3066 attr_type = apr_pstrdup(doc->pool, "decimal");
3068 else if (*value == 'a') {
3069 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3071 else if (*value == 'A') {
3072 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3075 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3078 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3082 if (IS_CSS_ON(xhtml->entryp)) {
3083 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3085 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3086 css_property_t *cur;
3087 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3088 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3089 attr_type = apr_pstrdup(doc->pool, "decimal");
3091 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3092 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3094 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3095 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3103 W_L("list-style-type:");
3120 * It is a handler who processes the OL tag.
3122 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3123 * destination is specified.
3124 * @param node [i] The OL tag node is specified.
3125 * @return The conversion result is returned.
3128 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3130 xhtml_t *xhtml = GET_XHTML(pdoc);
3131 Doc *doc = xhtml->doc;
3134 if (IS_CSS_ON(xhtml->entryp)) {
3135 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3143 * It is a handler who processes the LI tag.
3145 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3146 * destination is specified.
3147 * @param node [i] The LI tag node is specified.
3148 * @return The conversion result is returned.
3151 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3153 xhtml_t *xhtml = GET_XHTML(pdoc);
3154 Doc *doc = xhtml->doc;
3156 char *attr_type = NULL;
3157 char *attr_value = NULL;
3158 char *attr_style = NULL;
3160 for (attr = qs_get_attr(doc,node);
3162 attr = qs_get_next_attr(doc,attr)) {
3163 char *name = qs_get_attr_name(doc,attr);
3164 char *value = qs_get_attr_value(doc,attr);
3165 if (STRCASEEQ('t','T',"type",name)) {
3166 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3167 if (*value == '1') {
3168 attr_type = apr_pstrdup(doc->pool, "decimal");
3170 else if (*value == 'a') {
3171 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3173 else if (*value == 'A') {
3174 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3181 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3184 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3188 if (IS_CSS_ON(xhtml->entryp)) {
3189 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3191 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3192 css_property_t *cur;
3193 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3194 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3195 attr_type = apr_pstrdup(doc->pool, "decimal");
3197 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3198 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3200 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3201 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3203 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3204 attr_type = apr_pstrdup(doc->pool, "disc");
3206 else if (STRCASEEQ('s','S',"square", cur->value)) {
3207 attr_type = apr_pstrdup(doc->pool, "square");
3209 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3210 attr_type = apr_pstrdup(doc->pool, "circle");
3220 W_L("list-style-type:");
3236 ** It is a handler who processes the LI tag.
3238 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3239 * destination is specified.
3240 * @param node [i] The LI tag node is specified.
3241 * @return The conversion result is returned.
3244 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
3246 xhtml_t *xhtml = GET_XHTML(pdoc);
3247 Doc *doc = xhtml->doc;
3250 if (IS_CSS_ON(xhtml->entryp)) {
3251 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3257 * It is a handler who processes the IMG tag.
3259 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3260 * destination is specified.
3261 * @param node [i] The IMG tag node is specified.
3262 * @return The conversion result is returned.
3265 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
3267 xhtml_t *xhtml = GET_XHTML(pdoc);
3268 Doc *doc = xhtml->doc;
3269 request_rec *r = doc->r;
3271 char *attr_src = NULL;
3272 char *attr_alt = NULL;
3273 char *attr_height = NULL;
3274 char *attr_width = NULL;
3275 char *attr_align = NULL;
3276 char *attr_style = NULL;
3277 char *attr_hspace = NULL;
3278 char *attr_vspace = NULL;
3280 #ifndef IMG_NOT_CONVERT_FILENAME
3281 device_table *spec = xhtml->spec;
3284 /*--------------------------------------------------------------------------*/
3285 /* Get Attributes */
3286 /*--------------------------------------------------------------------------*/
3287 for (attr = qs_get_attr(doc,node);
3289 attr = qs_get_next_attr(doc,attr)) {
3290 char *name = qs_get_attr_name(doc,attr);
3291 char *value = qs_get_attr_value(doc,attr);
3293 if (STRCASEEQ('s','S',"src",name)) {
3294 value = chxj_encoding_parameter(r, value, 1);
3295 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
3296 value = chxj_add_cookie_no_update_parameter(r, value);
3297 #ifdef IMG_NOT_CONVERT_FILENAME
3303 attr_src = chxj_img_conv(r,spec,value);
3309 if (STRCASEEQ('a','A',"align",name)) {
3311 if (STRCASEEQ('t','T',"top", value) ||
3312 STRCASEEQ('m','M',"middle",value) ||
3313 STRCASEEQ('b','B',"bottom",value) ||
3314 STRCASEEQ('l','L',"left", value) ||
3315 STRCASEEQ('r','R',"right", value)) {
3318 else if (STRCASEEQ('c','C',"center", value)) {
3319 attr_align = apr_pstrdup(doc->pool, "middle");
3323 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3326 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3329 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3330 attr_height = value;
3332 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3333 attr_hspace = value;
3335 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3336 attr_vspace = value;
3338 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3343 if (IS_CSS_ON(xhtml->entryp)) {
3344 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3346 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3347 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3348 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3349 css_property_t *cur;
3350 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3351 attr_height = apr_pstrdup(doc->pool, cur->value);
3353 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3354 attr_width = apr_pstrdup(doc->pool, cur->value);
3356 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3357 attr_align = apr_pstrdup(doc->pool, cur->value);
3407 * It is a handler who processes the IMG tag.
3409 * @param xhtml [i/o] The pointer to the XHTML structure at the output
3410 * destination is specified.
3411 * @param node [i] The IMG tag node is specified.
3412 * @return The conversion result is returned.
3415 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
3417 xhtml_t *xhtml = GET_XHTML(pdoc);
3424 * It is a handler who processes the SELECT tag.
3426 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3427 * destination is specified.
3428 * @param node [i] The SELECT tag node is specified.
3429 * @return The conversion result is returned.
3432 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
3434 xhtml_t *xhtml = GET_XHTML(pdoc);
3435 Doc *doc = xhtml->doc;
3438 char *multiple = NULL;
3440 char *attr_style = NULL;
3443 for (attr = qs_get_attr(doc,node);
3445 attr = qs_get_next_attr(doc,attr)) {
3446 char *nm = qs_get_attr_name(doc,attr);
3447 char *val = qs_get_attr_value(doc,attr);
3448 if (STRCASEEQ('s','S',"size",nm)) {
3449 /*----------------------------------------------------------------------*/
3450 /* CHTML 1.0 version 2.0 */
3451 /*----------------------------------------------------------------------*/
3452 size = apr_pstrdup(doc->buf.pool, val);
3454 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3455 /*----------------------------------------------------------------------*/
3456 /* CHTML 1.0 version 2.0 */
3457 /*----------------------------------------------------------------------*/
3458 attr_style = apr_pstrdup(doc->buf.pool, val);
3460 else if (STRCASEEQ('n','N',"name",nm)) {
3461 /*----------------------------------------------------------------------*/
3462 /* CHTML 1.0 version 2.0 */
3463 /*----------------------------------------------------------------------*/
3464 name = apr_pstrdup(doc->buf.pool, val);
3466 else if (STRCASEEQ('m','M',"multiple",nm)) {
3467 /*----------------------------------------------------------------------*/
3468 /* CHTML 1.0 version 2.0 */
3469 /*----------------------------------------------------------------------*/
3470 multiple = apr_pstrdup(doc->buf.pool, val);
3473 if (size && *size) {
3478 if (name && *name) {
3484 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
3485 W_L(" multiple=\"true\"");
3488 if (IS_CSS_ON(xhtml->entryp)) {
3489 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3497 * It is a handler who processes the SELECT tag.
3499 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3500 * destination is specified.
3501 * @param node [i] The SELECT tag node is specified.
3502 * @return The conversion result is returned.
3505 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
3507 xhtml_t *xhtml = GET_XHTML(pdoc);
3508 Doc *doc = xhtml->doc;
3511 if (IS_CSS_ON(xhtml->entryp)) {
3512 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3519 * It is a handler who processes the OPTION tag.
3521 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3522 * destination is specified.
3523 * @param node [i] The OPTION tag node is specified.
3524 * @return The conversion result is returned.
3527 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
3529 xhtml_t *xhtml = GET_XHTML(pdoc);
3530 Doc *doc = xhtml->doc;
3532 char *attr_style = NULL;
3534 char *selected = NULL;
3538 for (attr = qs_get_attr(doc,node);
3540 attr = qs_get_next_attr(doc,attr)) {
3541 char *nm = qs_get_attr_name(doc,attr);
3542 char *val = qs_get_attr_value(doc,attr);
3543 if (STRCASEEQ('s','S',"selected",nm)) {
3544 /* CHTML version 2.0 */
3545 selected = apr_pstrdup(doc->buf.pool, val);
3547 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3548 /* CHTML version 2.0 */
3549 attr_style = apr_pstrdup(doc->buf.pool, val);
3551 else if (STRCASEEQ('v','V',"value",nm)) {
3552 /* CHTML version 2.0 */
3553 value = apr_pstrdup(doc->buf.pool, val);
3562 W_L(" selected=\"selected\"");
3565 if (IS_CSS_ON(xhtml->entryp)) {
3566 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3573 * It is a handler who processes the OPTION tag.
3575 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3576 * destination is specified.
3577 * @param node [i] The OPTION tag node is specified.
3578 * @return The conversion result is returned.
3581 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
3583 xhtml_t *xhtml = GET_XHTML(pdoc);
3584 Doc *doc = xhtml->doc;
3587 if (IS_CSS_ON(xhtml->entryp)) {
3588 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3596 * It is a handler who processes the DIV tag.
3598 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3599 * destination is specified.
3600 * @param node [i] The DIV tag node is specified.
3601 * @return The conversion result is returned.
3604 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
3606 xhtml_t *xhtml = GET_XHTML(pdoc);
3607 Doc *doc = xhtml->doc;
3609 char *attr_style = NULL;
3610 char *attr_align = NULL;
3611 char *attr_display = NULL;
3612 char *attr_decoration = NULL;
3613 char *attr_wap_marquee_style = NULL;
3614 char *attr_wap_marquee_dir = NULL;
3615 char *attr_wap_marquee_loop = NULL;
3616 char *attr_color = NULL;
3617 char *attr_bgcolor = NULL;
3618 char *attr_font_size = NULL;
3620 for (attr = qs_get_attr(doc,node);
3622 attr = qs_get_next_attr(doc,attr)) {
3623 char *nm = qs_get_attr_name(doc,attr);
3624 char *val = qs_get_attr_value(doc,attr);
3625 if (STRCASEEQ('a','A',"align",nm)) {
3626 /*----------------------------------------------------------------------*/
3627 /* CHTML 1.0 (W3C version 3.2) */
3628 /*----------------------------------------------------------------------*/
3629 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3630 attr_align = apr_pstrdup(doc->buf.pool, val);
3633 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3634 attr_style = apr_pstrdup(doc->buf.pool, val);
3638 if (IS_CSS_ON(xhtml->entryp)) {
3639 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3641 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3642 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3643 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3644 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3645 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3646 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3647 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3649 css_property_t *cur;
3650 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3651 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3652 attr_display = apr_pstrdup(doc->pool, cur->value);
3655 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3656 if (STRCASEEQ('b','B',"blink", cur->value)) {
3657 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3660 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3661 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3662 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3664 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3665 char *ss = strchr(cur->value, '#');
3667 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3668 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3671 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3672 attr_color = apr_pstrdup(doc->pool, cur->value);
3674 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3675 attr_align = apr_pstrdup(doc->pool, cur->value);
3677 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3678 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3679 || STRCASEEQ('x','X',"x-small",cur->value)
3680 || STRCASEEQ('s','S',"small",cur->value)
3681 || STRCASEEQ('m','M',"medium",cur->value)
3682 || STRCASEEQ('l','L',"large",cur->value)
3683 || STRCASEEQ('x','X',"x-large",cur->value)
3684 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3685 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3689 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3690 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3691 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3692 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3693 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3694 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3697 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3698 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3699 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3701 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3702 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3705 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3706 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3715 || attr_wap_marquee_style
3716 || attr_wap_marquee_dir
3717 || attr_wap_marquee_loop
3720 || attr_font_size) {
3732 if (attr_decoration) {
3733 W_L("text-decoration:");
3734 W_V(attr_decoration);
3737 if (attr_wap_marquee_style) {
3738 W_L("-wap-marquee-style:");
3739 W_V(attr_wap_marquee_style);
3742 if (attr_wap_marquee_dir) {
3743 W_L("-wap-marquee-dir:");
3744 W_V(attr_wap_marquee_dir);
3747 if (attr_wap_marquee_loop) {
3748 W_L("-wap-marquee-loop:");
3749 W_V(attr_wap_marquee_loop);
3758 W_L("background-color:");
3762 if (attr_font_size) {
3764 W_V(attr_font_size);
3775 * It is a handler who processes the DIV tag.
3777 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3778 * destination is specified.
3779 * @param node [i] The DIV tag node is specified.
3780 * @return The conversion result is returned.
3783 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
3785 xhtml_t *xhtml = GET_XHTML(pdoc);
3786 Doc *doc = xhtml->doc;
3788 if (IS_CSS_ON(xhtml->entryp)) {
3789 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3796 * It is a handler who processes the B tag.
3798 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3799 * destination is specified.
3800 * @param node [i] The B tag node is specified.
3801 * @return The conversion result is returned.
3804 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
3806 xhtml_t *xhtml = GET_XHTML(pdoc);
3807 Doc *doc = xhtml->doc;
3809 W_L("<div style=\"font-weight:bold\">");
3815 * It is a handler who processes the B tag.
3817 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3818 * destination is specified.
3819 * @param node [i] The B tag node is specified.
3820 * @return The conversion result is returned.
3823 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
3825 xhtml_t *xhtml = GET_XHTML(pdoc);
3826 Doc *doc = xhtml->doc;
3834 * It is a handler who processes the CHXJ:IF tag.
3836 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3837 * destination is specified.
3838 * @param node [i] The CHXJ:IF tag node is specified.
3841 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
3843 xhtml_t *xhtml = GET_XHTML(pdoc);
3844 Doc *doc = xhtml->doc;
3847 for (child = qs_get_child_node(doc, node);
3849 child = qs_get_next_node(doc, child)) {
3851 s_xhtml_1_0_chxjif_tag(xhtml, child);
3859 * It is a handler who processes the TEXTARE tag.
3861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3862 * destination is specified.
3863 * @param node [i] The TEXTAREA tag node is specified.
3864 * @return The conversion result is returned.
3867 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
3869 xhtml_t *xhtml = GET_XHTML(pdoc);
3870 Doc *doc = xhtml->doc;
3872 char *attr_accesskey = NULL;
3873 char *attr_name = NULL;
3874 char *attr_rows = NULL;
3875 char *attr_cols = NULL;
3876 char *attr_istyle = NULL;
3877 char *attr_style = NULL;
3879 xhtml->textarea_flag++;
3880 for (attr = qs_get_attr(doc,node);
3882 attr = qs_get_next_attr(doc,attr)) {
3883 char *name = qs_get_attr_name(doc,attr);
3884 char *value = qs_get_attr_value(doc,attr);
3885 if (STRCASEEQ('n','N',"name",name) && value && *value) {
3888 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
3891 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
3894 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3895 attr_istyle = value;
3897 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
3903 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3904 attr_accesskey = value;
3906 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
3910 if (IS_CSS_ON(xhtml->entryp)) {
3911 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3913 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3914 css_property_t *cur;
3915 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3916 if (strcasestr(cur->value, "<ja:n>")) {
3919 else if (strcasestr(cur->value, "<ja:en>")) {
3922 else if (strcasestr(cur->value, "<ja:hk>")) {
3925 else if (strcasestr(cur->value, "<ja:h>")) {
3932 if (attr_accesskey) {
3933 W_L(" accesskey=\"");
3934 W_V(attr_accesskey);
3953 char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
3964 * It is a handler who processes the TEXTAREA tag.
3966 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3967 * destination is specified.
3968 * @param node [i] The TEXTAREA tag node is specified.
3969 * @return The conversion result is returned.
3972 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3974 xhtml_t *xhtml = GET_XHTML(pdoc);
3975 Doc *doc = xhtml->doc;
3978 xhtml->textarea_flag--;
3984 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
3986 xhtml_t *xhtml = GET_XHTML(pdoc);
3987 Doc *doc = xhtml->doc;
3988 request_rec *r = doc->r;
3996 textval = qs_get_node_value(doc,child);
3997 if (strlen(textval) == 0) {
4001 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4002 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4004 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4005 memset(one_byte, 0, sizeof(one_byte));
4008 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4010 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4012 DBG(r,"[%s][%d]", out, rtn);
4013 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4017 if (is_sjis_kanji(textval[ii])) {
4018 one_byte[0] = textval[ii+0];
4019 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4020 one_byte[0] = textval[ii+1];
4021 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4024 else if (xhtml->pre_flag) {
4025 one_byte[0] = textval[ii+0];
4026 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4028 else if (xhtml->textarea_flag) {
4029 one_byte[0] = textval[ii+0];
4030 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4032 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4033 one_byte[0] = textval[ii+0];
4034 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4043 * It is a handler who processes the BLOCKQUOTE tag.
4045 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4046 * destination is specified.
4047 * @param node [i] The BLOCKQUOTE tag node is specified.
4048 * @return The conversion result is returned.
4051 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4056 char *attr_style = NULL;
4057 char *attr_color = NULL;
4058 char *attr_size = NULL;
4060 xhtml = GET_XHTML(pdoc);
4062 for (attr = qs_get_attr(doc,node);
4064 attr = qs_get_next_attr(doc,attr)) {
4065 char *nm = qs_get_attr_name(doc,attr);
4066 char *val = qs_get_attr_value(doc,attr);
4067 if (val && STRCASEEQ('s','S',"style", nm)) {
4071 if (IS_CSS_ON(xhtml->entryp)) {
4072 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4074 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4075 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4076 css_property_t *cur;
4077 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4078 if (cur->value && *cur->value) {
4079 attr_color = apr_pstrdup(doc->pool, cur->value);
4082 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4083 if (cur->value && *cur->value) {
4084 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4085 attr_size = apr_pstrdup(doc->pool, cur->value);
4087 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4088 attr_size = apr_pstrdup(doc->pool, cur->value);
4090 else if (STRCASEEQ('s','S',"small",cur->value)) {
4091 attr_size = apr_pstrdup(doc->pool, cur->value);
4093 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4094 attr_size = apr_pstrdup(doc->pool, cur->value);
4096 else if (STRCASEEQ('l','L',"large",cur->value)) {
4097 attr_size = apr_pstrdup(doc->pool, cur->value);
4099 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4100 attr_size = apr_pstrdup(doc->pool, cur->value);
4102 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4103 attr_size = apr_pstrdup(doc->pool, cur->value);
4110 if (attr_color || attr_size) {
4113 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4131 * It is a handler who processes the BLOCKQUOTE tag.
4133 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4134 * destination is specified.
4135 * @param node [i] The BLOCKQUOTE tag node is specified.
4136 * @return The conversion result is returned.
4139 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4141 xhtml_t *xhtml = GET_XHTML(pdoc);
4142 Doc *doc = xhtml->doc;
4143 W_L("</blockquote>");
4144 if (IS_CSS_ON(xhtml->entryp)) {
4145 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4152 * It is a handler who processes the DIR tag.
4154 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4155 * destination is specified.
4156 * @param node [i] The DIR tag node is specified.
4157 * @return The conversion result is returned.
4160 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
4162 xhtml_t *xhtml = GET_XHTML(pdoc);
4163 Doc *doc = xhtml->doc;
4165 char *attr_style = NULL;
4166 char *attr_color = NULL;
4167 char *attr_type = NULL;
4168 char *attr_size = NULL;
4169 for (attr = qs_get_attr(doc,node);
4171 attr = qs_get_next_attr(doc,attr)) {
4172 char *name = qs_get_attr_name(doc,attr);
4173 char *value = qs_get_attr_value(doc,attr);
4174 if (STRCASEEQ('t','T',"type",name)) {
4175 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4179 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4183 if (IS_CSS_ON(xhtml->entryp)) {
4184 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4186 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4187 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4188 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4189 css_property_t *cur;
4190 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4191 if (cur->value && *cur->value) {
4192 attr_color = apr_pstrdup(doc->pool, cur->value);
4195 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4196 if (cur->value && *cur->value) {
4197 attr_type = apr_pstrdup(doc->pool, cur->value);
4200 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4201 if (cur->value && *cur->value) {
4202 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4203 attr_size = apr_pstrdup(doc->pool, cur->value);
4205 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4206 attr_size = apr_pstrdup(doc->pool, cur->value);
4208 else if (STRCASEEQ('s','S',"small",cur->value)) {
4209 attr_size = apr_pstrdup(doc->pool, cur->value);
4211 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4212 attr_size = apr_pstrdup(doc->pool, cur->value);
4214 else if (STRCASEEQ('l','L',"large",cur->value)) {
4215 attr_size = apr_pstrdup(doc->pool, cur->value);
4217 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4218 attr_size = apr_pstrdup(doc->pool, cur->value);
4220 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4221 attr_size = apr_pstrdup(doc->pool, cur->value);
4228 if (attr_type || attr_color || attr_size) {
4231 W_L("list-style-type:");
4236 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4254 * It is a handler who processes the DIR tag.
4256 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4257 * destination is specified.
4258 * @param node [i] The DIR tag node is specified.
4259 * @return The conversion result is returned.
4262 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
4264 xhtml_t *xhtml = GET_XHTML(pdoc);
4265 Doc *doc = xhtml->doc;
4267 if (IS_CSS_ON(xhtml->entryp)) {
4268 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4275 * It is a handler who processes the DL tag.
4277 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4278 * destination is specified.
4279 * @param node [i] The DL tag node is specified.
4280 * @return The conversion result is returned.
4283 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
4285 xhtml_t *xhtml = GET_XHTML(pdoc);
4286 Doc *doc = xhtml->doc;
4288 char *attr_style = NULL;
4289 char *attr_color = NULL;
4290 char *attr_size = NULL;
4292 for (attr = qs_get_attr(doc,node);
4294 attr = qs_get_next_attr(doc,attr)) {
4295 char *name = qs_get_attr_name(doc,attr);
4296 char *value = qs_get_attr_value(doc,attr);
4297 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4301 if (IS_CSS_ON(xhtml->entryp)) {
4302 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4304 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4305 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4306 css_property_t *cur;
4307 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4308 if (cur->value && *cur->value) {
4309 attr_color = apr_pstrdup(doc->pool, cur->value);
4312 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4313 if (cur->value && *cur->value) {
4314 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4315 attr_size = apr_pstrdup(doc->pool, cur->value);
4317 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4318 attr_size = apr_pstrdup(doc->pool, cur->value);
4320 else if (STRCASEEQ('s','S',"small",cur->value)) {
4321 attr_size = apr_pstrdup(doc->pool, cur->value);
4323 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4324 attr_size = apr_pstrdup(doc->pool, cur->value);
4326 else if (STRCASEEQ('l','L',"large",cur->value)) {
4327 attr_size = apr_pstrdup(doc->pool, cur->value);
4329 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4330 attr_size = apr_pstrdup(doc->pool, cur->value);
4332 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4333 attr_size = apr_pstrdup(doc->pool, cur->value);
4340 if (attr_color || attr_size) {
4343 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4361 * It is a handler who processes the DL tag.
4363 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4364 * destination is specified.
4365 * @param node [i] The DL tag node is specified.
4366 * @return The conversion result is returned.
4369 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
4371 xhtml_t *xhtml = GET_XHTML(pdoc);
4372 Doc *doc = xhtml->doc;
4374 if (IS_CSS_ON(xhtml->entryp)) {
4375 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4382 * It is a handter who processes the DT tag.
4384 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4385 * destination is specified.
4386 * @param node [i] The DT tag node is specified.
4387 * @return The conversion result is returned.
4390 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
4392 xhtml_t *xhtml = GET_XHTML(pdoc);
4393 Doc *doc = xhtml->doc;
4395 char *attr_style = NULL;
4396 char *attr_color = NULL;
4397 char *attr_size = NULL;
4399 for (attr = qs_get_attr(doc,node);
4401 attr = qs_get_next_attr(doc,attr)) {
4402 char *name = qs_get_attr_name(doc,attr);
4403 char *value = qs_get_attr_value(doc,attr);
4404 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4408 if (IS_CSS_ON(xhtml->entryp)) {
4409 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4411 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4412 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4413 css_property_t *cur;
4414 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4415 if (cur->value && *cur->value) {
4416 attr_color = apr_pstrdup(doc->pool, cur->value);
4419 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4420 if (cur->value && *cur->value) {
4421 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4422 attr_size = apr_pstrdup(doc->pool, cur->value);
4424 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4425 attr_size = apr_pstrdup(doc->pool, cur->value);
4427 else if (STRCASEEQ('s','S',"small",cur->value)) {
4428 attr_size = apr_pstrdup(doc->pool, cur->value);
4430 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4431 attr_size = apr_pstrdup(doc->pool, cur->value);
4433 else if (STRCASEEQ('l','L',"large",cur->value)) {
4434 attr_size = apr_pstrdup(doc->pool, cur->value);
4436 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4437 attr_size = apr_pstrdup(doc->pool, cur->value);
4439 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4440 attr_size = apr_pstrdup(doc->pool, cur->value);
4447 if (attr_color || attr_size) {
4450 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4468 * It is a handter who processes the DT tag.
4470 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4471 * destination is specified.
4472 * @param node [i] The DT tag node is specified.
4473 * @return The conversion result is returned.
4476 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
4478 xhtml_t *xhtml = GET_XHTML(pdoc);
4479 Doc *doc = xhtml->doc;
4481 if (IS_CSS_ON(xhtml->entryp)) {
4482 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4489 * It is a handder who processes the DD tag.
4491 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4492 * destination is specified.
4493 * @param node [i] The DD tag node is specified.
4494 * @return The conversion result is returned.
4497 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
4499 xhtml_t *xhtml = GET_XHTML(pdoc);
4500 Doc *doc = xhtml->doc;
4502 char *attr_style = NULL;
4503 char *attr_color = NULL;
4504 char *attr_size = NULL;
4506 for (attr = qs_get_attr(doc,node);
4508 attr = qs_get_next_attr(doc,attr)) {
4509 char *name = qs_get_attr_name(doc,attr);
4510 char *value = qs_get_attr_value(doc,attr);
4511 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4515 if (IS_CSS_ON(xhtml->entryp)) {
4516 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4518 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4519 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4520 css_property_t *cur;
4521 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4522 if (cur->value && *cur->value) {
4523 attr_color = apr_pstrdup(doc->pool, cur->value);
4526 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4527 if (cur->value && *cur->value) {
4528 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4529 attr_size = apr_pstrdup(doc->pool, cur->value);
4531 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4532 attr_size = apr_pstrdup(doc->pool, cur->value);
4534 else if (STRCASEEQ('s','S',"small",cur->value)) {
4535 attr_size = apr_pstrdup(doc->pool, cur->value);
4537 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4538 attr_size = apr_pstrdup(doc->pool, cur->value);
4540 else if (STRCASEEQ('l','L',"large",cur->value)) {
4541 attr_size = apr_pstrdup(doc->pool, cur->value);
4543 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4544 attr_size = apr_pstrdup(doc->pool, cur->value);
4546 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4547 attr_size = apr_pstrdup(doc->pool, cur->value);
4554 if (attr_color || attr_size) {
4557 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4575 * It is a handler who processes the DD tag.
4577 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4578 * destination is specified.
4579 * @param node [i] The DD tag node is specified.
4580 * @return The conversion result is returned.
4583 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
4585 xhtml_t *xhtml = GET_XHTML(pdoc);
4586 Doc *doc = xhtml->doc;
4588 if (IS_CSS_ON(xhtml->entryp)) {
4589 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4596 * It is a handler who processes the MENU tag.
4598 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4599 * destination is specified.
4600 * @param node [i] The MENU tag node is specified.
4601 * @return The conversion result is returned.
4604 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
4606 xhtml_t *xhtml = GET_XHTML(pdoc);
4607 Doc *doc = xhtml->doc;
4609 char *attr_style = NULL;
4610 char *attr_color = NULL;
4611 char *attr_type = NULL;
4612 char *attr_size = NULL;
4613 for (attr = qs_get_attr(doc,node);
4615 attr = qs_get_next_attr(doc,attr)) {
4616 char *name = qs_get_attr_name(doc,attr);
4617 char *value = qs_get_attr_value(doc,attr);
4618 if (STRCASEEQ('t','T',"type",name)) {
4619 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4623 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4627 if (IS_CSS_ON(xhtml->entryp)) {
4628 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4630 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4631 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4632 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4633 css_property_t *cur;
4634 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4635 if (cur->value && *cur->value) {
4636 attr_color = apr_pstrdup(doc->pool, cur->value);
4639 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4640 if (cur->value && *cur->value) {
4641 attr_type = apr_pstrdup(doc->pool, cur->value);
4644 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4645 if (cur->value && *cur->value) {
4646 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4647 attr_size = apr_pstrdup(doc->pool, cur->value);
4649 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4650 attr_size = apr_pstrdup(doc->pool, cur->value);
4652 else if (STRCASEEQ('s','S',"small",cur->value)) {
4653 attr_size = apr_pstrdup(doc->pool, cur->value);
4655 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4656 attr_size = apr_pstrdup(doc->pool, cur->value);
4658 else if (STRCASEEQ('l','L',"large",cur->value)) {
4659 attr_size = apr_pstrdup(doc->pool, cur->value);
4661 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4662 attr_size = apr_pstrdup(doc->pool, cur->value);
4664 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4665 attr_size = apr_pstrdup(doc->pool, cur->value);
4672 if (attr_type || attr_color || attr_size) {
4675 W_L("list-style-type:");
4680 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4698 * It is a hanmenuer who processes the MENU tag.
4700 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4701 * destination is specified.
4702 * @param node [i] The MENU tag node is specified.
4703 * @return The conversion result is returned.
4706 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
4708 xhtml_t *xhtml = GET_XHTML(pdoc);
4709 Doc *doc = xhtml->doc;
4711 if (IS_CSS_ON(xhtml->entryp)) {
4712 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4719 * It is a handler who processes the PLAINTEXT tag.
4721 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4722 * destination is specified.
4723 * @param node [i] The PLAINTEXT tag node is specified.
4724 * @return The conversion result is returned.
4727 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
4729 xhtml_t *xhtml = GET_XHTML(pdoc);
4730 Doc *doc = xhtml->doc;
4732 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
4737 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
4739 xhtml_t *xhtml = GET_XHTML(pdoc);
4740 Doc *doc = xhtml->doc;
4742 for (child = qs_get_child_node(doc, node);
4744 child = qs_get_next_node(doc, child)) {
4746 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
4753 * It is a handler who processes the PLAINTEXT tag.
4755 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4756 * destination is specified.
4757 * @param node [i] The PLAINTEXT tag node is specified.
4758 * @return The conversion result is returned.
4761 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4763 xhtml_t *xhtml = GET_XHTML(pdoc);
4764 Doc *doc = xhtml->doc;
4765 W_L("</plaintext>");
4771 * It is a handler who processes the BLINK tag.
4773 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4774 * destination is specified.
4775 * @param node [i] The BLINK tag node is specified.
4776 * @return The conversion result is returned.
4779 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
4781 xhtml_t *xhtml = GET_XHTML(pdoc);
4782 Doc *doc = xhtml->doc;
4784 char *attr_style = NULL;
4785 char *attr_color = NULL;
4786 char *attr_size = NULL;
4788 for (attr = qs_get_attr(doc,node);
4790 attr = qs_get_next_attr(doc,attr)) {
4791 char *name = qs_get_attr_name(doc,attr);
4792 char *value = qs_get_attr_value(doc,attr);
4793 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4797 if (IS_CSS_ON(xhtml->entryp)) {
4798 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4800 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4801 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4802 css_property_t *cur;
4803 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4804 if (cur->value && *cur->value) {
4805 attr_color = apr_pstrdup(doc->pool, cur->value);
4808 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4809 if (cur->value && *cur->value) {
4810 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4811 attr_size = apr_pstrdup(doc->pool, cur->value);
4813 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4814 attr_size = apr_pstrdup(doc->pool, cur->value);
4816 else if (STRCASEEQ('s','S',"small",cur->value)) {
4817 attr_size = apr_pstrdup(doc->pool, cur->value);
4819 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4820 attr_size = apr_pstrdup(doc->pool, cur->value);
4822 else if (STRCASEEQ('l','L',"large",cur->value)) {
4823 attr_size = apr_pstrdup(doc->pool, cur->value);
4825 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4826 attr_size = apr_pstrdup(doc->pool, cur->value);
4828 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4829 attr_size = apr_pstrdup(doc->pool, cur->value);
4836 if (attr_color || attr_size) {
4839 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4857 * It is a handler who processes the BLINK tag.
4859 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4860 * destination is specified.
4861 * @param node [i] The BLINK tag node is specified.
4862 * @return The conversion result is returned.
4865 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
4867 xhtml_t *xhtml = GET_XHTML(pdoc);
4868 Doc *doc = xhtml->doc;
4870 if (IS_CSS_ON(xhtml->entryp)) {
4871 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4878 * It is a handler who processes the MARQUEE tag.
4880 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4881 * destination is specified.
4882 * @param node [i] The MARQUEE tag node is specified.
4883 * @return The conversion result is returned.
4886 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
4888 xhtml_t *xhtml = GET_XHTML(pdoc);
4889 Doc *doc = xhtml->doc;
4891 char *attr_direction = NULL;
4892 char *attr_behavior = NULL;
4893 char *attr_loop = NULL;
4894 char *attr_style = NULL;
4895 char *attr_color = NULL;
4896 char *attr_size = NULL;
4897 char *attr_bgcolor = NULL;
4898 /*--------------------------------------------------------------------------*/
4899 /* Get Attributes */
4900 /*--------------------------------------------------------------------------*/
4901 for (attr = qs_get_attr(doc,node);
4903 attr = qs_get_next_attr(doc,attr)) {
4904 char *name = qs_get_attr_name(doc,attr);
4905 char *value = qs_get_attr_value(doc,attr);
4906 if (STRCASEEQ('d','D',"direction", name)) {
4908 if (STRCASEEQ('l','L',"left",value)) {
4909 attr_direction = "rtl";
4911 else if (STRCASEEQ('r','R',"right",value)) {
4912 attr_direction = "ltr";
4916 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
4917 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
4918 attr_behavior = value;
4921 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
4924 else if (STRCASEEQ('b','B',"bgcolor",name)) {
4925 if (value && *value) {
4926 attr_bgcolor = value;
4929 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4933 if (IS_CSS_ON(xhtml->entryp)) {
4934 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4936 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4937 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4938 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
4939 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4940 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4941 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4942 css_property_t *cur;
4943 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4944 if (cur->value && *cur->value) {
4945 attr_color = apr_pstrdup(doc->pool, cur->value);
4948 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
4949 if (cur->value && *cur->value) {
4950 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4953 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4954 if (cur->value && *cur->value) {
4955 attr_direction = apr_pstrdup(doc->pool, cur->value);
4958 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
4959 if (cur->value && *cur->value) {
4960 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4961 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4965 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4966 if (cur->value && *cur->value) {
4967 attr_loop = apr_pstrdup(doc->pool, cur->value);
4970 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4971 if (cur->value && *cur->value) {
4972 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4973 attr_size = apr_pstrdup(doc->pool, cur->value);
4975 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4976 attr_size = apr_pstrdup(doc->pool, cur->value);
4978 else if (STRCASEEQ('s','S',"small",cur->value)) {
4979 attr_size = apr_pstrdup(doc->pool, cur->value);
4981 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4982 attr_size = apr_pstrdup(doc->pool, cur->value);
4984 else if (STRCASEEQ('l','L',"large",cur->value)) {
4985 attr_size = apr_pstrdup(doc->pool, cur->value);
4987 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4988 attr_size = apr_pstrdup(doc->pool, cur->value);
4990 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4991 attr_size = apr_pstrdup(doc->pool, cur->value);
4998 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5000 if (attr_direction) {
5001 W_L("-wap-marquee-dir:");
5002 W_V(attr_direction);
5005 if (attr_behavior) {
5006 W_L("-wap-marquee-style:");
5011 W_L("-wap-marquee-loop:");
5016 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5017 W_L("background-color:");
5022 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5041 * It is a handler who processes the MARQUEE tag.
5043 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5044 * destination is specified.
5045 * @param node [i] The MARQUEE tag node is specified.
5046 * @return The conversion result is returned.
5049 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5051 xhtml_t *xhtml = GET_XHTML(pdoc);
5052 Doc *doc = xhtml->doc;
5054 if (IS_CSS_ON(xhtml->entryp)) {
5055 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5062 * It is handler who processes the New Line Code.
5065 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5067 xhtml_t *xhtml = GET_XHTML(pdoc);
5068 Doc *doc = xhtml->doc;
5069 if (xhtml->start_html_flag) {
5077 * It is a handler who processes the LINK tag.
5079 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5080 * destination is specified.
5081 * @param node [i] The LINK tag node is specified.
5082 * @return The conversion result is returned.
5085 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5094 xhtml = GET_XHTML(pdoc);
5097 if (! IS_CSS_ON(xhtml->entryp)) {
5101 for (attr = qs_get_attr(doc,node);
5103 attr = qs_get_next_attr(doc,attr)) {
5104 char *name = qs_get_attr_name(doc,attr);
5105 char *value = qs_get_attr_value(doc,attr);
5106 if (STRCASEEQ('r','R',"rel", name)) {
5107 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5111 else if (STRCASEEQ('h','H',"href", name)) {
5112 if (value && *value) {
5116 else if (STRCASEEQ('t','T',"type", name)) {
5117 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5123 if (rel && href && type) {
5124 DBG(doc->r, "start load CSS. url:[%s]", href);
5125 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
5126 DBG(doc->r, "end load CSS. url:[%s]", href);
5132 static css_prop_list_t *
5133 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5135 xhtml_t *xhtml = GET_XHTML(pdoc);
5136 Doc *doc = xhtml->doc;
5137 css_prop_list_t *last_css = NULL;
5138 if (IS_CSS_ON(xhtml->entryp)) {
5139 css_prop_list_t *dup_css;
5140 css_selector_t *selector;
5142 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5143 dup_css = chxj_dup_css_prop_list(doc, last_css);
5144 selector = chxj_css_find_selector(doc, xhtml->style, node);
5146 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5148 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
5149 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5151 if (style_attr_value) {
5152 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));
5154 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5162 static css_prop_list_t *
5163 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5165 xhtml_t *xhtml = GET_XHTML(pdoc);
5166 Doc *doc = xhtml->doc;
5167 css_prop_list_t *last_css = NULL;
5168 if (IS_CSS_ON(xhtml->entryp)) {
5169 css_prop_list_t *dup_css;
5170 css_selector_t *selector;
5172 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5173 dup_css = chxj_dup_css_prop_list(doc, last_css);
5174 selector = chxj_css_find_selector(doc, xhtml->style, node);
5176 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5180 if (style_attr_value) {
5181 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));
5183 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5192 * It is a handler who processes the SPAN tag.
5194 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5195 * destination is specified.
5196 * @param node [i] The SPAN tag node is specified.
5197 * @return The conversion result is returned.
5200 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
5205 char *attr_style = NULL;
5206 char *attr_color = NULL;
5207 char *attr_size = NULL;
5208 char *attr_align = NULL;
5209 char *attr_blink = NULL;
5210 char *attr_marquee = NULL;
5211 char *attr_marquee_dir = NULL;
5212 char *attr_marquee_style = NULL;
5213 char *attr_marquee_loop = NULL;
5215 xhtml = GET_XHTML(pdoc);
5218 for (attr = qs_get_attr(doc,node);
5220 attr = qs_get_next_attr(doc,attr)) {
5221 char *nm = qs_get_attr_name(doc,attr);
5222 char *val = qs_get_attr_value(doc,attr);
5223 if (val && STRCASEEQ('s','S',"style", nm)) {
5227 if (IS_CSS_ON(xhtml->entryp)) {
5228 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5230 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5231 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5232 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5233 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5234 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5235 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5236 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5237 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5238 css_property_t *cur;
5239 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5240 attr_color = apr_pstrdup(doc->pool, cur->value);
5242 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5243 if (cur->value && *cur->value) {
5244 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5245 || STRCASEEQ('x','X',"x-small", cur->value)
5246 || STRCASEEQ('s','S',"small", cur->value)
5247 || STRCASEEQ('m','M',"medium", cur->value)
5248 || STRCASEEQ('l','L',"large", cur->value)
5249 || STRCASEEQ('x','X',"x-large", cur->value)
5250 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5251 attr_size = apr_pstrdup(doc->pool, cur->value);
5255 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5256 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5257 attr_blink = apr_pstrdup(doc->pool, cur->value);
5260 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5261 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5262 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5265 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5266 if (cur->value && *cur->value) {
5267 if ( STRCASEEQ('l','L',"ltr",cur->value)
5268 || STRCASEEQ('r','R',"rtl",cur->value)) {
5269 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5273 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5274 if (cur->value && *cur->value) {
5275 if ( STRCASEEQ('s','S',"scroll",cur->value)
5276 || STRCASEEQ('s','S',"slide",cur->value)
5277 || STRCASEEQ('a','A',"alternate",cur->value)) {
5278 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5282 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5283 if (cur->value && *cur->value) {
5284 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5287 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5288 if (STRCASEEQ('l','L',"left", cur->value)) {
5289 attr_align = apr_pstrdup(doc->pool, "left");
5291 else if (STRCASEEQ('c','C',"center",cur->value)) {
5292 attr_align = apr_pstrdup(doc->pool, "center");
5294 else if (STRCASEEQ('r','R',"right",cur->value)) {
5295 attr_align = apr_pstrdup(doc->pool, "right");
5302 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5305 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5321 W_L("text-decoration:");
5326 W_L("display:-wap-marquee;");
5327 if (attr_marquee_dir) {
5328 W_L("-wap-marquee-dir:");
5329 W_V(attr_marquee_dir);
5332 if (attr_marquee_style) {
5333 W_L("-wap-marquee-style:");
5334 W_V(attr_marquee_style);
5337 if (attr_marquee_loop) {
5338 W_L("-wap-marquee-loop:");
5339 W_V(attr_marquee_loop);
5351 * It is a handler who processes the SPAN tag.
5353 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5354 * destination is specified.
5355 * @param node [i] The SPAN tag node is specified.
5356 * @return The conversion result is returned.
5359 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
5361 xhtml_t *xhtml = GET_XHTML(pdoc);
5362 Doc *doc = xhtml->doc;
5365 if (IS_CSS_ON(xhtml->entryp)) {
5366 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5373 * It is a handler who processes the STYLE tag.
5375 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5376 * destination is specified.
5377 * @param node [i] The STYLE tag node is specified.
5378 * @return The conversion result is returned.
5381 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
5388 xhtml = GET_XHTML(pdoc);
5391 if (! IS_CSS_ON(xhtml->entryp)) {
5395 for (attr = qs_get_attr(doc,node);
5397 attr = qs_get_next_attr(doc,attr)) {
5398 char *name = qs_get_attr_name(doc,attr);
5399 char *value = qs_get_attr_value(doc,attr);
5400 if (STRCASEEQ('t','T',"type", name)) {
5401 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5407 Node *child = qs_get_child_node(doc, node);
5408 if (type && child) {
5409 char *name = qs_get_node_name(doc, child);
5410 if (STRCASEEQ('t','T',"text", name)) {
5411 char *value = qs_get_node_value(doc, child);
5412 DBG(doc->r, "start load CSS. buf:[%s]", value);
5413 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
5414 DBG(doc->r, "end load CSS. value:[%s]", value);