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_nopush_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 attr_clear = apr_pstrdup(doc->pool, cur->value);
1451 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1452 attr_clear = apr_pstrdup(doc->pool, "all");
1470 * It is a handler who processes the BR tag.
1472 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1473 * destination is specified.
1474 * @param node [i] The BR tag node is specified.
1475 * @return The conversion result is returned.
1478 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1480 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1485 * It is a handler who processes the TABLE tag.
1487 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1488 * destination is specified.
1489 * @param node [i] The TR tag node is specified.
1490 * @return The conversion result is returned.
1493 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1500 char *attr_style = NULL;
1501 char *attr_align = NULL;
1502 char *attr_width = NULL;
1503 char *attr_height = NULL;
1504 char *attr_bgcolor = NULL;
1505 char *attr_border_width = NULL;
1506 char *attr_border_color = NULL;
1508 jxhtml = GET_JXHTML(pdoc);
1512 /*--------------------------------------------------------------------------*/
1513 /* Get Attributes */
1514 /*--------------------------------------------------------------------------*/
1515 for (attr = qs_get_attr(doc,node);
1517 attr = qs_get_next_attr(doc,attr)) {
1518 char *name = qs_get_attr_name(doc,attr);
1519 char *val = qs_get_attr_value(doc,attr);
1520 if (STRCASEEQ('a','A',"align",name)) {
1521 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1522 attr_align = apr_pstrdup(doc->buf.pool, val);
1525 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1526 attr_height = apr_pstrdup(doc->buf.pool, val);
1528 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1529 attr_width = apr_pstrdup(doc->buf.pool, val);
1531 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1532 attr_style = apr_pstrdup(doc->buf.pool, val);
1534 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1535 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1536 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1538 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1539 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1541 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1542 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1543 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1547 if (IS_CSS_ON(jxhtml->entryp)) {
1548 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1550 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1551 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1552 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1553 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1554 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1555 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1557 css_property_t *cur;
1558 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1559 char *tmp = apr_pstrdup(doc->pool, cur->value);
1560 char *tmpp = strstr(tmp, "px");
1562 size_t len = strlen(tmp) - strlen(tmpp);
1563 attr_width = apr_pstrndup(doc->pool, tmp,len);
1566 attr_width = apr_pstrdup(doc->pool, tmp);
1569 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1570 char *tmp = apr_pstrdup(doc->pool, cur->value);
1571 char *tmpp = strstr(tmp, "px");
1573 size_t len = strlen(tmp) - strlen(tmpp);
1574 attr_height = apr_pstrndup(doc->pool, tmp,len);
1577 attr_height = apr_pstrdup(doc->pool, tmp);
1580 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1581 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1582 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1585 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1586 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1587 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1589 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1590 char *tmp = apr_pstrdup(doc->pool, cur->value);
1591 char *tmpp = strstr(tmp, "px");
1593 size_t len = strlen(tmp) - strlen(tmpp);
1594 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1597 attr_border_width = apr_pstrdup(doc->pool, tmp);
1600 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1601 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1602 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1623 if (attr_bgcolor && *attr_bgcolor){
1628 if (attr_border_width || attr_border_color ){
1629 W_L(" style=\"border:");
1630 if (attr_border_width){
1631 W_V(attr_border_width);
1638 if (attr_border_color && *attr_border_color){
1640 W_V(attr_border_color);
1650 * It is a handler who processes the TABLE tag.
1652 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1653 * destination is specified.
1654 * @param node [i] The TR tag node is specified.
1655 * @return The conversion result is returned.
1658 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1664 jxhtml = GET_JXHTML(pdoc);
1674 * It is a handler who processes the TR tag.
1676 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1677 * destination is specified.
1678 * @param node [i] The TR tag node is specified.
1679 * @return The conversion result is returned.
1682 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1690 char *attr_style = NULL;
1691 char *attr_align = NULL;
1692 char *attr_valign = NULL;
1693 char *attr_bgcolor = NULL;
1695 jxhtml = GET_JXHTML(pdoc);
1699 /*--------------------------------------------------------------------------*/
1700 /* Get Attributes */
1701 /*--------------------------------------------------------------------------*/
1702 for (attr = qs_get_attr(doc,node);
1704 attr = qs_get_next_attr(doc,attr)) {
1705 char *name = qs_get_attr_name(doc,attr);
1706 char *val = qs_get_attr_value(doc,attr);
1707 if (STRCASEEQ('a','A',"align",name)) {
1708 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1709 attr_align = apr_pstrdup(doc->buf.pool, val);
1712 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1713 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1714 attr_valign = apr_pstrdup(doc->buf.pool, val);
1717 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1718 attr_style = apr_pstrdup(doc->buf.pool, val);
1720 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1721 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1722 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1726 if (IS_CSS_ON(jxhtml->entryp)) {
1727 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1729 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1730 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1731 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1733 css_property_t *cur;
1734 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1735 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1736 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1739 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1740 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1741 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1744 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1745 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1746 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1762 if (attr_bgcolor && *attr_bgcolor){
1773 * It is a handler who processes the TR tag.
1775 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1776 * destination is specified.
1777 * @param node [i] The TR tag node is specified.
1778 * @return The conversion result is returned.
1781 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1787 jxhtml = GET_JXHTML(pdoc);
1796 * It is a handler who processes the TD tag.
1798 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1799 * destination is specified.
1800 * @param node [i] The TR tag node is specified.
1801 * @return The conversion result is returned.
1804 s_jxhtml_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1812 char *attr_style = NULL;
1813 char *attr_align = NULL;
1814 char *attr_valign = NULL;
1815 char *attr_bgcolor = NULL;
1816 char *attr_colspan = NULL;
1817 char *attr_rowspan = NULL;
1818 char *attr_width = NULL;
1819 char *attr_height = NULL;
1821 jxhtml = GET_JXHTML(pdoc);
1825 /*--------------------------------------------------------------------------*/
1826 /* Get Attributes */
1827 /*--------------------------------------------------------------------------*/
1828 for (attr = qs_get_attr(doc,node);
1830 attr = qs_get_next_attr(doc,attr)) {
1831 char *name = qs_get_attr_name(doc,attr);
1832 char *val = qs_get_attr_value(doc,attr);
1833 if (STRCASEEQ('a','A',"align",name)) {
1834 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1835 attr_align = apr_pstrdup(doc->buf.pool, val);
1838 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1839 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1840 attr_valign = apr_pstrdup(doc->buf.pool, val);
1843 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1844 attr_style = apr_pstrdup(doc->buf.pool, val);
1846 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1847 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1848 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1850 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1851 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1853 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1854 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1856 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1857 char *tmp = strstr(val, "%");
1859 attr_width = apr_pstrdup(doc->buf.pool, val);
1862 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1865 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1866 char *tmp = strstr(val, "%");
1868 attr_height = apr_pstrdup(doc->buf.pool, val);
1871 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1876 if (IS_CSS_ON(jxhtml->entryp)) {
1877 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1879 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1880 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1881 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1882 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1883 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1885 css_property_t *cur;
1886 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1887 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1888 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1891 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1892 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1893 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1896 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1897 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1898 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1900 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1901 attr_width = apr_pstrdup(doc->pool, cur->value);
1903 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1904 attr_height = apr_pstrdup(doc->pool, cur->value);
1931 if (attr_bgcolor && *attr_bgcolor){
1936 if (attr_width || attr_height ){
1956 * It is a handler who processes the TD tag.
1958 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1959 * destination is specified.
1960 * @param node [i] The TR tag node is specified.
1961 * @return The conversion result is returned.
1964 s_jxhtml_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1970 jxhtml = GET_JXHTML(pdoc);
1981 * It is a handler who processes the TD tag.
1983 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1984 * destination is specified.
1985 * @param node [i] The TD tag node is specified.
1986 * @return The conversion result is returned.
1989 s_jxhtml_start_td_tag(void *pdoc, Node *node)
1991 return s_jxhtml_start_td_or_th_tag(pdoc,node,"td");
1994 * It is a handler who processes the TD tag.
1996 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1997 * destination is specified.
1998 * @param node [i] The TD tag node is specified.
1999 * @return The conversion result is returned.
2002 s_jxhtml_end_td_tag(void *pdoc, Node *node)
2004 return s_jxhtml_end_td_or_th_tag(pdoc,node,"td");
2008 * It is a handler who processes the TD tag.
2010 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2011 * destination is specified.
2012 * @param node [i] The TD tag node is specified.
2013 * @return The conversion result is returned.
2016 s_jxhtml_start_th_tag(void *pdoc, Node *node)
2018 return s_jxhtml_start_td_or_th_tag(pdoc,node,"th");
2021 * It is a handler who processes the TD tag.
2023 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2024 * destination is specified.
2025 * @param node [i] The TD tag node is specified.
2026 * @return The conversion result is returned.
2029 s_jxhtml_end_th_tag(void *pdoc, Node *node)
2031 return s_jxhtml_end_td_or_th_tag(pdoc,node,"th");
2035 * It is a handler who processes the FONT tag.
2037 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2038 * destination is specified.
2039 * @param node [i] The FONT tag node is specified.
2040 * @return The conversion result is returned.
2043 s_jxhtml_start_font_tag(void *pdoc, Node *node)
2049 char *attr_color = NULL;
2050 char *attr_size = NULL;
2051 char *attr_style = NULL;
2053 jxhtml = GET_JXHTML(pdoc);
2057 /*--------------------------------------------------------------------------*/
2058 /* Get Attributes */
2059 /*--------------------------------------------------------------------------*/
2060 for (attr = qs_get_attr(doc,node);
2062 attr = qs_get_next_attr(doc,attr)) {
2063 char *name = qs_get_attr_name(doc,attr);
2064 char *value = qs_get_attr_value(doc,attr);
2065 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2066 attr_color = apr_pstrdup(doc->buf.pool, value);
2068 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2069 /*----------------------------------------------------------------------*/
2071 /*----------------------------------------------------------------------*/
2072 attr_size = apr_pstrdup(doc->buf.pool, value);
2074 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2075 attr_style = apr_pstrdup(doc->buf.pool, value);
2078 if (IS_CSS_ON(jxhtml->entryp)) {
2079 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2081 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2082 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2083 css_property_t *cur;
2084 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2085 if (cur->value && *cur->value) {
2086 attr_color = apr_pstrdup(doc->pool, cur->value);
2089 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2090 if (cur->value && *cur->value) {
2091 attr_size = apr_pstrdup(doc->pool, cur->value);
2092 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2093 attr_size = apr_pstrdup(doc->pool, "1");
2095 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2096 attr_size = apr_pstrdup(doc->pool, "2");
2098 else if (STRCASEEQ('s','S',"small",attr_size)) {
2099 attr_size = apr_pstrdup(doc->pool, "3");
2101 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2102 attr_size = apr_pstrdup(doc->pool, "4");
2104 else if (STRCASEEQ('l','L',"large",attr_size)) {
2105 attr_size = apr_pstrdup(doc->pool, "5");
2107 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2108 attr_size = apr_pstrdup(doc->pool, "6");
2110 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2111 attr_size = apr_pstrdup(doc->pool, "7");
2117 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2118 memset(flg, 0, sizeof(*flg));
2120 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2121 W_L("<font color=\"");
2124 flg->font_color_flag = 1;
2127 flg->font_size_flag = 1;
2128 switch(*attr_size) {
2129 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2130 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2131 case '3': W_L("<span style=\"font-size: small\">"); break;
2132 case '4': W_L("<span style=\"font-size: medium\">"); break;
2133 case '5': W_L("<span style=\"font-size: large\">"); break;
2134 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2135 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2137 if (*(attr_size + 1) == '1') {
2138 W_L("<span style=\"font-size: small\">");
2141 if (*(attr_size + 1) == '2') {
2142 W_L("<span style=\"font-size: x-small\">");
2145 if (*(attr_size + 1) == '3') {
2146 W_L("<span style=\"font-size: xx-small\">");
2149 flg->font_size_flag = 0;
2153 if (*(attr_size + 1) == '1') {
2154 W_L("<span style=\"font-size: large\">");
2157 if (*(attr_size + 1) == '2') {
2158 W_L("<span style=\"font-size: x-large\">");
2161 if (*(attr_size + 1) == '3') {
2162 W_L("<span style=\"font-size: xx-large\">");
2165 flg->font_size_flag = 0;
2169 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2170 flg->font_size_flag = 0;
2173 node->userData = flg;
2179 * It is a handler who processes the FONT tag.
2181 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2182 * destination is specified.
2183 * @param node [i] The FONT tag node is specified.
2184 * @return The conversion result is returned.
2187 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2193 jxhtml = GET_JXHTML(pdoc);
2197 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2198 if (flg && flg->font_size_flag) {
2201 if (flg && flg->font_color_flag) {
2204 if (IS_CSS_ON(jxhtml->entryp)) {
2205 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2213 * It is a handler who processes the FORM tag.
2215 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2216 * destination is specified.
2217 * @param node [i] The FORM tag node is specified.
2218 * @return The conversion result is returned.
2221 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2227 char *attr_action = NULL;
2228 char *attr_method = NULL;
2229 char *attr_style = NULL;
2230 char *attr_color = NULL;
2231 char *attr_align = NULL;
2232 char *attr_name = NULL;
2233 char *css_clear = NULL;
2234 char *new_hidden_tag = NULL;
2236 jxhtml = GET_JXHTML(pdoc);
2240 /*--------------------------------------------------------------------------*/
2241 /* Get Attributes */
2242 /*--------------------------------------------------------------------------*/
2243 for (attr = qs_get_attr(doc,node);
2245 attr = qs_get_next_attr(doc,attr)) {
2246 char *name = qs_get_attr_name(doc,attr);
2247 char *value = qs_get_attr_value(doc,attr);
2251 if (strcasecmp(name, "action") == 0) {
2252 /*--------------------------------------------------------------------*/
2254 /*--------------------------------------------------------------------*/
2255 attr_action = value;
2261 if (strcasecmp(name, "method") == 0) {
2262 /*--------------------------------------------------------------------*/
2264 /*--------------------------------------------------------------------*/
2265 attr_method = value;
2271 if (strcasecmp(name, "name") == 0) {
2272 /*--------------------------------------------------------------------*/
2274 /*--------------------------------------------------------------------*/
2281 if (strcasecmp(name, "style") == 0) {
2290 if (IS_CSS_ON(jxhtml->entryp)) {
2291 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2293 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2294 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2295 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2296 css_property_t *cur;
2297 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2298 if (STRCASEEQ('l','L',"left", cur->value)) {
2299 attr_align = apr_pstrdup(doc->pool, "left");
2301 else if (STRCASEEQ('c','C',"center",cur->value)) {
2302 attr_align = apr_pstrdup(doc->pool, "center");
2304 else if (STRCASEEQ('r','R',"right",cur->value)) {
2305 attr_align = apr_pstrdup(doc->pool, "right");
2308 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2309 attr_color = apr_pstrdup(doc->pool, cur->value);
2311 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2312 css_clear = apr_pstrdup(doc->pool, cur->value);
2317 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2321 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2322 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2324 char *old_qs = NULL;
2325 q = strchr(attr_action, '?');
2327 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);
2328 if (new_hidden_tag || old_qs) {
2358 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2359 memset(flg, 0, sizeof(*flg));
2361 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2362 W_L("<font color=\"");
2365 flg->with_font_flag = 1;
2368 W_L("<div align=\"");
2371 flg->with_div_flag = 1;
2373 node->userData = flg;
2374 if (new_hidden_tag) {
2375 W_V(new_hidden_tag);
2382 * It is a handler who processes the FORM tag.
2384 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2385 * destination is specified.
2386 * @param node [i] The FORM tag node is specified.
2387 * @return The conversion result is returned.
2390 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2392 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2393 Doc *doc = jxhtml->doc;
2395 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2396 if (flg && flg->with_div_flag) {
2399 if (flg && flg->with_font_flag) {
2403 if (IS_CSS_ON(jxhtml->entryp)) {
2404 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2412 * It is a handler who processes the INPUT tag.
2414 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2415 * destination is specified.
2416 * @param node [i] The INPUT tag node is specified.
2417 * @return The conversion result is returned.
2420 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2426 char *attr_accesskey = NULL;
2427 char *attr_max_length = NULL;
2428 char *attr_type = NULL;
2429 char *attr_name = NULL;
2430 char *attr_value = NULL;
2431 char *attr_istyle = NULL;
2432 char *attr_size = NULL;
2433 char *attr_checked = NULL;
2434 char *attr_style = NULL;
2436 jxhtml = GET_JXHTML(pdoc);
2440 /*--------------------------------------------------------------------------*/
2441 /* Get Attributes */
2442 /*--------------------------------------------------------------------------*/
2443 for (attr = qs_get_attr(doc,node);
2445 attr = qs_get_next_attr(doc,attr)) {
2446 char *name = qs_get_attr_name(doc,attr);
2447 char *value = qs_get_attr_value(doc,attr);
2448 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2449 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2450 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2451 STRCASEEQ('p','P',"password",tmp_type) ||
2452 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2453 STRCASEEQ('r','R',"radio", tmp_type) ||
2454 STRCASEEQ('h','H',"hidden", tmp_type) ||
2455 STRCASEEQ('s','S',"submit", tmp_type) ||
2456 STRCASEEQ('r','R',"reset", tmp_type))) {
2457 attr_type = tmp_type;
2460 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2463 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2466 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2467 attr_istyle = value;
2469 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2470 attr_max_length = value;
2472 else if (STRCASEEQ('c','C',"checked", name)) {
2473 attr_checked = value;
2475 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2476 attr_accesskey = value;
2478 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2481 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2486 if (IS_CSS_ON(jxhtml->entryp)) {
2487 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2489 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2490 css_property_t *cur;
2491 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2492 if (strcasestr(cur->value, "<ja:n>")) {
2495 else if (strcasestr(cur->value, "<ja:en>")) {
2498 else if (strcasestr(cur->value, "<ja:hk>")) {
2501 else if (strcasestr(cur->value, "<ja:h>")) {
2521 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2526 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2529 if (attr_accesskey) {
2530 W_L(" accesskey=\"");
2531 W_V(attr_accesskey);
2534 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2539 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2540 W_L(" istyle=\"4\"");
2542 /*--------------------------------------------------------------------------*/
2543 /* The figure is default for the password. */
2544 /*--------------------------------------------------------------------------*/
2545 if (attr_max_length && *attr_max_length) {
2546 if (chxj_chk_numeric(attr_max_length) == 0) {
2547 W_L(" maxlength=\"");
2548 W_V(attr_max_length);
2553 W_L(" checked=\"checked\"");
2569 jxhtml = GET_JXHTML(pdoc);
2582 /*--------------------------------------------------------------------------*/
2583 /* Get Attributes */
2584 /*--------------------------------------------------------------------------*/
2585 type = qs_get_type_attr(doc, node, doc->buf.pool);
2586 name = qs_get_name_attr(doc, node, doc->buf.pool);
2587 value = qs_get_value_attr(doc,node, doc->buf.pool);
2588 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2589 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2590 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2591 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2592 size = qs_get_size_attr(doc, node, doc->buf.pool);
2595 if (type && (STRCASEEQ('t','T',"text", type) ||
2596 STRCASEEQ('p','P',"password",type) ||
2597 STRCASEEQ('c','C',"checkbox",type) ||
2598 STRCASEEQ('r','R',"radio", type) ||
2599 STRCASEEQ('h','H',"hidden", type) ||
2600 STRCASEEQ('s','S',"submit", type) ||
2601 STRCASEEQ('r','R',"reset", type))) {
2607 if (size && *size) {
2612 if (name && *name) {
2614 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2617 if (value && *value) {
2618 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2619 apr_size_t value_len = strlen(value);
2620 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2624 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2627 if (accesskey && *accesskey) {
2628 W_L(" accesskey=\"");
2632 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2633 /*------------------------------------------------------------------------*/
2635 /*------------------------------------------------------------------------*/
2636 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2637 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2640 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2642 W_L("-wap-input-format:'*");
2648 else if (type && STRCASEEQ('p','P',"password",type)) {
2649 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2651 /*--------------------------------------------------------------------------*/
2652 /* The figure is default for the password. */
2653 /*--------------------------------------------------------------------------*/
2654 if (max_length && *max_length) {
2655 if (chxj_chk_numeric(max_length) == 0) {
2656 W_L(" maxlength=\"");
2663 W_L(" checked=\"checked\"");
2672 * It is a handler who processes the INPUT tag.
2674 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2675 * destination is specified.
2676 * @param node [i] The INPUT tag node is specified.
2677 * @return The conversion result is returned.
2680 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2682 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2688 * It is a handler who processes the CENTER tag.
2690 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2691 * destination is specified.
2692 * @param node [i] The CENTER tag node is specified.
2693 * @return The conversion result is returned.
2696 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2701 char *attr_style = NULL;
2702 char *attr_color = NULL;
2703 char *attr_size = NULL;
2705 jxhtml = GET_JXHTML(pdoc);
2708 for (attr = qs_get_attr(doc,node);
2710 attr = qs_get_next_attr(doc,attr)) {
2711 char *name = qs_get_attr_name(doc,attr);
2712 char *value = qs_get_attr_value(doc,attr);
2713 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2717 if (IS_CSS_ON(jxhtml->entryp)) {
2718 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2720 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2721 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2722 css_property_t *cur;
2723 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2724 if (cur->value && *cur->value) {
2725 attr_color = apr_pstrdup(doc->pool, cur->value);
2728 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2729 if (cur->value && *cur->value) {
2730 attr_size = apr_pstrdup(doc->pool, cur->value);
2737 if (attr_size || attr_color) {
2745 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2759 * It is a handler who processes the CENTER tag.
2761 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2762 * destination is specified.
2763 * @param node [i] The CENTER tag node is specified.
2764 * @return The conversion result is returned.
2767 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2773 jxhtml = GET_JXHTML(pdoc);
2778 if (IS_CSS_ON(jxhtml->entryp)) {
2779 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2786 * It is a handler who processes the li tag.
2788 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2789 * destination is specified.
2790 * @param node [i] The li tag node is specified.
2791 * @return The conversion result is returned.
2794 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2800 char *attr_type = NULL;
2801 char *attr_value = NULL;
2802 char *attr_style = NULL;
2804 jxhtml = GET_JXHTML(pdoc);
2808 for (attr = qs_get_attr(doc,node);
2810 attr = qs_get_next_attr(doc,attr)) {
2811 char *name = qs_get_attr_name(doc,attr);
2812 char *value = qs_get_attr_value(doc,attr);
2813 if (STRCASEEQ('t','T',"type",name)) {
2814 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2815 if (*value == '1') {
2816 attr_type = apr_pstrdup(doc->pool, "decimal");
2818 else if (*value == 'a') {
2819 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2821 else if (*value == 'A') {
2822 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2829 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2832 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2836 if (IS_CSS_ON(jxhtml->entryp)) {
2837 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2839 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2840 css_property_t *cur;
2841 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2842 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2843 attr_type = apr_pstrdup(doc->pool, "decimal");
2845 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2846 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2848 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2849 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2851 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2852 attr_type = apr_pstrdup(doc->pool, "disc");
2854 else if (STRCASEEQ('s','S',"square", cur->value)) {
2855 attr_type = apr_pstrdup(doc->pool, "square");
2857 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2858 attr_type = apr_pstrdup(doc->pool, "circle");
2868 W_L("list-style-type:");
2884 * It is a handler who processes the li tag.
2886 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2887 * destination is specified.
2888 * @param node [i] The li tag node is specified.
2889 * @return The conversion result is returned.
2892 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2898 jxhtml = GET_JXHTML(pdoc);
2902 if (IS_CSS_ON(jxhtml->entryp)) {
2903 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2911 * It is a handler who processes the OL tag.
2913 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2914 * destination is specified.
2915 * @param node [i] The OL tag node is specified.
2916 * @return The conversion result is returned.
2919 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2925 char *attr_style = NULL;
2926 char *attr_start = NULL;
2927 char *attr_type = NULL;
2929 jxhtml = GET_JXHTML(pdoc);
2933 /*--------------------------------------------------------------------------*/
2934 /* Get Attributes */
2935 /*--------------------------------------------------------------------------*/
2936 for (attr = qs_get_attr(doc,node);
2938 attr = qs_get_next_attr(doc,attr)) {
2939 char *name = qs_get_attr_name(doc,attr);
2940 char *value = qs_get_attr_value(doc,attr);
2941 if (STRCASEEQ('t','T',"type",name) && value) {
2942 if (*value == '1') {
2943 attr_type = apr_pstrdup(doc->pool, "decimal");
2945 else if (*value == 'a') {
2946 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2948 else if (*value == 'A') {
2949 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2952 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2955 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2959 if (IS_CSS_ON(jxhtml->entryp)) {
2960 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2962 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2963 css_property_t *cur;
2964 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2965 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2966 attr_type = apr_pstrdup(doc->pool, "decimal");
2968 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2969 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2971 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2972 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2980 W_L("list-style-type:");
2997 * It is a handler who processes the OL tag.
2999 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3000 * destination is specified.
3001 * @param node [i] The OL tag node is specified.
3002 * @return The conversion result is returned.
3005 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
3011 jxhtml = GET_JXHTML(pdoc);
3016 if (IS_CSS_ON(jxhtml->entryp)) {
3017 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3024 * It is a handler who processes the P tag.
3026 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3027 * destination is specified.
3028 * @param node [i] The P tag node is specified.
3029 * @return The conversion result is returned.
3032 s_jxhtml_start_p_tag(void *pdoc, Node *node)
3038 char *attr_align = NULL;
3039 char *attr_style = NULL;
3040 char *attr_color = NULL;
3041 char *attr_blink = NULL;
3042 char *css_clear = NULL;
3044 jxhtml = GET_JXHTML(pdoc);
3048 for (attr = qs_get_attr(doc,node);
3050 attr = qs_get_next_attr(doc,attr)) {
3051 char *nm = qs_get_attr_name(doc,attr);
3052 char *val = qs_get_attr_value(doc,attr);
3053 if (STRCASEEQ('a','A',"align", nm)) {
3054 /*----------------------------------------------------------------------*/
3055 /* CHTML 1.0 (W3C version 3.2) */
3056 /*----------------------------------------------------------------------*/
3057 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3058 attr_align = apr_pstrdup(doc->buf.pool, val);
3062 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3063 attr_style = apr_pstrdup(doc->buf.pool, val);
3066 if (IS_CSS_ON(jxhtml->entryp)) {
3067 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3069 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3070 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3071 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3072 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3073 css_property_t *cur;
3074 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3075 if (STRCASEEQ('l','L',"left",cur->value)) {
3076 attr_align = apr_pstrdup(doc->pool, "left");
3078 else if (STRCASEEQ('c','C',"center",cur->value)) {
3079 attr_align = apr_pstrdup(doc->pool, "center");
3081 else if (STRCASEEQ('r','R',"right",cur->value)) {
3082 attr_align = apr_pstrdup(doc->pool, "right");
3085 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3086 if (cur->value && *cur->value) {
3087 attr_color = apr_pstrdup(doc->pool, cur->value);
3090 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3091 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3092 attr_blink = apr_pstrdup(doc->pool, cur->value);
3095 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3096 css_clear = apr_pstrdup(doc->pool, cur->value);
3101 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3109 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3115 W_L("text-decoration:");
3132 * It is a handler who processes the P tag.
3134 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3135 * destination is specified.
3136 * @param node [i] The P tag node is specified.
3137 * @return The conversion result is returned.
3140 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3142 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3143 Doc *doc = jxhtml->doc;
3146 if (IS_CSS_ON(jxhtml->entryp)) {
3147 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3154 * It is a handler who processes the PRE tag.
3156 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3157 * destination is specified.
3158 * @param node [i] The PRE tag node is specified.
3159 * @return The conversion result is returned.
3162 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3164 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3165 Doc *doc = jxhtml->doc;
3167 char *attr_style = NULL;
3169 for (attr = qs_get_attr(doc,node);
3171 attr = qs_get_next_attr(doc,attr)) {
3172 char *nm = qs_get_attr_name(doc,attr);
3173 char *val = qs_get_attr_value(doc,attr);
3174 if (val && STRCASEEQ('s','S',"style", nm)) {
3179 if (IS_CSS_ON(jxhtml->entryp)) {
3180 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3190 * It is a handler who processes the PRE tag.
3192 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3193 * destination is specified.
3194 * @param node [i] The PRE tag node is specified.
3195 * @return The conversion result is returned.
3198 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3200 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3201 Doc *doc = jxhtml->doc;
3205 if (IS_CSS_ON(jxhtml->entryp)) {
3206 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3214 * It is a handler who processes the UL tag.
3216 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3217 * destination is specified.
3218 * @param node [i] The UL tag node is specified.
3219 * @return The conversion result is returned.
3222 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3224 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3225 Doc *doc = jxhtml->doc;
3227 char *attr_type = NULL;
3228 char *attr_style = NULL;
3229 /*--------------------------------------------------------------------------*/
3230 /* Get Attributes */
3231 /*--------------------------------------------------------------------------*/
3232 for (attr = qs_get_attr(doc,node);
3234 attr = qs_get_next_attr(doc,attr)) {
3235 char *name = qs_get_attr_name(doc,attr);
3236 char *value = qs_get_attr_value(doc,attr);
3237 if (STRCASEEQ('t','T',"type",name)) {
3238 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3242 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3246 if (IS_CSS_ON(jxhtml->entryp)) {
3247 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3249 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3250 css_property_t *cur;
3251 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3252 if (STRCASEEQ('d','D',"disc",cur->value)) {
3253 attr_type = apr_pstrdup(doc->pool, "disc");
3255 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3256 attr_type = apr_pstrdup(doc->pool, "circle");
3258 else if (STRCASEEQ('s','S',"square",cur->value)) {
3259 attr_type = apr_pstrdup(doc->pool, "square");
3267 W_L("list-style-type:");
3278 * It is a handler who processes the UL tag.
3280 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3281 * destination is specified.
3282 * @param node [i] The UL tag node is specified.
3283 * @return The conversion result is returned.
3286 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3288 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3289 Doc *doc = jxhtml->doc;
3292 if (IS_CSS_ON(jxhtml->entryp)) {
3293 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3300 * It is a handler who processes the HR tag.
3302 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3303 * destination is specified.
3304 * @param node [i] The HR tag node is specified.
3305 * @return The conversion result is returned.
3308 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3314 char *attr_align = NULL;
3315 char *attr_size = NULL;
3316 char *attr_width = NULL;
3317 char *attr_noshade = NULL;
3318 char *attr_style = NULL;
3319 char *attr_color = NULL;
3321 char *style_float = NULL;
3322 char *style_border_color = NULL;
3324 jxhtml = GET_JXHTML(pdoc);
3328 for (attr = qs_get_attr(doc,node);
3330 attr = qs_get_next_attr(doc,attr)) {
3331 char *name = qs_get_attr_name (doc,attr);
3332 char *value = qs_get_attr_value(doc,attr);
3336 if (strcasecmp(name, "align") == 0) {
3337 /*--------------------------------------------------------------------*/
3339 /*--------------------------------------------------------------------*/
3340 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3348 if (strcasecmp(name, "size") == 0) {
3349 /*--------------------------------------------------------------------*/
3351 /*--------------------------------------------------------------------*/
3352 if (value && *value) {
3356 else if (strcasecmp(name, "style") == 0) {
3357 if (value && *value) {
3365 if (strcasecmp(name, "width") == 0) {
3366 /*--------------------------------------------------------------------*/
3368 /*--------------------------------------------------------------------*/
3369 if (value && *value) {
3377 if (strcasecmp(name, "noshade") == 0) {
3378 /*--------------------------------------------------------------------*/
3380 /*--------------------------------------------------------------------*/
3381 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3387 if (strcasecmp(name, "color") == 0 && value && *value) {
3388 /*--------------------------------------------------------------------*/
3390 /*--------------------------------------------------------------------*/
3399 if (IS_CSS_ON(jxhtml->entryp)) {
3400 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3402 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3403 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3404 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3406 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3407 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3408 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3409 css_property_t *cur;
3411 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3412 if (STRCASEEQ('s','S',"solid",cur->value)) {
3413 attr_noshade = "noshade";
3416 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3417 char *tmp = apr_pstrdup(doc->pool, cur->value);
3418 char *tmpp = strstr(tmp, "px");
3420 attr_size = apr_pstrdup(doc->pool, tmp);
3424 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3425 char *tmp = apr_pstrdup(doc->pool,cur->value);
3426 attr_color = apr_pstrdup(doc->pool,tmp);
3429 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3430 char *tmp = apr_pstrdup(doc->pool, cur->value);
3431 char *tmpp = strstr(tmp,"none");
3433 style_float = "center";
3436 style_float = apr_pstrdup(doc->pool,tmp);
3441 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3442 char *tmp = apr_pstrdup(doc->pool, cur->value);
3443 char *tmpp = strstr(tmp, "px");
3445 attr_width = apr_pstrdup(doc->pool, tmp);
3448 tmpp = strstr(tmp, "%");
3450 attr_width = apr_pstrdup(doc->pool, tmp);
3455 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3456 char *tmp = apr_pstrdup(doc->pool, cur->value);
3458 style_border_color = apr_pstrdup(doc->pool, tmp);
3476 if (attr_size || attr_width || attr_noshade || style_border_color) {
3481 if (!strstr(attr_size, "px")) {
3489 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3495 W_L("border-style:solid;");
3497 if(style_border_color){
3498 W_L("border-color:");
3499 W_V(style_border_color);
3517 * It is a handler who processes the HR tag.
3519 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3520 * destination is specified.
3521 * @param node [i] The HR tag node is specified.
3522 * @return The conversion result is returned.
3525 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3527 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3533 * It is a handler who processes the IMG tag.
3535 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3536 * destination is specified.
3537 * @param node [i] The IMG tag node is specified.
3538 * @return The conversion result is returned.
3541 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3543 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3544 Doc *doc = jxhtml->doc;
3545 request_rec *r = doc->r;
3547 char *attr_src = NULL;
3548 char *attr_height = NULL;
3549 char *attr_width = NULL;
3550 char *attr_align = NULL;
3551 char *attr_alt = NULL;
3552 char *attr_style = NULL;
3553 char *attr_hspace = NULL;
3554 char *attr_vspace = NULL;
3556 char *css_float = NULL;
3557 char *css_margin_left = NULL;
3558 char *css_margin_right = NULL;
3559 char *css_margin_top = NULL;
3560 char *css_margin_bottom = NULL;
3561 char *css_display = NULL;
3562 char *css_valign = NULL;
3564 #ifndef IMG_NOT_CONVERT_FILENAME
3565 device_table *spec = jxhtml->spec;
3568 /*--------------------------------------------------------------------------*/
3569 /* Get Attributes */
3570 /*--------------------------------------------------------------------------*/
3571 for (attr = qs_get_attr(doc,node);
3573 attr = qs_get_next_attr(doc,attr)) {
3574 char *name = qs_get_attr_name(doc,attr);
3575 char *value = qs_get_attr_value(doc,attr);
3576 if (STRCASEEQ('s','S',"src",name)) {
3577 /*----------------------------------------------------------------------*/
3579 /*----------------------------------------------------------------------*/
3580 #ifdef IMG_NOT_CONVERT_FILENAME
3581 value = chxj_encoding_parameter(r, value, 1);
3582 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3583 value = chxj_add_cookie_no_update_parameter(r, value);
3586 value = chxj_img_conv(r, spec, value);
3587 value = chxj_encoding_parameter(r, value, 1);
3588 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3589 value = chxj_add_cookie_no_update_parameter(r, value);
3593 else if (STRCASEEQ('a','A',"align",name)) {
3594 /*----------------------------------------------------------------------*/
3596 /*----------------------------------------------------------------------*/
3598 if (STRCASEEQ('t','T',"top", value) ||
3599 STRCASEEQ('m','M',"middle",value) ||
3600 STRCASEEQ('b','B',"bottom",value)){
3602 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3605 else if (STRCASEEQ('c','C',"center",value)) {
3606 css_valign = apr_pstrdup(doc->pool, "middle");
3610 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3611 /*----------------------------------------------------------------------*/
3613 /*----------------------------------------------------------------------*/
3616 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3617 /*----------------------------------------------------------------------*/
3619 /*----------------------------------------------------------------------*/
3620 attr_height = value;
3622 else if (STRCASEEQ('h','H',"hspace",name)) {
3623 /*----------------------------------------------------------------------*/
3625 /*----------------------------------------------------------------------*/
3626 attr_hspace = value;
3628 else if (STRCASEEQ('v','V',"vspace",name)) {
3629 /*----------------------------------------------------------------------*/
3631 /*----------------------------------------------------------------------*/
3632 attr_vspace = value;
3634 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3635 /*----------------------------------------------------------------------*/
3637 /*----------------------------------------------------------------------*/
3640 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3641 /*----------------------------------------------------------------------*/
3643 /*----------------------------------------------------------------------*/
3648 if (IS_CSS_ON(jxhtml->entryp)) {
3649 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3651 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3652 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3653 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3654 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3655 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3656 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3657 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3660 css_property_t *cur;
3661 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3662 attr_height = apr_pstrdup(doc->pool, cur->value);
3664 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3665 attr_width = apr_pstrdup(doc->pool, cur->value);
3668 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3669 css_valign = apr_pstrdup(doc->pool, cur->value);
3672 if (! attr_hspace) {
3673 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3674 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3676 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3677 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3680 if (! attr_vspace) {
3681 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3682 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3684 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3685 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3689 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3690 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3691 css_float = apr_pstrdup(doc->pool, cur->value);
3695 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3696 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3697 char *tmp = apr_pstrdup(doc->pool, cur->value);
3698 char *tmpp = strstr(tmp, "none");
3700 css_display = apr_pstrdup(doc->pool, tmp);
3712 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3720 W_L("vertical-align:");
3725 W_L("margin-left:");
3728 W_L("margin-right:");
3733 if(css_margin_left){
3734 W_L("margin-left:");
3735 W_V(css_margin_left);
3738 if(css_margin_right){
3739 W_L("margin-right:");
3740 W_V(css_margin_right);
3748 W_L("margin-bottom:");
3755 W_V(css_margin_top);
3758 if(css_margin_bottom){
3759 W_L("margin-bottom:");
3760 W_V(css_margin_bottom);
3765 W_L("display:none;");
3794 * It is a handler who processes the IMG tag.
3796 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3797 * destination is specified.
3798 * @param node [i] The IMG tag node is specified.
3799 * @return The conversion result is returned.
3802 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3804 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3810 * It is a handler who processes the SELECT tag.
3812 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3813 * destination is specified.
3814 * @param node [i] The SELECT tag node is specified.
3815 * @return The conversion result is returned.
3818 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3820 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3821 Doc *doc = jxhtml->doc;
3825 char *multiple = NULL;
3826 char *attr_style = NULL;
3829 for (attr = qs_get_attr(doc,node);
3831 attr = qs_get_next_attr(doc,attr)) {
3832 char *nm = qs_get_attr_name(doc,attr);
3833 char *val = qs_get_attr_value(doc,attr);
3834 if (STRCASEEQ('s','S',"size",nm)) {
3835 /*----------------------------------------------------------------------*/
3836 /* CHTML 1.0 version 2.0 */
3837 /*----------------------------------------------------------------------*/
3838 size = apr_pstrdup(doc->buf.pool, val);
3840 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3841 /*----------------------------------------------------------------------*/
3842 /* CHTML 1.0 version 2.0 */
3843 /*----------------------------------------------------------------------*/
3844 attr_style = apr_pstrdup(doc->buf.pool, val);
3846 else if (STRCASEEQ('n','N',"name",nm)) {
3847 /*----------------------------------------------------------------------*/
3848 /* CHTML 1.0 version 2.0 */
3849 /*----------------------------------------------------------------------*/
3850 name = apr_pstrdup(doc->buf.pool, val);
3852 else if (STRCASEEQ('m','M',"multiple", nm)) {
3853 /*----------------------------------------------------------------------*/
3854 /* CHTML 1.0 version 2.0 */
3855 /*----------------------------------------------------------------------*/
3856 multiple = apr_pstrdup(doc->buf.pool, val);
3859 if (size && *size) {
3864 if (name && *name) {
3874 if (IS_CSS_ON(jxhtml->entryp)) {
3875 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3883 * It is a handler who processes the SELECT tag.
3885 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3886 * destination is specified.
3887 * @param node [i] The SELECT tag node is specified.
3888 * @return The conversion result is returned.
3891 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3893 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3894 Doc *doc = jxhtml->doc;
3897 if (IS_CSS_ON(jxhtml->entryp)) {
3898 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3905 * It is a handler who processes the OPTION tag.
3907 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3908 * destination is specified.
3909 * @param node [i] The OPTION tag node is specified.
3910 * @return The conversion result is returned.
3913 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3915 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3916 Doc *doc = jxhtml->doc;
3919 char *selected = NULL;
3921 char *attr_style = NULL;
3924 for (attr = qs_get_attr(doc,node);
3926 attr = qs_get_next_attr(doc,attr)) {
3927 char *nm = qs_get_attr_name(doc,attr);
3928 char *val = qs_get_attr_value(doc,attr);
3929 if (STRCASEEQ('s','S',"selected",nm)) {
3930 /*----------------------------------------------------------------------*/
3931 /* CHTML 1.0 version 2.0 */
3932 /*----------------------------------------------------------------------*/
3933 selected = apr_pstrdup(doc->buf.pool, val);
3935 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3936 /*----------------------------------------------------------------------*/
3937 /* CHTML 1.0 version 2.0 */
3938 /*----------------------------------------------------------------------*/
3939 attr_style = apr_pstrdup(doc->buf.pool, val);
3941 else if (STRCASEEQ('v','V',"value",nm)) {
3942 /*----------------------------------------------------------------------*/
3943 /* CHTML 1.0 version 2.0 */
3944 /*----------------------------------------------------------------------*/
3945 value = apr_pstrdup(doc->buf.pool, val);
3958 if (IS_CSS_ON(jxhtml->entryp)) {
3959 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3967 * It is a handler who processes the OPTION tag.
3969 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3970 * destination is specified.
3971 * @param node [i] The OPTION tag node is specified.
3972 * @return The conversion result is returned.
3975 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3977 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3978 Doc *doc = jxhtml->doc;
3981 if (IS_CSS_ON(jxhtml->entryp)) {
3982 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3990 * It is a handler who processes the DIV tag.
3992 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3993 * destination is specified.
3994 * @param node [i] The DIV tag node is specified.
3995 * @return The conversion result is returned.
3998 s_jxhtml_start_div_tag(void *pdoc, Node *node)
4004 char *attr_style = NULL;
4005 char *attr_align = NULL;
4006 char *attr_display = NULL;
4007 char *attr_decoration = NULL;
4008 char *attr_wap_marquee_style = NULL;
4009 char *attr_wap_marquee_dir = NULL;
4010 char *attr_wap_marquee_loop = NULL;
4011 char *attr_color = NULL;
4012 char *attr_bgcolor = NULL;
4013 char *attr_font_size = NULL;
4014 char *css_clear = NULL;
4016 jxhtml = GET_JXHTML(pdoc);
4020 for (attr = qs_get_attr(doc,node);
4022 attr = qs_get_next_attr(doc,attr)) {
4023 char *nm = qs_get_attr_name(doc,attr);
4024 char *val = qs_get_attr_value(doc,attr);
4025 if (STRCASEEQ('a','A',"align",nm)) {
4026 /*----------------------------------------------------------------------*/
4027 /* CHTML 1.0 (W3C version 3.2) */
4028 /*----------------------------------------------------------------------*/
4029 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4030 attr_align = apr_pstrdup(doc->buf.pool, val);
4033 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4034 attr_style = apr_pstrdup(doc->buf.pool, val);
4038 if (IS_CSS_ON(jxhtml->entryp)) {
4039 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4041 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4042 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4043 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4044 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4045 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4046 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4047 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4048 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4050 css_property_t *cur;
4051 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4052 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4053 attr_display = apr_pstrdup(doc->pool, cur->value);
4056 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4057 if (STRCASEEQ('b','B',"blink", cur->value)) {
4058 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4061 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4062 attr_color = apr_pstrdup(doc->pool, cur->value);
4064 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4065 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4066 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4068 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4069 char *ss = strchr(cur->value, '#');
4071 ss = strstr(cur->value, "rgb");
4074 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4075 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4078 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4079 attr_align = apr_pstrdup(doc->pool, cur->value);
4081 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4082 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4083 || STRCASEEQ('x','X',"x-small",cur->value)
4084 || STRCASEEQ('s','S',"small",cur->value)
4085 || STRCASEEQ('m','M',"medium",cur->value)
4086 || STRCASEEQ('l','L',"large",cur->value)
4087 || STRCASEEQ('x','X',"x-large",cur->value)
4088 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4089 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4093 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4094 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4095 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4096 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4097 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4098 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4101 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4102 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4103 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4105 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4106 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4109 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4110 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4111 attr_wap_marquee_loop = "infinite";
4114 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4118 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4119 css_clear = apr_pstrdup(doc->pool, cur->value);
4127 || attr_wap_marquee_style
4128 || attr_wap_marquee_dir
4129 || attr_wap_marquee_loop
4145 if (attr_decoration) {
4146 W_L("text-decoration:");
4147 W_V(attr_decoration);
4150 if (attr_wap_marquee_style) {
4151 W_L("-wap-marquee-style:");
4152 W_V(attr_wap_marquee_style);
4155 if (attr_wap_marquee_dir) {
4156 W_L("-wap-marquee-dir:");
4157 W_V(attr_wap_marquee_dir);
4160 if (attr_wap_marquee_loop) {
4161 W_L("-wap-marquee-loop:");
4162 W_V(attr_wap_marquee_loop);
4171 W_L("background-color:");
4175 if (attr_font_size) {
4177 W_V(attr_font_size);
4193 * It is a handler who processes the DIV tag.
4195 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4196 * destination is specified.
4197 * @param node [i] The DIV tag node is specified.
4198 * @return The conversion result is returned.
4201 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4207 jxhtml = GET_JXHTML(pdoc);
4212 if (IS_CSS_ON(jxhtml->entryp)) {
4213 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4220 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4227 jxhtml = GET_JXHTML(pdoc);
4231 for (child = qs_get_child_node(doc, node);
4233 child = qs_get_next_node(doc, child)) {
4235 s_jxhtml_chxjif_tag(jxhtml, child);
4242 * It is a handler who processes the TEXTARE tag.
4244 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4245 * destination is specified.
4246 * @param node [i] The TEXTAREA tag node is specified.
4247 * @return The conversion result is returned.
4250 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4256 char *attr_accesskey = NULL;
4257 char *attr_name = NULL;
4258 char *attr_rows = NULL;
4259 char *attr_cols = NULL;
4260 char *attr_istyle = NULL;
4261 char *attr_style = NULL;
4264 jxhtml = GET_JXHTML(pdoc);
4268 jxhtml->textarea_flag++;
4269 for (attr = qs_get_attr(doc,node);
4271 attr = qs_get_next_attr(doc,attr)) {
4272 char *name = qs_get_attr_name(doc,attr);
4273 char *value = qs_get_attr_value(doc,attr);
4274 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4275 attr_accesskey = value;
4277 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4278 attr_istyle = value;
4280 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4283 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4286 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4289 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4293 if (IS_CSS_ON(jxhtml->entryp)) {
4294 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4296 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4297 css_property_t *cur;
4298 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4299 if (strcasestr(cur->value, "<ja:n>")) {
4302 else if (strcasestr(cur->value, "<ja:en>")) {
4305 else if (strcasestr(cur->value, "<ja:hk>")) {
4308 else if (strcasestr(cur->value, "<ja:h>")) {
4315 if (attr_accesskey) {
4316 W_L(" accesskey=\"");
4317 W_V(attr_accesskey);
4346 * It is a handler who processes the TEXTAREA tag.
4348 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4349 * destination is specified.
4350 * @param node [i] The TEXTAREA tag node is specified.
4351 * @return The conversion result is returned.
4354 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4360 jxhtml = GET_JXHTML(pdoc);
4365 jxhtml->textarea_flag--;
4372 * It is a handler who processes the B tag.
4374 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4375 * destination is specified.
4376 * @param node [i] The B tag node is specified.
4377 * @return The conversion result is returned.
4380 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4386 jxhtml = GET_JXHTML(pdoc);
4396 * It is a handler who processes the B tag.
4398 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4399 * destination is specified.
4400 * @param node [i] The B tag node is specified.
4401 * @return The conversion result is returned.
4404 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4406 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4407 Doc* doc = jxhtml->doc;
4414 s_jxhtml_text_tag(void* pdoc, Node* child)
4425 apr_size_t z2h_input_len;
4427 jxhtml = GET_JXHTML(pdoc);
4431 textval = qs_get_node_value(doc,child);
4432 if (strlen(textval) == 0) {
4436 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4437 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4439 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4440 memset(one_byte, 0, sizeof(one_byte));
4443 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4445 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4447 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4452 if (is_sjis_kanji(textval[ii])) {
4453 one_byte[0] = textval[ii+0];
4454 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4455 one_byte[0] = textval[ii+1];
4456 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4460 if (jxhtml->pre_flag) {
4461 one_byte[0] = textval[ii+0];
4462 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4465 if (jxhtml->textarea_flag) {
4466 one_byte[0] = textval[ii+0];
4467 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4470 if (textval[ii] != '\r' && textval[ii] != '\n') {
4471 one_byte[0] = textval[ii+0];
4472 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4476 z2h_input_len = strlen(tdst);
4477 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4485 * It is a handler who processes the BLOCKQUOTE tag.
4487 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4488 * destination is specified.
4489 * @param node [i] The BLOCKQUOTE tag node is specified.
4490 * @return The conversion result is returned.
4493 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4498 char *attr_style = NULL;
4499 char *attr_color = NULL;
4500 char *attr_size = NULL;
4502 jxhtml = GET_JXHTML(pdoc);
4504 for (attr = qs_get_attr(doc,node);
4506 attr = qs_get_next_attr(doc,attr)) {
4507 char *nm = qs_get_attr_name(doc,attr);
4508 char *val = qs_get_attr_value(doc,attr);
4509 if (val && STRCASEEQ('s','S',"style", nm)) {
4513 if (IS_CSS_ON(jxhtml->entryp)) {
4514 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4516 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4517 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4518 css_property_t *cur;
4519 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4520 if (cur->value && *cur->value) {
4521 attr_color = apr_pstrdup(doc->pool, cur->value);
4524 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4525 if (cur->value && *cur->value) {
4526 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4527 attr_size = apr_pstrdup(doc->pool, cur->value);
4529 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4530 attr_size = apr_pstrdup(doc->pool, cur->value);
4532 else if (STRCASEEQ('s','S',"small",cur->value)) {
4533 attr_size = apr_pstrdup(doc->pool, cur->value);
4535 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4536 attr_size = apr_pstrdup(doc->pool, cur->value);
4538 else if (STRCASEEQ('l','L',"large",cur->value)) {
4539 attr_size = apr_pstrdup(doc->pool, cur->value);
4541 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4542 attr_size = apr_pstrdup(doc->pool, cur->value);
4544 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4545 attr_size = apr_pstrdup(doc->pool, cur->value);
4552 if (attr_color || attr_size) {
4555 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4573 * It is a handler who processes the BLOCKQUOTE tag.
4575 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4576 * destination is specified.
4577 * @param node [i] The BLOCKQUOTE tag node is specified.
4578 * @return The conversion result is returned.
4581 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4583 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4584 Doc *doc = jxhtml->doc;
4585 W_L("</blockquote>");
4586 if (IS_CSS_ON(jxhtml->entryp)) {
4587 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4594 * It is a handler who processes the DIR tag.
4596 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4597 * destination is specified.
4598 * @param node [i] The DIR tag node is specified.
4599 * @return The conversion result is returned.
4602 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4604 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4605 Doc *doc = jxhtml->doc;
4607 char *attr_style = NULL;
4608 char *attr_color = NULL;
4609 char *attr_type = NULL;
4610 char *attr_size = NULL;
4611 for (attr = qs_get_attr(doc,node);
4613 attr = qs_get_next_attr(doc,attr)) {
4614 char *name = qs_get_attr_name(doc,attr);
4615 char *value = qs_get_attr_value(doc,attr);
4616 if (STRCASEEQ('t','T',"type",name)) {
4617 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4621 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4625 if (IS_CSS_ON(jxhtml->entryp)) {
4626 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4628 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4629 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4630 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4631 css_property_t *cur;
4632 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4633 if (cur->value && *cur->value) {
4634 attr_color = apr_pstrdup(doc->pool, cur->value);
4637 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4638 if (cur->value && *cur->value) {
4639 attr_type = apr_pstrdup(doc->pool, cur->value);
4642 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4643 if (cur->value && *cur->value) {
4644 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4645 attr_size = apr_pstrdup(doc->pool, cur->value);
4647 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4648 attr_size = apr_pstrdup(doc->pool, cur->value);
4650 else if (STRCASEEQ('s','S',"small",cur->value)) {
4651 attr_size = apr_pstrdup(doc->pool, cur->value);
4653 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4654 attr_size = apr_pstrdup(doc->pool, cur->value);
4656 else if (STRCASEEQ('l','L',"large",cur->value)) {
4657 attr_size = apr_pstrdup(doc->pool, cur->value);
4659 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4660 attr_size = apr_pstrdup(doc->pool, cur->value);
4662 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4663 attr_size = apr_pstrdup(doc->pool, cur->value);
4670 if (attr_type || attr_color || attr_size) {
4673 W_L("list-style-type:");
4678 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4696 * It is a handler who processes the DIR tag.
4698 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4699 * destination is specified.
4700 * @param node [i] The DIR tag node is specified.
4701 * @return The conversion result is returned.
4704 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4706 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4707 Doc *doc = jxhtml->doc;
4709 if (IS_CSS_ON(jxhtml->entryp)) {
4710 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4717 * It is a handler who processes the DL tag.
4719 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4720 * destination is specified.
4721 * @param node [i] The DL tag node is specified.
4722 * @return The conversion result is returned.
4725 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4727 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4728 Doc *doc = jxhtml->doc;
4730 char *attr_style = NULL;
4731 char *attr_color = NULL;
4732 char *attr_size = NULL;
4733 for (attr = qs_get_attr(doc,node);
4735 attr = qs_get_next_attr(doc,attr)) {
4736 char *name = qs_get_attr_name(doc,attr);
4737 char *value = qs_get_attr_value(doc,attr);
4738 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4742 if (IS_CSS_ON(jxhtml->entryp)) {
4743 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4745 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4746 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4747 css_property_t *cur;
4748 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4749 if (cur->value && *cur->value) {
4750 attr_color = apr_pstrdup(doc->pool, cur->value);
4753 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4754 if (cur->value && *cur->value) {
4755 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4756 attr_size = apr_pstrdup(doc->pool, cur->value);
4758 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4759 attr_size = apr_pstrdup(doc->pool, cur->value);
4761 else if (STRCASEEQ('s','S',"small",cur->value)) {
4762 attr_size = apr_pstrdup(doc->pool, cur->value);
4764 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4765 attr_size = apr_pstrdup(doc->pool, cur->value);
4767 else if (STRCASEEQ('l','L',"large",cur->value)) {
4768 attr_size = apr_pstrdup(doc->pool, cur->value);
4770 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4771 attr_size = apr_pstrdup(doc->pool, cur->value);
4773 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4774 attr_size = apr_pstrdup(doc->pool, cur->value);
4781 if (attr_color || attr_size) {
4784 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4802 * It is a handler who processes the DL tag.
4804 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4805 * destination is specified.
4806 * @param node [i] The DL tag node is specified.
4807 * @return The conversion result is returned.
4810 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4812 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4813 Doc *doc = jxhtml->doc;
4815 if (IS_CSS_ON(jxhtml->entryp)) {
4816 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4823 * It is a handler who processes the DT tag.
4825 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4826 * destination is specified.
4827 * @param node [i] The DT tag node is specified.
4828 * @return The conversion result is returned.
4831 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4833 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4834 Doc *doc = jxhtml->doc;
4836 char *attr_style = NULL;
4837 char *attr_color = NULL;
4838 char *attr_size = NULL;
4839 for (attr = qs_get_attr(doc,node);
4841 attr = qs_get_next_attr(doc,attr)) {
4842 char *name = qs_get_attr_name(doc,attr);
4843 char *value = qs_get_attr_value(doc,attr);
4844 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4848 if (IS_CSS_ON(jxhtml->entryp)) {
4849 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4851 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4852 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4853 css_property_t *cur;
4854 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4855 if (cur->value && *cur->value) {
4856 attr_color = apr_pstrdup(doc->pool, cur->value);
4859 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4860 if (cur->value && *cur->value) {
4861 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4862 attr_size = apr_pstrdup(doc->pool, cur->value);
4864 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4865 attr_size = apr_pstrdup(doc->pool, cur->value);
4867 else if (STRCASEEQ('s','S',"small",cur->value)) {
4868 attr_size = apr_pstrdup(doc->pool, cur->value);
4870 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4871 attr_size = apr_pstrdup(doc->pool, cur->value);
4873 else if (STRCASEEQ('l','L',"large",cur->value)) {
4874 attr_size = apr_pstrdup(doc->pool, cur->value);
4876 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4877 attr_size = apr_pstrdup(doc->pool, cur->value);
4879 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4880 attr_size = apr_pstrdup(doc->pool, cur->value);
4887 if (attr_color || attr_size) {
4890 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4908 * It is a handler who processes the DT tag.
4910 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4911 * destination is specified.
4912 * @param node [i] The DT tag node is specified.
4913 * @return The conversion result is returned.
4916 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4918 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4919 Doc *doc = jxhtml->doc;
4921 if (IS_CSS_ON(jxhtml->entryp)) {
4922 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4929 * It is a handler who processes the DD tag.
4931 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4932 * destination is specified.
4933 * @param node [i] The DD tag node is specified.
4934 * @return The conversion result is returned.
4937 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4939 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4940 Doc *doc = jxhtml->doc;
4942 char *attr_style = NULL;
4943 char *attr_color = NULL;
4944 char *attr_size = NULL;
4945 for (attr = qs_get_attr(doc,node);
4947 attr = qs_get_next_attr(doc,attr)) {
4948 char *name = qs_get_attr_name(doc,attr);
4949 char *value = qs_get_attr_value(doc,attr);
4950 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4954 if (IS_CSS_ON(jxhtml->entryp)) {
4955 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4957 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4958 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4959 css_property_t *cur;
4960 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4961 if (cur->value && *cur->value) {
4962 attr_color = apr_pstrdup(doc->pool, cur->value);
4965 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4966 if (cur->value && *cur->value) {
4967 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4968 attr_size = apr_pstrdup(doc->pool, cur->value);
4970 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4971 attr_size = apr_pstrdup(doc->pool, cur->value);
4973 else if (STRCASEEQ('s','S',"small",cur->value)) {
4974 attr_size = apr_pstrdup(doc->pool, cur->value);
4976 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4977 attr_size = apr_pstrdup(doc->pool, cur->value);
4979 else if (STRCASEEQ('l','L',"large",cur->value)) {
4980 attr_size = apr_pstrdup(doc->pool, cur->value);
4982 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4983 attr_size = apr_pstrdup(doc->pool, cur->value);
4985 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4986 attr_size = apr_pstrdup(doc->pool, cur->value);
4993 if (attr_color || attr_size) {
4996 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5014 * It is a handler who processes the DD tag.
5016 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5017 * destination is specified.
5018 * @param node [i] The DD tag node is specified.
5019 * @return The conversion result is returned.
5022 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5024 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5025 Doc *doc = jxhtml->doc;
5027 if (IS_CSS_ON(jxhtml->entryp)) {
5028 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5035 * It is a handler who processes the H1 tag.
5037 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5038 * destination is specified.
5039 * @param node [i] The H1 tag node is specified.
5040 * @return The conversion result is returned.
5043 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5049 char *attr_style = NULL;
5050 char *attr_align = NULL;
5051 char *css_clear = NULL;
5053 jxhtml = GET_JXHTML(pdoc);
5057 for (attr = qs_get_attr(doc,node);
5059 attr = qs_get_next_attr(doc,attr)) {
5060 char *name = qs_get_attr_name(doc,attr);
5061 char *value = qs_get_attr_value(doc,attr);
5062 if (STRCASEEQ('a','A',"align", name)) {
5063 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5067 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5071 if (IS_CSS_ON(jxhtml->entryp)) {
5072 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5074 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5075 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5076 css_property_t *cur;
5077 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5078 if (STRCASEEQ('l','L',"left", cur->value)) {
5079 attr_align = apr_pstrdup(doc->pool, "left");
5081 else if (STRCASEEQ('c','C',"center",cur->value)) {
5082 attr_align = apr_pstrdup(doc->pool, "center");
5084 else if (STRCASEEQ('r','R',"right",cur->value)) {
5085 attr_align = apr_pstrdup(doc->pool, "right");
5088 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5089 if (STRCASEEQ('b','B',"both", cur->value)) {
5090 css_clear = apr_pstrdup(doc->pool, "both");
5092 else if (STRCASEEQ('r','R',"right", cur->value)) {
5093 css_clear = apr_pstrdup(doc->pool, "right");
5095 else if (STRCASEEQ('l','L',"left", cur->value)) {
5096 css_clear = apr_pstrdup(doc->pool, "left");
5102 if (attr_align || css_clear ) {
5123 * It is a handler who processes the H1 tag.
5125 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5126 * destination is specified.
5127 * @param node [i] The H1 tag node is specified.
5128 * @return The conversion result is returned.
5131 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5137 jxhtml = GET_JXHTML(pdoc);
5142 if (IS_CSS_ON(jxhtml->entryp)) {
5143 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5151 * It is a handler who processes the H2 tag.
5153 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5154 * destination is specified.
5155 * @param node [i] The H1 tag node is specified.
5156 * @return The conversion result is returned.
5159 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5165 char *attr_style = NULL;
5166 char *attr_align = NULL;
5167 char *css_clear = NULL;
5169 jxhtml = GET_JXHTML(pdoc);
5173 for (attr = qs_get_attr(doc,node);
5175 attr = qs_get_next_attr(doc,attr)) {
5176 char *name = qs_get_attr_name(doc,attr);
5177 char *value = qs_get_attr_value(doc,attr);
5178 if (STRCASEEQ('a','A',"align", name)) {
5179 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5183 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5187 if (IS_CSS_ON(jxhtml->entryp)) {
5188 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5190 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5191 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5192 css_property_t *cur;
5193 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5194 if (STRCASEEQ('l','L',"left", cur->value)) {
5195 attr_align = apr_pstrdup(doc->pool, "left");
5197 else if (STRCASEEQ('c','C',"center",cur->value)) {
5198 attr_align = apr_pstrdup(doc->pool, "center");
5200 else if (STRCASEEQ('r','R',"right",cur->value)) {
5201 attr_align = apr_pstrdup(doc->pool, "right");
5204 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5205 if (STRCASEEQ('b','B',"both", cur->value)) {
5206 css_clear = apr_pstrdup(doc->pool, "both");
5208 else if (STRCASEEQ('r','R',"right", cur->value)) {
5209 css_clear = apr_pstrdup(doc->pool, "right");
5211 else if (STRCASEEQ('l','L',"left", cur->value)) {
5212 css_clear = apr_pstrdup(doc->pool, "left");
5218 if (attr_align || css_clear ) {
5239 * It is a handler who processes the H2 tag.
5241 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5242 * destination is specified.
5243 * @param node [i] The H1 tag node is specified.
5244 * @return The conversion result is returned.
5247 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5253 jxhtml = GET_JXHTML(pdoc);
5258 if (IS_CSS_ON(jxhtml->entryp)) {
5259 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5266 * It is a handler who processes the H3 tag.
5268 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5269 * destination is specified.
5270 * @param node [i] The H1 tag node is specified.
5271 * @return The conversion result is returned.
5274 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5280 char *attr_style = NULL;
5281 char *attr_align = NULL;
5282 char *css_clear = NULL;
5284 jxhtml = GET_JXHTML(pdoc);
5288 for (attr = qs_get_attr(doc,node);
5290 attr = qs_get_next_attr(doc,attr)) {
5291 char *name = qs_get_attr_name(doc,attr);
5292 char *value = qs_get_attr_value(doc,attr);
5293 if (STRCASEEQ('a','A',"align", name)) {
5294 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5298 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5302 if (IS_CSS_ON(jxhtml->entryp)) {
5303 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5305 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5306 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5307 css_property_t *cur;
5308 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5309 if (STRCASEEQ('l','L',"left", cur->value)) {
5310 attr_align = apr_pstrdup(doc->pool, "left");
5312 else if (STRCASEEQ('c','C',"center",cur->value)) {
5313 attr_align = apr_pstrdup(doc->pool, "center");
5315 else if (STRCASEEQ('r','R',"right",cur->value)) {
5316 attr_align = apr_pstrdup(doc->pool, "right");
5319 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5320 if (STRCASEEQ('b','B',"both", cur->value)) {
5321 css_clear = apr_pstrdup(doc->pool, "both");
5323 else if (STRCASEEQ('r','R',"right", cur->value)) {
5324 css_clear = apr_pstrdup(doc->pool, "right");
5326 else if (STRCASEEQ('l','L',"left", cur->value)) {
5327 css_clear = apr_pstrdup(doc->pool, "left");
5333 if (attr_align || css_clear ) {
5354 * It is a handler who processes the H3 tag.
5356 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5357 * destination is specified.
5358 * @param node [i] The H1 tag node is specified.
5359 * @return The conversion result is returned.
5362 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5368 jxhtml = GET_JXHTML(pdoc);
5373 if (IS_CSS_ON(jxhtml->entryp)) {
5374 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5381 * It is a handler who processes the H4 tag.
5383 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5384 * destination is specified.
5385 * @param node [i] The H1 tag node is specified.
5386 * @return The conversion result is returned.
5389 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5395 char *attr_style = NULL;
5396 char *attr_align = NULL;
5397 char *css_clear = NULL;
5399 jxhtml = GET_JXHTML(pdoc);
5403 for (attr = qs_get_attr(doc,node);
5405 attr = qs_get_next_attr(doc,attr)) {
5406 char *name = qs_get_attr_name(doc,attr);
5407 char *value = qs_get_attr_value(doc,attr);
5408 if (STRCASEEQ('a','A',"align", name)) {
5409 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5413 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5417 if (IS_CSS_ON(jxhtml->entryp)) {
5418 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5420 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5421 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5422 css_property_t *cur;
5423 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5424 if (STRCASEEQ('l','L',"left", cur->value)) {
5425 attr_align = apr_pstrdup(doc->pool, "left");
5427 else if (STRCASEEQ('c','C',"center",cur->value)) {
5428 attr_align = apr_pstrdup(doc->pool, "center");
5430 else if (STRCASEEQ('r','R',"right",cur->value)) {
5431 attr_align = apr_pstrdup(doc->pool, "right");
5434 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5435 if (STRCASEEQ('b','B',"both", cur->value)) {
5436 css_clear = apr_pstrdup(doc->pool, "both");
5438 else if (STRCASEEQ('r','R',"right", cur->value)) {
5439 css_clear = apr_pstrdup(doc->pool, "right");
5441 else if (STRCASEEQ('l','L',"left", cur->value)) {
5442 css_clear = apr_pstrdup(doc->pool, "left");
5448 if (attr_align || css_clear ) {
5469 * It is a handler who processes the H4 tag.
5471 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5472 * destination is specified.
5473 * @param node [i] The H1 tag node is specified.
5474 * @return The conversion result is returned.
5477 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5483 jxhtml = GET_JXHTML(pdoc);
5488 if (IS_CSS_ON(jxhtml->entryp)) {
5489 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5497 * It is a handler who processes the H5 tag.
5499 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5500 * destination is specified.
5501 * @param node [i] The H1 tag node is specified.
5502 * @return The conversion result is returned.
5505 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5511 char *attr_style = NULL;
5512 char *attr_align = NULL;
5513 char *css_clear = NULL;
5515 jxhtml = GET_JXHTML(pdoc);
5519 for (attr = qs_get_attr(doc,node);
5521 attr = qs_get_next_attr(doc,attr)) {
5522 char *name = qs_get_attr_name(doc,attr);
5523 char *value = qs_get_attr_value(doc,attr);
5524 if (STRCASEEQ('a','A',"align", name)) {
5525 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5529 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5533 if (IS_CSS_ON(jxhtml->entryp)) {
5534 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5536 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5537 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5538 css_property_t *cur;
5539 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5540 if (STRCASEEQ('l','L',"left", cur->value)) {
5541 attr_align = apr_pstrdup(doc->pool, "left");
5543 else if (STRCASEEQ('c','C',"center",cur->value)) {
5544 attr_align = apr_pstrdup(doc->pool, "center");
5546 else if (STRCASEEQ('r','R',"right",cur->value)) {
5547 attr_align = apr_pstrdup(doc->pool, "right");
5550 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5551 if (STRCASEEQ('b','B',"both", cur->value)) {
5552 css_clear = apr_pstrdup(doc->pool, "both");
5554 else if (STRCASEEQ('r','R',"right", cur->value)) {
5555 css_clear = apr_pstrdup(doc->pool, "right");
5557 else if (STRCASEEQ('l','L',"left", cur->value)) {
5558 css_clear = apr_pstrdup(doc->pool, "left");
5564 if (attr_align || css_clear ) {
5585 * It is a handler who processes the H5 tag.
5587 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5588 * destination is specified.
5589 * @param node [i] The H1 tag node is specified.
5590 * @return The conversion result is returned.
5593 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5599 jxhtml = GET_JXHTML(pdoc);
5604 if (IS_CSS_ON(jxhtml->entryp)) {
5605 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5613 * It is a handler who processes the H6 tag.
5615 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5616 * destination is specified.
5617 * @param node [i] The H1 tag node is specified.
5618 * @return The conversion result is returned.
5621 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5627 char *attr_style = NULL;
5628 char *attr_align = NULL;
5629 char *css_clear = NULL;
5631 jxhtml = GET_JXHTML(pdoc);
5635 for (attr = qs_get_attr(doc,node);
5637 attr = qs_get_next_attr(doc,attr)) {
5638 char *name = qs_get_attr_name(doc,attr);
5639 char *value = qs_get_attr_value(doc,attr);
5640 if (STRCASEEQ('a','A',"align", name)) {
5641 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5645 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5649 if (IS_CSS_ON(jxhtml->entryp)) {
5650 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5652 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5653 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5654 css_property_t *cur;
5655 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5656 if (STRCASEEQ('l','L',"left", cur->value)) {
5657 attr_align = apr_pstrdup(doc->pool, "left");
5659 else if (STRCASEEQ('c','C',"center",cur->value)) {
5660 attr_align = apr_pstrdup(doc->pool, "center");
5662 else if (STRCASEEQ('r','R',"right",cur->value)) {
5663 attr_align = apr_pstrdup(doc->pool, "right");
5666 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5667 if (STRCASEEQ('b','B',"both", cur->value)) {
5668 css_clear = apr_pstrdup(doc->pool, "both");
5670 else if (STRCASEEQ('r','R',"right", cur->value)) {
5671 css_clear = apr_pstrdup(doc->pool, "right");
5673 else if (STRCASEEQ('l','L',"left", cur->value)) {
5674 css_clear = apr_pstrdup(doc->pool, "left");
5680 if (attr_align || css_clear ) {
5701 * It is a handler who processes the H6 tag.
5703 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5704 * destination is specified.
5705 * @param node [i] The H1 tag node is specified.
5706 * @return The conversion result is returned.
5709 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5715 jxhtml = GET_JXHTML(pdoc);
5720 if (IS_CSS_ON(jxhtml->entryp)) {
5721 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5729 * It is a handler who processes the MENU tag.
5731 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5732 * destination is specified.
5733 * @param node [i] The MENU tag node is specified.
5734 * @return The conversion result is returned.
5737 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5739 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5740 Doc *doc = jxhtml->doc;
5742 char *attr_style = NULL;
5743 char *attr_color = NULL;
5744 char *attr_type = NULL;
5745 char *attr_size = NULL;
5746 for (attr = qs_get_attr(doc,node);
5748 attr = qs_get_next_attr(doc,attr)) {
5749 char *name = qs_get_attr_name(doc,attr);
5750 char *value = qs_get_attr_value(doc,attr);
5751 if (STRCASEEQ('t','T',"type",name)) {
5752 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5756 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5760 if (IS_CSS_ON(jxhtml->entryp)) {
5761 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5763 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5764 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5765 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5766 css_property_t *cur;
5767 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5768 if (cur->value && *cur->value) {
5769 attr_color = apr_pstrdup(doc->pool, cur->value);
5772 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5773 if (cur->value && *cur->value) {
5774 attr_type = apr_pstrdup(doc->pool, cur->value);
5777 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5778 if (cur->value && *cur->value) {
5779 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5780 attr_size = apr_pstrdup(doc->pool, cur->value);
5782 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5783 attr_size = apr_pstrdup(doc->pool, cur->value);
5785 else if (STRCASEEQ('s','S',"small",cur->value)) {
5786 attr_size = apr_pstrdup(doc->pool, cur->value);
5788 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5789 attr_size = apr_pstrdup(doc->pool, cur->value);
5791 else if (STRCASEEQ('l','L',"large",cur->value)) {
5792 attr_size = apr_pstrdup(doc->pool, cur->value);
5794 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5795 attr_size = apr_pstrdup(doc->pool, cur->value);
5797 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5798 attr_size = apr_pstrdup(doc->pool, cur->value);
5805 if (attr_type || attr_color || attr_size) {
5808 W_L("list-style-type:");
5813 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5831 * It is a handler who processes the MENU tag.
5833 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5834 * destination is specified.
5835 * @param node [i] The MENU tag node is specified.
5836 * @return The conversion result is returned.
5839 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5841 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5842 Doc *doc = jxhtml->doc;
5844 if (IS_CSS_ON(jxhtml->entryp)) {
5845 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5852 * It is a handler who processes the PLAINTEXT tag.
5854 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5855 * destination is specified.
5856 * @param node [i] The PLAINTEXT tag node is specified.
5857 * @return The conversion result is returned.
5860 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5865 jxhtml = GET_JXHTML(pdoc);
5868 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5873 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5878 jxhtml = GET_JXHTML(pdoc);
5880 for (child = qs_get_child_node(doc, node);
5882 child = qs_get_next_node(doc, child)) {
5884 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5891 * It is a handler who processes the PLAINTEXT tag.
5893 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5894 * destination is specified.
5895 * @param node [i] The PLAINTEXT tag node is specified.
5896 * @return The conversion result is returned.
5899 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5901 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5907 * It is a handler who processes the BLINK tag.
5909 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5910 * destination is specified.
5911 * @param node [i] The BLINK tag node is specified.
5912 * @return The conversion result is returned.
5915 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5917 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5918 Doc *doc = jxhtml->doc;
5920 char *attr_style = NULL;
5921 char *attr_color = NULL;
5922 char *attr_size = NULL;
5923 for (attr = qs_get_attr(doc,node);
5925 attr = qs_get_next_attr(doc,attr)) {
5926 char *name = qs_get_attr_name(doc,attr);
5927 char *value = qs_get_attr_value(doc,attr);
5928 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5932 if (IS_CSS_ON(jxhtml->entryp)) {
5933 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5935 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5936 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5937 css_property_t *cur;
5938 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5939 if (cur->value && *cur->value) {
5940 attr_color = apr_pstrdup(doc->pool, cur->value);
5943 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5944 if (cur->value && *cur->value) {
5945 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5946 attr_size = apr_pstrdup(doc->pool, cur->value);
5948 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5949 attr_size = apr_pstrdup(doc->pool, cur->value);
5951 else if (STRCASEEQ('s','S',"small",cur->value)) {
5952 attr_size = apr_pstrdup(doc->pool, cur->value);
5954 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5955 attr_size = apr_pstrdup(doc->pool, cur->value);
5957 else if (STRCASEEQ('l','L',"large",cur->value)) {
5958 attr_size = apr_pstrdup(doc->pool, cur->value);
5960 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5961 attr_size = apr_pstrdup(doc->pool, cur->value);
5963 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5964 attr_size = apr_pstrdup(doc->pool, cur->value);
5971 if (attr_color || attr_size) {
5974 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5992 * It is a handler who processes the BLINK tag.
5994 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5995 * destination is specified.
5996 * @param node [i] The BLINK tag node is specified.
5997 * @return The conversion result is returned.
6000 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6002 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6003 Doc *doc = jxhtml->doc;
6005 if (IS_CSS_ON(jxhtml->entryp)) {
6006 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6013 * It is a handler who processes the MARQUEE tag.
6015 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6016 * destination is specified.
6017 * @param node [i] The MARQUEE tag node is specified.
6018 * @return The conversion result is returned.
6021 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6023 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6024 Doc *doc = jxhtml->doc;
6026 char *attr_direction = NULL;
6027 char *attr_style = NULL;
6028 char *attr_color = NULL;
6029 char *attr_size = NULL;
6030 char *attr_bgcolor = NULL;
6031 /*--------------------------------------------------------------------------*/
6032 /* Get Attributes */
6033 /*--------------------------------------------------------------------------*/
6034 for (attr = qs_get_attr(doc,node);
6036 attr = qs_get_next_attr(doc,attr)) {
6037 char *name = qs_get_attr_name(doc,attr);
6038 char *value = qs_get_attr_value(doc,attr);
6039 if (STRCASEEQ('d','D',"direction", name)) {
6041 if (STRCASEEQ('l','L',"left",value)) {
6042 attr_direction = "rtl";
6044 else if (STRCASEEQ('r','R',"right",value)) {
6045 attr_direction = "ltr";
6049 else if (STRCASEEQ('b','B',"behavior",name)) {
6052 else if (STRCASEEQ('l','L',"loop",name)) {
6055 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6056 if (value && *value) {
6057 attr_bgcolor = value;
6060 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6064 if (IS_CSS_ON(jxhtml->entryp)) {
6065 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
6067 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6068 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6069 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6070 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6071 css_property_t *cur;
6072 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6073 if (cur->value && *cur->value) {
6074 attr_color = apr_pstrdup(doc->pool, cur->value);
6077 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6078 if (cur->value && *cur->value) {
6079 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6082 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6083 if (cur->value && *cur->value) {
6084 attr_direction = apr_pstrdup(doc->pool, cur->value);
6087 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6088 if (cur->value && *cur->value) {
6089 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6090 || STRCASEEQ('x','X',"x-small", cur->value)
6091 || STRCASEEQ('s','S',"small", cur->value)
6092 || STRCASEEQ('m','M',"medium", cur->value)
6093 || STRCASEEQ('l','L',"large", cur->value)
6094 || STRCASEEQ('x','X',"x-large", cur->value)
6095 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6096 attr_size = apr_pstrdup(doc->pool, cur->value);
6103 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6105 if (attr_direction) {
6106 W_L("-wap-marquee-dir:");
6107 W_V(attr_direction);
6111 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6112 W_L("background-color:");
6117 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6136 * It is a handler who processes the MARQUEE tag.
6138 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6139 * destination is specified.
6140 * @param node [i] The MARQUEE tag node is specified.
6141 * @return The conversion result is returned.
6144 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6146 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6147 Doc *doc = jxhtml->doc;
6149 if (IS_CSS_ON(jxhtml->entryp)) {
6150 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6157 * It is handler who processes the New Line Code.
6160 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6162 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6163 if (jxhtml->start_html_flag) {
6164 Doc *doc = jxhtml->doc;
6172 * It is a handler who processes the LINK tag.
6174 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6175 * destination is specified.
6176 * @param node [i] The LINK tag node is specified.
6177 * @return The conversion result is returned.
6180 s_jxhtml_link_tag(void *pdoc, Node *node)
6189 jxhtml = GET_JXHTML(pdoc);
6192 if (! IS_CSS_ON(jxhtml->entryp)) {
6196 for (attr = qs_get_attr(doc,node);
6198 attr = qs_get_next_attr(doc,attr)) {
6199 char *name = qs_get_attr_name(doc,attr);
6200 char *value = qs_get_attr_value(doc,attr);
6201 if (STRCASEEQ('r','R',"rel", name)) {
6202 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6206 else if (STRCASEEQ('h','H',"href", name)) {
6207 if (value && *value) {
6211 else if (STRCASEEQ('t','T',"type", name)) {
6212 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6218 if (rel && href && type) {
6219 DBG(doc->r, "start load CSS. url:[%s]", href);
6220 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6221 DBG(doc->r, "end load CSS. url:[%s]", href);
6228 static css_prop_list_t *
6229 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6231 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6232 Doc *doc = jxhtml->doc;
6233 css_prop_list_t *last_css = NULL;
6234 if (IS_CSS_ON(jxhtml->entryp)) {
6235 css_prop_list_t *dup_css;
6236 css_selector_t *selector;
6238 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6239 dup_css = chxj_dup_css_prop_list(doc, last_css);
6240 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6242 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6244 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6245 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6247 if (style_attr_value) {
6248 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));
6250 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6258 static css_prop_list_t *
6259 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6261 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6262 Doc *doc = jxhtml->doc;
6263 css_prop_list_t *last_css = NULL;
6264 if (IS_CSS_ON(jxhtml->entryp)) {
6265 css_prop_list_t *dup_css;
6266 css_selector_t *selector;
6268 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6269 dup_css = chxj_dup_css_prop_list(doc, last_css);
6270 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6272 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6276 if (style_attr_value) {
6277 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));
6279 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6288 * It is a handler who processes the SPAN tag.
6290 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6291 * destination is specified.
6292 * @param node [i] The SPAN tag node is specified.
6293 * @return The conversion result is returned.
6296 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6301 char *attr_style = NULL;
6302 char *attr_color = NULL;
6303 char *attr_size = NULL;
6304 char *attr_align = NULL;
6305 char *attr_blink = NULL;
6306 char *attr_marquee = NULL;
6307 char *attr_marquee_dir = NULL;
6308 char *attr_marquee_style = NULL;
6309 char *attr_marquee_loop = NULL;
6310 char *css_bgcolor = NULL;
6312 jxhtml = GET_JXHTML(pdoc);
6315 for (attr = qs_get_attr(doc,node);
6317 attr = qs_get_next_attr(doc,attr)) {
6318 char *nm = qs_get_attr_name(doc,attr);
6319 char *val = qs_get_attr_value(doc,attr);
6320 if (val && STRCASEEQ('s','S',"style", nm)) {
6324 if (IS_CSS_ON(jxhtml->entryp)) {
6325 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
6327 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6328 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6329 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6330 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6331 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6332 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6333 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6334 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6335 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6337 css_property_t *cur;
6338 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6339 attr_color = apr_pstrdup(doc->pool, cur->value);
6341 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6342 if (cur->value && *cur->value) {
6343 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6344 || STRCASEEQ('x','X',"x-small", cur->value)
6345 || STRCASEEQ('s','S',"small", cur->value)
6346 || STRCASEEQ('m','M',"medium", cur->value)
6347 || STRCASEEQ('l','L',"large", cur->value)
6348 || STRCASEEQ('x','X',"x-large", cur->value)
6349 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6350 attr_size = apr_pstrdup(doc->pool, cur->value);
6354 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6355 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6356 attr_blink = apr_pstrdup(doc->pool, cur->value);
6359 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6360 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6361 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6364 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6365 if (cur->value && *cur->value) {
6366 if ( STRCASEEQ('l','L',"ltr",cur->value)
6367 || STRCASEEQ('r','R',"rtl",cur->value)) {
6368 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6372 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6373 if (cur->value && *cur->value) {
6374 if ( STRCASEEQ('s','S',"scroll",cur->value)
6375 || STRCASEEQ('s','S',"slide",cur->value)
6376 || STRCASEEQ('a','A',"alternate",cur->value)) {
6377 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6381 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6382 if (cur->value && *cur->value) {
6383 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6384 attr_marquee_loop = "infinite";
6387 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6391 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6392 if (STRCASEEQ('l','L',"left", cur->value)) {
6393 attr_align = apr_pstrdup(doc->pool, "left");
6395 else if (STRCASEEQ('c','C',"center",cur->value)) {
6396 attr_align = apr_pstrdup(doc->pool, "center");
6398 else if (STRCASEEQ('r','R',"right",cur->value)) {
6399 attr_align = apr_pstrdup(doc->pool, "right");
6402 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6403 if (cur->value && *cur->value) {
6404 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6411 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6414 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6430 W_L("text-decoration:");
6435 W_L("display:-wap-marquee;");
6436 if (attr_marquee_dir) {
6437 W_L("-wap-marquee-dir:");
6438 W_V(attr_marquee_dir);
6441 if (attr_marquee_style) {
6442 W_L("-wap-marquee-style:");
6443 W_V(attr_marquee_style);
6446 if (attr_marquee_loop) {
6447 W_L("-wap-marquee-loop:");
6448 W_V(attr_marquee_loop);
6453 W_L("background-color:");
6465 * It is a handler who processes the SPAN tag.
6467 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6468 * destination is specified.
6469 * @param node [i] The SPAN tag node is specified.
6470 * @return The conversion result is returned.
6473 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6475 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6476 Doc *doc = jxhtml->doc;
6479 if (IS_CSS_ON(jxhtml->entryp)) {
6480 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6487 * It is a handler who processes the STYLE tag.
6489 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6490 * destination is specified.
6491 * @param node [i] The STYLE tag node is specified.
6492 * @return The conversion result is returned.
6495 s_jxhtml_style_tag(void *pdoc, Node *node)
6502 jxhtml = GET_JXHTML(pdoc);
6505 if (! IS_CSS_ON(jxhtml->entryp)) {
6509 for (attr = qs_get_attr(doc,node);
6511 attr = qs_get_next_attr(doc,attr)) {
6512 char *name = qs_get_attr_name(doc,attr);
6513 char *value = qs_get_attr_value(doc,attr);
6514 if (STRCASEEQ('t','T',"type", name)) {
6515 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6521 Node *child = qs_get_child_node(doc, node);
6522 if (type && child) {
6523 char *name = qs_get_node_name(doc, child);
6524 if (STRCASEEQ('t','T',"text", name)) {
6525 char *value = qs_get_node_value(doc, child);
6526 DBG(doc->r, "start load CSS. buf:[%s]", value);
6527 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6528 DBG(doc->r, "end load CSS. value:[%s]", value);
6534 * It is a handler who processes the OBJECT tag.
6536 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6537 * destination is specified.
6538 * @param node [i] The OBJECT tag node is specified.
6539 * @return The conversion result is returned.
6542 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6544 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6545 Doc *doc = jxhtml->doc;
6548 char *attr_id = NULL;
6549 char *attr_width = NULL;
6550 char *attr_height = NULL;
6551 char *attr_data = NULL;
6552 char *attr_type = NULL;
6553 char *attr_declare = NULL;
6554 char *attr_classid = NULL;
6555 char *attr_codebase = NULL;
6557 /*--------------------------------------------------------------------------*/
6558 /* Get Attributes */
6559 /*--------------------------------------------------------------------------*/
6560 for (attr = qs_get_attr(doc,node);
6562 attr = qs_get_next_attr(doc,attr)) {
6563 char *name = qs_get_attr_name(doc,attr);
6564 char *value = qs_get_attr_value(doc,attr);
6565 if (STRCASEEQ('i','I',"id",name)) {
6566 attr_id = apr_pstrdup(doc->pool, value);
6568 else if (STRCASEEQ('w','W',"width",name)) {
6569 attr_width = apr_pstrdup(doc->pool, value);
6571 else if (STRCASEEQ('h','H',"height",name)) {
6572 attr_height = apr_pstrdup(doc->pool, value);
6574 else if (STRCASEEQ('d','D',"data",name)) {
6575 attr_data = apr_pstrdup(doc->pool, value);
6577 else if (STRCASEEQ('t','T',"type",name)) {
6578 attr_type = apr_pstrdup(doc->pool, value);
6580 else if (STRCASEEQ('d','D',"declare",name)) {
6581 attr_declare = apr_pstrdup(doc->pool, value);
6583 else if (STRCASEEQ('c','C',"classid",name)) {
6584 attr_classid = apr_pstrdup(doc->pool, value);
6586 else if (STRCASEEQ('c','C',"codebase",name)) {
6587 attr_codebase = apr_pstrdup(doc->pool, value);
6619 W_L(" declare=\"declare\"");
6627 W_L(" codebase=\"");
6636 * It is a handler who processes the OBJECT tag.
6638 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6639 * destination is specified.
6640 * @param node [i] The OBJECT tag node is specified.
6641 * @return The conversion result is returned.
6644 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6646 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6647 Doc *doc = jxhtml->doc;
6653 * It is a handler who processes the OBJECT tag.
6655 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6656 * destination is specified.
6657 * @param node [i] The OBJECT tag node is specified.
6658 * @return The conversion result is returned.
6661 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6663 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6664 Doc *doc = jxhtml->doc;
6667 char *attr_style = NULL;
6668 char *attr_name = NULL;
6669 char *attr_value = NULL;
6670 char *attr_valuetype = NULL;
6672 /*--------------------------------------------------------------------------*/
6673 /* Get Attributes */
6674 /*--------------------------------------------------------------------------*/
6675 for (attr = qs_get_attr(doc,node);
6677 attr = qs_get_next_attr(doc,attr)) {
6678 char *name = qs_get_attr_name(doc,attr);
6679 char *value = qs_get_attr_value(doc,attr);
6680 if (STRCASEEQ('n','N',"name",name)) {
6681 attr_name = apr_pstrdup(doc->pool, value);
6683 else if (STRCASEEQ('v','V',"value",name)) {
6684 attr_value = apr_pstrdup(doc->pool, value);
6686 else if (STRCASEEQ('v','V',"valuetype",name)) {
6687 attr_valuetype = apr_pstrdup(doc->pool, value);
6703 W_L(" valuetype=\"");
6704 W_V(attr_valuetype);