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 if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
490 apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"text/html; charset=UTF-8");
492 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
494 /*--------------------------------------------------------------------------*/
495 /* The character string of the input is analyzed. */
496 /*--------------------------------------------------------------------------*/
497 qs_init_malloc(&doc);
498 qs_init_root_node(&doc);
500 ss = apr_pcalloc(r->pool, srclen + 1);
501 memset(ss, 0, srclen + 1);
502 memcpy(ss, src, srclen);
504 if (IS_CSS_ON(xhtml.entryp)) {
505 /* current property list */
506 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
509 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
511 qs_parse_string(&doc,ss, strlen(ss));
513 chxj_buffered_write_init(r->pool, &doc.buf);
514 /*--------------------------------------------------------------------------*/
515 /* It converts it from CHTML to XHTML. */
516 /*--------------------------------------------------------------------------*/
517 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
518 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
519 dst = apr_pstrdup(r->pool, xhtml.out);
520 chxj_buffered_write_terminate(&doc.buf);
522 qs_all_free(&doc,QX_LOGMARK);
525 return apr_pstrdup(r->pool,ss);
529 dst = apr_psprintf(r->pool, "\n");
531 *dstlen = strlen(dst);
534 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
537 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
543 * The XHTML structure is initialized.
545 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
546 * initialized is specified.
547 * @param doc [i] The Doc structure that should be set to the initialized
548 * HDML structure is specified.
549 * @param r [i] To use POOL, the pointer to request_rec is specified.
550 * @param spec [i] The pointer to the device_table
553 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
555 memset(doc, 0, sizeof(Doc));
556 memset(xhtml, 0, sizeof(xhtml_t));
561 xhtml->out = qs_alloc_zero_byte_string(r->pool);
562 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
563 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
568 * Corresponding EMOJI to a current character-code is retrieved.
569 * The substitution character string is stored in the rslt pointer if agreeing.
571 * @param xhtml [i] The pointer to the XHTML structure is specified.
572 * @param txt [i] The character string to want to examine whether it is
573 * EMOJI is specified.
574 * @param rslt [o] The pointer to the pointer that stores the result is
576 * @return When corresponding EMOJI exists, it returns it excluding 0.
579 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
592 DBG(r,"spec is NULL");
595 for (ee = xhtml->conf->emoji;
598 unsigned char hex1byte;
599 unsigned char hex2byte;
601 DBG(r,"emoji->imode is NULL");
605 if (ee->imode->string != NULL
606 && strlen(ee->imode->string) > 0
607 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
608 if (spec == NULL || spec->emoji_type == NULL) {
609 *rslt = apr_psprintf(r->pool,
612 return strlen(ee->imode->string);
615 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
616 *rslt = apr_psprintf(r->pool,
619 return strlen(ee->imode->string);
622 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
623 *rslt = apr_psprintf(r->pool,
626 return strlen(ee->imode->string);
629 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
630 *rslt = apr_psprintf(r->pool,
633 return strlen(ee->imode->string);
636 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
637 *rslt = apr_psprintf(r->pool,
640 return strlen(ee->imode->string);
643 *rslt = apr_psprintf(r->pool,
646 return strlen(ee->imode->string);
650 hex1byte = ee->imode->hex1byte & 0xff;
651 hex2byte = ee->imode->hex2byte & 0xff;
653 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
654 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
655 if (spec == NULL || spec->emoji_type == NULL) {
656 *rslt = apr_psprintf(r->pool,
657 "<img localsrc=\"%s\">",
662 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
663 *rslt = apr_psprintf(r->pool,
664 "<img localsrc=\"%s\">",
669 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
670 *rslt = apr_psprintf(r->pool,
671 "<img localsrc=\"%s\">",
676 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
677 *rslt = apr_psprintf(r->pool,
678 "<img localsrc=\"%s\">",
683 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
684 *rslt = apr_psprintf(r->pool,
685 "<img localsrc=\"%s\">",
690 *rslt = apr_psprintf(r->pool,
691 "<img localsrc=\"%s\">",
703 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
717 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
718 memset(doc, 0, sizeof(Doc));
719 memset(xhtml, 0, sizeof(xhtml_t));
724 xhtml->out = qs_alloc_zero_byte_string(r->pool);
725 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
726 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
728 apr_pool_create(&pool, r->pool);
730 chxj_buffered_write_init(pool, &doc->buf);
732 for (ii=0; ii<len; ii++) {
736 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
743 if (is_sjis_kanji(src[ii])) {
744 two_byte[0] = src[ii+0];
745 two_byte[1] = src[ii+1];
751 one_byte[0] = src[ii+0];
756 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
758 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
764 * It is a handler who processes the HTML tag.
766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
767 * destination is specified.
768 * @param node [i] The HTML tag node is specified.
769 * @return The conversion result is returned.
772 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
774 xhtml_t *xhtml = GET_XHTML(pdoc);
775 Doc *doc = xhtml->doc;
777 /*--------------------------------------------------------------------------*/
778 /* Add XML Declare */
779 /*--------------------------------------------------------------------------*/
780 W_L("<?xml version=\"1.0\" encoding=\"");
781 W_V(xhtml->spec->output_encoding);
784 /*--------------------------------------------------------------------------*/
786 /*--------------------------------------------------------------------------*/
787 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
789 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
791 /*--------------------------------------------------------------------------*/
793 /*--------------------------------------------------------------------------*/
794 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
796 xhtml->start_html_flag = 1;
802 * It is a handler who processes the HTML tag.
804 * @param pdoc [i/o] The pointer to the XHTML structure at the output
805 * destination is specified.
806 * @param node [i] The HTML tag node is specified.
807 * @return The conversion result is returned.
810 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
812 xhtml_t *xhtml = GET_XHTML(pdoc);
813 Doc *doc = xhtml->doc;
820 * It is a handler who processes the META tag.
822 * @param pdoc [i/o] The pointer to the XHTML structure at the output
823 * destination is specified.
824 * @param node [i] The META tag node is specified.
825 * @return The conversion result is returned.
828 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
830 xhtml_t *xhtml = GET_XHTML(pdoc);
832 Doc *doc = xhtml->doc;
833 int content_type_flag = 0;
834 request_rec *r = doc->r;
837 /*--------------------------------------------------------------------------*/
839 /*--------------------------------------------------------------------------*/
840 for (attr = qs_get_attr(doc,node);
842 attr = qs_get_next_attr(doc,attr)) {
843 char *name = qs_get_attr_name(doc,attr);
844 char *value = qs_get_attr_value(doc,attr);
845 if (STRCASEEQ('n','N',"name", name) && value && *value) {
852 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
858 if (STRCASEEQ('c','C', "content-type", value)) {
859 content_type_flag = 1;
862 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
863 if (content_type_flag) {
867 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Shift_JIS"));
885 * It is a handler who processes the META tag.
887 * @param pdoc [i/o] The pointer to the XHTML structure at the output
888 * destination is specified.
889 * @param node [i] The META tag node is specified.
890 * @return The conversion result is returned.
893 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
895 xhtml_t *xhtml = GET_XHTML(pdoc);
902 * It is a handler who processes the HEAD tag.
904 * @param pdoc [i/o] The pointer to the XHTML structure at the output
905 * destination is specified.
906 * @param node [i] The HEAD tag node is specified.
907 * @return The conversion result is returned.
910 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
912 xhtml_t *xhtml = GET_XHTML(pdoc);
913 Doc *doc = xhtml->doc;
921 * It is a handler who processes the HEAD tag.
923 * @param pdoc [i/o] The pointer to the XHTML structure at the output
924 * destination is specified.
925 * @param node [i] The HEAD tag node is specified.
926 * @return The conversion result is returned.
929 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
931 xhtml_t *xhtml = GET_XHTML(pdoc);
932 Doc *doc = xhtml->doc;
940 * It is a handler who processes the TITLE tag.
942 * @param pdoc [i/o] The pointer to the XHTML structure at the output
943 * destination is specified.
944 * @param node [i] The TITLE tag node is specified.
945 * @return The conversion result is returned.
948 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
950 xhtml_t *xhtml = GET_XHTML(pdoc);
951 Doc *doc = xhtml->doc;
959 * It is a handler who processes the TITLE tag.
961 * @param pdoc [i/o] The pointer to the XHTML structure at the output
962 * destination is specified.
963 * @param node [i] The TITLE tag node is specified.
964 * @return The conversion result is returned.
967 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
969 xhtml_t *xhtml = GET_XHTML(pdoc);
970 Doc *doc = xhtml->doc;
979 * It is a handler who processes the BASE tag.
981 * @param pdoc [i/o] The pointer to the XHTML structure at the output
982 * destination is specified.
983 * @param node [i] The BASE tag node is specified.
984 * @return The conversion result is returned.
987 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
989 xhtml_t *xhtml = GET_XHTML(pdoc);
991 Doc *doc = xhtml->doc;
994 /*--------------------------------------------------------------------------*/
996 /*--------------------------------------------------------------------------*/
997 for (attr = qs_get_attr(doc,node);
999 attr = qs_get_next_attr(doc,attr)) {
1000 char *name = qs_get_attr_name(doc,attr);
1001 char *value = qs_get_attr_value(doc,attr);
1002 if (STRCASEEQ('h','H',"href",name)) {
1016 * It is a handler who processes the BASE tag.
1018 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1019 * destination is specified.
1020 * @param node [i] The BASE tag node is specified.
1021 * @return The conversion result is returned.
1024 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
1026 xhtml_t *xhtml = GET_XHTML(pdoc);
1033 * It is a handler who processes the BODY tag.
1035 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1036 * destination is specified.
1037 * @param node [i] The BODY tag node is specified.
1038 * @return The conversion result is returned.
1041 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1043 xhtml_t *xhtml = GET_XHTML(pdoc);
1044 Doc *doc = xhtml->doc;
1046 char *attr_bgcolor = NULL;
1047 char *attr_text = NULL;
1048 char *attr_link = NULL;
1049 char *attr_vlink = NULL;
1050 char *attr_style = NULL;
1051 char *attr_background = NULL;
1053 /*--------------------------------------------------------------------------*/
1054 /* Get Attributes */
1055 /*--------------------------------------------------------------------------*/
1056 for (attr = qs_get_attr(doc,node);
1058 attr = qs_get_next_attr(doc,attr)) {
1059 char *name = qs_get_attr_name(doc,attr);
1060 char *value = qs_get_attr_value(doc,attr);
1061 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1062 attr_bgcolor = value;
1064 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1067 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1070 else if (STRCASEEQ('a','A',"alink", name)) {
1073 else if (STRCASEEQ('v','V',"vlink",name)) {
1076 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1079 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1080 attr_background = value;
1084 if (IS_CSS_ON(xhtml->entryp)) {
1085 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1087 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1088 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1089 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1090 css_property_t *cur;
1091 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1092 if (cur->value && *cur->value) {
1093 attr_text = apr_pstrdup(doc->pool, cur->value);
1096 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1097 if (cur->value && *cur->value) {
1098 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1101 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1102 if (cur->value && *cur->value) {
1103 char *tmp = apr_pstrdup(doc->pool, cur->value);
1104 char *tmps = strstr(tmp,"(");
1106 char *tmpe = strstr(tmp,")");
1107 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1109 attr_background = apr_pstrndup(doc->pool, tmps,len);
1115 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1116 css_selector_t *cur_sel;
1117 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1118 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1119 css_property_t *cur;
1120 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1121 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1122 attr_link = apr_pstrdup(doc->pool, cur->value);
1126 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1127 css_property_t *cur;
1128 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1129 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1130 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1139 if (attr_bgcolor || attr_text) {
1142 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1143 W_L("background-color:");
1148 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1156 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1162 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1167 if (attr_background) {
1168 W_L(" background=\"");
1169 W_V(attr_background);
1179 * It is a handler who processes the BODY tag.
1181 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1182 * destination is specified.
1183 * @param node [i] The BODY tag node is specified.
1184 * @return The conversion result is returned.
1187 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1189 xhtml_t *xhtml = GET_XHTML(pdoc);
1190 Doc *doc = xhtml->doc;
1194 if (IS_CSS_ON(xhtml->entryp)) {
1195 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1204 * It is a handler who processes the A tag.
1206 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1207 * destination is specified.
1208 * @param node [i] The A tag node is specified.
1209 * @return The conversion result is returned.
1212 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1214 xhtml_t *xhtml = GET_XHTML(pdoc);
1215 Doc *doc = xhtml->doc;
1216 request_rec *r = doc->r;
1218 char *attr_style = NULL;
1219 char *attr_id = NULL;
1222 /*--------------------------------------------------------------------------*/
1223 /* Get Attributes */
1224 /*--------------------------------------------------------------------------*/
1225 for (attr = qs_get_attr(doc,node);
1227 attr = qs_get_next_attr(doc,attr)) {
1228 char* name = qs_get_attr_name(doc,attr);
1229 char* value = qs_get_attr_value(doc,attr);
1230 if (STRCASEEQ('i','I',"id",name)){
1231 attr_id = apr_pstrdup(doc->buf.pool, value);
1233 else if (STRCASEEQ('n','N',"name",name)) {
1234 attr_id = apr_pstrdup(doc->buf.pool, value);
1236 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1237 value = chxj_encoding_parameter(r, value, 1);
1238 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1239 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1245 else if (STRCASEEQ('a','A',"accesskey", name)) {
1246 W_L(" accesskey=\"");
1250 else if (STRCASEEQ('c','C',"cti",name)) {
1253 else if (STRCASEEQ('i','I',"ijam", name)) {
1256 else if (STRCASEEQ('u','U',"utn", name)) {
1259 else if (STRCASEEQ('t','T',"telbook",name)) {
1262 else if (STRCASEEQ('k','K',"kana",name)) {
1265 else if (STRCASEEQ('e','E',"email",name)) {
1268 else if (STRCASEEQ('i','I',"ista",name)) {
1271 else if (STRCASEEQ('i','I',"ilet",name)) {
1274 else if (STRCASEEQ('i','I',"iswf",name)) {
1277 else if (STRCASEEQ('i','I',"irst",name)) {
1280 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1291 if (IS_CSS_ON(xhtml->entryp)) {
1292 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1300 * It is a handler who processes the A tag.
1302 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1303 * destination is specified.
1304 * @param node [i] The A tag node is specified.
1305 * @return The conversion result is returned.
1308 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1310 xhtml_t *xhtml = GET_XHTML(pdoc);
1311 Doc *doc = xhtml->doc;
1315 if (IS_CSS_ON(xhtml->entryp)) {
1316 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1324 * It is a handler who processes the BR tag.
1326 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1327 * destination is specified.
1328 * @param node [i] The BR tag node is specified.
1329 * @return The conversion result is returned.
1332 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1334 xhtml_t *xhtml = GET_XHTML(pdoc);
1335 Doc *doc = xhtml->doc;
1337 char *attr_style = NULL;
1338 char *attr_clear = NULL;
1341 /*--------------------------------------------------------------------------*/
1342 /* Get Attributes */
1343 /*--------------------------------------------------------------------------*/
1344 for (attr = qs_get_attr(doc,node);
1346 attr = qs_get_next_attr(doc,attr)) {
1347 char *name = qs_get_attr_name(doc,attr);
1348 char *value = qs_get_attr_value(doc,attr);
1349 if (STRCASEEQ('c','C',"clear",name)) {
1350 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1354 else if (STRCASEEQ('s','S',"style",name)) {
1355 attr_style = apr_pstrdup(doc->buf.pool, value);
1358 if (IS_CSS_ON(xhtml->entryp)) {
1359 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1361 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1362 css_property_t *cur;
1363 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1364 if (cur->value && *cur->value) {
1365 if ( STRCASEEQ('l','L',"left", cur->value)
1366 || STRCASEEQ('r','R',"right", cur->value)) {
1367 attr_clear = apr_pstrdup(doc->pool, cur->value);
1369 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1370 attr_clear = apr_pstrdup(doc->pool, "all");
1389 * It is a handler who processes the BR tag.
1391 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1392 * destination is specified.
1393 * @param node [i] The BR tag node is specified.
1394 * @return The conversion result is returned.
1397 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1399 xhtml_t *xhtml = GET_XHTML(pdoc);
1406 * It is a handler who processes the TABLE tag.
1408 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1409 * destination is specified.
1410 * @param node [i] The TR tag node is specified.
1411 * @return The conversion result is returned.
1414 s_xhtml_1_0_start_table_tag(void *pdoc, Node *node)
1416 xhtml_t *xhtml = GET_XHTML(pdoc);
1417 Doc *doc = xhtml->doc;
1418 request_rec *r = doc->r;
1420 char *attr_style = NULL;
1421 char *attr_align = NULL;
1422 char *attr_width = NULL;
1423 char *attr_height = NULL;
1424 char *attr_bgcolor = NULL;
1425 char *attr_border_width = NULL;
1426 char *attr_border_color = NULL;
1428 /*--------------------------------------------------------------------------*/
1429 /* Get Attributes */
1430 /*--------------------------------------------------------------------------*/
1431 for (attr = qs_get_attr(doc,node);
1433 attr = qs_get_next_attr(doc,attr)) {
1434 char *name = qs_get_attr_name(doc,attr);
1435 char *val = qs_get_attr_value(doc,attr);
1437 if (STRCASEEQ('a','A',"align",name)) {
1438 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1439 attr_align = apr_pstrdup(doc->buf.pool, val);
1442 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1443 attr_height = apr_pstrdup(doc->buf.pool, val);
1445 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1446 attr_width = apr_pstrdup(doc->buf.pool, val);
1448 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1449 attr_style = apr_pstrdup(doc->buf.pool, val);
1451 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1452 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1453 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1455 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1456 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1458 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1459 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1460 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1463 if (IS_CSS_ON(xhtml->entryp)) {
1464 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1466 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1467 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1468 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1469 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1470 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1471 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1473 css_property_t *cur;
1474 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1475 char *tmp = apr_pstrdup(doc->pool, cur->value);
1476 char *tmpp = strstr(tmp, "px");
1478 size_t len = strlen(tmp) - strlen(tmpp);
1479 attr_width = apr_pstrndup(doc->pool, tmp,len);
1482 attr_width = apr_pstrdup(doc->pool, tmp);
1485 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1486 char *tmp = apr_pstrdup(doc->pool, cur->value);
1487 char *tmpp = strstr(tmp, "px");
1489 size_t len = strlen(tmp) - strlen(tmpp);
1490 attr_height = apr_pstrndup(doc->pool, tmp,len);
1493 attr_height = apr_pstrdup(doc->pool, tmp);
1496 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1497 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1498 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1501 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1502 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1503 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1505 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1506 char *tmp = apr_pstrdup(doc->pool, cur->value);
1507 char *tmpp = strstr(tmp, "px");
1509 size_t len = strlen(tmp) - strlen(tmpp);
1510 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1513 attr_border_width = apr_pstrdup(doc->pool, tmp);
1516 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1517 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1518 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1539 if (attr_bgcolor && *attr_bgcolor){
1544 if (attr_border_width || attr_border_color ){
1545 W_L(" style=\"border:");
1546 if (attr_border_width){
1547 W_V(attr_border_width);
1554 if (attr_border_color && *attr_border_color){
1556 W_V(attr_border_color);
1568 * It is a handler who processes the TABLE tag.
1570 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1571 * destination is specified.
1572 * @param node [i] The TR tag node is specified.
1573 * @return The conversion result is returned.
1576 s_xhtml_1_0_end_table_tag(void *pdoc, Node *UNUSED(child))
1578 xhtml_t *xhtml = GET_XHTML(pdoc);
1579 Doc *doc = xhtml->doc;
1586 * It is a handler who processes the TR tag.
1588 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1589 * destination is specified.
1590 * @param node [i] The TR tag node is specified.
1591 * @return The conversion result is returned.
1594 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *node)
1596 xhtml_t *xhtml = GET_XHTML(pdoc);
1597 Doc *doc = xhtml->doc;
1599 request_rec *r = doc->r;
1602 char *attr_style = NULL;
1603 char *attr_align = NULL;
1604 char *attr_valign = NULL;
1605 char *attr_bgcolor = NULL;
1607 /*--------------------------------------------------------------------------*/
1608 /* Get Attributes */
1609 /*--------------------------------------------------------------------------*/
1610 for (attr = qs_get_attr(doc,node);
1612 attr = qs_get_next_attr(doc,attr)) {
1613 char *name = qs_get_attr_name(doc,attr);
1614 char *val = qs_get_attr_value(doc,attr);
1616 if (STRCASEEQ('a','A',"align",name)) {
1617 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1618 attr_align = apr_pstrdup(doc->buf.pool, val);
1621 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1622 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1623 attr_valign = apr_pstrdup(doc->buf.pool, val);
1626 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1627 attr_style = apr_pstrdup(doc->buf.pool, val);
1629 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1630 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1631 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1634 if (IS_CSS_ON(xhtml->entryp)) {
1635 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1637 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1638 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1639 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1641 css_property_t *cur;
1642 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1643 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1644 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1647 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1648 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1649 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1652 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1653 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1654 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1670 if (attr_bgcolor && *attr_bgcolor){
1682 * It is a handler who processes the TR tag.
1684 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1685 * destination is specified.
1686 * @param node [i] The TR tag node is specified.
1687 * @return The conversion result is returned.
1690 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1692 xhtml_t *xhtml = GET_XHTML(pdoc);
1693 Doc *doc = xhtml->doc;
1701 * It is a handler who processes the TD tag.
1703 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1704 * destination is specified.
1705 * @param node [i] The TR tag node is specified.
1706 * @return The conversion result is returned.
1709 s_xhtml_1_0_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1711 xhtml_t *xhtml = GET_XHTML(pdoc);
1712 Doc *doc = xhtml->doc;
1714 request_rec *r = doc->r;
1717 char *attr_style = NULL;
1718 char *attr_align = NULL;
1719 char *attr_valign = NULL;
1720 char *attr_bgcolor = NULL;
1721 char *attr_colspan = NULL;
1722 char *attr_rowspan = NULL;
1723 char *attr_width = NULL;
1724 char *attr_height = NULL;
1726 /*--------------------------------------------------------------------------*/
1727 /* Get Attributes */
1728 /*--------------------------------------------------------------------------*/
1729 for (attr = qs_get_attr(doc,node);
1731 attr = qs_get_next_attr(doc,attr)) {
1732 char *name = qs_get_attr_name(doc,attr);
1733 char *val = qs_get_attr_value(doc,attr);
1734 if (STRCASEEQ('a','A',"align",name)) {
1735 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1736 attr_align = apr_pstrdup(doc->buf.pool, val);
1739 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1740 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1741 attr_valign = apr_pstrdup(doc->buf.pool, val);
1744 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1745 attr_style = apr_pstrdup(doc->buf.pool, val);
1747 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1748 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1749 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1751 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1752 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1754 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1755 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1757 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1758 char *tmp = strstr(val, "%");
1760 attr_width = apr_pstrdup(doc->buf.pool, val);
1763 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1766 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1767 char *tmp = strstr(val, "%");
1769 attr_height = apr_pstrdup(doc->buf.pool, val);
1772 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1777 if (IS_CSS_ON(xhtml->entryp)) {
1778 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1780 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1781 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1782 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1783 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1784 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1786 css_property_t *cur;
1787 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1788 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1789 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1792 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1793 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1794 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1797 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1798 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1799 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1801 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1802 attr_width = apr_pstrdup(doc->pool, cur->value);
1804 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1805 attr_height = apr_pstrdup(doc->pool, cur->value);
1832 if (attr_bgcolor && *attr_bgcolor){
1837 if (attr_width || attr_height ){
1858 * It is a handler who processes the TD tag.
1860 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1861 * destination is specified.
1862 * @param node [i] The TR tag node is specified.
1863 * @return The conversion result is returned.
1866 s_xhtml_1_0_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1868 xhtml_t *xhtml = GET_XHTML(pdoc);
1869 Doc *doc = xhtml->doc;
1879 * It is a handler who processes the TD tag.
1881 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1882 * destination is specified.
1883 * @param node [i] The TD tag node is specified.
1884 * @return The conversion result is returned.
1887 s_xhtml_1_0_start_td_tag(void *pdoc, Node *child)
1889 return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"td");
1893 * It is a handler who processes the TD tag.
1895 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1896 * destination is specified.
1897 * @param node [i] The TD tag node is specified.
1898 * @return The conversion result is returned.
1901 s_xhtml_1_0_end_td_tag(void *pdoc, Node *child)
1903 return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"td");
1907 * It is a handler who processes the TD tag.
1909 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1910 * destination is specified.
1911 * @param node [i] The TH tag node is specified.
1912 * @return The conversion result is returned.
1915 s_xhtml_1_0_start_th_tag(void *pdoc, Node *child)
1917 return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"th");
1921 * It is a handler who processes the TD tag.
1923 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1924 * destination is specified.
1925 * @param node [i] The TH tag node is specified.
1926 * @return The conversion result is returned.
1929 s_xhtml_1_0_end_th_tag(void *pdoc, Node *child)
1931 return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"th");
1937 * It is a handler who processes the FONT tag.
1939 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1940 * destination is specified.
1941 * @param node [i] The FONT tag node is specified.
1942 * @return The conversion result is returned.
1945 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1947 xhtml_t *xhtml = GET_XHTML(pdoc);
1948 Doc *doc = xhtml->doc;
1950 char *attr_color = NULL;
1951 char *attr_size = NULL;
1952 char *attr_style = NULL;
1954 /*--------------------------------------------------------------------------*/
1955 /* Get Attributes */
1956 /*--------------------------------------------------------------------------*/
1957 for (attr = qs_get_attr(doc,node);
1959 attr = qs_get_next_attr(doc,attr)) {
1960 char *name = qs_get_attr_name(doc,attr);
1961 char *value = qs_get_attr_value(doc,attr);
1962 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1963 attr_color = apr_pstrdup(doc->buf.pool, value);
1965 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1966 /*----------------------------------------------------------------------*/
1968 /*----------------------------------------------------------------------*/
1969 attr_size = apr_pstrdup(doc->buf.pool, value);
1971 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1972 attr_style = apr_pstrdup(doc->buf.pool, value);
1975 if (IS_CSS_ON(xhtml->entryp)) {
1976 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1978 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1979 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1980 css_property_t *cur;
1981 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1982 if (cur->value && *cur->value) {
1983 attr_color = apr_pstrdup(doc->pool, cur->value);
1986 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1987 if (cur->value && *cur->value) {
1988 attr_size = apr_pstrdup(doc->pool, cur->value);
1989 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1990 attr_size = apr_pstrdup(doc->pool, "1");
1992 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1993 attr_size = apr_pstrdup(doc->pool, "2");
1995 else if (STRCASEEQ('s','S',"small",attr_size)) {
1996 attr_size = apr_pstrdup(doc->pool, "3");
1998 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1999 attr_size = apr_pstrdup(doc->pool, "4");
2001 else if (STRCASEEQ('l','L',"large",attr_size)) {
2002 attr_size = apr_pstrdup(doc->pool, "5");
2004 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2005 attr_size = apr_pstrdup(doc->pool, "6");
2007 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2008 attr_size = apr_pstrdup(doc->pool, "7");
2015 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2016 memset(flg, 0, sizeof(*flg));
2018 W_L("<font color=\"");
2021 flg->font_color_flag = 1;
2024 flg->font_size_flag = 1;
2025 switch(*attr_size) {
2026 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2027 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2028 case '3': W_L("<span style=\"font-size: small\">"); break;
2029 case '4': W_L("<span style=\"font-size: medium\">"); break;
2030 case '5': W_L("<span style=\"font-size: large\">"); break;
2031 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2032 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2034 if (*(attr_size + 1) == '1') {
2035 W_L("<span style=\"font-size: small\">");
2038 if (*(attr_size + 1) == '2') {
2039 W_L("<span style=\"font-size: x-small\">");
2042 if (*(attr_size + 1) == '3') {
2043 W_L("<span style=\"font-size: xx-small\">");
2046 flg->font_size_flag = 0;
2050 if (*(attr_size + 1) == '1') {
2051 W_L("<span style=\"font-size: large\">");
2054 if (*(attr_size + 1) == '2') {
2055 W_L("<span style=\"font-size: x-large\">");
2058 if (*(attr_size + 1) == '3') {
2059 W_L("<span style=\"font-size: xx-large\">");
2062 flg->font_size_flag = 0;
2066 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2067 flg->font_size_flag = 0;
2070 node->userData = flg;
2077 * It is a handler who processes the FONT tag.
2079 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2080 * destination is specified.
2081 * @param node [i] The FONT tag node is specified.
2082 * @return The conversion result is returned.
2085 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
2087 xhtml_t *xhtml = GET_XHTML(pdoc);
2088 Doc *doc = xhtml->doc;
2090 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2091 if (flg && flg->font_size_flag) {
2094 if (flg && flg->font_color_flag) {
2097 if (IS_CSS_ON(xhtml->entryp)) {
2098 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2105 * It is a handler who processes the FORM tag.
2107 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2108 * destination is specified.
2109 * @param node [i] The FORM tag node is specified.
2110 * @return The conversion result is returned.
2113 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
2115 xhtml_t *xhtml = GET_XHTML(pdoc);
2116 Doc *doc = xhtml->doc;
2117 request_rec *r = doc->r;
2119 char *attr_action = NULL;
2120 char *attr_method = NULL;
2121 char *attr_style = NULL;
2122 char *attr_color = NULL;
2123 char *attr_align = NULL;
2124 char *attr_name = NULL;
2125 char *css_clear = NULL;
2126 char *new_hidden_tag = NULL;
2128 /*--------------------------------------------------------------------------*/
2129 /* Get Attributes */
2130 /*--------------------------------------------------------------------------*/
2131 for (attr = qs_get_attr(doc,node);
2133 attr = qs_get_next_attr(doc,attr)) {
2134 char *name = qs_get_attr_name(doc,attr);
2135 char *value = qs_get_attr_value(doc,attr);
2139 if (strcasecmp(name, "action") == 0) {
2140 /*--------------------------------------------------------------------*/
2142 /*--------------------------------------------------------------------*/
2143 attr_action = value;
2149 if (strcasecmp(name, "method") == 0) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2153 attr_method = value;
2159 if (strcasecmp(name, "name") == 0) {
2160 /*--------------------------------------------------------------------*/
2162 /*--------------------------------------------------------------------*/
2169 if (strcasecmp(name, "style") == 0) {
2178 if (IS_CSS_ON(xhtml->entryp)) {
2179 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2181 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2182 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2183 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2184 css_property_t *cur;
2185 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2186 if (STRCASEEQ('l','L',"left", cur->value)) {
2187 attr_align = apr_pstrdup(doc->pool, "left");
2189 else if (STRCASEEQ('c','C',"center",cur->value)) {
2190 attr_align = apr_pstrdup(doc->pool, "center");
2192 else if (STRCASEEQ('r','R',"right",cur->value)) {
2193 attr_align = apr_pstrdup(doc->pool, "right");
2196 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2197 attr_color = apr_pstrdup(doc->pool, cur->value);
2199 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2200 css_clear = apr_pstrdup(doc->pool, cur->value);
2205 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2209 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2210 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
2212 char *old_qs = NULL;
2213 q = strchr(attr_action, '?');
2215 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);
2216 if (new_hidden_tag || old_qs) {
2246 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
2247 memset(flg, 0, sizeof(*flg));
2249 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2250 W_L("<font color=\"");
2253 flg->with_font_flag = 1;
2256 W_L("<div align=\"");
2259 flg->with_div_flag = 1;
2261 node->userData = flg;
2262 if (new_hidden_tag) {
2263 W_V(new_hidden_tag);
2270 * It is a handler who processes the FORM tag.
2272 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2273 * destination is specified.
2274 * @param node [i] The FORM tag node is specified.
2275 * @return The conversion result is returned.
2278 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
2280 xhtml_t *xhtml = GET_XHTML(pdoc);
2281 Doc *doc = xhtml->doc;
2283 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2284 if (flg && flg->with_div_flag) {
2287 if (flg && flg->with_font_flag) {
2291 if (IS_CSS_ON(xhtml->entryp)) {
2292 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2300 * It is a handler who processes the INPUT tag.
2302 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2303 * destination is specified.
2304 * @param node [i] The INPUT tag node is specified.
2305 * @return The conversion result is returned.
2308 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
2310 xhtml_t *xhtml = GET_XHTML(pdoc);
2311 Doc *doc = xhtml->doc;
2312 request_rec *r = doc->r;
2314 char *attr_max_length = NULL;
2315 char *attr_type = NULL;
2316 char *attr_name = NULL;
2317 char *attr_value = NULL;
2318 char *attr_istyle = NULL;
2319 char *attr_size = NULL;
2320 char *attr_checked = NULL;
2321 char *attr_accesskey = NULL;
2322 char *attr_style = NULL;
2324 /*--------------------------------------------------------------------------*/
2325 /* Get Attributes */
2326 /*--------------------------------------------------------------------------*/
2327 for (attr = qs_get_attr(doc,node);
2329 attr = qs_get_next_attr(doc,attr)) {
2330 char *name = qs_get_attr_name(doc,attr);
2331 char *value = qs_get_attr_value(doc,attr);
2332 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2333 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2334 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2335 STRCASEEQ('p','P',"password",tmp_type) ||
2336 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2337 STRCASEEQ('r','R',"radio", tmp_type) ||
2338 STRCASEEQ('h','H',"hidden", tmp_type) ||
2339 STRCASEEQ('s','S',"submit", tmp_type) ||
2340 STRCASEEQ('r','R',"reset", tmp_type))) {
2341 attr_type = tmp_type;
2344 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2347 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2350 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2351 attr_istyle = value;
2353 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2354 attr_max_length = value;
2356 else if (STRCASEEQ('c','C',"checked", name)) {
2357 attr_checked = value;
2359 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2360 attr_accesskey = value;
2362 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2365 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2370 if (IS_CSS_ON(xhtml->entryp)) {
2371 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2373 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2374 css_property_t *cur;
2375 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2376 if (strcasestr(cur->value, "<ja:n>")) {
2379 else if (strcasestr(cur->value, "<ja:en>")) {
2382 else if (strcasestr(cur->value, "<ja:hk>")) {
2385 else if (strcasestr(cur->value, "<ja:h>")) {
2393 attr_type = qs_trim_string(doc->buf.pool, attr_type);
2394 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
2395 STRCASEEQ('p','P',"password",attr_type) ||
2396 STRCASEEQ('c','C',"checkbox",attr_type) ||
2397 STRCASEEQ('r','R',"radio", attr_type) ||
2398 STRCASEEQ('h','H',"hidden", attr_type) ||
2399 STRCASEEQ('s','S',"submit", attr_type) ||
2400 STRCASEEQ('r','R',"reset", attr_type))) {
2406 if (attr_size && *attr_size) {
2411 if (attr_name && *attr_name) {
2416 if (attr_value && *attr_value) {
2418 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2421 if (attr_accesskey && *attr_accesskey) {
2422 W_L(" accesskey=\"");
2423 W_V(attr_accesskey);
2426 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2431 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2432 W_L(" istyle=\"4\"");
2434 if (attr_max_length && *attr_max_length) {
2435 if (chxj_chk_numeric(attr_max_length) == 0) {
2436 W_L(" maxlength=\"");
2437 W_V(attr_max_length);
2441 /*--------------------------------------------------------------------------*/
2442 /* The figure is default for the password. */
2443 /*--------------------------------------------------------------------------*/
2444 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
2445 if (attr_max_length) {
2447 W_V(attr_max_length);
2451 W_L(" FORMAT=\"*N\"");
2455 W_L(" checked=\"checked\"");
2460 /*--------------------------------------------------------------------------*/
2461 /* Get Attributes */
2462 /*--------------------------------------------------------------------------*/
2463 type = qs_get_type_attr(doc, node, doc->buf.pool);
2464 name = qs_get_name_attr(doc, node, doc->buf.pool);
2465 value = qs_get_value_attr(doc,node, doc->buf.pool);
2466 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2467 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2468 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
2469 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2470 size = qs_get_size_attr(doc, node, doc->buf.pool);
2473 type = qs_trim_string(doc->buf.pool, type);
2474 if (type && (STRCASEEQ('t','T',"text", type) ||
2475 STRCASEEQ('p','P',"password",type) ||
2476 STRCASEEQ('c','C',"checkbox",type) ||
2477 STRCASEEQ('r','R',"radio", type) ||
2478 STRCASEEQ('h','H',"hidden", type) ||
2479 STRCASEEQ('s','S',"submit", type) ||
2480 STRCASEEQ('r','R',"reset", type))) {
2486 if (size && *size) {
2491 if (name && *name) {
2496 if (value && *value) {
2497 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2498 apr_size_t value_len = strlen(value);
2499 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
2503 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2506 if (accesskey && *accesskey) {
2507 W_L(" accesskey=\"");
2511 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2512 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
2513 if (max_length && *max_length) {
2515 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
2516 if (max_length[ii] < '0' || max_length[ii] > '9') {
2517 max_length = apr_psprintf(r->pool, "0");
2522 if (strcmp(max_length, "0")) {
2523 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
2535 if (max_length && *max_length) {
2536 if (chxj_chk_numeric(max_length) != 0) {
2537 max_length = apr_psprintf(r->pool, "0");
2539 if (strcmp(max_length, "0")) {
2540 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
2545 /*--------------------------------------------------------------------------*/
2546 /* The figure is default for the password. */
2547 /*--------------------------------------------------------------------------*/
2548 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
2555 W_L(" FORMAT=\"*N\"");
2559 W_L(" checked=\"checked\"");
2569 * It is a handler who processes the INPUT tag.
2571 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2572 * destination is specified.
2573 * @param node [i] The INPUT tag node is specified.
2574 * @return The conversion result is returned.
2577 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
2579 xhtml_t *xhtml = GET_XHTML(pdoc);
2586 * It is a handler who processes the CENTER tag.
2588 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2589 * destination is specified.
2590 * @param node [i] The CENTER tag node is specified.
2591 * @return The conversion result is returned.
2594 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2599 char *attr_style = NULL;
2600 char *attr_color = NULL;
2601 char *attr_size = NULL;
2603 xhtml = GET_XHTML(pdoc);
2606 for (attr = qs_get_attr(doc,node);
2608 attr = qs_get_next_attr(doc,attr)) {
2609 char *name = qs_get_attr_name(doc,attr);
2610 char *value = qs_get_attr_value(doc,attr);
2611 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2615 if (IS_CSS_ON(xhtml->entryp)) {
2616 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2618 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2619 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2620 css_property_t *cur;
2621 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2622 if (cur->value && *cur->value) {
2623 attr_color = apr_pstrdup(doc->pool, cur->value);
2626 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2627 if (cur->value && *cur->value) {
2628 attr_size = apr_pstrdup(doc->pool, cur->value);
2635 if (attr_size || attr_color) {
2643 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2657 * It is a handler who processes the CENTER tag.
2659 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2660 * destination is specified.
2661 * @param node [i] The CENTER tag node is specified.
2662 * @return The conversion result is returned.
2665 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2667 xhtml_t *xhtml = GET_XHTML(pdoc);
2668 Doc *doc = xhtml->doc;
2671 if (IS_CSS_ON(xhtml->entryp)) {
2672 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2679 * It is a handler who processes the HR tag.
2681 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The HR tag node is specified.
2684 * @return The conversion result is returned.
2687 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2693 char *attr_align = NULL;
2694 char *attr_size = NULL;
2695 char *attr_width = NULL;
2696 char *attr_noshade = NULL;
2697 char *attr_style = NULL;
2698 char *attr_color = NULL;
2700 xhtml = GET_XHTML(pdoc);
2704 for (attr = qs_get_attr(doc,node);
2706 attr = qs_get_next_attr(doc,attr)) {
2707 char *name = qs_get_attr_name (doc,attr);
2708 char *value = qs_get_attr_value(doc,attr);
2712 if (strcasecmp(name, "align") == 0) {
2713 /*--------------------------------------------------------------------*/
2715 /*--------------------------------------------------------------------*/
2716 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2724 if (strcasecmp(name, "size") == 0) {
2725 /*--------------------------------------------------------------------*/
2727 /*--------------------------------------------------------------------*/
2728 if (value && *value) {
2732 else if (strcasecmp(name, "style") == 0) {
2733 if (value && *value) {
2741 if (strcasecmp(name, "width") == 0) {
2742 /*--------------------------------------------------------------------*/
2744 /*--------------------------------------------------------------------*/
2745 if (value && *value) {
2753 if (strcasecmp(name, "noshade") == 0) {
2754 /*--------------------------------------------------------------------*/
2756 /*--------------------------------------------------------------------*/
2757 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2763 if (strcasecmp(name, "color") == 0 && value && *value) {
2764 /*--------------------------------------------------------------------*/
2766 /*--------------------------------------------------------------------*/
2775 if (IS_CSS_ON(xhtml->entryp)) {
2776 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2778 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2779 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2780 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2782 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2783 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2786 css_property_t *cur;
2787 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2788 if (STRCASEEQ('s','S',"solid",cur->value)) {
2789 attr_noshade = "noshade";
2792 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2793 char *tmp = apr_pstrdup(doc->pool, cur->value);
2794 char *tmpp = strstr(tmp, "px");
2796 size_t len = strlen(tmp) - strlen(tmpp);
2797 attr_size = apr_pstrndup(doc->pool, tmp,len);
2800 char *tmp2 = strstr(tmp,"%");
2802 attr_size = apr_pstrdup(doc->pool, tmp);
2806 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2807 char *tmp = apr_pstrdup(doc->pool, cur->value);
2808 char *tmpp = strstr(tmp, "px");
2810 attr_width = apr_pstrdup(doc->pool, tmp);
2813 tmpp = strstr(tmp, "%");
2815 attr_width = apr_pstrdup(doc->pool, tmp);
2820 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2821 char *tmp = apr_pstrdup(doc->pool, cur->value);
2822 char *tmpp = strstr(tmp,"none");
2824 attr_align = "center";
2828 attr_align = apr_pstrdup(doc->pool, tmp);
2834 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2835 char *tmp = apr_pstrdup(doc->pool, cur->value);
2837 attr_color = apr_pstrdup(doc->pool, tmp);
2857 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2885 * It is a handler who processes the HR tag.
2887 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2888 * destination is specified.
2889 * @param node [i] The HR tag node is specified.
2890 * @return The conversion result is returned.
2893 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2895 xhtml_t *xhtml = GET_XHTML(pdoc);
2902 * It is a handler who processes the PRE tag.
2904 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2905 * destination is specified.
2906 * @param node [i] The PRE tag node is specified.
2907 * @return The conversion result is returned.
2910 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2912 xhtml_t *xhtml = GET_XHTML(pdoc);
2913 Doc *doc = xhtml->doc;
2915 char *attr_style = NULL;
2917 for (attr = qs_get_attr(doc,node);
2919 attr = qs_get_next_attr(doc,attr)) {
2920 char *nm = qs_get_attr_name(doc,attr);
2921 char *val = qs_get_attr_value(doc,attr);
2922 if (val && STRCASEEQ('s','S',"style", nm)) {
2927 if (IS_CSS_ON(xhtml->entryp)) {
2928 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2938 * It is a handler who processes the PRE tag.
2940 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2941 * destination is specified.
2942 * @param node [i] The PRE tag node is specified.
2943 * @return The conversion result is returned.
2946 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2948 xhtml_t *xhtml = GET_XHTML(pdoc);
2949 Doc *doc = xhtml->doc;
2953 if (IS_CSS_ON(xhtml->entryp)) {
2954 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2962 * It is a handler who processes the P tag.
2964 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2965 * destination is specified.
2966 * @param node [i] The P tag node is specified.
2967 * @return The conversion result is returned.
2970 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2972 xhtml_t *xhtml = GET_XHTML(pdoc);
2973 Doc *doc = xhtml->doc;
2975 char *attr_align = NULL;
2976 char *attr_style = NULL;
2977 char *attr_color = NULL;
2978 char *attr_blink = NULL;
2979 char *css_clear = NULL;
2981 for (attr = qs_get_attr(doc,node);
2983 attr = qs_get_next_attr(doc,attr)) {
2984 char *nm = qs_get_attr_name(doc,attr);
2985 char *val = qs_get_attr_value(doc,attr);
2986 if (STRCASEEQ('a','A',"align", nm)) {
2987 /*----------------------------------------------------------------------*/
2988 /* CHTML 1.0 (W3C version 3.2) */
2989 /*----------------------------------------------------------------------*/
2990 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2991 attr_align = apr_pstrdup(doc->buf.pool, val);
2995 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2996 attr_style = apr_pstrdup(doc->buf.pool, val);
2999 if (IS_CSS_ON(xhtml->entryp)) {
3000 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3002 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3003 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3004 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3005 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3006 css_property_t *cur;
3007 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3008 if (STRCASEEQ('l','L',"left",cur->value)) {
3009 attr_align = apr_pstrdup(doc->pool, "left");
3011 else if (STRCASEEQ('c','C',"center",cur->value)) {
3012 attr_align = apr_pstrdup(doc->pool, "center");
3014 else if (STRCASEEQ('r','R',"right",cur->value)) {
3015 attr_align = apr_pstrdup(doc->pool, "right");
3018 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3019 if (cur->value && *cur->value) {
3020 attr_color = apr_pstrdup(doc->pool, cur->value);
3023 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3024 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3025 attr_blink = apr_pstrdup(doc->pool, cur->value);
3028 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3029 css_clear = apr_pstrdup(doc->pool, cur->value);
3034 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3042 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3048 W_L("text-decoration:");
3065 * It is a handler who processes the P tag.
3067 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3068 * destination is specified.
3069 * @param node [i] The P tag node is specified.
3070 * @return The conversion result is returned.
3073 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
3075 xhtml_t *xhtml = GET_XHTML(pdoc);
3076 Doc *doc = xhtml->doc;
3079 if (IS_CSS_ON(xhtml->entryp)) {
3080 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3087 * It is a handler who processes the UL tag.
3089 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3090 * destination is specified.
3091 * @param node [i] The UL tag node is specified.
3092 * @return The conversion result is returned.
3095 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
3097 xhtml_t *xhtml = GET_XHTML(pdoc);
3098 Doc *doc = xhtml->doc;
3100 char *attr_type = NULL;
3101 char *attr_style = NULL;
3102 /*--------------------------------------------------------------------------*/
3103 /* Get Attributes */
3104 /*--------------------------------------------------------------------------*/
3105 for (attr = qs_get_attr(doc,node);
3107 attr = qs_get_next_attr(doc,attr)) {
3108 char *name = qs_get_attr_name(doc,attr);
3109 char *value = qs_get_attr_value(doc,attr);
3110 if (STRCASEEQ('t','T',"type",name)) {
3111 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3115 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3119 if (IS_CSS_ON(xhtml->entryp)) {
3120 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3122 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3123 css_property_t *cur;
3124 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3125 if (STRCASEEQ('d','D',"disc",cur->value)) {
3126 attr_type = apr_pstrdup(doc->pool, "disc");
3128 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3129 attr_type = apr_pstrdup(doc->pool, "circle");
3131 else if (STRCASEEQ('s','S',"square",cur->value)) {
3132 attr_type = apr_pstrdup(doc->pool, "square");
3140 W_L("list-style-type:");
3151 * It is a handler who processes the UL tag.
3153 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3154 * destination is specified.
3155 * @param node [i] The UL tag node is specified.
3156 * @return The conversion result is returned.
3159 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
3161 xhtml_t *xhtml = GET_XHTML(pdoc);
3162 Doc *doc = xhtml->doc;
3165 if (IS_CSS_ON(xhtml->entryp)) {
3166 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3173 * It is a handler who processes the H1 tag.
3175 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3176 * destination is specified.
3177 * @param node [i] The H1 tag node is specified.
3178 * @return The conversion result is returned.
3181 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
3183 xhtml_t *xhtml = GET_XHTML(pdoc);
3184 Doc *doc = xhtml->doc;
3186 char *attr_style = NULL;
3187 char *attr_align = NULL;
3188 char *css_clear = NULL;
3190 for (attr = qs_get_attr(doc,node);
3192 attr = qs_get_next_attr(doc,attr)) {
3193 char *name = qs_get_attr_name(doc,attr);
3194 char *value = qs_get_attr_value(doc,attr);
3195 if (STRCASEEQ('a','A',"align", name)) {
3196 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3200 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3204 if (IS_CSS_ON(xhtml->entryp)) {
3205 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3207 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3208 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3209 css_property_t *cur;
3210 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3211 if (STRCASEEQ('l','L',"left", cur->value)) {
3212 attr_align = apr_pstrdup(doc->pool, "left");
3214 else if (STRCASEEQ('c','C',"center",cur->value)) {
3215 attr_align = apr_pstrdup(doc->pool, "center");
3217 else if (STRCASEEQ('r','R',"right",cur->value)) {
3218 attr_align = apr_pstrdup(doc->pool, "right");
3221 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3222 if (STRCASEEQ('b','B',"both", cur->value)) {
3223 css_clear = apr_pstrdup(doc->pool, "both");
3225 else if (STRCASEEQ('r','R',"right", cur->value)) {
3226 css_clear = apr_pstrdup(doc->pool, "right");
3228 else if (STRCASEEQ('l','L',"left", cur->value)) {
3229 css_clear = apr_pstrdup(doc->pool, "left");
3235 if (attr_align || css_clear ) {
3256 * It is a handler who processes the H1 tag.
3258 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3259 * destination is specified.
3260 * @param node [i] The H1 tag node is specified.
3261 * @return The conversion result is returned.
3264 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
3266 xhtml_t *xhtml = GET_XHTML(pdoc);
3267 Doc *doc = xhtml->doc;
3270 if (IS_CSS_ON(xhtml->entryp)) {
3271 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3278 * It is a handler who processes the H2 tag.
3280 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3281 * destination is specified.
3282 * @param node [i] The H2 tag node is specified.
3283 * @return The conversion result is returned.
3286 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
3288 xhtml_t *xhtml = GET_XHTML(pdoc);
3289 Doc *doc = xhtml->doc;
3291 char *attr_style = NULL;
3292 char *attr_align = NULL;
3293 char *css_clear = NULL;
3295 for (attr = qs_get_attr(doc,node);
3297 attr = qs_get_next_attr(doc,attr)) {
3298 char *name = qs_get_attr_name(doc,attr);
3299 char *value = qs_get_attr_value(doc,attr);
3300 if (STRCASEEQ('a','A',"align", name)) {
3301 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3305 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3309 if (IS_CSS_ON(xhtml->entryp)) {
3310 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3312 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3313 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3314 css_property_t *cur;
3315 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3316 if (STRCASEEQ('l','L',"left", cur->value)) {
3317 attr_align = apr_pstrdup(doc->pool, "left");
3319 else if (STRCASEEQ('c','C',"center",cur->value)) {
3320 attr_align = apr_pstrdup(doc->pool, "center");
3322 else if (STRCASEEQ('r','R',"right",cur->value)) {
3323 attr_align = apr_pstrdup(doc->pool, "right");
3326 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3327 if (STRCASEEQ('b','B',"both", cur->value)) {
3328 css_clear = apr_pstrdup(doc->pool, "both");
3330 else if (STRCASEEQ('r','R',"right", cur->value)) {
3331 css_clear = apr_pstrdup(doc->pool, "right");
3333 else if (STRCASEEQ('l','L',"left", cur->value)) {
3334 css_clear = apr_pstrdup(doc->pool, "left");
3340 if (attr_align || css_clear ) {
3361 * It is a handler who processes the H2 tag.
3363 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3364 * destination is specified.
3365 * @param node [i] The H2 tag node is specified.
3366 * @return The conversion result is returned.
3369 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
3371 xhtml_t *xhtml = GET_XHTML(pdoc);
3372 Doc *doc = xhtml->doc;
3375 if (IS_CSS_ON(xhtml->entryp)) {
3376 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3383 * It is a handler who processes the H3 tag.
3385 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3386 * destination is specified.
3387 * @param node [i] The H3 tag node is specified.
3388 * @return The conversion result is returned.
3391 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
3393 xhtml_t *xhtml = GET_XHTML(pdoc);
3394 Doc *doc = xhtml->doc;
3396 char *attr_style = NULL;
3397 char *attr_align = NULL;
3398 char *css_clear = NULL;
3400 for (attr = qs_get_attr(doc,node);
3402 attr = qs_get_next_attr(doc,attr)) {
3403 char *name = qs_get_attr_name(doc,attr);
3404 char *value = qs_get_attr_value(doc,attr);
3405 if (STRCASEEQ('a','A',"align", name)) {
3406 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3410 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3414 if (IS_CSS_ON(xhtml->entryp)) {
3415 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3417 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3418 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3419 css_property_t *cur;
3420 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3421 if (STRCASEEQ('l','L',"left", cur->value)) {
3422 attr_align = apr_pstrdup(doc->pool, "left");
3424 else if (STRCASEEQ('c','C',"center",cur->value)) {
3425 attr_align = apr_pstrdup(doc->pool, "center");
3427 else if (STRCASEEQ('r','R',"right",cur->value)) {
3428 attr_align = apr_pstrdup(doc->pool, "right");
3431 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3432 if (STRCASEEQ('b','B',"both", cur->value)) {
3433 css_clear = apr_pstrdup(doc->pool, "both");
3435 else if (STRCASEEQ('r','R',"right", cur->value)) {
3436 css_clear = apr_pstrdup(doc->pool, "right");
3438 else if (STRCASEEQ('l','L',"left", cur->value)) {
3439 css_clear = apr_pstrdup(doc->pool, "left");
3445 if (attr_align || css_clear ) {
3466 * It is a handler who processes the H3 tag.
3468 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3469 * destination is specified.
3470 * @param node [i] The H3 tag node is specified.
3471 * @return The conversion result is returned.
3474 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
3476 xhtml_t *xhtml = GET_XHTML(pdoc);
3477 Doc *doc = xhtml->doc;
3480 if (IS_CSS_ON(xhtml->entryp)) {
3481 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3489 * It is a handler who processes the H4 tag.
3491 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3492 * destination is specified.
3493 * @param node [i] The H4 tag node is specified.
3494 * @return The conversion result is returned.
3497 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
3499 xhtml_t *xhtml = GET_XHTML(pdoc);
3500 Doc *doc = xhtml->doc;
3502 char *attr_style = NULL;
3503 char *attr_align = NULL;
3504 char *css_clear = NULL;
3506 for (attr = qs_get_attr(doc,node);
3508 attr = qs_get_next_attr(doc,attr)) {
3509 char *name = qs_get_attr_name(doc,attr);
3510 char *value = qs_get_attr_value(doc,attr);
3511 if (STRCASEEQ('a','A',"align", name)) {
3512 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3516 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3520 if (IS_CSS_ON(xhtml->entryp)) {
3521 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3523 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3524 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3525 css_property_t *cur;
3526 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3527 if (STRCASEEQ('l','L',"left", cur->value)) {
3528 attr_align = apr_pstrdup(doc->pool, "left");
3530 else if (STRCASEEQ('c','C',"center",cur->value)) {
3531 attr_align = apr_pstrdup(doc->pool, "center");
3533 else if (STRCASEEQ('r','R',"right",cur->value)) {
3534 attr_align = apr_pstrdup(doc->pool, "right");
3537 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3538 if (STRCASEEQ('b','B',"both", cur->value)) {
3539 css_clear = apr_pstrdup(doc->pool, "both");
3541 else if (STRCASEEQ('r','R',"right", cur->value)) {
3542 css_clear = apr_pstrdup(doc->pool, "right");
3544 else if (STRCASEEQ('l','L',"left", cur->value)) {
3545 css_clear = apr_pstrdup(doc->pool, "left");
3551 if (attr_align || css_clear ) {
3572 * It is a handler who processes the H4 tag.
3574 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3575 * destination is specified.
3576 * @param node [i] The H4 tag node is specified.
3577 * @return The conversion result is returned.
3580 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
3582 xhtml_t *xhtml = GET_XHTML(pdoc);
3583 Doc *doc = xhtml->doc;
3586 if (IS_CSS_ON(xhtml->entryp)) {
3587 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3595 * It is a handler who processes the H5 tag.
3597 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3598 * destination is specified.
3599 * @param node [i] The H5 tag node is specified.
3600 * @return The conversion result is returned.
3603 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
3605 xhtml_t *xhtml = GET_XHTML(pdoc);
3606 Doc *doc = xhtml->doc;
3608 char *attr_style = NULL;
3609 char *attr_align = NULL;
3610 char *css_clear = NULL;
3612 for (attr = qs_get_attr(doc,node);
3614 attr = qs_get_next_attr(doc,attr)) {
3615 char *name = qs_get_attr_name(doc,attr);
3616 char *value = qs_get_attr_value(doc,attr);
3617 if (STRCASEEQ('a','A',"align", name)) {
3618 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3622 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3626 if (IS_CSS_ON(xhtml->entryp)) {
3627 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3629 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3630 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3631 css_property_t *cur;
3632 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3633 if (STRCASEEQ('l','L',"left", cur->value)) {
3634 attr_align = apr_pstrdup(doc->pool, "left");
3636 else if (STRCASEEQ('c','C',"center",cur->value)) {
3637 attr_align = apr_pstrdup(doc->pool, "center");
3639 else if (STRCASEEQ('r','R',"right",cur->value)) {
3640 attr_align = apr_pstrdup(doc->pool, "right");
3643 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3644 if (STRCASEEQ('b','B',"both", cur->value)) {
3645 css_clear = apr_pstrdup(doc->pool, "both");
3647 else if (STRCASEEQ('r','R',"right", cur->value)) {
3648 css_clear = apr_pstrdup(doc->pool, "right");
3650 else if (STRCASEEQ('l','L',"left", cur->value)) {
3651 css_clear = apr_pstrdup(doc->pool, "left");
3657 if (attr_align || css_clear ) {
3678 * It is a handler who processes the H5 tag.
3680 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3681 * destination is specified.
3682 * @param node [i] The H5 tag node is specified.
3683 * @return The conversion result is returned.
3686 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
3688 xhtml_t *xhtml = GET_XHTML(pdoc);
3689 Doc *doc = xhtml->doc;
3692 if (IS_CSS_ON(xhtml->entryp)) {
3693 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3701 * It is a handler who processes the H6 tag.
3703 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3704 * destination is specified.
3705 * @param node [i] The H6 tag node is specified.
3706 * @return The conversion result is returned.
3709 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
3711 xhtml_t *xhtml = GET_XHTML(pdoc);
3712 Doc *doc = xhtml->doc;
3714 char *attr_style = NULL;
3715 char *attr_align = NULL;
3716 char *css_clear = NULL;
3718 for (attr = qs_get_attr(doc,node);
3720 attr = qs_get_next_attr(doc,attr)) {
3721 char *name = qs_get_attr_name(doc,attr);
3722 char *value = qs_get_attr_value(doc,attr);
3723 if (STRCASEEQ('a','A',"align", name)) {
3724 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3728 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3732 if (IS_CSS_ON(xhtml->entryp)) {
3733 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3735 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3736 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3737 css_property_t *cur;
3738 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3739 if (STRCASEEQ('l','L',"left", cur->value)) {
3740 attr_align = apr_pstrdup(doc->pool, "left");
3742 else if (STRCASEEQ('c','C',"center",cur->value)) {
3743 attr_align = apr_pstrdup(doc->pool, "center");
3745 else if (STRCASEEQ('r','R',"right",cur->value)) {
3746 attr_align = apr_pstrdup(doc->pool, "right");
3749 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3750 if (STRCASEEQ('b','B',"both", cur->value)) {
3751 css_clear = apr_pstrdup(doc->pool, "both");
3753 else if (STRCASEEQ('r','R',"right", cur->value)) {
3754 css_clear = apr_pstrdup(doc->pool, "right");
3756 else if (STRCASEEQ('l','L',"left", cur->value)) {
3757 css_clear = apr_pstrdup(doc->pool, "left");
3763 if (attr_align || css_clear ) {
3784 * It is a handler who processes the H6 tag.
3786 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3787 * destination is specified.
3788 * @param node [i] The H6 tag node is specified.
3789 * @return The conversion result is returned.
3792 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3794 xhtml_t *xhtml = GET_XHTML(pdoc);
3795 Doc *doc = xhtml->doc;
3798 if (IS_CSS_ON(xhtml->entryp)) {
3799 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3807 * It is a handler who processes the OL tag.
3809 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3810 * destination is specified.
3811 * @param node [i] The OL tag node is specified.
3812 * @return The conversion result is returned.
3815 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3817 xhtml_t *xhtml = GET_XHTML(pdoc);
3818 Doc *doc = xhtml->doc;
3820 char *attr_style = NULL;
3821 char *attr_start = NULL;
3822 char *attr_type = NULL;
3824 /*--------------------------------------------------------------------------*/
3825 /* Get Attributes */
3826 /*--------------------------------------------------------------------------*/
3827 for (attr = qs_get_attr(doc,node);
3829 attr = qs_get_next_attr(doc,attr)) {
3830 char *name = qs_get_attr_name(doc,attr);
3831 char *value = qs_get_attr_value(doc,attr);
3832 if (STRCASEEQ('t','T',"type",name) && value) {
3833 if (*value == '1') {
3834 attr_type = apr_pstrdup(doc->pool, "decimal");
3836 else if (*value == 'a') {
3837 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3839 else if (*value == 'A') {
3840 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3843 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3846 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3850 if (IS_CSS_ON(xhtml->entryp)) {
3851 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3853 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3854 css_property_t *cur;
3855 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3856 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3857 attr_type = apr_pstrdup(doc->pool, "decimal");
3859 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3860 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3862 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3863 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3871 W_L("list-style-type:");
3888 * It is a handler who processes the OL tag.
3890 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3891 * destination is specified.
3892 * @param node [i] The OL tag node is specified.
3893 * @return The conversion result is returned.
3896 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3898 xhtml_t *xhtml = GET_XHTML(pdoc);
3899 Doc *doc = xhtml->doc;
3902 if (IS_CSS_ON(xhtml->entryp)) {
3903 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3911 * It is a handler who processes the LI tag.
3913 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3914 * destination is specified.
3915 * @param node [i] The LI tag node is specified.
3916 * @return The conversion result is returned.
3919 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3921 xhtml_t *xhtml = GET_XHTML(pdoc);
3922 Doc *doc = xhtml->doc;
3924 char *attr_type = NULL;
3925 char *attr_value = NULL;
3926 char *attr_style = NULL;
3928 for (attr = qs_get_attr(doc,node);
3930 attr = qs_get_next_attr(doc,attr)) {
3931 char *name = qs_get_attr_name(doc,attr);
3932 char *value = qs_get_attr_value(doc,attr);
3933 if (STRCASEEQ('t','T',"type",name)) {
3934 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3935 if (*value == '1') {
3936 attr_type = apr_pstrdup(doc->pool, "decimal");
3938 else if (*value == 'a') {
3939 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3941 else if (*value == 'A') {
3942 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3949 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3952 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3956 if (IS_CSS_ON(xhtml->entryp)) {
3957 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3959 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3960 css_property_t *cur;
3961 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3962 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3963 attr_type = apr_pstrdup(doc->pool, "decimal");
3965 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3966 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3968 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3969 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3971 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3972 attr_type = apr_pstrdup(doc->pool, "disc");
3974 else if (STRCASEEQ('s','S',"square", cur->value)) {
3975 attr_type = apr_pstrdup(doc->pool, "square");
3977 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3978 attr_type = apr_pstrdup(doc->pool, "circle");
3988 W_L("list-style-type:");
4004 ** It is a handler who processes the LI tag.
4006 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4007 * destination is specified.
4008 * @param node [i] The LI tag node is specified.
4009 * @return The conversion result is returned.
4012 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
4014 xhtml_t *xhtml = GET_XHTML(pdoc);
4015 Doc *doc = xhtml->doc;
4018 if (IS_CSS_ON(xhtml->entryp)) {
4019 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4025 * It is a handler who processes the IMG tag.
4027 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4028 * destination is specified.
4029 * @param node [i] The IMG tag node is specified.
4030 * @return The conversion result is returned.
4033 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
4035 xhtml_t *xhtml = GET_XHTML(pdoc);
4036 Doc *doc = xhtml->doc;
4037 request_rec *r = doc->r;
4039 char *attr_src = NULL;
4040 char *attr_alt = NULL;
4041 char *attr_height = NULL;
4042 char *attr_width = NULL;
4043 char *attr_align = NULL;
4044 char *attr_style = NULL;
4045 char *attr_hspace = NULL;
4046 char *attr_vspace = NULL;
4048 char *css_margin_left = NULL;
4049 char *css_margin_right = NULL;
4050 char *css_margin_top = NULL;
4051 char *css_margin_bottom = NULL;
4052 char *css_display = NULL;
4053 char *css_valign = NULL;
4056 #ifndef IMG_NOT_CONVERT_FILENAME
4057 device_table *spec = xhtml->spec;
4060 /*--------------------------------------------------------------------------*/
4061 /* Get Attributes */
4062 /*--------------------------------------------------------------------------*/
4063 for (attr = qs_get_attr(doc,node);
4065 attr = qs_get_next_attr(doc,attr)) {
4066 char *name = qs_get_attr_name(doc,attr);
4067 char *value = qs_get_attr_value(doc,attr);
4069 if (STRCASEEQ('s','S',"src",name)) {
4070 value = chxj_encoding_parameter(r, value, 1);
4071 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
4072 value = chxj_add_cookie_no_update_parameter(r, value);
4073 value = chxj_img_rewrite_parameter(r,xhtml->conf,value);
4074 #ifdef IMG_NOT_CONVERT_FILENAME
4080 attr_src = chxj_img_conv(r,spec,value);
4086 if (STRCASEEQ('a','A',"align",name)) {
4088 if (STRCASEEQ('t','T',"top", value) ||
4089 STRCASEEQ('m','M',"middle",value) ||
4090 STRCASEEQ('b','B',"bottom",value)) {
4093 else if( STRCASEEQ('l','L',"left", value) ||
4094 STRCASEEQ('r','R',"right", value)) {
4097 else if (STRCASEEQ('c','C',"center", value)) {
4098 css_valign = apr_pstrdup(doc->pool, "middle");
4102 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
4105 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
4108 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
4109 attr_height = value;
4111 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
4112 attr_hspace = value;
4114 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
4115 attr_vspace = value;
4117 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4122 if (IS_CSS_ON(xhtml->entryp)) {
4123 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4125 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
4126 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
4127 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
4128 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
4129 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
4130 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
4131 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
4133 css_property_t *cur;
4134 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
4135 attr_height = apr_pstrdup(doc->pool, cur->value);
4137 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
4138 attr_width = apr_pstrdup(doc->pool, cur->value);
4141 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
4142 css_valign = apr_pstrdup(doc->pool, cur->value);
4146 if (! attr_hspace) {
4147 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
4148 css_margin_left = apr_pstrdup(doc->pool, cur->value);
4150 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
4151 css_margin_right = apr_pstrdup(doc->pool, cur->value);
4155 if (! attr_vspace) {
4156 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
4157 css_margin_top = apr_pstrdup(doc->pool, cur->value);
4159 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
4160 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
4164 // float:[left|right] -> align
4166 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
4167 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
4168 attr_align = apr_pstrdup(doc->pool, cur->value);
4171 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4172 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4173 char *tmp = apr_pstrdup(doc->pool, cur->value);
4174 char *tmpp = strstr(tmp, "none");
4176 css_display = apr_pstrdup(doc->pool, tmp);
4203 if (attr_hspace || attr_vspace || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
4206 W_L("vertical-align:");
4211 W_L("margin-left:");
4214 W_L("margin-right:");
4219 if(css_margin_left){
4220 W_L("margin-left:");
4221 W_V(css_margin_left);
4224 if(css_margin_right){
4225 W_L("margin-right:");
4226 W_V(css_margin_right);
4234 W_L("margin-bottom:");
4241 W_V(css_margin_top);
4244 if(css_margin_bottom){
4245 W_L("margin-bottom:");
4246 W_V(css_margin_bottom);
4251 W_L("display:none;");
4269 * It is a handler who processes the IMG tag.
4271 * @param xhtml [i/o] The pointer to the XHTML structure at the output
4272 * destination is specified.
4273 * @param node [i] The IMG tag node is specified.
4274 * @return The conversion result is returned.
4277 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
4279 xhtml_t *xhtml = GET_XHTML(pdoc);
4286 * It is a handler who processes the SELECT tag.
4288 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4289 * destination is specified.
4290 * @param node [i] The SELECT tag node is specified.
4291 * @return The conversion result is returned.
4294 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
4296 xhtml_t *xhtml = GET_XHTML(pdoc);
4297 Doc *doc = xhtml->doc;
4300 char *multiple = NULL;
4302 char *attr_style = NULL;
4305 for (attr = qs_get_attr(doc,node);
4307 attr = qs_get_next_attr(doc,attr)) {
4308 char *nm = qs_get_attr_name(doc,attr);
4309 char *val = qs_get_attr_value(doc,attr);
4310 if (STRCASEEQ('s','S',"size",nm)) {
4311 /*----------------------------------------------------------------------*/
4312 /* CHTML 1.0 version 2.0 */
4313 /*----------------------------------------------------------------------*/
4314 size = apr_pstrdup(doc->buf.pool, val);
4316 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4317 /*----------------------------------------------------------------------*/
4318 /* CHTML 1.0 version 2.0 */
4319 /*----------------------------------------------------------------------*/
4320 attr_style = apr_pstrdup(doc->buf.pool, val);
4322 else if (STRCASEEQ('n','N',"name",nm)) {
4323 /*----------------------------------------------------------------------*/
4324 /* CHTML 1.0 version 2.0 */
4325 /*----------------------------------------------------------------------*/
4326 name = apr_pstrdup(doc->buf.pool, val);
4328 else if (STRCASEEQ('m','M',"multiple",nm)) {
4329 /*----------------------------------------------------------------------*/
4330 /* CHTML 1.0 version 2.0 */
4331 /*----------------------------------------------------------------------*/
4332 multiple = apr_pstrdup(doc->buf.pool, val);
4335 if (size && *size) {
4340 if (name && *name) {
4346 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
4347 W_L(" multiple=\"true\"");
4350 if (IS_CSS_ON(xhtml->entryp)) {
4351 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4359 * It is a handler who processes the SELECT tag.
4361 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4362 * destination is specified.
4363 * @param node [i] The SELECT tag node is specified.
4364 * @return The conversion result is returned.
4367 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
4369 xhtml_t *xhtml = GET_XHTML(pdoc);
4370 Doc *doc = xhtml->doc;
4373 if (IS_CSS_ON(xhtml->entryp)) {
4374 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4381 * It is a handler who processes the OPTION tag.
4383 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4384 * destination is specified.
4385 * @param node [i] The OPTION tag node is specified.
4386 * @return The conversion result is returned.
4389 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
4391 xhtml_t *xhtml = GET_XHTML(pdoc);
4392 Doc *doc = xhtml->doc;
4394 char *attr_style = NULL;
4396 char *selected = NULL;
4400 for (attr = qs_get_attr(doc,node);
4402 attr = qs_get_next_attr(doc,attr)) {
4403 char *nm = qs_get_attr_name(doc,attr);
4404 char *val = qs_get_attr_value(doc,attr);
4405 if (STRCASEEQ('s','S',"selected",nm)) {
4406 /* CHTML version 2.0 */
4407 selected = apr_pstrdup(doc->buf.pool, val);
4409 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4410 /* CHTML version 2.0 */
4411 attr_style = apr_pstrdup(doc->buf.pool, val);
4413 else if (STRCASEEQ('v','V',"value",nm)) {
4414 /* CHTML version 2.0 */
4415 value = apr_pstrdup(doc->buf.pool, val);
4424 W_L(" selected=\"selected\"");
4427 if (IS_CSS_ON(xhtml->entryp)) {
4428 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4435 * It is a handler who processes the OPTION tag.
4437 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4438 * destination is specified.
4439 * @param node [i] The OPTION tag node is specified.
4440 * @return The conversion result is returned.
4443 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
4445 xhtml_t *xhtml = GET_XHTML(pdoc);
4446 Doc *doc = xhtml->doc;
4449 if (IS_CSS_ON(xhtml->entryp)) {
4450 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4458 * It is a handler who processes the DIV tag.
4460 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4461 * destination is specified.
4462 * @param node [i] The DIV tag node is specified.
4463 * @return The conversion result is returned.
4466 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
4468 xhtml_t *xhtml = GET_XHTML(pdoc);
4469 Doc *doc = xhtml->doc;
4471 char *attr_style = NULL;
4472 char *attr_align = NULL;
4473 char *attr_display = NULL;
4474 char *attr_decoration = NULL;
4475 char *attr_wap_marquee_style = NULL;
4476 char *attr_wap_marquee_dir = NULL;
4477 char *attr_wap_marquee_loop = NULL;
4478 char *attr_color = NULL;
4479 char *attr_bgcolor = NULL;
4480 char *attr_font_size = NULL;
4481 char *css_clear = NULL;
4483 for (attr = qs_get_attr(doc,node);
4485 attr = qs_get_next_attr(doc,attr)) {
4486 char *nm = qs_get_attr_name(doc,attr);
4487 char *val = qs_get_attr_value(doc,attr);
4488 if (STRCASEEQ('a','A',"align",nm)) {
4489 /*----------------------------------------------------------------------*/
4490 /* CHTML 1.0 (W3C version 3.2) */
4491 /*----------------------------------------------------------------------*/
4492 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4493 attr_align = apr_pstrdup(doc->buf.pool, val);
4496 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4497 attr_style = apr_pstrdup(doc->buf.pool, val);
4501 if (IS_CSS_ON(xhtml->entryp)) {
4502 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4504 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4505 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4506 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4507 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4508 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4509 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4510 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4511 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4513 css_property_t *cur;
4514 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4515 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4516 attr_display = apr_pstrdup(doc->pool, cur->value);
4519 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4520 if (STRCASEEQ('b','B',"blink", cur->value)) {
4521 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4524 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4525 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4526 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4528 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4529 char *ss = strchr(cur->value, '#');
4531 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4532 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4535 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4536 attr_color = apr_pstrdup(doc->pool, cur->value);
4538 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4539 attr_align = apr_pstrdup(doc->pool, cur->value);
4541 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4542 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4543 || STRCASEEQ('x','X',"x-small",cur->value)
4544 || STRCASEEQ('s','S',"small",cur->value)
4545 || STRCASEEQ('m','M',"medium",cur->value)
4546 || STRCASEEQ('l','L',"large",cur->value)
4547 || STRCASEEQ('x','X',"x-large",cur->value)
4548 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4549 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4553 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4554 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4555 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4556 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4557 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4558 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4561 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4562 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4563 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4565 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4566 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4569 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4570 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4571 attr_wap_marquee_loop = "infinite";
4574 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4578 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4579 css_clear = apr_pstrdup(doc->pool, cur->value);
4587 || attr_wap_marquee_style
4588 || attr_wap_marquee_dir
4589 || attr_wap_marquee_loop
4605 if (attr_decoration) {
4606 W_L("text-decoration:");
4607 W_V(attr_decoration);
4610 if (attr_wap_marquee_style) {
4611 W_L("-wap-marquee-style:");
4612 W_V(attr_wap_marquee_style);
4615 if (attr_wap_marquee_dir) {
4616 W_L("-wap-marquee-dir:");
4617 W_V(attr_wap_marquee_dir);
4620 if (attr_wap_marquee_loop) {
4621 W_L("-wap-marquee-loop:");
4622 W_V(attr_wap_marquee_loop);
4631 W_L("background-color:");
4635 if (attr_font_size) {
4637 W_V(attr_font_size);
4653 * It is a handler who processes the DIV tag.
4655 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4656 * destination is specified.
4657 * @param node [i] The DIV tag node is specified.
4658 * @return The conversion result is returned.
4661 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
4663 xhtml_t *xhtml = GET_XHTML(pdoc);
4664 Doc *doc = xhtml->doc;
4666 if (IS_CSS_ON(xhtml->entryp)) {
4667 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4674 * It is a handler who processes the B tag.
4676 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4677 * destination is specified.
4678 * @param node [i] The B tag node is specified.
4679 * @return The conversion result is returned.
4682 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
4684 xhtml_t *xhtml = GET_XHTML(pdoc);
4685 Doc *doc = xhtml->doc;
4687 W_L("<div style=\"font-weight:bold\">");
4693 * It is a handler who processes the B tag.
4695 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4696 * destination is specified.
4697 * @param node [i] The B tag node is specified.
4698 * @return The conversion result is returned.
4701 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
4703 xhtml_t *xhtml = GET_XHTML(pdoc);
4704 Doc *doc = xhtml->doc;
4712 * It is a handler who processes the CHXJ:IF tag.
4714 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4715 * destination is specified.
4716 * @param node [i] The CHXJ:IF tag node is specified.
4719 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
4721 xhtml_t *xhtml = GET_XHTML(pdoc);
4722 Doc *doc = xhtml->doc;
4725 for (child = qs_get_child_node(doc, node);
4727 child = qs_get_next_node(doc, child)) {
4729 s_xhtml_1_0_chxjif_tag(xhtml, child);
4737 * It is a handler who processes the TEXTARE tag.
4739 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4740 * destination is specified.
4741 * @param node [i] The TEXTAREA tag node is specified.
4742 * @return The conversion result is returned.
4745 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
4747 xhtml_t *xhtml = GET_XHTML(pdoc);
4748 Doc *doc = xhtml->doc;
4750 char *attr_accesskey = NULL;
4751 char *attr_name = NULL;
4752 char *attr_rows = NULL;
4753 char *attr_cols = NULL;
4754 char *attr_istyle = NULL;
4755 char *attr_style = NULL;
4757 xhtml->textarea_flag++;
4758 for (attr = qs_get_attr(doc,node);
4760 attr = qs_get_next_attr(doc,attr)) {
4761 char *name = qs_get_attr_name(doc,attr);
4762 char *value = qs_get_attr_value(doc,attr);
4763 if (STRCASEEQ('n','N',"name",name) && value && *value) {
4766 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
4769 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
4772 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4773 attr_istyle = value;
4775 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
4781 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4782 attr_accesskey = value;
4784 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
4788 if (IS_CSS_ON(xhtml->entryp)) {
4789 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4791 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4792 css_property_t *cur;
4793 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4794 if (strcasestr(cur->value, "<ja:n>")) {
4797 else if (strcasestr(cur->value, "<ja:en>")) {
4800 else if (strcasestr(cur->value, "<ja:hk>")) {
4803 else if (strcasestr(cur->value, "<ja:h>")) {
4810 if (attr_accesskey) {
4811 W_L(" accesskey=\"");
4812 W_V(attr_accesskey);
4841 * It is a handler who processes the TEXTAREA tag.
4843 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4844 * destination is specified.
4845 * @param node [i] The TEXTAREA tag node is specified.
4846 * @return The conversion result is returned.
4849 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4851 xhtml_t *xhtml = GET_XHTML(pdoc);
4852 Doc *doc = xhtml->doc;
4855 xhtml->textarea_flag--;
4861 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
4863 xhtml_t *xhtml = GET_XHTML(pdoc);
4864 Doc *doc = xhtml->doc;
4865 request_rec *r = doc->r;
4872 apr_size_t z2h_input_len;
4874 textval = qs_get_node_value(doc,child);
4875 if (strlen(textval) == 0) {
4879 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4880 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4882 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4883 memset(one_byte, 0, sizeof(one_byte));
4886 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4888 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4890 DBG(r,"[%s][%d]", out, rtn);
4891 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4895 if (is_sjis_kanji(textval[ii])) {
4896 one_byte[0] = textval[ii+0];
4897 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4898 one_byte[0] = textval[ii+1];
4899 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4902 else if (xhtml->pre_flag) {
4903 one_byte[0] = textval[ii+0];
4904 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4906 else if (xhtml->textarea_flag) {
4907 one_byte[0] = textval[ii+0];
4908 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4910 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4911 one_byte[0] = textval[ii+0];
4912 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4915 z2h_input_len = strlen(tdst);
4916 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4924 * It is a handler who processes the BLOCKQUOTE tag.
4926 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4927 * destination is specified.
4928 * @param node [i] The BLOCKQUOTE tag node is specified.
4929 * @return The conversion result is returned.
4932 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4937 char *attr_style = NULL;
4938 char *attr_color = NULL;
4939 char *attr_size = NULL;
4941 xhtml = GET_XHTML(pdoc);
4943 for (attr = qs_get_attr(doc,node);
4945 attr = qs_get_next_attr(doc,attr)) {
4946 char *nm = qs_get_attr_name(doc,attr);
4947 char *val = qs_get_attr_value(doc,attr);
4948 if (val && STRCASEEQ('s','S',"style", nm)) {
4952 if (IS_CSS_ON(xhtml->entryp)) {
4953 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4955 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4956 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4957 css_property_t *cur;
4958 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4959 if (cur->value && *cur->value) {
4960 attr_color = apr_pstrdup(doc->pool, cur->value);
4963 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4964 if (cur->value && *cur->value) {
4965 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4966 attr_size = apr_pstrdup(doc->pool, cur->value);
4968 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4969 attr_size = apr_pstrdup(doc->pool, cur->value);
4971 else if (STRCASEEQ('s','S',"small",cur->value)) {
4972 attr_size = apr_pstrdup(doc->pool, cur->value);
4974 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4975 attr_size = apr_pstrdup(doc->pool, cur->value);
4977 else if (STRCASEEQ('l','L',"large",cur->value)) {
4978 attr_size = apr_pstrdup(doc->pool, cur->value);
4980 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4981 attr_size = apr_pstrdup(doc->pool, cur->value);
4983 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4984 attr_size = apr_pstrdup(doc->pool, cur->value);
4991 if (attr_color || attr_size) {
4994 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5012 * It is a handler who processes the BLOCKQUOTE tag.
5014 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5015 * destination is specified.
5016 * @param node [i] The BLOCKQUOTE tag node is specified.
5017 * @return The conversion result is returned.
5020 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
5022 xhtml_t *xhtml = GET_XHTML(pdoc);
5023 Doc *doc = xhtml->doc;
5024 W_L("</blockquote>");
5025 if (IS_CSS_ON(xhtml->entryp)) {
5026 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5033 * It is a handler who processes the DIR tag.
5035 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5036 * destination is specified.
5037 * @param node [i] The DIR tag node is specified.
5038 * @return The conversion result is returned.
5041 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
5043 xhtml_t *xhtml = GET_XHTML(pdoc);
5044 Doc *doc = xhtml->doc;
5046 char *attr_style = NULL;
5047 char *attr_color = NULL;
5048 char *attr_type = NULL;
5049 char *attr_size = NULL;
5050 for (attr = qs_get_attr(doc,node);
5052 attr = qs_get_next_attr(doc,attr)) {
5053 char *name = qs_get_attr_name(doc,attr);
5054 char *value = qs_get_attr_value(doc,attr);
5055 if (STRCASEEQ('t','T',"type",name)) {
5056 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5060 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5064 if (IS_CSS_ON(xhtml->entryp)) {
5065 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5067 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5068 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5069 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5070 css_property_t *cur;
5071 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5072 if (cur->value && *cur->value) {
5073 attr_color = apr_pstrdup(doc->pool, cur->value);
5076 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5077 if (cur->value && *cur->value) {
5078 attr_type = apr_pstrdup(doc->pool, cur->value);
5081 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5082 if (cur->value && *cur->value) {
5083 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5084 attr_size = apr_pstrdup(doc->pool, cur->value);
5086 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5087 attr_size = apr_pstrdup(doc->pool, cur->value);
5089 else if (STRCASEEQ('s','S',"small",cur->value)) {
5090 attr_size = apr_pstrdup(doc->pool, cur->value);
5092 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5093 attr_size = apr_pstrdup(doc->pool, cur->value);
5095 else if (STRCASEEQ('l','L',"large",cur->value)) {
5096 attr_size = apr_pstrdup(doc->pool, cur->value);
5098 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5099 attr_size = apr_pstrdup(doc->pool, cur->value);
5101 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5102 attr_size = apr_pstrdup(doc->pool, cur->value);
5109 if (attr_type || attr_color || attr_size) {
5112 W_L("list-style-type:");
5117 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5135 * It is a handler who processes the DIR tag.
5137 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5138 * destination is specified.
5139 * @param node [i] The DIR tag node is specified.
5140 * @return The conversion result is returned.
5143 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
5145 xhtml_t *xhtml = GET_XHTML(pdoc);
5146 Doc *doc = xhtml->doc;
5148 if (IS_CSS_ON(xhtml->entryp)) {
5149 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5156 * It is a handler who processes the DL tag.
5158 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5159 * destination is specified.
5160 * @param node [i] The DL tag node is specified.
5161 * @return The conversion result is returned.
5164 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
5166 xhtml_t *xhtml = GET_XHTML(pdoc);
5167 Doc *doc = xhtml->doc;
5169 char *attr_style = NULL;
5170 char *attr_color = NULL;
5171 char *attr_size = NULL;
5173 for (attr = qs_get_attr(doc,node);
5175 attr = qs_get_next_attr(doc,attr)) {
5176 char *name = qs_get_attr_name(doc,attr);
5177 char *value = qs_get_attr_value(doc,attr);
5178 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5182 if (IS_CSS_ON(xhtml->entryp)) {
5183 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5185 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5186 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5187 css_property_t *cur;
5188 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5189 if (cur->value && *cur->value) {
5190 attr_color = apr_pstrdup(doc->pool, cur->value);
5193 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5194 if (cur->value && *cur->value) {
5195 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5196 attr_size = apr_pstrdup(doc->pool, cur->value);
5198 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5199 attr_size = apr_pstrdup(doc->pool, cur->value);
5201 else if (STRCASEEQ('s','S',"small",cur->value)) {
5202 attr_size = apr_pstrdup(doc->pool, cur->value);
5204 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5205 attr_size = apr_pstrdup(doc->pool, cur->value);
5207 else if (STRCASEEQ('l','L',"large",cur->value)) {
5208 attr_size = apr_pstrdup(doc->pool, cur->value);
5210 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5211 attr_size = apr_pstrdup(doc->pool, cur->value);
5213 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5214 attr_size = apr_pstrdup(doc->pool, cur->value);
5221 if (attr_color || attr_size) {
5224 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5242 * It is a handler who processes the DL tag.
5244 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5245 * destination is specified.
5246 * @param node [i] The DL tag node is specified.
5247 * @return The conversion result is returned.
5250 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
5252 xhtml_t *xhtml = GET_XHTML(pdoc);
5253 Doc *doc = xhtml->doc;
5255 if (IS_CSS_ON(xhtml->entryp)) {
5256 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5263 * It is a handter who processes the DT tag.
5265 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5266 * destination is specified.
5267 * @param node [i] The DT tag node is specified.
5268 * @return The conversion result is returned.
5271 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
5273 xhtml_t *xhtml = GET_XHTML(pdoc);
5274 Doc *doc = xhtml->doc;
5276 char *attr_style = NULL;
5277 char *attr_color = NULL;
5278 char *attr_size = NULL;
5280 for (attr = qs_get_attr(doc,node);
5282 attr = qs_get_next_attr(doc,attr)) {
5283 char *name = qs_get_attr_name(doc,attr);
5284 char *value = qs_get_attr_value(doc,attr);
5285 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5289 if (IS_CSS_ON(xhtml->entryp)) {
5290 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5292 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5293 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5294 css_property_t *cur;
5295 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5296 if (cur->value && *cur->value) {
5297 attr_color = apr_pstrdup(doc->pool, cur->value);
5300 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5301 if (cur->value && *cur->value) {
5302 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5303 attr_size = apr_pstrdup(doc->pool, cur->value);
5305 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5306 attr_size = apr_pstrdup(doc->pool, cur->value);
5308 else if (STRCASEEQ('s','S',"small",cur->value)) {
5309 attr_size = apr_pstrdup(doc->pool, cur->value);
5311 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5312 attr_size = apr_pstrdup(doc->pool, cur->value);
5314 else if (STRCASEEQ('l','L',"large",cur->value)) {
5315 attr_size = apr_pstrdup(doc->pool, cur->value);
5317 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5318 attr_size = apr_pstrdup(doc->pool, cur->value);
5320 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5321 attr_size = apr_pstrdup(doc->pool, cur->value);
5328 if (attr_color || attr_size) {
5331 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5349 * It is a handter who processes the DT tag.
5351 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5352 * destination is specified.
5353 * @param node [i] The DT tag node is specified.
5354 * @return The conversion result is returned.
5357 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
5359 xhtml_t *xhtml = GET_XHTML(pdoc);
5360 Doc *doc = xhtml->doc;
5362 if (IS_CSS_ON(xhtml->entryp)) {
5363 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5370 * It is a handder who processes the DD tag.
5372 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5373 * destination is specified.
5374 * @param node [i] The DD tag node is specified.
5375 * @return The conversion result is returned.
5378 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
5380 xhtml_t *xhtml = GET_XHTML(pdoc);
5381 Doc *doc = xhtml->doc;
5383 char *attr_style = NULL;
5384 char *attr_color = NULL;
5385 char *attr_size = NULL;
5387 for (attr = qs_get_attr(doc,node);
5389 attr = qs_get_next_attr(doc,attr)) {
5390 char *name = qs_get_attr_name(doc,attr);
5391 char *value = qs_get_attr_value(doc,attr);
5392 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5396 if (IS_CSS_ON(xhtml->entryp)) {
5397 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5399 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5400 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5401 css_property_t *cur;
5402 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5403 if (cur->value && *cur->value) {
5404 attr_color = apr_pstrdup(doc->pool, cur->value);
5407 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5408 if (cur->value && *cur->value) {
5409 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5410 attr_size = apr_pstrdup(doc->pool, cur->value);
5412 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5413 attr_size = apr_pstrdup(doc->pool, cur->value);
5415 else if (STRCASEEQ('s','S',"small",cur->value)) {
5416 attr_size = apr_pstrdup(doc->pool, cur->value);
5418 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5419 attr_size = apr_pstrdup(doc->pool, cur->value);
5421 else if (STRCASEEQ('l','L',"large",cur->value)) {
5422 attr_size = apr_pstrdup(doc->pool, cur->value);
5424 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5425 attr_size = apr_pstrdup(doc->pool, cur->value);
5427 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5428 attr_size = apr_pstrdup(doc->pool, cur->value);
5435 if (attr_color || attr_size) {
5438 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5456 * It is a handler who processes the DD tag.
5458 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5459 * destination is specified.
5460 * @param node [i] The DD tag node is specified.
5461 * @return The conversion result is returned.
5464 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
5466 xhtml_t *xhtml = GET_XHTML(pdoc);
5467 Doc *doc = xhtml->doc;
5469 if (IS_CSS_ON(xhtml->entryp)) {
5470 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5477 * It is a handler who processes the MENU tag.
5479 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5480 * destination is specified.
5481 * @param node [i] The MENU tag node is specified.
5482 * @return The conversion result is returned.
5485 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
5487 xhtml_t *xhtml = GET_XHTML(pdoc);
5488 Doc *doc = xhtml->doc;
5490 char *attr_style = NULL;
5491 char *attr_color = NULL;
5492 char *attr_type = NULL;
5493 char *attr_size = NULL;
5494 for (attr = qs_get_attr(doc,node);
5496 attr = qs_get_next_attr(doc,attr)) {
5497 char *name = qs_get_attr_name(doc,attr);
5498 char *value = qs_get_attr_value(doc,attr);
5499 if (STRCASEEQ('t','T',"type",name)) {
5500 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5504 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5508 if (IS_CSS_ON(xhtml->entryp)) {
5509 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5511 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5512 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5513 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5514 css_property_t *cur;
5515 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5516 if (cur->value && *cur->value) {
5517 attr_color = apr_pstrdup(doc->pool, cur->value);
5520 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5521 if (cur->value && *cur->value) {
5522 attr_type = apr_pstrdup(doc->pool, cur->value);
5525 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5526 if (cur->value && *cur->value) {
5527 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5528 attr_size = apr_pstrdup(doc->pool, cur->value);
5530 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5531 attr_size = apr_pstrdup(doc->pool, cur->value);
5533 else if (STRCASEEQ('s','S',"small",cur->value)) {
5534 attr_size = apr_pstrdup(doc->pool, cur->value);
5536 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5537 attr_size = apr_pstrdup(doc->pool, cur->value);
5539 else if (STRCASEEQ('l','L',"large",cur->value)) {
5540 attr_size = apr_pstrdup(doc->pool, cur->value);
5542 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5543 attr_size = apr_pstrdup(doc->pool, cur->value);
5545 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5546 attr_size = apr_pstrdup(doc->pool, cur->value);
5553 if (attr_type || attr_color || attr_size) {
5556 W_L("list-style-type:");
5561 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5579 * It is a hanmenuer who processes the MENU tag.
5581 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5582 * destination is specified.
5583 * @param node [i] The MENU tag node is specified.
5584 * @return The conversion result is returned.
5587 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
5589 xhtml_t *xhtml = GET_XHTML(pdoc);
5590 Doc *doc = xhtml->doc;
5592 if (IS_CSS_ON(xhtml->entryp)) {
5593 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5600 * It is a handler who processes the PLAINTEXT tag.
5602 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5603 * destination is specified.
5604 * @param node [i] The PLAINTEXT tag node is specified.
5605 * @return The conversion result is returned.
5608 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
5610 xhtml_t *xhtml = GET_XHTML(pdoc);
5611 Doc *doc = xhtml->doc;
5613 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
5618 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
5620 xhtml_t *xhtml = GET_XHTML(pdoc);
5621 Doc *doc = xhtml->doc;
5623 for (child = qs_get_child_node(doc, node);
5625 child = qs_get_next_node(doc, child)) {
5627 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
5634 * It is a handler who processes the PLAINTEXT tag.
5636 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5637 * destination is specified.
5638 * @param node [i] The PLAINTEXT tag node is specified.
5639 * @return The conversion result is returned.
5642 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5644 xhtml_t *xhtml = GET_XHTML(pdoc);
5645 Doc *doc = xhtml->doc;
5646 W_L("</plaintext>");
5652 * It is a handler who processes the BLINK tag.
5654 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5655 * destination is specified.
5656 * @param node [i] The BLINK tag node is specified.
5657 * @return The conversion result is returned.
5660 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
5662 xhtml_t *xhtml = GET_XHTML(pdoc);
5663 Doc *doc = xhtml->doc;
5665 char *attr_style = NULL;
5666 char *attr_color = NULL;
5667 char *attr_size = NULL;
5669 for (attr = qs_get_attr(doc,node);
5671 attr = qs_get_next_attr(doc,attr)) {
5672 char *name = qs_get_attr_name(doc,attr);
5673 char *value = qs_get_attr_value(doc,attr);
5674 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5678 if (IS_CSS_ON(xhtml->entryp)) {
5679 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5681 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5682 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5683 css_property_t *cur;
5684 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5685 if (cur->value && *cur->value) {
5686 attr_color = apr_pstrdup(doc->pool, cur->value);
5689 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5690 if (cur->value && *cur->value) {
5691 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5692 attr_size = apr_pstrdup(doc->pool, cur->value);
5694 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5695 attr_size = apr_pstrdup(doc->pool, cur->value);
5697 else if (STRCASEEQ('s','S',"small",cur->value)) {
5698 attr_size = apr_pstrdup(doc->pool, cur->value);
5700 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5701 attr_size = apr_pstrdup(doc->pool, cur->value);
5703 else if (STRCASEEQ('l','L',"large",cur->value)) {
5704 attr_size = apr_pstrdup(doc->pool, cur->value);
5706 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5707 attr_size = apr_pstrdup(doc->pool, cur->value);
5709 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5710 attr_size = apr_pstrdup(doc->pool, cur->value);
5717 if (attr_color || attr_size) {
5720 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5738 * It is a handler who processes the BLINK tag.
5740 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5741 * destination is specified.
5742 * @param node [i] The BLINK tag node is specified.
5743 * @return The conversion result is returned.
5746 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
5748 xhtml_t *xhtml = GET_XHTML(pdoc);
5749 Doc *doc = xhtml->doc;
5751 if (IS_CSS_ON(xhtml->entryp)) {
5752 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5759 * It is a handler who processes the MARQUEE tag.
5761 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5762 * destination is specified.
5763 * @param node [i] The MARQUEE tag node is specified.
5764 * @return The conversion result is returned.
5767 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
5769 xhtml_t *xhtml = GET_XHTML(pdoc);
5770 Doc *doc = xhtml->doc;
5772 char *attr_direction = NULL;
5773 char *attr_behavior = NULL;
5774 char *attr_loop = NULL;
5775 char *attr_style = NULL;
5776 char *attr_color = NULL;
5777 char *attr_size = NULL;
5778 char *attr_bgcolor = NULL;
5779 /*--------------------------------------------------------------------------*/
5780 /* Get Attributes */
5781 /*--------------------------------------------------------------------------*/
5782 for (attr = qs_get_attr(doc,node);
5784 attr = qs_get_next_attr(doc,attr)) {
5785 char *name = qs_get_attr_name(doc,attr);
5786 char *value = qs_get_attr_value(doc,attr);
5787 if (STRCASEEQ('d','D',"direction", name)) {
5789 if (STRCASEEQ('l','L',"left",value)) {
5790 attr_direction = "rtl";
5792 else if (STRCASEEQ('r','R',"right",value)) {
5793 attr_direction = "ltr";
5797 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
5798 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
5799 attr_behavior = value;
5802 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
5805 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5806 if (value && *value) {
5807 attr_bgcolor = value;
5810 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5814 if (IS_CSS_ON(xhtml->entryp)) {
5815 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5817 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5818 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5819 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5820 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5821 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5822 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5823 css_property_t *cur;
5824 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5825 if (cur->value && *cur->value) {
5826 attr_color = apr_pstrdup(doc->pool, cur->value);
5829 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5830 if (cur->value && *cur->value) {
5831 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5834 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5835 if (cur->value && *cur->value) {
5836 attr_direction = apr_pstrdup(doc->pool, cur->value);
5839 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
5840 if (cur->value && *cur->value) {
5841 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
5842 attr_behavior = apr_pstrdup(doc->pool, cur->value);
5846 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
5847 if (cur->value && *cur->value) {
5848 attr_loop = apr_pstrdup(doc->pool, cur->value);
5851 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5852 if (cur->value && *cur->value) {
5853 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5854 attr_size = apr_pstrdup(doc->pool, cur->value);
5856 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5857 attr_size = apr_pstrdup(doc->pool, cur->value);
5859 else if (STRCASEEQ('s','S',"small",cur->value)) {
5860 attr_size = apr_pstrdup(doc->pool, cur->value);
5862 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5863 attr_size = apr_pstrdup(doc->pool, cur->value);
5865 else if (STRCASEEQ('l','L',"large",cur->value)) {
5866 attr_size = apr_pstrdup(doc->pool, cur->value);
5868 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5869 attr_size = apr_pstrdup(doc->pool, cur->value);
5871 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5872 attr_size = apr_pstrdup(doc->pool, cur->value);
5879 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5881 if (attr_direction) {
5882 W_L("-wap-marquee-dir:");
5883 W_V(attr_direction);
5886 if (attr_behavior) {
5887 W_L("-wap-marquee-style:");
5892 W_L("-wap-marquee-loop:");
5897 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5898 W_L("background-color:");
5903 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5922 * It is a handler who processes the MARQUEE tag.
5924 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5925 * destination is specified.
5926 * @param node [i] The MARQUEE tag node is specified.
5927 * @return The conversion result is returned.
5930 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5932 xhtml_t *xhtml = GET_XHTML(pdoc);
5933 Doc *doc = xhtml->doc;
5935 if (IS_CSS_ON(xhtml->entryp)) {
5936 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5943 * It is handler who processes the New Line Code.
5946 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5948 xhtml_t *xhtml = GET_XHTML(pdoc);
5949 Doc *doc = xhtml->doc;
5950 if (xhtml->start_html_flag) {
5958 * It is a handler who processes the LINK tag.
5960 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5961 * destination is specified.
5962 * @param node [i] The LINK tag node is specified.
5963 * @return The conversion result is returned.
5966 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5975 xhtml = GET_XHTML(pdoc);
5978 if (! IS_CSS_ON(xhtml->entryp)) {
5982 for (attr = qs_get_attr(doc,node);
5984 attr = qs_get_next_attr(doc,attr)) {
5985 char *name = qs_get_attr_name(doc,attr);
5986 char *value = qs_get_attr_value(doc,attr);
5987 if (STRCASEEQ('r','R',"rel", name)) {
5988 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5992 else if (STRCASEEQ('h','H',"href", name)) {
5993 if (value && *value) {
5997 else if (STRCASEEQ('t','T',"type", name)) {
5998 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6004 if (rel && href && type) {
6005 DBG(doc->r, "start load CSS. url:[%s]", href);
6006 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
6007 DBG(doc->r, "end load CSS. url:[%s]", href);
6013 static css_prop_list_t *
6014 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6016 xhtml_t *xhtml = GET_XHTML(pdoc);
6017 Doc *doc = xhtml->doc;
6018 css_prop_list_t *last_css = NULL;
6019 if (IS_CSS_ON(xhtml->entryp)) {
6020 css_prop_list_t *dup_css;
6021 css_selector_t *selector;
6023 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6024 dup_css = chxj_dup_css_prop_list(doc, last_css);
6025 selector = chxj_css_find_selector(doc, xhtml->style, node);
6027 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6029 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
6030 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6032 if (style_attr_value) {
6033 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));
6035 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6043 static css_prop_list_t *
6044 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6046 xhtml_t *xhtml = GET_XHTML(pdoc);
6047 Doc *doc = xhtml->doc;
6048 css_prop_list_t *last_css = NULL;
6049 if (IS_CSS_ON(xhtml->entryp)) {
6050 css_prop_list_t *dup_css;
6051 css_selector_t *selector;
6053 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6054 dup_css = chxj_dup_css_prop_list(doc, last_css);
6055 selector = chxj_css_find_selector(doc, xhtml->style, node);
6057 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6061 if (style_attr_value) {
6062 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));
6064 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6073 * It is a handler who processes the SPAN tag.
6075 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6076 * destination is specified.
6077 * @param node [i] The SPAN tag node is specified.
6078 * @return The conversion result is returned.
6081 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
6086 char *attr_style = NULL;
6087 char *attr_color = NULL;
6088 char *attr_size = NULL;
6089 char *attr_align = NULL;
6090 char *attr_blink = NULL;
6091 char *attr_marquee = NULL;
6092 char *attr_marquee_dir = NULL;
6093 char *attr_marquee_style = NULL;
6094 char *attr_marquee_loop = NULL;
6095 char *css_bgcolor = NULL;
6097 xhtml = GET_XHTML(pdoc);
6100 for (attr = qs_get_attr(doc,node);
6102 attr = qs_get_next_attr(doc,attr)) {
6103 char *nm = qs_get_attr_name(doc,attr);
6104 char *val = qs_get_attr_value(doc,attr);
6105 if (val && STRCASEEQ('s','S',"style", nm)) {
6109 if (IS_CSS_ON(xhtml->entryp)) {
6110 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
6112 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6113 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6114 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6115 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6116 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6117 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6118 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6119 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6120 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6122 css_property_t *cur;
6123 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6124 attr_color = apr_pstrdup(doc->pool, cur->value);
6126 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6127 if (cur->value && *cur->value) {
6128 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6129 || STRCASEEQ('x','X',"x-small", cur->value)
6130 || STRCASEEQ('s','S',"small", cur->value)
6131 || STRCASEEQ('m','M',"medium", cur->value)
6132 || STRCASEEQ('l','L',"large", cur->value)
6133 || STRCASEEQ('x','X',"x-large", cur->value)
6134 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6135 attr_size = apr_pstrdup(doc->pool, cur->value);
6139 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6140 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6141 attr_blink = apr_pstrdup(doc->pool, cur->value);
6144 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6145 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6146 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6149 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6150 if (cur->value && *cur->value) {
6151 if ( STRCASEEQ('l','L',"ltr",cur->value)
6152 || STRCASEEQ('r','R',"rtl",cur->value)) {
6153 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6157 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6158 if (cur->value && *cur->value) {
6159 if ( STRCASEEQ('s','S',"scroll",cur->value)
6160 || STRCASEEQ('s','S',"slide",cur->value)
6161 || STRCASEEQ('a','A',"alternate",cur->value)) {
6162 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6166 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6167 if (cur->value && *cur->value) {
6168 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6169 attr_marquee_loop = "infinite";
6172 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6176 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6177 if (STRCASEEQ('l','L',"left", cur->value)) {
6178 attr_align = apr_pstrdup(doc->pool, "left");
6180 else if (STRCASEEQ('c','C',"center",cur->value)) {
6181 attr_align = apr_pstrdup(doc->pool, "center");
6183 else if (STRCASEEQ('r','R',"right",cur->value)) {
6184 attr_align = apr_pstrdup(doc->pool, "right");
6187 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6188 if (cur->value && *cur->value) {
6189 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6196 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6199 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6215 W_L("text-decoration:");
6220 W_L("display:-wap-marquee;");
6221 if (attr_marquee_dir) {
6222 W_L("-wap-marquee-dir:");
6223 W_V(attr_marquee_dir);
6226 if (attr_marquee_style) {
6227 W_L("-wap-marquee-style:");
6228 W_V(attr_marquee_style);
6231 if (attr_marquee_loop) {
6232 W_L("-wap-marquee-loop:");
6233 W_V(attr_marquee_loop);
6238 W_L("background-color:");
6250 * It is a handler who processes the SPAN tag.
6252 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6253 * destination is specified.
6254 * @param node [i] The SPAN tag node is specified.
6255 * @return The conversion result is returned.
6258 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
6260 xhtml_t *xhtml = GET_XHTML(pdoc);
6261 Doc *doc = xhtml->doc;
6270 * It is a handler who processes the STYLE tag.
6272 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6273 * destination is specified.
6274 * @param node [i] The STYLE tag node is specified.
6275 * @return The conversion result is returned.
6278 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
6285 xhtml = GET_XHTML(pdoc);
6288 if (! IS_CSS_ON(xhtml->entryp)) {
6292 for (attr = qs_get_attr(doc,node);
6294 attr = qs_get_next_attr(doc,attr)) {
6295 char *name = qs_get_attr_name(doc,attr);
6296 char *value = qs_get_attr_value(doc,attr);
6297 if (STRCASEEQ('t','T',"type", name)) {
6298 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6304 Node *child = qs_get_child_node(doc, node);
6305 if (type && child) {
6306 char *name = qs_get_node_name(doc, child);
6307 if (STRCASEEQ('t','T',"text", name)) {
6308 char *value = qs_get_node_value(doc, child);
6309 DBG(doc->r, "start load CSS. buf:[%s]", value);
6310 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
6311 DBG(doc->r, "end load CSS. value:[%s]", value);
6318 * It is a handler who processes the OBJECT tag.
6320 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6321 * destination is specified.
6322 * @param node [i] The OBJECT tag node is specified.
6323 * @return The conversion result is returned.
6326 s_xhtml_1_0_start_object_tag(void *pdoc, Node *node)
6328 xhtml_t *xhtml = GET_XHTML(pdoc);
6329 Doc *doc = xhtml->doc;
6333 char *attr_id = NULL;
6334 char *attr_width = NULL;
6335 char *attr_height = NULL;
6336 char *attr_data = NULL;
6337 char *attr_type = NULL;
6339 /*--------------------------------------------------------------------------*/
6340 /* Get Attributes */
6341 /*--------------------------------------------------------------------------*/
6342 for (attr = qs_get_attr(doc,node);
6344 attr = qs_get_next_attr(doc,attr)) {
6345 char *name = qs_get_attr_name(doc,attr);
6346 char *value = qs_get_attr_value(doc,attr);
6347 if (STRCASEEQ('i','I',"id",name)) {
6348 attr_id = apr_pstrdup(doc->pool, value);
6350 else if (STRCASEEQ('w','W',"width",name)) {
6351 attr_width = apr_pstrdup(doc->pool, value);
6353 else if (STRCASEEQ('h','H',"height",name)) {
6354 attr_height = apr_pstrdup(doc->pool, value);
6356 else if (STRCASEEQ('d','D',"data",name)) {
6357 attr_data = apr_pstrdup(doc->pool, value);
6359 else if (STRCASEEQ('t','T',"type",name)) {
6360 attr_type = apr_pstrdup(doc->pool, value);
6396 * It is a handler who processes the OBJECT tag.
6398 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6399 * destination is specified.
6400 * @param node [i] The OBJECT tag node is specified.
6401 * @return The conversion result is returned.
6404 s_xhtml_1_0_end_object_tag(void *pdoc, Node *UNUSED(node))
6406 xhtml_t *xhtml = GET_XHTML(pdoc);
6407 Doc *doc = xhtml->doc;
6414 * It is a handler who processes the OBJECT tag.
6416 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6417 * destination is specified.
6418 * @param node [i] The OBJECT tag node is specified.
6419 * @return The conversion result is returned.
6422 s_xhtml_1_0_start_param_tag(void *pdoc, Node *node)
6424 xhtml_t *xhtml = GET_XHTML(pdoc);
6425 Doc *doc = xhtml->doc;
6428 char *attr_style = NULL;
6429 char *attr_name = NULL;
6430 char *attr_value = NULL;
6431 char *attr_valuetype = NULL;
6433 /*--------------------------------------------------------------------------*/
6434 /* Get Attributes */
6435 /*--------------------------------------------------------------------------*/
6436 for (attr = qs_get_attr(doc,node);
6438 attr = qs_get_next_attr(doc,attr)) {
6439 char *name = qs_get_attr_name(doc,attr);
6440 char *value = qs_get_attr_value(doc,attr);
6441 if (STRCASEEQ('n','N',"name",name)) {
6442 attr_name = apr_pstrdup(doc->pool, value);
6444 else if (STRCASEEQ('v','V',"value",name)) {
6445 attr_value = apr_pstrdup(doc->pool, value);
6447 else if (STRCASEEQ('v','V',"valuetype",name)) {
6448 attr_valuetype = apr_pstrdup(doc->pool, value);
6464 W_L(" valuetype=\"");
6465 W_V(attr_valuetype);
6472 * It is a handler who processes the CAPTION tag.
6474 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6475 * destination is specified.
6476 * @param node [i] The CAPTION tag node is specified.
6477 * @return The conversion result is returned.
6480 s_xhtml_1_0_start_caption_tag(void *pdoc, Node *node)
6482 xhtml_t *xhtml = GET_XHTML(pdoc);
6483 Doc *doc = xhtml->doc;
6485 char *attr_style = NULL;
6486 char *attr_align = NULL;
6488 for (attr = qs_get_attr(doc,node);
6490 attr = qs_get_next_attr(doc,attr)) {
6491 char *name = qs_get_attr_name(doc,attr);
6492 char *value = qs_get_attr_value(doc,attr);
6493 if (STRCASEEQ('a','A',"align", name)) {
6495 (STRCASEEQ('l','L',"left",value)
6496 || STRCASEEQ('r','R',"right",value)
6497 || STRCASEEQ('t','T',"top",value)
6498 || STRCASEEQ('b','B',"bottom",value)
6503 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6521 * It is a handler who processes the CAPTION tag.
6523 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6524 * destination is specified.
6525 * @param node [i] The CAPTION tag node is specified.
6526 * @return The conversion result is returned.
6529 s_xhtml_1_0_end_caption_tag(void *pdoc, Node *UNUSED(child))
6531 xhtml_t *xhtml = GET_XHTML(pdoc);
6532 Doc *doc = xhtml->doc;