2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_conv_z2h.h"
29 #define GET_XHTML(X) ((xhtml_t*)(X))
32 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
38 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_table_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_end_table_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_start_td_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_end_td_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_start_blockquote_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
116 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
117 static char *s_xhtml_1_0_start_plaintext_tag (void *pdoc, Node *node);
118 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
119 static char *s_xhtml_1_0_end_plaintext_tag (void *pdoc, Node *node);
120 static char *s_xhtml_1_0_start_blink_tag (void *pdoc, Node *node);
121 static char *s_xhtml_1_0_end_blink_tag (void *pdoc, Node *node);
122 static char *s_xhtml_1_0_start_marquee_tag (void *pdoc, Node *node);
123 static char *s_xhtml_1_0_end_marquee_tag (void *pdoc, Node *node);
124 static char *s_xhtml_1_0_newline_mark (void *pdoc, Node *node);
125 static char *s_xhtml_1_0_link_tag (void *pdoc, Node *node);
126 static char *s_xhtml_1_0_start_span_tag (void *pdoc, Node *node);
127 static char *s_xhtml_1_0_end_span_tag (void *pdoc, Node *node);
128 static char *s_xhtml_1_0_style_tag (void *pdoc, Node *node);
129 static char *s_xhtml_1_0_start_object_tag (void *pdoc, Node *node);
130 static char *s_xhtml_1_0_end_object_tag (void *pdoc, Node *node);
131 static char *s_xhtml_1_0_start_param_tag (void *pdoc, Node *node);
133 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
134 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
135 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
136 static css_prop_list_t *s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
137 static css_prop_list_t *s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
141 tag_handler xhtml_handler[] = {
144 s_xhtml_1_0_start_html_tag,
145 s_xhtml_1_0_end_html_tag,
149 s_xhtml_1_0_start_meta_tag,
150 s_xhtml_1_0_end_meta_tag,
154 s_xhtml_1_0_start_textarea_tag,
155 s_xhtml_1_0_end_textarea_tag,
159 s_xhtml_1_0_start_p_tag,
160 s_xhtml_1_0_end_p_tag,
164 s_xhtml_1_0_start_pre_tag,
165 s_xhtml_1_0_end_pre_tag,
169 s_xhtml_1_0_start_ul_tag,
170 s_xhtml_1_0_end_ul_tag,
174 s_xhtml_1_0_start_li_tag,
175 s_xhtml_1_0_end_li_tag,
179 s_xhtml_1_0_start_ol_tag,
180 s_xhtml_1_0_end_ol_tag,
184 s_xhtml_1_0_start_h1_tag,
185 s_xhtml_1_0_end_h1_tag,
189 s_xhtml_1_0_start_h2_tag,
190 s_xhtml_1_0_end_h2_tag,
194 s_xhtml_1_0_start_h3_tag,
195 s_xhtml_1_0_end_h3_tag,
199 s_xhtml_1_0_start_h4_tag,
200 s_xhtml_1_0_end_h4_tag,
204 s_xhtml_1_0_start_h5_tag,
205 s_xhtml_1_0_end_h5_tag,
209 s_xhtml_1_0_start_h6_tag,
210 s_xhtml_1_0_end_h6_tag,
214 s_xhtml_1_0_start_head_tag,
215 s_xhtml_1_0_end_head_tag,
219 s_xhtml_1_0_start_title_tag,
220 s_xhtml_1_0_end_title_tag,
224 s_xhtml_1_0_start_base_tag,
225 s_xhtml_1_0_end_base_tag,
229 s_xhtml_1_0_start_body_tag,
230 s_xhtml_1_0_end_body_tag,
234 s_xhtml_1_0_start_a_tag,
235 s_xhtml_1_0_end_a_tag,
239 s_xhtml_1_0_start_br_tag,
240 s_xhtml_1_0_end_br_tag,
244 s_xhtml_1_0_start_table_tag,
245 s_xhtml_1_0_end_table_tag,
249 s_xhtml_1_0_start_tr_tag,
250 s_xhtml_1_0_end_tr_tag,
254 s_xhtml_1_0_start_td_tag,
255 s_xhtml_1_0_end_td_tag,
264 s_xhtml_1_0_start_font_tag,
265 s_xhtml_1_0_end_font_tag,
269 s_xhtml_1_0_start_form_tag,
270 s_xhtml_1_0_end_form_tag,
274 s_xhtml_1_0_start_input_tag,
275 s_xhtml_1_0_end_input_tag,
279 s_xhtml_1_0_start_center_tag,
280 s_xhtml_1_0_end_center_tag,
284 s_xhtml_1_0_start_hr_tag,
285 s_xhtml_1_0_end_hr_tag,
289 s_xhtml_1_0_start_img_tag,
290 s_xhtml_1_0_end_img_tag,
294 s_xhtml_1_0_start_select_tag,
295 s_xhtml_1_0_end_select_tag,
299 s_xhtml_1_0_start_option_tag,
300 s_xhtml_1_0_end_option_tag,
304 s_xhtml_1_0_start_div_tag,
305 s_xhtml_1_0_end_div_tag,
309 s_xhtml_1_0_chxjif_tag,
314 s_xhtml_1_0_chxjif_tag,
329 s_xhtml_1_0_style_tag,
334 s_xhtml_1_0_start_span_tag,
335 s_xhtml_1_0_end_span_tag,
339 s_xhtml_1_0_text_tag,
349 s_xhtml_1_0_start_b_tag,
350 s_xhtml_1_0_end_b_tag,
359 s_xhtml_1_0_start_dt_tag,
360 s_xhtml_1_0_end_dt_tag,
374 s_xhtml_1_0_start_blockquote_tag,
375 s_xhtml_1_0_end_blockquote_tag,
379 s_xhtml_1_0_start_dir_tag,
380 s_xhtml_1_0_end_dir_tag,
384 s_xhtml_1_0_start_dl_tag,
385 s_xhtml_1_0_end_dl_tag,
389 s_xhtml_1_0_start_dd_tag,
390 s_xhtml_1_0_end_dd_tag,
394 s_xhtml_1_0_start_menu_tag,
395 s_xhtml_1_0_end_menu_tag,
399 s_xhtml_1_0_start_plaintext_tag,
400 s_xhtml_1_0_end_plaintext_tag,
404 s_xhtml_1_0_start_blink_tag,
405 s_xhtml_1_0_end_blink_tag,
409 s_xhtml_1_0_start_marquee_tag,
410 s_xhtml_1_0_end_marquee_tag,
414 s_xhtml_1_0_link_tag,
419 s_xhtml_1_0_newline_mark,
424 s_xhtml_1_0_start_object_tag,
425 s_xhtml_1_0_end_object_tag,
429 s_xhtml_1_0_start_param_tag,
435 * converts from CHTML to XHTML.
437 * @param r [i] Requet_rec is appointed.
438 * @param spec [i] The result of the device specification processing which
439 * was done in advance is appointed.
440 * @param src [i] The character string before the converting is appointed.
441 * @return The character string after the converting is returned.
444 chxj_convert_xhtml_mobile_1_0(
450 chxjconvrule_entry *entryp,
459 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
460 /*--------------------------------------------------------------------------*/
462 /*--------------------------------------------------------------------------*/
464 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
466 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
470 /*--------------------------------------------------------------------------*/
471 /* The XHTML structure is initialized. */
472 /*--------------------------------------------------------------------------*/
473 s_init_xhtml(&xhtml, &doc, r, spec);
475 xhtml.entryp = entryp;
476 xhtml.cookie = cookie;
478 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
480 /*--------------------------------------------------------------------------*/
481 /* The character string of the input is analyzed. */
482 /*--------------------------------------------------------------------------*/
483 qs_init_malloc(&doc);
484 qs_init_root_node(&doc);
486 ss = apr_pcalloc(r->pool, srclen + 1);
487 memset(ss, 0, srclen + 1);
488 memcpy(ss, src, srclen);
490 if (IS_CSS_ON(xhtml.entryp)) {
491 /* current property list */
492 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
495 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
497 qs_parse_string(&doc,ss, strlen(ss));
499 chxj_buffered_write_init(r->pool, &doc.buf);
500 /*--------------------------------------------------------------------------*/
501 /* It converts it from CHTML to XHTML. */
502 /*--------------------------------------------------------------------------*/
503 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
504 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
505 dst = apr_pstrdup(r->pool, xhtml.out);
506 chxj_buffered_write_terminate(&doc.buf);
508 qs_all_free(&doc,QX_LOGMARK);
511 return apr_pstrdup(r->pool,ss);
515 dst = apr_psprintf(r->pool, "\n");
517 *dstlen = strlen(dst);
520 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
523 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
529 * The XHTML structure is initialized.
531 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
532 * initialized is specified.
533 * @param doc [i] The Doc structure that should be set to the initialized
534 * HDML structure is specified.
535 * @param r [i] To use POOL, the pointer to request_rec is specified.
536 * @param spec [i] The pointer to the device_table
539 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
541 memset(doc, 0, sizeof(Doc));
542 memset(xhtml, 0, sizeof(xhtml_t));
547 xhtml->out = qs_alloc_zero_byte_string(r->pool);
548 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
549 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
554 * Corresponding EMOJI to a current character-code is retrieved.
555 * The substitution character string is stored in the rslt pointer if agreeing.
557 * @param xhtml [i] The pointer to the XHTML structure is specified.
558 * @param txt [i] The character string to want to examine whether it is
559 * EMOJI is specified.
560 * @param rslt [o] The pointer to the pointer that stores the result is
562 * @return When corresponding EMOJI exists, it returns it excluding 0.
565 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
578 DBG(r,"spec is NULL");
581 for (ee = xhtml->conf->emoji;
584 unsigned char hex1byte;
585 unsigned char hex2byte;
587 DBG(r,"emoji->imode is NULL");
591 if (ee->imode->string != NULL
592 && strlen(ee->imode->string) > 0
593 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
594 if (spec == NULL || spec->emoji_type == NULL) {
595 *rslt = apr_psprintf(r->pool,
598 return strlen(ee->imode->string);
601 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
602 *rslt = apr_psprintf(r->pool,
605 return strlen(ee->imode->string);
608 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
609 *rslt = apr_psprintf(r->pool,
612 return strlen(ee->imode->string);
615 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
616 *rslt = apr_psprintf(r->pool,
619 return strlen(ee->imode->string);
622 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
623 *rslt = apr_psprintf(r->pool,
626 return strlen(ee->imode->string);
629 *rslt = apr_psprintf(r->pool,
632 return strlen(ee->imode->string);
636 hex1byte = ee->imode->hex1byte & 0xff;
637 hex2byte = ee->imode->hex2byte & 0xff;
639 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
640 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
641 if (spec == NULL || spec->emoji_type == NULL) {
642 *rslt = apr_psprintf(r->pool,
643 "<img localsrc=\"%s\">",
648 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
649 *rslt = apr_psprintf(r->pool,
650 "<img localsrc=\"%s\">",
655 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
656 *rslt = apr_psprintf(r->pool,
657 "<img localsrc=\"%s\">",
662 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
663 *rslt = apr_psprintf(r->pool,
664 "<img localsrc=\"%s\">",
669 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
670 *rslt = apr_psprintf(r->pool,
671 "<img localsrc=\"%s\">",
676 *rslt = apr_psprintf(r->pool,
677 "<img localsrc=\"%s\">",
689 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
703 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
704 memset(doc, 0, sizeof(Doc));
705 memset(xhtml, 0, sizeof(xhtml_t));
710 xhtml->out = qs_alloc_zero_byte_string(r->pool);
711 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
712 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
714 apr_pool_create(&pool, r->pool);
716 chxj_buffered_write_init(pool, &doc->buf);
718 for (ii=0; ii<len; ii++) {
722 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
729 if (is_sjis_kanji(src[ii])) {
730 two_byte[0] = src[ii+0];
731 two_byte[1] = src[ii+1];
737 one_byte[0] = src[ii+0];
742 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
744 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
750 * It is a handler who processes the HTML tag.
752 * @param pdoc [i/o] The pointer to the XHTML structure at the output
753 * destination is specified.
754 * @param node [i] The HTML tag node is specified.
755 * @return The conversion result is returned.
758 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
760 xhtml_t *xhtml = GET_XHTML(pdoc);
761 Doc *doc = xhtml->doc;
763 /*--------------------------------------------------------------------------*/
764 /* Add XML Declare */
765 /*--------------------------------------------------------------------------*/
766 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
768 /*--------------------------------------------------------------------------*/
770 /*--------------------------------------------------------------------------*/
771 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
773 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
775 /*--------------------------------------------------------------------------*/
777 /*--------------------------------------------------------------------------*/
778 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
780 xhtml->start_html_flag = 1;
786 * It is a handler who processes the HTML tag.
788 * @param pdoc [i/o] The pointer to the XHTML structure at the output
789 * destination is specified.
790 * @param node [i] The HTML tag node is specified.
791 * @return The conversion result is returned.
794 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
796 xhtml_t *xhtml = GET_XHTML(pdoc);
797 Doc *doc = xhtml->doc;
804 * It is a handler who processes the META tag.
806 * @param pdoc [i/o] The pointer to the XHTML structure at the output
807 * destination is specified.
808 * @param node [i] The META tag node is specified.
809 * @return The conversion result is returned.
812 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
814 xhtml_t *xhtml = GET_XHTML(pdoc);
816 Doc *doc = xhtml->doc;
817 int content_type_flag = 0;
818 request_rec *r = doc->r;
821 /*--------------------------------------------------------------------------*/
823 /*--------------------------------------------------------------------------*/
824 for (attr = qs_get_attr(doc,node);
826 attr = qs_get_next_attr(doc,attr)) {
827 char *name = qs_get_attr_name(doc,attr);
828 char *value = qs_get_attr_value(doc,attr);
829 if (STRCASEEQ('n','N',"name", name) && value && *value) {
836 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
842 if (STRCASEEQ('c','C', "content-type", value)) {
843 content_type_flag = 1;
846 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
847 if (content_type_flag) {
851 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Shift_JIS"));
869 * It is a handler who processes the META tag.
871 * @param pdoc [i/o] The pointer to the XHTML structure at the output
872 * destination is specified.
873 * @param node [i] The META tag node is specified.
874 * @return The conversion result is returned.
877 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
879 xhtml_t *xhtml = GET_XHTML(pdoc);
886 * It is a handler who processes the HEAD tag.
888 * @param pdoc [i/o] The pointer to the XHTML structure at the output
889 * destination is specified.
890 * @param node [i] The HEAD tag node is specified.
891 * @return The conversion result is returned.
894 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
896 xhtml_t *xhtml = GET_XHTML(pdoc);
897 Doc *doc = xhtml->doc;
905 * It is a handler who processes the HEAD tag.
907 * @param pdoc [i/o] The pointer to the XHTML structure at the output
908 * destination is specified.
909 * @param node [i] The HEAD tag node is specified.
910 * @return The conversion result is returned.
913 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
915 xhtml_t *xhtml = GET_XHTML(pdoc);
916 Doc *doc = xhtml->doc;
924 * It is a handler who processes the TITLE tag.
926 * @param pdoc [i/o] The pointer to the XHTML structure at the output
927 * destination is specified.
928 * @param node [i] The TITLE tag node is specified.
929 * @return The conversion result is returned.
932 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
934 xhtml_t *xhtml = GET_XHTML(pdoc);
935 Doc *doc = xhtml->doc;
943 * It is a handler who processes the TITLE tag.
945 * @param pdoc [i/o] The pointer to the XHTML structure at the output
946 * destination is specified.
947 * @param node [i] The TITLE tag node is specified.
948 * @return The conversion result is returned.
951 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
953 xhtml_t *xhtml = GET_XHTML(pdoc);
954 Doc *doc = xhtml->doc;
963 * It is a handler who processes the BASE tag.
965 * @param pdoc [i/o] The pointer to the XHTML structure at the output
966 * destination is specified.
967 * @param node [i] The BASE tag node is specified.
968 * @return The conversion result is returned.
971 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
973 xhtml_t *xhtml = GET_XHTML(pdoc);
975 Doc *doc = xhtml->doc;
978 /*--------------------------------------------------------------------------*/
980 /*--------------------------------------------------------------------------*/
981 for (attr = qs_get_attr(doc,node);
983 attr = qs_get_next_attr(doc,attr)) {
984 char *name = qs_get_attr_name(doc,attr);
985 char *value = qs_get_attr_value(doc,attr);
986 if (STRCASEEQ('h','H',"href",name)) {
1000 * It is a handler who processes the BASE tag.
1002 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The BASE tag node is specified.
1005 * @return The conversion result is returned.
1008 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
1010 xhtml_t *xhtml = GET_XHTML(pdoc);
1017 * It is a handler who processes the BODY tag.
1019 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1020 * destination is specified.
1021 * @param node [i] The BODY tag node is specified.
1022 * @return The conversion result is returned.
1025 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1027 xhtml_t *xhtml = GET_XHTML(pdoc);
1028 Doc *doc = xhtml->doc;
1030 char *attr_bgcolor = NULL;
1031 char *attr_text = NULL;
1032 char *attr_link = NULL;
1033 char *attr_vlink = NULL;
1034 char *attr_style = NULL;
1035 char *attr_background = NULL;
1037 /*--------------------------------------------------------------------------*/
1038 /* Get Attributes */
1039 /*--------------------------------------------------------------------------*/
1040 for (attr = qs_get_attr(doc,node);
1042 attr = qs_get_next_attr(doc,attr)) {
1043 char *name = qs_get_attr_name(doc,attr);
1044 char *value = qs_get_attr_value(doc,attr);
1045 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1046 attr_bgcolor = value;
1048 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1051 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1054 else if (STRCASEEQ('a','A',"alink", name)) {
1057 else if (STRCASEEQ('v','V',"vlink",name)) {
1060 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1063 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1064 attr_background = value;
1068 if (IS_CSS_ON(xhtml->entryp)) {
1069 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1071 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1072 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1073 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1074 css_property_t *cur;
1075 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1076 if (cur->value && *cur->value) {
1077 attr_text = apr_pstrdup(doc->pool, cur->value);
1080 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1081 if (cur->value && *cur->value) {
1082 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1085 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1086 if (cur->value && *cur->value) {
1087 char *tmp = apr_pstrdup(doc->pool, cur->value);
1088 char *tmps = strstr(tmp,"(");
1090 char *tmpe = strstr(tmp,")");
1091 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1093 attr_background = apr_pstrndup(doc->pool, tmps,len);
1099 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1100 css_selector_t *cur_sel;
1101 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1102 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1103 css_property_t *cur;
1104 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1105 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1106 attr_link = apr_pstrdup(doc->pool, cur->value);
1110 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1111 css_property_t *cur;
1112 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1113 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1114 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1123 if (attr_bgcolor || attr_text) {
1126 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1127 W_L("background-color:");
1132 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1140 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1146 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1151 if (attr_background) {
1152 W_L(" background=\"");
1153 W_V(attr_background);
1163 * It is a handler who processes the BODY tag.
1165 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1166 * destination is specified.
1167 * @param node [i] The BODY tag node is specified.
1168 * @return The conversion result is returned.
1171 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1173 xhtml_t *xhtml = GET_XHTML(pdoc);
1174 Doc *doc = xhtml->doc;
1177 if (IS_CSS_ON(xhtml->entryp)) {
1178 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1186 * It is a handler who processes the A tag.
1188 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1189 * destination is specified.
1190 * @param node [i] The A tag node is specified.
1191 * @return The conversion result is returned.
1194 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1196 xhtml_t *xhtml = GET_XHTML(pdoc);
1197 Doc *doc = xhtml->doc;
1198 request_rec *r = doc->r;
1200 char *attr_style = NULL;
1203 /*--------------------------------------------------------------------------*/
1204 /* Get Attributes */
1205 /*--------------------------------------------------------------------------*/
1206 for (attr = qs_get_attr(doc,node);
1208 attr = qs_get_next_attr(doc,attr)) {
1209 char* name = qs_get_attr_name(doc,attr);
1210 char* value = qs_get_attr_value(doc,attr);
1211 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1216 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1217 value = chxj_encoding_parameter(r, value, 1);
1218 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1219 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1225 else if (STRCASEEQ('a','A',"accesskey", name)) {
1226 W_L(" accesskey=\"");
1230 else if (STRCASEEQ('c','C',"cti",name)) {
1233 else if (STRCASEEQ('i','I',"ijam", name)) {
1236 else if (STRCASEEQ('u','U',"utn", name)) {
1239 else if (STRCASEEQ('t','T',"telbook",name)) {
1242 else if (STRCASEEQ('k','K',"kana",name)) {
1245 else if (STRCASEEQ('e','E',"email",name)) {
1248 else if (STRCASEEQ('i','I',"ista",name)) {
1251 else if (STRCASEEQ('i','I',"ilet",name)) {
1254 else if (STRCASEEQ('i','I',"iswf",name)) {
1257 else if (STRCASEEQ('i','I',"irst",name)) {
1260 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1266 if (IS_CSS_ON(xhtml->entryp)) {
1267 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1275 * It is a handler who processes the A tag.
1277 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1278 * destination is specified.
1279 * @param node [i] The A tag node is specified.
1280 * @return The conversion result is returned.
1283 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1285 xhtml_t *xhtml = GET_XHTML(pdoc);
1286 Doc *doc = xhtml->doc;
1290 if (IS_CSS_ON(xhtml->entryp)) {
1291 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1299 * It is a handler who processes the BR tag.
1301 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1302 * destination is specified.
1303 * @param node [i] The BR tag node is specified.
1304 * @return The conversion result is returned.
1307 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1309 xhtml_t *xhtml = GET_XHTML(pdoc);
1310 Doc *doc = xhtml->doc;
1312 char *attr_style = NULL;
1313 char *attr_clear = NULL;
1316 /*--------------------------------------------------------------------------*/
1317 /* Get Attributes */
1318 /*--------------------------------------------------------------------------*/
1319 for (attr = qs_get_attr(doc,node);
1321 attr = qs_get_next_attr(doc,attr)) {
1322 char *name = qs_get_attr_name(doc,attr);
1323 char *value = qs_get_attr_value(doc,attr);
1324 if (STRCASEEQ('c','C',"clear",name)) {
1325 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1329 else if (STRCASEEQ('s','S',"style",name)) {
1330 attr_style = apr_pstrdup(doc->buf.pool, value);
1333 if (IS_CSS_ON(xhtml->entryp)) {
1334 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1336 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1337 css_property_t *cur;
1338 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1339 if (cur->value && *cur->value) {
1340 if ( STRCASEEQ('l','L',"left", cur->value)
1341 || STRCASEEQ('r','R',"right", cur->value)
1342 || STRCASEEQ('b','B',"both" ,cur->value)) {
1343 attr_clear = apr_pstrdup(doc->pool, cur->value);
1362 * It is a handler who processes the BR tag.
1364 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1365 * destination is specified.
1366 * @param node [i] The BR tag node is specified.
1367 * @return The conversion result is returned.
1370 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1372 xhtml_t *xhtml = GET_XHTML(pdoc);
1379 * It is a handler who processes the TABLE tag.
1381 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1382 * destination is specified.
1383 * @param node [i] The TR tag node is specified.
1384 * @return The conversion result is returned.
1387 s_xhtml_1_0_start_table_tag(void *pdoc, Node *node)
1389 xhtml_t *xhtml = GET_XHTML(pdoc);
1390 Doc *doc = xhtml->doc;
1391 request_rec *r = doc->r;
1393 char *attr_style = NULL;
1394 char *attr_align = NULL;
1395 char *attr_width = NULL;
1396 char *attr_height = NULL;
1397 char *attr_bgcolor = NULL;
1398 char *attr_border_width = NULL;
1399 char *attr_border_color = NULL;
1401 /*--------------------------------------------------------------------------*/
1402 /* Get Attributes */
1403 /*--------------------------------------------------------------------------*/
1404 for (attr = qs_get_attr(doc,node);
1406 attr = qs_get_next_attr(doc,attr)) {
1407 char *name = qs_get_attr_name(doc,attr);
1408 char *val = qs_get_attr_value(doc,attr);
1410 if (STRCASEEQ('a','A',"align",name)) {
1411 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1412 attr_align = apr_pstrdup(doc->buf.pool, val);
1415 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1416 attr_height = apr_pstrdup(doc->buf.pool, val);
1418 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1419 attr_width = apr_pstrdup(doc->buf.pool, val);
1421 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1422 attr_style = apr_pstrdup(doc->buf.pool, val);
1424 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1425 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1426 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1428 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1429 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1431 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1432 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1433 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1436 if (IS_CSS_ON(xhtml->entryp)) {
1437 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1439 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1440 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1441 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1442 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1443 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1444 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1446 css_property_t *cur;
1447 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1448 char *tmp = apr_pstrdup(doc->pool, cur->value);
1449 char *tmpp = strstr(tmp, "px");
1451 size_t len = strlen(tmp) - strlen(tmpp);
1452 attr_width = apr_pstrndup(doc->pool, tmp,len);
1455 attr_width = apr_pstrdup(doc->pool, tmp);
1458 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1459 char *tmp = apr_pstrdup(doc->pool, cur->value);
1460 char *tmpp = strstr(tmp, "px");
1462 size_t len = strlen(tmp) - strlen(tmpp);
1463 attr_height = apr_pstrndup(doc->pool, tmp,len);
1466 attr_height = apr_pstrdup(doc->pool, tmp);
1469 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1470 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1471 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1474 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1475 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1476 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1478 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1479 char *tmp = apr_pstrdup(doc->pool, cur->value);
1480 char *tmpp = strstr(tmp, "px");
1482 size_t len = strlen(tmp) - strlen(tmpp);
1483 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1486 attr_border_width = apr_pstrdup(doc->pool, tmp);
1489 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1490 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1491 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1512 if (attr_bgcolor && *attr_bgcolor){
1517 if (attr_border_width || attr_border_color ){
1518 W_L(" style=\"border:");
1519 if (attr_border_width){
1520 W_V(attr_border_width);
1527 if (attr_border_color && *attr_border_color){
1529 W_V(attr_border_color);
1541 * It is a handler who processes the TABLE tag.
1543 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1544 * destination is specified.
1545 * @param node [i] The TR tag node is specified.
1546 * @return The conversion result is returned.
1549 s_xhtml_1_0_end_table_tag(void *pdoc, Node *UNUSED(child))
1551 xhtml_t *xhtml = GET_XHTML(pdoc);
1552 Doc *doc = xhtml->doc;
1559 * It is a handler who processes the TR tag.
1561 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1562 * destination is specified.
1563 * @param node [i] The TR tag node is specified.
1564 * @return The conversion result is returned.
1567 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *node)
1569 xhtml_t *xhtml = GET_XHTML(pdoc);
1570 Doc *doc = xhtml->doc;
1572 request_rec *r = doc->r;
1575 char *attr_style = NULL;
1576 char *attr_align = NULL;
1577 char *attr_valign = NULL;
1578 char *attr_bgcolor = NULL;
1580 /*--------------------------------------------------------------------------*/
1581 /* Get Attributes */
1582 /*--------------------------------------------------------------------------*/
1583 for (attr = qs_get_attr(doc,node);
1585 attr = qs_get_next_attr(doc,attr)) {
1586 char *name = qs_get_attr_name(doc,attr);
1587 char *val = qs_get_attr_value(doc,attr);
1589 if (STRCASEEQ('a','A',"align",name)) {
1590 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1591 attr_align = apr_pstrdup(doc->buf.pool, val);
1594 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1595 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1596 attr_valign = apr_pstrdup(doc->buf.pool, val);
1599 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1600 attr_style = apr_pstrdup(doc->buf.pool, val);
1602 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1603 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1604 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1607 if (IS_CSS_ON(xhtml->entryp)) {
1608 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1610 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1611 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1612 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1614 css_property_t *cur;
1615 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1616 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1617 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1620 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1621 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1622 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1625 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1626 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1627 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1643 if (attr_bgcolor && *attr_bgcolor){
1655 * It is a handler who processes the TR tag.
1657 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1658 * destination is specified.
1659 * @param node [i] The TR tag node is specified.
1660 * @return The conversion result is returned.
1663 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1665 xhtml_t *xhtml = GET_XHTML(pdoc);
1666 Doc *doc = xhtml->doc;
1674 * It is a handler who processes the TD tag.
1676 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1677 * destination is specified.
1678 * @param node [i] The TR tag node is specified.
1679 * @return The conversion result is returned.
1682 s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
1684 xhtml_t *xhtml = GET_XHTML(pdoc);
1685 Doc *doc = xhtml->doc;
1687 request_rec *r = doc->r;
1690 char *attr_style = NULL;
1691 char *attr_align = NULL;
1692 char *attr_valign = NULL;
1693 char *attr_bgcolor = NULL;
1694 char *attr_colspan = NULL;
1695 char *attr_rowspan = NULL;
1697 /*--------------------------------------------------------------------------*/
1698 /* Get Attributes */
1699 /*--------------------------------------------------------------------------*/
1700 for (attr = qs_get_attr(doc,node);
1702 attr = qs_get_next_attr(doc,attr)) {
1703 char *name = qs_get_attr_name(doc,attr);
1704 char *val = qs_get_attr_value(doc,attr);
1705 if (STRCASEEQ('a','A',"align",name)) {
1706 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1707 attr_align = apr_pstrdup(doc->buf.pool, val);
1710 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1711 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1712 attr_valign = apr_pstrdup(doc->buf.pool, val);
1715 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1716 attr_style = apr_pstrdup(doc->buf.pool, val);
1718 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1719 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1720 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1722 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1723 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1725 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1726 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1730 if (IS_CSS_ON(xhtml->entryp)) {
1731 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1733 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1734 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1735 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1737 css_property_t *cur;
1738 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1739 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1740 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1743 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1744 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1745 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1748 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1749 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1750 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1776 if (attr_bgcolor && *attr_bgcolor){
1788 * It is a handler who processes the TD tag.
1790 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1791 * destination is specified.
1792 * @param node [i] The TR tag node is specified.
1793 * @return The conversion result is returned.
1796 s_xhtml_1_0_end_td_tag(void *pdoc, Node *UNUSED(child))
1798 xhtml_t *xhtml = GET_XHTML(pdoc);
1799 Doc *doc = xhtml->doc;
1807 * It is a handler who processes the FONT tag.
1809 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1810 * destination is specified.
1811 * @param node [i] The FONT tag node is specified.
1812 * @return The conversion result is returned.
1815 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1817 xhtml_t *xhtml = GET_XHTML(pdoc);
1818 Doc *doc = xhtml->doc;
1820 char *attr_color = NULL;
1821 char *attr_size = NULL;
1822 char *attr_style = NULL;
1824 /*--------------------------------------------------------------------------*/
1825 /* Get Attributes */
1826 /*--------------------------------------------------------------------------*/
1827 for (attr = qs_get_attr(doc,node);
1829 attr = qs_get_next_attr(doc,attr)) {
1830 char *name = qs_get_attr_name(doc,attr);
1831 char *value = qs_get_attr_value(doc,attr);
1832 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1833 attr_color = apr_pstrdup(doc->buf.pool, value);
1835 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1836 /*----------------------------------------------------------------------*/
1838 /*----------------------------------------------------------------------*/
1839 attr_size = apr_pstrdup(doc->buf.pool, value);
1841 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1842 attr_style = apr_pstrdup(doc->buf.pool, value);
1845 if (IS_CSS_ON(xhtml->entryp)) {
1846 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1848 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1849 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1850 css_property_t *cur;
1851 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1852 if (cur->value && *cur->value) {
1853 attr_color = apr_pstrdup(doc->pool, cur->value);
1856 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1857 if (cur->value && *cur->value) {
1858 attr_size = apr_pstrdup(doc->pool, cur->value);
1859 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1860 attr_size = apr_pstrdup(doc->pool, "1");
1862 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1863 attr_size = apr_pstrdup(doc->pool, "2");
1865 else if (STRCASEEQ('s','S',"small",attr_size)) {
1866 attr_size = apr_pstrdup(doc->pool, "3");
1868 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1869 attr_size = apr_pstrdup(doc->pool, "4");
1871 else if (STRCASEEQ('l','L',"large",attr_size)) {
1872 attr_size = apr_pstrdup(doc->pool, "5");
1874 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1875 attr_size = apr_pstrdup(doc->pool, "6");
1877 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1878 attr_size = apr_pstrdup(doc->pool, "7");
1885 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1886 memset(flg, 0, sizeof(*flg));
1888 W_L("<font color=\"");
1891 flg->font_color_flag = 1;
1894 flg->font_size_flag = 1;
1895 switch(*attr_size) {
1896 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1897 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1898 case '3': W_L("<span style=\"font-size: small\">"); break;
1899 case '4': W_L("<span style=\"font-size: medium\">"); break;
1900 case '5': W_L("<span style=\"font-size: large\">"); break;
1901 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1902 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1904 if (*(attr_size + 1) == '1') {
1905 W_L("<span style=\"font-size: small\">");
1908 if (*(attr_size + 1) == '2') {
1909 W_L("<span style=\"font-size: x-small\">");
1912 if (*(attr_size + 1) == '3') {
1913 W_L("<span style=\"font-size: xx-small\">");
1916 flg->font_size_flag = 0;
1920 if (*(attr_size + 1) == '1') {
1921 W_L("<span style=\"font-size: large\">");
1924 if (*(attr_size + 1) == '2') {
1925 W_L("<span style=\"font-size: x-large\">");
1928 if (*(attr_size + 1) == '3') {
1929 W_L("<span style=\"font-size: xx-large\">");
1932 flg->font_size_flag = 0;
1936 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1937 flg->font_size_flag = 0;
1940 node->userData = flg;
1947 * It is a handler who processes the FONT tag.
1949 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1950 * destination is specified.
1951 * @param node [i] The FONT tag node is specified.
1952 * @return The conversion result is returned.
1955 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
1957 xhtml_t *xhtml = GET_XHTML(pdoc);
1958 Doc *doc = xhtml->doc;
1960 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1961 if (flg && flg->font_size_flag) {
1964 if (flg && flg->font_color_flag) {
1967 if (IS_CSS_ON(xhtml->entryp)) {
1968 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1975 * It is a handler who processes the FORM tag.
1977 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1978 * destination is specified.
1979 * @param node [i] The FORM tag node is specified.
1980 * @return The conversion result is returned.
1983 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1985 xhtml_t *xhtml = GET_XHTML(pdoc);
1986 Doc *doc = xhtml->doc;
1987 request_rec *r = doc->r;
1989 char *attr_action = NULL;
1990 char *attr_method = NULL;
1991 char *attr_style = NULL;
1992 char *attr_color = NULL;
1993 char *attr_align = NULL;
1994 char *attr_name = NULL;
1995 char *new_hidden_tag = NULL;
1997 /*--------------------------------------------------------------------------*/
1998 /* Get Attributes */
1999 /*--------------------------------------------------------------------------*/
2000 for (attr = qs_get_attr(doc,node);
2002 attr = qs_get_next_attr(doc,attr)) {
2003 char *name = qs_get_attr_name(doc,attr);
2004 char *value = qs_get_attr_value(doc,attr);
2008 if (strcasecmp(name, "action") == 0) {
2009 /*--------------------------------------------------------------------*/
2011 /*--------------------------------------------------------------------*/
2012 attr_action = value;
2018 if (strcasecmp(name, "method") == 0) {
2019 /*--------------------------------------------------------------------*/
2021 /*--------------------------------------------------------------------*/
2022 attr_method = value;
2028 if (strcasecmp(name, "name") == 0) {
2029 /*--------------------------------------------------------------------*/
2031 /*--------------------------------------------------------------------*/
2038 if (strcasecmp(name, "style") == 0) {
2047 if (IS_CSS_ON(xhtml->entryp)) {
2048 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2050 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2051 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2052 css_property_t *cur;
2053 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2054 if (STRCASEEQ('l','L',"left", cur->value)) {
2055 attr_align = apr_pstrdup(doc->pool, "left");
2057 else if (STRCASEEQ('c','C',"center",cur->value)) {
2058 attr_align = apr_pstrdup(doc->pool, "center");
2060 else if (STRCASEEQ('r','R',"right",cur->value)) {
2061 attr_align = apr_pstrdup(doc->pool, "right");
2064 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2065 attr_color = apr_pstrdup(doc->pool, cur->value);
2070 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2074 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2075 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
2077 char *old_qs = NULL;
2078 q = strchr(attr_action, '?');
2080 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);
2081 if (new_hidden_tag || old_qs) {
2105 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
2106 memset(flg, 0, sizeof(*flg));
2108 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2109 W_L("<font color=\"");
2112 flg->with_font_flag = 1;
2115 W_L("<div align=\"");
2118 flg->with_div_flag = 1;
2120 node->userData = flg;
2121 if (new_hidden_tag) {
2122 W_V(new_hidden_tag);
2129 * It is a handler who processes the FORM tag.
2131 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2132 * destination is specified.
2133 * @param node [i] The FORM tag node is specified.
2134 * @return The conversion result is returned.
2137 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
2139 xhtml_t *xhtml = GET_XHTML(pdoc);
2140 Doc *doc = xhtml->doc;
2142 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
2143 if (flg && flg->with_div_flag) {
2146 if (flg && flg->with_font_flag) {
2150 if (IS_CSS_ON(xhtml->entryp)) {
2151 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2159 * It is a handler who processes the INPUT tag.
2161 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2162 * destination is specified.
2163 * @param node [i] The INPUT tag node is specified.
2164 * @return The conversion result is returned.
2167 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
2169 xhtml_t *xhtml = GET_XHTML(pdoc);
2170 Doc *doc = xhtml->doc;
2171 request_rec *r = doc->r;
2173 char *attr_max_length = NULL;
2174 char *attr_type = NULL;
2175 char *attr_name = NULL;
2176 char *attr_value = NULL;
2177 char *attr_istyle = NULL;
2178 char *attr_size = NULL;
2179 char *attr_checked = NULL;
2180 char *attr_accesskey = NULL;
2181 char *attr_style = NULL;
2183 /*--------------------------------------------------------------------------*/
2184 /* Get Attributes */
2185 /*--------------------------------------------------------------------------*/
2186 for (attr = qs_get_attr(doc,node);
2188 attr = qs_get_next_attr(doc,attr)) {
2189 char *name = qs_get_attr_name(doc,attr);
2190 char *value = qs_get_attr_value(doc,attr);
2191 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2192 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2193 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2194 STRCASEEQ('p','P',"password",tmp_type) ||
2195 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2196 STRCASEEQ('r','R',"radio", tmp_type) ||
2197 STRCASEEQ('h','H',"hidden", tmp_type) ||
2198 STRCASEEQ('s','S',"submit", tmp_type) ||
2199 STRCASEEQ('r','R',"reset", tmp_type))) {
2200 attr_type = tmp_type;
2203 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2206 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2209 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2210 attr_istyle = value;
2212 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2213 attr_max_length = value;
2215 else if (STRCASEEQ('c','C',"checked", name)) {
2216 attr_checked = value;
2218 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2219 attr_accesskey = value;
2221 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2224 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2229 if (IS_CSS_ON(xhtml->entryp)) {
2230 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2232 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2233 css_property_t *cur;
2234 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2235 if (strcasestr(cur->value, "<ja:n>")) {
2238 else if (strcasestr(cur->value, "<ja:en>")) {
2241 else if (strcasestr(cur->value, "<ja:hk>")) {
2244 else if (strcasestr(cur->value, "<ja:h>")) {
2252 attr_type = qs_trim_string(doc->buf.pool, attr_type);
2253 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
2254 STRCASEEQ('p','P',"password",attr_type) ||
2255 STRCASEEQ('c','C',"checkbox",attr_type) ||
2256 STRCASEEQ('r','R',"radio", attr_type) ||
2257 STRCASEEQ('h','H',"hidden", attr_type) ||
2258 STRCASEEQ('s','S',"submit", attr_type) ||
2259 STRCASEEQ('r','R',"reset", attr_type))) {
2265 if (attr_size && *attr_size) {
2270 if (attr_name && *attr_name) {
2275 if (attr_value && *attr_value) {
2277 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2280 if (attr_accesskey && *attr_accesskey) {
2281 W_L(" accesskey=\"");
2282 W_V(attr_accesskey);
2285 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2290 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2291 W_L(" istyle=\"4\"");
2293 if (attr_max_length && *attr_max_length) {
2294 if (chxj_chk_numeric(attr_max_length) == 0) {
2295 W_L(" maxlength=\"");
2296 W_V(attr_max_length);
2300 /*--------------------------------------------------------------------------*/
2301 /* The figure is default for the password. */
2302 /*--------------------------------------------------------------------------*/
2303 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
2304 if (attr_max_length) {
2306 W_V(attr_max_length);
2310 W_L(" FORMAT=\"*N\"");
2314 W_L(" checked=\"checked\"");
2319 /*--------------------------------------------------------------------------*/
2320 /* Get Attributes */
2321 /*--------------------------------------------------------------------------*/
2322 type = qs_get_type_attr(doc, node, doc->buf.pool);
2323 name = qs_get_name_attr(doc, node, doc->buf.pool);
2324 value = qs_get_value_attr(doc,node, doc->buf.pool);
2325 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2326 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2327 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
2328 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2329 size = qs_get_size_attr(doc, node, doc->buf.pool);
2332 type = qs_trim_string(doc->buf.pool, type);
2333 if (type && (STRCASEEQ('t','T',"text", type) ||
2334 STRCASEEQ('p','P',"password",type) ||
2335 STRCASEEQ('c','C',"checkbox",type) ||
2336 STRCASEEQ('r','R',"radio", type) ||
2337 STRCASEEQ('h','H',"hidden", type) ||
2338 STRCASEEQ('s','S',"submit", type) ||
2339 STRCASEEQ('r','R',"reset", type))) {
2345 if (size && *size) {
2350 if (name && *name) {
2355 if (value && *value) {
2356 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2357 apr_size_t value_len = strlen(value);
2358 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
2362 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2365 if (accesskey && *accesskey) {
2366 W_L(" accesskey=\"");
2370 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2371 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
2372 if (max_length && *max_length) {
2374 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
2375 if (max_length[ii] < '0' || max_length[ii] > '9') {
2376 max_length = apr_psprintf(r->pool, "0");
2381 if (strcmp(max_length, "0")) {
2382 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
2394 if (max_length && *max_length) {
2395 if (chxj_chk_numeric(max_length) != 0) {
2396 max_length = apr_psprintf(r->pool, "0");
2398 if (strcmp(max_length, "0")) {
2399 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
2404 /*--------------------------------------------------------------------------*/
2405 /* The figure is default for the password. */
2406 /*--------------------------------------------------------------------------*/
2407 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
2414 W_L(" FORMAT=\"*N\"");
2418 W_L(" checked=\"checked\"");
2428 * It is a handler who processes the INPUT tag.
2430 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2431 * destination is specified.
2432 * @param node [i] The INPUT tag node is specified.
2433 * @return The conversion result is returned.
2436 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
2438 xhtml_t *xhtml = GET_XHTML(pdoc);
2445 * It is a handler who processes the CENTER tag.
2447 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2448 * destination is specified.
2449 * @param node [i] The CENTER tag node is specified.
2450 * @return The conversion result is returned.
2453 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2458 char *attr_style = NULL;
2459 char *attr_color = NULL;
2460 char *attr_size = NULL;
2462 xhtml = GET_XHTML(pdoc);
2465 for (attr = qs_get_attr(doc,node);
2467 attr = qs_get_next_attr(doc,attr)) {
2468 char *name = qs_get_attr_name(doc,attr);
2469 char *value = qs_get_attr_value(doc,attr);
2470 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2474 if (IS_CSS_ON(xhtml->entryp)) {
2475 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2477 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2478 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2479 css_property_t *cur;
2480 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2481 if (cur->value && *cur->value) {
2482 attr_color = apr_pstrdup(doc->pool, cur->value);
2485 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2486 if (cur->value && *cur->value) {
2487 attr_size = apr_pstrdup(doc->pool, cur->value);
2494 if (attr_size || attr_color) {
2502 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2516 * It is a handler who processes the CENTER tag.
2518 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2519 * destination is specified.
2520 * @param node [i] The CENTER tag node is specified.
2521 * @return The conversion result is returned.
2524 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2526 xhtml_t *xhtml = GET_XHTML(pdoc);
2527 Doc *doc = xhtml->doc;
2530 if (IS_CSS_ON(xhtml->entryp)) {
2531 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2538 * It is a handler who processes the HR tag.
2540 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2541 * destination is specified.
2542 * @param node [i] The HR tag node is specified.
2543 * @return The conversion result is returned.
2546 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2552 char *attr_align = NULL;
2553 char *attr_size = NULL;
2554 char *attr_width = NULL;
2555 char *attr_noshade = NULL;
2556 char *attr_style = NULL;
2557 char *attr_color = NULL;
2559 xhtml = GET_XHTML(pdoc);
2563 for (attr = qs_get_attr(doc,node);
2565 attr = qs_get_next_attr(doc,attr)) {
2566 char *name = qs_get_attr_name (doc,attr);
2567 char *value = qs_get_attr_value(doc,attr);
2571 if (strcasecmp(name, "align") == 0) {
2572 /*--------------------------------------------------------------------*/
2574 /*--------------------------------------------------------------------*/
2575 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2583 if (strcasecmp(name, "size") == 0) {
2584 /*--------------------------------------------------------------------*/
2586 /*--------------------------------------------------------------------*/
2587 if (value && *value) {
2591 else if (strcasecmp(name, "style") == 0) {
2592 if (value && *value) {
2600 if (strcasecmp(name, "width") == 0) {
2601 /*--------------------------------------------------------------------*/
2603 /*--------------------------------------------------------------------*/
2604 if (value && *value) {
2612 if (strcasecmp(name, "noshade") == 0) {
2613 /*--------------------------------------------------------------------*/
2615 /*--------------------------------------------------------------------*/
2616 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2622 if (strcasecmp(name, "color") == 0 && value && *value) {
2623 /*--------------------------------------------------------------------*/
2625 /*--------------------------------------------------------------------*/
2634 if (IS_CSS_ON(xhtml->entryp)) {
2635 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2637 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2638 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2639 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2641 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2642 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2645 css_property_t *cur;
2646 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2647 if (STRCASEEQ('s','S',"solid",cur->value)) {
2648 attr_noshade = "noshade";
2651 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2652 char *tmp = apr_pstrdup(doc->pool, cur->value);
2653 char *tmpp = strstr(tmp, "px");
2655 size_t len = strlen(tmp) - strlen(tmpp);
2656 attr_size = apr_pstrndup(doc->pool, tmp,len);
2659 char *tmp2 = strstr(tmp,"%");
2661 attr_size = apr_pstrdup(doc->pool, tmp);
2665 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2666 char *tmp = apr_pstrdup(doc->pool, cur->value);
2667 char *tmpp = strstr(tmp, "px");
2669 attr_width = apr_pstrdup(doc->pool, tmp);
2672 tmpp = strstr(tmp, "%");
2674 attr_width = apr_pstrdup(doc->pool, tmp);
2679 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2680 char *tmp = apr_pstrdup(doc->pool, cur->value);
2681 char *tmpp = strstr(tmp,"none");
2683 attr_align = "center";
2687 attr_align = apr_pstrdup(doc->pool, tmp);
2693 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2694 char *tmp = apr_pstrdup(doc->pool, cur->value);
2696 attr_color = apr_pstrdup(doc->pool, tmp);
2716 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2744 * It is a handler who processes the HR tag.
2746 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2747 * destination is specified.
2748 * @param node [i] The HR tag node is specified.
2749 * @return The conversion result is returned.
2752 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2754 xhtml_t *xhtml = GET_XHTML(pdoc);
2761 * It is a handler who processes the PRE tag.
2763 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2764 * destination is specified.
2765 * @param node [i] The PRE tag node is specified.
2766 * @return The conversion result is returned.
2769 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2771 xhtml_t *xhtml = GET_XHTML(pdoc);
2772 Doc *doc = xhtml->doc;
2774 char *attr_style = NULL;
2776 for (attr = qs_get_attr(doc,node);
2778 attr = qs_get_next_attr(doc,attr)) {
2779 char *nm = qs_get_attr_name(doc,attr);
2780 char *val = qs_get_attr_value(doc,attr);
2781 if (val && STRCASEEQ('s','S',"style", nm)) {
2786 if (IS_CSS_ON(xhtml->entryp)) {
2787 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2797 * It is a handler who processes the PRE tag.
2799 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2800 * destination is specified.
2801 * @param node [i] The PRE tag node is specified.
2802 * @return The conversion result is returned.
2805 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2807 xhtml_t *xhtml = GET_XHTML(pdoc);
2808 Doc *doc = xhtml->doc;
2812 if (IS_CSS_ON(xhtml->entryp)) {
2813 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2821 * It is a handler who processes the P tag.
2823 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2824 * destination is specified.
2825 * @param node [i] The P tag node is specified.
2826 * @return The conversion result is returned.
2829 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2831 xhtml_t *xhtml = GET_XHTML(pdoc);
2832 Doc *doc = xhtml->doc;
2834 char *attr_align = NULL;
2835 char *attr_style = NULL;
2836 char *attr_color = NULL;
2837 char *attr_blink = NULL;
2838 char *css_clear = NULL;
2840 for (attr = qs_get_attr(doc,node);
2842 attr = qs_get_next_attr(doc,attr)) {
2843 char *nm = qs_get_attr_name(doc,attr);
2844 char *val = qs_get_attr_value(doc,attr);
2845 if (STRCASEEQ('a','A',"align", nm)) {
2846 /*----------------------------------------------------------------------*/
2847 /* CHTML 1.0 (W3C version 3.2) */
2848 /*----------------------------------------------------------------------*/
2849 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2850 attr_align = apr_pstrdup(doc->buf.pool, val);
2854 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2855 attr_style = apr_pstrdup(doc->buf.pool, val);
2858 if (IS_CSS_ON(xhtml->entryp)) {
2859 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2861 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2862 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2863 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2864 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2865 css_property_t *cur;
2866 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2867 if (STRCASEEQ('l','L',"left",cur->value)) {
2868 attr_align = apr_pstrdup(doc->pool, "left");
2870 else if (STRCASEEQ('c','C',"center",cur->value)) {
2871 attr_align = apr_pstrdup(doc->pool, "center");
2873 else if (STRCASEEQ('r','R',"right",cur->value)) {
2874 attr_align = apr_pstrdup(doc->pool, "right");
2877 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2878 if (cur->value && *cur->value) {
2879 attr_color = apr_pstrdup(doc->pool, cur->value);
2882 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2883 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2884 attr_blink = apr_pstrdup(doc->pool, cur->value);
2887 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2888 css_clear = apr_pstrdup(doc->pool, cur->value);
2893 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2901 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2907 W_L("text-decoration:");
2924 * It is a handler who processes the P tag.
2926 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2927 * destination is specified.
2928 * @param node [i] The P tag node is specified.
2929 * @return The conversion result is returned.
2932 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
2934 xhtml_t *xhtml = GET_XHTML(pdoc);
2935 Doc *doc = xhtml->doc;
2938 if (IS_CSS_ON(xhtml->entryp)) {
2939 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2946 * It is a handler who processes the UL tag.
2948 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2949 * destination is specified.
2950 * @param node [i] The UL tag node is specified.
2951 * @return The conversion result is returned.
2954 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
2956 xhtml_t *xhtml = GET_XHTML(pdoc);
2957 Doc *doc = xhtml->doc;
2959 char *attr_type = NULL;
2960 char *attr_style = NULL;
2961 /*--------------------------------------------------------------------------*/
2962 /* Get Attributes */
2963 /*--------------------------------------------------------------------------*/
2964 for (attr = qs_get_attr(doc,node);
2966 attr = qs_get_next_attr(doc,attr)) {
2967 char *name = qs_get_attr_name(doc,attr);
2968 char *value = qs_get_attr_value(doc,attr);
2969 if (STRCASEEQ('t','T',"type",name)) {
2970 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2974 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2978 if (IS_CSS_ON(xhtml->entryp)) {
2979 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2981 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2982 css_property_t *cur;
2983 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2984 if (STRCASEEQ('d','D',"disc",cur->value)) {
2985 attr_type = apr_pstrdup(doc->pool, "disc");
2987 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2988 attr_type = apr_pstrdup(doc->pool, "circle");
2990 else if (STRCASEEQ('s','S',"square",cur->value)) {
2991 attr_type = apr_pstrdup(doc->pool, "square");
2999 W_L("list-style-type:");
3010 * It is a handler who processes the UL tag.
3012 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3013 * destination is specified.
3014 * @param node [i] The UL tag node is specified.
3015 * @return The conversion result is returned.
3018 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
3020 xhtml_t *xhtml = GET_XHTML(pdoc);
3021 Doc *doc = xhtml->doc;
3024 if (IS_CSS_ON(xhtml->entryp)) {
3025 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3032 * It is a handler who processes the H1 tag.
3034 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3035 * destination is specified.
3036 * @param node [i] The H1 tag node is specified.
3037 * @return The conversion result is returned.
3040 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
3042 xhtml_t *xhtml = GET_XHTML(pdoc);
3043 Doc *doc = xhtml->doc;
3045 char *attr_style = NULL;
3046 char *attr_align = NULL;
3047 char *css_clear = NULL;
3049 for (attr = qs_get_attr(doc,node);
3051 attr = qs_get_next_attr(doc,attr)) {
3052 char *name = qs_get_attr_name(doc,attr);
3053 char *value = qs_get_attr_value(doc,attr);
3054 if (STRCASEEQ('a','A',"align", name)) {
3055 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3059 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3063 if (IS_CSS_ON(xhtml->entryp)) {
3064 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3066 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3067 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3068 css_property_t *cur;
3069 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3070 if (STRCASEEQ('l','L',"left", cur->value)) {
3071 attr_align = apr_pstrdup(doc->pool, "left");
3073 else if (STRCASEEQ('c','C',"center",cur->value)) {
3074 attr_align = apr_pstrdup(doc->pool, "center");
3076 else if (STRCASEEQ('r','R',"right",cur->value)) {
3077 attr_align = apr_pstrdup(doc->pool, "right");
3080 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3081 if (STRCASEEQ('b','B',"both", cur->value)) {
3082 css_clear = apr_pstrdup(doc->pool, "both");
3084 else if (STRCASEEQ('r','R',"right", cur->value)) {
3085 css_clear = apr_pstrdup(doc->pool, "right");
3087 else if (STRCASEEQ('l','L',"left", cur->value)) {
3088 css_clear = apr_pstrdup(doc->pool, "left");
3094 if (attr_align || css_clear ) {
3115 * It is a handler who processes the H1 tag.
3117 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3118 * destination is specified.
3119 * @param node [i] The H1 tag node is specified.
3120 * @return The conversion result is returned.
3123 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
3125 xhtml_t *xhtml = GET_XHTML(pdoc);
3126 Doc *doc = xhtml->doc;
3129 if (IS_CSS_ON(xhtml->entryp)) {
3130 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3137 * It is a handler who processes the H2 tag.
3139 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3140 * destination is specified.
3141 * @param node [i] The H2 tag node is specified.
3142 * @return The conversion result is returned.
3145 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
3147 xhtml_t *xhtml = GET_XHTML(pdoc);
3148 Doc *doc = xhtml->doc;
3150 char *attr_style = NULL;
3151 char *attr_align = NULL;
3152 char *css_clear = NULL;
3154 for (attr = qs_get_attr(doc,node);
3156 attr = qs_get_next_attr(doc,attr)) {
3157 char *name = qs_get_attr_name(doc,attr);
3158 char *value = qs_get_attr_value(doc,attr);
3159 if (STRCASEEQ('a','A',"align", name)) {
3160 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3164 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3168 if (IS_CSS_ON(xhtml->entryp)) {
3169 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3171 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3172 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3173 css_property_t *cur;
3174 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3175 if (STRCASEEQ('l','L',"left", cur->value)) {
3176 attr_align = apr_pstrdup(doc->pool, "left");
3178 else if (STRCASEEQ('c','C',"center",cur->value)) {
3179 attr_align = apr_pstrdup(doc->pool, "center");
3181 else if (STRCASEEQ('r','R',"right",cur->value)) {
3182 attr_align = apr_pstrdup(doc->pool, "right");
3185 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3186 if (STRCASEEQ('b','B',"both", cur->value)) {
3187 css_clear = apr_pstrdup(doc->pool, "both");
3189 else if (STRCASEEQ('r','R',"right", cur->value)) {
3190 css_clear = apr_pstrdup(doc->pool, "right");
3192 else if (STRCASEEQ('l','L',"left", cur->value)) {
3193 css_clear = apr_pstrdup(doc->pool, "left");
3199 if (attr_align || css_clear ) {
3220 * It is a handler who processes the H2 tag.
3222 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3223 * destination is specified.
3224 * @param node [i] The H2 tag node is specified.
3225 * @return The conversion result is returned.
3228 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
3230 xhtml_t *xhtml = GET_XHTML(pdoc);
3231 Doc *doc = xhtml->doc;
3234 if (IS_CSS_ON(xhtml->entryp)) {
3235 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3242 * It is a handler who processes the H3 tag.
3244 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3245 * destination is specified.
3246 * @param node [i] The H3 tag node is specified.
3247 * @return The conversion result is returned.
3250 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
3252 xhtml_t *xhtml = GET_XHTML(pdoc);
3253 Doc *doc = xhtml->doc;
3255 char *attr_style = NULL;
3256 char *attr_align = NULL;
3257 char *css_clear = NULL;
3259 for (attr = qs_get_attr(doc,node);
3261 attr = qs_get_next_attr(doc,attr)) {
3262 char *name = qs_get_attr_name(doc,attr);
3263 char *value = qs_get_attr_value(doc,attr);
3264 if (STRCASEEQ('a','A',"align", name)) {
3265 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3269 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3273 if (IS_CSS_ON(xhtml->entryp)) {
3274 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3276 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3277 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3278 css_property_t *cur;
3279 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3280 if (STRCASEEQ('l','L',"left", cur->value)) {
3281 attr_align = apr_pstrdup(doc->pool, "left");
3283 else if (STRCASEEQ('c','C',"center",cur->value)) {
3284 attr_align = apr_pstrdup(doc->pool, "center");
3286 else if (STRCASEEQ('r','R',"right",cur->value)) {
3287 attr_align = apr_pstrdup(doc->pool, "right");
3290 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3291 if (STRCASEEQ('b','B',"both", cur->value)) {
3292 css_clear = apr_pstrdup(doc->pool, "both");
3294 else if (STRCASEEQ('r','R',"right", cur->value)) {
3295 css_clear = apr_pstrdup(doc->pool, "right");
3297 else if (STRCASEEQ('l','L',"left", cur->value)) {
3298 css_clear = apr_pstrdup(doc->pool, "left");
3304 if (attr_align || css_clear ) {
3325 * It is a handler who processes the H3 tag.
3327 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3328 * destination is specified.
3329 * @param node [i] The H3 tag node is specified.
3330 * @return The conversion result is returned.
3333 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
3335 xhtml_t *xhtml = GET_XHTML(pdoc);
3336 Doc *doc = xhtml->doc;
3339 if (IS_CSS_ON(xhtml->entryp)) {
3340 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3348 * It is a handler who processes the H4 tag.
3350 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3351 * destination is specified.
3352 * @param node [i] The H4 tag node is specified.
3353 * @return The conversion result is returned.
3356 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
3358 xhtml_t *xhtml = GET_XHTML(pdoc);
3359 Doc *doc = xhtml->doc;
3361 char *attr_style = NULL;
3362 char *attr_align = NULL;
3363 char *css_clear = NULL;
3365 for (attr = qs_get_attr(doc,node);
3367 attr = qs_get_next_attr(doc,attr)) {
3368 char *name = qs_get_attr_name(doc,attr);
3369 char *value = qs_get_attr_value(doc,attr);
3370 if (STRCASEEQ('a','A',"align", name)) {
3371 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3375 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3379 if (IS_CSS_ON(xhtml->entryp)) {
3380 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3382 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3383 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3384 css_property_t *cur;
3385 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3386 if (STRCASEEQ('l','L',"left", cur->value)) {
3387 attr_align = apr_pstrdup(doc->pool, "left");
3389 else if (STRCASEEQ('c','C',"center",cur->value)) {
3390 attr_align = apr_pstrdup(doc->pool, "center");
3392 else if (STRCASEEQ('r','R',"right",cur->value)) {
3393 attr_align = apr_pstrdup(doc->pool, "right");
3396 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3397 if (STRCASEEQ('b','B',"both", cur->value)) {
3398 css_clear = apr_pstrdup(doc->pool, "both");
3400 else if (STRCASEEQ('r','R',"right", cur->value)) {
3401 css_clear = apr_pstrdup(doc->pool, "right");
3403 else if (STRCASEEQ('l','L',"left", cur->value)) {
3404 css_clear = apr_pstrdup(doc->pool, "left");
3410 if (attr_align || css_clear ) {
3431 * It is a handler who processes the H4 tag.
3433 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3434 * destination is specified.
3435 * @param node [i] The H4 tag node is specified.
3436 * @return The conversion result is returned.
3439 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
3441 xhtml_t *xhtml = GET_XHTML(pdoc);
3442 Doc *doc = xhtml->doc;
3445 if (IS_CSS_ON(xhtml->entryp)) {
3446 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3454 * It is a handler who processes the H5 tag.
3456 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3457 * destination is specified.
3458 * @param node [i] The H5 tag node is specified.
3459 * @return The conversion result is returned.
3462 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
3464 xhtml_t *xhtml = GET_XHTML(pdoc);
3465 Doc *doc = xhtml->doc;
3467 char *attr_style = NULL;
3468 char *attr_align = NULL;
3469 char *css_clear = NULL;
3471 for (attr = qs_get_attr(doc,node);
3473 attr = qs_get_next_attr(doc,attr)) {
3474 char *name = qs_get_attr_name(doc,attr);
3475 char *value = qs_get_attr_value(doc,attr);
3476 if (STRCASEEQ('a','A',"align", name)) {
3477 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3481 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3485 if (IS_CSS_ON(xhtml->entryp)) {
3486 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3488 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3489 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3490 css_property_t *cur;
3491 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3492 if (STRCASEEQ('l','L',"left", cur->value)) {
3493 attr_align = apr_pstrdup(doc->pool, "left");
3495 else if (STRCASEEQ('c','C',"center",cur->value)) {
3496 attr_align = apr_pstrdup(doc->pool, "center");
3498 else if (STRCASEEQ('r','R',"right",cur->value)) {
3499 attr_align = apr_pstrdup(doc->pool, "right");
3502 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3503 if (STRCASEEQ('b','B',"both", cur->value)) {
3504 css_clear = apr_pstrdup(doc->pool, "both");
3506 else if (STRCASEEQ('r','R',"right", cur->value)) {
3507 css_clear = apr_pstrdup(doc->pool, "right");
3509 else if (STRCASEEQ('l','L',"left", cur->value)) {
3510 css_clear = apr_pstrdup(doc->pool, "left");
3516 if (attr_align || css_clear ) {
3537 * It is a handler who processes the H5 tag.
3539 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3540 * destination is specified.
3541 * @param node [i] The H5 tag node is specified.
3542 * @return The conversion result is returned.
3545 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
3547 xhtml_t *xhtml = GET_XHTML(pdoc);
3548 Doc *doc = xhtml->doc;
3551 if (IS_CSS_ON(xhtml->entryp)) {
3552 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3560 * It is a handler who processes the H6 tag.
3562 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3563 * destination is specified.
3564 * @param node [i] The H6 tag node is specified.
3565 * @return The conversion result is returned.
3568 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
3570 xhtml_t *xhtml = GET_XHTML(pdoc);
3571 Doc *doc = xhtml->doc;
3573 char *attr_style = NULL;
3574 char *attr_align = NULL;
3575 char *css_clear = NULL;
3577 for (attr = qs_get_attr(doc,node);
3579 attr = qs_get_next_attr(doc,attr)) {
3580 char *name = qs_get_attr_name(doc,attr);
3581 char *value = qs_get_attr_value(doc,attr);
3582 if (STRCASEEQ('a','A',"align", name)) {
3583 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3587 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3591 if (IS_CSS_ON(xhtml->entryp)) {
3592 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3594 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3595 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3596 css_property_t *cur;
3597 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3598 if (STRCASEEQ('l','L',"left", cur->value)) {
3599 attr_align = apr_pstrdup(doc->pool, "left");
3601 else if (STRCASEEQ('c','C',"center",cur->value)) {
3602 attr_align = apr_pstrdup(doc->pool, "center");
3604 else if (STRCASEEQ('r','R',"right",cur->value)) {
3605 attr_align = apr_pstrdup(doc->pool, "right");
3608 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3609 if (STRCASEEQ('b','B',"both", cur->value)) {
3610 css_clear = apr_pstrdup(doc->pool, "both");
3612 else if (STRCASEEQ('r','R',"right", cur->value)) {
3613 css_clear = apr_pstrdup(doc->pool, "right");
3615 else if (STRCASEEQ('l','L',"left", cur->value)) {
3616 css_clear = apr_pstrdup(doc->pool, "left");
3622 if (attr_align || css_clear ) {
3643 * It is a handler who processes the H6 tag.
3645 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3646 * destination is specified.
3647 * @param node [i] The H6 tag node is specified.
3648 * @return The conversion result is returned.
3651 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3653 xhtml_t *xhtml = GET_XHTML(pdoc);
3654 Doc *doc = xhtml->doc;
3657 if (IS_CSS_ON(xhtml->entryp)) {
3658 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3666 * It is a handler who processes the OL tag.
3668 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3669 * destination is specified.
3670 * @param node [i] The OL tag node is specified.
3671 * @return The conversion result is returned.
3674 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3676 xhtml_t *xhtml = GET_XHTML(pdoc);
3677 Doc *doc = xhtml->doc;
3679 char *attr_style = NULL;
3680 char *attr_start = NULL;
3681 char *attr_type = NULL;
3683 /*--------------------------------------------------------------------------*/
3684 /* Get Attributes */
3685 /*--------------------------------------------------------------------------*/
3686 for (attr = qs_get_attr(doc,node);
3688 attr = qs_get_next_attr(doc,attr)) {
3689 char *name = qs_get_attr_name(doc,attr);
3690 char *value = qs_get_attr_value(doc,attr);
3691 if (STRCASEEQ('t','T',"type",name) && value) {
3692 if (*value == '1') {
3693 attr_type = apr_pstrdup(doc->pool, "decimal");
3695 else if (*value == 'a') {
3696 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3698 else if (*value == 'A') {
3699 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3702 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3705 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3709 if (IS_CSS_ON(xhtml->entryp)) {
3710 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3712 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3713 css_property_t *cur;
3714 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3715 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3716 attr_type = apr_pstrdup(doc->pool, "decimal");
3718 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3719 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3721 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3722 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3730 W_L("list-style-type:");
3747 * It is a handler who processes the OL tag.
3749 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3750 * destination is specified.
3751 * @param node [i] The OL tag node is specified.
3752 * @return The conversion result is returned.
3755 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3757 xhtml_t *xhtml = GET_XHTML(pdoc);
3758 Doc *doc = xhtml->doc;
3761 if (IS_CSS_ON(xhtml->entryp)) {
3762 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3770 * It is a handler who processes the LI tag.
3772 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3773 * destination is specified.
3774 * @param node [i] The LI tag node is specified.
3775 * @return The conversion result is returned.
3778 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3780 xhtml_t *xhtml = GET_XHTML(pdoc);
3781 Doc *doc = xhtml->doc;
3783 char *attr_type = NULL;
3784 char *attr_value = NULL;
3785 char *attr_style = NULL;
3787 for (attr = qs_get_attr(doc,node);
3789 attr = qs_get_next_attr(doc,attr)) {
3790 char *name = qs_get_attr_name(doc,attr);
3791 char *value = qs_get_attr_value(doc,attr);
3792 if (STRCASEEQ('t','T',"type",name)) {
3793 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3794 if (*value == '1') {
3795 attr_type = apr_pstrdup(doc->pool, "decimal");
3797 else if (*value == 'a') {
3798 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3800 else if (*value == 'A') {
3801 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3808 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3811 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3815 if (IS_CSS_ON(xhtml->entryp)) {
3816 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3818 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3819 css_property_t *cur;
3820 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3821 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3822 attr_type = apr_pstrdup(doc->pool, "decimal");
3824 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3825 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3827 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3828 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3830 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3831 attr_type = apr_pstrdup(doc->pool, "disc");
3833 else if (STRCASEEQ('s','S',"square", cur->value)) {
3834 attr_type = apr_pstrdup(doc->pool, "square");
3836 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3837 attr_type = apr_pstrdup(doc->pool, "circle");
3847 W_L("list-style-type:");
3863 ** It is a handler who processes the LI tag.
3865 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3866 * destination is specified.
3867 * @param node [i] The LI tag node is specified.
3868 * @return The conversion result is returned.
3871 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
3873 xhtml_t *xhtml = GET_XHTML(pdoc);
3874 Doc *doc = xhtml->doc;
3877 if (IS_CSS_ON(xhtml->entryp)) {
3878 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3884 * It is a handler who processes the IMG tag.
3886 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3887 * destination is specified.
3888 * @param node [i] The IMG tag node is specified.
3889 * @return The conversion result is returned.
3892 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
3894 xhtml_t *xhtml = GET_XHTML(pdoc);
3895 Doc *doc = xhtml->doc;
3896 request_rec *r = doc->r;
3898 char *attr_src = NULL;
3899 char *attr_alt = NULL;
3900 char *attr_height = NULL;
3901 char *attr_width = NULL;
3902 char *attr_align = NULL;
3903 char *attr_style = NULL;
3904 char *attr_hspace = NULL;
3905 char *attr_vspace = NULL;
3907 char *css_margin_left = NULL;
3908 char *css_margin_right = NULL;
3909 char *css_margin_top = NULL;
3910 char *css_margin_bottom = NULL;
3911 char *css_display = NULL;
3912 char *css_valign = NULL;
3915 #ifndef IMG_NOT_CONVERT_FILENAME
3916 device_table *spec = xhtml->spec;
3919 /*--------------------------------------------------------------------------*/
3920 /* Get Attributes */
3921 /*--------------------------------------------------------------------------*/
3922 for (attr = qs_get_attr(doc,node);
3924 attr = qs_get_next_attr(doc,attr)) {
3925 char *name = qs_get_attr_name(doc,attr);
3926 char *value = qs_get_attr_value(doc,attr);
3928 if (STRCASEEQ('s','S',"src",name)) {
3929 value = chxj_encoding_parameter(r, value, 1);
3930 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
3931 value = chxj_add_cookie_no_update_parameter(r, value);
3932 #ifdef IMG_NOT_CONVERT_FILENAME
3938 attr_src = chxj_img_conv(r,spec,value);
3944 if (STRCASEEQ('a','A',"align",name)) {
3946 if (STRCASEEQ('t','T',"top", value) ||
3947 STRCASEEQ('m','M',"middle",value) ||
3948 STRCASEEQ('b','B',"bottom",value)) {
3951 else if( STRCASEEQ('l','L',"left", value) ||
3952 STRCASEEQ('r','R',"right", value)) {
3955 else if (STRCASEEQ('c','C',"center", value)) {
3956 css_valign = apr_pstrdup(doc->pool, "middle");
3960 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3963 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3966 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3967 attr_height = value;
3969 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3970 attr_hspace = value;
3972 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3973 attr_vspace = value;
3975 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3980 if (IS_CSS_ON(xhtml->entryp)) {
3981 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3983 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3984 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3985 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3986 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3987 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3988 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3989 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3991 css_property_t *cur;
3992 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3993 attr_height = apr_pstrdup(doc->pool, cur->value);
3995 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3996 attr_width = apr_pstrdup(doc->pool, cur->value);
3999 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
4000 css_valign = apr_pstrdup(doc->pool, cur->value);
4004 if (! attr_hspace) {
4005 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
4006 css_margin_left = apr_pstrdup(doc->pool, cur->value);
4008 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
4009 css_margin_right = apr_pstrdup(doc->pool, cur->value);
4013 if (! attr_vspace) {
4014 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
4015 css_margin_top = apr_pstrdup(doc->pool, cur->value);
4017 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
4018 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
4022 // float:[left|right] -> align
4024 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
4025 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
4026 attr_align = apr_pstrdup(doc->pool, cur->value);
4029 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4030 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4031 char *tmp = apr_pstrdup(doc->pool, cur->value);
4032 char *tmpp = strstr(tmp, "none");
4034 css_display = apr_pstrdup(doc->pool, tmp);
4061 if (attr_hspace || attr_vspace || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
4064 W_L("vertical-align:");
4069 W_L("margin-left:");
4072 W_L("margin-right:");
4077 if(css_margin_left){
4078 W_L("margin-left:");
4079 W_V(css_margin_left);
4082 if(css_margin_right){
4083 W_L("margin-right:");
4084 W_V(css_margin_right);
4092 W_L("margin-bottom:");
4099 W_V(css_margin_top);
4102 if(css_margin_bottom){
4103 W_L("margin-bottom:");
4104 W_V(css_margin_bottom);
4109 W_L("display:none;");
4127 * It is a handler who processes the IMG tag.
4129 * @param xhtml [i/o] The pointer to the XHTML structure at the output
4130 * destination is specified.
4131 * @param node [i] The IMG tag node is specified.
4132 * @return The conversion result is returned.
4135 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
4137 xhtml_t *xhtml = GET_XHTML(pdoc);
4144 * It is a handler who processes the SELECT tag.
4146 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4147 * destination is specified.
4148 * @param node [i] The SELECT tag node is specified.
4149 * @return The conversion result is returned.
4152 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
4154 xhtml_t *xhtml = GET_XHTML(pdoc);
4155 Doc *doc = xhtml->doc;
4158 char *multiple = NULL;
4160 char *attr_style = NULL;
4163 for (attr = qs_get_attr(doc,node);
4165 attr = qs_get_next_attr(doc,attr)) {
4166 char *nm = qs_get_attr_name(doc,attr);
4167 char *val = qs_get_attr_value(doc,attr);
4168 if (STRCASEEQ('s','S',"size",nm)) {
4169 /*----------------------------------------------------------------------*/
4170 /* CHTML 1.0 version 2.0 */
4171 /*----------------------------------------------------------------------*/
4172 size = apr_pstrdup(doc->buf.pool, val);
4174 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4175 /*----------------------------------------------------------------------*/
4176 /* CHTML 1.0 version 2.0 */
4177 /*----------------------------------------------------------------------*/
4178 attr_style = apr_pstrdup(doc->buf.pool, val);
4180 else if (STRCASEEQ('n','N',"name",nm)) {
4181 /*----------------------------------------------------------------------*/
4182 /* CHTML 1.0 version 2.0 */
4183 /*----------------------------------------------------------------------*/
4184 name = apr_pstrdup(doc->buf.pool, val);
4186 else if (STRCASEEQ('m','M',"multiple",nm)) {
4187 /*----------------------------------------------------------------------*/
4188 /* CHTML 1.0 version 2.0 */
4189 /*----------------------------------------------------------------------*/
4190 multiple = apr_pstrdup(doc->buf.pool, val);
4193 if (size && *size) {
4198 if (name && *name) {
4204 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
4205 W_L(" multiple=\"true\"");
4208 if (IS_CSS_ON(xhtml->entryp)) {
4209 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4217 * It is a handler who processes the SELECT tag.
4219 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4220 * destination is specified.
4221 * @param node [i] The SELECT tag node is specified.
4222 * @return The conversion result is returned.
4225 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
4227 xhtml_t *xhtml = GET_XHTML(pdoc);
4228 Doc *doc = xhtml->doc;
4231 if (IS_CSS_ON(xhtml->entryp)) {
4232 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4239 * It is a handler who processes the OPTION tag.
4241 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4242 * destination is specified.
4243 * @param node [i] The OPTION tag node is specified.
4244 * @return The conversion result is returned.
4247 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
4249 xhtml_t *xhtml = GET_XHTML(pdoc);
4250 Doc *doc = xhtml->doc;
4252 char *attr_style = NULL;
4254 char *selected = NULL;
4258 for (attr = qs_get_attr(doc,node);
4260 attr = qs_get_next_attr(doc,attr)) {
4261 char *nm = qs_get_attr_name(doc,attr);
4262 char *val = qs_get_attr_value(doc,attr);
4263 if (STRCASEEQ('s','S',"selected",nm)) {
4264 /* CHTML version 2.0 */
4265 selected = apr_pstrdup(doc->buf.pool, val);
4267 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4268 /* CHTML version 2.0 */
4269 attr_style = apr_pstrdup(doc->buf.pool, val);
4271 else if (STRCASEEQ('v','V',"value",nm)) {
4272 /* CHTML version 2.0 */
4273 value = apr_pstrdup(doc->buf.pool, val);
4282 W_L(" selected=\"selected\"");
4285 if (IS_CSS_ON(xhtml->entryp)) {
4286 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4293 * It is a handler who processes the OPTION tag.
4295 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4296 * destination is specified.
4297 * @param node [i] The OPTION tag node is specified.
4298 * @return The conversion result is returned.
4301 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
4303 xhtml_t *xhtml = GET_XHTML(pdoc);
4304 Doc *doc = xhtml->doc;
4307 if (IS_CSS_ON(xhtml->entryp)) {
4308 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4316 * It is a handler who processes the DIV tag.
4318 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4319 * destination is specified.
4320 * @param node [i] The DIV tag node is specified.
4321 * @return The conversion result is returned.
4324 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
4326 xhtml_t *xhtml = GET_XHTML(pdoc);
4327 Doc *doc = xhtml->doc;
4329 char *attr_style = NULL;
4330 char *attr_align = NULL;
4331 char *attr_display = NULL;
4332 char *attr_decoration = NULL;
4333 char *attr_wap_marquee_style = NULL;
4334 char *attr_wap_marquee_dir = NULL;
4335 char *attr_wap_marquee_loop = NULL;
4336 char *attr_color = NULL;
4337 char *attr_bgcolor = NULL;
4338 char *attr_font_size = NULL;
4339 char *css_clear = NULL;
4341 for (attr = qs_get_attr(doc,node);
4343 attr = qs_get_next_attr(doc,attr)) {
4344 char *nm = qs_get_attr_name(doc,attr);
4345 char *val = qs_get_attr_value(doc,attr);
4346 if (STRCASEEQ('a','A',"align",nm)) {
4347 /*----------------------------------------------------------------------*/
4348 /* CHTML 1.0 (W3C version 3.2) */
4349 /*----------------------------------------------------------------------*/
4350 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4351 attr_align = apr_pstrdup(doc->buf.pool, val);
4354 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4355 attr_style = apr_pstrdup(doc->buf.pool, val);
4359 if (IS_CSS_ON(xhtml->entryp)) {
4360 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4362 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4363 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4364 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4365 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4366 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4367 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4368 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4369 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4371 css_property_t *cur;
4372 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4373 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4374 attr_display = apr_pstrdup(doc->pool, cur->value);
4377 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4378 if (STRCASEEQ('b','B',"blink", cur->value)) {
4379 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4382 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4383 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4384 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4386 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4387 char *ss = strchr(cur->value, '#');
4389 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4390 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4393 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4394 attr_color = apr_pstrdup(doc->pool, cur->value);
4396 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4397 attr_align = apr_pstrdup(doc->pool, cur->value);
4399 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4400 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4401 || STRCASEEQ('x','X',"x-small",cur->value)
4402 || STRCASEEQ('s','S',"small",cur->value)
4403 || STRCASEEQ('m','M',"medium",cur->value)
4404 || STRCASEEQ('l','L',"large",cur->value)
4405 || STRCASEEQ('x','X',"x-large",cur->value)
4406 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4407 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4411 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4412 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4413 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4414 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4415 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4416 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4419 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4420 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4421 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4423 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4424 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4427 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4428 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4429 attr_wap_marquee_loop = "infinite";
4432 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4436 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4437 css_clear = apr_pstrdup(doc->pool, cur->value);
4445 || attr_wap_marquee_style
4446 || attr_wap_marquee_dir
4447 || attr_wap_marquee_loop
4463 if (attr_decoration) {
4464 W_L("text-decoration:");
4465 W_V(attr_decoration);
4468 if (attr_wap_marquee_style) {
4469 W_L("-wap-marquee-style:");
4470 W_V(attr_wap_marquee_style);
4473 if (attr_wap_marquee_dir) {
4474 W_L("-wap-marquee-dir:");
4475 W_V(attr_wap_marquee_dir);
4478 if (attr_wap_marquee_loop) {
4479 W_L("-wap-marquee-loop:");
4480 W_V(attr_wap_marquee_loop);
4489 W_L("background-color:");
4493 if (attr_font_size) {
4495 W_V(attr_font_size);
4511 * It is a handler who processes the DIV tag.
4513 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4514 * destination is specified.
4515 * @param node [i] The DIV tag node is specified.
4516 * @return The conversion result is returned.
4519 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
4521 xhtml_t *xhtml = GET_XHTML(pdoc);
4522 Doc *doc = xhtml->doc;
4524 if (IS_CSS_ON(xhtml->entryp)) {
4525 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4532 * It is a handler who processes the B tag.
4534 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4535 * destination is specified.
4536 * @param node [i] The B tag node is specified.
4537 * @return The conversion result is returned.
4540 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
4542 xhtml_t *xhtml = GET_XHTML(pdoc);
4543 Doc *doc = xhtml->doc;
4545 W_L("<div style=\"font-weight:bold\">");
4551 * It is a handler who processes the B tag.
4553 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4554 * destination is specified.
4555 * @param node [i] The B tag node is specified.
4556 * @return The conversion result is returned.
4559 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
4561 xhtml_t *xhtml = GET_XHTML(pdoc);
4562 Doc *doc = xhtml->doc;
4570 * It is a handler who processes the CHXJ:IF tag.
4572 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4573 * destination is specified.
4574 * @param node [i] The CHXJ:IF tag node is specified.
4577 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
4579 xhtml_t *xhtml = GET_XHTML(pdoc);
4580 Doc *doc = xhtml->doc;
4583 for (child = qs_get_child_node(doc, node);
4585 child = qs_get_next_node(doc, child)) {
4587 s_xhtml_1_0_chxjif_tag(xhtml, child);
4595 * It is a handler who processes the TEXTARE tag.
4597 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4598 * destination is specified.
4599 * @param node [i] The TEXTAREA tag node is specified.
4600 * @return The conversion result is returned.
4603 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
4605 xhtml_t *xhtml = GET_XHTML(pdoc);
4606 Doc *doc = xhtml->doc;
4608 char *attr_accesskey = NULL;
4609 char *attr_name = NULL;
4610 char *attr_rows = NULL;
4611 char *attr_cols = NULL;
4612 char *attr_istyle = NULL;
4613 char *attr_style = NULL;
4615 xhtml->textarea_flag++;
4616 for (attr = qs_get_attr(doc,node);
4618 attr = qs_get_next_attr(doc,attr)) {
4619 char *name = qs_get_attr_name(doc,attr);
4620 char *value = qs_get_attr_value(doc,attr);
4621 if (STRCASEEQ('n','N',"name",name) && value && *value) {
4624 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
4627 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
4630 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4631 attr_istyle = value;
4633 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
4639 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4640 attr_accesskey = value;
4642 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
4646 if (IS_CSS_ON(xhtml->entryp)) {
4647 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4649 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4650 css_property_t *cur;
4651 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4652 if (strcasestr(cur->value, "<ja:n>")) {
4655 else if (strcasestr(cur->value, "<ja:en>")) {
4658 else if (strcasestr(cur->value, "<ja:hk>")) {
4661 else if (strcasestr(cur->value, "<ja:h>")) {
4668 if (attr_accesskey) {
4669 W_L(" accesskey=\"");
4670 W_V(attr_accesskey);
4699 * It is a handler who processes the TEXTAREA tag.
4701 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4702 * destination is specified.
4703 * @param node [i] The TEXTAREA tag node is specified.
4704 * @return The conversion result is returned.
4707 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4709 xhtml_t *xhtml = GET_XHTML(pdoc);
4710 Doc *doc = xhtml->doc;
4713 xhtml->textarea_flag--;
4719 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
4721 xhtml_t *xhtml = GET_XHTML(pdoc);
4722 Doc *doc = xhtml->doc;
4723 request_rec *r = doc->r;
4730 apr_size_t z2h_input_len;
4732 textval = qs_get_node_value(doc,child);
4733 if (strlen(textval) == 0) {
4737 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4738 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4740 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4741 memset(one_byte, 0, sizeof(one_byte));
4744 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4746 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4748 DBG(r,"[%s][%d]", out, rtn);
4749 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4753 if (is_sjis_kanji(textval[ii])) {
4754 one_byte[0] = textval[ii+0];
4755 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4756 one_byte[0] = textval[ii+1];
4757 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4760 else if (xhtml->pre_flag) {
4761 one_byte[0] = textval[ii+0];
4762 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4764 else if (xhtml->textarea_flag) {
4765 one_byte[0] = textval[ii+0];
4766 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4768 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4769 one_byte[0] = textval[ii+0];
4770 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4773 z2h_input_len = strlen(tdst);
4774 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4782 * It is a handler who processes the BLOCKQUOTE tag.
4784 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4785 * destination is specified.
4786 * @param node [i] The BLOCKQUOTE tag node is specified.
4787 * @return The conversion result is returned.
4790 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4795 char *attr_style = NULL;
4796 char *attr_color = NULL;
4797 char *attr_size = NULL;
4799 xhtml = GET_XHTML(pdoc);
4801 for (attr = qs_get_attr(doc,node);
4803 attr = qs_get_next_attr(doc,attr)) {
4804 char *nm = qs_get_attr_name(doc,attr);
4805 char *val = qs_get_attr_value(doc,attr);
4806 if (val && STRCASEEQ('s','S',"style", nm)) {
4810 if (IS_CSS_ON(xhtml->entryp)) {
4811 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4813 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4814 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4815 css_property_t *cur;
4816 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4817 if (cur->value && *cur->value) {
4818 attr_color = apr_pstrdup(doc->pool, cur->value);
4821 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4822 if (cur->value && *cur->value) {
4823 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4824 attr_size = apr_pstrdup(doc->pool, cur->value);
4826 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4827 attr_size = apr_pstrdup(doc->pool, cur->value);
4829 else if (STRCASEEQ('s','S',"small",cur->value)) {
4830 attr_size = apr_pstrdup(doc->pool, cur->value);
4832 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4833 attr_size = apr_pstrdup(doc->pool, cur->value);
4835 else if (STRCASEEQ('l','L',"large",cur->value)) {
4836 attr_size = apr_pstrdup(doc->pool, cur->value);
4838 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4839 attr_size = apr_pstrdup(doc->pool, cur->value);
4841 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4842 attr_size = apr_pstrdup(doc->pool, cur->value);
4849 if (attr_color || attr_size) {
4852 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4870 * It is a handler who processes the BLOCKQUOTE tag.
4872 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4873 * destination is specified.
4874 * @param node [i] The BLOCKQUOTE tag node is specified.
4875 * @return The conversion result is returned.
4878 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4880 xhtml_t *xhtml = GET_XHTML(pdoc);
4881 Doc *doc = xhtml->doc;
4882 W_L("</blockquote>");
4883 if (IS_CSS_ON(xhtml->entryp)) {
4884 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4891 * It is a handler who processes the DIR tag.
4893 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4894 * destination is specified.
4895 * @param node [i] The DIR tag node is specified.
4896 * @return The conversion result is returned.
4899 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
4901 xhtml_t *xhtml = GET_XHTML(pdoc);
4902 Doc *doc = xhtml->doc;
4904 char *attr_style = NULL;
4905 char *attr_color = NULL;
4906 char *attr_type = NULL;
4907 char *attr_size = NULL;
4908 for (attr = qs_get_attr(doc,node);
4910 attr = qs_get_next_attr(doc,attr)) {
4911 char *name = qs_get_attr_name(doc,attr);
4912 char *value = qs_get_attr_value(doc,attr);
4913 if (STRCASEEQ('t','T',"type",name)) {
4914 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4918 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4922 if (IS_CSS_ON(xhtml->entryp)) {
4923 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4925 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4926 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4927 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4928 css_property_t *cur;
4929 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4930 if (cur->value && *cur->value) {
4931 attr_color = apr_pstrdup(doc->pool, cur->value);
4934 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4935 if (cur->value && *cur->value) {
4936 attr_type = apr_pstrdup(doc->pool, cur->value);
4939 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4940 if (cur->value && *cur->value) {
4941 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4942 attr_size = apr_pstrdup(doc->pool, cur->value);
4944 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4945 attr_size = apr_pstrdup(doc->pool, cur->value);
4947 else if (STRCASEEQ('s','S',"small",cur->value)) {
4948 attr_size = apr_pstrdup(doc->pool, cur->value);
4950 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4951 attr_size = apr_pstrdup(doc->pool, cur->value);
4953 else if (STRCASEEQ('l','L',"large",cur->value)) {
4954 attr_size = apr_pstrdup(doc->pool, cur->value);
4956 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4957 attr_size = apr_pstrdup(doc->pool, cur->value);
4959 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4960 attr_size = apr_pstrdup(doc->pool, cur->value);
4967 if (attr_type || attr_color || attr_size) {
4970 W_L("list-style-type:");
4975 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4993 * It is a handler who processes the DIR tag.
4995 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4996 * destination is specified.
4997 * @param node [i] The DIR tag node is specified.
4998 * @return The conversion result is returned.
5001 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
5003 xhtml_t *xhtml = GET_XHTML(pdoc);
5004 Doc *doc = xhtml->doc;
5006 if (IS_CSS_ON(xhtml->entryp)) {
5007 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5014 * It is a handler who processes the DL tag.
5016 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5017 * destination is specified.
5018 * @param node [i] The DL tag node is specified.
5019 * @return The conversion result is returned.
5022 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
5024 xhtml_t *xhtml = GET_XHTML(pdoc);
5025 Doc *doc = xhtml->doc;
5027 char *attr_style = NULL;
5028 char *attr_color = NULL;
5029 char *attr_size = NULL;
5031 for (attr = qs_get_attr(doc,node);
5033 attr = qs_get_next_attr(doc,attr)) {
5034 char *name = qs_get_attr_name(doc,attr);
5035 char *value = qs_get_attr_value(doc,attr);
5036 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5040 if (IS_CSS_ON(xhtml->entryp)) {
5041 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5043 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5044 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5045 css_property_t *cur;
5046 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5047 if (cur->value && *cur->value) {
5048 attr_color = apr_pstrdup(doc->pool, cur->value);
5051 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5052 if (cur->value && *cur->value) {
5053 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5054 attr_size = apr_pstrdup(doc->pool, cur->value);
5056 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5057 attr_size = apr_pstrdup(doc->pool, cur->value);
5059 else if (STRCASEEQ('s','S',"small",cur->value)) {
5060 attr_size = apr_pstrdup(doc->pool, cur->value);
5062 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5063 attr_size = apr_pstrdup(doc->pool, cur->value);
5065 else if (STRCASEEQ('l','L',"large",cur->value)) {
5066 attr_size = apr_pstrdup(doc->pool, cur->value);
5068 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5069 attr_size = apr_pstrdup(doc->pool, cur->value);
5071 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5072 attr_size = apr_pstrdup(doc->pool, cur->value);
5079 if (attr_color || attr_size) {
5082 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5100 * It is a handler who processes the DL tag.
5102 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5103 * destination is specified.
5104 * @param node [i] The DL tag node is specified.
5105 * @return The conversion result is returned.
5108 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
5110 xhtml_t *xhtml = GET_XHTML(pdoc);
5111 Doc *doc = xhtml->doc;
5113 if (IS_CSS_ON(xhtml->entryp)) {
5114 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5121 * It is a handter who processes the DT tag.
5123 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5124 * destination is specified.
5125 * @param node [i] The DT tag node is specified.
5126 * @return The conversion result is returned.
5129 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
5131 xhtml_t *xhtml = GET_XHTML(pdoc);
5132 Doc *doc = xhtml->doc;
5134 char *attr_style = NULL;
5135 char *attr_color = NULL;
5136 char *attr_size = NULL;
5138 for (attr = qs_get_attr(doc,node);
5140 attr = qs_get_next_attr(doc,attr)) {
5141 char *name = qs_get_attr_name(doc,attr);
5142 char *value = qs_get_attr_value(doc,attr);
5143 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5147 if (IS_CSS_ON(xhtml->entryp)) {
5148 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5150 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5151 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5152 css_property_t *cur;
5153 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5154 if (cur->value && *cur->value) {
5155 attr_color = apr_pstrdup(doc->pool, cur->value);
5158 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5159 if (cur->value && *cur->value) {
5160 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5161 attr_size = apr_pstrdup(doc->pool, cur->value);
5163 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5164 attr_size = apr_pstrdup(doc->pool, cur->value);
5166 else if (STRCASEEQ('s','S',"small",cur->value)) {
5167 attr_size = apr_pstrdup(doc->pool, cur->value);
5169 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5170 attr_size = apr_pstrdup(doc->pool, cur->value);
5172 else if (STRCASEEQ('l','L',"large",cur->value)) {
5173 attr_size = apr_pstrdup(doc->pool, cur->value);
5175 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5176 attr_size = apr_pstrdup(doc->pool, cur->value);
5178 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5179 attr_size = apr_pstrdup(doc->pool, cur->value);
5186 if (attr_color || attr_size) {
5189 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5207 * It is a handter who processes the DT tag.
5209 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5210 * destination is specified.
5211 * @param node [i] The DT tag node is specified.
5212 * @return The conversion result is returned.
5215 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
5217 xhtml_t *xhtml = GET_XHTML(pdoc);
5218 Doc *doc = xhtml->doc;
5220 if (IS_CSS_ON(xhtml->entryp)) {
5221 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5228 * It is a handder who processes the DD tag.
5230 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5231 * destination is specified.
5232 * @param node [i] The DD tag node is specified.
5233 * @return The conversion result is returned.
5236 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
5238 xhtml_t *xhtml = GET_XHTML(pdoc);
5239 Doc *doc = xhtml->doc;
5241 char *attr_style = NULL;
5242 char *attr_color = NULL;
5243 char *attr_size = NULL;
5245 for (attr = qs_get_attr(doc,node);
5247 attr = qs_get_next_attr(doc,attr)) {
5248 char *name = qs_get_attr_name(doc,attr);
5249 char *value = qs_get_attr_value(doc,attr);
5250 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5254 if (IS_CSS_ON(xhtml->entryp)) {
5255 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5257 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5258 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5259 css_property_t *cur;
5260 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5261 if (cur->value && *cur->value) {
5262 attr_color = apr_pstrdup(doc->pool, cur->value);
5265 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5266 if (cur->value && *cur->value) {
5267 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5268 attr_size = apr_pstrdup(doc->pool, cur->value);
5270 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5271 attr_size = apr_pstrdup(doc->pool, cur->value);
5273 else if (STRCASEEQ('s','S',"small",cur->value)) {
5274 attr_size = apr_pstrdup(doc->pool, cur->value);
5276 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5277 attr_size = apr_pstrdup(doc->pool, cur->value);
5279 else if (STRCASEEQ('l','L',"large",cur->value)) {
5280 attr_size = apr_pstrdup(doc->pool, cur->value);
5282 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5283 attr_size = apr_pstrdup(doc->pool, cur->value);
5285 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5286 attr_size = apr_pstrdup(doc->pool, cur->value);
5293 if (attr_color || attr_size) {
5296 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5314 * It is a handler who processes the DD tag.
5316 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5317 * destination is specified.
5318 * @param node [i] The DD tag node is specified.
5319 * @return The conversion result is returned.
5322 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
5324 xhtml_t *xhtml = GET_XHTML(pdoc);
5325 Doc *doc = xhtml->doc;
5327 if (IS_CSS_ON(xhtml->entryp)) {
5328 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5335 * It is a handler who processes the MENU tag.
5337 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5338 * destination is specified.
5339 * @param node [i] The MENU tag node is specified.
5340 * @return The conversion result is returned.
5343 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
5345 xhtml_t *xhtml = GET_XHTML(pdoc);
5346 Doc *doc = xhtml->doc;
5348 char *attr_style = NULL;
5349 char *attr_color = NULL;
5350 char *attr_type = NULL;
5351 char *attr_size = NULL;
5352 for (attr = qs_get_attr(doc,node);
5354 attr = qs_get_next_attr(doc,attr)) {
5355 char *name = qs_get_attr_name(doc,attr);
5356 char *value = qs_get_attr_value(doc,attr);
5357 if (STRCASEEQ('t','T',"type",name)) {
5358 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5362 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5366 if (IS_CSS_ON(xhtml->entryp)) {
5367 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5369 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5370 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5371 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5372 css_property_t *cur;
5373 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5374 if (cur->value && *cur->value) {
5375 attr_color = apr_pstrdup(doc->pool, cur->value);
5378 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5379 if (cur->value && *cur->value) {
5380 attr_type = apr_pstrdup(doc->pool, cur->value);
5383 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5384 if (cur->value && *cur->value) {
5385 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5386 attr_size = apr_pstrdup(doc->pool, cur->value);
5388 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5389 attr_size = apr_pstrdup(doc->pool, cur->value);
5391 else if (STRCASEEQ('s','S',"small",cur->value)) {
5392 attr_size = apr_pstrdup(doc->pool, cur->value);
5394 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5395 attr_size = apr_pstrdup(doc->pool, cur->value);
5397 else if (STRCASEEQ('l','L',"large",cur->value)) {
5398 attr_size = apr_pstrdup(doc->pool, cur->value);
5400 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5401 attr_size = apr_pstrdup(doc->pool, cur->value);
5403 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5404 attr_size = apr_pstrdup(doc->pool, cur->value);
5411 if (attr_type || attr_color || attr_size) {
5414 W_L("list-style-type:");
5419 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5437 * It is a hanmenuer who processes the MENU tag.
5439 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5440 * destination is specified.
5441 * @param node [i] The MENU tag node is specified.
5442 * @return The conversion result is returned.
5445 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
5447 xhtml_t *xhtml = GET_XHTML(pdoc);
5448 Doc *doc = xhtml->doc;
5450 if (IS_CSS_ON(xhtml->entryp)) {
5451 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5458 * It is a handler who processes the PLAINTEXT tag.
5460 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5461 * destination is specified.
5462 * @param node [i] The PLAINTEXT tag node is specified.
5463 * @return The conversion result is returned.
5466 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
5468 xhtml_t *xhtml = GET_XHTML(pdoc);
5469 Doc *doc = xhtml->doc;
5471 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
5476 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
5478 xhtml_t *xhtml = GET_XHTML(pdoc);
5479 Doc *doc = xhtml->doc;
5481 for (child = qs_get_child_node(doc, node);
5483 child = qs_get_next_node(doc, child)) {
5485 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
5492 * It is a handler who processes the PLAINTEXT tag.
5494 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5495 * destination is specified.
5496 * @param node [i] The PLAINTEXT tag node is specified.
5497 * @return The conversion result is returned.
5500 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5502 xhtml_t *xhtml = GET_XHTML(pdoc);
5503 Doc *doc = xhtml->doc;
5504 W_L("</plaintext>");
5510 * It is a handler who processes the BLINK tag.
5512 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5513 * destination is specified.
5514 * @param node [i] The BLINK tag node is specified.
5515 * @return The conversion result is returned.
5518 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
5520 xhtml_t *xhtml = GET_XHTML(pdoc);
5521 Doc *doc = xhtml->doc;
5523 char *attr_style = NULL;
5524 char *attr_color = NULL;
5525 char *attr_size = NULL;
5527 for (attr = qs_get_attr(doc,node);
5529 attr = qs_get_next_attr(doc,attr)) {
5530 char *name = qs_get_attr_name(doc,attr);
5531 char *value = qs_get_attr_value(doc,attr);
5532 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5536 if (IS_CSS_ON(xhtml->entryp)) {
5537 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5539 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5540 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5541 css_property_t *cur;
5542 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5543 if (cur->value && *cur->value) {
5544 attr_color = apr_pstrdup(doc->pool, cur->value);
5547 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5548 if (cur->value && *cur->value) {
5549 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5550 attr_size = apr_pstrdup(doc->pool, cur->value);
5552 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5553 attr_size = apr_pstrdup(doc->pool, cur->value);
5555 else if (STRCASEEQ('s','S',"small",cur->value)) {
5556 attr_size = apr_pstrdup(doc->pool, cur->value);
5558 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5559 attr_size = apr_pstrdup(doc->pool, cur->value);
5561 else if (STRCASEEQ('l','L',"large",cur->value)) {
5562 attr_size = apr_pstrdup(doc->pool, cur->value);
5564 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5565 attr_size = apr_pstrdup(doc->pool, cur->value);
5567 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5568 attr_size = apr_pstrdup(doc->pool, cur->value);
5575 if (attr_color || attr_size) {
5578 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5596 * It is a handler who processes the BLINK tag.
5598 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5599 * destination is specified.
5600 * @param node [i] The BLINK tag node is specified.
5601 * @return The conversion result is returned.
5604 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
5606 xhtml_t *xhtml = GET_XHTML(pdoc);
5607 Doc *doc = xhtml->doc;
5609 if (IS_CSS_ON(xhtml->entryp)) {
5610 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5617 * It is a handler who processes the MARQUEE tag.
5619 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5620 * destination is specified.
5621 * @param node [i] The MARQUEE tag node is specified.
5622 * @return The conversion result is returned.
5625 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
5627 xhtml_t *xhtml = GET_XHTML(pdoc);
5628 Doc *doc = xhtml->doc;
5630 char *attr_direction = NULL;
5631 char *attr_behavior = NULL;
5632 char *attr_loop = NULL;
5633 char *attr_style = NULL;
5634 char *attr_color = NULL;
5635 char *attr_size = NULL;
5636 char *attr_bgcolor = NULL;
5637 /*--------------------------------------------------------------------------*/
5638 /* Get Attributes */
5639 /*--------------------------------------------------------------------------*/
5640 for (attr = qs_get_attr(doc,node);
5642 attr = qs_get_next_attr(doc,attr)) {
5643 char *name = qs_get_attr_name(doc,attr);
5644 char *value = qs_get_attr_value(doc,attr);
5645 if (STRCASEEQ('d','D',"direction", name)) {
5647 if (STRCASEEQ('l','L',"left",value)) {
5648 attr_direction = "rtl";
5650 else if (STRCASEEQ('r','R',"right",value)) {
5651 attr_direction = "ltr";
5655 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
5656 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
5657 attr_behavior = value;
5660 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
5663 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5664 if (value && *value) {
5665 attr_bgcolor = value;
5668 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5672 if (IS_CSS_ON(xhtml->entryp)) {
5673 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5675 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5676 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5677 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5678 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5679 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5680 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5681 css_property_t *cur;
5682 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5683 if (cur->value && *cur->value) {
5684 attr_color = apr_pstrdup(doc->pool, cur->value);
5687 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5688 if (cur->value && *cur->value) {
5689 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5692 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5693 if (cur->value && *cur->value) {
5694 attr_direction = apr_pstrdup(doc->pool, cur->value);
5697 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
5698 if (cur->value && *cur->value) {
5699 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
5700 attr_behavior = apr_pstrdup(doc->pool, cur->value);
5704 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
5705 if (cur->value && *cur->value) {
5706 attr_loop = apr_pstrdup(doc->pool, cur->value);
5709 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5710 if (cur->value && *cur->value) {
5711 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5712 attr_size = apr_pstrdup(doc->pool, cur->value);
5714 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5715 attr_size = apr_pstrdup(doc->pool, cur->value);
5717 else if (STRCASEEQ('s','S',"small",cur->value)) {
5718 attr_size = apr_pstrdup(doc->pool, cur->value);
5720 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5721 attr_size = apr_pstrdup(doc->pool, cur->value);
5723 else if (STRCASEEQ('l','L',"large",cur->value)) {
5724 attr_size = apr_pstrdup(doc->pool, cur->value);
5726 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5727 attr_size = apr_pstrdup(doc->pool, cur->value);
5729 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5730 attr_size = apr_pstrdup(doc->pool, cur->value);
5737 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5739 if (attr_direction) {
5740 W_L("-wap-marquee-dir:");
5741 W_V(attr_direction);
5744 if (attr_behavior) {
5745 W_L("-wap-marquee-style:");
5750 W_L("-wap-marquee-loop:");
5755 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5756 W_L("background-color:");
5761 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5780 * It is a handler who processes the MARQUEE tag.
5782 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5783 * destination is specified.
5784 * @param node [i] The MARQUEE tag node is specified.
5785 * @return The conversion result is returned.
5788 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5790 xhtml_t *xhtml = GET_XHTML(pdoc);
5791 Doc *doc = xhtml->doc;
5793 if (IS_CSS_ON(xhtml->entryp)) {
5794 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5801 * It is handler who processes the New Line Code.
5804 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5806 xhtml_t *xhtml = GET_XHTML(pdoc);
5807 Doc *doc = xhtml->doc;
5808 if (xhtml->start_html_flag) {
5816 * It is a handler who processes the LINK tag.
5818 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5819 * destination is specified.
5820 * @param node [i] The LINK tag node is specified.
5821 * @return The conversion result is returned.
5824 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5833 xhtml = GET_XHTML(pdoc);
5836 if (! IS_CSS_ON(xhtml->entryp)) {
5840 for (attr = qs_get_attr(doc,node);
5842 attr = qs_get_next_attr(doc,attr)) {
5843 char *name = qs_get_attr_name(doc,attr);
5844 char *value = qs_get_attr_value(doc,attr);
5845 if (STRCASEEQ('r','R',"rel", name)) {
5846 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5850 else if (STRCASEEQ('h','H',"href", name)) {
5851 if (value && *value) {
5855 else if (STRCASEEQ('t','T',"type", name)) {
5856 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5862 if (rel && href && type) {
5863 DBG(doc->r, "start load CSS. url:[%s]", href);
5864 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
5865 DBG(doc->r, "end load CSS. url:[%s]", href);
5871 static css_prop_list_t *
5872 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5874 xhtml_t *xhtml = GET_XHTML(pdoc);
5875 Doc *doc = xhtml->doc;
5876 css_prop_list_t *last_css = NULL;
5877 if (IS_CSS_ON(xhtml->entryp)) {
5878 css_prop_list_t *dup_css;
5879 css_selector_t *selector;
5881 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5882 dup_css = chxj_dup_css_prop_list(doc, last_css);
5883 selector = chxj_css_find_selector(doc, xhtml->style, node);
5885 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5887 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
5888 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5890 if (style_attr_value) {
5891 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));
5893 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5901 static css_prop_list_t *
5902 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5904 xhtml_t *xhtml = GET_XHTML(pdoc);
5905 Doc *doc = xhtml->doc;
5906 css_prop_list_t *last_css = NULL;
5907 if (IS_CSS_ON(xhtml->entryp)) {
5908 css_prop_list_t *dup_css;
5909 css_selector_t *selector;
5911 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5912 dup_css = chxj_dup_css_prop_list(doc, last_css);
5913 selector = chxj_css_find_selector(doc, xhtml->style, node);
5915 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5919 if (style_attr_value) {
5920 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));
5922 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5931 * It is a handler who processes the SPAN tag.
5933 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5934 * destination is specified.
5935 * @param node [i] The SPAN tag node is specified.
5936 * @return The conversion result is returned.
5939 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
5944 char *attr_style = NULL;
5945 char *attr_color = NULL;
5946 char *attr_size = NULL;
5947 char *attr_align = NULL;
5948 char *attr_blink = NULL;
5949 char *attr_marquee = NULL;
5950 char *attr_marquee_dir = NULL;
5951 char *attr_marquee_style = NULL;
5952 char *attr_marquee_loop = NULL;
5953 char *css_bgcolor = NULL;
5955 xhtml = GET_XHTML(pdoc);
5958 for (attr = qs_get_attr(doc,node);
5960 attr = qs_get_next_attr(doc,attr)) {
5961 char *nm = qs_get_attr_name(doc,attr);
5962 char *val = qs_get_attr_value(doc,attr);
5963 if (val && STRCASEEQ('s','S',"style", nm)) {
5967 if (IS_CSS_ON(xhtml->entryp)) {
5968 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5970 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5971 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5972 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5973 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5974 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5975 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5976 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5977 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5978 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5980 css_property_t *cur;
5981 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5982 attr_color = apr_pstrdup(doc->pool, cur->value);
5984 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5985 if (cur->value && *cur->value) {
5986 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5987 || STRCASEEQ('x','X',"x-small", cur->value)
5988 || STRCASEEQ('s','S',"small", cur->value)
5989 || STRCASEEQ('m','M',"medium", cur->value)
5990 || STRCASEEQ('l','L',"large", cur->value)
5991 || STRCASEEQ('x','X',"x-large", cur->value)
5992 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5993 attr_size = apr_pstrdup(doc->pool, cur->value);
5997 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5998 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5999 attr_blink = apr_pstrdup(doc->pool, cur->value);
6002 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6003 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6004 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6007 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6008 if (cur->value && *cur->value) {
6009 if ( STRCASEEQ('l','L',"ltr",cur->value)
6010 || STRCASEEQ('r','R',"rtl",cur->value)) {
6011 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6015 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6016 if (cur->value && *cur->value) {
6017 if ( STRCASEEQ('s','S',"scroll",cur->value)
6018 || STRCASEEQ('s','S',"slide",cur->value)
6019 || STRCASEEQ('a','A',"alternate",cur->value)) {
6020 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6024 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6025 if (cur->value && *cur->value) {
6026 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6027 attr_marquee_loop = "infinite";
6030 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6034 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6035 if (STRCASEEQ('l','L',"left", cur->value)) {
6036 attr_align = apr_pstrdup(doc->pool, "left");
6038 else if (STRCASEEQ('c','C',"center",cur->value)) {
6039 attr_align = apr_pstrdup(doc->pool, "center");
6041 else if (STRCASEEQ('r','R',"right",cur->value)) {
6042 attr_align = apr_pstrdup(doc->pool, "right");
6045 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6046 if (cur->value && *cur->value) {
6047 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6054 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6057 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6073 W_L("text-decoration:");
6078 W_L("display:-wap-marquee;");
6079 if (attr_marquee_dir) {
6080 W_L("-wap-marquee-dir:");
6081 W_V(attr_marquee_dir);
6084 if (attr_marquee_style) {
6085 W_L("-wap-marquee-style:");
6086 W_V(attr_marquee_style);
6089 if (attr_marquee_loop) {
6090 W_L("-wap-marquee-loop:");
6091 W_V(attr_marquee_loop);
6096 W_L("background-color:");
6108 * It is a handler who processes the SPAN tag.
6110 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6111 * destination is specified.
6112 * @param node [i] The SPAN tag node is specified.
6113 * @return The conversion result is returned.
6116 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
6118 xhtml_t *xhtml = GET_XHTML(pdoc);
6119 Doc *doc = xhtml->doc;
6122 if (IS_CSS_ON(xhtml->entryp)) {
6123 chxj_css_pop_prop_list(xhtml->css_prop_stack);
6130 * It is a handler who processes the STYLE tag.
6132 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6133 * destination is specified.
6134 * @param node [i] The STYLE tag node is specified.
6135 * @return The conversion result is returned.
6138 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
6145 xhtml = GET_XHTML(pdoc);
6148 if (! IS_CSS_ON(xhtml->entryp)) {
6152 for (attr = qs_get_attr(doc,node);
6154 attr = qs_get_next_attr(doc,attr)) {
6155 char *name = qs_get_attr_name(doc,attr);
6156 char *value = qs_get_attr_value(doc,attr);
6157 if (STRCASEEQ('t','T',"type", name)) {
6158 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6164 Node *child = qs_get_child_node(doc, node);
6165 if (type && child) {
6166 char *name = qs_get_node_name(doc, child);
6167 if (STRCASEEQ('t','T',"text", name)) {
6168 char *value = qs_get_node_value(doc, child);
6169 DBG(doc->r, "start load CSS. buf:[%s]", value);
6170 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
6171 DBG(doc->r, "end load CSS. value:[%s]", value);
6178 * It is a handler who processes the OBJECT tag.
6180 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6181 * destination is specified.
6182 * @param node [i] The OBJECT tag node is specified.
6183 * @return The conversion result is returned.
6186 s_xhtml_1_0_start_object_tag(void *pdoc, Node *node)
6188 xhtml_t *xhtml = GET_XHTML(pdoc);
6189 Doc *doc = xhtml->doc;
6193 char *attr_id = NULL;
6194 char *attr_width = NULL;
6195 char *attr_height = NULL;
6196 char *attr_data = NULL;
6197 char *attr_type = NULL;
6199 /*--------------------------------------------------------------------------*/
6200 /* Get Attributes */
6201 /*--------------------------------------------------------------------------*/
6202 for (attr = qs_get_attr(doc,node);
6204 attr = qs_get_next_attr(doc,attr)) {
6205 char *name = qs_get_attr_name(doc,attr);
6206 char *value = qs_get_attr_value(doc,attr);
6207 if (STRCASEEQ('i','I',"id",name)) {
6208 attr_id = apr_pstrdup(doc->pool, value);
6210 else if (STRCASEEQ('w','W',"width",name)) {
6211 attr_width = apr_pstrdup(doc->pool, value);
6213 else if (STRCASEEQ('h','H',"height",name)) {
6214 attr_height = apr_pstrdup(doc->pool, value);
6216 else if (STRCASEEQ('d','D',"data",name)) {
6217 attr_data = apr_pstrdup(doc->pool, value);
6219 else if (STRCASEEQ('t','T',"type",name)) {
6220 attr_type = apr_pstrdup(doc->pool, value);
6256 * It is a handler who processes the OBJECT tag.
6258 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6259 * destination is specified.
6260 * @param node [i] The OBJECT tag node is specified.
6261 * @return The conversion result is returned.
6264 s_xhtml_1_0_end_object_tag(void *pdoc, Node *UNUSED(node))
6266 xhtml_t *xhtml = GET_XHTML(pdoc);
6267 Doc *doc = xhtml->doc;
6274 * It is a handler who processes the OBJECT tag.
6276 * @param pdoc [i/o] The pointer to the XHTML structure at the output
6277 * destination is specified.
6278 * @param node [i] The OBJECT tag node is specified.
6279 * @return The conversion result is returned.
6282 s_xhtml_1_0_start_param_tag(void *pdoc, Node *node)
6284 xhtml_t *xhtml = GET_XHTML(pdoc);
6285 Doc *doc = xhtml->doc;
6288 char *attr_style = NULL;
6289 char *attr_name = NULL;
6290 char *attr_value = NULL;
6292 /*--------------------------------------------------------------------------*/
6293 /* Get Attributes */
6294 /*--------------------------------------------------------------------------*/
6295 for (attr = qs_get_attr(doc,node);
6297 attr = qs_get_next_attr(doc,attr)) {
6298 char *name = qs_get_attr_name(doc,attr);
6299 char *value = qs_get_attr_value(doc,attr);
6300 if (STRCASEEQ('n','N',"name",name)) {
6301 attr_name = apr_pstrdup(doc->pool, value);
6303 else if (STRCASEEQ('v','V',"value",name)) {
6304 attr_value = apr_pstrdup(doc->pool, value);