2 * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_conv_z2h.h"
29 #define GET_XHTML(X) ((xhtml_t*)(X))
32 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
38 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_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,"REQ[%X] start %s()",TO_ADDR(r),__func__);
471 /*--------------------------------------------------------------------------*/
473 /*--------------------------------------------------------------------------*/
475 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
477 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
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,"REQ[%X] end %s()",TO_ADDR(r),__func__);
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,"REQ[%X] spec is NULL",TO_ADDR(r));
595 for (ee = xhtml->conf->emoji;
598 unsigned char hex1byte;
599 unsigned char hex2byte;
601 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
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 %s()",TO_ADDR(r),__func__);
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 %s()",TO_ADDR(r),__func__);
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;
1419 char *attr_style = NULL;
1420 char *attr_align = NULL;
1421 char *attr_width = NULL;
1422 char *attr_height = NULL;
1423 char *attr_bgcolor = NULL;
1424 char *attr_border_width = NULL;
1425 char *attr_border_color = NULL;
1427 /*--------------------------------------------------------------------------*/
1428 /* Get Attributes */
1429 /*--------------------------------------------------------------------------*/
1430 for (attr = qs_get_attr(doc,node);
1432 attr = qs_get_next_attr(doc,attr)) {
1433 char *name = qs_get_attr_name(doc,attr);
1434 char *val = qs_get_attr_value(doc,attr);
1436 if (STRCASEEQ('a','A',"align",name)) {
1437 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1438 attr_align = apr_pstrdup(doc->buf.pool, val);
1441 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1442 attr_height = apr_pstrdup(doc->buf.pool, val);
1444 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1445 attr_width = apr_pstrdup(doc->buf.pool, val);
1447 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1448 attr_style = apr_pstrdup(doc->buf.pool, val);
1450 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1451 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1452 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1454 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1455 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1457 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1458 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1459 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1462 if (IS_CSS_ON(xhtml->entryp)) {
1463 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1465 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1466 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1467 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1468 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1469 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1470 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1472 css_property_t *cur;
1473 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1474 char *tmp = apr_pstrdup(doc->pool, cur->value);
1475 char *tmpp = strstr(tmp, "px");
1477 size_t len = strlen(tmp) - strlen(tmpp);
1478 attr_width = apr_pstrndup(doc->pool, tmp,len);
1481 attr_width = apr_pstrdup(doc->pool, tmp);
1484 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1485 char *tmp = apr_pstrdup(doc->pool, cur->value);
1486 char *tmpp = strstr(tmp, "px");
1488 size_t len = strlen(tmp) - strlen(tmpp);
1489 attr_height = apr_pstrndup(doc->pool, tmp,len);
1492 attr_height = apr_pstrdup(doc->pool, tmp);
1495 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1496 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1497 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1500 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1501 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1502 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1504 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1505 char *tmp = apr_pstrdup(doc->pool, cur->value);
1506 char *tmpp = strstr(tmp, "px");
1508 size_t len = strlen(tmp) - strlen(tmpp);
1509 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1512 attr_border_width = apr_pstrdup(doc->pool, tmp);
1515 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1516 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1517 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1538 if (attr_bgcolor && *attr_bgcolor){
1543 if (attr_border_width || attr_border_color ){
1544 W_L(" style=\"border:");
1545 if (attr_border_width){
1546 W_V(attr_border_width);
1553 if (attr_border_color && *attr_border_color){
1555 W_V(attr_border_color);
1567 * It is a handler who processes the TABLE tag.
1569 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1570 * destination is specified.
1571 * @param node [i] The TR tag node is specified.
1572 * @return The conversion result is returned.
1575 s_xhtml_1_0_end_table_tag(void *pdoc, Node *UNUSED(child))
1577 xhtml_t *xhtml = GET_XHTML(pdoc);
1578 Doc *doc = xhtml->doc;
1585 * It is a handler who processes the TR tag.
1587 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1588 * destination is specified.
1589 * @param node [i] The TR tag node is specified.
1590 * @return The conversion result is returned.
1593 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *node)
1595 xhtml_t *xhtml = GET_XHTML(pdoc);
1596 Doc *doc = xhtml->doc;
1600 char *attr_style = NULL;
1601 char *attr_align = NULL;
1602 char *attr_valign = NULL;
1603 char *attr_bgcolor = NULL;
1605 /*--------------------------------------------------------------------------*/
1606 /* Get Attributes */
1607 /*--------------------------------------------------------------------------*/
1608 for (attr = qs_get_attr(doc,node);
1610 attr = qs_get_next_attr(doc,attr)) {
1611 char *name = qs_get_attr_name(doc,attr);
1612 char *val = qs_get_attr_value(doc,attr);
1614 if (STRCASEEQ('a','A',"align",name)) {
1615 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1616 attr_align = apr_pstrdup(doc->buf.pool, val);
1619 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1620 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1621 attr_valign = apr_pstrdup(doc->buf.pool, val);
1624 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1625 attr_style = apr_pstrdup(doc->buf.pool, val);
1627 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1628 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1629 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1632 if (IS_CSS_ON(xhtml->entryp)) {
1633 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1635 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1636 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1637 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1639 css_property_t *cur;
1640 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1641 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1642 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1645 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1646 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1647 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1650 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1651 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1652 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1668 if (attr_bgcolor && *attr_bgcolor){
1680 * It is a handler who processes the TR tag.
1682 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1683 * destination is specified.
1684 * @param node [i] The TR tag node is specified.
1685 * @return The conversion result is returned.
1688 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1690 xhtml_t *xhtml = GET_XHTML(pdoc);
1691 Doc *doc = xhtml->doc;
1699 * It is a handler who processes the TD tag.
1701 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1702 * destination is specified.
1703 * @param node [i] The TR tag node is specified.
1704 * @return The conversion result is returned.
1707 s_xhtml_1_0_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1709 xhtml_t *xhtml = GET_XHTML(pdoc);
1710 Doc *doc = xhtml->doc;
1714 char *attr_style = NULL;
1715 char *attr_align = NULL;
1716 char *attr_valign = NULL;
1717 char *attr_bgcolor = NULL;
1718 char *attr_colspan = NULL;
1719 char *attr_rowspan = NULL;
1720 char *attr_width = NULL;
1721 char *attr_height = NULL;
1723 /*--------------------------------------------------------------------------*/
1724 /* Get Attributes */
1725 /*--------------------------------------------------------------------------*/
1726 for (attr = qs_get_attr(doc,node);
1728 attr = qs_get_next_attr(doc,attr)) {
1729 char *name = qs_get_attr_name(doc,attr);
1730 char *val = qs_get_attr_value(doc,attr);
1731 if (STRCASEEQ('a','A',"align",name)) {
1732 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1733 attr_align = apr_pstrdup(doc->buf.pool, val);
1736 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1737 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1738 attr_valign = apr_pstrdup(doc->buf.pool, val);
1741 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1742 attr_style = apr_pstrdup(doc->buf.pool, val);
1744 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1745 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1746 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1748 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1749 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1751 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1752 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1754 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1755 char *tmp = strstr(val, "%");
1757 attr_width = apr_pstrdup(doc->buf.pool, val);
1760 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1763 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1764 char *tmp = strstr(val, "%");
1766 attr_height = apr_pstrdup(doc->buf.pool, val);
1769 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1774 if (IS_CSS_ON(xhtml->entryp)) {
1775 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1777 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1778 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1779 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1780 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1781 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1783 css_property_t *cur;
1784 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1785 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1786 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1789 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1790 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1791 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1794 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1795 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1796 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1798 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1799 attr_width = apr_pstrdup(doc->pool, cur->value);
1801 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1802 attr_height = apr_pstrdup(doc->pool, cur->value);
1829 if (attr_bgcolor && *attr_bgcolor){
1834 if (attr_width || attr_height ){
1855 * It is a handler who processes the TD tag.
1857 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1858 * destination is specified.
1859 * @param node [i] The TR tag node is specified.
1860 * @return The conversion result is returned.
1863 s_xhtml_1_0_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1865 xhtml_t *xhtml = GET_XHTML(pdoc);
1866 Doc *doc = xhtml->doc;
1876 * It is a handler who processes the TD tag.
1878 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1879 * destination is specified.
1880 * @param node [i] The TD tag node is specified.
1881 * @return The conversion result is returned.
1884 s_xhtml_1_0_start_td_tag(void *pdoc, Node *child)
1886 return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"td");
1890 * It is a handler who processes the TD tag.
1892 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1893 * destination is specified.
1894 * @param node [i] The TD tag node is specified.
1895 * @return The conversion result is returned.
1898 s_xhtml_1_0_end_td_tag(void *pdoc, Node *child)
1900 return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"td");
1904 * It is a handler who processes the TD tag.
1906 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1907 * destination is specified.
1908 * @param node [i] The TH tag node is specified.
1909 * @return The conversion result is returned.
1912 s_xhtml_1_0_start_th_tag(void *pdoc, Node *child)
1914 return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"th");
1918 * It is a handler who processes the TD tag.
1920 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1921 * destination is specified.
1922 * @param node [i] The TH tag node is specified.
1923 * @return The conversion result is returned.
1926 s_xhtml_1_0_end_th_tag(void *pdoc, Node *child)
1928 return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"th");
1934 * It is a handler who processes the FONT tag.
1936 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1937 * destination is specified.
1938 * @param node [i] The FONT tag node is specified.
1939 * @return The conversion result is returned.
1942 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1944 xhtml_t *xhtml = GET_XHTML(pdoc);
1945 Doc *doc = xhtml->doc;
1947 char *attr_color = NULL;
1948 char *attr_size = NULL;
1949 char *attr_style = NULL;
1951 /*--------------------------------------------------------------------------*/
1952 /* Get Attributes */
1953 /*--------------------------------------------------------------------------*/
1954 for (attr = qs_get_attr(doc,node);
1956 attr = qs_get_next_attr(doc,attr)) {
1957 char *name = qs_get_attr_name(doc,attr);
1958 char *value = qs_get_attr_value(doc,attr);
1959 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1960 attr_color = apr_pstrdup(doc->buf.pool, value);
1962 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1963 /*----------------------------------------------------------------------*/
1965 /*----------------------------------------------------------------------*/
1966 attr_size = apr_pstrdup(doc->buf.pool, value);
1968 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1969 attr_style = apr_pstrdup(doc->buf.pool, value);
1972 if (IS_CSS_ON(xhtml->entryp)) {
1973 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1975 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1976 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1977 css_property_t *cur;
1978 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1979 if (cur->value && *cur->value) {
1980 attr_color = apr_pstrdup(doc->pool, cur->value);
1983 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1984 if (cur->value && *cur->value) {
1985 attr_size = apr_pstrdup(doc->pool, cur->value);
1986 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1987 attr_size = apr_pstrdup(doc->pool, "1");
1989 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1990 attr_size = apr_pstrdup(doc->pool, "2");
1992 else if (STRCASEEQ('s','S',"small",attr_size)) {
1993 attr_size = apr_pstrdup(doc->pool, "3");
1995 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1996 attr_size = apr_pstrdup(doc->pool, "4");
1998 else if (STRCASEEQ('l','L',"large",attr_size)) {
1999 attr_size = apr_pstrdup(doc->pool, "5");
2001 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2002 attr_size = apr_pstrdup(doc->pool, "6");
2004 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2005 attr_size = apr_pstrdup(doc->pool, "7");
2012 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2013 memset(flg, 0, sizeof(*flg));
2015 W_L("<font color=\"");
2018 flg->font_color_flag = 1;
2021 flg->font_size_flag = 1;
2022 switch(*attr_size) {
2023 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2024 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2025 case '3': W_L("<span style=\"font-size: small\">"); break;
2026 case '4': W_L("<span style=\"font-size: medium\">"); break;
2027 case '5': W_L("<span style=\"font-size: large\">"); break;
2028 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2029 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2031 if (*(attr_size + 1) == '1') {
2032 W_L("<span style=\"font-size: small\">");
2035 if (*(attr_size + 1) == '2') {
2036 W_L("<span style=\"font-size: x-small\">");
2039 if (*(attr_size + 1) == '3') {
2040 W_L("<span style=\"font-size: xx-small\">");
2043 flg->font_size_flag = 0;
2047 if (*(attr_size + 1) == '1') {
2048 W_L("<span style=\"font-size: large\">");
2051 if (*(attr_size + 1) == '2') {
2052 W_L("<span style=\"font-size: x-large\">");
2055 if (*(attr_size + 1) == '3') {
2056 W_L("<span style=\"font-size: xx-large\">");
2059 flg->font_size_flag = 0;
2063 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2064 flg->font_size_flag = 0;
2067 node->userData = flg;
2074 * It is a handler who processes the FONT tag.
2076 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2077 * destination is specified.
2078 * @param node [i] The FONT tag node is specified.
2079 * @return The conversion result is returned.
2082 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
2084 xhtml_t *xhtml = GET_XHTML(pdoc);
2085 Doc *doc = xhtml->doc;
2087 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2088 if (flg && flg->font_size_flag) {
2091 if (flg && flg->font_color_flag) {
2094 if (IS_CSS_ON(xhtml->entryp)) {
2095 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2102 * It is a handler who processes the FORM tag.
2104 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2105 * destination is specified.
2106 * @param node [i] The FORM tag node is specified.
2107 * @return The conversion result is returned.
2110 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
2112 xhtml_t *xhtml = GET_XHTML(pdoc);
2113 Doc *doc = xhtml->doc;
2114 request_rec *r = doc->r;
2116 char *attr_action = NULL;
2117 char *attr_method = NULL;
2118 char *attr_style = NULL;
2119 char *attr_color = NULL;
2120 char *attr_align = NULL;
2121 char *attr_name = NULL;
2122 char *css_clear = NULL;
2123 char *new_hidden_tag = NULL;
2125 /*--------------------------------------------------------------------------*/
2126 /* Get Attributes */
2127 /*--------------------------------------------------------------------------*/
2128 for (attr = qs_get_attr(doc,node);
2130 attr = qs_get_next_attr(doc,attr)) {
2131 char *name = qs_get_attr_name(doc,attr);
2132 char *value = qs_get_attr_value(doc,attr);
2136 if (strcasecmp(name, "action") == 0) {
2137 /*--------------------------------------------------------------------*/
2139 /*--------------------------------------------------------------------*/
2140 attr_action = value;
2146 if (strcasecmp(name, "method") == 0) {
2147 /*--------------------------------------------------------------------*/
2149 /*--------------------------------------------------------------------*/
2150 attr_method = value;
2156 if (strcasecmp(name, "name") == 0) {
2157 /*--------------------------------------------------------------------*/
2159 /*--------------------------------------------------------------------*/
2166 if (strcasecmp(name, "style") == 0) {
2175 if (IS_CSS_ON(xhtml->entryp)) {
2176 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2178 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2179 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2180 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2181 css_property_t *cur;
2182 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2183 if (STRCASEEQ('l','L',"left", cur->value)) {
2184 attr_align = apr_pstrdup(doc->pool, "left");
2186 else if (STRCASEEQ('c','C',"center",cur->value)) {
2187 attr_align = apr_pstrdup(doc->pool, "center");
2189 else if (STRCASEEQ('r','R',"right",cur->value)) {
2190 attr_align = apr_pstrdup(doc->pool, "right");
2193 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2194 attr_color = apr_pstrdup(doc->pool, cur->value);
2196 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2197 css_clear = apr_pstrdup(doc->pool, cur->value);
2202 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2206 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2207 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
2209 char *old_qs = NULL;
2210 q = strchr(attr_action, '?');
2212 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);
2213 if (new_hidden_tag || old_qs) {
2243 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
2244 memset(flg, 0, sizeof(*flg));
2246 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2247 W_L("<font color=\"");
2250 flg->with_font_flag = 1;
2253 W_L("<div align=\"");
2256 flg->with_div_flag = 1;
2258 node->userData = flg;
2259 if (new_hidden_tag) {
2260 W_V(new_hidden_tag);
2267 * It is a handler who processes the FORM tag.
2269 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2270 * destination is specified.
2271 * @param node [i] The FORM tag node is specified.
2272 * @return The conversion result is returned.
2275 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
2277 xhtml_t *xhtml = GET_XHTML(pdoc);
2278 Doc *doc = xhtml->doc;
2280 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2281 if (flg && flg->with_div_flag) {
2284 if (flg && flg->with_font_flag) {
2288 if (IS_CSS_ON(xhtml->entryp)) {
2289 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2297 * It is a handler who processes the INPUT tag.
2299 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2300 * destination is specified.
2301 * @param node [i] The INPUT tag node is specified.
2302 * @return The conversion result is returned.
2305 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
2307 xhtml_t *xhtml = GET_XHTML(pdoc);
2308 Doc *doc = xhtml->doc;
2310 char *attr_max_length = NULL;
2311 char *attr_type = NULL;
2312 char *attr_name = NULL;
2313 char *attr_value = NULL;
2314 char *attr_istyle = NULL;
2315 char *attr_size = NULL;
2316 char *attr_checked = NULL;
2317 char *attr_accesskey = NULL;
2318 char *attr_style = NULL;
2320 /*--------------------------------------------------------------------------*/
2321 /* Get Attributes */
2322 /*--------------------------------------------------------------------------*/
2323 for (attr = qs_get_attr(doc,node);
2325 attr = qs_get_next_attr(doc,attr)) {
2326 char *name = qs_get_attr_name(doc,attr);
2327 char *value = qs_get_attr_value(doc,attr);
2328 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2329 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2330 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2331 STRCASEEQ('p','P',"password",tmp_type) ||
2332 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2333 STRCASEEQ('r','R',"radio", tmp_type) ||
2334 STRCASEEQ('h','H',"hidden", tmp_type) ||
2335 STRCASEEQ('s','S',"submit", tmp_type) ||
2336 STRCASEEQ('r','R',"reset", tmp_type))) {
2337 attr_type = tmp_type;
2340 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2343 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2346 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2347 attr_istyle = value;
2349 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2350 attr_max_length = value;
2352 else if (STRCASEEQ('c','C',"checked", name)) {
2353 attr_checked = value;
2355 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2356 attr_accesskey = value;
2358 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2361 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2366 if (IS_CSS_ON(xhtml->entryp)) {
2367 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2369 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2370 css_property_t *cur;
2371 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2372 if (strcasestr(cur->value, "<ja:n>")) {
2375 else if (strcasestr(cur->value, "<ja:en>")) {
2378 else if (strcasestr(cur->value, "<ja:hk>")) {
2381 else if (strcasestr(cur->value, "<ja:h>")) {
2389 attr_type = qs_trim_string(doc->buf.pool, attr_type);
2390 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
2391 STRCASEEQ('p','P',"password",attr_type) ||
2392 STRCASEEQ('c','C',"checkbox",attr_type) ||
2393 STRCASEEQ('r','R',"radio", attr_type) ||
2394 STRCASEEQ('h','H',"hidden", attr_type) ||
2395 STRCASEEQ('s','S',"submit", attr_type) ||
2396 STRCASEEQ('r','R',"reset", attr_type))) {
2402 if (attr_size && *attr_size) {
2407 if (attr_name && *attr_name) {
2412 if (attr_value && *attr_value) {
2414 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2417 if (attr_accesskey && *attr_accesskey) {
2418 W_L(" accesskey=\"");
2419 W_V(attr_accesskey);
2422 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2427 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2428 W_L(" istyle=\"4\"");
2430 if (attr_max_length && *attr_max_length) {
2431 if (chxj_chk_numeric(attr_max_length) == 0) {
2432 W_L(" maxlength=\"");
2433 W_V(attr_max_length);
2437 /*--------------------------------------------------------------------------*/
2438 /* The figure is default for the password. */
2439 /*--------------------------------------------------------------------------*/
2440 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
2441 if (attr_max_length) {
2443 W_V(attr_max_length);
2447 W_L(" FORMAT=\"*N\"");
2451 W_L(" checked=\"checked\"");
2456 /*--------------------------------------------------------------------------*/
2457 /* Get Attributes */
2458 /*--------------------------------------------------------------------------*/
2459 type = qs_get_type_attr(doc, node, doc->buf.pool);
2460 name = qs_get_name_attr(doc, node, doc->buf.pool);
2461 value = qs_get_value_attr(doc,node, doc->buf.pool);
2462 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2463 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2464 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
2465 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2466 size = qs_get_size_attr(doc, node, doc->buf.pool);
2469 type = qs_trim_string(doc->buf.pool, type);
2470 if (type && (STRCASEEQ('t','T',"text", type) ||
2471 STRCASEEQ('p','P',"password",type) ||
2472 STRCASEEQ('c','C',"checkbox",type) ||
2473 STRCASEEQ('r','R',"radio", type) ||
2474 STRCASEEQ('h','H',"hidden", type) ||
2475 STRCASEEQ('s','S',"submit", type) ||
2476 STRCASEEQ('r','R',"reset", type))) {
2482 if (size && *size) {
2487 if (name && *name) {
2492 if (value && *value) {
2493 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2494 apr_size_t value_len = strlen(value);
2495 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
2499 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2502 if (accesskey && *accesskey) {
2503 W_L(" accesskey=\"");
2507 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2508 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
2509 if (max_length && *max_length) {
2511 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
2512 if (max_length[ii] < '0' || max_length[ii] > '9') {
2513 max_length = apr_psprintf(r->pool, "0");
2518 if (strcmp(max_length, "0")) {
2519 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
2531 if (max_length && *max_length) {
2532 if (chxj_chk_numeric(max_length) != 0) {
2533 max_length = apr_psprintf(r->pool, "0");
2535 if (strcmp(max_length, "0")) {
2536 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
2541 /*--------------------------------------------------------------------------*/
2542 /* The figure is default for the password. */
2543 /*--------------------------------------------------------------------------*/
2544 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
2551 W_L(" FORMAT=\"*N\"");
2555 W_L(" checked=\"checked\"");
2565 * It is a handler who processes the INPUT tag.
2567 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2568 * destination is specified.
2569 * @param node [i] The INPUT tag node is specified.
2570 * @return The conversion result is returned.
2573 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
2575 xhtml_t *xhtml = GET_XHTML(pdoc);
2582 * It is a handler who processes the CENTER tag.
2584 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2585 * destination is specified.
2586 * @param node [i] The CENTER tag node is specified.
2587 * @return The conversion result is returned.
2590 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2595 char *attr_style = NULL;
2596 char *attr_color = NULL;
2597 char *attr_size = NULL;
2599 xhtml = GET_XHTML(pdoc);
2602 for (attr = qs_get_attr(doc,node);
2604 attr = qs_get_next_attr(doc,attr)) {
2605 char *name = qs_get_attr_name(doc,attr);
2606 char *value = qs_get_attr_value(doc,attr);
2607 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2611 if (IS_CSS_ON(xhtml->entryp)) {
2612 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2614 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2615 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2616 css_property_t *cur;
2617 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2618 if (cur->value && *cur->value) {
2619 attr_color = apr_pstrdup(doc->pool, cur->value);
2622 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2623 if (cur->value && *cur->value) {
2624 attr_size = apr_pstrdup(doc->pool, cur->value);
2631 if (attr_size || attr_color) {
2639 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2653 * It is a handler who processes the CENTER tag.
2655 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2656 * destination is specified.
2657 * @param node [i] The CENTER tag node is specified.
2658 * @return The conversion result is returned.
2661 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2663 xhtml_t *xhtml = GET_XHTML(pdoc);
2664 Doc *doc = xhtml->doc;
2667 if (IS_CSS_ON(xhtml->entryp)) {
2668 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2675 * It is a handler who processes the HR tag.
2677 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2678 * destination is specified.
2679 * @param node [i] The HR tag node is specified.
2680 * @return The conversion result is returned.
2683 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2689 char *attr_align = NULL;
2690 char *attr_size = NULL;
2691 char *attr_width = NULL;
2692 char *attr_noshade = NULL;
2693 char *attr_style = NULL;
2694 char *attr_color = NULL;
2696 xhtml = GET_XHTML(pdoc);
2700 for (attr = qs_get_attr(doc,node);
2702 attr = qs_get_next_attr(doc,attr)) {
2703 char *name = qs_get_attr_name (doc,attr);
2704 char *value = qs_get_attr_value(doc,attr);
2708 if (strcasecmp(name, "align") == 0) {
2709 /*--------------------------------------------------------------------*/
2711 /*--------------------------------------------------------------------*/
2712 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2720 if (strcasecmp(name, "size") == 0) {
2721 /*--------------------------------------------------------------------*/
2723 /*--------------------------------------------------------------------*/
2724 if (value && *value) {
2728 else if (strcasecmp(name, "style") == 0) {
2729 if (value && *value) {
2737 if (strcasecmp(name, "width") == 0) {
2738 /*--------------------------------------------------------------------*/
2740 /*--------------------------------------------------------------------*/
2741 if (value && *value) {
2749 if (strcasecmp(name, "noshade") == 0) {
2750 /*--------------------------------------------------------------------*/
2752 /*--------------------------------------------------------------------*/
2753 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2759 if (strcasecmp(name, "color") == 0 && value && *value) {
2760 /*--------------------------------------------------------------------*/
2762 /*--------------------------------------------------------------------*/
2771 if (IS_CSS_ON(xhtml->entryp)) {
2772 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2774 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2775 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2776 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2778 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2779 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2782 css_property_t *cur;
2783 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2784 if (STRCASEEQ('s','S',"solid",cur->value)) {
2785 attr_noshade = "noshade";
2788 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2789 char *tmp = apr_pstrdup(doc->pool, cur->value);
2790 char *tmpp = strstr(tmp, "px");
2792 size_t len = strlen(tmp) - strlen(tmpp);
2793 attr_size = apr_pstrndup(doc->pool, tmp,len);
2796 char *tmp2 = strstr(tmp,"%");
2798 attr_size = apr_pstrdup(doc->pool, tmp);
2802 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2803 char *tmp = apr_pstrdup(doc->pool, cur->value);
2804 char *tmpp = strstr(tmp, "px");
2806 attr_width = apr_pstrdup(doc->pool, tmp);
2809 tmpp = strstr(tmp, "%");
2811 attr_width = apr_pstrdup(doc->pool, tmp);
2816 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2817 char *tmp = apr_pstrdup(doc->pool, cur->value);
2818 char *tmpp = strstr(tmp,"none");
2820 attr_align = "center";
2824 attr_align = apr_pstrdup(doc->pool, tmp);
2830 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2831 char *tmp = apr_pstrdup(doc->pool, cur->value);
2833 attr_color = apr_pstrdup(doc->pool, tmp);
2853 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2881 * It is a handler who processes the HR tag.
2883 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2884 * destination is specified.
2885 * @param node [i] The HR tag node is specified.
2886 * @return The conversion result is returned.
2889 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2891 xhtml_t *xhtml = GET_XHTML(pdoc);
2898 * It is a handler who processes the PRE tag.
2900 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2901 * destination is specified.
2902 * @param node [i] The PRE tag node is specified.
2903 * @return The conversion result is returned.
2906 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2908 xhtml_t *xhtml = GET_XHTML(pdoc);
2909 Doc *doc = xhtml->doc;
2911 char *attr_style = NULL;
2913 for (attr = qs_get_attr(doc,node);
2915 attr = qs_get_next_attr(doc,attr)) {
2916 char *nm = qs_get_attr_name(doc,attr);
2917 char *val = qs_get_attr_value(doc,attr);
2918 if (val && STRCASEEQ('s','S',"style", nm)) {
2923 if (IS_CSS_ON(xhtml->entryp)) {
2924 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2934 * It is a handler who processes the PRE tag.
2936 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2937 * destination is specified.
2938 * @param node [i] The PRE tag node is specified.
2939 * @return The conversion result is returned.
2942 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2944 xhtml_t *xhtml = GET_XHTML(pdoc);
2945 Doc *doc = xhtml->doc;
2949 if (IS_CSS_ON(xhtml->entryp)) {
2950 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2958 * It is a handler who processes the P tag.
2960 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2961 * destination is specified.
2962 * @param node [i] The P tag node is specified.
2963 * @return The conversion result is returned.
2966 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2968 xhtml_t *xhtml = GET_XHTML(pdoc);
2969 Doc *doc = xhtml->doc;
2971 char *attr_align = NULL;
2972 char *attr_style = NULL;
2973 char *attr_color = NULL;
2974 char *attr_blink = NULL;
2975 char *css_clear = NULL;
2977 for (attr = qs_get_attr(doc,node);
2979 attr = qs_get_next_attr(doc,attr)) {
2980 char *nm = qs_get_attr_name(doc,attr);
2981 char *val = qs_get_attr_value(doc,attr);
2982 if (STRCASEEQ('a','A',"align", nm)) {
2983 /*----------------------------------------------------------------------*/
2984 /* CHTML 1.0 (W3C version 3.2) */
2985 /*----------------------------------------------------------------------*/
2986 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2987 attr_align = apr_pstrdup(doc->buf.pool, val);
2991 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2992 attr_style = apr_pstrdup(doc->buf.pool, val);
2995 if (IS_CSS_ON(xhtml->entryp)) {
2996 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2998 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2999 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3000 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3001 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3002 css_property_t *cur;
3003 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3004 if (STRCASEEQ('l','L',"left",cur->value)) {
3005 attr_align = apr_pstrdup(doc->pool, "left");
3007 else if (STRCASEEQ('c','C',"center",cur->value)) {
3008 attr_align = apr_pstrdup(doc->pool, "center");
3010 else if (STRCASEEQ('r','R',"right",cur->value)) {
3011 attr_align = apr_pstrdup(doc->pool, "right");
3014 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3015 if (cur->value && *cur->value) {
3016 attr_color = apr_pstrdup(doc->pool, cur->value);
3019 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3020 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3021 attr_blink = apr_pstrdup(doc->pool, cur->value);
3024 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3025 css_clear = apr_pstrdup(doc->pool, cur->value);
3030 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3038 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3044 W_L("text-decoration:");
3061 * It is a handler who processes the P tag.
3063 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3064 * destination is specified.
3065 * @param node [i] The P tag node is specified.
3066 * @return The conversion result is returned.
3069 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
3071 xhtml_t *xhtml = GET_XHTML(pdoc);
3072 Doc *doc = xhtml->doc;
3075 if (IS_CSS_ON(xhtml->entryp)) {
3076 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3083 * It is a handler who processes the UL tag.
3085 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3086 * destination is specified.
3087 * @param node [i] The UL tag node is specified.
3088 * @return The conversion result is returned.
3091 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
3093 xhtml_t *xhtml = GET_XHTML(pdoc);
3094 Doc *doc = xhtml->doc;
3096 char *attr_type = NULL;
3097 char *attr_style = NULL;
3098 /*--------------------------------------------------------------------------*/
3099 /* Get Attributes */
3100 /*--------------------------------------------------------------------------*/
3101 for (attr = qs_get_attr(doc,node);
3103 attr = qs_get_next_attr(doc,attr)) {
3104 char *name = qs_get_attr_name(doc,attr);
3105 char *value = qs_get_attr_value(doc,attr);
3106 if (STRCASEEQ('t','T',"type",name)) {
3107 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3111 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3115 if (IS_CSS_ON(xhtml->entryp)) {
3116 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3118 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3119 css_property_t *cur;
3120 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3121 if (STRCASEEQ('d','D',"disc",cur->value)) {
3122 attr_type = apr_pstrdup(doc->pool, "disc");
3124 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3125 attr_type = apr_pstrdup(doc->pool, "circle");
3127 else if (STRCASEEQ('s','S',"square",cur->value)) {
3128 attr_type = apr_pstrdup(doc->pool, "square");
3136 W_L("list-style-type:");
3147 * It is a handler who processes the UL tag.
3149 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3150 * destination is specified.
3151 * @param node [i] The UL tag node is specified.
3152 * @return The conversion result is returned.
3155 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
3157 xhtml_t *xhtml = GET_XHTML(pdoc);
3158 Doc *doc = xhtml->doc;
3161 if (IS_CSS_ON(xhtml->entryp)) {
3162 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3169 * It is a handler who processes the H1 tag.
3171 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3172 * destination is specified.
3173 * @param node [i] The H1 tag node is specified.
3174 * @return The conversion result is returned.
3177 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
3179 xhtml_t *xhtml = GET_XHTML(pdoc);
3180 Doc *doc = xhtml->doc;
3182 char *attr_style = NULL;
3183 char *attr_align = NULL;
3184 char *css_clear = NULL;
3186 for (attr = qs_get_attr(doc,node);
3188 attr = qs_get_next_attr(doc,attr)) {
3189 char *name = qs_get_attr_name(doc,attr);
3190 char *value = qs_get_attr_value(doc,attr);
3191 if (STRCASEEQ('a','A',"align", name)) {
3192 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3196 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3200 if (IS_CSS_ON(xhtml->entryp)) {
3201 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3203 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3204 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3205 css_property_t *cur;
3206 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3207 if (STRCASEEQ('l','L',"left", cur->value)) {
3208 attr_align = apr_pstrdup(doc->pool, "left");
3210 else if (STRCASEEQ('c','C',"center",cur->value)) {
3211 attr_align = apr_pstrdup(doc->pool, "center");
3213 else if (STRCASEEQ('r','R',"right",cur->value)) {
3214 attr_align = apr_pstrdup(doc->pool, "right");
3217 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3218 if (STRCASEEQ('b','B',"both", cur->value)) {
3219 css_clear = apr_pstrdup(doc->pool, "both");
3221 else if (STRCASEEQ('r','R',"right", cur->value)) {
3222 css_clear = apr_pstrdup(doc->pool, "right");
3224 else if (STRCASEEQ('l','L',"left", cur->value)) {
3225 css_clear = apr_pstrdup(doc->pool, "left");
3231 if (attr_align || css_clear ) {
3252 * It is a handler who processes the H1 tag.
3254 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3255 * destination is specified.
3256 * @param node [i] The H1 tag node is specified.
3257 * @return The conversion result is returned.
3260 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
3262 xhtml_t *xhtml = GET_XHTML(pdoc);
3263 Doc *doc = xhtml->doc;
3266 if (IS_CSS_ON(xhtml->entryp)) {
3267 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3274 * It is a handler who processes the H2 tag.
3276 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3277 * destination is specified.
3278 * @param node [i] The H2 tag node is specified.
3279 * @return The conversion result is returned.
3282 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
3284 xhtml_t *xhtml = GET_XHTML(pdoc);
3285 Doc *doc = xhtml->doc;
3287 char *attr_style = NULL;
3288 char *attr_align = NULL;
3289 char *css_clear = NULL;
3291 for (attr = qs_get_attr(doc,node);
3293 attr = qs_get_next_attr(doc,attr)) {
3294 char *name = qs_get_attr_name(doc,attr);
3295 char *value = qs_get_attr_value(doc,attr);
3296 if (STRCASEEQ('a','A',"align", name)) {
3297 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3301 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3305 if (IS_CSS_ON(xhtml->entryp)) {
3306 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3308 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3309 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3310 css_property_t *cur;
3311 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3312 if (STRCASEEQ('l','L',"left", cur->value)) {
3313 attr_align = apr_pstrdup(doc->pool, "left");
3315 else if (STRCASEEQ('c','C',"center",cur->value)) {
3316 attr_align = apr_pstrdup(doc->pool, "center");
3318 else if (STRCASEEQ('r','R',"right",cur->value)) {
3319 attr_align = apr_pstrdup(doc->pool, "right");
3322 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3323 if (STRCASEEQ('b','B',"both", cur->value)) {
3324 css_clear = apr_pstrdup(doc->pool, "both");
3326 else if (STRCASEEQ('r','R',"right", cur->value)) {
3327 css_clear = apr_pstrdup(doc->pool, "right");
3329 else if (STRCASEEQ('l','L',"left", cur->value)) {
3330 css_clear = apr_pstrdup(doc->pool, "left");
3336 if (attr_align || css_clear ) {
3357 * It is a handler who processes the H2 tag.
3359 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3360 * destination is specified.
3361 * @param node [i] The H2 tag node is specified.
3362 * @return The conversion result is returned.
3365 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
3367 xhtml_t *xhtml = GET_XHTML(pdoc);
3368 Doc *doc = xhtml->doc;
3371 if (IS_CSS_ON(xhtml->entryp)) {
3372 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3379 * It is a handler who processes the H3 tag.
3381 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3382 * destination is specified.
3383 * @param node [i] The H3 tag node is specified.
3384 * @return The conversion result is returned.
3387 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
3389 xhtml_t *xhtml = GET_XHTML(pdoc);
3390 Doc *doc = xhtml->doc;
3392 char *attr_style = NULL;
3393 char *attr_align = NULL;
3394 char *css_clear = NULL;
3396 for (attr = qs_get_attr(doc,node);
3398 attr = qs_get_next_attr(doc,attr)) {
3399 char *name = qs_get_attr_name(doc,attr);
3400 char *value = qs_get_attr_value(doc,attr);
3401 if (STRCASEEQ('a','A',"align", name)) {
3402 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3406 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3410 if (IS_CSS_ON(xhtml->entryp)) {
3411 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3413 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3414 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3415 css_property_t *cur;
3416 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3417 if (STRCASEEQ('l','L',"left", cur->value)) {
3418 attr_align = apr_pstrdup(doc->pool, "left");
3420 else if (STRCASEEQ('c','C',"center",cur->value)) {
3421 attr_align = apr_pstrdup(doc->pool, "center");
3423 else if (STRCASEEQ('r','R',"right",cur->value)) {
3424 attr_align = apr_pstrdup(doc->pool, "right");
3427 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3428 if (STRCASEEQ('b','B',"both", cur->value)) {
3429 css_clear = apr_pstrdup(doc->pool, "both");
3431 else if (STRCASEEQ('r','R',"right", cur->value)) {
3432 css_clear = apr_pstrdup(doc->pool, "right");
3434 else if (STRCASEEQ('l','L',"left", cur->value)) {
3435 css_clear = apr_pstrdup(doc->pool, "left");
3441 if (attr_align || css_clear ) {
3462 * It is a handler who processes the H3 tag.
3464 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3465 * destination is specified.
3466 * @param node [i] The H3 tag node is specified.
3467 * @return The conversion result is returned.
3470 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
3472 xhtml_t *xhtml = GET_XHTML(pdoc);
3473 Doc *doc = xhtml->doc;
3476 if (IS_CSS_ON(xhtml->entryp)) {
3477 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3485 * It is a handler who processes the H4 tag.
3487 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3488 * destination is specified.
3489 * @param node [i] The H4 tag node is specified.
3490 * @return The conversion result is returned.
3493 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
3495 xhtml_t *xhtml = GET_XHTML(pdoc);
3496 Doc *doc = xhtml->doc;
3498 char *attr_style = NULL;
3499 char *attr_align = NULL;
3500 char *css_clear = NULL;
3502 for (attr = qs_get_attr(doc,node);
3504 attr = qs_get_next_attr(doc,attr)) {
3505 char *name = qs_get_attr_name(doc,attr);
3506 char *value = qs_get_attr_value(doc,attr);
3507 if (STRCASEEQ('a','A',"align", name)) {
3508 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3512 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3516 if (IS_CSS_ON(xhtml->entryp)) {
3517 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3519 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3520 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3521 css_property_t *cur;
3522 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3523 if (STRCASEEQ('l','L',"left", cur->value)) {
3524 attr_align = apr_pstrdup(doc->pool, "left");
3526 else if (STRCASEEQ('c','C',"center",cur->value)) {
3527 attr_align = apr_pstrdup(doc->pool, "center");
3529 else if (STRCASEEQ('r','R',"right",cur->value)) {
3530 attr_align = apr_pstrdup(doc->pool, "right");
3533 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3534 if (STRCASEEQ('b','B',"both", cur->value)) {
3535 css_clear = apr_pstrdup(doc->pool, "both");
3537 else if (STRCASEEQ('r','R',"right", cur->value)) {
3538 css_clear = apr_pstrdup(doc->pool, "right");
3540 else if (STRCASEEQ('l','L',"left", cur->value)) {
3541 css_clear = apr_pstrdup(doc->pool, "left");
3547 if (attr_align || css_clear ) {
3568 * It is a handler who processes the H4 tag.
3570 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3571 * destination is specified.
3572 * @param node [i] The H4 tag node is specified.
3573 * @return The conversion result is returned.
3576 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
3578 xhtml_t *xhtml = GET_XHTML(pdoc);
3579 Doc *doc = xhtml->doc;
3582 if (IS_CSS_ON(xhtml->entryp)) {
3583 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3591 * It is a handler who processes the H5 tag.
3593 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3594 * destination is specified.
3595 * @param node [i] The H5 tag node is specified.
3596 * @return The conversion result is returned.
3599 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
3601 xhtml_t *xhtml = GET_XHTML(pdoc);
3602 Doc *doc = xhtml->doc;
3604 char *attr_style = NULL;
3605 char *attr_align = NULL;
3606 char *css_clear = NULL;
3608 for (attr = qs_get_attr(doc,node);
3610 attr = qs_get_next_attr(doc,attr)) {
3611 char *name = qs_get_attr_name(doc,attr);
3612 char *value = qs_get_attr_value(doc,attr);
3613 if (STRCASEEQ('a','A',"align", name)) {
3614 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3618 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3622 if (IS_CSS_ON(xhtml->entryp)) {
3623 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3625 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3626 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3627 css_property_t *cur;
3628 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3629 if (STRCASEEQ('l','L',"left", cur->value)) {
3630 attr_align = apr_pstrdup(doc->pool, "left");
3632 else if (STRCASEEQ('c','C',"center",cur->value)) {
3633 attr_align = apr_pstrdup(doc->pool, "center");
3635 else if (STRCASEEQ('r','R',"right",cur->value)) {
3636 attr_align = apr_pstrdup(doc->pool, "right");
3639 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3640 if (STRCASEEQ('b','B',"both", cur->value)) {
3641 css_clear = apr_pstrdup(doc->pool, "both");
3643 else if (STRCASEEQ('r','R',"right", cur->value)) {
3644 css_clear = apr_pstrdup(doc->pool, "right");
3646 else if (STRCASEEQ('l','L',"left", cur->value)) {
3647 css_clear = apr_pstrdup(doc->pool, "left");
3653 if (attr_align || css_clear ) {
3674 * It is a handler who processes the H5 tag.
3676 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3677 * destination is specified.
3678 * @param node [i] The H5 tag node is specified.
3679 * @return The conversion result is returned.
3682 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
3684 xhtml_t *xhtml = GET_XHTML(pdoc);
3685 Doc *doc = xhtml->doc;
3688 if (IS_CSS_ON(xhtml->entryp)) {
3689 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3697 * It is a handler who processes the H6 tag.
3699 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3700 * destination is specified.
3701 * @param node [i] The H6 tag node is specified.
3702 * @return The conversion result is returned.
3705 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
3707 xhtml_t *xhtml = GET_XHTML(pdoc);
3708 Doc *doc = xhtml->doc;
3710 char *attr_style = NULL;
3711 char *attr_align = NULL;
3712 char *css_clear = NULL;
3714 for (attr = qs_get_attr(doc,node);
3716 attr = qs_get_next_attr(doc,attr)) {
3717 char *name = qs_get_attr_name(doc,attr);
3718 char *value = qs_get_attr_value(doc,attr);
3719 if (STRCASEEQ('a','A',"align", name)) {
3720 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3724 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3728 if (IS_CSS_ON(xhtml->entryp)) {
3729 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3731 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3732 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3733 css_property_t *cur;
3734 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3735 if (STRCASEEQ('l','L',"left", cur->value)) {
3736 attr_align = apr_pstrdup(doc->pool, "left");
3738 else if (STRCASEEQ('c','C',"center",cur->value)) {
3739 attr_align = apr_pstrdup(doc->pool, "center");
3741 else if (STRCASEEQ('r','R',"right",cur->value)) {
3742 attr_align = apr_pstrdup(doc->pool, "right");
3745 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3746 if (STRCASEEQ('b','B',"both", cur->value)) {
3747 css_clear = apr_pstrdup(doc->pool, "both");
3749 else if (STRCASEEQ('r','R',"right", cur->value)) {
3750 css_clear = apr_pstrdup(doc->pool, "right");
3752 else if (STRCASEEQ('l','L',"left", cur->value)) {
3753 css_clear = apr_pstrdup(doc->pool, "left");
3759 if (attr_align || css_clear ) {
3780 * It is a handler who processes the H6 tag.
3782 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3783 * destination is specified.
3784 * @param node [i] The H6 tag node is specified.
3785 * @return The conversion result is returned.
3788 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3790 xhtml_t *xhtml = GET_XHTML(pdoc);
3791 Doc *doc = xhtml->doc;
3794 if (IS_CSS_ON(xhtml->entryp)) {
3795 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3803 * It is a handler who processes the OL tag.
3805 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3806 * destination is specified.
3807 * @param node [i] The OL tag node is specified.
3808 * @return The conversion result is returned.
3811 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3813 xhtml_t *xhtml = GET_XHTML(pdoc);
3814 Doc *doc = xhtml->doc;
3816 char *attr_style = NULL;
3817 char *attr_start = NULL;
3818 char *attr_type = NULL;
3820 /*--------------------------------------------------------------------------*/
3821 /* Get Attributes */
3822 /*--------------------------------------------------------------------------*/
3823 for (attr = qs_get_attr(doc,node);
3825 attr = qs_get_next_attr(doc,attr)) {
3826 char *name = qs_get_attr_name(doc,attr);
3827 char *value = qs_get_attr_value(doc,attr);
3828 if (STRCASEEQ('t','T',"type",name) && value) {
3829 if (*value == '1') {
3830 attr_type = apr_pstrdup(doc->pool, "decimal");
3832 else if (*value == 'a') {
3833 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3835 else if (*value == 'A') {
3836 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3839 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3842 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3846 if (IS_CSS_ON(xhtml->entryp)) {
3847 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3849 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3850 css_property_t *cur;
3851 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3852 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3853 attr_type = apr_pstrdup(doc->pool, "decimal");
3855 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3856 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3858 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3859 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3867 W_L("list-style-type:");
3884 * It is a handler who processes the OL tag.
3886 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3887 * destination is specified.
3888 * @param node [i] The OL tag node is specified.
3889 * @return The conversion result is returned.
3892 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3894 xhtml_t *xhtml = GET_XHTML(pdoc);
3895 Doc *doc = xhtml->doc;
3898 if (IS_CSS_ON(xhtml->entryp)) {
3899 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3907 * It is a handler who processes the LI tag.
3909 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3910 * destination is specified.
3911 * @param node [i] The LI tag node is specified.
3912 * @return The conversion result is returned.
3915 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3917 xhtml_t *xhtml = GET_XHTML(pdoc);
3918 Doc *doc = xhtml->doc;
3920 char *attr_type = NULL;
3921 char *attr_value = NULL;
3922 char *attr_style = NULL;
3924 for (attr = qs_get_attr(doc,node);
3926 attr = qs_get_next_attr(doc,attr)) {
3927 char *name = qs_get_attr_name(doc,attr);
3928 char *value = qs_get_attr_value(doc,attr);
3929 if (STRCASEEQ('t','T',"type",name)) {
3930 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3931 if (*value == '1') {
3932 attr_type = apr_pstrdup(doc->pool, "decimal");
3934 else if (*value == 'a') {
3935 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3937 else if (*value == 'A') {
3938 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3945 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3948 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3952 if (IS_CSS_ON(xhtml->entryp)) {
3953 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3955 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3956 css_property_t *cur;
3957 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3958 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3959 attr_type = apr_pstrdup(doc->pool, "decimal");
3961 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3962 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3964 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3965 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3967 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3968 attr_type = apr_pstrdup(doc->pool, "disc");
3970 else if (STRCASEEQ('s','S',"square", cur->value)) {
3971 attr_type = apr_pstrdup(doc->pool, "square");
3973 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3974 attr_type = apr_pstrdup(doc->pool, "circle");
3984 W_L("list-style-type:");
4000 ** It is a handler who processes the LI tag.
4002 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4003 * destination is specified.
4004 * @param node [i] The LI tag node is specified.
4005 * @return The conversion result is returned.
4008 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
4010 xhtml_t *xhtml = GET_XHTML(pdoc);
4011 Doc *doc = xhtml->doc;
4014 if (IS_CSS_ON(xhtml->entryp)) {
4015 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4021 * It is a handler who processes the IMG tag.
4023 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4024 * destination is specified.
4025 * @param node [i] The IMG tag node is specified.
4026 * @return The conversion result is returned.
4029 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
4031 xhtml_t *xhtml = GET_XHTML(pdoc);
4032 Doc *doc = xhtml->doc;
4033 request_rec *r = doc->r;
4035 char *attr_src = NULL;
4036 char *attr_alt = NULL;
4037 char *attr_height = NULL;
4038 char *attr_width = NULL;
4039 char *attr_align = NULL;
4040 char *attr_style = NULL;
4041 char *attr_hspace = NULL;
4042 char *attr_vspace = NULL;
4044 char *css_margin_left = NULL;
4045 char *css_margin_right = NULL;
4046 char *css_margin_top = NULL;
4047 char *css_margin_bottom = NULL;
4048 char *css_display = NULL;
4049 char *css_valign = NULL;
4052 #ifndef IMG_NOT_CONVERT_FILENAME
4053 device_table *spec = xhtml->spec;
4056 /*--------------------------------------------------------------------------*/
4057 /* Get Attributes */
4058 /*--------------------------------------------------------------------------*/
4059 for (attr = qs_get_attr(doc,node);
4061 attr = qs_get_next_attr(doc,attr)) {
4062 char *name = qs_get_attr_name(doc,attr);
4063 char *value = qs_get_attr_value(doc,attr);
4065 if (STRCASEEQ('s','S',"src",name)) {
4066 value = chxj_encoding_parameter(r, value, 1);
4067 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
4068 value = chxj_add_cookie_no_update_parameter(r, value);
4069 value = chxj_img_rewrite_parameter(r,xhtml->conf,value);
4070 #ifdef IMG_NOT_CONVERT_FILENAME
4076 attr_src = chxj_img_conv(r,spec,value);
4082 if (STRCASEEQ('a','A',"align",name)) {
4084 if (STRCASEEQ('t','T',"top", value) ||
4085 STRCASEEQ('m','M',"middle",value) ||
4086 STRCASEEQ('b','B',"bottom",value)) {
4089 else if( STRCASEEQ('l','L',"left", value) ||
4090 STRCASEEQ('r','R',"right", value)) {
4093 else if (STRCASEEQ('c','C',"center", value)) {
4094 css_valign = apr_pstrdup(doc->pool, "middle");
4098 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
4101 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
4104 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
4105 attr_height = value;
4107 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
4108 attr_hspace = value;
4110 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
4111 attr_vspace = value;
4113 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4118 if (IS_CSS_ON(xhtml->entryp)) {
4119 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4121 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
4122 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
4123 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
4124 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
4125 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
4126 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
4127 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
4129 css_property_t *cur;
4130 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
4131 attr_height = apr_pstrdup(doc->pool, cur->value);
4133 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
4134 attr_width = apr_pstrdup(doc->pool, cur->value);
4137 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
4138 css_valign = apr_pstrdup(doc->pool, cur->value);
4142 if (! attr_hspace) {
4143 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
4144 css_margin_left = apr_pstrdup(doc->pool, cur->value);
4146 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
4147 css_margin_right = apr_pstrdup(doc->pool, cur->value);
4151 if (! attr_vspace) {
4152 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
4153 css_margin_top = apr_pstrdup(doc->pool, cur->value);
4155 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
4156 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
4160 // float:[left|right] -> align
4162 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
4163 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
4164 attr_align = apr_pstrdup(doc->pool, cur->value);
4167 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4168 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4169 char *tmp = apr_pstrdup(doc->pool, cur->value);
4170 char *tmpp = strstr(tmp, "none");
4172 css_display = apr_pstrdup(doc->pool, tmp);
4199 if (attr_hspace || attr_vspace || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
4202 W_L("vertical-align:");
4207 W_L("margin-left:");
4210 W_L("margin-right:");
4215 if(css_margin_left){
4216 W_L("margin-left:");
4217 W_V(css_margin_left);
4220 if(css_margin_right){
4221 W_L("margin-right:");
4222 W_V(css_margin_right);
4230 W_L("margin-bottom:");
4237 W_V(css_margin_top);
4240 if(css_margin_bottom){
4241 W_L("margin-bottom:");
4242 W_V(css_margin_bottom);
4247 W_L("display:none;");
4265 * It is a handler who processes the IMG tag.
4267 * @param xhtml [i/o] The pointer to the XHTML structure at the output
4268 * destination is specified.
4269 * @param node [i] The IMG tag node is specified.
4270 * @return The conversion result is returned.
4273 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
4275 xhtml_t *xhtml = GET_XHTML(pdoc);
4282 * It is a handler who processes the SELECT tag.
4284 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4285 * destination is specified.
4286 * @param node [i] The SELECT tag node is specified.
4287 * @return The conversion result is returned.
4290 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
4292 xhtml_t *xhtml = GET_XHTML(pdoc);
4293 Doc *doc = xhtml->doc;
4296 char *multiple = NULL;
4298 char *attr_style = NULL;
4301 for (attr = qs_get_attr(doc,node);
4303 attr = qs_get_next_attr(doc,attr)) {
4304 char *nm = qs_get_attr_name(doc,attr);
4305 char *val = qs_get_attr_value(doc,attr);
4306 if (STRCASEEQ('s','S',"size",nm)) {
4307 /*----------------------------------------------------------------------*/
4308 /* CHTML 1.0 version 2.0 */
4309 /*----------------------------------------------------------------------*/
4310 size = apr_pstrdup(doc->buf.pool, val);
4312 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4313 /*----------------------------------------------------------------------*/
4314 /* CHTML 1.0 version 2.0 */
4315 /*----------------------------------------------------------------------*/
4316 attr_style = apr_pstrdup(doc->buf.pool, val);
4318 else if (STRCASEEQ('n','N',"name",nm)) {
4319 /*----------------------------------------------------------------------*/
4320 /* CHTML 1.0 version 2.0 */
4321 /*----------------------------------------------------------------------*/
4322 name = apr_pstrdup(doc->buf.pool, val);
4324 else if (STRCASEEQ('m','M',"multiple",nm)) {
4325 /*----------------------------------------------------------------------*/
4326 /* CHTML 1.0 version 2.0 */
4327 /*----------------------------------------------------------------------*/
4328 multiple = apr_pstrdup(doc->buf.pool, val);
4331 if (size && *size) {
4336 if (name && *name) {
4342 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
4343 W_L(" multiple=\"true\"");
4346 if (IS_CSS_ON(xhtml->entryp)) {
4347 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4355 * It is a handler who processes the SELECT tag.
4357 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4358 * destination is specified.
4359 * @param node [i] The SELECT tag node is specified.
4360 * @return The conversion result is returned.
4363 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
4365 xhtml_t *xhtml = GET_XHTML(pdoc);
4366 Doc *doc = xhtml->doc;
4369 if (IS_CSS_ON(xhtml->entryp)) {
4370 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4377 * It is a handler who processes the OPTION tag.
4379 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4380 * destination is specified.
4381 * @param node [i] The OPTION tag node is specified.
4382 * @return The conversion result is returned.
4385 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
4387 xhtml_t *xhtml = GET_XHTML(pdoc);
4388 Doc *doc = xhtml->doc;
4390 char *attr_style = NULL;
4392 char *selected = NULL;
4396 for (attr = qs_get_attr(doc,node);
4398 attr = qs_get_next_attr(doc,attr)) {
4399 char *nm = qs_get_attr_name(doc,attr);
4400 char *val = qs_get_attr_value(doc,attr);
4401 if (STRCASEEQ('s','S',"selected",nm)) {
4402 /* CHTML version 2.0 */
4403 selected = apr_pstrdup(doc->buf.pool, val);
4405 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4406 /* CHTML version 2.0 */
4407 attr_style = apr_pstrdup(doc->buf.pool, val);
4409 else if (STRCASEEQ('v','V',"value",nm)) {
4410 /* CHTML version 2.0 */
4411 value = apr_pstrdup(doc->buf.pool, val);
4420 W_L(" selected=\"selected\"");
4423 if (IS_CSS_ON(xhtml->entryp)) {
4424 s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4431 * It is a handler who processes the OPTION tag.
4433 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4434 * destination is specified.
4435 * @param node [i] The OPTION tag node is specified.
4436 * @return The conversion result is returned.
4439 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
4441 xhtml_t *xhtml = GET_XHTML(pdoc);
4442 Doc *doc = xhtml->doc;
4445 if (IS_CSS_ON(xhtml->entryp)) {
4446 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4454 * It is a handler who processes the DIV tag.
4456 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4457 * destination is specified.
4458 * @param node [i] The DIV tag node is specified.
4459 * @return The conversion result is returned.
4462 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
4464 xhtml_t *xhtml = GET_XHTML(pdoc);
4465 Doc *doc = xhtml->doc;
4467 char *attr_style = NULL;
4468 char *attr_align = NULL;
4469 char *attr_display = NULL;
4470 char *attr_decoration = NULL;
4471 char *attr_wap_marquee_style = NULL;
4472 char *attr_wap_marquee_dir = NULL;
4473 char *attr_wap_marquee_loop = NULL;
4474 char *attr_color = NULL;
4475 char *attr_bgcolor = NULL;
4476 char *attr_font_size = NULL;
4477 char *css_clear = NULL;
4479 for (attr = qs_get_attr(doc,node);
4481 attr = qs_get_next_attr(doc,attr)) {
4482 char *nm = qs_get_attr_name(doc,attr);
4483 char *val = qs_get_attr_value(doc,attr);
4484 if (STRCASEEQ('a','A',"align",nm)) {
4485 /*----------------------------------------------------------------------*/
4486 /* CHTML 1.0 (W3C version 3.2) */
4487 /*----------------------------------------------------------------------*/
4488 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4489 attr_align = apr_pstrdup(doc->buf.pool, val);
4492 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4493 attr_style = apr_pstrdup(doc->buf.pool, val);
4497 if (IS_CSS_ON(xhtml->entryp)) {
4498 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4500 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4501 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4502 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4503 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4504 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4505 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4506 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4507 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4509 css_property_t *cur;
4510 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4511 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4512 attr_display = apr_pstrdup(doc->pool, cur->value);
4515 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4516 if (STRCASEEQ('b','B',"blink", cur->value)) {
4517 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4520 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4521 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4522 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4524 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4525 char *ss = strchr(cur->value, '#');
4527 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4528 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4531 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4532 attr_color = apr_pstrdup(doc->pool, cur->value);
4534 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4535 attr_align = apr_pstrdup(doc->pool, cur->value);
4537 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4538 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4539 || STRCASEEQ('x','X',"x-small",cur->value)
4540 || STRCASEEQ('s','S',"small",cur->value)
4541 || STRCASEEQ('m','M',"medium",cur->value)
4542 || STRCASEEQ('l','L',"large",cur->value)
4543 || STRCASEEQ('x','X',"x-large",cur->value)
4544 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4545 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4549 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4550 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4551 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4552 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4553 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4554 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4557 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4558 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4559 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4561 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4562 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4565 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4566 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4567 attr_wap_marquee_loop = "infinite";
4570 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4574 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4575 css_clear = apr_pstrdup(doc->pool, cur->value);
4583 || attr_wap_marquee_style
4584 || attr_wap_marquee_dir
4585 || attr_wap_marquee_loop
4601 if (attr_decoration) {
4602 W_L("text-decoration:");
4603 W_V(attr_decoration);
4606 if (attr_wap_marquee_style) {
4607 W_L("-wap-marquee-style:");
4608 W_V(attr_wap_marquee_style);
4611 if (attr_wap_marquee_dir) {
4612 W_L("-wap-marquee-dir:");
4613 W_V(attr_wap_marquee_dir);
4616 if (attr_wap_marquee_loop) {
4617 W_L("-wap-marquee-loop:");
4618 W_V(attr_wap_marquee_loop);
4627 W_L("background-color:");
4631 if (attr_font_size) {
4633 W_V(attr_font_size);
4649 * It is a handler who processes the DIV tag.
4651 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4652 * destination is specified.
4653 * @param node [i] The DIV tag node is specified.
4654 * @return The conversion result is returned.
4657 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
4659 xhtml_t *xhtml = GET_XHTML(pdoc);
4660 Doc *doc = xhtml->doc;
4662 if (IS_CSS_ON(xhtml->entryp)) {
4663 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4670 * It is a handler who processes the B tag.
4672 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4673 * destination is specified.
4674 * @param node [i] The B tag node is specified.
4675 * @return The conversion result is returned.
4678 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
4680 xhtml_t *xhtml = GET_XHTML(pdoc);
4681 Doc *doc = xhtml->doc;
4683 W_L("<div style=\"font-weight:bold\">");
4689 * It is a handler who processes the B tag.
4691 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4692 * destination is specified.
4693 * @param node [i] The B tag node is specified.
4694 * @return The conversion result is returned.
4697 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
4699 xhtml_t *xhtml = GET_XHTML(pdoc);
4700 Doc *doc = xhtml->doc;
4708 * It is a handler who processes the CHXJ:IF tag.
4710 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4711 * destination is specified.
4712 * @param node [i] The CHXJ:IF tag node is specified.
4715 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
4717 xhtml_t *xhtml = GET_XHTML(pdoc);
4718 Doc *doc = xhtml->doc;
4721 for (child = qs_get_child_node(doc, node);
4723 child = qs_get_next_node(doc, child)) {
4725 s_xhtml_1_0_chxjif_tag(xhtml, child);
4733 * It is a handler who processes the TEXTARE tag.
4735 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4736 * destination is specified.
4737 * @param node [i] The TEXTAREA tag node is specified.
4738 * @return The conversion result is returned.
4741 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
4743 xhtml_t *xhtml = GET_XHTML(pdoc);
4744 Doc *doc = xhtml->doc;
4746 char *attr_accesskey = NULL;
4747 char *attr_name = NULL;
4748 char *attr_rows = NULL;
4749 char *attr_cols = NULL;
4750 char *attr_istyle = NULL;
4751 char *attr_style = NULL;
4753 xhtml->textarea_flag++;
4754 for (attr = qs_get_attr(doc,node);
4756 attr = qs_get_next_attr(doc,attr)) {
4757 char *name = qs_get_attr_name(doc,attr);
4758 char *value = qs_get_attr_value(doc,attr);
4759 if (STRCASEEQ('n','N',"name",name) && value && *value) {
4762 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
4765 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
4768 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4769 attr_istyle = value;
4771 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
4777 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4778 attr_accesskey = value;
4780 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
4784 if (IS_CSS_ON(xhtml->entryp)) {
4785 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4787 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4788 css_property_t *cur;
4789 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4790 if (strcasestr(cur->value, "<ja:n>")) {
4793 else if (strcasestr(cur->value, "<ja:en>")) {
4796 else if (strcasestr(cur->value, "<ja:hk>")) {
4799 else if (strcasestr(cur->value, "<ja:h>")) {
4806 if (attr_accesskey) {
4807 W_L(" accesskey=\"");
4808 W_V(attr_accesskey);
4837 * It is a handler who processes the TEXTAREA tag.
4839 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4840 * destination is specified.
4841 * @param node [i] The TEXTAREA tag node is specified.
4842 * @return The conversion result is returned.
4845 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4847 xhtml_t *xhtml = GET_XHTML(pdoc);
4848 Doc *doc = xhtml->doc;
4851 xhtml->textarea_flag--;
4857 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
4859 xhtml_t *xhtml = GET_XHTML(pdoc);
4860 Doc *doc = xhtml->doc;
4861 request_rec *r = doc->r;
4868 apr_size_t z2h_input_len;
4870 textval = qs_get_node_value(doc,child);
4871 if (strlen(textval) == 0) {
4875 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4876 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4878 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4879 memset(one_byte, 0, sizeof(one_byte));
4882 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4884 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4886 DBG(r,"REQ[%X] [%s][%d]", TO_ADDR(r),out, rtn);
4887 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4891 if (is_sjis_kanji(textval[ii])) {
4892 one_byte[0] = textval[ii+0];
4893 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4894 one_byte[0] = textval[ii+1];
4895 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4898 else if (xhtml->pre_flag) {
4899 one_byte[0] = textval[ii+0];
4900 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4902 else if (xhtml->textarea_flag) {
4903 one_byte[0] = textval[ii+0];
4904 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4906 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4907 one_byte[0] = textval[ii+0];
4908 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4911 z2h_input_len = strlen(tdst);
4912 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4920 * It is a handler who processes the BLOCKQUOTE tag.
4922 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4923 * destination is specified.
4924 * @param node [i] The BLOCKQUOTE tag node is specified.
4925 * @return The conversion result is returned.
4928 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4933 char *attr_style = NULL;
4934 char *attr_color = NULL;
4935 char *attr_size = NULL;
4937 xhtml = GET_XHTML(pdoc);
4939 for (attr = qs_get_attr(doc,node);
4941 attr = qs_get_next_attr(doc,attr)) {
4942 char *nm = qs_get_attr_name(doc,attr);
4943 char *val = qs_get_attr_value(doc,attr);
4944 if (val && STRCASEEQ('s','S',"style", nm)) {
4948 if (IS_CSS_ON(xhtml->entryp)) {
4949 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4951 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4952 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4953 css_property_t *cur;
4954 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4955 if (cur->value && *cur->value) {
4956 attr_color = apr_pstrdup(doc->pool, cur->value);
4959 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4960 if (cur->value && *cur->value) {
4961 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4962 attr_size = apr_pstrdup(doc->pool, cur->value);
4964 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4965 attr_size = apr_pstrdup(doc->pool, cur->value);
4967 else if (STRCASEEQ('s','S',"small",cur->value)) {
4968 attr_size = apr_pstrdup(doc->pool, cur->value);
4970 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4971 attr_size = apr_pstrdup(doc->pool, cur->value);
4973 else if (STRCASEEQ('l','L',"large",cur->value)) {
4974 attr_size = apr_pstrdup(doc->pool, cur->value);
4976 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4977 attr_size = apr_pstrdup(doc->pool, cur->value);
4979 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4980 attr_size = apr_pstrdup(doc->pool, cur->value);
4987 if (attr_color || attr_size) {
4990 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5008 * It is a handler who processes the BLOCKQUOTE tag.
5010 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5011 * destination is specified.
5012 * @param node [i] The BLOCKQUOTE tag node is specified.
5013 * @return The conversion result is returned.
5016 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
5018 xhtml_t *xhtml = GET_XHTML(pdoc);
5019 Doc *doc = xhtml->doc;
5020 W_L("</blockquote>");
5021 if (IS_CSS_ON(xhtml->entryp)) {
5022 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5029 * It is a handler who processes the DIR tag.
5031 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5032 * destination is specified.
5033 * @param node [i] The DIR tag node is specified.
5034 * @return The conversion result is returned.
5037 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
5039 xhtml_t *xhtml = GET_XHTML(pdoc);
5040 Doc *doc = xhtml->doc;
5042 char *attr_style = NULL;
5043 char *attr_color = NULL;
5044 char *attr_type = NULL;
5045 char *attr_size = NULL;
5046 for (attr = qs_get_attr(doc,node);
5048 attr = qs_get_next_attr(doc,attr)) {
5049 char *name = qs_get_attr_name(doc,attr);
5050 char *value = qs_get_attr_value(doc,attr);
5051 if (STRCASEEQ('t','T',"type",name)) {
5052 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5056 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5060 if (IS_CSS_ON(xhtml->entryp)) {
5061 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5063 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5064 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5065 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5066 css_property_t *cur;
5067 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5068 if (cur->value && *cur->value) {
5069 attr_color = apr_pstrdup(doc->pool, cur->value);
5072 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5073 if (cur->value && *cur->value) {
5074 attr_type = apr_pstrdup(doc->pool, cur->value);
5077 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5078 if (cur->value && *cur->value) {
5079 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5080 attr_size = apr_pstrdup(doc->pool, cur->value);
5082 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5083 attr_size = apr_pstrdup(doc->pool, cur->value);
5085 else if (STRCASEEQ('s','S',"small",cur->value)) {
5086 attr_size = apr_pstrdup(doc->pool, cur->value);
5088 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5089 attr_size = apr_pstrdup(doc->pool, cur->value);
5091 else if (STRCASEEQ('l','L',"large",cur->value)) {
5092 attr_size = apr_pstrdup(doc->pool, cur->value);
5094 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5095 attr_size = apr_pstrdup(doc->pool, cur->value);
5097 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5098 attr_size = apr_pstrdup(doc->pool, cur->value);
5105 if (attr_type || attr_color || attr_size) {
5108 W_L("list-style-type:");
5113 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5131 * It is a handler who processes the DIR tag.
5133 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5134 * destination is specified.
5135 * @param node [i] The DIR tag node is specified.
5136 * @return The conversion result is returned.
5139 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
5141 xhtml_t *xhtml = GET_XHTML(pdoc);
5142 Doc *doc = xhtml->doc;
5144 if (IS_CSS_ON(xhtml->entryp)) {
5145 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5152 * It is a handler who processes the DL tag.
5154 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5155 * destination is specified.
5156 * @param node [i] The DL tag node is specified.
5157 * @return The conversion result is returned.
5160 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
5162 xhtml_t *xhtml = GET_XHTML(pdoc);
5163 Doc *doc = xhtml->doc;
5165 char *attr_style = NULL;
5166 char *attr_color = NULL;
5167 char *attr_size = NULL;
5169 for (attr = qs_get_attr(doc,node);
5171 attr = qs_get_next_attr(doc,attr)) {
5172 char *name = qs_get_attr_name(doc,attr);
5173 char *value = qs_get_attr_value(doc,attr);
5174 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5178 if (IS_CSS_ON(xhtml->entryp)) {
5179 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5181 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5182 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5183 css_property_t *cur;
5184 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5185 if (cur->value && *cur->value) {
5186 attr_color = apr_pstrdup(doc->pool, cur->value);
5189 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5190 if (cur->value && *cur->value) {
5191 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5192 attr_size = apr_pstrdup(doc->pool, cur->value);
5194 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5195 attr_size = apr_pstrdup(doc->pool, cur->value);
5197 else if (STRCASEEQ('s','S',"small",cur->value)) {
5198 attr_size = apr_pstrdup(doc->pool, cur->value);
5200 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5201 attr_size = apr_pstrdup(doc->pool, cur->value);
5203 else if (STRCASEEQ('l','L',"large",cur->value)) {
5204 attr_size = apr_pstrdup(doc->pool, cur->value);
5206 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5207 attr_size = apr_pstrdup(doc->pool, cur->value);
5209 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5210 attr_size = apr_pstrdup(doc->pool, cur->value);
5217 if (attr_color || attr_size) {
5220 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5238 * It is a handler who processes the DL tag.
5240 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5241 * destination is specified.
5242 * @param node [i] The DL tag node is specified.
5243 * @return The conversion result is returned.
5246 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
5248 xhtml_t *xhtml = GET_XHTML(pdoc);
5249 Doc *doc = xhtml->doc;
5251 if (IS_CSS_ON(xhtml->entryp)) {
5252 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5259 * It is a handter who processes the DT tag.
5261 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5262 * destination is specified.
5263 * @param node [i] The DT tag node is specified.
5264 * @return The conversion result is returned.
5267 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
5269 xhtml_t *xhtml = GET_XHTML(pdoc);
5270 Doc *doc = xhtml->doc;
5272 char *attr_style = NULL;
5273 char *attr_color = NULL;
5274 char *attr_size = NULL;
5276 for (attr = qs_get_attr(doc,node);
5278 attr = qs_get_next_attr(doc,attr)) {
5279 char *name = qs_get_attr_name(doc,attr);
5280 char *value = qs_get_attr_value(doc,attr);
5281 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5285 if (IS_CSS_ON(xhtml->entryp)) {
5286 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5288 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5289 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5290 css_property_t *cur;
5291 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5292 if (cur->value && *cur->value) {
5293 attr_color = apr_pstrdup(doc->pool, cur->value);
5296 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5297 if (cur->value && *cur->value) {
5298 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5299 attr_size = apr_pstrdup(doc->pool, cur->value);
5301 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5302 attr_size = apr_pstrdup(doc->pool, cur->value);
5304 else if (STRCASEEQ('s','S',"small",cur->value)) {
5305 attr_size = apr_pstrdup(doc->pool, cur->value);
5307 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5308 attr_size = apr_pstrdup(doc->pool, cur->value);
5310 else if (STRCASEEQ('l','L',"large",cur->value)) {
5311 attr_size = apr_pstrdup(doc->pool, cur->value);
5313 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5314 attr_size = apr_pstrdup(doc->pool, cur->value);
5316 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5317 attr_size = apr_pstrdup(doc->pool, cur->value);
5324 if (attr_color || attr_size) {
5327 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5345 * It is a handter who processes the DT tag.
5347 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5348 * destination is specified.
5349 * @param node [i] The DT tag node is specified.
5350 * @return The conversion result is returned.
5353 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
5355 xhtml_t *xhtml = GET_XHTML(pdoc);
5356 Doc *doc = xhtml->doc;
5358 if (IS_CSS_ON(xhtml->entryp)) {
5359 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5366 * It is a handder who processes the DD tag.
5368 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5369 * destination is specified.
5370 * @param node [i] The DD tag node is specified.
5371 * @return The conversion result is returned.
5374 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
5376 xhtml_t *xhtml = GET_XHTML(pdoc);
5377 Doc *doc = xhtml->doc;
5379 char *attr_style = NULL;
5380 char *attr_color = NULL;
5381 char *attr_size = NULL;
5383 for (attr = qs_get_attr(doc,node);
5385 attr = qs_get_next_attr(doc,attr)) {
5386 char *name = qs_get_attr_name(doc,attr);
5387 char *value = qs_get_attr_value(doc,attr);
5388 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5392 if (IS_CSS_ON(xhtml->entryp)) {
5393 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5395 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5396 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5397 css_property_t *cur;
5398 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5399 if (cur->value && *cur->value) {
5400 attr_color = apr_pstrdup(doc->pool, cur->value);
5403 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5404 if (cur->value && *cur->value) {
5405 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5406 attr_size = apr_pstrdup(doc->pool, cur->value);
5408 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5409 attr_size = apr_pstrdup(doc->pool, cur->value);
5411 else if (STRCASEEQ('s','S',"small",cur->value)) {
5412 attr_size = apr_pstrdup(doc->pool, cur->value);
5414 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5415 attr_size = apr_pstrdup(doc->pool, cur->value);
5417 else if (STRCASEEQ('l','L',"large",cur->value)) {
5418 attr_size = apr_pstrdup(doc->pool, cur->value);
5420 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5421 attr_size = apr_pstrdup(doc->pool, cur->value);
5423 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5424 attr_size = apr_pstrdup(doc->pool, cur->value);
5431 if (attr_color || attr_size) {
5434 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5452 * It is a handler who processes the DD tag.
5454 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5455 * destination is specified.
5456 * @param node [i] The DD tag node is specified.
5457 * @return The conversion result is returned.
5460 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
5462 xhtml_t *xhtml = GET_XHTML(pdoc);
5463 Doc *doc = xhtml->doc;
5465 if (IS_CSS_ON(xhtml->entryp)) {
5466 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5473 * It is a handler who processes the MENU tag.
5475 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5476 * destination is specified.
5477 * @param node [i] The MENU tag node is specified.
5478 * @return The conversion result is returned.
5481 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
5483 xhtml_t *xhtml = GET_XHTML(pdoc);
5484 Doc *doc = xhtml->doc;
5486 char *attr_style = NULL;
5487 char *attr_color = NULL;
5488 char *attr_type = NULL;
5489 char *attr_size = NULL;
5490 for (attr = qs_get_attr(doc,node);
5492 attr = qs_get_next_attr(doc,attr)) {
5493 char *name = qs_get_attr_name(doc,attr);
5494 char *value = qs_get_attr_value(doc,attr);
5495 if (STRCASEEQ('t','T',"type",name)) {
5496 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5500 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5504 if (IS_CSS_ON(xhtml->entryp)) {
5505 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5507 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5508 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5509 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5510 css_property_t *cur;
5511 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5512 if (cur->value && *cur->value) {
5513 attr_color = apr_pstrdup(doc->pool, cur->value);
5516 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5517 if (cur->value && *cur->value) {
5518 attr_type = apr_pstrdup(doc->pool, cur->value);
5521 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5522 if (cur->value && *cur->value) {
5523 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5524 attr_size = apr_pstrdup(doc->pool, cur->value);
5526 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5527 attr_size = apr_pstrdup(doc->pool, cur->value);
5529 else if (STRCASEEQ('s','S',"small",cur->value)) {
5530 attr_size = apr_pstrdup(doc->pool, cur->value);
5532 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5533 attr_size = apr_pstrdup(doc->pool, cur->value);
5535 else if (STRCASEEQ('l','L',"large",cur->value)) {
5536 attr_size = apr_pstrdup(doc->pool, cur->value);
5538 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5539 attr_size = apr_pstrdup(doc->pool, cur->value);
5541 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5542 attr_size = apr_pstrdup(doc->pool, cur->value);
5549 if (attr_type || attr_color || attr_size) {
5552 W_L("list-style-type:");
5557 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5575 * It is a hanmenuer who processes the MENU tag.
5577 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5578 * destination is specified.
5579 * @param node [i] The MENU tag node is specified.
5580 * @return The conversion result is returned.
5583 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
5585 xhtml_t *xhtml = GET_XHTML(pdoc);
5586 Doc *doc = xhtml->doc;
5588 if (IS_CSS_ON(xhtml->entryp)) {
5589 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5596 * It is a handler who processes the PLAINTEXT tag.
5598 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5599 * destination is specified.
5600 * @param node [i] The PLAINTEXT tag node is specified.
5601 * @return The conversion result is returned.
5604 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
5606 xhtml_t *xhtml = GET_XHTML(pdoc);
5607 Doc *doc = xhtml->doc;
5609 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
5614 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
5616 xhtml_t *xhtml = GET_XHTML(pdoc);
5617 Doc *doc = xhtml->doc;
5619 for (child = qs_get_child_node(doc, node);
5621 child = qs_get_next_node(doc, child)) {
5623 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
5630 * It is a handler who processes the PLAINTEXT tag.
5632 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5633 * destination is specified.
5634 * @param node [i] The PLAINTEXT tag node is specified.
5635 * @return The conversion result is returned.
5638 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5640 xhtml_t *xhtml = GET_XHTML(pdoc);
5641 Doc *doc = xhtml->doc;
5642 W_L("</plaintext>");
5648 * It is a handler who processes the BLINK tag.
5650 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5651 * destination is specified.
5652 * @param node [i] The BLINK tag node is specified.
5653 * @return The conversion result is returned.
5656 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
5658 xhtml_t *xhtml = GET_XHTML(pdoc);
5659 Doc *doc = xhtml->doc;
5661 char *attr_style = NULL;
5662 char *attr_color = NULL;
5663 char *attr_size = NULL;
5665 for (attr = qs_get_attr(doc,node);
5667 attr = qs_get_next_attr(doc,attr)) {
5668 char *name = qs_get_attr_name(doc,attr);
5669 char *value = qs_get_attr_value(doc,attr);
5670 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5674 if (IS_CSS_ON(xhtml->entryp)) {
5675 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5677 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5678 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5679 css_property_t *cur;
5680 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5681 if (cur->value && *cur->value) {
5682 attr_color = apr_pstrdup(doc->pool, cur->value);
5685 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5686 if (cur->value && *cur->value) {
5687 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5688 attr_size = apr_pstrdup(doc->pool, cur->value);
5690 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5691 attr_size = apr_pstrdup(doc->pool, cur->value);
5693 else if (STRCASEEQ('s','S',"small",cur->value)) {
5694 attr_size = apr_pstrdup(doc->pool, cur->value);
5696 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5697 attr_size = apr_pstrdup(doc->pool, cur->value);
5699 else if (STRCASEEQ('l','L',"large",cur->value)) {
5700 attr_size = apr_pstrdup(doc->pool, cur->value);
5702 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5703 attr_size = apr_pstrdup(doc->pool, cur->value);
5705 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5706 attr_size = apr_pstrdup(doc->pool, cur->value);
5713 if (attr_color || attr_size) {
5716 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5734 * It is a handler who processes the BLINK tag.
5736 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5737 * destination is specified.
5738 * @param node [i] The BLINK tag node is specified.
5739 * @return The conversion result is returned.
5742 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
5744 xhtml_t *xhtml = GET_XHTML(pdoc);
5745 Doc *doc = xhtml->doc;
5747 if (IS_CSS_ON(xhtml->entryp)) {
5748 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5755 * It is a handler who processes the MARQUEE tag.
5757 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5758 * destination is specified.
5759 * @param node [i] The MARQUEE tag node is specified.
5760 * @return The conversion result is returned.
5763 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
5765 xhtml_t *xhtml = GET_XHTML(pdoc);
5766 Doc *doc = xhtml->doc;
5768 char *attr_direction = NULL;
5769 char *attr_behavior = NULL;
5770 char *attr_loop = NULL;
5771 char *attr_style = NULL;
5772 char *attr_color = NULL;
5773 char *attr_size = NULL;
5774 char *attr_bgcolor = NULL;
5775 /*--------------------------------------------------------------------------*/
5776 /* Get Attributes */
5777 /*--------------------------------------------------------------------------*/
5778 for (attr = qs_get_attr(doc,node);
5780 attr = qs_get_next_attr(doc,attr)) {
5781 char *name = qs_get_attr_name(doc,attr);
5782 char *value = qs_get_attr_value(doc,attr);
5783 if (STRCASEEQ('d','D',"direction", name)) {
5785 if (STRCASEEQ('l','L',"left",value)) {
5786 attr_direction = "rtl";
5788 else if (STRCASEEQ('r','R',"right",value)) {
5789 attr_direction = "ltr";
5793 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
5794 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
5795 attr_behavior = value;
5798 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
5801 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5802 if (value && *value) {
5803 attr_bgcolor = value;
5806 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5810 if (IS_CSS_ON(xhtml->entryp)) {
5811 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
5813 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5814 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5815 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5816 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5817 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5818 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5819 css_property_t *cur;
5820 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5821 if (cur->value && *cur->value) {
5822 attr_color = apr_pstrdup(doc->pool, cur->value);
5825 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5826 if (cur->value && *cur->value) {
5827 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5830 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5831 if (cur->value && *cur->value) {
5832 attr_direction = apr_pstrdup(doc->pool, cur->value);
5835 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
5836 if (cur->value && *cur->value) {
5837 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
5838 attr_behavior = apr_pstrdup(doc->pool, cur->value);
5842 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
5843 if (cur->value && *cur->value) {
5844 attr_loop = apr_pstrdup(doc->pool, cur->value);
5847 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5848 if (cur->value && *cur->value) {
5849 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5850 attr_size = apr_pstrdup(doc->pool, cur->value);
5852 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5853 attr_size = apr_pstrdup(doc->pool, cur->value);
5855 else if (STRCASEEQ('s','S',"small",cur->value)) {
5856 attr_size = apr_pstrdup(doc->pool, cur->value);
5858 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5859 attr_size = apr_pstrdup(doc->pool, cur->value);
5861 else if (STRCASEEQ('l','L',"large",cur->value)) {
5862 attr_size = apr_pstrdup(doc->pool, cur->value);
5864 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5865 attr_size = apr_pstrdup(doc->pool, cur->value);
5867 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5868 attr_size = apr_pstrdup(doc->pool, cur->value);
5875 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5877 if (attr_direction) {
5878 W_L("-wap-marquee-dir:");
5879 W_V(attr_direction);
5882 if (attr_behavior) {
5883 W_L("-wap-marquee-style:");
5888 W_L("-wap-marquee-loop:");
5893 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5894 W_L("background-color:");
5899 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5918 * It is a handler who processes the MARQUEE tag.
5920 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5921 * destination is specified.
5922 * @param node [i] The MARQUEE tag node is specified.
5923 * @return The conversion result is returned.
5926 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5928 xhtml_t *xhtml = GET_XHTML(pdoc);
5929 Doc *doc = xhtml->doc;
5931 if (IS_CSS_ON(xhtml->entryp)) {
5932 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5939 * It is handler who processes the New Line Code.
5942 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5944 xhtml_t *xhtml = GET_XHTML(pdoc);
5945 Doc *doc = xhtml->doc;
5946 if (xhtml->start_html_flag) {
5954 * It is a handler who processes the LINK tag.
5956 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5957 * destination is specified.
5958 * @param node [i] The LINK tag node is specified.
5959 * @return The conversion result is returned.
5962 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5971 xhtml = GET_XHTML(pdoc);
5974 if (! IS_CSS_ON(xhtml->entryp)) {
5978 for (attr = qs_get_attr(doc,node);
5980 attr = qs_get_next_attr(doc,attr)) {
5981 char *name = qs_get_attr_name(doc,attr);
5982 char *value = qs_get_attr_value(doc,attr);
5983 if (STRCASEEQ('r','R',"rel", name)) {
5984 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5988 else if (STRCASEEQ('h','H',"href", name)) {
5989 if (value && *value) {
5993 else if (STRCASEEQ('t','T',"type", name)) {
5994 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6000 if (rel && href && type) {
6001 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6002 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
6003 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6009 static css_prop_list_t *
6010 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6012 xhtml_t *xhtml = GET_XHTML(pdoc);
6013 Doc *doc = xhtml->doc;
6014 css_prop_list_t *last_css = NULL;
6015 if (IS_CSS_ON(xhtml->entryp)) {
6016 css_prop_list_t *dup_css;
6017 css_selector_t *selector;
6019 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6020 dup_css = chxj_dup_css_prop_list(doc, last_css);
6021 selector = chxj_css_find_selector(doc, xhtml->style, node);
6023 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6025 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
6026 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6028 if (style_attr_value) {
6029 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));
6031 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6039 static css_prop_list_t *
6040 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6042 xhtml_t *xhtml = GET_XHTML(pdoc);
6043 Doc *doc = xhtml->doc;
6044 css_prop_list_t *last_css = NULL;
6045 if (IS_CSS_ON(xhtml->entryp)) {
6046 css_prop_list_t *dup_css;
6047 css_selector_t *selector;
6049 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
6050 dup_css = chxj_dup_css_prop_list(doc, last_css);
6051 selector = chxj_css_find_selector(doc, xhtml->style, node);
6053 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6057 if (style_attr_value) {
6058 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));
6060 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6069 * It is a handler who processes the SPAN tag.
6071 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6072 * destination is specified.
6073 * @param node [i] The SPAN tag node is specified.
6074 * @return The conversion result is returned.
6077 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
6082 char *attr_style = NULL;
6083 char *attr_color = NULL;
6084 char *attr_size = NULL;
6085 char *attr_align = NULL;
6086 char *attr_blink = NULL;
6087 char *attr_marquee = NULL;
6088 char *attr_marquee_dir = NULL;
6089 char *attr_marquee_style = NULL;
6090 char *attr_marquee_loop = NULL;
6091 char *css_bgcolor = NULL;
6093 xhtml = GET_XHTML(pdoc);
6096 for (attr = qs_get_attr(doc,node);
6098 attr = qs_get_next_attr(doc,attr)) {
6099 char *nm = qs_get_attr_name(doc,attr);
6100 char *val = qs_get_attr_value(doc,attr);
6101 if (val && STRCASEEQ('s','S',"style", nm)) {
6105 if (IS_CSS_ON(xhtml->entryp)) {
6106 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
6108 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6109 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6110 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6111 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6112 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6113 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6114 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6115 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6116 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6118 css_property_t *cur;
6119 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6120 attr_color = apr_pstrdup(doc->pool, cur->value);
6122 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6123 if (cur->value && *cur->value) {
6124 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6125 || STRCASEEQ('x','X',"x-small", cur->value)
6126 || STRCASEEQ('s','S',"small", cur->value)
6127 || STRCASEEQ('m','M',"medium", cur->value)
6128 || STRCASEEQ('l','L',"large", cur->value)
6129 || STRCASEEQ('x','X',"x-large", cur->value)
6130 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6131 attr_size = apr_pstrdup(doc->pool, cur->value);
6135 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6136 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6137 attr_blink = apr_pstrdup(doc->pool, cur->value);
6140 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6141 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6142 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6145 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6146 if (cur->value && *cur->value) {
6147 if ( STRCASEEQ('l','L',"ltr",cur->value)
6148 || STRCASEEQ('r','R',"rtl",cur->value)) {
6149 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6153 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6154 if (cur->value && *cur->value) {
6155 if ( STRCASEEQ('s','S',"scroll",cur->value)
6156 || STRCASEEQ('s','S',"slide",cur->value)
6157 || STRCASEEQ('a','A',"alternate",cur->value)) {
6158 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6162 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6163 if (cur->value && *cur->value) {
6164 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6165 attr_marquee_loop = "infinite";
6168 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6172 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6173 if (STRCASEEQ('l','L',"left", cur->value)) {
6174 attr_align = apr_pstrdup(doc->pool, "left");
6176 else if (STRCASEEQ('c','C',"center",cur->value)) {
6177 attr_align = apr_pstrdup(doc->pool, "center");
6179 else if (STRCASEEQ('r','R',"right",cur->value)) {
6180 attr_align = apr_pstrdup(doc->pool, "right");
6183 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6184 if (cur->value && *cur->value) {
6185 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6192 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6195 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6211 W_L("text-decoration:");
6216 W_L("display:-wap-marquee;");
6217 if (attr_marquee_dir) {
6218 W_L("-wap-marquee-dir:");
6219 W_V(attr_marquee_dir);
6222 if (attr_marquee_style) {
6223 W_L("-wap-marquee-style:");
6224 W_V(attr_marquee_style);
6227 if (attr_marquee_loop) {
6228 W_L("-wap-marquee-loop:");
6229 W_V(attr_marquee_loop);
6234 W_L("background-color:");
6246 * It is a handler who processes the SPAN tag.
6248 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6249 * destination is specified.
6250 * @param node [i] The SPAN tag node is specified.
6251 * @return The conversion result is returned.
6254 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
6256 xhtml_t *xhtml = GET_XHTML(pdoc);
6257 Doc *doc = xhtml->doc;
6266 * It is a handler who processes the STYLE tag.
6268 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6269 * destination is specified.
6270 * @param node [i] The STYLE tag node is specified.
6271 * @return The conversion result is returned.
6274 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
6281 xhtml = GET_XHTML(pdoc);
6284 if (! IS_CSS_ON(xhtml->entryp)) {
6288 for (attr = qs_get_attr(doc,node);
6290 attr = qs_get_next_attr(doc,attr)) {
6291 char *name = qs_get_attr_name(doc,attr);
6292 char *value = qs_get_attr_value(doc,attr);
6293 if (STRCASEEQ('t','T',"type", name)) {
6294 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6300 Node *child = qs_get_child_node(doc, node);
6301 if (type && child) {
6302 char *name = qs_get_node_name(doc, child);
6303 if (STRCASEEQ('t','T',"text", name)) {
6304 char *value = qs_get_node_value(doc, child);
6305 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),value);
6306 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
6307 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),value);
6314 * It is a handler who processes the OBJECT tag.
6316 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6317 * destination is specified.
6318 * @param node [i] The OBJECT tag node is specified.
6319 * @return The conversion result is returned.
6322 s_xhtml_1_0_start_object_tag(void *pdoc, Node *node)
6324 xhtml_t *xhtml = GET_XHTML(pdoc);
6325 Doc *doc = xhtml->doc;
6329 char *attr_id = NULL;
6330 char *attr_width = NULL;
6331 char *attr_height = NULL;
6332 char *attr_data = NULL;
6333 char *attr_type = NULL;
6335 /*--------------------------------------------------------------------------*/
6336 /* Get Attributes */
6337 /*--------------------------------------------------------------------------*/
6338 for (attr = qs_get_attr(doc,node);
6340 attr = qs_get_next_attr(doc,attr)) {
6341 char *name = qs_get_attr_name(doc,attr);
6342 char *value = qs_get_attr_value(doc,attr);
6343 if (STRCASEEQ('i','I',"id",name)) {
6344 attr_id = apr_pstrdup(doc->pool, value);
6346 else if (STRCASEEQ('w','W',"width",name)) {
6347 attr_width = apr_pstrdup(doc->pool, value);
6349 else if (STRCASEEQ('h','H',"height",name)) {
6350 attr_height = apr_pstrdup(doc->pool, value);
6352 else if (STRCASEEQ('d','D',"data",name)) {
6353 attr_data = apr_pstrdup(doc->pool, value);
6355 else if (STRCASEEQ('t','T',"type",name)) {
6356 attr_type = apr_pstrdup(doc->pool, value);
6392 * It is a handler who processes the OBJECT tag.
6394 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6395 * destination is specified.
6396 * @param node [i] The OBJECT tag node is specified.
6397 * @return The conversion result is returned.
6400 s_xhtml_1_0_end_object_tag(void *pdoc, Node *UNUSED(node))
6402 xhtml_t *xhtml = GET_XHTML(pdoc);
6403 Doc *doc = xhtml->doc;
6410 * It is a handler who processes the OBJECT tag.
6412 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6413 * destination is specified.
6414 * @param node [i] The OBJECT tag node is specified.
6415 * @return The conversion result is returned.
6418 s_xhtml_1_0_start_param_tag(void *pdoc, Node *node)
6420 xhtml_t *xhtml = GET_XHTML(pdoc);
6421 Doc *doc = xhtml->doc;
6424 char *attr_name = NULL;
6425 char *attr_value = NULL;
6426 char *attr_valuetype = NULL;
6428 /*--------------------------------------------------------------------------*/
6429 /* Get Attributes */
6430 /*--------------------------------------------------------------------------*/
6431 for (attr = qs_get_attr(doc,node);
6433 attr = qs_get_next_attr(doc,attr)) {
6434 char *name = qs_get_attr_name(doc,attr);
6435 char *value = qs_get_attr_value(doc,attr);
6436 if (STRCASEEQ('n','N',"name",name)) {
6437 attr_name = apr_pstrdup(doc->pool, value);
6439 else if (STRCASEEQ('v','V',"value",name)) {
6440 attr_value = apr_pstrdup(doc->pool, value);
6442 else if (STRCASEEQ('v','V',"valuetype",name)) {
6443 attr_valuetype = apr_pstrdup(doc->pool, value);
6459 W_L(" valuetype=\"");
6460 W_V(attr_valuetype);
6467 * It is a handler who processes the CAPTION tag.
6469 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6470 * destination is specified.
6471 * @param node [i] The CAPTION tag node is specified.
6472 * @return The conversion result is returned.
6475 s_xhtml_1_0_start_caption_tag(void *pdoc, Node *node)
6477 xhtml_t *xhtml = GET_XHTML(pdoc);
6478 Doc *doc = xhtml->doc;
6480 char *attr_style = NULL;
6481 char *attr_align = NULL;
6483 for (attr = qs_get_attr(doc,node);
6485 attr = qs_get_next_attr(doc,attr)) {
6486 char *name = qs_get_attr_name(doc,attr);
6487 char *value = qs_get_attr_value(doc,attr);
6488 if (STRCASEEQ('a','A',"align", name)) {
6490 (STRCASEEQ('l','L',"left",value)
6491 || STRCASEEQ('r','R',"right",value)
6492 || STRCASEEQ('t','T',"top",value)
6493 || STRCASEEQ('b','B',"bottom",value)
6498 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6516 * It is a handler who processes the CAPTION tag.
6518 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6519 * destination is specified.
6520 * @param node [i] The CAPTION tag node is specified.
6521 * @return The conversion result is returned.
6524 s_xhtml_1_0_end_caption_tag(void *pdoc, Node *UNUSED(child))
6526 xhtml_t *xhtml = GET_XHTML(pdoc);
6527 Doc *doc = xhtml->doc;