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.
17 #include "chxj_jxhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_conv_z2h.h"
30 #define GET_JXHTML(X) ((jxhtml_t *)(X))
33 #define W_L(X) do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
34 #define W_V(X) do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X)) \
35 : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
39 static char *s_jxhtml_start_html_tag (void *pdoc, Node *node);
40 static char *s_jxhtml_end_html_tag (void *pdoc, Node *node);
41 static char *s_jxhtml_start_meta_tag (void *pdoc, Node *node);
42 static char *s_jxhtml_end_meta_tag (void *pdoc, Node *node);
43 static char *s_jxhtml_start_head_tag (void *pdoc, Node *node);
44 static char *s_jxhtml_end_head_tag (void *pdoc, Node *node);
45 static char *s_jxhtml_start_title_tag (void *pdoc, Node *node);
46 static char *s_jxhtml_end_title_tag (void *pdoc, Node *node);
47 static char *s_jxhtml_start_base_tag (void *pdoc, Node *node);
48 static char *s_jxhtml_end_base_tag (void *pdoc, Node *node);
49 static char *s_jxhtml_start_body_tag (void *pdoc, Node *node);
50 static char *s_jxhtml_end_body_tag (void *pdoc, Node *node);
51 static char *s_jxhtml_start_a_tag (void *pdoc, Node *node);
52 static char *s_jxhtml_end_a_tag (void *pdoc, Node *node);
53 static char *s_jxhtml_start_pre_tag (void *pdoc, Node *node);
54 static char *s_jxhtml_end_pre_tag (void *pdoc, Node *node);
55 static char *s_jxhtml_start_p_tag (void *pdoc, Node *node);
56 static char *s_jxhtml_end_p_tag (void *pdoc, Node *node);
57 static char *s_jxhtml_start_ul_tag (void *pdoc, Node *node);
58 static char *s_jxhtml_end_ul_tag (void *pdoc, Node *node);
59 static char *s_jxhtml_start_ol_tag (void *pdoc, Node *node);
60 static char *s_jxhtml_end_ol_tag (void *pdoc, Node *node);
61 static char *s_jxhtml_start_li_tag (void *pdoc, Node *node);
62 static char *s_jxhtml_end_li_tag (void *pdoc, Node *node);
63 static char *s_jxhtml_start_br_tag (void *pdoc, Node *node);
64 static char *s_jxhtml_end_br_tag (void *pdoc, Node *node);
66 static char *s_jxhtml_start_table_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_end_table_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_start_tr_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_start_td_or_th_tag (void *pdoc, Node *node,char *tagName);
71 static char *s_jxhtml_end_td_or_th_tag (void *pdoc, Node *node,char *tagName);
72 static char *s_jxhtml_start_td_tag (void *pdoc, Node *node);
73 static char *s_jxhtml_end_td_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_start_th_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_end_th_tag (void *pdoc, Node *node);
77 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
116 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
117 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
121 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
122 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
123 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
126 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
127 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
128 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
129 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
130 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
131 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
132 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
133 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
134 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
135 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
136 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
137 static char *s_jxhtml_start_object_tag (void *pdoc, Node *node);
138 static char *s_jxhtml_end_object_tag (void *pdoc, Node *node);
139 static char *s_jxhtml_start_param_tag (void *pdoc, Node *node);
141 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
143 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
145 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
146 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
150 tag_handler jxhtml_handler[] = {
153 s_jxhtml_start_html_tag,
154 s_jxhtml_end_html_tag,
158 s_jxhtml_start_meta_tag,
159 s_jxhtml_end_meta_tag,
163 s_jxhtml_start_textarea_tag,
164 s_jxhtml_end_textarea_tag,
168 s_jxhtml_start_p_tag,
173 s_jxhtml_start_pre_tag,
174 s_jxhtml_end_pre_tag,
178 s_jxhtml_start_ul_tag,
183 s_jxhtml_start_li_tag,
188 s_jxhtml_start_ol_tag,
193 s_jxhtml_start_h1_tag,
198 s_jxhtml_start_h2_tag,
203 s_jxhtml_start_h3_tag,
208 s_jxhtml_start_h4_tag,
213 s_jxhtml_start_h5_tag,
218 s_jxhtml_start_h6_tag,
223 s_jxhtml_start_head_tag,
224 s_jxhtml_end_head_tag,
228 s_jxhtml_start_title_tag,
229 s_jxhtml_end_title_tag,
233 s_jxhtml_start_base_tag,
234 s_jxhtml_end_base_tag,
238 s_jxhtml_start_body_tag,
239 s_jxhtml_end_body_tag,
243 s_jxhtml_start_a_tag,
248 s_jxhtml_start_br_tag,
253 s_jxhtml_start_table_tag,
254 s_jxhtml_end_table_tag,
258 s_jxhtml_start_tr_tag,
263 s_jxhtml_start_td_tag,
273 s_jxhtml_start_font_tag,
274 s_jxhtml_end_font_tag,
278 s_jxhtml_start_form_tag,
279 s_jxhtml_end_form_tag,
283 s_jxhtml_start_input_tag,
284 s_jxhtml_end_input_tag,
288 s_jxhtml_start_center_tag,
289 s_jxhtml_end_center_tag,
293 s_jxhtml_start_hr_tag,
298 s_jxhtml_start_img_tag,
299 s_jxhtml_end_img_tag,
303 s_jxhtml_start_select_tag,
304 s_jxhtml_end_select_tag,
308 s_jxhtml_start_option_tag,
309 s_jxhtml_end_option_tag,
313 s_jxhtml_start_div_tag,
314 s_jxhtml_end_div_tag,
343 s_jxhtml_start_span_tag,
344 s_jxhtml_end_span_tag,
353 s_jxhtml_start_th_tag,
358 s_jxhtml_start_b_tag,
368 s_jxhtml_start_dt_tag,
383 s_jxhtml_start_blockquote_tag,
384 s_jxhtml_end_blockquote_tag,
388 s_jxhtml_start_dir_tag,
389 s_jxhtml_end_dir_tag,
393 s_jxhtml_start_dl_tag,
398 s_jxhtml_start_dd_tag,
403 s_jxhtml_start_menu_tag,
404 s_jxhtml_end_menu_tag,
408 s_jxhtml_start_plaintext_tag,
409 s_jxhtml_end_plaintext_tag,
413 s_jxhtml_start_blink_tag,
414 s_jxhtml_end_blink_tag,
418 s_jxhtml_start_marquee_tag,
419 s_jxhtml_end_marquee_tag,
428 s_jxhtml_newline_mark,
433 s_jxhtml_start_object_tag,
434 s_jxhtml_end_object_tag,
438 s_jxhtml_start_param_tag,
445 * converts from CHTML5.0 to JXHTML.
447 * @param r [i] Requet_rec is appointed.
448 * @param spec [i] The result of the device specification processing which
449 * was done in advance is appointed.
450 * @param src [i] The character string before the converting is appointed.
451 * @return The character string after the converting is returned.
460 chxjconvrule_entry *entryp,
471 /*--------------------------------------------------------------------------*/
473 /*--------------------------------------------------------------------------*/
475 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
477 DBG(r,"I found qrcode xml");
480 DBG(r,"not found qrcode xml");
482 /*--------------------------------------------------------------------------*/
483 /* The CHTML structure is initialized. */
484 /*--------------------------------------------------------------------------*/
485 s_init_jxhtml(&jxhtml, &doc, r, spec);
487 jxhtml.entryp = entryp;
488 jxhtml.cookie = cookie;
490 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
492 /*--------------------------------------------------------------------------*/
493 /* The character string of the input is analyzed. */
494 /*--------------------------------------------------------------------------*/
495 qs_init_malloc(&doc);
496 qs_init_root_node(&doc);
498 ss = apr_pcalloc(r->pool, srclen + 1);
500 memset(ss, 0, srclen + 1);
501 memcpy(ss, src, srclen);
503 if (IS_CSS_ON(jxhtml.entryp)) {
504 /* current property list */
505 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
508 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
511 qs_parse_string(&doc,ss,strlen(ss));
513 chxj_buffered_write_init(r->pool, &doc.buf);
514 /*--------------------------------------------------------------------------*/
515 /* It converts it from CHTML to JXHTML. */
516 /*--------------------------------------------------------------------------*/
517 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
518 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
519 dst = apr_pstrdup(r->pool, jxhtml.out);
520 chxj_buffered_write_terminate(&doc.buf);
523 qs_all_free(&doc,QX_LOGMARK);
526 return apr_pstrdup(r->pool,ss);
529 dst = apr_psprintf(r->pool, "\n");
531 *dstlen = strlen(dst);
534 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
542 * The JXHTML structure is initialized.
544 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
545 * initialized is specified.
546 * @param doc [i] The Doc structure that should be set to the initialized
547 * JXHTML structure is specified.
548 * @param r [i] To use POOL, the pointer to request_rec is specified.
549 * @param spec [i] The pointer to the device_table
552 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
554 memset(doc, 0, sizeof(Doc));
555 memset(jxhtml, 0, sizeof(jxhtml_t));
560 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
561 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
562 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
567 * Corresponding EMOJI to a current character-code is retrieved.
568 * The substitution character string is stored in the rslt pointer if agreeing.
570 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
571 * @param txt [i] The character string to want to examine whether it is
572 * EMOJI is specified.
573 * @param rslt [o] The pointer to the pointer that stores the result is
575 * @return When corresponding EMOJI exists, it returns it excluding 0.
578 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
590 if (! spec) DBG(r,"spec is NULL");
592 for (ee = jxhtml->conf->emoji;
596 unsigned char hex1byte;
597 unsigned char hex2byte;
600 DBG(r,"emoji->imode is NULL");
604 hex1byte = ee->imode->hex1byte & 0xff;
605 hex2byte = ee->imode->hex2byte & 0xff;
607 if (ee->imode->string
608 && strlen(ee->imode->string) > 0
609 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
610 if (spec == NULL || spec->emoji_type == NULL) {
611 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
612 return strlen(ee->imode->string);
619 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
620 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
621 if (spec == NULL || spec->emoji_type == NULL) {
622 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
635 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
649 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
650 memset(doc, 0, sizeof(Doc));
651 memset(jxhtml, 0, sizeof(jxhtml_t));
656 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
657 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
658 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
660 apr_pool_create(&pool, r->pool);
662 chxj_buffered_write_init(pool, &doc->buf);
664 for (ii=0; ii<len; ii++) {
668 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
675 if (is_sjis_kanji(src[ii])) {
676 two_byte[0] = src[ii+0];
677 two_byte[1] = src[ii+1];
683 one_byte[0] = src[ii+0];
688 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
690 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
696 * It is a handler who processes the HTML tag.
698 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
699 * destination is specified.
700 * @param node [i] The HTML tag node is specified.
701 * @return The conversion result is returned.
704 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
711 jxhtml = GET_JXHTML(pdoc);
714 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
716 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
718 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
721 /*--------------------------------------------------------------------------*/
723 /*--------------------------------------------------------------------------*/
724 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
726 jxhtml->start_html_flag = 1;
728 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
735 * It is a handler who processes the HTML tag.
737 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
738 * destination is specified.
739 * @param node [i] The HTML tag node is specified.
740 * @return The conversion result is returned.
743 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
745 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
746 Doc *doc = jxhtml->doc;
755 * It is a handler who processes the META tag.
757 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
758 * destination is specified.
759 * @param node [i] The META tag node is specified.
760 * @return The conversion result is returned.
763 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
769 int content_type_flag;
772 jxhtml = GET_JXHTML(pdoc);
776 content_type_flag = 0;
779 /*--------------------------------------------------------------------------*/
781 /*--------------------------------------------------------------------------*/
782 for (attr = qs_get_attr(doc,node);
784 attr = qs_get_next_attr(doc,attr)) {
785 char *name = qs_get_attr_name(doc,attr);
786 char *value = qs_get_attr_value(doc,attr);
790 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
791 /*----------------------------------------------------------------------*/
793 /*----------------------------------------------------------------------*/
794 W_L(" http-equiv=\"");
797 if (STRCASEEQ('c','C',"content-type",value)) {
798 content_type_flag = 1;
800 if (STRCASEEQ('r','R',"refresh",value)) {
808 if (strcasecmp(name, "content") == 0 && value && *value) {
809 /*----------------------------------------------------------------------*/
811 /*----------------------------------------------------------------------*/
812 if (content_type_flag) {
816 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
825 buf = apr_pstrdup(r->pool, value);
827 url = strchr(buf, ';');
829 sec = apr_pstrdup(r->pool, buf);
832 url = chxj_encoding_parameter(r, url, 1);
853 if (strcasecmp(name, "name") == 0 && value && *value) {
869 * It is a handler who processes the META tag.
871 * @param pdoc [i/o] The pointer to the JXHTML 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_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
879 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
886 * It is a handler who processes the HEAD tag.
888 * @param pdoc [i/o] The pointer to the JXHTML 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_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
900 jxhtml = GET_JXHTML(pdoc);
910 * It is a handler who processes the HEAD tag.
912 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
913 * destination is specified.
914 * @param node [i] The HEAD tag node is specified.
915 * @return The conversion result is returned.
918 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
924 jxhtml = GET_JXHTML(pdoc);
934 * It is a handler who processes the TITLE tag.
936 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
937 * destination is specified.
938 * @param node [i] The TITLE tag node is specified.
939 * @return The conversion result is returned.
942 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
948 jxhtml = GET_JXHTML(pdoc);
958 * It is a handler who processes the TITLE tag.
960 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
961 * destination is specified.
962 * @param node [i] The TITLE tag node is specified.
963 * @return The conversion result is returned.
966 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
972 jxhtml = GET_JXHTML(pdoc);
982 * It is a handler who processes the BASE tag.
984 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
985 * destination is specified.
986 * @param node [i] The BASE tag node is specified.
987 * @return The conversion result is returned.
990 s_jxhtml_start_base_tag(void *pdoc, Node *node)
997 jxhtml = GET_JXHTML(pdoc);
1002 /*--------------------------------------------------------------------------*/
1003 /* Get Attributes */
1004 /*--------------------------------------------------------------------------*/
1005 for (attr = qs_get_attr(doc,node);
1007 attr = qs_get_next_attr(doc,attr)) {
1008 char *name = qs_get_attr_name(doc,attr);
1009 char *value = qs_get_attr_value(doc,attr);
1010 if (STRCASEEQ('h','H',"href",name)) {
1022 * It is a handler who processes the BASE tag.
1024 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1025 * destination is specified.
1026 * @param node [i] The BASE tag node is specified.
1027 * @return The conversion result is returned.
1030 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1032 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1038 * It is a handler who processes the BODY tag.
1040 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1041 * destination is specified.
1042 * @param node [i] The BODY tag node is specified.
1043 * @return The conversion result is returned.
1046 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1052 char *attr_bgcolor = NULL;
1053 char *attr_text = NULL;
1054 char *attr_link = NULL;
1055 char *attr_vlink = NULL;
1056 char *attr_style = NULL;
1057 char *attr_background = NULL;
1059 jxhtml = GET_JXHTML(pdoc);
1063 /*--------------------------------------------------------------------------*/
1064 /* Get Attributes */
1065 /*--------------------------------------------------------------------------*/
1066 for (attr = qs_get_attr(doc,node);
1068 attr = qs_get_next_attr(doc,attr)) {
1069 char *name = qs_get_attr_name(doc,attr);
1070 char *value = qs_get_attr_value(doc,attr);
1071 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1072 /*----------------------------------------------------------------------*/
1074 /*----------------------------------------------------------------------*/
1075 attr_bgcolor = value;
1077 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1078 /*----------------------------------------------------------------------*/
1080 /*----------------------------------------------------------------------*/
1083 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1084 /*----------------------------------------------------------------------*/
1086 /*----------------------------------------------------------------------*/
1089 else if (STRCASEEQ('a','A',"alink",name)) {
1090 /*----------------------------------------------------------------------*/
1092 /*----------------------------------------------------------------------*/
1095 else if (STRCASEEQ('v','V',"vlink",name)) {
1096 /*----------------------------------------------------------------------*/
1098 /*----------------------------------------------------------------------*/
1101 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1102 /*----------------------------------------------------------------------*/
1104 /*----------------------------------------------------------------------*/
1105 attr_background = value;
1107 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1112 if (IS_CSS_ON(jxhtml->entryp)) {
1113 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1115 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1116 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1117 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1118 css_property_t *cur;
1119 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1120 if (cur->value && *cur->value) {
1121 attr_text = apr_pstrdup(doc->pool, cur->value);
1124 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1125 if (cur->value && *cur->value) {
1126 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1129 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1130 if (cur->value && *cur->value) {
1131 char *tmp = apr_pstrdup(doc->pool, cur->value);
1132 char *tmps = strstr(tmp,"(");
1134 char *tmpe = strstr(tmp,")");
1135 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1137 attr_background = apr_pstrndup(doc->pool, tmps,len);
1142 if (jxhtml->style) {
1143 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1144 css_selector_t *cur_sel;
1145 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1146 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1147 css_property_t *cur;
1148 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1149 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1150 attr_link = apr_pstrdup(doc->pool, cur->value);
1154 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1155 css_property_t *cur;
1156 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1157 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1158 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1168 if (attr_bgcolor || attr_text) {
1171 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1172 W_L("background-color:");
1177 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1185 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1191 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1196 if (attr_background) {
1197 W_L(" background=\"");
1198 W_V(attr_background);
1207 * It is a handler who processes the BODY tag.
1209 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1210 * destination is specified.
1211 * @param node [i] The BODY tag node is specified.
1212 * @return The conversion result is returned.
1215 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1221 jxhtml = GET_JXHTML(pdoc);
1225 W_L("</div></body>");
1226 if (IS_CSS_ON(jxhtml->entryp)) {
1227 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1234 * It is a handler who processes the A tag.
1236 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1237 * destination is specified.
1238 * @param node [i] The A tag node is specified.
1239 * @return The conversion result is returned.
1242 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1248 char *attr_style = NULL;
1250 jxhtml = GET_JXHTML(pdoc);
1255 /*--------------------------------------------------------------------------*/
1256 /* Get Attributes */
1257 /*--------------------------------------------------------------------------*/
1258 for (attr = qs_get_attr(doc,node);
1260 attr = qs_get_next_attr(doc,attr)) {
1261 char *name = qs_get_attr_name(doc,attr);
1262 char *value = qs_get_attr_value(doc,attr);
1263 if (STRCASEEQ('n','N',"name",name)) {
1264 /*----------------------------------------------------------------------*/
1266 /*----------------------------------------------------------------------*/
1268 W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1271 else if (STRCASEEQ('h','H',"href",name)) {
1272 /*----------------------------------------------------------------------*/
1274 /*----------------------------------------------------------------------*/
1275 value = chxj_encoding_parameter(r, value, 1);
1276 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1277 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1283 else if (STRCASEEQ('a','A',"accesskey",name)) {
1284 /*----------------------------------------------------------------------*/
1286 /*----------------------------------------------------------------------*/
1287 W_L(" accesskey=\"");
1291 else if (STRCASEEQ('c','C',"cti",name)) {
1292 /*----------------------------------------------------------------------*/
1294 /*----------------------------------------------------------------------*/
1299 else if (STRCASEEQ('i','I',"ijam",name)) {
1300 /*----------------------------------------------------------------------*/
1302 /*----------------------------------------------------------------------*/
1305 else if (STRCASEEQ('u','U',"utn",name)) {
1306 /*----------------------------------------------------------------------*/
1308 /* It is special only for CHTML. */
1309 /*----------------------------------------------------------------------*/
1312 else if (STRCASEEQ('t','T',"telbook",name)) {
1313 /*----------------------------------------------------------------------*/
1315 /*----------------------------------------------------------------------*/
1318 else if (STRCASEEQ('k','K',"kana",name)) {
1319 /*----------------------------------------------------------------------*/
1321 /*----------------------------------------------------------------------*/
1324 else if (STRCASEEQ('e','E',"email",name)) {
1325 /*----------------------------------------------------------------------*/
1327 /*----------------------------------------------------------------------*/
1330 else if (STRCASEEQ('i','I',"ista",name)) {
1331 /*----------------------------------------------------------------------*/
1333 /*----------------------------------------------------------------------*/
1336 else if (STRCASEEQ('i','I',"ilet",name)) {
1337 /*----------------------------------------------------------------------*/
1339 /*----------------------------------------------------------------------*/
1342 else if (STRCASEEQ('i','I',"iswf",name)) {
1343 /*----------------------------------------------------------------------*/
1345 /*----------------------------------------------------------------------*/
1348 else if (STRCASEEQ('i','I',"irst",name)) {
1349 /*----------------------------------------------------------------------*/
1351 /*----------------------------------------------------------------------*/
1354 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1355 /*----------------------------------------------------------------------*/
1357 /*----------------------------------------------------------------------*/
1363 if (IS_CSS_ON(jxhtml->entryp)) {
1364 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1372 * It is a handler who processes the A tag.
1374 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1375 * destination is specified.
1376 * @param node [i] The A tag node is specified.
1377 * @return The conversion result is returned.
1380 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1386 jxhtml = GET_JXHTML(pdoc);
1392 if (IS_CSS_ON(jxhtml->entryp)) {
1393 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1401 * It is a handler who processes the BR tag.
1403 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1404 * destination is specified.
1405 * @param node [i] The BR tag node is specified.
1406 * @return The conversion result is returned.
1409 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1416 jxhtml = GET_JXHTML(pdoc);
1420 char *attr_style = NULL;
1421 char *attr_clear = NULL;
1423 /*--------------------------------------------------------------------------*/
1424 /* Get Attributes */
1425 /*--------------------------------------------------------------------------*/
1426 for (attr = qs_get_attr(doc,node);
1428 attr = qs_get_next_attr(doc,attr)) {
1429 char *name = qs_get_attr_name(doc,attr);
1430 char *value = qs_get_attr_value(doc,attr);
1431 if (STRCASEEQ('c','C',"clear",name)) {
1432 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1436 else if (STRCASEEQ('s','S',"style",name)) {
1437 attr_style = apr_pstrdup(doc->buf.pool, value);
1440 if (IS_CSS_ON(jxhtml->entryp)) {
1441 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1443 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1444 css_property_t *cur;
1445 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1446 if (cur->value && *cur->value) {
1447 if ( STRCASEEQ('l','L',"left", cur->value)
1448 || STRCASEEQ('r','R',"right", cur->value)
1449 || STRCASEEQ('b','B',"both" ,cur->value)) {
1450 attr_clear = apr_pstrdup(doc->pool, cur->value);
1468 * It is a handler who processes the BR tag.
1470 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1471 * destination is specified.
1472 * @param node [i] The BR tag node is specified.
1473 * @return The conversion result is returned.
1476 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1478 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1483 * It is a handler who processes the TABLE tag.
1485 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1486 * destination is specified.
1487 * @param node [i] The TR tag node is specified.
1488 * @return The conversion result is returned.
1491 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1498 char *attr_style = NULL;
1499 char *attr_align = NULL;
1500 char *attr_width = NULL;
1501 char *attr_height = NULL;
1502 char *attr_bgcolor = NULL;
1503 char *attr_border_width = NULL;
1504 char *attr_border_color = NULL;
1506 jxhtml = GET_JXHTML(pdoc);
1510 /*--------------------------------------------------------------------------*/
1511 /* Get Attributes */
1512 /*--------------------------------------------------------------------------*/
1513 for (attr = qs_get_attr(doc,node);
1515 attr = qs_get_next_attr(doc,attr)) {
1516 char *name = qs_get_attr_name(doc,attr);
1517 char *val = qs_get_attr_value(doc,attr);
1518 if (STRCASEEQ('a','A',"align",name)) {
1519 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1520 attr_align = apr_pstrdup(doc->buf.pool, val);
1523 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1524 attr_height = apr_pstrdup(doc->buf.pool, val);
1526 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1527 attr_width = apr_pstrdup(doc->buf.pool, val);
1529 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1530 attr_style = apr_pstrdup(doc->buf.pool, val);
1532 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1533 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1534 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1536 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1537 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1539 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1540 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1541 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1545 if (IS_CSS_ON(jxhtml->entryp)) {
1546 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1548 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1549 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1550 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1551 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1552 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1553 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1555 css_property_t *cur;
1556 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1557 char *tmp = apr_pstrdup(doc->pool, cur->value);
1558 char *tmpp = strstr(tmp, "px");
1560 size_t len = strlen(tmp) - strlen(tmpp);
1561 attr_width = apr_pstrndup(doc->pool, tmp,len);
1564 attr_width = apr_pstrdup(doc->pool, tmp);
1567 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1568 char *tmp = apr_pstrdup(doc->pool, cur->value);
1569 char *tmpp = strstr(tmp, "px");
1571 size_t len = strlen(tmp) - strlen(tmpp);
1572 attr_height = apr_pstrndup(doc->pool, tmp,len);
1575 attr_height = apr_pstrdup(doc->pool, tmp);
1578 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1579 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1580 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1583 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1584 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1585 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1587 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1588 char *tmp = apr_pstrdup(doc->pool, cur->value);
1589 char *tmpp = strstr(tmp, "px");
1591 size_t len = strlen(tmp) - strlen(tmpp);
1592 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1595 attr_border_width = apr_pstrdup(doc->pool, tmp);
1598 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1599 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1600 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1621 if (attr_bgcolor && *attr_bgcolor){
1626 if (attr_border_width || attr_border_color ){
1627 W_L(" style=\"border:");
1628 if (attr_border_width){
1629 W_V(attr_border_width);
1636 if (attr_border_color && *attr_border_color){
1638 W_V(attr_border_color);
1648 * It is a handler who processes the TABLE tag.
1650 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1651 * destination is specified.
1652 * @param node [i] The TR tag node is specified.
1653 * @return The conversion result is returned.
1656 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1662 jxhtml = GET_JXHTML(pdoc);
1672 * It is a handler who processes the TR tag.
1674 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1675 * destination is specified.
1676 * @param node [i] The TR tag node is specified.
1677 * @return The conversion result is returned.
1680 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1688 char *attr_style = NULL;
1689 char *attr_align = NULL;
1690 char *attr_valign = NULL;
1691 char *attr_bgcolor = NULL;
1693 jxhtml = GET_JXHTML(pdoc);
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);
1724 if (IS_CSS_ON(jxhtml->entryp)) {
1725 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1727 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1728 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1729 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1731 css_property_t *cur;
1732 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1733 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1734 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1737 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1738 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1739 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1742 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1743 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1744 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1760 if (attr_bgcolor && *attr_bgcolor){
1771 * It is a handler who processes the TR tag.
1773 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1774 * destination is specified.
1775 * @param node [i] The TR tag node is specified.
1776 * @return The conversion result is returned.
1779 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1785 jxhtml = GET_JXHTML(pdoc);
1794 * It is a handler who processes the TD tag.
1796 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1797 * destination is specified.
1798 * @param node [i] The TR tag node is specified.
1799 * @return The conversion result is returned.
1802 s_jxhtml_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1810 char *attr_style = NULL;
1811 char *attr_align = NULL;
1812 char *attr_valign = NULL;
1813 char *attr_bgcolor = NULL;
1814 char *attr_colspan = NULL;
1815 char *attr_rowspan = NULL;
1816 char *attr_width = NULL;
1817 char *attr_height = NULL;
1819 jxhtml = GET_JXHTML(pdoc);
1823 /*--------------------------------------------------------------------------*/
1824 /* Get Attributes */
1825 /*--------------------------------------------------------------------------*/
1826 for (attr = qs_get_attr(doc,node);
1828 attr = qs_get_next_attr(doc,attr)) {
1829 char *name = qs_get_attr_name(doc,attr);
1830 char *val = qs_get_attr_value(doc,attr);
1831 if (STRCASEEQ('a','A',"align",name)) {
1832 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1833 attr_align = apr_pstrdup(doc->buf.pool, val);
1836 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1837 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1838 attr_valign = apr_pstrdup(doc->buf.pool, val);
1841 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1842 attr_style = apr_pstrdup(doc->buf.pool, val);
1844 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1845 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1846 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1848 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1849 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1851 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1852 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1854 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1855 char *tmp = strstr(val, "%");
1857 attr_width = apr_pstrdup(doc->buf.pool, val);
1860 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1863 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1864 char *tmp = strstr(val, "%");
1866 attr_height = apr_pstrdup(doc->buf.pool, val);
1869 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1874 if (IS_CSS_ON(jxhtml->entryp)) {
1875 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1877 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1878 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1879 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1880 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1881 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1883 css_property_t *cur;
1884 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1885 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1886 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1889 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1890 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1891 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1894 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1895 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1896 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1898 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1899 attr_width = apr_pstrdup(doc->pool, cur->value);
1901 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1902 attr_height = apr_pstrdup(doc->pool, cur->value);
1929 if (attr_bgcolor && *attr_bgcolor){
1934 if (attr_width || attr_height ){
1954 * It is a handler who processes the TD tag.
1956 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1957 * destination is specified.
1958 * @param node [i] The TR tag node is specified.
1959 * @return The conversion result is returned.
1962 s_jxhtml_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1968 jxhtml = GET_JXHTML(pdoc);
1979 * It is a handler who processes the TD tag.
1981 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1982 * destination is specified.
1983 * @param node [i] The TD tag node is specified.
1984 * @return The conversion result is returned.
1987 s_jxhtml_start_td_tag(void *pdoc, Node *node)
1989 return s_jxhtml_start_td_or_th_tag(pdoc,node,"td");
1992 * It is a handler who processes the TD tag.
1994 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1995 * destination is specified.
1996 * @param node [i] The TD tag node is specified.
1997 * @return The conversion result is returned.
2000 s_jxhtml_end_td_tag(void *pdoc, Node *node)
2002 return s_jxhtml_end_td_or_th_tag(pdoc,node,"td");
2006 * It is a handler who processes the TD tag.
2008 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2009 * destination is specified.
2010 * @param node [i] The TD tag node is specified.
2011 * @return The conversion result is returned.
2014 s_jxhtml_start_th_tag(void *pdoc, Node *node)
2016 return s_jxhtml_start_td_or_th_tag(pdoc,node,"th");
2019 * It is a handler who processes the TD tag.
2021 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2022 * destination is specified.
2023 * @param node [i] The TD tag node is specified.
2024 * @return The conversion result is returned.
2027 s_jxhtml_end_th_tag(void *pdoc, Node *node)
2029 return s_jxhtml_end_td_or_th_tag(pdoc,node,"th");
2033 * It is a handler who processes the FONT tag.
2035 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2036 * destination is specified.
2037 * @param node [i] The FONT tag node is specified.
2038 * @return The conversion result is returned.
2041 s_jxhtml_start_font_tag(void *pdoc, Node *node)
2047 char *attr_color = NULL;
2048 char *attr_size = NULL;
2049 char *attr_style = NULL;
2051 jxhtml = GET_JXHTML(pdoc);
2055 /*--------------------------------------------------------------------------*/
2056 /* Get Attributes */
2057 /*--------------------------------------------------------------------------*/
2058 for (attr = qs_get_attr(doc,node);
2060 attr = qs_get_next_attr(doc,attr)) {
2061 char *name = qs_get_attr_name(doc,attr);
2062 char *value = qs_get_attr_value(doc,attr);
2063 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2064 attr_color = apr_pstrdup(doc->buf.pool, value);
2066 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2067 /*----------------------------------------------------------------------*/
2069 /*----------------------------------------------------------------------*/
2070 attr_size = apr_pstrdup(doc->buf.pool, value);
2072 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2073 attr_style = apr_pstrdup(doc->buf.pool, value);
2076 if (IS_CSS_ON(jxhtml->entryp)) {
2077 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2079 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2080 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2081 css_property_t *cur;
2082 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2083 if (cur->value && *cur->value) {
2084 attr_color = apr_pstrdup(doc->pool, cur->value);
2087 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2088 if (cur->value && *cur->value) {
2089 attr_size = apr_pstrdup(doc->pool, cur->value);
2090 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2091 attr_size = apr_pstrdup(doc->pool, "1");
2093 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2094 attr_size = apr_pstrdup(doc->pool, "2");
2096 else if (STRCASEEQ('s','S',"small",attr_size)) {
2097 attr_size = apr_pstrdup(doc->pool, "3");
2099 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2100 attr_size = apr_pstrdup(doc->pool, "4");
2102 else if (STRCASEEQ('l','L',"large",attr_size)) {
2103 attr_size = apr_pstrdup(doc->pool, "5");
2105 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2106 attr_size = apr_pstrdup(doc->pool, "6");
2108 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2109 attr_size = apr_pstrdup(doc->pool, "7");
2115 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2116 memset(flg, 0, sizeof(*flg));
2118 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2119 W_L("<font color=\"");
2122 flg->font_color_flag = 1;
2125 flg->font_size_flag = 1;
2126 switch(*attr_size) {
2127 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2128 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2129 case '3': W_L("<span style=\"font-size: small\">"); break;
2130 case '4': W_L("<span style=\"font-size: medium\">"); break;
2131 case '5': W_L("<span style=\"font-size: large\">"); break;
2132 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2133 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2135 if (*(attr_size + 1) == '1') {
2136 W_L("<span style=\"font-size: small\">");
2139 if (*(attr_size + 1) == '2') {
2140 W_L("<span style=\"font-size: x-small\">");
2143 if (*(attr_size + 1) == '3') {
2144 W_L("<span style=\"font-size: xx-small\">");
2147 flg->font_size_flag = 0;
2151 if (*(attr_size + 1) == '1') {
2152 W_L("<span style=\"font-size: large\">");
2155 if (*(attr_size + 1) == '2') {
2156 W_L("<span style=\"font-size: x-large\">");
2159 if (*(attr_size + 1) == '3') {
2160 W_L("<span style=\"font-size: xx-large\">");
2163 flg->font_size_flag = 0;
2167 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2168 flg->font_size_flag = 0;
2171 node->userData = flg;
2177 * It is a handler who processes the FONT tag.
2179 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2180 * destination is specified.
2181 * @param node [i] The FONT tag node is specified.
2182 * @return The conversion result is returned.
2185 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2191 jxhtml = GET_JXHTML(pdoc);
2195 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2196 if (flg && flg->font_size_flag) {
2199 if (flg && flg->font_color_flag) {
2202 if (IS_CSS_ON(jxhtml->entryp)) {
2203 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2211 * It is a handler who processes the FORM tag.
2213 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2214 * destination is specified.
2215 * @param node [i] The FORM tag node is specified.
2216 * @return The conversion result is returned.
2219 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2225 char *attr_action = NULL;
2226 char *attr_method = NULL;
2227 char *attr_style = NULL;
2228 char *attr_color = NULL;
2229 char *attr_align = NULL;
2230 char *attr_name = NULL;
2231 char *new_hidden_tag = NULL;
2233 jxhtml = GET_JXHTML(pdoc);
2237 /*--------------------------------------------------------------------------*/
2238 /* Get Attributes */
2239 /*--------------------------------------------------------------------------*/
2240 for (attr = qs_get_attr(doc,node);
2242 attr = qs_get_next_attr(doc,attr)) {
2243 char *name = qs_get_attr_name(doc,attr);
2244 char *value = qs_get_attr_value(doc,attr);
2248 if (strcasecmp(name, "action") == 0) {
2249 /*--------------------------------------------------------------------*/
2251 /*--------------------------------------------------------------------*/
2252 attr_action = value;
2258 if (strcasecmp(name, "method") == 0) {
2259 /*--------------------------------------------------------------------*/
2261 /*--------------------------------------------------------------------*/
2262 attr_method = value;
2268 if (strcasecmp(name, "name") == 0) {
2269 /*--------------------------------------------------------------------*/
2271 /*--------------------------------------------------------------------*/
2278 if (strcasecmp(name, "style") == 0) {
2287 if (IS_CSS_ON(jxhtml->entryp)) {
2288 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2290 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2291 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2292 css_property_t *cur;
2293 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2294 if (STRCASEEQ('l','L',"left", cur->value)) {
2295 attr_align = apr_pstrdup(doc->pool, "left");
2297 else if (STRCASEEQ('c','C',"center",cur->value)) {
2298 attr_align = apr_pstrdup(doc->pool, "center");
2300 else if (STRCASEEQ('r','R',"right",cur->value)) {
2301 attr_align = apr_pstrdup(doc->pool, "right");
2304 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2305 attr_color = apr_pstrdup(doc->pool, cur->value);
2310 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2314 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2315 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2317 char *old_qs = NULL;
2318 q = strchr(attr_action, '?');
2320 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, jxhtml->entryp);
2321 if (new_hidden_tag || old_qs) {
2345 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2346 memset(flg, 0, sizeof(*flg));
2348 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2349 W_L("<font color=\"");
2352 flg->with_font_flag = 1;
2355 W_L("<div align=\"");
2358 flg->with_div_flag = 1;
2360 node->userData = flg;
2361 if (new_hidden_tag) {
2362 W_V(new_hidden_tag);
2369 * It is a handler who processes the FORM tag.
2371 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2372 * destination is specified.
2373 * @param node [i] The FORM tag node is specified.
2374 * @return The conversion result is returned.
2377 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2379 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2380 Doc *doc = jxhtml->doc;
2382 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2383 if (flg && flg->with_div_flag) {
2386 if (flg && flg->with_font_flag) {
2390 if (IS_CSS_ON(jxhtml->entryp)) {
2391 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2399 * It is a handler who processes the INPUT tag.
2401 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2402 * destination is specified.
2403 * @param node [i] The INPUT tag node is specified.
2404 * @return The conversion result is returned.
2407 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2413 char *attr_accesskey = NULL;
2414 char *attr_max_length = NULL;
2415 char *attr_type = NULL;
2416 char *attr_name = NULL;
2417 char *attr_value = NULL;
2418 char *attr_istyle = NULL;
2419 char *attr_size = NULL;
2420 char *attr_checked = NULL;
2421 char *attr_style = NULL;
2423 jxhtml = GET_JXHTML(pdoc);
2427 /*--------------------------------------------------------------------------*/
2428 /* Get Attributes */
2429 /*--------------------------------------------------------------------------*/
2430 for (attr = qs_get_attr(doc,node);
2432 attr = qs_get_next_attr(doc,attr)) {
2433 char *name = qs_get_attr_name(doc,attr);
2434 char *value = qs_get_attr_value(doc,attr);
2435 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2436 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2437 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2438 STRCASEEQ('p','P',"password",tmp_type) ||
2439 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2440 STRCASEEQ('r','R',"radio", tmp_type) ||
2441 STRCASEEQ('h','H',"hidden", tmp_type) ||
2442 STRCASEEQ('s','S',"submit", tmp_type) ||
2443 STRCASEEQ('r','R',"reset", tmp_type))) {
2444 attr_type = tmp_type;
2447 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2450 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2453 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2454 attr_istyle = value;
2456 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2457 attr_max_length = value;
2459 else if (STRCASEEQ('c','C',"checked", name)) {
2460 attr_checked = value;
2462 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2463 attr_accesskey = value;
2465 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2468 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2473 if (IS_CSS_ON(jxhtml->entryp)) {
2474 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2476 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2477 css_property_t *cur;
2478 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2479 if (strcasestr(cur->value, "<ja:n>")) {
2482 else if (strcasestr(cur->value, "<ja:en>")) {
2485 else if (strcasestr(cur->value, "<ja:hk>")) {
2488 else if (strcasestr(cur->value, "<ja:h>")) {
2508 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2513 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2516 if (attr_accesskey) {
2517 W_L(" accesskey=\"");
2518 W_V(attr_accesskey);
2521 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2526 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2527 W_L(" istyle=\"4\"");
2529 /*--------------------------------------------------------------------------*/
2530 /* The figure is default for the password. */
2531 /*--------------------------------------------------------------------------*/
2532 if (attr_max_length && *attr_max_length) {
2533 if (chxj_chk_numeric(attr_max_length) == 0) {
2534 W_L(" maxlength=\"");
2535 W_V(attr_max_length);
2540 W_L(" checked=\"checked\"");
2556 jxhtml = GET_JXHTML(pdoc);
2569 /*--------------------------------------------------------------------------*/
2570 /* Get Attributes */
2571 /*--------------------------------------------------------------------------*/
2572 type = qs_get_type_attr(doc, node, doc->buf.pool);
2573 name = qs_get_name_attr(doc, node, doc->buf.pool);
2574 value = qs_get_value_attr(doc,node, doc->buf.pool);
2575 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2576 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2577 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2578 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2579 size = qs_get_size_attr(doc, node, doc->buf.pool);
2582 if (type && (STRCASEEQ('t','T',"text", type) ||
2583 STRCASEEQ('p','P',"password",type) ||
2584 STRCASEEQ('c','C',"checkbox",type) ||
2585 STRCASEEQ('r','R',"radio", type) ||
2586 STRCASEEQ('h','H',"hidden", type) ||
2587 STRCASEEQ('s','S',"submit", type) ||
2588 STRCASEEQ('r','R',"reset", type))) {
2594 if (size && *size) {
2599 if (name && *name) {
2601 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2604 if (value && *value) {
2605 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2606 apr_size_t value_len = strlen(value);
2607 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2611 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2614 if (accesskey && *accesskey) {
2615 W_L(" accesskey=\"");
2619 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2620 /*------------------------------------------------------------------------*/
2622 /*------------------------------------------------------------------------*/
2623 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2624 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2627 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2629 W_L("-wap-input-format:'*");
2635 else if (type && STRCASEEQ('p','P',"password",type)) {
2636 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2638 /*--------------------------------------------------------------------------*/
2639 /* The figure is default for the password. */
2640 /*--------------------------------------------------------------------------*/
2641 if (max_length && *max_length) {
2642 if (chxj_chk_numeric(max_length) == 0) {
2643 W_L(" maxlength=\"");
2650 W_L(" checked=\"checked\"");
2659 * It is a handler who processes the INPUT tag.
2661 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2662 * destination is specified.
2663 * @param node [i] The INPUT tag node is specified.
2664 * @return The conversion result is returned.
2667 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2669 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2675 * It is a handler who processes the CENTER tag.
2677 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2678 * destination is specified.
2679 * @param node [i] The CENTER tag node is specified.
2680 * @return The conversion result is returned.
2683 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2688 char *attr_style = NULL;
2689 char *attr_color = NULL;
2690 char *attr_size = NULL;
2692 jxhtml = GET_JXHTML(pdoc);
2695 for (attr = qs_get_attr(doc,node);
2697 attr = qs_get_next_attr(doc,attr)) {
2698 char *name = qs_get_attr_name(doc,attr);
2699 char *value = qs_get_attr_value(doc,attr);
2700 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2704 if (IS_CSS_ON(jxhtml->entryp)) {
2705 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2707 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2708 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2709 css_property_t *cur;
2710 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2711 if (cur->value && *cur->value) {
2712 attr_color = apr_pstrdup(doc->pool, cur->value);
2715 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2716 if (cur->value && *cur->value) {
2717 attr_size = apr_pstrdup(doc->pool, cur->value);
2724 if (attr_size || attr_color) {
2732 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2746 * It is a handler who processes the CENTER tag.
2748 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2749 * destination is specified.
2750 * @param node [i] The CENTER tag node is specified.
2751 * @return The conversion result is returned.
2754 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2760 jxhtml = GET_JXHTML(pdoc);
2765 if (IS_CSS_ON(jxhtml->entryp)) {
2766 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2773 * It is a handler who processes the li tag.
2775 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2776 * destination is specified.
2777 * @param node [i] The li tag node is specified.
2778 * @return The conversion result is returned.
2781 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2787 char *attr_type = NULL;
2788 char *attr_value = NULL;
2789 char *attr_style = NULL;
2791 jxhtml = GET_JXHTML(pdoc);
2795 for (attr = qs_get_attr(doc,node);
2797 attr = qs_get_next_attr(doc,attr)) {
2798 char *name = qs_get_attr_name(doc,attr);
2799 char *value = qs_get_attr_value(doc,attr);
2800 if (STRCASEEQ('t','T',"type",name)) {
2801 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2802 if (*value == '1') {
2803 attr_type = apr_pstrdup(doc->pool, "decimal");
2805 else if (*value == 'a') {
2806 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2808 else if (*value == 'A') {
2809 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2816 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2819 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2823 if (IS_CSS_ON(jxhtml->entryp)) {
2824 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2826 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2827 css_property_t *cur;
2828 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2829 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2830 attr_type = apr_pstrdup(doc->pool, "decimal");
2832 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2833 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2835 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2836 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2838 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2839 attr_type = apr_pstrdup(doc->pool, "disc");
2841 else if (STRCASEEQ('s','S',"square", cur->value)) {
2842 attr_type = apr_pstrdup(doc->pool, "square");
2844 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2845 attr_type = apr_pstrdup(doc->pool, "circle");
2855 W_L("list-style-type:");
2871 * It is a handler who processes the li tag.
2873 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2874 * destination is specified.
2875 * @param node [i] The li tag node is specified.
2876 * @return The conversion result is returned.
2879 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2885 jxhtml = GET_JXHTML(pdoc);
2889 if (IS_CSS_ON(jxhtml->entryp)) {
2890 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2898 * It is a handler who processes the OL tag.
2900 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2901 * destination is specified.
2902 * @param node [i] The OL tag node is specified.
2903 * @return The conversion result is returned.
2906 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2912 char *attr_style = NULL;
2913 char *attr_start = NULL;
2914 char *attr_type = NULL;
2916 jxhtml = GET_JXHTML(pdoc);
2920 /*--------------------------------------------------------------------------*/
2921 /* Get Attributes */
2922 /*--------------------------------------------------------------------------*/
2923 for (attr = qs_get_attr(doc,node);
2925 attr = qs_get_next_attr(doc,attr)) {
2926 char *name = qs_get_attr_name(doc,attr);
2927 char *value = qs_get_attr_value(doc,attr);
2928 if (STRCASEEQ('t','T',"type",name) && value) {
2929 if (*value == '1') {
2930 attr_type = apr_pstrdup(doc->pool, "decimal");
2932 else if (*value == 'a') {
2933 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2935 else if (*value == 'A') {
2936 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2939 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2942 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2946 if (IS_CSS_ON(jxhtml->entryp)) {
2947 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2949 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2950 css_property_t *cur;
2951 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2952 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2953 attr_type = apr_pstrdup(doc->pool, "decimal");
2955 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2956 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2958 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2959 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2967 W_L("list-style-type:");
2984 * It is a handler who processes the OL tag.
2986 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2987 * destination is specified.
2988 * @param node [i] The OL tag node is specified.
2989 * @return The conversion result is returned.
2992 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2998 jxhtml = GET_JXHTML(pdoc);
3003 if (IS_CSS_ON(jxhtml->entryp)) {
3004 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3011 * It is a handler who processes the P tag.
3013 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3014 * destination is specified.
3015 * @param node [i] The P tag node is specified.
3016 * @return The conversion result is returned.
3019 s_jxhtml_start_p_tag(void *pdoc, Node *node)
3025 char *attr_align = NULL;
3026 char *attr_style = NULL;
3027 char *attr_color = NULL;
3028 char *attr_blink = NULL;
3029 char *css_clear = NULL;
3031 jxhtml = GET_JXHTML(pdoc);
3035 for (attr = qs_get_attr(doc,node);
3037 attr = qs_get_next_attr(doc,attr)) {
3038 char *nm = qs_get_attr_name(doc,attr);
3039 char *val = qs_get_attr_value(doc,attr);
3040 if (STRCASEEQ('a','A',"align", nm)) {
3041 /*----------------------------------------------------------------------*/
3042 /* CHTML 1.0 (W3C version 3.2) */
3043 /*----------------------------------------------------------------------*/
3044 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3045 attr_align = apr_pstrdup(doc->buf.pool, val);
3049 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3050 attr_style = apr_pstrdup(doc->buf.pool, val);
3053 if (IS_CSS_ON(jxhtml->entryp)) {
3054 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3056 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3057 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3058 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3059 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3060 css_property_t *cur;
3061 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3062 if (STRCASEEQ('l','L',"left",cur->value)) {
3063 attr_align = apr_pstrdup(doc->pool, "left");
3065 else if (STRCASEEQ('c','C',"center",cur->value)) {
3066 attr_align = apr_pstrdup(doc->pool, "center");
3068 else if (STRCASEEQ('r','R',"right",cur->value)) {
3069 attr_align = apr_pstrdup(doc->pool, "right");
3072 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3073 if (cur->value && *cur->value) {
3074 attr_color = apr_pstrdup(doc->pool, cur->value);
3077 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3078 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3079 attr_blink = apr_pstrdup(doc->pool, cur->value);
3082 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3083 css_clear = apr_pstrdup(doc->pool, cur->value);
3088 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3096 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3102 W_L("text-decoration:");
3119 * It is a handler who processes the P tag.
3121 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3122 * destination is specified.
3123 * @param node [i] The P tag node is specified.
3124 * @return The conversion result is returned.
3127 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3129 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3130 Doc *doc = jxhtml->doc;
3133 if (IS_CSS_ON(jxhtml->entryp)) {
3134 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3141 * It is a handler who processes the PRE tag.
3143 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3144 * destination is specified.
3145 * @param node [i] The PRE tag node is specified.
3146 * @return The conversion result is returned.
3149 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3151 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3152 Doc *doc = jxhtml->doc;
3154 char *attr_style = NULL;
3156 for (attr = qs_get_attr(doc,node);
3158 attr = qs_get_next_attr(doc,attr)) {
3159 char *nm = qs_get_attr_name(doc,attr);
3160 char *val = qs_get_attr_value(doc,attr);
3161 if (val && STRCASEEQ('s','S',"style", nm)) {
3166 if (IS_CSS_ON(jxhtml->entryp)) {
3167 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3177 * It is a handler who processes the PRE tag.
3179 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3180 * destination is specified.
3181 * @param node [i] The PRE tag node is specified.
3182 * @return The conversion result is returned.
3185 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3187 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3188 Doc *doc = jxhtml->doc;
3192 if (IS_CSS_ON(jxhtml->entryp)) {
3193 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3201 * It is a handler who processes the UL tag.
3203 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3204 * destination is specified.
3205 * @param node [i] The UL tag node is specified.
3206 * @return The conversion result is returned.
3209 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3211 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3212 Doc *doc = jxhtml->doc;
3214 char *attr_type = NULL;
3215 char *attr_style = NULL;
3216 /*--------------------------------------------------------------------------*/
3217 /* Get Attributes */
3218 /*--------------------------------------------------------------------------*/
3219 for (attr = qs_get_attr(doc,node);
3221 attr = qs_get_next_attr(doc,attr)) {
3222 char *name = qs_get_attr_name(doc,attr);
3223 char *value = qs_get_attr_value(doc,attr);
3224 if (STRCASEEQ('t','T',"type",name)) {
3225 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3229 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3233 if (IS_CSS_ON(jxhtml->entryp)) {
3234 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3236 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3237 css_property_t *cur;
3238 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3239 if (STRCASEEQ('d','D',"disc",cur->value)) {
3240 attr_type = apr_pstrdup(doc->pool, "disc");
3242 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3243 attr_type = apr_pstrdup(doc->pool, "circle");
3245 else if (STRCASEEQ('s','S',"square",cur->value)) {
3246 attr_type = apr_pstrdup(doc->pool, "square");
3254 W_L("list-style-type:");
3265 * It is a handler who processes the UL tag.
3267 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3268 * destination is specified.
3269 * @param node [i] The UL tag node is specified.
3270 * @return The conversion result is returned.
3273 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3275 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3276 Doc *doc = jxhtml->doc;
3279 if (IS_CSS_ON(jxhtml->entryp)) {
3280 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3287 * It is a handler who processes the HR tag.
3289 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3290 * destination is specified.
3291 * @param node [i] The HR tag node is specified.
3292 * @return The conversion result is returned.
3295 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3301 char *attr_align = NULL;
3302 char *attr_size = NULL;
3303 char *attr_width = NULL;
3304 char *attr_noshade = NULL;
3305 char *attr_style = NULL;
3306 char *attr_color = NULL;
3308 char *style_float = NULL;
3309 char *style_border_color = NULL;
3311 jxhtml = GET_JXHTML(pdoc);
3315 for (attr = qs_get_attr(doc,node);
3317 attr = qs_get_next_attr(doc,attr)) {
3318 char *name = qs_get_attr_name (doc,attr);
3319 char *value = qs_get_attr_value(doc,attr);
3323 if (strcasecmp(name, "align") == 0) {
3324 /*--------------------------------------------------------------------*/
3326 /*--------------------------------------------------------------------*/
3327 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3335 if (strcasecmp(name, "size") == 0) {
3336 /*--------------------------------------------------------------------*/
3338 /*--------------------------------------------------------------------*/
3339 if (value && *value) {
3343 else if (strcasecmp(name, "style") == 0) {
3344 if (value && *value) {
3352 if (strcasecmp(name, "width") == 0) {
3353 /*--------------------------------------------------------------------*/
3355 /*--------------------------------------------------------------------*/
3356 if (value && *value) {
3364 if (strcasecmp(name, "noshade") == 0) {
3365 /*--------------------------------------------------------------------*/
3367 /*--------------------------------------------------------------------*/
3368 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3374 if (strcasecmp(name, "color") == 0 && value && *value) {
3375 /*--------------------------------------------------------------------*/
3377 /*--------------------------------------------------------------------*/
3386 if (IS_CSS_ON(jxhtml->entryp)) {
3387 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3389 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3390 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3391 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3393 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3394 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3395 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3396 css_property_t *cur;
3398 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3399 if (STRCASEEQ('s','S',"solid",cur->value)) {
3400 attr_noshade = "noshade";
3403 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3404 char *tmp = apr_pstrdup(doc->pool, cur->value);
3405 char *tmpp = strstr(tmp, "px");
3407 attr_size = apr_pstrdup(doc->pool, tmp);
3411 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3412 char *tmp = apr_pstrdup(doc->pool,cur->value);
3413 attr_color = apr_pstrdup(doc->pool,tmp);
3416 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3417 char *tmp = apr_pstrdup(doc->pool, cur->value);
3418 char *tmpp = strstr(tmp,"none");
3420 style_float = "center";
3423 style_float = apr_pstrdup(doc->pool,tmp);
3428 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3429 char *tmp = apr_pstrdup(doc->pool, cur->value);
3430 char *tmpp = strstr(tmp, "px");
3432 attr_width = apr_pstrdup(doc->pool, tmp);
3435 tmpp = strstr(tmp, "%");
3437 attr_width = apr_pstrdup(doc->pool, tmp);
3442 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3443 char *tmp = apr_pstrdup(doc->pool, cur->value);
3445 style_border_color = apr_pstrdup(doc->pool, tmp);
3463 if (attr_size || attr_width || attr_noshade || style_border_color) {
3468 if (!strstr(attr_size, "px")) {
3476 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3482 W_L("border-style:solid;");
3484 if(style_border_color){
3485 W_L("border-color:");
3486 W_V(style_border_color);
3504 * It is a handler who processes the HR tag.
3506 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3507 * destination is specified.
3508 * @param node [i] The HR tag node is specified.
3509 * @return The conversion result is returned.
3512 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3514 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3520 * It is a handler who processes the IMG tag.
3522 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3523 * destination is specified.
3524 * @param node [i] The IMG tag node is specified.
3525 * @return The conversion result is returned.
3528 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3530 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3531 Doc *doc = jxhtml->doc;
3532 request_rec *r = doc->r;
3534 char *attr_src = NULL;
3535 char *attr_height = NULL;
3536 char *attr_width = NULL;
3537 char *attr_align = NULL;
3538 char *attr_alt = NULL;
3539 char *attr_style = NULL;
3540 char *attr_hspace = NULL;
3541 char *attr_vspace = NULL;
3543 char *css_float = NULL;
3544 char *css_margin_left = NULL;
3545 char *css_margin_right = NULL;
3546 char *css_margin_top = NULL;
3547 char *css_margin_bottom = NULL;
3548 char *css_display = NULL;
3549 char *css_valign = NULL;
3551 #ifndef IMG_NOT_CONVERT_FILENAME
3552 device_table *spec = jxhtml->spec;
3555 /*--------------------------------------------------------------------------*/
3556 /* Get Attributes */
3557 /*--------------------------------------------------------------------------*/
3558 for (attr = qs_get_attr(doc,node);
3560 attr = qs_get_next_attr(doc,attr)) {
3561 char *name = qs_get_attr_name(doc,attr);
3562 char *value = qs_get_attr_value(doc,attr);
3563 if (STRCASEEQ('s','S',"src",name)) {
3564 /*----------------------------------------------------------------------*/
3566 /*----------------------------------------------------------------------*/
3567 #ifdef IMG_NOT_CONVERT_FILENAME
3568 value = chxj_encoding_parameter(r, value, 1);
3569 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3570 value = chxj_add_cookie_no_update_parameter(r, value);
3573 value = chxj_img_conv(r, spec, value);
3574 value = chxj_encoding_parameter(r, value, 1);
3575 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3576 value = chxj_add_cookie_no_update_parameter(r, value);
3580 else if (STRCASEEQ('a','A',"align",name)) {
3581 /*----------------------------------------------------------------------*/
3583 /*----------------------------------------------------------------------*/
3585 if (STRCASEEQ('t','T',"top", value) ||
3586 STRCASEEQ('m','M',"middle",value) ||
3587 STRCASEEQ('b','B',"bottom",value)){
3589 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3592 else if (STRCASEEQ('c','C',"center",value)) {
3593 css_valign = apr_pstrdup(doc->pool, "middle");
3597 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3598 /*----------------------------------------------------------------------*/
3600 /*----------------------------------------------------------------------*/
3603 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3604 /*----------------------------------------------------------------------*/
3606 /*----------------------------------------------------------------------*/
3607 attr_height = value;
3609 else if (STRCASEEQ('h','H',"hspace",name)) {
3610 /*----------------------------------------------------------------------*/
3612 /*----------------------------------------------------------------------*/
3613 attr_hspace = value;
3615 else if (STRCASEEQ('v','V',"vspace",name)) {
3616 /*----------------------------------------------------------------------*/
3618 /*----------------------------------------------------------------------*/
3619 attr_vspace = value;
3621 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3622 /*----------------------------------------------------------------------*/
3624 /*----------------------------------------------------------------------*/
3627 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3628 /*----------------------------------------------------------------------*/
3630 /*----------------------------------------------------------------------*/
3635 if (IS_CSS_ON(jxhtml->entryp)) {
3636 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3638 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3639 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3640 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3641 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3642 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3643 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3644 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3647 css_property_t *cur;
3648 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3649 attr_height = apr_pstrdup(doc->pool, cur->value);
3651 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3652 attr_width = apr_pstrdup(doc->pool, cur->value);
3655 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3656 css_valign = apr_pstrdup(doc->pool, cur->value);
3659 if (! attr_hspace) {
3660 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3661 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3663 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3664 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3667 if (! attr_vspace) {
3668 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3669 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3671 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3672 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3676 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3677 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3678 css_float = apr_pstrdup(doc->pool, cur->value);
3682 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3683 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3684 char *tmp = apr_pstrdup(doc->pool, cur->value);
3685 char *tmpp = strstr(tmp, "none");
3687 css_display = apr_pstrdup(doc->pool, tmp);
3699 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3707 W_L("vertical-align:");
3712 W_L("margin-left:");
3715 W_L("margin-right:");
3720 if(css_margin_left){
3721 W_L("margin-left:");
3722 W_V(css_margin_left);
3725 if(css_margin_right){
3726 W_L("margin-right:");
3727 W_V(css_margin_right);
3735 W_L("margin-bottom:");
3742 W_V(css_margin_top);
3745 if(css_margin_bottom){
3746 W_L("margin-bottom:");
3747 W_V(css_margin_bottom);
3752 W_L("display:none;");
3781 * It is a handler who processes the IMG tag.
3783 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3784 * destination is specified.
3785 * @param node [i] The IMG tag node is specified.
3786 * @return The conversion result is returned.
3789 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3791 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3797 * It is a handler who processes the SELECT tag.
3799 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3800 * destination is specified.
3801 * @param node [i] The SELECT tag node is specified.
3802 * @return The conversion result is returned.
3805 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3807 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3808 Doc *doc = jxhtml->doc;
3812 char *multiple = NULL;
3813 char *attr_style = NULL;
3816 for (attr = qs_get_attr(doc,node);
3818 attr = qs_get_next_attr(doc,attr)) {
3819 char *nm = qs_get_attr_name(doc,attr);
3820 char *val = qs_get_attr_value(doc,attr);
3821 if (STRCASEEQ('s','S',"size",nm)) {
3822 /*----------------------------------------------------------------------*/
3823 /* CHTML 1.0 version 2.0 */
3824 /*----------------------------------------------------------------------*/
3825 size = apr_pstrdup(doc->buf.pool, val);
3827 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3828 /*----------------------------------------------------------------------*/
3829 /* CHTML 1.0 version 2.0 */
3830 /*----------------------------------------------------------------------*/
3831 attr_style = apr_pstrdup(doc->buf.pool, val);
3833 else if (STRCASEEQ('n','N',"name",nm)) {
3834 /*----------------------------------------------------------------------*/
3835 /* CHTML 1.0 version 2.0 */
3836 /*----------------------------------------------------------------------*/
3837 name = apr_pstrdup(doc->buf.pool, val);
3839 else if (STRCASEEQ('m','M',"multiple", nm)) {
3840 /*----------------------------------------------------------------------*/
3841 /* CHTML 1.0 version 2.0 */
3842 /*----------------------------------------------------------------------*/
3843 multiple = apr_pstrdup(doc->buf.pool, val);
3846 if (size && *size) {
3851 if (name && *name) {
3861 if (IS_CSS_ON(jxhtml->entryp)) {
3862 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3870 * It is a handler who processes the SELECT tag.
3872 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3873 * destination is specified.
3874 * @param node [i] The SELECT tag node is specified.
3875 * @return The conversion result is returned.
3878 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3880 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3881 Doc *doc = jxhtml->doc;
3884 if (IS_CSS_ON(jxhtml->entryp)) {
3885 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3892 * It is a handler who processes the OPTION tag.
3894 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3895 * destination is specified.
3896 * @param node [i] The OPTION tag node is specified.
3897 * @return The conversion result is returned.
3900 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3902 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3903 Doc *doc = jxhtml->doc;
3906 char *selected = NULL;
3908 char *attr_style = NULL;
3911 for (attr = qs_get_attr(doc,node);
3913 attr = qs_get_next_attr(doc,attr)) {
3914 char *nm = qs_get_attr_name(doc,attr);
3915 char *val = qs_get_attr_value(doc,attr);
3916 if (STRCASEEQ('s','S',"selected",nm)) {
3917 /*----------------------------------------------------------------------*/
3918 /* CHTML 1.0 version 2.0 */
3919 /*----------------------------------------------------------------------*/
3920 selected = apr_pstrdup(doc->buf.pool, val);
3922 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3923 /*----------------------------------------------------------------------*/
3924 /* CHTML 1.0 version 2.0 */
3925 /*----------------------------------------------------------------------*/
3926 attr_style = apr_pstrdup(doc->buf.pool, val);
3928 else if (STRCASEEQ('v','V',"value",nm)) {
3929 /*----------------------------------------------------------------------*/
3930 /* CHTML 1.0 version 2.0 */
3931 /*----------------------------------------------------------------------*/
3932 value = apr_pstrdup(doc->buf.pool, val);
3945 if (IS_CSS_ON(jxhtml->entryp)) {
3946 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3954 * It is a handler who processes the OPTION tag.
3956 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3957 * destination is specified.
3958 * @param node [i] The OPTION tag node is specified.
3959 * @return The conversion result is returned.
3962 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3964 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3965 Doc *doc = jxhtml->doc;
3968 if (IS_CSS_ON(jxhtml->entryp)) {
3969 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3977 * It is a handler who processes the DIV tag.
3979 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3980 * destination is specified.
3981 * @param node [i] The DIV tag node is specified.
3982 * @return The conversion result is returned.
3985 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3991 char *attr_style = NULL;
3992 char *attr_align = NULL;
3993 char *attr_display = NULL;
3994 char *attr_decoration = NULL;
3995 char *attr_wap_marquee_style = NULL;
3996 char *attr_wap_marquee_dir = NULL;
3997 char *attr_wap_marquee_loop = NULL;
3998 char *attr_color = NULL;
3999 char *attr_bgcolor = NULL;
4000 char *attr_font_size = NULL;
4001 char *css_clear = NULL;
4003 jxhtml = GET_JXHTML(pdoc);
4007 for (attr = qs_get_attr(doc,node);
4009 attr = qs_get_next_attr(doc,attr)) {
4010 char *nm = qs_get_attr_name(doc,attr);
4011 char *val = qs_get_attr_value(doc,attr);
4012 if (STRCASEEQ('a','A',"align",nm)) {
4013 /*----------------------------------------------------------------------*/
4014 /* CHTML 1.0 (W3C version 3.2) */
4015 /*----------------------------------------------------------------------*/
4016 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4017 attr_align = apr_pstrdup(doc->buf.pool, val);
4020 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4021 attr_style = apr_pstrdup(doc->buf.pool, val);
4025 if (IS_CSS_ON(jxhtml->entryp)) {
4026 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4028 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4029 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4030 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4031 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4032 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4033 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4034 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4035 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4037 css_property_t *cur;
4038 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4039 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4040 attr_display = apr_pstrdup(doc->pool, cur->value);
4043 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4044 if (STRCASEEQ('b','B',"blink", cur->value)) {
4045 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4048 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4049 attr_color = apr_pstrdup(doc->pool, cur->value);
4051 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4052 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4053 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4055 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4056 char *ss = strchr(cur->value, '#');
4058 ss = strstr(cur->value, "rgb");
4061 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4062 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4065 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4066 attr_align = apr_pstrdup(doc->pool, cur->value);
4068 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4069 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4070 || STRCASEEQ('x','X',"x-small",cur->value)
4071 || STRCASEEQ('s','S',"small",cur->value)
4072 || STRCASEEQ('m','M',"medium",cur->value)
4073 || STRCASEEQ('l','L',"large",cur->value)
4074 || STRCASEEQ('x','X',"x-large",cur->value)
4075 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4076 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4080 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4081 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4082 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4083 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4084 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4085 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4088 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4089 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4090 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4092 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4093 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4096 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4097 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4098 attr_wap_marquee_loop = "infinite";
4101 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4105 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4106 css_clear = apr_pstrdup(doc->pool, cur->value);
4114 || attr_wap_marquee_style
4115 || attr_wap_marquee_dir
4116 || attr_wap_marquee_loop
4132 if (attr_decoration) {
4133 W_L("text-decoration:");
4134 W_V(attr_decoration);
4137 if (attr_wap_marquee_style) {
4138 W_L("-wap-marquee-style:");
4139 W_V(attr_wap_marquee_style);
4142 if (attr_wap_marquee_dir) {
4143 W_L("-wap-marquee-dir:");
4144 W_V(attr_wap_marquee_dir);
4147 if (attr_wap_marquee_loop) {
4148 W_L("-wap-marquee-loop:");
4149 W_V(attr_wap_marquee_loop);
4158 W_L("background-color:");
4162 if (attr_font_size) {
4164 W_V(attr_font_size);
4180 * It is a handler who processes the DIV tag.
4182 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4183 * destination is specified.
4184 * @param node [i] The DIV tag node is specified.
4185 * @return The conversion result is returned.
4188 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4194 jxhtml = GET_JXHTML(pdoc);
4199 if (IS_CSS_ON(jxhtml->entryp)) {
4200 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4207 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4214 jxhtml = GET_JXHTML(pdoc);
4218 for (child = qs_get_child_node(doc, node);
4220 child = qs_get_next_node(doc, child)) {
4222 s_jxhtml_chxjif_tag(jxhtml, child);
4229 * It is a handler who processes the TEXTARE tag.
4231 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4232 * destination is specified.
4233 * @param node [i] The TEXTAREA tag node is specified.
4234 * @return The conversion result is returned.
4237 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4243 char *attr_accesskey = NULL;
4244 char *attr_name = NULL;
4245 char *attr_rows = NULL;
4246 char *attr_cols = NULL;
4247 char *attr_istyle = NULL;
4248 char *attr_style = NULL;
4251 jxhtml = GET_JXHTML(pdoc);
4255 jxhtml->textarea_flag++;
4256 for (attr = qs_get_attr(doc,node);
4258 attr = qs_get_next_attr(doc,attr)) {
4259 char *name = qs_get_attr_name(doc,attr);
4260 char *value = qs_get_attr_value(doc,attr);
4261 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4262 attr_accesskey = value;
4264 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4265 attr_istyle = value;
4267 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4270 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4273 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4276 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4280 if (IS_CSS_ON(jxhtml->entryp)) {
4281 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4283 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4284 css_property_t *cur;
4285 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4286 if (strcasestr(cur->value, "<ja:n>")) {
4289 else if (strcasestr(cur->value, "<ja:en>")) {
4292 else if (strcasestr(cur->value, "<ja:hk>")) {
4295 else if (strcasestr(cur->value, "<ja:h>")) {
4302 if (attr_accesskey) {
4303 W_L(" accesskey=\"");
4304 W_V(attr_accesskey);
4333 * It is a handler who processes the TEXTAREA tag.
4335 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4336 * destination is specified.
4337 * @param node [i] The TEXTAREA tag node is specified.
4338 * @return The conversion result is returned.
4341 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4347 jxhtml = GET_JXHTML(pdoc);
4352 jxhtml->textarea_flag--;
4359 * It is a handler who processes the B tag.
4361 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4362 * destination is specified.
4363 * @param node [i] The B tag node is specified.
4364 * @return The conversion result is returned.
4367 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4373 jxhtml = GET_JXHTML(pdoc);
4383 * It is a handler who processes the B tag.
4385 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4386 * destination is specified.
4387 * @param node [i] The B tag node is specified.
4388 * @return The conversion result is returned.
4391 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4393 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4394 Doc* doc = jxhtml->doc;
4401 s_jxhtml_text_tag(void* pdoc, Node* child)
4412 apr_size_t z2h_input_len;
4414 jxhtml = GET_JXHTML(pdoc);
4418 textval = qs_get_node_value(doc,child);
4419 if (strlen(textval) == 0) {
4423 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4424 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4426 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4427 memset(one_byte, 0, sizeof(one_byte));
4430 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4432 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4434 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4439 if (is_sjis_kanji(textval[ii])) {
4440 one_byte[0] = textval[ii+0];
4441 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4442 one_byte[0] = textval[ii+1];
4443 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4447 if (jxhtml->pre_flag) {
4448 one_byte[0] = textval[ii+0];
4449 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4452 if (jxhtml->textarea_flag) {
4453 one_byte[0] = textval[ii+0];
4454 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4457 if (textval[ii] != '\r' && textval[ii] != '\n') {
4458 one_byte[0] = textval[ii+0];
4459 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4463 z2h_input_len = strlen(tdst);
4464 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4472 * It is a handler who processes the BLOCKQUOTE tag.
4474 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4475 * destination is specified.
4476 * @param node [i] The BLOCKQUOTE tag node is specified.
4477 * @return The conversion result is returned.
4480 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4485 char *attr_style = NULL;
4486 char *attr_color = NULL;
4487 char *attr_size = NULL;
4489 jxhtml = GET_JXHTML(pdoc);
4491 for (attr = qs_get_attr(doc,node);
4493 attr = qs_get_next_attr(doc,attr)) {
4494 char *nm = qs_get_attr_name(doc,attr);
4495 char *val = qs_get_attr_value(doc,attr);
4496 if (val && STRCASEEQ('s','S',"style", nm)) {
4500 if (IS_CSS_ON(jxhtml->entryp)) {
4501 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4503 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4504 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4505 css_property_t *cur;
4506 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4507 if (cur->value && *cur->value) {
4508 attr_color = apr_pstrdup(doc->pool, cur->value);
4511 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4512 if (cur->value && *cur->value) {
4513 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4514 attr_size = apr_pstrdup(doc->pool, cur->value);
4516 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4517 attr_size = apr_pstrdup(doc->pool, cur->value);
4519 else if (STRCASEEQ('s','S',"small",cur->value)) {
4520 attr_size = apr_pstrdup(doc->pool, cur->value);
4522 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4523 attr_size = apr_pstrdup(doc->pool, cur->value);
4525 else if (STRCASEEQ('l','L',"large",cur->value)) {
4526 attr_size = apr_pstrdup(doc->pool, cur->value);
4528 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4529 attr_size = apr_pstrdup(doc->pool, cur->value);
4531 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4532 attr_size = apr_pstrdup(doc->pool, cur->value);
4539 if (attr_color || attr_size) {
4542 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4560 * It is a handler who processes the BLOCKQUOTE tag.
4562 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4563 * destination is specified.
4564 * @param node [i] The BLOCKQUOTE tag node is specified.
4565 * @return The conversion result is returned.
4568 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4570 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4571 Doc *doc = jxhtml->doc;
4572 W_L("</blockquote>");
4573 if (IS_CSS_ON(jxhtml->entryp)) {
4574 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4581 * It is a handler who processes the DIR tag.
4583 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4584 * destination is specified.
4585 * @param node [i] The DIR tag node is specified.
4586 * @return The conversion result is returned.
4589 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4591 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4592 Doc *doc = jxhtml->doc;
4594 char *attr_style = NULL;
4595 char *attr_color = NULL;
4596 char *attr_type = NULL;
4597 char *attr_size = NULL;
4598 for (attr = qs_get_attr(doc,node);
4600 attr = qs_get_next_attr(doc,attr)) {
4601 char *name = qs_get_attr_name(doc,attr);
4602 char *value = qs_get_attr_value(doc,attr);
4603 if (STRCASEEQ('t','T',"type",name)) {
4604 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4608 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4612 if (IS_CSS_ON(jxhtml->entryp)) {
4613 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4615 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4616 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4617 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4618 css_property_t *cur;
4619 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4620 if (cur->value && *cur->value) {
4621 attr_color = apr_pstrdup(doc->pool, cur->value);
4624 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4625 if (cur->value && *cur->value) {
4626 attr_type = apr_pstrdup(doc->pool, cur->value);
4629 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4630 if (cur->value && *cur->value) {
4631 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4632 attr_size = apr_pstrdup(doc->pool, cur->value);
4634 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4635 attr_size = apr_pstrdup(doc->pool, cur->value);
4637 else if (STRCASEEQ('s','S',"small",cur->value)) {
4638 attr_size = apr_pstrdup(doc->pool, cur->value);
4640 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4641 attr_size = apr_pstrdup(doc->pool, cur->value);
4643 else if (STRCASEEQ('l','L',"large",cur->value)) {
4644 attr_size = apr_pstrdup(doc->pool, cur->value);
4646 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4647 attr_size = apr_pstrdup(doc->pool, cur->value);
4649 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4650 attr_size = apr_pstrdup(doc->pool, cur->value);
4657 if (attr_type || attr_color || attr_size) {
4660 W_L("list-style-type:");
4665 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4683 * It is a handler who processes the DIR tag.
4685 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4686 * destination is specified.
4687 * @param node [i] The DIR tag node is specified.
4688 * @return The conversion result is returned.
4691 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4693 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4694 Doc *doc = jxhtml->doc;
4696 if (IS_CSS_ON(jxhtml->entryp)) {
4697 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4704 * It is a handler who processes the DL tag.
4706 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4707 * destination is specified.
4708 * @param node [i] The DL tag node is specified.
4709 * @return The conversion result is returned.
4712 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4714 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4715 Doc *doc = jxhtml->doc;
4717 char *attr_style = NULL;
4718 char *attr_color = NULL;
4719 char *attr_size = NULL;
4720 for (attr = qs_get_attr(doc,node);
4722 attr = qs_get_next_attr(doc,attr)) {
4723 char *name = qs_get_attr_name(doc,attr);
4724 char *value = qs_get_attr_value(doc,attr);
4725 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4729 if (IS_CSS_ON(jxhtml->entryp)) {
4730 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4732 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4733 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4734 css_property_t *cur;
4735 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4736 if (cur->value && *cur->value) {
4737 attr_color = apr_pstrdup(doc->pool, cur->value);
4740 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4741 if (cur->value && *cur->value) {
4742 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4743 attr_size = apr_pstrdup(doc->pool, cur->value);
4745 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4746 attr_size = apr_pstrdup(doc->pool, cur->value);
4748 else if (STRCASEEQ('s','S',"small",cur->value)) {
4749 attr_size = apr_pstrdup(doc->pool, cur->value);
4751 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4752 attr_size = apr_pstrdup(doc->pool, cur->value);
4754 else if (STRCASEEQ('l','L',"large",cur->value)) {
4755 attr_size = apr_pstrdup(doc->pool, cur->value);
4757 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4758 attr_size = apr_pstrdup(doc->pool, cur->value);
4760 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4761 attr_size = apr_pstrdup(doc->pool, cur->value);
4768 if (attr_color || attr_size) {
4771 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4789 * It is a handler who processes the DL tag.
4791 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4792 * destination is specified.
4793 * @param node [i] The DL tag node is specified.
4794 * @return The conversion result is returned.
4797 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4799 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4800 Doc *doc = jxhtml->doc;
4802 if (IS_CSS_ON(jxhtml->entryp)) {
4803 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4810 * It is a handler who processes the DT tag.
4812 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4813 * destination is specified.
4814 * @param node [i] The DT tag node is specified.
4815 * @return The conversion result is returned.
4818 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4820 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4821 Doc *doc = jxhtml->doc;
4823 char *attr_style = NULL;
4824 char *attr_color = NULL;
4825 char *attr_size = NULL;
4826 for (attr = qs_get_attr(doc,node);
4828 attr = qs_get_next_attr(doc,attr)) {
4829 char *name = qs_get_attr_name(doc,attr);
4830 char *value = qs_get_attr_value(doc,attr);
4831 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4835 if (IS_CSS_ON(jxhtml->entryp)) {
4836 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4838 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4839 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4840 css_property_t *cur;
4841 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4842 if (cur->value && *cur->value) {
4843 attr_color = apr_pstrdup(doc->pool, cur->value);
4846 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4847 if (cur->value && *cur->value) {
4848 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4849 attr_size = apr_pstrdup(doc->pool, cur->value);
4851 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4852 attr_size = apr_pstrdup(doc->pool, cur->value);
4854 else if (STRCASEEQ('s','S',"small",cur->value)) {
4855 attr_size = apr_pstrdup(doc->pool, cur->value);
4857 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4858 attr_size = apr_pstrdup(doc->pool, cur->value);
4860 else if (STRCASEEQ('l','L',"large",cur->value)) {
4861 attr_size = apr_pstrdup(doc->pool, cur->value);
4863 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4864 attr_size = apr_pstrdup(doc->pool, cur->value);
4866 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4867 attr_size = apr_pstrdup(doc->pool, cur->value);
4874 if (attr_color || attr_size) {
4877 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4895 * It is a handler who processes the DT tag.
4897 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4898 * destination is specified.
4899 * @param node [i] The DT tag node is specified.
4900 * @return The conversion result is returned.
4903 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4905 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4906 Doc *doc = jxhtml->doc;
4908 if (IS_CSS_ON(jxhtml->entryp)) {
4909 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4916 * It is a handler who processes the DD tag.
4918 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4919 * destination is specified.
4920 * @param node [i] The DD tag node is specified.
4921 * @return The conversion result is returned.
4924 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4926 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4927 Doc *doc = jxhtml->doc;
4929 char *attr_style = NULL;
4930 char *attr_color = NULL;
4931 char *attr_size = NULL;
4932 for (attr = qs_get_attr(doc,node);
4934 attr = qs_get_next_attr(doc,attr)) {
4935 char *name = qs_get_attr_name(doc,attr);
4936 char *value = qs_get_attr_value(doc,attr);
4937 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4941 if (IS_CSS_ON(jxhtml->entryp)) {
4942 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4944 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4945 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4946 css_property_t *cur;
4947 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4948 if (cur->value && *cur->value) {
4949 attr_color = apr_pstrdup(doc->pool, cur->value);
4952 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4953 if (cur->value && *cur->value) {
4954 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4955 attr_size = apr_pstrdup(doc->pool, cur->value);
4957 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4958 attr_size = apr_pstrdup(doc->pool, cur->value);
4960 else if (STRCASEEQ('s','S',"small",cur->value)) {
4961 attr_size = apr_pstrdup(doc->pool, cur->value);
4963 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4964 attr_size = apr_pstrdup(doc->pool, cur->value);
4966 else if (STRCASEEQ('l','L',"large",cur->value)) {
4967 attr_size = apr_pstrdup(doc->pool, cur->value);
4969 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4970 attr_size = apr_pstrdup(doc->pool, cur->value);
4972 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4973 attr_size = apr_pstrdup(doc->pool, cur->value);
4980 if (attr_color || attr_size) {
4983 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5001 * It is a handler who processes the DD tag.
5003 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5004 * destination is specified.
5005 * @param node [i] The DD tag node is specified.
5006 * @return The conversion result is returned.
5009 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5011 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5012 Doc *doc = jxhtml->doc;
5014 if (IS_CSS_ON(jxhtml->entryp)) {
5015 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5022 * It is a handler who processes the H1 tag.
5024 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5025 * destination is specified.
5026 * @param node [i] The H1 tag node is specified.
5027 * @return The conversion result is returned.
5030 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5036 char *attr_style = NULL;
5037 char *attr_align = NULL;
5038 char *css_clear = NULL;
5040 jxhtml = GET_JXHTML(pdoc);
5044 for (attr = qs_get_attr(doc,node);
5046 attr = qs_get_next_attr(doc,attr)) {
5047 char *name = qs_get_attr_name(doc,attr);
5048 char *value = qs_get_attr_value(doc,attr);
5049 if (STRCASEEQ('a','A',"align", name)) {
5050 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5054 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5058 if (IS_CSS_ON(jxhtml->entryp)) {
5059 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5061 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5062 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5063 css_property_t *cur;
5064 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5065 if (STRCASEEQ('l','L',"left", cur->value)) {
5066 attr_align = apr_pstrdup(doc->pool, "left");
5068 else if (STRCASEEQ('c','C',"center",cur->value)) {
5069 attr_align = apr_pstrdup(doc->pool, "center");
5071 else if (STRCASEEQ('r','R',"right",cur->value)) {
5072 attr_align = apr_pstrdup(doc->pool, "right");
5075 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5076 if (STRCASEEQ('b','B',"both", cur->value)) {
5077 css_clear = apr_pstrdup(doc->pool, "both");
5079 else if (STRCASEEQ('r','R',"right", cur->value)) {
5080 css_clear = apr_pstrdup(doc->pool, "right");
5082 else if (STRCASEEQ('l','L',"left", cur->value)) {
5083 css_clear = apr_pstrdup(doc->pool, "left");
5089 if (attr_align || css_clear ) {
5110 * It is a handler who processes the H1 tag.
5112 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5113 * destination is specified.
5114 * @param node [i] The H1 tag node is specified.
5115 * @return The conversion result is returned.
5118 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5124 jxhtml = GET_JXHTML(pdoc);
5129 if (IS_CSS_ON(jxhtml->entryp)) {
5130 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5138 * It is a handler who processes the H2 tag.
5140 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5141 * destination is specified.
5142 * @param node [i] The H1 tag node is specified.
5143 * @return The conversion result is returned.
5146 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5152 char *attr_style = NULL;
5153 char *attr_align = NULL;
5154 char *css_clear = NULL;
5156 jxhtml = GET_JXHTML(pdoc);
5160 for (attr = qs_get_attr(doc,node);
5162 attr = qs_get_next_attr(doc,attr)) {
5163 char *name = qs_get_attr_name(doc,attr);
5164 char *value = qs_get_attr_value(doc,attr);
5165 if (STRCASEEQ('a','A',"align", name)) {
5166 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5170 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5174 if (IS_CSS_ON(jxhtml->entryp)) {
5175 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5177 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5178 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5179 css_property_t *cur;
5180 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5181 if (STRCASEEQ('l','L',"left", cur->value)) {
5182 attr_align = apr_pstrdup(doc->pool, "left");
5184 else if (STRCASEEQ('c','C',"center",cur->value)) {
5185 attr_align = apr_pstrdup(doc->pool, "center");
5187 else if (STRCASEEQ('r','R',"right",cur->value)) {
5188 attr_align = apr_pstrdup(doc->pool, "right");
5191 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5192 if (STRCASEEQ('b','B',"both", cur->value)) {
5193 css_clear = apr_pstrdup(doc->pool, "both");
5195 else if (STRCASEEQ('r','R',"right", cur->value)) {
5196 css_clear = apr_pstrdup(doc->pool, "right");
5198 else if (STRCASEEQ('l','L',"left", cur->value)) {
5199 css_clear = apr_pstrdup(doc->pool, "left");
5205 if (attr_align || css_clear ) {
5226 * It is a handler who processes the H2 tag.
5228 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5229 * destination is specified.
5230 * @param node [i] The H1 tag node is specified.
5231 * @return The conversion result is returned.
5234 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5240 jxhtml = GET_JXHTML(pdoc);
5245 if (IS_CSS_ON(jxhtml->entryp)) {
5246 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5253 * It is a handler who processes the H3 tag.
5255 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5256 * destination is specified.
5257 * @param node [i] The H1 tag node is specified.
5258 * @return The conversion result is returned.
5261 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5267 char *attr_style = NULL;
5268 char *attr_align = NULL;
5269 char *css_clear = NULL;
5271 jxhtml = GET_JXHTML(pdoc);
5275 for (attr = qs_get_attr(doc,node);
5277 attr = qs_get_next_attr(doc,attr)) {
5278 char *name = qs_get_attr_name(doc,attr);
5279 char *value = qs_get_attr_value(doc,attr);
5280 if (STRCASEEQ('a','A',"align", name)) {
5281 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5285 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5289 if (IS_CSS_ON(jxhtml->entryp)) {
5290 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5292 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5293 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5294 css_property_t *cur;
5295 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5296 if (STRCASEEQ('l','L',"left", cur->value)) {
5297 attr_align = apr_pstrdup(doc->pool, "left");
5299 else if (STRCASEEQ('c','C',"center",cur->value)) {
5300 attr_align = apr_pstrdup(doc->pool, "center");
5302 else if (STRCASEEQ('r','R',"right",cur->value)) {
5303 attr_align = apr_pstrdup(doc->pool, "right");
5306 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5307 if (STRCASEEQ('b','B',"both", cur->value)) {
5308 css_clear = apr_pstrdup(doc->pool, "both");
5310 else if (STRCASEEQ('r','R',"right", cur->value)) {
5311 css_clear = apr_pstrdup(doc->pool, "right");
5313 else if (STRCASEEQ('l','L',"left", cur->value)) {
5314 css_clear = apr_pstrdup(doc->pool, "left");
5320 if (attr_align || css_clear ) {
5341 * It is a handler who processes the H3 tag.
5343 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5344 * destination is specified.
5345 * @param node [i] The H1 tag node is specified.
5346 * @return The conversion result is returned.
5349 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5355 jxhtml = GET_JXHTML(pdoc);
5360 if (IS_CSS_ON(jxhtml->entryp)) {
5361 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5368 * It is a handler who processes the H4 tag.
5370 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5371 * destination is specified.
5372 * @param node [i] The H1 tag node is specified.
5373 * @return The conversion result is returned.
5376 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5382 char *attr_style = NULL;
5383 char *attr_align = NULL;
5384 char *css_clear = NULL;
5386 jxhtml = GET_JXHTML(pdoc);
5390 for (attr = qs_get_attr(doc,node);
5392 attr = qs_get_next_attr(doc,attr)) {
5393 char *name = qs_get_attr_name(doc,attr);
5394 char *value = qs_get_attr_value(doc,attr);
5395 if (STRCASEEQ('a','A',"align", name)) {
5396 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5400 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5404 if (IS_CSS_ON(jxhtml->entryp)) {
5405 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5407 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5408 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5409 css_property_t *cur;
5410 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5411 if (STRCASEEQ('l','L',"left", cur->value)) {
5412 attr_align = apr_pstrdup(doc->pool, "left");
5414 else if (STRCASEEQ('c','C',"center",cur->value)) {
5415 attr_align = apr_pstrdup(doc->pool, "center");
5417 else if (STRCASEEQ('r','R',"right",cur->value)) {
5418 attr_align = apr_pstrdup(doc->pool, "right");
5421 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5422 if (STRCASEEQ('b','B',"both", cur->value)) {
5423 css_clear = apr_pstrdup(doc->pool, "both");
5425 else if (STRCASEEQ('r','R',"right", cur->value)) {
5426 css_clear = apr_pstrdup(doc->pool, "right");
5428 else if (STRCASEEQ('l','L',"left", cur->value)) {
5429 css_clear = apr_pstrdup(doc->pool, "left");
5435 if (attr_align || css_clear ) {
5456 * It is a handler who processes the H4 tag.
5458 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5459 * destination is specified.
5460 * @param node [i] The H1 tag node is specified.
5461 * @return The conversion result is returned.
5464 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5470 jxhtml = GET_JXHTML(pdoc);
5475 if (IS_CSS_ON(jxhtml->entryp)) {
5476 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5484 * It is a handler who processes the H5 tag.
5486 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5487 * destination is specified.
5488 * @param node [i] The H1 tag node is specified.
5489 * @return The conversion result is returned.
5492 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5498 char *attr_style = NULL;
5499 char *attr_align = NULL;
5500 char *css_clear = NULL;
5502 jxhtml = GET_JXHTML(pdoc);
5506 for (attr = qs_get_attr(doc,node);
5508 attr = qs_get_next_attr(doc,attr)) {
5509 char *name = qs_get_attr_name(doc,attr);
5510 char *value = qs_get_attr_value(doc,attr);
5511 if (STRCASEEQ('a','A',"align", name)) {
5512 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5516 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5520 if (IS_CSS_ON(jxhtml->entryp)) {
5521 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5523 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5524 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5525 css_property_t *cur;
5526 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5527 if (STRCASEEQ('l','L',"left", cur->value)) {
5528 attr_align = apr_pstrdup(doc->pool, "left");
5530 else if (STRCASEEQ('c','C',"center",cur->value)) {
5531 attr_align = apr_pstrdup(doc->pool, "center");
5533 else if (STRCASEEQ('r','R',"right",cur->value)) {
5534 attr_align = apr_pstrdup(doc->pool, "right");
5537 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5538 if (STRCASEEQ('b','B',"both", cur->value)) {
5539 css_clear = apr_pstrdup(doc->pool, "both");
5541 else if (STRCASEEQ('r','R',"right", cur->value)) {
5542 css_clear = apr_pstrdup(doc->pool, "right");
5544 else if (STRCASEEQ('l','L',"left", cur->value)) {
5545 css_clear = apr_pstrdup(doc->pool, "left");
5551 if (attr_align || css_clear ) {
5572 * It is a handler who processes the H5 tag.
5574 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5575 * destination is specified.
5576 * @param node [i] The H1 tag node is specified.
5577 * @return The conversion result is returned.
5580 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5586 jxhtml = GET_JXHTML(pdoc);
5591 if (IS_CSS_ON(jxhtml->entryp)) {
5592 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5600 * It is a handler who processes the H6 tag.
5602 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5603 * destination is specified.
5604 * @param node [i] The H1 tag node is specified.
5605 * @return The conversion result is returned.
5608 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5614 char *attr_style = NULL;
5615 char *attr_align = NULL;
5616 char *css_clear = NULL;
5618 jxhtml = GET_JXHTML(pdoc);
5622 for (attr = qs_get_attr(doc,node);
5624 attr = qs_get_next_attr(doc,attr)) {
5625 char *name = qs_get_attr_name(doc,attr);
5626 char *value = qs_get_attr_value(doc,attr);
5627 if (STRCASEEQ('a','A',"align", name)) {
5628 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5632 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5636 if (IS_CSS_ON(jxhtml->entryp)) {
5637 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5639 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5640 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5641 css_property_t *cur;
5642 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5643 if (STRCASEEQ('l','L',"left", cur->value)) {
5644 attr_align = apr_pstrdup(doc->pool, "left");
5646 else if (STRCASEEQ('c','C',"center",cur->value)) {
5647 attr_align = apr_pstrdup(doc->pool, "center");
5649 else if (STRCASEEQ('r','R',"right",cur->value)) {
5650 attr_align = apr_pstrdup(doc->pool, "right");
5653 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5654 if (STRCASEEQ('b','B',"both", cur->value)) {
5655 css_clear = apr_pstrdup(doc->pool, "both");
5657 else if (STRCASEEQ('r','R',"right", cur->value)) {
5658 css_clear = apr_pstrdup(doc->pool, "right");
5660 else if (STRCASEEQ('l','L',"left", cur->value)) {
5661 css_clear = apr_pstrdup(doc->pool, "left");
5667 if (attr_align || css_clear ) {
5688 * It is a handler who processes the H6 tag.
5690 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5691 * destination is specified.
5692 * @param node [i] The H1 tag node is specified.
5693 * @return The conversion result is returned.
5696 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5702 jxhtml = GET_JXHTML(pdoc);
5707 if (IS_CSS_ON(jxhtml->entryp)) {
5708 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5716 * It is a handler who processes the MENU tag.
5718 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5719 * destination is specified.
5720 * @param node [i] The MENU tag node is specified.
5721 * @return The conversion result is returned.
5724 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5726 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5727 Doc *doc = jxhtml->doc;
5729 char *attr_style = NULL;
5730 char *attr_color = NULL;
5731 char *attr_type = NULL;
5732 char *attr_size = NULL;
5733 for (attr = qs_get_attr(doc,node);
5735 attr = qs_get_next_attr(doc,attr)) {
5736 char *name = qs_get_attr_name(doc,attr);
5737 char *value = qs_get_attr_value(doc,attr);
5738 if (STRCASEEQ('t','T',"type",name)) {
5739 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5743 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5747 if (IS_CSS_ON(jxhtml->entryp)) {
5748 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5750 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5751 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5752 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5753 css_property_t *cur;
5754 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5755 if (cur->value && *cur->value) {
5756 attr_color = apr_pstrdup(doc->pool, cur->value);
5759 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5760 if (cur->value && *cur->value) {
5761 attr_type = apr_pstrdup(doc->pool, cur->value);
5764 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5765 if (cur->value && *cur->value) {
5766 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5767 attr_size = apr_pstrdup(doc->pool, cur->value);
5769 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5770 attr_size = apr_pstrdup(doc->pool, cur->value);
5772 else if (STRCASEEQ('s','S',"small",cur->value)) {
5773 attr_size = apr_pstrdup(doc->pool, cur->value);
5775 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5776 attr_size = apr_pstrdup(doc->pool, cur->value);
5778 else if (STRCASEEQ('l','L',"large",cur->value)) {
5779 attr_size = apr_pstrdup(doc->pool, cur->value);
5781 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5782 attr_size = apr_pstrdup(doc->pool, cur->value);
5784 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5785 attr_size = apr_pstrdup(doc->pool, cur->value);
5792 if (attr_type || attr_color || attr_size) {
5795 W_L("list-style-type:");
5800 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5818 * It is a handler who processes the MENU tag.
5820 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5821 * destination is specified.
5822 * @param node [i] The MENU tag node is specified.
5823 * @return The conversion result is returned.
5826 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5828 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5829 Doc *doc = jxhtml->doc;
5831 if (IS_CSS_ON(jxhtml->entryp)) {
5832 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5839 * It is a handler who processes the PLAINTEXT tag.
5841 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5842 * destination is specified.
5843 * @param node [i] The PLAINTEXT tag node is specified.
5844 * @return The conversion result is returned.
5847 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5852 jxhtml = GET_JXHTML(pdoc);
5855 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5860 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5865 jxhtml = GET_JXHTML(pdoc);
5867 for (child = qs_get_child_node(doc, node);
5869 child = qs_get_next_node(doc, child)) {
5871 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5878 * It is a handler who processes the PLAINTEXT tag.
5880 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5881 * destination is specified.
5882 * @param node [i] The PLAINTEXT tag node is specified.
5883 * @return The conversion result is returned.
5886 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5888 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5894 * It is a handler who processes the BLINK tag.
5896 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5897 * destination is specified.
5898 * @param node [i] The BLINK tag node is specified.
5899 * @return The conversion result is returned.
5902 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5904 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5905 Doc *doc = jxhtml->doc;
5907 char *attr_style = NULL;
5908 char *attr_color = NULL;
5909 char *attr_size = NULL;
5910 for (attr = qs_get_attr(doc,node);
5912 attr = qs_get_next_attr(doc,attr)) {
5913 char *name = qs_get_attr_name(doc,attr);
5914 char *value = qs_get_attr_value(doc,attr);
5915 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5919 if (IS_CSS_ON(jxhtml->entryp)) {
5920 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5922 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5923 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5924 css_property_t *cur;
5925 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5926 if (cur->value && *cur->value) {
5927 attr_color = apr_pstrdup(doc->pool, cur->value);
5930 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5931 if (cur->value && *cur->value) {
5932 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5933 attr_size = apr_pstrdup(doc->pool, cur->value);
5935 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5936 attr_size = apr_pstrdup(doc->pool, cur->value);
5938 else if (STRCASEEQ('s','S',"small",cur->value)) {
5939 attr_size = apr_pstrdup(doc->pool, cur->value);
5941 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5942 attr_size = apr_pstrdup(doc->pool, cur->value);
5944 else if (STRCASEEQ('l','L',"large",cur->value)) {
5945 attr_size = apr_pstrdup(doc->pool, cur->value);
5947 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5948 attr_size = apr_pstrdup(doc->pool, cur->value);
5950 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5951 attr_size = apr_pstrdup(doc->pool, cur->value);
5958 if (attr_color || attr_size) {
5961 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5979 * It is a handler who processes the BLINK tag.
5981 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5982 * destination is specified.
5983 * @param node [i] The BLINK tag node is specified.
5984 * @return The conversion result is returned.
5987 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5989 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5990 Doc *doc = jxhtml->doc;
5992 if (IS_CSS_ON(jxhtml->entryp)) {
5993 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6000 * It is a handler who processes the MARQUEE tag.
6002 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6003 * destination is specified.
6004 * @param node [i] The MARQUEE tag node is specified.
6005 * @return The conversion result is returned.
6008 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6010 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6011 Doc *doc = jxhtml->doc;
6013 char *attr_direction = NULL;
6014 char *attr_style = NULL;
6015 char *attr_color = NULL;
6016 char *attr_size = NULL;
6017 char *attr_bgcolor = NULL;
6018 /*--------------------------------------------------------------------------*/
6019 /* Get Attributes */
6020 /*--------------------------------------------------------------------------*/
6021 for (attr = qs_get_attr(doc,node);
6023 attr = qs_get_next_attr(doc,attr)) {
6024 char *name = qs_get_attr_name(doc,attr);
6025 char *value = qs_get_attr_value(doc,attr);
6026 if (STRCASEEQ('d','D',"direction", name)) {
6028 if (STRCASEEQ('l','L',"left",value)) {
6029 attr_direction = "rtl";
6031 else if (STRCASEEQ('r','R',"right",value)) {
6032 attr_direction = "ltr";
6036 else if (STRCASEEQ('b','B',"behavior",name)) {
6039 else if (STRCASEEQ('l','L',"loop",name)) {
6042 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6043 if (value && *value) {
6044 attr_bgcolor = value;
6047 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6051 if (IS_CSS_ON(jxhtml->entryp)) {
6052 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
6054 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6055 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6056 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6057 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6058 css_property_t *cur;
6059 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6060 if (cur->value && *cur->value) {
6061 attr_color = apr_pstrdup(doc->pool, cur->value);
6064 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6065 if (cur->value && *cur->value) {
6066 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6069 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6070 if (cur->value && *cur->value) {
6071 attr_direction = apr_pstrdup(doc->pool, cur->value);
6074 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6075 if (cur->value && *cur->value) {
6076 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6077 || STRCASEEQ('x','X',"x-small", cur->value)
6078 || STRCASEEQ('s','S',"small", cur->value)
6079 || STRCASEEQ('m','M',"medium", cur->value)
6080 || STRCASEEQ('l','L',"large", cur->value)
6081 || STRCASEEQ('x','X',"x-large", cur->value)
6082 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6083 attr_size = apr_pstrdup(doc->pool, cur->value);
6090 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6092 if (attr_direction) {
6093 W_L("-wap-marquee-dir:");
6094 W_V(attr_direction);
6098 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6099 W_L("background-color:");
6104 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6123 * It is a handler who processes the MARQUEE tag.
6125 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6126 * destination is specified.
6127 * @param node [i] The MARQUEE tag node is specified.
6128 * @return The conversion result is returned.
6131 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6133 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6134 Doc *doc = jxhtml->doc;
6136 if (IS_CSS_ON(jxhtml->entryp)) {
6137 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6144 * It is handler who processes the New Line Code.
6147 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6149 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6150 if (jxhtml->start_html_flag) {
6151 Doc *doc = jxhtml->doc;
6159 * It is a handler who processes the LINK tag.
6161 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6162 * destination is specified.
6163 * @param node [i] The LINK tag node is specified.
6164 * @return The conversion result is returned.
6167 s_jxhtml_link_tag(void *pdoc, Node *node)
6176 jxhtml = GET_JXHTML(pdoc);
6179 if (! IS_CSS_ON(jxhtml->entryp)) {
6183 for (attr = qs_get_attr(doc,node);
6185 attr = qs_get_next_attr(doc,attr)) {
6186 char *name = qs_get_attr_name(doc,attr);
6187 char *value = qs_get_attr_value(doc,attr);
6188 if (STRCASEEQ('r','R',"rel", name)) {
6189 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6193 else if (STRCASEEQ('h','H',"href", name)) {
6194 if (value && *value) {
6198 else if (STRCASEEQ('t','T',"type", name)) {
6199 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6205 if (rel && href && type) {
6206 DBG(doc->r, "start load CSS. url:[%s]", href);
6207 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6208 DBG(doc->r, "end load CSS. url:[%s]", href);
6215 static css_prop_list_t *
6216 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6218 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6219 Doc *doc = jxhtml->doc;
6220 css_prop_list_t *last_css = NULL;
6221 if (IS_CSS_ON(jxhtml->entryp)) {
6222 css_prop_list_t *dup_css;
6223 css_selector_t *selector;
6225 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6226 dup_css = chxj_dup_css_prop_list(doc, last_css);
6227 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6229 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6231 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6232 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6234 if (style_attr_value) {
6235 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));
6237 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6245 static css_prop_list_t *
6246 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6248 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6249 Doc *doc = jxhtml->doc;
6250 css_prop_list_t *last_css = NULL;
6251 if (IS_CSS_ON(jxhtml->entryp)) {
6252 css_prop_list_t *dup_css;
6253 css_selector_t *selector;
6255 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6256 dup_css = chxj_dup_css_prop_list(doc, last_css);
6257 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6259 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6263 if (style_attr_value) {
6264 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));
6266 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6275 * It is a handler who processes the SPAN tag.
6277 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6278 * destination is specified.
6279 * @param node [i] The SPAN tag node is specified.
6280 * @return The conversion result is returned.
6283 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6288 char *attr_style = NULL;
6289 char *attr_color = NULL;
6290 char *attr_size = NULL;
6291 char *attr_align = NULL;
6292 char *attr_blink = NULL;
6293 char *attr_marquee = NULL;
6294 char *attr_marquee_dir = NULL;
6295 char *attr_marquee_style = NULL;
6296 char *attr_marquee_loop = NULL;
6297 char *css_bgcolor = NULL;
6299 jxhtml = GET_JXHTML(pdoc);
6302 for (attr = qs_get_attr(doc,node);
6304 attr = qs_get_next_attr(doc,attr)) {
6305 char *nm = qs_get_attr_name(doc,attr);
6306 char *val = qs_get_attr_value(doc,attr);
6307 if (val && STRCASEEQ('s','S',"style", nm)) {
6311 if (IS_CSS_ON(jxhtml->entryp)) {
6312 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
6314 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6315 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6316 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6317 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6318 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6319 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6320 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6321 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6322 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6324 css_property_t *cur;
6325 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6326 attr_color = apr_pstrdup(doc->pool, cur->value);
6328 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6329 if (cur->value && *cur->value) {
6330 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6331 || STRCASEEQ('x','X',"x-small", cur->value)
6332 || STRCASEEQ('s','S',"small", cur->value)
6333 || STRCASEEQ('m','M',"medium", cur->value)
6334 || STRCASEEQ('l','L',"large", cur->value)
6335 || STRCASEEQ('x','X',"x-large", cur->value)
6336 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6337 attr_size = apr_pstrdup(doc->pool, cur->value);
6341 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6342 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6343 attr_blink = apr_pstrdup(doc->pool, cur->value);
6346 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6347 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6348 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6351 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6352 if (cur->value && *cur->value) {
6353 if ( STRCASEEQ('l','L',"ltr",cur->value)
6354 || STRCASEEQ('r','R',"rtl",cur->value)) {
6355 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6359 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6360 if (cur->value && *cur->value) {
6361 if ( STRCASEEQ('s','S',"scroll",cur->value)
6362 || STRCASEEQ('s','S',"slide",cur->value)
6363 || STRCASEEQ('a','A',"alternate",cur->value)) {
6364 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6368 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6369 if (cur->value && *cur->value) {
6370 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6371 attr_marquee_loop = "infinite";
6374 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6378 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6379 if (STRCASEEQ('l','L',"left", cur->value)) {
6380 attr_align = apr_pstrdup(doc->pool, "left");
6382 else if (STRCASEEQ('c','C',"center",cur->value)) {
6383 attr_align = apr_pstrdup(doc->pool, "center");
6385 else if (STRCASEEQ('r','R',"right",cur->value)) {
6386 attr_align = apr_pstrdup(doc->pool, "right");
6389 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6390 if (cur->value && *cur->value) {
6391 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6398 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6401 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6417 W_L("text-decoration:");
6422 W_L("display:-wap-marquee;");
6423 if (attr_marquee_dir) {
6424 W_L("-wap-marquee-dir:");
6425 W_V(attr_marquee_dir);
6428 if (attr_marquee_style) {
6429 W_L("-wap-marquee-style:");
6430 W_V(attr_marquee_style);
6433 if (attr_marquee_loop) {
6434 W_L("-wap-marquee-loop:");
6435 W_V(attr_marquee_loop);
6440 W_L("background-color:");
6452 * It is a handler who processes the SPAN tag.
6454 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6455 * destination is specified.
6456 * @param node [i] The SPAN tag node is specified.
6457 * @return The conversion result is returned.
6460 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6462 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6463 Doc *doc = jxhtml->doc;
6466 if (IS_CSS_ON(jxhtml->entryp)) {
6467 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6474 * It is a handler who processes the STYLE tag.
6476 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6477 * destination is specified.
6478 * @param node [i] The STYLE tag node is specified.
6479 * @return The conversion result is returned.
6482 s_jxhtml_style_tag(void *pdoc, Node *node)
6489 jxhtml = GET_JXHTML(pdoc);
6492 if (! IS_CSS_ON(jxhtml->entryp)) {
6496 for (attr = qs_get_attr(doc,node);
6498 attr = qs_get_next_attr(doc,attr)) {
6499 char *name = qs_get_attr_name(doc,attr);
6500 char *value = qs_get_attr_value(doc,attr);
6501 if (STRCASEEQ('t','T',"type", name)) {
6502 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6508 Node *child = qs_get_child_node(doc, node);
6509 if (type && child) {
6510 char *name = qs_get_node_name(doc, child);
6511 if (STRCASEEQ('t','T',"text", name)) {
6512 char *value = qs_get_node_value(doc, child);
6513 DBG(doc->r, "start load CSS. buf:[%s]", value);
6514 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6515 DBG(doc->r, "end load CSS. value:[%s]", value);
6521 * It is a handler who processes the OBJECT tag.
6523 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6524 * destination is specified.
6525 * @param node [i] The OBJECT tag node is specified.
6526 * @return The conversion result is returned.
6529 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6531 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6532 Doc *doc = jxhtml->doc;
6535 char *attr_id = NULL;
6536 char *attr_width = NULL;
6537 char *attr_height = NULL;
6538 char *attr_data = NULL;
6539 char *attr_type = NULL;
6540 char *attr_declare = NULL;
6541 char *attr_classid = NULL;
6542 char *attr_codebase = NULL;
6544 /*--------------------------------------------------------------------------*/
6545 /* Get Attributes */
6546 /*--------------------------------------------------------------------------*/
6547 for (attr = qs_get_attr(doc,node);
6549 attr = qs_get_next_attr(doc,attr)) {
6550 char *name = qs_get_attr_name(doc,attr);
6551 char *value = qs_get_attr_value(doc,attr);
6552 if (STRCASEEQ('i','I',"id",name)) {
6553 attr_id = apr_pstrdup(doc->pool, value);
6555 else if (STRCASEEQ('w','W',"width",name)) {
6556 attr_width = apr_pstrdup(doc->pool, value);
6558 else if (STRCASEEQ('h','H',"height",name)) {
6559 attr_height = apr_pstrdup(doc->pool, value);
6561 else if (STRCASEEQ('d','D',"data",name)) {
6562 attr_data = apr_pstrdup(doc->pool, value);
6564 else if (STRCASEEQ('t','T',"type",name)) {
6565 attr_type = apr_pstrdup(doc->pool, value);
6567 else if (STRCASEEQ('d','D',"declare",name)) {
6568 attr_declare = apr_pstrdup(doc->pool, value);
6570 else if (STRCASEEQ('c','C',"classid",name)) {
6571 attr_classid = apr_pstrdup(doc->pool, value);
6573 else if (STRCASEEQ('c','C',"codebase",name)) {
6574 attr_codebase = apr_pstrdup(doc->pool, value);
6606 W_L(" declare=\"declare\"");
6614 W_L(" codebase=\"");
6623 * It is a handler who processes the OBJECT tag.
6625 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6626 * destination is specified.
6627 * @param node [i] The OBJECT tag node is specified.
6628 * @return The conversion result is returned.
6631 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6633 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6634 Doc *doc = jxhtml->doc;
6640 * It is a handler who processes the OBJECT tag.
6642 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6643 * destination is specified.
6644 * @param node [i] The OBJECT tag node is specified.
6645 * @return The conversion result is returned.
6648 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6650 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6651 Doc *doc = jxhtml->doc;
6654 char *attr_style = NULL;
6655 char *attr_name = NULL;
6656 char *attr_value = NULL;
6658 /*--------------------------------------------------------------------------*/
6659 /* Get Attributes */
6660 /*--------------------------------------------------------------------------*/
6661 for (attr = qs_get_attr(doc,node);
6663 attr = qs_get_next_attr(doc,attr)) {
6664 char *name = qs_get_attr_name(doc,attr);
6665 char *value = qs_get_attr_value(doc,attr);
6666 if (STRCASEEQ('n','N',"name",name)) {
6667 attr_name = apr_pstrdup(doc->pool, value);
6669 else if (STRCASEEQ('v','V',"value",name)) {
6670 attr_value = apr_pstrdup(doc->pool, value);