2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_conv_z2h.h"
29 #define GET_XHTML(X) ((xhtml_t*)(X))
32 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
38 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_table_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_end_table_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_start_td_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_end_td_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_start_th_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_end_th_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_start_td_or_th_tag (void *pdoc, Node *node,char *tagName);
85 static char *s_xhtml_1_0_end_td_or_th_tag (void *pdoc, Node *node,char *tagName);
86 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_start_blockquote_tag (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
116 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
117 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
118 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
119 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
120 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
121 static char *s_xhtml_1_0_start_plaintext_tag (void *pdoc, Node *node);
122 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
123 static char *s_xhtml_1_0_end_plaintext_tag (void *pdoc, Node *node);
124 static char *s_xhtml_1_0_start_blink_tag (void *pdoc, Node *node);
125 static char *s_xhtml_1_0_end_blink_tag (void *pdoc, Node *node);
126 static char *s_xhtml_1_0_start_marquee_tag (void *pdoc, Node *node);
127 static char *s_xhtml_1_0_end_marquee_tag (void *pdoc, Node *node);
128 static char *s_xhtml_1_0_newline_mark (void *pdoc, Node *node);
129 static char *s_xhtml_1_0_link_tag (void *pdoc, Node *node);
130 static char *s_xhtml_1_0_start_span_tag (void *pdoc, Node *node);
131 static char *s_xhtml_1_0_end_span_tag (void *pdoc, Node *node);
132 static char *s_xhtml_1_0_style_tag (void *pdoc, Node *node);
133 static char *s_xhtml_1_0_start_object_tag (void *pdoc, Node *node);
134 static char *s_xhtml_1_0_end_object_tag (void *pdoc, Node *node);
135 static char *s_xhtml_1_0_start_param_tag (void *pdoc, Node *node);
136 static char *s_xhtml_1_0_start_caption_tag (void *pdoc, Node *node);
137 static char *s_xhtml_1_0_end_caption_tag (void *pdoc, Node *node);
139 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
140 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
141 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
142 static css_prop_list_t *s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
143 static css_prop_list_t *s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
147 tag_handler xhtml_handler[] = {
150 s_xhtml_1_0_start_html_tag,
151 s_xhtml_1_0_end_html_tag,
155 s_xhtml_1_0_start_meta_tag,
156 s_xhtml_1_0_end_meta_tag,
160 s_xhtml_1_0_start_textarea_tag,
161 s_xhtml_1_0_end_textarea_tag,
165 s_xhtml_1_0_start_p_tag,
166 s_xhtml_1_0_end_p_tag,
170 s_xhtml_1_0_start_pre_tag,
171 s_xhtml_1_0_end_pre_tag,
175 s_xhtml_1_0_start_ul_tag,
176 s_xhtml_1_0_end_ul_tag,
180 s_xhtml_1_0_start_li_tag,
181 s_xhtml_1_0_end_li_tag,
185 s_xhtml_1_0_start_ol_tag,
186 s_xhtml_1_0_end_ol_tag,
190 s_xhtml_1_0_start_h1_tag,
191 s_xhtml_1_0_end_h1_tag,
195 s_xhtml_1_0_start_h2_tag,
196 s_xhtml_1_0_end_h2_tag,
200 s_xhtml_1_0_start_h3_tag,
201 s_xhtml_1_0_end_h3_tag,
205 s_xhtml_1_0_start_h4_tag,
206 s_xhtml_1_0_end_h4_tag,
210 s_xhtml_1_0_start_h5_tag,
211 s_xhtml_1_0_end_h5_tag,
215 s_xhtml_1_0_start_h6_tag,
216 s_xhtml_1_0_end_h6_tag,
220 s_xhtml_1_0_start_head_tag,
221 s_xhtml_1_0_end_head_tag,
225 s_xhtml_1_0_start_title_tag,
226 s_xhtml_1_0_end_title_tag,
230 s_xhtml_1_0_start_base_tag,
231 s_xhtml_1_0_end_base_tag,
235 s_xhtml_1_0_start_body_tag,
236 s_xhtml_1_0_end_body_tag,
240 s_xhtml_1_0_start_a_tag,
241 s_xhtml_1_0_end_a_tag,
245 s_xhtml_1_0_start_br_tag,
246 s_xhtml_1_0_end_br_tag,
250 s_xhtml_1_0_start_table_tag,
251 s_xhtml_1_0_end_table_tag,
255 s_xhtml_1_0_start_tr_tag,
256 s_xhtml_1_0_end_tr_tag,
260 s_xhtml_1_0_start_td_tag,
261 s_xhtml_1_0_end_td_tag,
270 s_xhtml_1_0_start_font_tag,
271 s_xhtml_1_0_end_font_tag,
275 s_xhtml_1_0_start_form_tag,
276 s_xhtml_1_0_end_form_tag,
280 s_xhtml_1_0_start_input_tag,
281 s_xhtml_1_0_end_input_tag,
285 s_xhtml_1_0_start_center_tag,
286 s_xhtml_1_0_end_center_tag,
290 s_xhtml_1_0_start_hr_tag,
291 s_xhtml_1_0_end_hr_tag,
295 s_xhtml_1_0_start_img_tag,
296 s_xhtml_1_0_end_img_tag,
300 s_xhtml_1_0_start_select_tag,
301 s_xhtml_1_0_end_select_tag,
305 s_xhtml_1_0_start_option_tag,
306 s_xhtml_1_0_end_option_tag,
310 s_xhtml_1_0_start_div_tag,
311 s_xhtml_1_0_end_div_tag,
315 s_xhtml_1_0_chxjif_tag,
320 s_xhtml_1_0_chxjif_tag,
335 s_xhtml_1_0_style_tag,
340 s_xhtml_1_0_start_span_tag,
341 s_xhtml_1_0_end_span_tag,
345 s_xhtml_1_0_text_tag,
350 s_xhtml_1_0_start_th_tag,
351 s_xhtml_1_0_end_th_tag,
355 s_xhtml_1_0_start_b_tag,
356 s_xhtml_1_0_end_b_tag,
365 s_xhtml_1_0_start_dt_tag,
366 s_xhtml_1_0_end_dt_tag,
380 s_xhtml_1_0_start_blockquote_tag,
381 s_xhtml_1_0_end_blockquote_tag,
385 s_xhtml_1_0_start_dir_tag,
386 s_xhtml_1_0_end_dir_tag,
390 s_xhtml_1_0_start_dl_tag,
391 s_xhtml_1_0_end_dl_tag,
395 s_xhtml_1_0_start_dd_tag,
396 s_xhtml_1_0_end_dd_tag,
400 s_xhtml_1_0_start_menu_tag,
401 s_xhtml_1_0_end_menu_tag,
405 s_xhtml_1_0_start_plaintext_tag,
406 s_xhtml_1_0_end_plaintext_tag,
410 s_xhtml_1_0_start_blink_tag,
411 s_xhtml_1_0_end_blink_tag,
415 s_xhtml_1_0_start_marquee_tag,
416 s_xhtml_1_0_end_marquee_tag,
420 s_xhtml_1_0_link_tag,
425 s_xhtml_1_0_newline_mark,
430 s_xhtml_1_0_start_object_tag,
431 s_xhtml_1_0_end_object_tag,
435 s_xhtml_1_0_start_param_tag,
440 s_xhtml_1_0_start_caption_tag,
441 s_xhtml_1_0_end_caption_tag,
446 * converts from CHTML to XHTML.
448 * @param r [i] Requet_rec is appointed.
449 * @param spec [i] The result of the device specification processing which
450 * was done in advance is appointed.
451 * @param src [i] The character string before the converting is appointed.
452 * @return The character string after the converting is returned.
455 chxj_convert_xhtml_mobile_1_0(
461 chxjconvrule_entry *entryp,
470 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
471 /*--------------------------------------------------------------------------*/
473 /*--------------------------------------------------------------------------*/
475 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
477 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
481 /*--------------------------------------------------------------------------*/
482 /* The XHTML structure is initialized. */
483 /*--------------------------------------------------------------------------*/
484 s_init_xhtml(&xhtml, &doc, r, spec);
486 xhtml.entryp = entryp;
487 xhtml.cookie = cookie;
489 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
491 /*--------------------------------------------------------------------------*/
492 /* The character string of the input is analyzed. */
493 /*--------------------------------------------------------------------------*/
494 qs_init_malloc(&doc);
495 qs_init_root_node(&doc);
497 ss = apr_pcalloc(r->pool, srclen + 1);
498 memset(ss, 0, srclen + 1);
499 memcpy(ss, src, srclen);
501 if (IS_CSS_ON(xhtml.entryp)) {
502 /* current property list */
503 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
506 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
508 qs_parse_string(&doc,ss, strlen(ss));
510 chxj_buffered_write_init(r->pool, &doc.buf);
511 /*--------------------------------------------------------------------------*/
512 /* It converts it from CHTML to XHTML. */
513 /*--------------------------------------------------------------------------*/
514 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
515 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
516 dst = apr_pstrdup(r->pool, xhtml.out);
517 chxj_buffered_write_terminate(&doc.buf);
519 qs_all_free(&doc,QX_LOGMARK);
522 return apr_pstrdup(r->pool,ss);
526 dst = apr_psprintf(r->pool, "\n");
528 *dstlen = strlen(dst);
531 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
534 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
540 * The XHTML structure is initialized.
542 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
543 * initialized is specified.
544 * @param doc [i] The Doc structure that should be set to the initialized
545 * HDML structure is specified.
546 * @param r [i] To use POOL, the pointer to request_rec is specified.
547 * @param spec [i] The pointer to the device_table
550 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
552 memset(doc, 0, sizeof(Doc));
553 memset(xhtml, 0, sizeof(xhtml_t));
558 xhtml->out = qs_alloc_zero_byte_string(r->pool);
559 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
560 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
565 * Corresponding EMOJI to a current character-code is retrieved.
566 * The substitution character string is stored in the rslt pointer if agreeing.
568 * @param xhtml [i] The pointer to the XHTML structure is specified.
569 * @param txt [i] The character string to want to examine whether it is
570 * EMOJI is specified.
571 * @param rslt [o] The pointer to the pointer that stores the result is
573 * @return When corresponding EMOJI exists, it returns it excluding 0.
576 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
589 DBG(r,"spec is NULL");
592 for (ee = xhtml->conf->emoji;
595 unsigned char hex1byte;
596 unsigned char hex2byte;
598 DBG(r,"emoji->imode is NULL");
602 if (ee->imode->string != NULL
603 && strlen(ee->imode->string) > 0
604 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
605 if (spec == NULL || spec->emoji_type == NULL) {
606 *rslt = apr_psprintf(r->pool,
609 return strlen(ee->imode->string);
612 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
613 *rslt = apr_psprintf(r->pool,
616 return strlen(ee->imode->string);
619 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
620 *rslt = apr_psprintf(r->pool,
623 return strlen(ee->imode->string);
626 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
627 *rslt = apr_psprintf(r->pool,
630 return strlen(ee->imode->string);
633 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
634 *rslt = apr_psprintf(r->pool,
637 return strlen(ee->imode->string);
640 *rslt = apr_psprintf(r->pool,
643 return strlen(ee->imode->string);
647 hex1byte = ee->imode->hex1byte & 0xff;
648 hex2byte = ee->imode->hex2byte & 0xff;
650 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
651 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
652 if (spec == NULL || spec->emoji_type == NULL) {
653 *rslt = apr_psprintf(r->pool,
654 "<img localsrc=\"%s\">",
659 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
660 *rslt = apr_psprintf(r->pool,
661 "<img localsrc=\"%s\">",
666 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
667 *rslt = apr_psprintf(r->pool,
668 "<img localsrc=\"%s\">",
673 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
674 *rslt = apr_psprintf(r->pool,
675 "<img localsrc=\"%s\">",
680 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
681 *rslt = apr_psprintf(r->pool,
682 "<img localsrc=\"%s\">",
687 *rslt = apr_psprintf(r->pool,
688 "<img localsrc=\"%s\">",
700 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
714 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
715 memset(doc, 0, sizeof(Doc));
716 memset(xhtml, 0, sizeof(xhtml_t));
721 xhtml->out = qs_alloc_zero_byte_string(r->pool);
722 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
723 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
725 apr_pool_create(&pool, r->pool);
727 chxj_buffered_write_init(pool, &doc->buf);
729 for (ii=0; ii<len; ii++) {
733 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
740 if (is_sjis_kanji(src[ii])) {
741 two_byte[0] = src[ii+0];
742 two_byte[1] = src[ii+1];
748 one_byte[0] = src[ii+0];
753 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
755 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
761 * It is a handler who processes the HTML tag.
763 * @param pdoc [i/o] The pointer to the XHTML structure at the output
764 * destination is specified.
765 * @param node [i] The HTML tag node is specified.
766 * @return The conversion result is returned.
769 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
771 xhtml_t *xhtml = GET_XHTML(pdoc);
772 Doc *doc = xhtml->doc;
774 /*--------------------------------------------------------------------------*/
775 /* Add XML Declare */
776 /*--------------------------------------------------------------------------*/
777 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
779 /*--------------------------------------------------------------------------*/
781 /*--------------------------------------------------------------------------*/
782 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
784 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
786 /*--------------------------------------------------------------------------*/
788 /*--------------------------------------------------------------------------*/
789 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
791 xhtml->start_html_flag = 1;
797 * It is a handler who processes the HTML tag.
799 * @param pdoc [i/o] The pointer to the XHTML structure at the output
800 * destination is specified.
801 * @param node [i] The HTML tag node is specified.
802 * @return The conversion result is returned.
805 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
807 xhtml_t *xhtml = GET_XHTML(pdoc);
808 Doc *doc = xhtml->doc;
815 * It is a handler who processes the META tag.
817 * @param pdoc [i/o] The pointer to the XHTML structure at the output
818 * destination is specified.
819 * @param node [i] The META tag node is specified.
820 * @return The conversion result is returned.
823 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
825 xhtml_t *xhtml = GET_XHTML(pdoc);
827 Doc *doc = xhtml->doc;
828 int content_type_flag = 0;
829 request_rec *r = doc->r;
832 /*--------------------------------------------------------------------------*/
834 /*--------------------------------------------------------------------------*/
835 for (attr = qs_get_attr(doc,node);
837 attr = qs_get_next_attr(doc,attr)) {
838 char *name = qs_get_attr_name(doc,attr);
839 char *value = qs_get_attr_value(doc,attr);
840 if (STRCASEEQ('n','N',"name", name) && value && *value) {
847 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
853 if (STRCASEEQ('c','C', "content-type", value)) {
854 content_type_flag = 1;
857 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
858 if (content_type_flag) {
862 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Shift_JIS"));
880 * It is a handler who processes the META tag.
882 * @param pdoc [i/o] The pointer to the XHTML structure at the output
883 * destination is specified.
884 * @param node [i] The META tag node is specified.
885 * @return The conversion result is returned.
888 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
890 xhtml_t *xhtml = GET_XHTML(pdoc);
897 * It is a handler who processes the HEAD tag.
899 * @param pdoc [i/o] The pointer to the XHTML structure at the output
900 * destination is specified.
901 * @param node [i] The HEAD tag node is specified.
902 * @return The conversion result is returned.
905 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
907 xhtml_t *xhtml = GET_XHTML(pdoc);
908 Doc *doc = xhtml->doc;
916 * It is a handler who processes the HEAD tag.
918 * @param pdoc [i/o] The pointer to the XHTML structure at the output
919 * destination is specified.
920 * @param node [i] The HEAD tag node is specified.
921 * @return The conversion result is returned.
924 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
926 xhtml_t *xhtml = GET_XHTML(pdoc);
927 Doc *doc = xhtml->doc;
935 * It is a handler who processes the TITLE tag.
937 * @param pdoc [i/o] The pointer to the XHTML structure at the output
938 * destination is specified.
939 * @param node [i] The TITLE tag node is specified.
940 * @return The conversion result is returned.
943 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
945 xhtml_t *xhtml = GET_XHTML(pdoc);
946 Doc *doc = xhtml->doc;
954 * It is a handler who processes the TITLE tag.
956 * @param pdoc [i/o] The pointer to the XHTML structure at the output
957 * destination is specified.
958 * @param node [i] The TITLE tag node is specified.
959 * @return The conversion result is returned.
962 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
964 xhtml_t *xhtml = GET_XHTML(pdoc);
965 Doc *doc = xhtml->doc;
974 * It is a handler who processes the BASE tag.
976 * @param pdoc [i/o] The pointer to the XHTML structure at the output
977 * destination is specified.
978 * @param node [i] The BASE tag node is specified.
979 * @return The conversion result is returned.
982 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
984 xhtml_t *xhtml = GET_XHTML(pdoc);
986 Doc *doc = xhtml->doc;
989 /*--------------------------------------------------------------------------*/
991 /*--------------------------------------------------------------------------*/
992 for (attr = qs_get_attr(doc,node);
994 attr = qs_get_next_attr(doc,attr)) {
995 char *name = qs_get_attr_name(doc,attr);
996 char *value = qs_get_attr_value(doc,attr);
997 if (STRCASEEQ('h','H',"href",name)) {
1011 * It is a handler who processes the BASE tag.
1013 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1014 * destination is specified.
1015 * @param node [i] The BASE tag node is specified.
1016 * @return The conversion result is returned.
1019 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
1021 xhtml_t *xhtml = GET_XHTML(pdoc);
1028 * It is a handler who processes the BODY tag.
1030 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1031 * destination is specified.
1032 * @param node [i] The BODY tag node is specified.
1033 * @return The conversion result is returned.
1036 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1038 xhtml_t *xhtml = GET_XHTML(pdoc);
1039 Doc *doc = xhtml->doc;
1041 char *attr_bgcolor = NULL;
1042 char *attr_text = NULL;
1043 char *attr_link = NULL;
1044 char *attr_vlink = NULL;
1045 char *attr_style = NULL;
1046 char *attr_background = NULL;
1048 /*--------------------------------------------------------------------------*/
1049 /* Get Attributes */
1050 /*--------------------------------------------------------------------------*/
1051 for (attr = qs_get_attr(doc,node);
1053 attr = qs_get_next_attr(doc,attr)) {
1054 char *name = qs_get_attr_name(doc,attr);
1055 char *value = qs_get_attr_value(doc,attr);
1056 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1057 attr_bgcolor = value;
1059 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1062 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1065 else if (STRCASEEQ('a','A',"alink", name)) {
1068 else if (STRCASEEQ('v','V',"vlink",name)) {
1071 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1074 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1075 attr_background = value;
1079 if (IS_CSS_ON(xhtml->entryp)) {
1080 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1082 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1083 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1084 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1085 css_property_t *cur;
1086 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1087 if (cur->value && *cur->value) {
1088 attr_text = apr_pstrdup(doc->pool, cur->value);
1091 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1092 if (cur->value && *cur->value) {
1093 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1096 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1097 if (cur->value && *cur->value) {
1098 char *tmp = apr_pstrdup(doc->pool, cur->value);
1099 char *tmps = strstr(tmp,"(");
1101 char *tmpe = strstr(tmp,")");
1102 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1104 attr_background = apr_pstrndup(doc->pool, tmps,len);
1110 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1111 css_selector_t *cur_sel;
1112 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1113 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1114 css_property_t *cur;
1115 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1116 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1117 attr_link = apr_pstrdup(doc->pool, cur->value);
1121 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1122 css_property_t *cur;
1123 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1124 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1125 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1134 if (attr_bgcolor || attr_text) {
1137 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1138 W_L("background-color:");
1143 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1151 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1157 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1162 if (attr_background) {
1163 W_L(" background=\"");
1164 W_V(attr_background);
1174 * It is a handler who processes the BODY tag.
1176 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1177 * destination is specified.
1178 * @param node [i] The BODY tag node is specified.
1179 * @return The conversion result is returned.
1182 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1184 xhtml_t *xhtml = GET_XHTML(pdoc);
1185 Doc *doc = xhtml->doc;
1189 if (IS_CSS_ON(xhtml->entryp)) {
1190 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1199 * It is a handler who processes the A tag.
1201 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1202 * destination is specified.
1203 * @param node [i] The A tag node is specified.
1204 * @return The conversion result is returned.
1207 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1209 xhtml_t *xhtml = GET_XHTML(pdoc);
1210 Doc *doc = xhtml->doc;
1211 request_rec *r = doc->r;
1213 char *attr_style = NULL;
1214 char *attr_id = NULL;
1217 /*--------------------------------------------------------------------------*/
1218 /* Get Attributes */
1219 /*--------------------------------------------------------------------------*/
1220 for (attr = qs_get_attr(doc,node);
1222 attr = qs_get_next_attr(doc,attr)) {
1223 char* name = qs_get_attr_name(doc,attr);
1224 char* value = qs_get_attr_value(doc,attr);
1225 if (STRCASEEQ('i','I',"id",name)){
1226 attr_id = apr_pstrdup(doc->buf.pool, value);
1228 else if (STRCASEEQ('n','N',"name",name)) {
1229 attr_id = apr_pstrdup(doc->buf.pool, value);
1231 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1232 value = chxj_encoding_parameter(r, value, 1);
1233 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1234 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1240 else if (STRCASEEQ('a','A',"accesskey", name)) {
1241 W_L(" accesskey=\"");
1245 else if (STRCASEEQ('c','C',"cti",name)) {
1248 else if (STRCASEEQ('i','I',"ijam", name)) {
1251 else if (STRCASEEQ('u','U',"utn", name)) {
1254 else if (STRCASEEQ('t','T',"telbook",name)) {
1257 else if (STRCASEEQ('k','K',"kana",name)) {
1260 else if (STRCASEEQ('e','E',"email",name)) {
1263 else if (STRCASEEQ('i','I',"ista",name)) {
1266 else if (STRCASEEQ('i','I',"ilet",name)) {
1269 else if (STRCASEEQ('i','I',"iswf",name)) {
1272 else if (STRCASEEQ('i','I',"irst",name)) {
1275 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1286 if (IS_CSS_ON(xhtml->entryp)) {
1287 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1295 * It is a handler who processes the A tag.
1297 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1298 * destination is specified.
1299 * @param node [i] The A tag node is specified.
1300 * @return The conversion result is returned.
1303 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1305 xhtml_t *xhtml = GET_XHTML(pdoc);
1306 Doc *doc = xhtml->doc;
1310 if (IS_CSS_ON(xhtml->entryp)) {
1311 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1319 * It is a handler who processes the BR tag.
1321 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1322 * destination is specified.
1323 * @param node [i] The BR tag node is specified.
1324 * @return The conversion result is returned.
1327 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1329 xhtml_t *xhtml = GET_XHTML(pdoc);
1330 Doc *doc = xhtml->doc;
1332 char *attr_style = NULL;
1333 char *attr_clear = NULL;
1336 /*--------------------------------------------------------------------------*/
1337 /* Get Attributes */
1338 /*--------------------------------------------------------------------------*/
1339 for (attr = qs_get_attr(doc,node);
1341 attr = qs_get_next_attr(doc,attr)) {
1342 char *name = qs_get_attr_name(doc,attr);
1343 char *value = qs_get_attr_value(doc,attr);
1344 if (STRCASEEQ('c','C',"clear",name)) {
1345 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1349 else if (STRCASEEQ('s','S',"style",name)) {
1350 attr_style = apr_pstrdup(doc->buf.pool, value);
1353 if (IS_CSS_ON(xhtml->entryp)) {
1354 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1356 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1357 css_property_t *cur;
1358 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1359 if (cur->value && *cur->value) {
1360 if ( STRCASEEQ('l','L',"left", cur->value)
1361 || STRCASEEQ('r','R',"right", cur->value)) {
1362 attr_clear = apr_pstrdup(doc->pool, cur->value);
1364 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1365 attr_clear = apr_pstrdup(doc->pool, "all");
1384 * It is a handler who processes the BR tag.
1386 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1387 * destination is specified.
1388 * @param node [i] The BR tag node is specified.
1389 * @return The conversion result is returned.
1392 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1394 xhtml_t *xhtml = GET_XHTML(pdoc);
1401 * It is a handler who processes the TABLE tag.
1403 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1404 * destination is specified.
1405 * @param node [i] The TR tag node is specified.
1406 * @return The conversion result is returned.
1409 s_xhtml_1_0_start_table_tag(void *pdoc, Node *node)
1411 xhtml_t *xhtml = GET_XHTML(pdoc);
1412 Doc *doc = xhtml->doc;
1413 request_rec *r = doc->r;
1415 char *attr_style = NULL;
1416 char *attr_align = NULL;
1417 char *attr_width = NULL;
1418 char *attr_height = NULL;
1419 char *attr_bgcolor = NULL;
1420 char *attr_border_width = NULL;
1421 char *attr_border_color = NULL;
1423 /*--------------------------------------------------------------------------*/
1424 /* Get Attributes */
1425 /*--------------------------------------------------------------------------*/
1426 for (attr = qs_get_attr(doc,node);
1428 attr = qs_get_next_attr(doc,attr)) {
1429 char *name = qs_get_attr_name(doc,attr);
1430 char *val = qs_get_attr_value(doc,attr);
1432 if (STRCASEEQ('a','A',"align",name)) {
1433 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1434 attr_align = apr_pstrdup(doc->buf.pool, val);
1437 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1438 attr_height = apr_pstrdup(doc->buf.pool, val);
1440 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1441 attr_width = apr_pstrdup(doc->buf.pool, val);
1443 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1444 attr_style = apr_pstrdup(doc->buf.pool, val);
1446 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1447 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1448 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1450 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1451 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1453 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1454 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1455 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1458 if (IS_CSS_ON(xhtml->entryp)) {
1459 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1461 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1462 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1463 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1464 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1465 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1466 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1468 css_property_t *cur;
1469 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1470 char *tmp = apr_pstrdup(doc->pool, cur->value);
1471 char *tmpp = strstr(tmp, "px");
1473 size_t len = strlen(tmp) - strlen(tmpp);
1474 attr_width = apr_pstrndup(doc->pool, tmp,len);
1477 attr_width = apr_pstrdup(doc->pool, tmp);
1480 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1481 char *tmp = apr_pstrdup(doc->pool, cur->value);
1482 char *tmpp = strstr(tmp, "px");
1484 size_t len = strlen(tmp) - strlen(tmpp);
1485 attr_height = apr_pstrndup(doc->pool, tmp,len);
1488 attr_height = apr_pstrdup(doc->pool, tmp);
1491 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1492 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1493 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1496 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1497 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1498 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1500 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1501 char *tmp = apr_pstrdup(doc->pool, cur->value);
1502 char *tmpp = strstr(tmp, "px");
1504 size_t len = strlen(tmp) - strlen(tmpp);
1505 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1508 attr_border_width = apr_pstrdup(doc->pool, tmp);
1511 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1512 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1513 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1534 if (attr_bgcolor && *attr_bgcolor){
1539 if (attr_border_width || attr_border_color ){
1540 W_L(" style=\"border:");
1541 if (attr_border_width){
1542 W_V(attr_border_width);
1549 if (attr_border_color && *attr_border_color){
1551 W_V(attr_border_color);
1563 * It is a handler who processes the TABLE tag.
1565 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1566 * destination is specified.
1567 * @param node [i] The TR tag node is specified.
1568 * @return The conversion result is returned.
1571 s_xhtml_1_0_end_table_tag(void *pdoc, Node *UNUSED(child))
1573 xhtml_t *xhtml = GET_XHTML(pdoc);
1574 Doc *doc = xhtml->doc;
1581 * It is a handler who processes the TR tag.
1583 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1584 * destination is specified.
1585 * @param node [i] The TR tag node is specified.
1586 * @return The conversion result is returned.
1589 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *node)
1591 xhtml_t *xhtml = GET_XHTML(pdoc);
1592 Doc *doc = xhtml->doc;
1594 request_rec *r = doc->r;
1597 char *attr_style = NULL;
1598 char *attr_align = NULL;
1599 char *attr_valign = NULL;
1600 char *attr_bgcolor = NULL;
1602 /*--------------------------------------------------------------------------*/
1603 /* Get Attributes */
1604 /*--------------------------------------------------------------------------*/
1605 for (attr = qs_get_attr(doc,node);
1607 attr = qs_get_next_attr(doc,attr)) {
1608 char *name = qs_get_attr_name(doc,attr);
1609 char *val = qs_get_attr_value(doc,attr);
1611 if (STRCASEEQ('a','A',"align",name)) {
1612 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1613 attr_align = apr_pstrdup(doc->buf.pool, val);
1616 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1617 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1618 attr_valign = apr_pstrdup(doc->buf.pool, val);
1621 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1622 attr_style = apr_pstrdup(doc->buf.pool, val);
1624 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1625 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1626 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1629 if (IS_CSS_ON(xhtml->entryp)) {
1630 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1632 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1633 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1634 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1636 css_property_t *cur;
1637 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1638 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1639 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1642 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1643 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1644 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1647 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1648 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1649 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1665 if (attr_bgcolor && *attr_bgcolor){
1677 * It is a handler who processes the TR tag.
1679 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1680 * destination is specified.
1681 * @param node [i] The TR tag node is specified.
1682 * @return The conversion result is returned.
1685 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1687 xhtml_t *xhtml = GET_XHTML(pdoc);
1688 Doc *doc = xhtml->doc;
1696 * It is a handler who processes the TD tag.
1698 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1699 * destination is specified.
1700 * @param node [i] The TR tag node is specified.
1701 * @return The conversion result is returned.
1704 s_xhtml_1_0_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1706 xhtml_t *xhtml = GET_XHTML(pdoc);
1707 Doc *doc = xhtml->doc;
1709 request_rec *r = doc->r;
1712 char *attr_style = NULL;
1713 char *attr_align = NULL;
1714 char *attr_valign = NULL;
1715 char *attr_bgcolor = NULL;
1716 char *attr_colspan = NULL;
1717 char *attr_rowspan = NULL;
1718 char *attr_width = NULL;
1719 char *attr_height = NULL;
1721 /*--------------------------------------------------------------------------*/
1722 /* Get Attributes */
1723 /*--------------------------------------------------------------------------*/
1724 for (attr = qs_get_attr(doc,node);
1726 attr = qs_get_next_attr(doc,attr)) {
1727 char *name = qs_get_attr_name(doc,attr);
1728 char *val = qs_get_attr_value(doc,attr);
1729 if (STRCASEEQ('a','A',"align",name)) {
1730 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1731 attr_align = apr_pstrdup(doc->buf.pool, val);
1734 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1735 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1736 attr_valign = apr_pstrdup(doc->buf.pool, val);
1739 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1740 attr_style = apr_pstrdup(doc->buf.pool, val);
1742 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1743 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1744 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1746 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1747 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1749 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1750 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1752 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1753 char *tmp = strstr(val, "%");
1755 attr_width = apr_pstrdup(doc->buf.pool, val);
1758 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1761 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1762 char *tmp = strstr(val, "%");
1764 attr_height = apr_pstrdup(doc->buf.pool, val);
1767 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1772 if (IS_CSS_ON(xhtml->entryp)) {
1773 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1775 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1776 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1777 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1778 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1779 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1781 css_property_t *cur;
1782 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1783 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1784 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1787 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1788 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1789 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1792 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1793 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1794 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1796 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1797 attr_width = apr_pstrdup(doc->pool, cur->value);
1799 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1800 attr_height = apr_pstrdup(doc->pool, cur->value);
1827 if (attr_bgcolor && *attr_bgcolor){
1832 if (attr_width || attr_height ){
1853 * It is a handler who processes the TD tag.
1855 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1856 * destination is specified.
1857 * @param node [i] The TR tag node is specified.
1858 * @return The conversion result is returned.
1861 s_xhtml_1_0_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1863 xhtml_t *xhtml = GET_XHTML(pdoc);
1864 Doc *doc = xhtml->doc;
1874 * It is a handler who processes the TD tag.
1876 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1877 * destination is specified.
1878 * @param node [i] The TD tag node is specified.
1879 * @return The conversion result is returned.
1882 s_xhtml_1_0_start_td_tag(void *pdoc, Node *child)
1884 return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"td");
1888 * It is a handler who processes the TD tag.
1890 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1891 * destination is specified.
1892 * @param node [i] The TD tag node is specified.
1893 * @return The conversion result is returned.
1896 s_xhtml_1_0_end_td_tag(void *pdoc, Node *child)
1898 return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"td");
1902 * It is a handler who processes the TD tag.
1904 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1905 * destination is specified.
1906 * @param node [i] The TH tag node is specified.
1907 * @return The conversion result is returned.
1910 s_xhtml_1_0_start_th_tag(void *pdoc, Node *child)
1912 return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"th");
1916 * It is a handler who processes the TD tag.
1918 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1919 * destination is specified.
1920 * @param node [i] The TH tag node is specified.
1921 * @return The conversion result is returned.
1924 s_xhtml_1_0_end_th_tag(void *pdoc, Node *child)
1926 return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"th");
1932 * It is a handler who processes the FONT tag.
1934 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1935 * destination is specified.
1936 * @param node [i] The FONT tag node is specified.
1937 * @return The conversion result is returned.
1940 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1942 xhtml_t *xhtml = GET_XHTML(pdoc);
1943 Doc *doc = xhtml->doc;
1945 char *attr_color = NULL;
1946 char *attr_size = NULL;
1947 char *attr_style = NULL;
1949 /*--------------------------------------------------------------------------*/
1950 /* Get Attributes */
1951 /*--------------------------------------------------------------------------*/
1952 for (attr = qs_get_attr(doc,node);
1954 attr = qs_get_next_attr(doc,attr)) {
1955 char *name = qs_get_attr_name(doc,attr);
1956 char *value = qs_get_attr_value(doc,attr);
1957 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1958 attr_color = apr_pstrdup(doc->buf.pool, value);
1960 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1961 /*----------------------------------------------------------------------*/
1963 /*----------------------------------------------------------------------*/
1964 attr_size = apr_pstrdup(doc->buf.pool, value);
1966 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1967 attr_style = apr_pstrdup(doc->buf.pool, value);
1970 if (IS_CSS_ON(xhtml->entryp)) {
1971 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1973 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1974 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1975 css_property_t *cur;
1976 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1977 if (cur->value && *cur->value) {
1978 attr_color = apr_pstrdup(doc->pool, cur->value);
1981 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1982 if (cur->value && *cur->value) {
1983 attr_size = apr_pstrdup(doc->pool, cur->value);
1984 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1985 attr_size = apr_pstrdup(doc->pool, "1");
1987 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1988 attr_size = apr_pstrdup(doc->pool, "2");
1990 else if (STRCASEEQ('s','S',"small",attr_size)) {
1991 attr_size = apr_pstrdup(doc->pool, "3");
1993 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1994 attr_size = apr_pstrdup(doc->pool, "4");
1996 else if (STRCASEEQ('l','L',"large",attr_size)) {
1997 attr_size = apr_pstrdup(doc->pool, "5");
1999 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2000 attr_size = apr_pstrdup(doc->pool, "6");
2002 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2003 attr_size = apr_pstrdup(doc->pool, "7");
2010 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2011 memset(flg, 0, sizeof(*flg));
2013 W_L("<font color=\"");
2016 flg->font_color_flag = 1;
2019 flg->font_size_flag = 1;
2020 switch(*attr_size) {
2021 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2022 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2023 case '3': W_L("<span style=\"font-size: small\">"); break;
2024 case '4': W_L("<span style=\"font-size: medium\">"); break;
2025 case '5': W_L("<span style=\"font-size: large\">"); break;
2026 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2027 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2029 if (*(attr_size + 1) == '1') {
2030 W_L("<span style=\"font-size: small\">");
2033 if (*(attr_size + 1) == '2') {
2034 W_L("<span style=\"font-size: x-small\">");
2037 if (*(attr_size + 1) == '3') {
2038 W_L("<span style=\"font-size: xx-small\">");
2041 flg->font_size_flag = 0;
2045 if (*(attr_size + 1) == '1') {
2046 W_L("<span style=\"font-size: large\">");
2049 if (*(attr_size + 1) == '2') {
2050 W_L("<span style=\"font-size: x-large\">");
2053 if (*(attr_size + 1) == '3') {
2054 W_L("<span style=\"font-size: xx-large\">");
2057 flg->font_size_flag = 0;
2061 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2062 flg->font_size_flag = 0;
2065 node->userData = flg;
2072 * It is a handler who processes the FONT tag.
2074 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2075 * destination is specified.
2076 * @param node [i] The FONT tag node is specified.
2077 * @return The conversion result is returned.
2080 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
2082 xhtml_t *xhtml = GET_XHTML(pdoc);
2083 Doc *doc = xhtml->doc;
2085 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2086 if (flg && flg->font_size_flag) {
2089 if (flg && flg->font_color_flag) {
2092 if (IS_CSS_ON(xhtml->entryp)) {
2093 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2100 * It is a handler who processes the FORM tag.
2102 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2103 * destination is specified.
2104 * @param node [i] The FORM tag node is specified.
2105 * @return The conversion result is returned.
2108 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
2110 xhtml_t *xhtml = GET_XHTML(pdoc);
2111 Doc *doc = xhtml->doc;
2112 request_rec *r = doc->r;
2114 char *attr_action = NULL;
2115 char *attr_method = NULL;
2116 char *attr_style = NULL;
2117 char *attr_color = NULL;
2118 char *attr_align = NULL;
2119 char *attr_name = NULL;
2120 char *css_clear = NULL;
2121 char *new_hidden_tag = NULL;
2123 /*--------------------------------------------------------------------------*/
2124 /* Get Attributes */
2125 /*--------------------------------------------------------------------------*/
2126 for (attr = qs_get_attr(doc,node);
2128 attr = qs_get_next_attr(doc,attr)) {
2129 char *name = qs_get_attr_name(doc,attr);
2130 char *value = qs_get_attr_value(doc,attr);
2134 if (strcasecmp(name, "action") == 0) {
2135 /*--------------------------------------------------------------------*/
2137 /*--------------------------------------------------------------------*/
2138 attr_action = value;
2144 if (strcasecmp(name, "method") == 0) {
2145 /*--------------------------------------------------------------------*/
2147 /*--------------------------------------------------------------------*/
2148 attr_method = value;
2154 if (strcasecmp(name, "name") == 0) {
2155 /*--------------------------------------------------------------------*/
2157 /*--------------------------------------------------------------------*/
2164 if (strcasecmp(name, "style") == 0) {
2173 if (IS_CSS_ON(xhtml->entryp)) {
2174 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2176 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2177 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2178 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2179 css_property_t *cur;
2180 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2181 if (STRCASEEQ('l','L',"left", cur->value)) {
2182 attr_align = apr_pstrdup(doc->pool, "left");
2184 else if (STRCASEEQ('c','C',"center",cur->value)) {
2185 attr_align = apr_pstrdup(doc->pool, "center");
2187 else if (STRCASEEQ('r','R',"right",cur->value)) {
2188 attr_align = apr_pstrdup(doc->pool, "right");
2191 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2192 attr_color = apr_pstrdup(doc->pool, cur->value);
2194 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2195 css_clear = apr_pstrdup(doc->pool, cur->value);
2200 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2204 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2205 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
2207 char *old_qs = NULL;
2208 q = strchr(attr_action, '?');
2210 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);
2211 if (new_hidden_tag || old_qs) {
2241 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
2242 memset(flg, 0, sizeof(*flg));
2244 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2245 W_L("<font color=\"");
2248 flg->with_font_flag = 1;
2251 W_L("<div align=\"");
2254 flg->with_div_flag = 1;
2256 node->userData = flg;
2257 if (new_hidden_tag) {
2258 W_V(new_hidden_tag);
2265 * It is a handler who processes the FORM tag.
2267 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2268 * destination is specified.
2269 * @param node [i] The FORM tag node is specified.
2270 * @return The conversion result is returned.
2273 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
2275 xhtml_t *xhtml = GET_XHTML(pdoc);
2276 Doc *doc = xhtml->doc;
2278 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2279 if (flg && flg->with_div_flag) {
2282 if (flg && flg->with_font_flag) {
2286 if (IS_CSS_ON(xhtml->entryp)) {
2287 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2295 * It is a handler who processes the INPUT tag.
2297 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2298 * destination is specified.
2299 * @param node [i] The INPUT tag node is specified.
2300 * @return The conversion result is returned.
2303 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
2305 xhtml_t *xhtml = GET_XHTML(pdoc);
2306 Doc *doc = xhtml->doc;
2307 request_rec *r = doc->r;
2309 char *attr_max_length = NULL;
2310 char *attr_type = NULL;
2311 char *attr_name = NULL;
2312 char *attr_value = NULL;
2313 char *attr_istyle = NULL;
2314 char *attr_size = NULL;
2315 char *attr_checked = NULL;
2316 char *attr_accesskey = NULL;
2317 char *attr_style = NULL;
2319 /*--------------------------------------------------------------------------*/
2320 /* Get Attributes */
2321 /*--------------------------------------------------------------------------*/
2322 for (attr = qs_get_attr(doc,node);
2324 attr = qs_get_next_attr(doc,attr)) {
2325 char *name = qs_get_attr_name(doc,attr);
2326 char *value = qs_get_attr_value(doc,attr);
2327 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2328 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2329 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2330 STRCASEEQ('p','P',"password",tmp_type) ||
2331 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2332 STRCASEEQ('r','R',"radio", tmp_type) ||
2333 STRCASEEQ('h','H',"hidden", tmp_type) ||
2334 STRCASEEQ('s','S',"submit", tmp_type) ||
2335 STRCASEEQ('r','R',"reset", tmp_type))) {
2336 attr_type = tmp_type;
2339 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2342 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2345 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2346 attr_istyle = value;
2348 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2349 attr_max_length = value;
2351 else if (STRCASEEQ('c','C',"checked", name)) {
2352 attr_checked = value;
2354 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2355 attr_accesskey = value;
2357 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2360 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2365 if (IS_CSS_ON(xhtml->entryp)) {
2366 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2368 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2369 css_property_t *cur;
2370 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2371 if (strcasestr(cur->value, "<ja:n>")) {
2374 else if (strcasestr(cur->value, "<ja:en>")) {
2377 else if (strcasestr(cur->value, "<ja:hk>")) {
2380 else if (strcasestr(cur->value, "<ja:h>")) {
2388 attr_type = qs_trim_string(doc->buf.pool, attr_type);
2389 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
2390 STRCASEEQ('p','P',"password",attr_type) ||
2391 STRCASEEQ('c','C',"checkbox",attr_type) ||
2392 STRCASEEQ('r','R',"radio", attr_type) ||
2393 STRCASEEQ('h','H',"hidden", attr_type) ||
2394 STRCASEEQ('s','S',"submit", attr_type) ||
2395 STRCASEEQ('r','R',"reset", attr_type))) {
2401 if (attr_size && *attr_size) {
2406 if (attr_name && *attr_name) {
2411 if (attr_value && *attr_value) {
2413 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2416 if (attr_accesskey && *attr_accesskey) {
2417 W_L(" accesskey=\"");
2418 W_V(attr_accesskey);
2421 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2426 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2427 W_L(" istyle=\"4\"");
2429 if (attr_max_length && *attr_max_length) {
2430 if (chxj_chk_numeric(attr_max_length) == 0) {
2431 W_L(" maxlength=\"");
2432 W_V(attr_max_length);
2436 /*--------------------------------------------------------------------------*/
2437 /* The figure is default for the password. */
2438 /*--------------------------------------------------------------------------*/
2439 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
2440 if (attr_max_length) {
2442 W_V(attr_max_length);
2446 W_L(" FORMAT=\"*N\"");
2450 W_L(" checked=\"checked\"");
2455 /*--------------------------------------------------------------------------*/
2456 /* Get Attributes */
2457 /*--------------------------------------------------------------------------*/
2458 type = qs_get_type_attr(doc, node, doc->buf.pool);
2459 name = qs_get_name_attr(doc, node, doc->buf.pool);
2460 value = qs_get_value_attr(doc,node, doc->buf.pool);
2461 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2462 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2463 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
2464 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2465 size = qs_get_size_attr(doc, node, doc->buf.pool);
2468 type = qs_trim_string(doc->buf.pool, type);
2469 if (type && (STRCASEEQ('t','T',"text", type) ||
2470 STRCASEEQ('p','P',"password",type) ||
2471 STRCASEEQ('c','C',"checkbox",type) ||
2472 STRCASEEQ('r','R',"radio", type) ||
2473 STRCASEEQ('h','H',"hidden", type) ||
2474 STRCASEEQ('s','S',"submit", type) ||
2475 STRCASEEQ('r','R',"reset", type))) {
2481 if (size && *size) {
2486 if (name && *name) {
2491 if (value && *value) {
2492 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2493 apr_size_t value_len = strlen(value);
2494 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
2498 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2501 if (accesskey && *accesskey) {
2502 W_L(" accesskey=\"");
2506 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2507 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
2508 if (max_length && *max_length) {
2510 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
2511 if (max_length[ii] < '0' || max_length[ii] > '9') {
2512 max_length = apr_psprintf(r->pool, "0");
2517 if (strcmp(max_length, "0")) {
2518 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
2530 if (max_length && *max_length) {
2531 if (chxj_chk_numeric(max_length) != 0) {
2532 max_length = apr_psprintf(r->pool, "0");
2534 if (strcmp(max_length, "0")) {
2535 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
2540 /*--------------------------------------------------------------------------*/
2541 /* The figure is default for the password. */
2542 /*--------------------------------------------------------------------------*/
2543 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
2550 W_L(" FORMAT=\"*N\"");
2554 W_L(" checked=\"checked\"");
2564 * It is a handler who processes the INPUT tag.
2566 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2567 * destination is specified.
2568 * @param node [i] The INPUT tag node is specified.
2569 * @return The conversion result is returned.
2572 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
2574 xhtml_t *xhtml = GET_XHTML(pdoc);
2581 * It is a handler who processes the CENTER tag.
2583 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2584 * destination is specified.
2585 * @param node [i] The CENTER tag node is specified.
2586 * @return The conversion result is returned.
2589 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2594 char *attr_style = NULL;
2595 char *attr_color = NULL;
2596 char *attr_size = NULL;
2598 xhtml = GET_XHTML(pdoc);
2601 for (attr = qs_get_attr(doc,node);
2603 attr = qs_get_next_attr(doc,attr)) {
2604 char *name = qs_get_attr_name(doc,attr);
2605 char *value = qs_get_attr_value(doc,attr);
2606 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2610 if (IS_CSS_ON(xhtml->entryp)) {
2611 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2613 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2614 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2615 css_property_t *cur;
2616 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2617 if (cur->value && *cur->value) {
2618 attr_color = apr_pstrdup(doc->pool, cur->value);
2621 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2622 if (cur->value && *cur->value) {
2623 attr_size = apr_pstrdup(doc->pool, cur->value);
2630 if (attr_size || attr_color) {
2638 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2652 * It is a handler who processes the CENTER tag.
2654 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2655 * destination is specified.
2656 * @param node [i] The CENTER tag node is specified.
2657 * @return The conversion result is returned.
2660 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2662 xhtml_t *xhtml = GET_XHTML(pdoc);
2663 Doc *doc = xhtml->doc;
2666 if (IS_CSS_ON(xhtml->entryp)) {
2667 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2674 * It is a handler who processes the HR tag.
2676 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2677 * destination is specified.
2678 * @param node [i] The HR tag node is specified.
2679 * @return The conversion result is returned.
2682 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2688 char *attr_align = NULL;
2689 char *attr_size = NULL;
2690 char *attr_width = NULL;
2691 char *attr_noshade = NULL;
2692 char *attr_style = NULL;
2693 char *attr_color = NULL;
2695 xhtml = GET_XHTML(pdoc);
2699 for (attr = qs_get_attr(doc,node);
2701 attr = qs_get_next_attr(doc,attr)) {
2702 char *name = qs_get_attr_name (doc,attr);
2703 char *value = qs_get_attr_value(doc,attr);
2707 if (strcasecmp(name, "align") == 0) {
2708 /*--------------------------------------------------------------------*/
2710 /*--------------------------------------------------------------------*/
2711 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2719 if (strcasecmp(name, "size") == 0) {
2720 /*--------------------------------------------------------------------*/
2722 /*--------------------------------------------------------------------*/
2723 if (value && *value) {
2727 else if (strcasecmp(name, "style") == 0) {
2728 if (value && *value) {
2736 if (strcasecmp(name, "width") == 0) {
2737 /*--------------------------------------------------------------------*/
2739 /*--------------------------------------------------------------------*/
2740 if (value && *value) {
2748 if (strcasecmp(name, "noshade") == 0) {
2749 /*--------------------------------------------------------------------*/
2751 /*--------------------------------------------------------------------*/
2752 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2758 if (strcasecmp(name, "color") == 0 && value && *value) {
2759 /*--------------------------------------------------------------------*/
2761 /*--------------------------------------------------------------------*/
2770 if (IS_CSS_ON(xhtml->entryp)) {
2771 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2773 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2774 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2775 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2777 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2778 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2781 css_property_t *cur;
2782 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2783 if (STRCASEEQ('s','S',"solid",cur->value)) {
2784 attr_noshade = "noshade";
2787 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2788 char *tmp = apr_pstrdup(doc->pool, cur->value);
2789 char *tmpp = strstr(tmp, "px");
2791 size_t len = strlen(tmp) - strlen(tmpp);
2792 attr_size = apr_pstrndup(doc->pool, tmp,len);
2795 char *tmp2 = strstr(tmp,"%");
2797 attr_size = apr_pstrdup(doc->pool, tmp);
2801 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2802 char *tmp = apr_pstrdup(doc->pool, cur->value);
2803 char *tmpp = strstr(tmp, "px");
2805 attr_width = apr_pstrdup(doc->pool, tmp);
2808 tmpp = strstr(tmp, "%");
2810 attr_width = apr_pstrdup(doc->pool, tmp);
2815 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2816 char *tmp = apr_pstrdup(doc->pool, cur->value);
2817 char *tmpp = strstr(tmp,"none");
2819 attr_align = "center";
2823 attr_align = apr_pstrdup(doc->pool, tmp);
2829 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2830 char *tmp = apr_pstrdup(doc->pool, cur->value);
2832 attr_color = apr_pstrdup(doc->pool, tmp);
2852 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2880 * It is a handler who processes the HR tag.
2882 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2883 * destination is specified.
2884 * @param node [i] The HR tag node is specified.
2885 * @return The conversion result is returned.
2888 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2890 xhtml_t *xhtml = GET_XHTML(pdoc);
2897 * It is a handler who processes the PRE tag.
2899 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2900 * destination is specified.
2901 * @param node [i] The PRE tag node is specified.
2902 * @return The conversion result is returned.
2905 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2907 xhtml_t *xhtml = GET_XHTML(pdoc);
2908 Doc *doc = xhtml->doc;
2910 char *attr_style = NULL;
2912 for (attr = qs_get_attr(doc,node);
2914 attr = qs_get_next_attr(doc,attr)) {
2915 char *nm = qs_get_attr_name(doc,attr);
2916 char *val = qs_get_attr_value(doc,attr);
2917 if (val && STRCASEEQ('s','S',"style", nm)) {
2922 if (IS_CSS_ON(xhtml->entryp)) {
2923 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2933 * It is a handler who processes the PRE tag.
2935 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2936 * destination is specified.
2937 * @param node [i] The PRE tag node is specified.
2938 * @return The conversion result is returned.
2941 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2943 xhtml_t *xhtml = GET_XHTML(pdoc);
2944 Doc *doc = xhtml->doc;
2948 if (IS_CSS_ON(xhtml->entryp)) {
2949 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2957 * It is a handler who processes the P tag.
2959 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2960 * destination is specified.
2961 * @param node [i] The P tag node is specified.
2962 * @return The conversion result is returned.
2965 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2967 xhtml_t *xhtml = GET_XHTML(pdoc);
2968 Doc *doc = xhtml->doc;
2970 char *attr_align = NULL;
2971 char *attr_style = NULL;
2972 char *attr_color = NULL;
2973 char *attr_blink = NULL;
2974 char *css_clear = NULL;
2976 for (attr = qs_get_attr(doc,node);
2978 attr = qs_get_next_attr(doc,attr)) {
2979 char *nm = qs_get_attr_name(doc,attr);
2980 char *val = qs_get_attr_value(doc,attr);
2981 if (STRCASEEQ('a','A',"align", nm)) {
2982 /*----------------------------------------------------------------------*/
2983 /* CHTML 1.0 (W3C version 3.2) */
2984 /*----------------------------------------------------------------------*/
2985 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2986 attr_align = apr_pstrdup(doc->buf.pool, val);
2990 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2991 attr_style = apr_pstrdup(doc->buf.pool, val);
2994 if (IS_CSS_ON(xhtml->entryp)) {
2995 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2997 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2998 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2999 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3000 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3001 css_property_t *cur;
3002 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3003 if (STRCASEEQ('l','L',"left",cur->value)) {
3004 attr_align = apr_pstrdup(doc->pool, "left");
3006 else if (STRCASEEQ('c','C',"center",cur->value)) {
3007 attr_align = apr_pstrdup(doc->pool, "center");
3009 else if (STRCASEEQ('r','R',"right",cur->value)) {
3010 attr_align = apr_pstrdup(doc->pool, "right");
3013 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3014 if (cur->value && *cur->value) {
3015 attr_color = apr_pstrdup(doc->pool, cur->value);
3018 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3019 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3020 attr_blink = apr_pstrdup(doc->pool, cur->value);
3023 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3024 css_clear = apr_pstrdup(doc->pool, cur->value);
3029 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3037 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3043 W_L("text-decoration:");
3060 * It is a handler who processes the P tag.
3062 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3063 * destination is specified.
3064 * @param node [i] The P tag node is specified.
3065 * @return The conversion result is returned.
3068 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
3070 xhtml_t *xhtml = GET_XHTML(pdoc);
3071 Doc *doc = xhtml->doc;
3074 if (IS_CSS_ON(xhtml->entryp)) {
3075 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3082 * It is a handler who processes the UL tag.
3084 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3085 * destination is specified.
3086 * @param node [i] The UL tag node is specified.
3087 * @return The conversion result is returned.
3090 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
3092 xhtml_t *xhtml = GET_XHTML(pdoc);
3093 Doc *doc = xhtml->doc;
3095 char *attr_type = NULL;
3096 char *attr_style = NULL;
3097 /*--------------------------------------------------------------------------*/
3098 /* Get Attributes */
3099 /*--------------------------------------------------------------------------*/
3100 for (attr = qs_get_attr(doc,node);
3102 attr = qs_get_next_attr(doc,attr)) {
3103 char *name = qs_get_attr_name(doc,attr);
3104 char *value = qs_get_attr_value(doc,attr);
3105 if (STRCASEEQ('t','T',"type",name)) {
3106 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3110 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3114 if (IS_CSS_ON(xhtml->entryp)) {
3115 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3117 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3118 css_property_t *cur;
3119 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3120 if (STRCASEEQ('d','D',"disc",cur->value)) {
3121 attr_type = apr_pstrdup(doc->pool, "disc");
3123 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3124 attr_type = apr_pstrdup(doc->pool, "circle");
3126 else if (STRCASEEQ('s','S',"square",cur->value)) {
3127 attr_type = apr_pstrdup(doc->pool, "square");
3135 W_L("list-style-type:");
3146 * It is a handler who processes the UL tag.
3148 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3149 * destination is specified.
3150 * @param node [i] The UL tag node is specified.
3151 * @return The conversion result is returned.
3154 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
3156 xhtml_t *xhtml = GET_XHTML(pdoc);
3157 Doc *doc = xhtml->doc;
3160 if (IS_CSS_ON(xhtml->entryp)) {
3161 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3168 * It is a handler who processes the H1 tag.
3170 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3171 * destination is specified.
3172 * @param node [i] The H1 tag node is specified.
3173 * @return The conversion result is returned.
3176 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
3178 xhtml_t *xhtml = GET_XHTML(pdoc);
3179 Doc *doc = xhtml->doc;
3181 char *attr_style = NULL;
3182 char *attr_align = NULL;
3183 char *css_clear = NULL;
3185 for (attr = qs_get_attr(doc,node);
3187 attr = qs_get_next_attr(doc,attr)) {
3188 char *name = qs_get_attr_name(doc,attr);
3189 char *value = qs_get_attr_value(doc,attr);
3190 if (STRCASEEQ('a','A',"align", name)) {
3191 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3195 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3199 if (IS_CSS_ON(xhtml->entryp)) {
3200 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3202 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3203 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3204 css_property_t *cur;
3205 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3206 if (STRCASEEQ('l','L',"left", cur->value)) {
3207 attr_align = apr_pstrdup(doc->pool, "left");
3209 else if (STRCASEEQ('c','C',"center",cur->value)) {
3210 attr_align = apr_pstrdup(doc->pool, "center");
3212 else if (STRCASEEQ('r','R',"right",cur->value)) {
3213 attr_align = apr_pstrdup(doc->pool, "right");
3216 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3217 if (STRCASEEQ('b','B',"both", cur->value)) {
3218 css_clear = apr_pstrdup(doc->pool, "both");
3220 else if (STRCASEEQ('r','R',"right", cur->value)) {
3221 css_clear = apr_pstrdup(doc->pool, "right");
3223 else if (STRCASEEQ('l','L',"left", cur->value)) {
3224 css_clear = apr_pstrdup(doc->pool, "left");
3230 if (attr_align || css_clear ) {
3251 * It is a handler who processes the H1 tag.
3253 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3254 * destination is specified.
3255 * @param node [i] The H1 tag node is specified.
3256 * @return The conversion result is returned.
3259 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
3261 xhtml_t *xhtml = GET_XHTML(pdoc);
3262 Doc *doc = xhtml->doc;
3265 if (IS_CSS_ON(xhtml->entryp)) {
3266 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3273 * It is a handler who processes the H2 tag.
3275 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3276 * destination is specified.
3277 * @param node [i] The H2 tag node is specified.
3278 * @return The conversion result is returned.
3281 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
3283 xhtml_t *xhtml = GET_XHTML(pdoc);
3284 Doc *doc = xhtml->doc;
3286 char *attr_style = NULL;
3287 char *attr_align = NULL;
3288 char *css_clear = NULL;
3290 for (attr = qs_get_attr(doc,node);
3292 attr = qs_get_next_attr(doc,attr)) {
3293 char *name = qs_get_attr_name(doc,attr);
3294 char *value = qs_get_attr_value(doc,attr);
3295 if (STRCASEEQ('a','A',"align", name)) {
3296 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3300 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3304 if (IS_CSS_ON(xhtml->entryp)) {
3305 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3307 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3308 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3309 css_property_t *cur;
3310 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3311 if (STRCASEEQ('l','L',"left", cur->value)) {
3312 attr_align = apr_pstrdup(doc->pool, "left");
3314 else if (STRCASEEQ('c','C',"center",cur->value)) {
3315 attr_align = apr_pstrdup(doc->pool, "center");
3317 else if (STRCASEEQ('r','R',"right",cur->value)) {
3318 attr_align = apr_pstrdup(doc->pool, "right");
3321 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3322 if (STRCASEEQ('b','B',"both", cur->value)) {
3323 css_clear = apr_pstrdup(doc->pool, "both");
3325 else if (STRCASEEQ('r','R',"right", cur->value)) {
3326 css_clear = apr_pstrdup(doc->pool, "right");
3328 else if (STRCASEEQ('l','L',"left", cur->value)) {
3329 css_clear = apr_pstrdup(doc->pool, "left");
3335 if (attr_align || css_clear ) {
3356 * It is a handler who processes the H2 tag.
3358 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3359 * destination is specified.
3360 * @param node [i] The H2 tag node is specified.
3361 * @return The conversion result is returned.
3364 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
3366 xhtml_t *xhtml = GET_XHTML(pdoc);
3367 Doc *doc = xhtml->doc;
3370 if (IS_CSS_ON(xhtml->entryp)) {
3371 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3378 * It is a handler who processes the H3 tag.
3380 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3381 * destination is specified.
3382 * @param node [i] The H3 tag node is specified.
3383 * @return The conversion result is returned.
3386 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
3388 xhtml_t *xhtml = GET_XHTML(pdoc);
3389 Doc *doc = xhtml->doc;
3391 char *attr_style = NULL;
3392 char *attr_align = NULL;
3393 char *css_clear = NULL;
3395 for (attr = qs_get_attr(doc,node);
3397 attr = qs_get_next_attr(doc,attr)) {
3398 char *name = qs_get_attr_name(doc,attr);
3399 char *value = qs_get_attr_value(doc,attr);
3400 if (STRCASEEQ('a','A',"align", name)) {
3401 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3405 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3409 if (IS_CSS_ON(xhtml->entryp)) {
3410 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3412 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3413 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3414 css_property_t *cur;
3415 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3416 if (STRCASEEQ('l','L',"left", cur->value)) {
3417 attr_align = apr_pstrdup(doc->pool, "left");
3419 else if (STRCASEEQ('c','C',"center",cur->value)) {
3420 attr_align = apr_pstrdup(doc->pool, "center");
3422 else if (STRCASEEQ('r','R',"right",cur->value)) {
3423 attr_align = apr_pstrdup(doc->pool, "right");
3426 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3427 if (STRCASEEQ('b','B',"both", cur->value)) {
3428 css_clear = apr_pstrdup(doc->pool, "both");
3430 else if (STRCASEEQ('r','R',"right", cur->value)) {
3431 css_clear = apr_pstrdup(doc->pool, "right");
3433 else if (STRCASEEQ('l','L',"left", cur->value)) {
3434 css_clear = apr_pstrdup(doc->pool, "left");
3440 if (attr_align || css_clear ) {
3461 * It is a handler who processes the H3 tag.
3463 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3464 * destination is specified.
3465 * @param node [i] The H3 tag node is specified.
3466 * @return The conversion result is returned.
3469 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
3471 xhtml_t *xhtml = GET_XHTML(pdoc);
3472 Doc *doc = xhtml->doc;
3475 if (IS_CSS_ON(xhtml->entryp)) {
3476 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3484 * It is a handler who processes the H4 tag.
3486 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3487 * destination is specified.
3488 * @param node [i] The H4 tag node is specified.
3489 * @return The conversion result is returned.
3492 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
3494 xhtml_t *xhtml = GET_XHTML(pdoc);
3495 Doc *doc = xhtml->doc;
3497 char *attr_style = NULL;
3498 char *attr_align = NULL;
3499 char *css_clear = NULL;
3501 for (attr = qs_get_attr(doc,node);
3503 attr = qs_get_next_attr(doc,attr)) {
3504 char *name = qs_get_attr_name(doc,attr);
3505 char *value = qs_get_attr_value(doc,attr);
3506 if (STRCASEEQ('a','A',"align", name)) {
3507 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3511 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3515 if (IS_CSS_ON(xhtml->entryp)) {
3516 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3518 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3519 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3520 css_property_t *cur;
3521 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3522 if (STRCASEEQ('l','L',"left", cur->value)) {
3523 attr_align = apr_pstrdup(doc->pool, "left");
3525 else if (STRCASEEQ('c','C',"center",cur->value)) {
3526 attr_align = apr_pstrdup(doc->pool, "center");
3528 else if (STRCASEEQ('r','R',"right",cur->value)) {
3529 attr_align = apr_pstrdup(doc->pool, "right");
3532 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3533 if (STRCASEEQ('b','B',"both", cur->value)) {
3534 css_clear = apr_pstrdup(doc->pool, "both");
3536 else if (STRCASEEQ('r','R',"right", cur->value)) {
3537 css_clear = apr_pstrdup(doc->pool, "right");
3539 else if (STRCASEEQ('l','L',"left", cur->value)) {
3540 css_clear = apr_pstrdup(doc->pool, "left");
3546 if (attr_align || css_clear ) {
3567 * It is a handler who processes the H4 tag.
3569 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3570 * destination is specified.
3571 * @param node [i] The H4 tag node is specified.
3572 * @return The conversion result is returned.
3575 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
3577 xhtml_t *xhtml = GET_XHTML(pdoc);
3578 Doc *doc = xhtml->doc;
3581 if (IS_CSS_ON(xhtml->entryp)) {
3582 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3590 * It is a handler who processes the H5 tag.
3592 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3593 * destination is specified.
3594 * @param node [i] The H5 tag node is specified.
3595 * @return The conversion result is returned.
3598 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
3600 xhtml_t *xhtml = GET_XHTML(pdoc);
3601 Doc *doc = xhtml->doc;
3603 char *attr_style = NULL;
3604 char *attr_align = NULL;
3605 char *css_clear = NULL;
3607 for (attr = qs_get_attr(doc,node);
3609 attr = qs_get_next_attr(doc,attr)) {
3610 char *name = qs_get_attr_name(doc,attr);
3611 char *value = qs_get_attr_value(doc,attr);
3612 if (STRCASEEQ('a','A',"align", name)) {
3613 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3617 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3621 if (IS_CSS_ON(xhtml->entryp)) {
3622 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3624 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3625 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3626 css_property_t *cur;
3627 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3628 if (STRCASEEQ('l','L',"left", cur->value)) {
3629 attr_align = apr_pstrdup(doc->pool, "left");
3631 else if (STRCASEEQ('c','C',"center",cur->value)) {
3632 attr_align = apr_pstrdup(doc->pool, "center");
3634 else if (STRCASEEQ('r','R',"right",cur->value)) {
3635 attr_align = apr_pstrdup(doc->pool, "right");
3638 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3639 if (STRCASEEQ('b','B',"both", cur->value)) {
3640 css_clear = apr_pstrdup(doc->pool, "both");
3642 else if (STRCASEEQ('r','R',"right", cur->value)) {
3643 css_clear = apr_pstrdup(doc->pool, "right");
3645 else if (STRCASEEQ('l','L',"left", cur->value)) {
3646 css_clear = apr_pstrdup(doc->pool, "left");
3652 if (attr_align || css_clear ) {
3673 * It is a handler who processes the H5 tag.
3675 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3676 * destination is specified.
3677 * @param node [i] The H5 tag node is specified.
3678 * @return The conversion result is returned.
3681 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
3683 xhtml_t *xhtml = GET_XHTML(pdoc);
3684 Doc *doc = xhtml->doc;
3687 if (IS_CSS_ON(xhtml->entryp)) {
3688 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3696 * It is a handler who processes the H6 tag.
3698 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3699 * destination is specified.
3700 * @param node [i] The H6 tag node is specified.
3701 * @return The conversion result is returned.
3704 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
3706 xhtml_t *xhtml = GET_XHTML(pdoc);
3707 Doc *doc = xhtml->doc;
3709 char *attr_style = NULL;
3710 char *attr_align = NULL;
3711 char *css_clear = NULL;
3713 for (attr = qs_get_attr(doc,node);
3715 attr = qs_get_next_attr(doc,attr)) {
3716 char *name = qs_get_attr_name(doc,attr);
3717 char *value = qs_get_attr_value(doc,attr);
3718 if (STRCASEEQ('a','A',"align", name)) {
3719 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3723 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3727 if (IS_CSS_ON(xhtml->entryp)) {
3728 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3730 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3731 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3732 css_property_t *cur;
3733 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3734 if (STRCASEEQ('l','L',"left", cur->value)) {
3735 attr_align = apr_pstrdup(doc->pool, "left");
3737 else if (STRCASEEQ('c','C',"center",cur->value)) {
3738 attr_align = apr_pstrdup(doc->pool, "center");
3740 else if (STRCASEEQ('r','R',"right",cur->value)) {
3741 attr_align = apr_pstrdup(doc->pool, "right");
3744 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3745 if (STRCASEEQ('b','B',"both", cur->value)) {
3746 css_clear = apr_pstrdup(doc->pool, "both");
3748 else if (STRCASEEQ('r','R',"right", cur->value)) {
3749 css_clear = apr_pstrdup(doc->pool, "right");
3751 else if (STRCASEEQ('l','L',"left", cur->value)) {
3752 css_clear = apr_pstrdup(doc->pool, "left");
3758 if (attr_align || css_clear ) {
3779 * It is a handler who processes the H6 tag.
3781 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3782 * destination is specified.
3783 * @param node [i] The H6 tag node is specified.
3784 * @return The conversion result is returned.
3787 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3789 xhtml_t *xhtml = GET_XHTML(pdoc);
3790 Doc *doc = xhtml->doc;
3793 if (IS_CSS_ON(xhtml->entryp)) {
3794 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3802 * It is a handler who processes the OL tag.
3804 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3805 * destination is specified.
3806 * @param node [i] The OL tag node is specified.
3807 * @return The conversion result is returned.
3810 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3812 xhtml_t *xhtml = GET_XHTML(pdoc);
3813 Doc *doc = xhtml->doc;
3815 char *attr_style = NULL;
3816 char *attr_start = NULL;
3817 char *attr_type = NULL;
3819 /*--------------------------------------------------------------------------*/
3820 /* Get Attributes */
3821 /*--------------------------------------------------------------------------*/
3822 for (attr = qs_get_attr(doc,node);
3824 attr = qs_get_next_attr(doc,attr)) {
3825 char *name = qs_get_attr_name(doc,attr);
3826 char *value = qs_get_attr_value(doc,attr);
3827 if (STRCASEEQ('t','T',"type",name) && value) {
3828 if (*value == '1') {
3829 attr_type = apr_pstrdup(doc->pool, "decimal");
3831 else if (*value == 'a') {
3832 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3834 else if (*value == 'A') {
3835 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3838 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3841 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3845 if (IS_CSS_ON(xhtml->entryp)) {
3846 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3848 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3849 css_property_t *cur;
3850 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3851 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3852 attr_type = apr_pstrdup(doc->pool, "decimal");
3854 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3855 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3857 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3858 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3866 W_L("list-style-type:");
3883 * It is a handler who processes the OL tag.
3885 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3886 * destination is specified.
3887 * @param node [i] The OL tag node is specified.
3888 * @return The conversion result is returned.
3891 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3893 xhtml_t *xhtml = GET_XHTML(pdoc);
3894 Doc *doc = xhtml->doc;
3897 if (IS_CSS_ON(xhtml->entryp)) {
3898 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3906 * It is a handler who processes the LI tag.
3908 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3909 * destination is specified.
3910 * @param node [i] The LI tag node is specified.
3911 * @return The conversion result is returned.
3914 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3916 xhtml_t *xhtml = GET_XHTML(pdoc);
3917 Doc *doc = xhtml->doc;
3919 char *attr_type = NULL;
3920 char *attr_value = NULL;
3921 char *attr_style = NULL;
3923 for (attr = qs_get_attr(doc,node);
3925 attr = qs_get_next_attr(doc,attr)) {
3926 char *name = qs_get_attr_name(doc,attr);
3927 char *value = qs_get_attr_value(doc,attr);
3928 if (STRCASEEQ('t','T',"type",name)) {
3929 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3930 if (*value == '1') {
3931 attr_type = apr_pstrdup(doc->pool, "decimal");
3933 else if (*value == 'a') {
3934 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3936 else if (*value == 'A') {
3937 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3944 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3947 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3951 if (IS_CSS_ON(xhtml->entryp)) {
3952 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3954 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3955 css_property_t *cur;
3956 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3957 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3958 attr_type = apr_pstrdup(doc->pool, "decimal");
3960 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3961 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3963 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3964 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3966 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3967 attr_type = apr_pstrdup(doc->pool, "disc");
3969 else if (STRCASEEQ('s','S',"square", cur->value)) {
3970 attr_type = apr_pstrdup(doc->pool, "square");
3972 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3973 attr_type = apr_pstrdup(doc->pool, "circle");
3983 W_L("list-style-type:");
3999 ** It is a handler who processes the LI tag.
4001 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4002 * destination is specified.
4003 * @param node [i] The LI tag node is specified.
4004 * @return The conversion result is returned.
4007 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
4009 xhtml_t *xhtml = GET_XHTML(pdoc);
4010 Doc *doc = xhtml->doc;
4013 if (IS_CSS_ON(xhtml->entryp)) {
4014 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4020 * It is a handler who processes the IMG tag.
4022 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4023 * destination is specified.
4024 * @param node [i] The IMG tag node is specified.
4025 * @return The conversion result is returned.
4028 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
4030 xhtml_t *xhtml = GET_XHTML(pdoc);
4031 Doc *doc = xhtml->doc;
4032 request_rec *r = doc->r;
4034 char *attr_src = NULL;
4035 char *attr_alt = NULL;
4036 char *attr_height = NULL;
4037 char *attr_width = NULL;
4038 char *attr_align = NULL;
4039 char *attr_style = NULL;
4040 char *attr_hspace = NULL;
4041 char *attr_vspace = NULL;
4043 char *css_margin_left = NULL;
4044 char *css_margin_right = NULL;
4045 char *css_margin_top = NULL;
4046 char *css_margin_bottom = NULL;
4047 char *css_display = NULL;
4048 char *css_valign = NULL;
4051 #ifndef IMG_NOT_CONVERT_FILENAME
4052 device_table *spec = xhtml->spec;
4055 /*--------------------------------------------------------------------------*/
4056 /* Get Attributes */
4057 /*--------------------------------------------------------------------------*/
4058 for (attr = qs_get_attr(doc,node);
4060 attr = qs_get_next_attr(doc,attr)) {
4061 char *name = qs_get_attr_name(doc,attr);
4062 char *value = qs_get_attr_value(doc,attr);
4064 if (STRCASEEQ('s','S',"src",name)) {
4065 value = chxj_encoding_parameter(r, value, 1);
4066 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
4067 value = chxj_add_cookie_no_update_parameter(r, value);
4068 #ifdef IMG_NOT_CONVERT_FILENAME
4074 attr_src = chxj_img_conv(r,spec,value);
4080 if (STRCASEEQ('a','A',"align",name)) {
4082 if (STRCASEEQ('t','T',"top", value) ||
4083 STRCASEEQ('m','M',"middle",value) ||
4084 STRCASEEQ('b','B',"bottom",value)) {
4087 else if( STRCASEEQ('l','L',"left", value) ||
4088 STRCASEEQ('r','R',"right", value)) {
4091 else if (STRCASEEQ('c','C',"center", value)) {
4092 css_valign = apr_pstrdup(doc->pool, "middle");
4096 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
4099 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
4102 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
4103 attr_height = value;
4105 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
4106 attr_hspace = value;
4108 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
4109 attr_vspace = value;
4111 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4116 if (IS_CSS_ON(xhtml->entryp)) {
4117 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4119 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
4120 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
4121 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
4122 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
4123 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
4124 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
4125 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
4127 css_property_t *cur;
4128 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
4129 attr_height = apr_pstrdup(doc->pool, cur->value);
4131 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
4132 attr_width = apr_pstrdup(doc->pool, cur->value);
4135 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
4136 css_valign = apr_pstrdup(doc->pool, cur->value);
4140 if (! attr_hspace) {
4141 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
4142 css_margin_left = apr_pstrdup(doc->pool, cur->value);
4144 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
4145 css_margin_right = apr_pstrdup(doc->pool, cur->value);
4149 if (! attr_vspace) {
4150 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
4151 css_margin_top = apr_pstrdup(doc->pool, cur->value);
4153 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
4154 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
4158 // float:[left|right] -> align
4160 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
4161 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
4162 attr_align = apr_pstrdup(doc->pool, cur->value);
4165 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4166 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4167 char *tmp = apr_pstrdup(doc->pool, cur->value);
4168 char *tmpp = strstr(tmp, "none");
4170 css_display = apr_pstrdup(doc->pool, tmp);
4197 if (attr_hspace || attr_vspace || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
4200 W_L("vertical-align:");
4205 W_L("margin-left:");
4208 W_L("margin-right:");
4213 if(css_margin_left){
4214 W_L("margin-left:");
4215 W_V(css_margin_left);
4218 if(css_margin_right){
4219 W_L("margin-right:");
4220 W_V(css_margin_right);
4228 W_L("margin-bottom:");
4235 W_V(css_margin_top);
4238 if(css_margin_bottom){
4239 W_L("margin-bottom:");
4240 W_V(css_margin_bottom);
4245 W_L("display:none;");
4263 * It is a handler who processes the IMG tag.
4265 * @param xhtml [i/o] The pointer to the XHTML structure at the output
4266 * destination is specified.
4267 * @param node [i] The IMG tag node is specified.
4268 * @return The conversion result is returned.
4271 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
4273 xhtml_t *xhtml = GET_XHTML(pdoc);
4280 * It is a handler who processes the SELECT tag.
4282 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4283 * destination is specified.
4284 * @param node [i] The SELECT tag node is specified.
4285 * @return The conversion result is returned.
4288 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
4290 xhtml_t *xhtml = GET_XHTML(pdoc);
4291 Doc *doc = xhtml->doc;
4294 char *multiple = NULL;
4296 char *attr_style = NULL;
4299 for (attr = qs_get_attr(doc,node);
4301 attr = qs_get_next_attr(doc,attr)) {
4302 char *nm = qs_get_attr_name(doc,attr);
4303 char *val = qs_get_attr_value(doc,attr);
4304 if (STRCASEEQ('s','S',"size",nm)) {
4305 /*----------------------------------------------------------------------*/
4306 /* CHTML 1.0 version 2.0 */
4307 /*----------------------------------------------------------------------*/
4308 size = apr_pstrdup(doc->buf.pool, val);
4310 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4311 /*----------------------------------------------------------------------*/
4312 /* CHTML 1.0 version 2.0 */
4313 /*----------------------------------------------------------------------*/
4314 attr_style = apr_pstrdup(doc->buf.pool, val);
4316 else if (STRCASEEQ('n','N',"name",nm)) {
4317 /*----------------------------------------------------------------------*/
4318 /* CHTML 1.0 version 2.0 */
4319 /*----------------------------------------------------------------------*/
4320 name = apr_pstrdup(doc->buf.pool, val);
4322 else if (STRCASEEQ('m','M',"multiple",nm)) {
4323 /*----------------------------------------------------------------------*/
4324 /* CHTML 1.0 version 2.0 */
4325 /*----------------------------------------------------------------------*/
4326 multiple = apr_pstrdup(doc->buf.pool, val);
4329 if (size && *size) {
4334 if (name && *name) {
4340 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
4341 W_L(" multiple=\"true\"");
4344 if (IS_CSS_ON(xhtml->entryp)) {
4345 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4353 * It is a handler who processes the SELECT tag.
4355 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4356 * destination is specified.
4357 * @param node [i] The SELECT tag node is specified.
4358 * @return The conversion result is returned.
4361 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
4363 xhtml_t *xhtml = GET_XHTML(pdoc);
4364 Doc *doc = xhtml->doc;
4367 if (IS_CSS_ON(xhtml->entryp)) {
4368 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4375 * It is a handler who processes the OPTION tag.
4377 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4378 * destination is specified.
4379 * @param node [i] The OPTION tag node is specified.
4380 * @return The conversion result is returned.
4383 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
4385 xhtml_t *xhtml = GET_XHTML(pdoc);
4386 Doc *doc = xhtml->doc;
4388 char *attr_style = NULL;
4390 char *selected = NULL;
4394 for (attr = qs_get_attr(doc,node);
4396 attr = qs_get_next_attr(doc,attr)) {
4397 char *nm = qs_get_attr_name(doc,attr);
4398 char *val = qs_get_attr_value(doc,attr);
4399 if (STRCASEEQ('s','S',"selected",nm)) {
4400 /* CHTML version 2.0 */
4401 selected = apr_pstrdup(doc->buf.pool, val);
4403 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4404 /* CHTML version 2.0 */
4405 attr_style = apr_pstrdup(doc->buf.pool, val);
4407 else if (STRCASEEQ('v','V',"value",nm)) {
4408 /* CHTML version 2.0 */
4409 value = apr_pstrdup(doc->buf.pool, val);
4418 W_L(" selected=\"selected\"");
4421 if (IS_CSS_ON(xhtml->entryp)) {
4422 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4429 * It is a handler who processes the OPTION tag.
4431 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4432 * destination is specified.
4433 * @param node [i] The OPTION tag node is specified.
4434 * @return The conversion result is returned.
4437 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
4439 xhtml_t *xhtml = GET_XHTML(pdoc);
4440 Doc *doc = xhtml->doc;
4443 if (IS_CSS_ON(xhtml->entryp)) {
4444 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4452 * It is a handler who processes the DIV tag.
4454 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4455 * destination is specified.
4456 * @param node [i] The DIV tag node is specified.
4457 * @return The conversion result is returned.
4460 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
4462 xhtml_t *xhtml = GET_XHTML(pdoc);
4463 Doc *doc = xhtml->doc;
4465 char *attr_style = NULL;
4466 char *attr_align = NULL;
4467 char *attr_display = NULL;
4468 char *attr_decoration = NULL;
4469 char *attr_wap_marquee_style = NULL;
4470 char *attr_wap_marquee_dir = NULL;
4471 char *attr_wap_marquee_loop = NULL;
4472 char *attr_color = NULL;
4473 char *attr_bgcolor = NULL;
4474 char *attr_font_size = NULL;
4475 char *css_clear = NULL;
4477 for (attr = qs_get_attr(doc,node);
4479 attr = qs_get_next_attr(doc,attr)) {
4480 char *nm = qs_get_attr_name(doc,attr);
4481 char *val = qs_get_attr_value(doc,attr);
4482 if (STRCASEEQ('a','A',"align",nm)) {
4483 /*----------------------------------------------------------------------*/
4484 /* CHTML 1.0 (W3C version 3.2) */
4485 /*----------------------------------------------------------------------*/
4486 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4487 attr_align = apr_pstrdup(doc->buf.pool, val);
4490 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4491 attr_style = apr_pstrdup(doc->buf.pool, val);
4495 if (IS_CSS_ON(xhtml->entryp)) {
4496 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4498 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4499 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4500 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4501 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4502 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4503 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4504 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4505 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4507 css_property_t *cur;
4508 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4509 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4510 attr_display = apr_pstrdup(doc->pool, cur->value);
4513 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4514 if (STRCASEEQ('b','B',"blink", cur->value)) {
4515 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4518 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4519 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4520 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4522 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4523 char *ss = strchr(cur->value, '#');
4525 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4526 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4529 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4530 attr_color = apr_pstrdup(doc->pool, cur->value);
4532 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4533 attr_align = apr_pstrdup(doc->pool, cur->value);
4535 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4536 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4537 || STRCASEEQ('x','X',"x-small",cur->value)
4538 || STRCASEEQ('s','S',"small",cur->value)
4539 || STRCASEEQ('m','M',"medium",cur->value)
4540 || STRCASEEQ('l','L',"large",cur->value)
4541 || STRCASEEQ('x','X',"x-large",cur->value)
4542 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4543 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4547 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4548 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4549 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4550 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4551 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4552 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4555 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4556 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4557 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4559 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4560 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4563 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4564 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4565 attr_wap_marquee_loop = "infinite";
4568 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4572 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4573 css_clear = apr_pstrdup(doc->pool, cur->value);
4581 || attr_wap_marquee_style
4582 || attr_wap_marquee_dir
4583 || attr_wap_marquee_loop
4599 if (attr_decoration) {
4600 W_L("text-decoration:");
4601 W_V(attr_decoration);
4604 if (attr_wap_marquee_style) {
4605 W_L("-wap-marquee-style:");
4606 W_V(attr_wap_marquee_style);
4609 if (attr_wap_marquee_dir) {
4610 W_L("-wap-marquee-dir:");
4611 W_V(attr_wap_marquee_dir);
4614 if (attr_wap_marquee_loop) {
4615 W_L("-wap-marquee-loop:");
4616 W_V(attr_wap_marquee_loop);
4625 W_L("background-color:");
4629 if (attr_font_size) {
4631 W_V(attr_font_size);
4647 * It is a handler who processes the DIV tag.
4649 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4650 * destination is specified.
4651 * @param node [i] The DIV tag node is specified.
4652 * @return The conversion result is returned.
4655 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
4657 xhtml_t *xhtml = GET_XHTML(pdoc);
4658 Doc *doc = xhtml->doc;
4660 if (IS_CSS_ON(xhtml->entryp)) {
4661 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4668 * It is a handler who processes the B tag.
4670 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4671 * destination is specified.
4672 * @param node [i] The B tag node is specified.
4673 * @return The conversion result is returned.
4676 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
4678 xhtml_t *xhtml = GET_XHTML(pdoc);
4679 Doc *doc = xhtml->doc;
4681 W_L("<div style=\"font-weight:bold\">");
4687 * It is a handler who processes the B tag.
4689 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4690 * destination is specified.
4691 * @param node [i] The B tag node is specified.
4692 * @return The conversion result is returned.
4695 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
4697 xhtml_t *xhtml = GET_XHTML(pdoc);
4698 Doc *doc = xhtml->doc;
4706 * It is a handler who processes the CHXJ:IF tag.
4708 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4709 * destination is specified.
4710 * @param node [i] The CHXJ:IF tag node is specified.
4713 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
4715 xhtml_t *xhtml = GET_XHTML(pdoc);
4716 Doc *doc = xhtml->doc;
4719 for (child = qs_get_child_node(doc, node);
4721 child = qs_get_next_node(doc, child)) {
4723 s_xhtml_1_0_chxjif_tag(xhtml, child);
4731 * It is a handler who processes the TEXTARE tag.
4733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4734 * destination is specified.
4735 * @param node [i] The TEXTAREA tag node is specified.
4736 * @return The conversion result is returned.
4739 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
4741 xhtml_t *xhtml = GET_XHTML(pdoc);
4742 Doc *doc = xhtml->doc;
4744 char *attr_accesskey = NULL;
4745 char *attr_name = NULL;
4746 char *attr_rows = NULL;
4747 char *attr_cols = NULL;
4748 char *attr_istyle = NULL;
4749 char *attr_style = NULL;
4751 xhtml->textarea_flag++;
4752 for (attr = qs_get_attr(doc,node);
4754 attr = qs_get_next_attr(doc,attr)) {
4755 char *name = qs_get_attr_name(doc,attr);
4756 char *value = qs_get_attr_value(doc,attr);
4757 if (STRCASEEQ('n','N',"name",name) && value && *value) {
4760 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
4763 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
4766 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4767 attr_istyle = value;
4769 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
4775 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4776 attr_accesskey = value;
4778 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
4782 if (IS_CSS_ON(xhtml->entryp)) {
4783 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4785 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4786 css_property_t *cur;
4787 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4788 if (strcasestr(cur->value, "<ja:n>")) {
4791 else if (strcasestr(cur->value, "<ja:en>")) {
4794 else if (strcasestr(cur->value, "<ja:hk>")) {
4797 else if (strcasestr(cur->value, "<ja:h>")) {
4804 if (attr_accesskey) {
4805 W_L(" accesskey=\"");
4806 W_V(attr_accesskey);
4835 * It is a handler who processes the TEXTAREA tag.
4837 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4838 * destination is specified.
4839 * @param node [i] The TEXTAREA tag node is specified.
4840 * @return The conversion result is returned.
4843 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4845 xhtml_t *xhtml = GET_XHTML(pdoc);
4846 Doc *doc = xhtml->doc;
4849 xhtml->textarea_flag--;
4855 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
4857 xhtml_t *xhtml = GET_XHTML(pdoc);
4858 Doc *doc = xhtml->doc;
4859 request_rec *r = doc->r;
4866 apr_size_t z2h_input_len;
4868 textval = qs_get_node_value(doc,child);
4869 if (strlen(textval) == 0) {
4873 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4874 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4876 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4877 memset(one_byte, 0, sizeof(one_byte));
4880 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4882 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4884 DBG(r,"[%s][%d]", out, rtn);
4885 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4889 if (is_sjis_kanji(textval[ii])) {
4890 one_byte[0] = textval[ii+0];
4891 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4892 one_byte[0] = textval[ii+1];
4893 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4896 else if (xhtml->pre_flag) {
4897 one_byte[0] = textval[ii+0];
4898 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4900 else if (xhtml->textarea_flag) {
4901 one_byte[0] = textval[ii+0];
4902 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4904 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4905 one_byte[0] = textval[ii+0];
4906 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4909 z2h_input_len = strlen(tdst);
4910 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4918 * It is a handler who processes the BLOCKQUOTE tag.
4920 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4921 * destination is specified.
4922 * @param node [i] The BLOCKQUOTE tag node is specified.
4923 * @return The conversion result is returned.
4926 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4931 char *attr_style = NULL;
4932 char *attr_color = NULL;
4933 char *attr_size = NULL;
4935 xhtml = GET_XHTML(pdoc);
4937 for (attr = qs_get_attr(doc,node);
4939 attr = qs_get_next_attr(doc,attr)) {
4940 char *nm = qs_get_attr_name(doc,attr);
4941 char *val = qs_get_attr_value(doc,attr);
4942 if (val && STRCASEEQ('s','S',"style", nm)) {
4946 if (IS_CSS_ON(xhtml->entryp)) {
4947 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4949 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4950 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4951 css_property_t *cur;
4952 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4953 if (cur->value && *cur->value) {
4954 attr_color = apr_pstrdup(doc->pool, cur->value);
4957 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4958 if (cur->value && *cur->value) {
4959 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4960 attr_size = apr_pstrdup(doc->pool, cur->value);
4962 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4963 attr_size = apr_pstrdup(doc->pool, cur->value);
4965 else if (STRCASEEQ('s','S',"small",cur->value)) {
4966 attr_size = apr_pstrdup(doc->pool, cur->value);
4968 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4969 attr_size = apr_pstrdup(doc->pool, cur->value);
4971 else if (STRCASEEQ('l','L',"large",cur->value)) {
4972 attr_size = apr_pstrdup(doc->pool, cur->value);
4974 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4975 attr_size = apr_pstrdup(doc->pool, cur->value);
4977 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4978 attr_size = apr_pstrdup(doc->pool, cur->value);
4985 if (attr_color || attr_size) {
4988 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5006 * It is a handler who processes the BLOCKQUOTE tag.
5008 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5009 * destination is specified.
5010 * @param node [i] The BLOCKQUOTE tag node is specified.
5011 * @return The conversion result is returned.
5014 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
5016 xhtml_t *xhtml = GET_XHTML(pdoc);
5017 Doc *doc = xhtml->doc;
5018 W_L("</blockquote>");
5019 if (IS_CSS_ON(xhtml->entryp)) {
5020 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5027 * It is a handler who processes the DIR tag.
5029 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5030 * destination is specified.
5031 * @param node [i] The DIR tag node is specified.
5032 * @return The conversion result is returned.
5035 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
5037 xhtml_t *xhtml = GET_XHTML(pdoc);
5038 Doc *doc = xhtml->doc;
5040 char *attr_style = NULL;
5041 char *attr_color = NULL;
5042 char *attr_type = NULL;
5043 char *attr_size = NULL;
5044 for (attr = qs_get_attr(doc,node);
5046 attr = qs_get_next_attr(doc,attr)) {
5047 char *name = qs_get_attr_name(doc,attr);
5048 char *value = qs_get_attr_value(doc,attr);
5049 if (STRCASEEQ('t','T',"type",name)) {
5050 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5054 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5058 if (IS_CSS_ON(xhtml->entryp)) {
5059 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5061 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5062 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5063 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5064 css_property_t *cur;
5065 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5066 if (cur->value && *cur->value) {
5067 attr_color = apr_pstrdup(doc->pool, cur->value);
5070 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5071 if (cur->value && *cur->value) {
5072 attr_type = apr_pstrdup(doc->pool, cur->value);
5075 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5076 if (cur->value && *cur->value) {
5077 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5078 attr_size = apr_pstrdup(doc->pool, cur->value);
5080 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5081 attr_size = apr_pstrdup(doc->pool, cur->value);
5083 else if (STRCASEEQ('s','S',"small",cur->value)) {
5084 attr_size = apr_pstrdup(doc->pool, cur->value);
5086 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5087 attr_size = apr_pstrdup(doc->pool, cur->value);
5089 else if (STRCASEEQ('l','L',"large",cur->value)) {
5090 attr_size = apr_pstrdup(doc->pool, cur->value);
5092 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5093 attr_size = apr_pstrdup(doc->pool, cur->value);
5095 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5096 attr_size = apr_pstrdup(doc->pool, cur->value);
5103 if (attr_type || attr_color || attr_size) {
5106 W_L("list-style-type:");
5111 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5129 * It is a handler who processes the DIR tag.
5131 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5132 * destination is specified.
5133 * @param node [i] The DIR tag node is specified.
5134 * @return The conversion result is returned.
5137 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
5139 xhtml_t *xhtml = GET_XHTML(pdoc);
5140 Doc *doc = xhtml->doc;
5142 if (IS_CSS_ON(xhtml->entryp)) {
5143 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5150 * It is a handler who processes the DL tag.
5152 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5153 * destination is specified.
5154 * @param node [i] The DL tag node is specified.
5155 * @return The conversion result is returned.
5158 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
5160 xhtml_t *xhtml = GET_XHTML(pdoc);
5161 Doc *doc = xhtml->doc;
5163 char *attr_style = NULL;
5164 char *attr_color = NULL;
5165 char *attr_size = NULL;
5167 for (attr = qs_get_attr(doc,node);
5169 attr = qs_get_next_attr(doc,attr)) {
5170 char *name = qs_get_attr_name(doc,attr);
5171 char *value = qs_get_attr_value(doc,attr);
5172 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5176 if (IS_CSS_ON(xhtml->entryp)) {
5177 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5179 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5180 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5181 css_property_t *cur;
5182 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5183 if (cur->value && *cur->value) {
5184 attr_color = apr_pstrdup(doc->pool, cur->value);
5187 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5188 if (cur->value && *cur->value) {
5189 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5190 attr_size = apr_pstrdup(doc->pool, cur->value);
5192 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5193 attr_size = apr_pstrdup(doc->pool, cur->value);
5195 else if (STRCASEEQ('s','S',"small",cur->value)) {
5196 attr_size = apr_pstrdup(doc->pool, cur->value);
5198 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5199 attr_size = apr_pstrdup(doc->pool, cur->value);
5201 else if (STRCASEEQ('l','L',"large",cur->value)) {
5202 attr_size = apr_pstrdup(doc->pool, cur->value);
5204 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5205 attr_size = apr_pstrdup(doc->pool, cur->value);
5207 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5208 attr_size = apr_pstrdup(doc->pool, cur->value);
5215 if (attr_color || attr_size) {
5218 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5236 * It is a handler who processes the DL tag.
5238 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5239 * destination is specified.
5240 * @param node [i] The DL tag node is specified.
5241 * @return The conversion result is returned.
5244 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
5246 xhtml_t *xhtml = GET_XHTML(pdoc);
5247 Doc *doc = xhtml->doc;
5249 if (IS_CSS_ON(xhtml->entryp)) {
5250 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5257 * It is a handter who processes the DT tag.
5259 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5260 * destination is specified.
5261 * @param node [i] The DT tag node is specified.
5262 * @return The conversion result is returned.
5265 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
5267 xhtml_t *xhtml = GET_XHTML(pdoc);
5268 Doc *doc = xhtml->doc;
5270 char *attr_style = NULL;
5271 char *attr_color = NULL;
5272 char *attr_size = NULL;
5274 for (attr = qs_get_attr(doc,node);
5276 attr = qs_get_next_attr(doc,attr)) {
5277 char *name = qs_get_attr_name(doc,attr);
5278 char *value = qs_get_attr_value(doc,attr);
5279 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5283 if (IS_CSS_ON(xhtml->entryp)) {
5284 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5286 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5287 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5288 css_property_t *cur;
5289 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5290 if (cur->value && *cur->value) {
5291 attr_color = apr_pstrdup(doc->pool, cur->value);
5294 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5295 if (cur->value && *cur->value) {
5296 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5297 attr_size = apr_pstrdup(doc->pool, cur->value);
5299 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5300 attr_size = apr_pstrdup(doc->pool, cur->value);
5302 else if (STRCASEEQ('s','S',"small",cur->value)) {
5303 attr_size = apr_pstrdup(doc->pool, cur->value);
5305 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5306 attr_size = apr_pstrdup(doc->pool, cur->value);
5308 else if (STRCASEEQ('l','L',"large",cur->value)) {
5309 attr_size = apr_pstrdup(doc->pool, cur->value);
5311 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5312 attr_size = apr_pstrdup(doc->pool, cur->value);
5314 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5315 attr_size = apr_pstrdup(doc->pool, cur->value);
5322 if (attr_color || attr_size) {
5325 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5343 * It is a handter who processes the DT tag.
5345 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5346 * destination is specified.
5347 * @param node [i] The DT tag node is specified.
5348 * @return The conversion result is returned.
5351 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
5353 xhtml_t *xhtml = GET_XHTML(pdoc);
5354 Doc *doc = xhtml->doc;
5356 if (IS_CSS_ON(xhtml->entryp)) {
5357 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5364 * It is a handder who processes the DD tag.
5366 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5367 * destination is specified.
5368 * @param node [i] The DD tag node is specified.
5369 * @return The conversion result is returned.
5372 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
5374 xhtml_t *xhtml = GET_XHTML(pdoc);
5375 Doc *doc = xhtml->doc;
5377 char *attr_style = NULL;
5378 char *attr_color = NULL;
5379 char *attr_size = NULL;
5381 for (attr = qs_get_attr(doc,node);
5383 attr = qs_get_next_attr(doc,attr)) {
5384 char *name = qs_get_attr_name(doc,attr);
5385 char *value = qs_get_attr_value(doc,attr);
5386 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5390 if (IS_CSS_ON(xhtml->entryp)) {
5391 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5393 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5394 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5395 css_property_t *cur;
5396 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5397 if (cur->value && *cur->value) {
5398 attr_color = apr_pstrdup(doc->pool, cur->value);
5401 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5402 if (cur->value && *cur->value) {
5403 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5404 attr_size = apr_pstrdup(doc->pool, cur->value);
5406 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5407 attr_size = apr_pstrdup(doc->pool, cur->value);
5409 else if (STRCASEEQ('s','S',"small",cur->value)) {
5410 attr_size = apr_pstrdup(doc->pool, cur->value);
5412 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5413 attr_size = apr_pstrdup(doc->pool, cur->value);
5415 else if (STRCASEEQ('l','L',"large",cur->value)) {
5416 attr_size = apr_pstrdup(doc->pool, cur->value);
5418 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5419 attr_size = apr_pstrdup(doc->pool, cur->value);
5421 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5422 attr_size = apr_pstrdup(doc->pool, cur->value);
5429 if (attr_color || attr_size) {
5432 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5450 * It is a handler who processes the DD tag.
5452 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5453 * destination is specified.
5454 * @param node [i] The DD tag node is specified.
5455 * @return The conversion result is returned.
5458 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
5460 xhtml_t *xhtml = GET_XHTML(pdoc);
5461 Doc *doc = xhtml->doc;
5463 if (IS_CSS_ON(xhtml->entryp)) {
5464 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5471 * It is a handler who processes the MENU tag.
5473 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5474 * destination is specified.
5475 * @param node [i] The MENU tag node is specified.
5476 * @return The conversion result is returned.
5479 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
5481 xhtml_t *xhtml = GET_XHTML(pdoc);
5482 Doc *doc = xhtml->doc;
5484 char *attr_style = NULL;
5485 char *attr_color = NULL;
5486 char *attr_type = NULL;
5487 char *attr_size = NULL;
5488 for (attr = qs_get_attr(doc,node);
5490 attr = qs_get_next_attr(doc,attr)) {
5491 char *name = qs_get_attr_name(doc,attr);
5492 char *value = qs_get_attr_value(doc,attr);
5493 if (STRCASEEQ('t','T',"type",name)) {
5494 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5498 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5502 if (IS_CSS_ON(xhtml->entryp)) {
5503 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5505 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5506 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5507 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5508 css_property_t *cur;
5509 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5510 if (cur->value && *cur->value) {
5511 attr_color = apr_pstrdup(doc->pool, cur->value);
5514 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5515 if (cur->value && *cur->value) {
5516 attr_type = apr_pstrdup(doc->pool, cur->value);
5519 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5520 if (cur->value && *cur->value) {
5521 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5522 attr_size = apr_pstrdup(doc->pool, cur->value);
5524 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5525 attr_size = apr_pstrdup(doc->pool, cur->value);
5527 else if (STRCASEEQ('s','S',"small",cur->value)) {
5528 attr_size = apr_pstrdup(doc->pool, cur->value);
5530 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5531 attr_size = apr_pstrdup(doc->pool, cur->value);
5533 else if (STRCASEEQ('l','L',"large",cur->value)) {
5534 attr_size = apr_pstrdup(doc->pool, cur->value);
5536 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5537 attr_size = apr_pstrdup(doc->pool, cur->value);
5539 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5540 attr_size = apr_pstrdup(doc->pool, cur->value);
5547 if (attr_type || attr_color || attr_size) {
5550 W_L("list-style-type:");
5555 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5573 * It is a hanmenuer who processes the MENU tag.
5575 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5576 * destination is specified.
5577 * @param node [i] The MENU tag node is specified.
5578 * @return The conversion result is returned.
5581 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
5583 xhtml_t *xhtml = GET_XHTML(pdoc);
5584 Doc *doc = xhtml->doc;
5586 if (IS_CSS_ON(xhtml->entryp)) {
5587 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5594 * It is a handler who processes the PLAINTEXT tag.
5596 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5597 * destination is specified.
5598 * @param node [i] The PLAINTEXT tag node is specified.
5599 * @return The conversion result is returned.
5602 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
5604 xhtml_t *xhtml = GET_XHTML(pdoc);
5605 Doc *doc = xhtml->doc;
5607 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
5612 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
5614 xhtml_t *xhtml = GET_XHTML(pdoc);
5615 Doc *doc = xhtml->doc;
5617 for (child = qs_get_child_node(doc, node);
5619 child = qs_get_next_node(doc, child)) {
5621 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
5628 * It is a handler who processes the PLAINTEXT tag.
5630 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5631 * destination is specified.
5632 * @param node [i] The PLAINTEXT tag node is specified.
5633 * @return The conversion result is returned.
5636 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5638 xhtml_t *xhtml = GET_XHTML(pdoc);
5639 Doc *doc = xhtml->doc;
5640 W_L("</plaintext>");
5646 * It is a handler who processes the BLINK tag.
5648 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5649 * destination is specified.
5650 * @param node [i] The BLINK tag node is specified.
5651 * @return The conversion result is returned.
5654 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
5656 xhtml_t *xhtml = GET_XHTML(pdoc);
5657 Doc *doc = xhtml->doc;
5659 char *attr_style = NULL;
5660 char *attr_color = NULL;
5661 char *attr_size = NULL;
5663 for (attr = qs_get_attr(doc,node);
5665 attr = qs_get_next_attr(doc,attr)) {
5666 char *name = qs_get_attr_name(doc,attr);
5667 char *value = qs_get_attr_value(doc,attr);
5668 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5672 if (IS_CSS_ON(xhtml->entryp)) {
5673 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5675 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5676 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5677 css_property_t *cur;
5678 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5679 if (cur->value && *cur->value) {
5680 attr_color = apr_pstrdup(doc->pool, cur->value);
5683 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5684 if (cur->value && *cur->value) {
5685 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5686 attr_size = apr_pstrdup(doc->pool, cur->value);
5688 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5689 attr_size = apr_pstrdup(doc->pool, cur->value);
5691 else if (STRCASEEQ('s','S',"small",cur->value)) {
5692 attr_size = apr_pstrdup(doc->pool, cur->value);
5694 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5695 attr_size = apr_pstrdup(doc->pool, cur->value);
5697 else if (STRCASEEQ('l','L',"large",cur->value)) {
5698 attr_size = apr_pstrdup(doc->pool, cur->value);
5700 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5701 attr_size = apr_pstrdup(doc->pool, cur->value);
5703 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5704 attr_size = apr_pstrdup(doc->pool, cur->value);
5711 if (attr_color || attr_size) {
5714 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5732 * It is a handler who processes the BLINK tag.
5734 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5735 * destination is specified.
5736 * @param node [i] The BLINK tag node is specified.
5737 * @return The conversion result is returned.
5740 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
5742 xhtml_t *xhtml = GET_XHTML(pdoc);
5743 Doc *doc = xhtml->doc;
5745 if (IS_CSS_ON(xhtml->entryp)) {
5746 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5753 * It is a handler who processes the MARQUEE tag.
5755 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5756 * destination is specified.
5757 * @param node [i] The MARQUEE tag node is specified.
5758 * @return The conversion result is returned.
5761 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
5763 xhtml_t *xhtml = GET_XHTML(pdoc);
5764 Doc *doc = xhtml->doc;
5766 char *attr_direction = NULL;
5767 char *attr_behavior = NULL;
5768 char *attr_loop = NULL;
5769 char *attr_style = NULL;
5770 char *attr_color = NULL;
5771 char *attr_size = NULL;
5772 char *attr_bgcolor = NULL;
5773 /*--------------------------------------------------------------------------*/
5774 /* Get Attributes */
5775 /*--------------------------------------------------------------------------*/
5776 for (attr = qs_get_attr(doc,node);
5778 attr = qs_get_next_attr(doc,attr)) {
5779 char *name = qs_get_attr_name(doc,attr);
5780 char *value = qs_get_attr_value(doc,attr);
5781 if (STRCASEEQ('d','D',"direction", name)) {
5783 if (STRCASEEQ('l','L',"left",value)) {
5784 attr_direction = "rtl";
5786 else if (STRCASEEQ('r','R',"right",value)) {
5787 attr_direction = "ltr";
5791 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
5792 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
5793 attr_behavior = value;
5796 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
5799 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5800 if (value && *value) {
5801 attr_bgcolor = value;
5804 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5808 if (IS_CSS_ON(xhtml->entryp)) {
5809 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5811 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5812 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5813 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5814 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5815 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5816 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5817 css_property_t *cur;
5818 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5819 if (cur->value && *cur->value) {
5820 attr_color = apr_pstrdup(doc->pool, cur->value);
5823 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5824 if (cur->value && *cur->value) {
5825 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5828 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5829 if (cur->value && *cur->value) {
5830 attr_direction = apr_pstrdup(doc->pool, cur->value);
5833 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
5834 if (cur->value && *cur->value) {
5835 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
5836 attr_behavior = apr_pstrdup(doc->pool, cur->value);
5840 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
5841 if (cur->value && *cur->value) {
5842 attr_loop = apr_pstrdup(doc->pool, cur->value);
5845 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5846 if (cur->value && *cur->value) {
5847 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5848 attr_size = apr_pstrdup(doc->pool, cur->value);
5850 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5851 attr_size = apr_pstrdup(doc->pool, cur->value);
5853 else if (STRCASEEQ('s','S',"small",cur->value)) {
5854 attr_size = apr_pstrdup(doc->pool, cur->value);
5856 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5857 attr_size = apr_pstrdup(doc->pool, cur->value);
5859 else if (STRCASEEQ('l','L',"large",cur->value)) {
5860 attr_size = apr_pstrdup(doc->pool, cur->value);
5862 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5863 attr_size = apr_pstrdup(doc->pool, cur->value);
5865 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5866 attr_size = apr_pstrdup(doc->pool, cur->value);
5873 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5875 if (attr_direction) {
5876 W_L("-wap-marquee-dir:");
5877 W_V(attr_direction);
5880 if (attr_behavior) {
5881 W_L("-wap-marquee-style:");
5886 W_L("-wap-marquee-loop:");
5891 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5892 W_L("background-color:");
5897 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5916 * It is a handler who processes the MARQUEE tag.
5918 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5919 * destination is specified.
5920 * @param node [i] The MARQUEE tag node is specified.
5921 * @return The conversion result is returned.
5924 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5926 xhtml_t *xhtml = GET_XHTML(pdoc);
5927 Doc *doc = xhtml->doc;
5929 if (IS_CSS_ON(xhtml->entryp)) {
5930 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5937 * It is handler who processes the New Line Code.
5940 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5942 xhtml_t *xhtml = GET_XHTML(pdoc);
5943 Doc *doc = xhtml->doc;
5944 if (xhtml->start_html_flag) {
5952 * It is a handler who processes the LINK tag.
5954 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5955 * destination is specified.
5956 * @param node [i] The LINK tag node is specified.
5957 * @return The conversion result is returned.
5960 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5969 xhtml = GET_XHTML(pdoc);
5972 if (! IS_CSS_ON(xhtml->entryp)) {
5976 for (attr = qs_get_attr(doc,node);
5978 attr = qs_get_next_attr(doc,attr)) {
5979 char *name = qs_get_attr_name(doc,attr);
5980 char *value = qs_get_attr_value(doc,attr);
5981 if (STRCASEEQ('r','R',"rel", name)) {
5982 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5986 else if (STRCASEEQ('h','H',"href", name)) {
5987 if (value && *value) {
5991 else if (STRCASEEQ('t','T',"type", name)) {
5992 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5998 if (rel && href && type) {
5999 DBG(doc->r, "start load CSS. url:[%s]", href);
6000 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
6001 DBG(doc->r, "end load CSS. url:[%s]", href);
6007 static css_prop_list_t *
6008 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6010 xhtml_t *xhtml = GET_XHTML(pdoc);
6011 Doc *doc = xhtml->doc;
6012 css_prop_list_t *last_css = NULL;
6013 if (IS_CSS_ON(xhtml->entryp)) {
6014 css_prop_list_t *dup_css;
6015 css_selector_t *selector;
6017 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6018 dup_css = chxj_dup_css_prop_list(doc, last_css);
6019 selector = chxj_css_find_selector(doc, xhtml->style, node);
6021 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6023 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
6024 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6026 if (style_attr_value) {
6027 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));
6029 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6037 static css_prop_list_t *
6038 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6040 xhtml_t *xhtml = GET_XHTML(pdoc);
6041 Doc *doc = xhtml->doc;
6042 css_prop_list_t *last_css = NULL;
6043 if (IS_CSS_ON(xhtml->entryp)) {
6044 css_prop_list_t *dup_css;
6045 css_selector_t *selector;
6047 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6048 dup_css = chxj_dup_css_prop_list(doc, last_css);
6049 selector = chxj_css_find_selector(doc, xhtml->style, node);
6051 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6055 if (style_attr_value) {
6056 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));
6058 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6067 * It is a handler who processes the SPAN tag.
6069 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6070 * destination is specified.
6071 * @param node [i] The SPAN tag node is specified.
6072 * @return The conversion result is returned.
6075 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
6080 char *attr_style = NULL;
6081 char *attr_color = NULL;
6082 char *attr_size = NULL;
6083 char *attr_align = NULL;
6084 char *attr_blink = NULL;
6085 char *attr_marquee = NULL;
6086 char *attr_marquee_dir = NULL;
6087 char *attr_marquee_style = NULL;
6088 char *attr_marquee_loop = NULL;
6089 char *css_bgcolor = NULL;
6091 xhtml = GET_XHTML(pdoc);
6094 for (attr = qs_get_attr(doc,node);
6096 attr = qs_get_next_attr(doc,attr)) {
6097 char *nm = qs_get_attr_name(doc,attr);
6098 char *val = qs_get_attr_value(doc,attr);
6099 if (val && STRCASEEQ('s','S',"style", nm)) {
6103 if (IS_CSS_ON(xhtml->entryp)) {
6104 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
6106 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6107 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6108 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6109 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6110 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6111 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6112 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6113 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6114 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6116 css_property_t *cur;
6117 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6118 attr_color = apr_pstrdup(doc->pool, cur->value);
6120 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6121 if (cur->value && *cur->value) {
6122 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6123 || STRCASEEQ('x','X',"x-small", cur->value)
6124 || STRCASEEQ('s','S',"small", cur->value)
6125 || STRCASEEQ('m','M',"medium", cur->value)
6126 || STRCASEEQ('l','L',"large", cur->value)
6127 || STRCASEEQ('x','X',"x-large", cur->value)
6128 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6129 attr_size = apr_pstrdup(doc->pool, cur->value);
6133 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6134 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6135 attr_blink = apr_pstrdup(doc->pool, cur->value);
6138 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6139 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6140 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6143 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6144 if (cur->value && *cur->value) {
6145 if ( STRCASEEQ('l','L',"ltr",cur->value)
6146 || STRCASEEQ('r','R',"rtl",cur->value)) {
6147 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6151 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6152 if (cur->value && *cur->value) {
6153 if ( STRCASEEQ('s','S',"scroll",cur->value)
6154 || STRCASEEQ('s','S',"slide",cur->value)
6155 || STRCASEEQ('a','A',"alternate",cur->value)) {
6156 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6160 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6161 if (cur->value && *cur->value) {
6162 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6163 attr_marquee_loop = "infinite";
6166 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6170 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6171 if (STRCASEEQ('l','L',"left", cur->value)) {
6172 attr_align = apr_pstrdup(doc->pool, "left");
6174 else if (STRCASEEQ('c','C',"center",cur->value)) {
6175 attr_align = apr_pstrdup(doc->pool, "center");
6177 else if (STRCASEEQ('r','R',"right",cur->value)) {
6178 attr_align = apr_pstrdup(doc->pool, "right");
6181 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6182 if (cur->value && *cur->value) {
6183 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6190 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6193 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6209 W_L("text-decoration:");
6214 W_L("display:-wap-marquee;");
6215 if (attr_marquee_dir) {
6216 W_L("-wap-marquee-dir:");
6217 W_V(attr_marquee_dir);
6220 if (attr_marquee_style) {
6221 W_L("-wap-marquee-style:");
6222 W_V(attr_marquee_style);
6225 if (attr_marquee_loop) {
6226 W_L("-wap-marquee-loop:");
6227 W_V(attr_marquee_loop);
6232 W_L("background-color:");
6244 * It is a handler who processes the SPAN tag.
6246 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6247 * destination is specified.
6248 * @param node [i] The SPAN tag node is specified.
6249 * @return The conversion result is returned.
6252 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
6254 xhtml_t *xhtml = GET_XHTML(pdoc);
6255 Doc *doc = xhtml->doc;
6264 * It is a handler who processes the STYLE tag.
6266 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6267 * destination is specified.
6268 * @param node [i] The STYLE tag node is specified.
6269 * @return The conversion result is returned.
6272 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
6279 xhtml = GET_XHTML(pdoc);
6282 if (! IS_CSS_ON(xhtml->entryp)) {
6286 for (attr = qs_get_attr(doc,node);
6288 attr = qs_get_next_attr(doc,attr)) {
6289 char *name = qs_get_attr_name(doc,attr);
6290 char *value = qs_get_attr_value(doc,attr);
6291 if (STRCASEEQ('t','T',"type", name)) {
6292 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6298 Node *child = qs_get_child_node(doc, node);
6299 if (type && child) {
6300 char *name = qs_get_node_name(doc, child);
6301 if (STRCASEEQ('t','T',"text", name)) {
6302 char *value = qs_get_node_value(doc, child);
6303 DBG(doc->r, "start load CSS. buf:[%s]", value);
6304 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
6305 DBG(doc->r, "end load CSS. value:[%s]", value);
6312 * It is a handler who processes the OBJECT tag.
6314 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6315 * destination is specified.
6316 * @param node [i] The OBJECT tag node is specified.
6317 * @return The conversion result is returned.
6320 s_xhtml_1_0_start_object_tag(void *pdoc, Node *node)
6322 xhtml_t *xhtml = GET_XHTML(pdoc);
6323 Doc *doc = xhtml->doc;
6327 char *attr_id = NULL;
6328 char *attr_width = NULL;
6329 char *attr_height = NULL;
6330 char *attr_data = NULL;
6331 char *attr_type = NULL;
6333 /*--------------------------------------------------------------------------*/
6334 /* Get Attributes */
6335 /*--------------------------------------------------------------------------*/
6336 for (attr = qs_get_attr(doc,node);
6338 attr = qs_get_next_attr(doc,attr)) {
6339 char *name = qs_get_attr_name(doc,attr);
6340 char *value = qs_get_attr_value(doc,attr);
6341 if (STRCASEEQ('i','I',"id",name)) {
6342 attr_id = apr_pstrdup(doc->pool, value);
6344 else if (STRCASEEQ('w','W',"width",name)) {
6345 attr_width = apr_pstrdup(doc->pool, value);
6347 else if (STRCASEEQ('h','H',"height",name)) {
6348 attr_height = apr_pstrdup(doc->pool, value);
6350 else if (STRCASEEQ('d','D',"data",name)) {
6351 attr_data = apr_pstrdup(doc->pool, value);
6353 else if (STRCASEEQ('t','T',"type",name)) {
6354 attr_type = apr_pstrdup(doc->pool, value);
6390 * It is a handler who processes the OBJECT tag.
6392 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6393 * destination is specified.
6394 * @param node [i] The OBJECT tag node is specified.
6395 * @return The conversion result is returned.
6398 s_xhtml_1_0_end_object_tag(void *pdoc, Node *UNUSED(node))
6400 xhtml_t *xhtml = GET_XHTML(pdoc);
6401 Doc *doc = xhtml->doc;
6408 * It is a handler who processes the OBJECT tag.
6410 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6411 * destination is specified.
6412 * @param node [i] The OBJECT tag node is specified.
6413 * @return The conversion result is returned.
6416 s_xhtml_1_0_start_param_tag(void *pdoc, Node *node)
6418 xhtml_t *xhtml = GET_XHTML(pdoc);
6419 Doc *doc = xhtml->doc;
6422 char *attr_style = NULL;
6423 char *attr_name = NULL;
6424 char *attr_value = NULL;
6425 char *attr_valuetype = NULL;
6427 /*--------------------------------------------------------------------------*/
6428 /* Get Attributes */
6429 /*--------------------------------------------------------------------------*/
6430 for (attr = qs_get_attr(doc,node);
6432 attr = qs_get_next_attr(doc,attr)) {
6433 char *name = qs_get_attr_name(doc,attr);
6434 char *value = qs_get_attr_value(doc,attr);
6435 if (STRCASEEQ('n','N',"name",name)) {
6436 attr_name = apr_pstrdup(doc->pool, value);
6438 else if (STRCASEEQ('v','V',"value",name)) {
6439 attr_value = apr_pstrdup(doc->pool, value);
6441 else if (STRCASEEQ('v','V',"valuetype",name)) {
6442 attr_valuetype = apr_pstrdup(doc->pool, value);
6458 W_L(" valuetype=\"");
6459 W_V(attr_valuetype);
6466 * It is a handler who processes the CAPTION tag.
6468 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6469 * destination is specified.
6470 * @param node [i] The CAPTION tag node is specified.
6471 * @return The conversion result is returned.
6474 s_xhtml_1_0_start_caption_tag(void *pdoc, Node *node)
6476 xhtml_t *xhtml = GET_XHTML(pdoc);
6477 Doc *doc = xhtml->doc;
6479 char *attr_style = NULL;
6480 char *attr_align = NULL;
6482 for (attr = qs_get_attr(doc,node);
6484 attr = qs_get_next_attr(doc,attr)) {
6485 char *name = qs_get_attr_name(doc,attr);
6486 char *value = qs_get_attr_value(doc,attr);
6487 if (STRCASEEQ('a','A',"align", name)) {
6489 (STRCASEEQ('l','L',"left",value)
6490 || STRCASEEQ('r','R',"right",value)
6491 || STRCASEEQ('t','T',"top",value)
6492 || STRCASEEQ('b','B',"bottom",value)
6497 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6515 * It is a handler who processes the CAPTION tag.
6517 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6518 * destination is specified.
6519 * @param node [i] The CAPTION tag node is specified.
6520 * @return The conversion result is returned.
6523 s_xhtml_1_0_end_caption_tag(void *pdoc, Node *UNUSED(child))
6525 xhtml_t *xhtml = GET_XHTML(pdoc);
6526 Doc *doc = xhtml->doc;