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);
65 static char *s_jxhtml_start_table_tag (void *pdoc, Node *node);
66 static char *s_jxhtml_end_table_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_start_tr_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_start_td_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_end_td_tag (void *pdoc, Node *node);
71 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
72 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
73 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
76 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
77 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
116 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
117 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
121 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
122 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
123 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
126 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
127 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
128 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
129 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
130 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
131 static char *s_jxhtml_start_object_tag (void *pdoc, Node *node);
132 static char *s_jxhtml_end_object_tag (void *pdoc, Node *node);
133 static char *s_jxhtml_start_param_tag (void *pdoc, Node *node);
135 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
137 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
139 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
140 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
144 tag_handler jxhtml_handler[] = {
147 s_jxhtml_start_html_tag,
148 s_jxhtml_end_html_tag,
152 s_jxhtml_start_meta_tag,
153 s_jxhtml_end_meta_tag,
157 s_jxhtml_start_textarea_tag,
158 s_jxhtml_end_textarea_tag,
162 s_jxhtml_start_p_tag,
167 s_jxhtml_start_pre_tag,
168 s_jxhtml_end_pre_tag,
172 s_jxhtml_start_ul_tag,
177 s_jxhtml_start_li_tag,
182 s_jxhtml_start_ol_tag,
187 s_jxhtml_start_h1_tag,
192 s_jxhtml_start_h2_tag,
197 s_jxhtml_start_h3_tag,
202 s_jxhtml_start_h4_tag,
207 s_jxhtml_start_h5_tag,
212 s_jxhtml_start_h6_tag,
217 s_jxhtml_start_head_tag,
218 s_jxhtml_end_head_tag,
222 s_jxhtml_start_title_tag,
223 s_jxhtml_end_title_tag,
227 s_jxhtml_start_base_tag,
228 s_jxhtml_end_base_tag,
232 s_jxhtml_start_body_tag,
233 s_jxhtml_end_body_tag,
237 s_jxhtml_start_a_tag,
242 s_jxhtml_start_br_tag,
247 s_jxhtml_start_table_tag,
248 s_jxhtml_end_table_tag,
252 s_jxhtml_start_tr_tag,
257 s_jxhtml_start_td_tag,
267 s_jxhtml_start_font_tag,
268 s_jxhtml_end_font_tag,
272 s_jxhtml_start_form_tag,
273 s_jxhtml_end_form_tag,
277 s_jxhtml_start_input_tag,
278 s_jxhtml_end_input_tag,
282 s_jxhtml_start_center_tag,
283 s_jxhtml_end_center_tag,
287 s_jxhtml_start_hr_tag,
292 s_jxhtml_start_img_tag,
293 s_jxhtml_end_img_tag,
297 s_jxhtml_start_select_tag,
298 s_jxhtml_end_select_tag,
302 s_jxhtml_start_option_tag,
303 s_jxhtml_end_option_tag,
307 s_jxhtml_start_div_tag,
308 s_jxhtml_end_div_tag,
337 s_jxhtml_start_span_tag,
338 s_jxhtml_end_span_tag,
352 s_jxhtml_start_b_tag,
362 s_jxhtml_start_dt_tag,
377 s_jxhtml_start_blockquote_tag,
378 s_jxhtml_end_blockquote_tag,
382 s_jxhtml_start_dir_tag,
383 s_jxhtml_end_dir_tag,
387 s_jxhtml_start_dl_tag,
392 s_jxhtml_start_dd_tag,
397 s_jxhtml_start_menu_tag,
398 s_jxhtml_end_menu_tag,
402 s_jxhtml_start_plaintext_tag,
403 s_jxhtml_end_plaintext_tag,
407 s_jxhtml_start_blink_tag,
408 s_jxhtml_end_blink_tag,
412 s_jxhtml_start_marquee_tag,
413 s_jxhtml_end_marquee_tag,
422 s_jxhtml_newline_mark,
427 s_jxhtml_start_object_tag,
428 s_jxhtml_end_object_tag,
432 s_jxhtml_start_param_tag,
439 * converts from CHTML5.0 to JXHTML.
441 * @param r [i] Requet_rec is appointed.
442 * @param spec [i] The result of the device specification processing which
443 * was done in advance is appointed.
444 * @param src [i] The character string before the converting is appointed.
445 * @return The character string after the converting is returned.
454 chxjconvrule_entry *entryp,
465 /*--------------------------------------------------------------------------*/
467 /*--------------------------------------------------------------------------*/
469 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
471 DBG(r,"I found qrcode xml");
474 DBG(r,"not found qrcode xml");
476 /*--------------------------------------------------------------------------*/
477 /* The CHTML structure is initialized. */
478 /*--------------------------------------------------------------------------*/
479 s_init_jxhtml(&jxhtml, &doc, r, spec);
481 jxhtml.entryp = entryp;
482 jxhtml.cookie = cookie;
484 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
486 /*--------------------------------------------------------------------------*/
487 /* The character string of the input is analyzed. */
488 /*--------------------------------------------------------------------------*/
489 qs_init_malloc(&doc);
490 qs_init_root_node(&doc);
492 ss = apr_pcalloc(r->pool, srclen + 1);
494 memset(ss, 0, srclen + 1);
495 memcpy(ss, src, srclen);
497 if (IS_CSS_ON(jxhtml.entryp)) {
498 /* current property list */
499 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
502 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
505 qs_parse_string(&doc,ss,strlen(ss));
507 chxj_buffered_write_init(r->pool, &doc.buf);
508 /*--------------------------------------------------------------------------*/
509 /* It converts it from CHTML to JXHTML. */
510 /*--------------------------------------------------------------------------*/
511 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
512 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
513 dst = apr_pstrdup(r->pool, jxhtml.out);
514 chxj_buffered_write_terminate(&doc.buf);
517 qs_all_free(&doc,QX_LOGMARK);
520 return apr_pstrdup(r->pool,ss);
523 dst = apr_psprintf(r->pool, "\n");
525 *dstlen = strlen(dst);
528 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
536 * The JXHTML structure is initialized.
538 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
539 * initialized is specified.
540 * @param doc [i] The Doc structure that should be set to the initialized
541 * JXHTML structure is specified.
542 * @param r [i] To use POOL, the pointer to request_rec is specified.
543 * @param spec [i] The pointer to the device_table
546 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
548 memset(doc, 0, sizeof(Doc));
549 memset(jxhtml, 0, sizeof(jxhtml_t));
554 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
555 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
556 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
561 * Corresponding EMOJI to a current character-code is retrieved.
562 * The substitution character string is stored in the rslt pointer if agreeing.
564 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
565 * @param txt [i] The character string to want to examine whether it is
566 * EMOJI is specified.
567 * @param rslt [o] The pointer to the pointer that stores the result is
569 * @return When corresponding EMOJI exists, it returns it excluding 0.
572 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
584 if (! spec) DBG(r,"spec is NULL");
586 for (ee = jxhtml->conf->emoji;
590 unsigned char hex1byte;
591 unsigned char hex2byte;
594 DBG(r,"emoji->imode is NULL");
598 hex1byte = ee->imode->hex1byte & 0xff;
599 hex2byte = ee->imode->hex2byte & 0xff;
601 if (ee->imode->string
602 && strlen(ee->imode->string) > 0
603 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
604 if (spec == NULL || spec->emoji_type == NULL) {
605 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
606 return strlen(ee->imode->string);
613 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
614 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
615 if (spec == NULL || spec->emoji_type == NULL) {
616 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
629 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
643 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
644 memset(doc, 0, sizeof(Doc));
645 memset(jxhtml, 0, sizeof(jxhtml_t));
650 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
651 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
652 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
654 apr_pool_create(&pool, r->pool);
656 chxj_buffered_write_init(pool, &doc->buf);
658 for (ii=0; ii<len; ii++) {
662 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
669 if (is_sjis_kanji(src[ii])) {
670 two_byte[0] = src[ii+0];
671 two_byte[1] = src[ii+1];
677 one_byte[0] = src[ii+0];
682 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
684 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
690 * It is a handler who processes the HTML tag.
692 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
693 * destination is specified.
694 * @param node [i] The HTML tag node is specified.
695 * @return The conversion result is returned.
698 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
705 jxhtml = GET_JXHTML(pdoc);
708 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
710 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
712 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
715 /*--------------------------------------------------------------------------*/
717 /*--------------------------------------------------------------------------*/
718 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
720 jxhtml->start_html_flag = 1;
722 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
729 * It is a handler who processes the HTML tag.
731 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
732 * destination is specified.
733 * @param node [i] The HTML tag node is specified.
734 * @return The conversion result is returned.
737 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
739 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
740 Doc *doc = jxhtml->doc;
749 * It is a handler who processes the META tag.
751 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
752 * destination is specified.
753 * @param node [i] The META tag node is specified.
754 * @return The conversion result is returned.
757 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
763 int content_type_flag;
766 jxhtml = GET_JXHTML(pdoc);
770 content_type_flag = 0;
773 /*--------------------------------------------------------------------------*/
775 /*--------------------------------------------------------------------------*/
776 for (attr = qs_get_attr(doc,node);
778 attr = qs_get_next_attr(doc,attr)) {
779 char *name = qs_get_attr_name(doc,attr);
780 char *value = qs_get_attr_value(doc,attr);
784 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
785 /*----------------------------------------------------------------------*/
787 /*----------------------------------------------------------------------*/
788 W_L(" http-equiv=\"");
791 if (STRCASEEQ('c','C',"content-type",value)) {
792 content_type_flag = 1;
794 if (STRCASEEQ('r','R',"refresh",value)) {
802 if (strcasecmp(name, "content") == 0 && value && *value) {
803 /*----------------------------------------------------------------------*/
805 /*----------------------------------------------------------------------*/
806 if (content_type_flag) {
810 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
819 buf = apr_pstrdup(r->pool, value);
821 url = strchr(buf, ';');
823 sec = apr_pstrdup(r->pool, buf);
826 url = chxj_encoding_parameter(r, url, 1);
847 if (strcasecmp(name, "name") == 0 && value && *value) {
863 * It is a handler who processes the META tag.
865 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
866 * destination is specified.
867 * @param node [i] The META tag node is specified.
868 * @return The conversion result is returned.
871 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
873 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
880 * It is a handler who processes the HEAD tag.
882 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
883 * destination is specified.
884 * @param node [i] The HEAD tag node is specified.
885 * @return The conversion result is returned.
888 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
894 jxhtml = GET_JXHTML(pdoc);
904 * It is a handler who processes the HEAD tag.
906 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
907 * destination is specified.
908 * @param node [i] The HEAD tag node is specified.
909 * @return The conversion result is returned.
912 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
918 jxhtml = GET_JXHTML(pdoc);
928 * It is a handler who processes the TITLE tag.
930 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
931 * destination is specified.
932 * @param node [i] The TITLE tag node is specified.
933 * @return The conversion result is returned.
936 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
942 jxhtml = GET_JXHTML(pdoc);
952 * It is a handler who processes the TITLE tag.
954 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
955 * destination is specified.
956 * @param node [i] The TITLE tag node is specified.
957 * @return The conversion result is returned.
960 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
966 jxhtml = GET_JXHTML(pdoc);
976 * It is a handler who processes the BASE tag.
978 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
979 * destination is specified.
980 * @param node [i] The BASE tag node is specified.
981 * @return The conversion result is returned.
984 s_jxhtml_start_base_tag(void *pdoc, Node *node)
991 jxhtml = GET_JXHTML(pdoc);
996 /*--------------------------------------------------------------------------*/
998 /*--------------------------------------------------------------------------*/
999 for (attr = qs_get_attr(doc,node);
1001 attr = qs_get_next_attr(doc,attr)) {
1002 char *name = qs_get_attr_name(doc,attr);
1003 char *value = qs_get_attr_value(doc,attr);
1004 if (STRCASEEQ('h','H',"href",name)) {
1016 * It is a handler who processes the BASE tag.
1018 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1019 * destination is specified.
1020 * @param node [i] The BASE tag node is specified.
1021 * @return The conversion result is returned.
1024 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1026 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1032 * It is a handler who processes the BODY tag.
1034 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1035 * destination is specified.
1036 * @param node [i] The BODY tag node is specified.
1037 * @return The conversion result is returned.
1040 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1046 char *attr_bgcolor = NULL;
1047 char *attr_text = NULL;
1048 char *attr_link = NULL;
1049 char *attr_vlink = NULL;
1050 char *attr_style = NULL;
1051 char *attr_background = NULL;
1053 jxhtml = GET_JXHTML(pdoc);
1057 /*--------------------------------------------------------------------------*/
1058 /* Get Attributes */
1059 /*--------------------------------------------------------------------------*/
1060 for (attr = qs_get_attr(doc,node);
1062 attr = qs_get_next_attr(doc,attr)) {
1063 char *name = qs_get_attr_name(doc,attr);
1064 char *value = qs_get_attr_value(doc,attr);
1065 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1066 /*----------------------------------------------------------------------*/
1068 /*----------------------------------------------------------------------*/
1069 attr_bgcolor = value;
1071 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1072 /*----------------------------------------------------------------------*/
1074 /*----------------------------------------------------------------------*/
1077 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1078 /*----------------------------------------------------------------------*/
1080 /*----------------------------------------------------------------------*/
1083 else if (STRCASEEQ('a','A',"alink",name)) {
1084 /*----------------------------------------------------------------------*/
1086 /*----------------------------------------------------------------------*/
1089 else if (STRCASEEQ('v','V',"vlink",name)) {
1090 /*----------------------------------------------------------------------*/
1092 /*----------------------------------------------------------------------*/
1095 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1096 /*----------------------------------------------------------------------*/
1098 /*----------------------------------------------------------------------*/
1099 attr_background = value;
1101 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1106 if (IS_CSS_ON(jxhtml->entryp)) {
1107 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1109 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1110 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1111 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1112 css_property_t *cur;
1113 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1114 if (cur->value && *cur->value) {
1115 attr_text = apr_pstrdup(doc->pool, cur->value);
1118 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1119 if (cur->value && *cur->value) {
1120 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1123 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1124 if (cur->value && *cur->value) {
1125 char *tmp = apr_pstrdup(doc->pool, cur->value);
1126 char *tmps = strstr(tmp,"(");
1128 char *tmpe = strstr(tmp,")");
1129 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1131 attr_background = apr_pstrndup(doc->pool, tmps,len);
1136 if (jxhtml->style) {
1137 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1138 css_selector_t *cur_sel;
1139 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1140 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1141 css_property_t *cur;
1142 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1143 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1144 attr_link = apr_pstrdup(doc->pool, cur->value);
1148 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1149 css_property_t *cur;
1150 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1151 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1152 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1162 if (attr_bgcolor || attr_text) {
1165 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1166 W_L("background-color:");
1171 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1179 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1185 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1190 if (attr_background) {
1191 W_L(" background=\"");
1192 W_V(attr_background);
1201 * It is a handler who processes the BODY tag.
1203 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1204 * destination is specified.
1205 * @param node [i] The BODY tag node is specified.
1206 * @return The conversion result is returned.
1209 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1215 jxhtml = GET_JXHTML(pdoc);
1219 W_L("</div></body>");
1220 if (IS_CSS_ON(jxhtml->entryp)) {
1221 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1228 * It is a handler who processes the A tag.
1230 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1231 * destination is specified.
1232 * @param node [i] The A tag node is specified.
1233 * @return The conversion result is returned.
1236 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1242 char *attr_style = NULL;
1244 jxhtml = GET_JXHTML(pdoc);
1249 /*--------------------------------------------------------------------------*/
1250 /* Get Attributes */
1251 /*--------------------------------------------------------------------------*/
1252 for (attr = qs_get_attr(doc,node);
1254 attr = qs_get_next_attr(doc,attr)) {
1255 char *name = qs_get_attr_name(doc,attr);
1256 char *value = qs_get_attr_value(doc,attr);
1257 if (STRCASEEQ('n','N',"name",name)) {
1258 /*----------------------------------------------------------------------*/
1260 /*----------------------------------------------------------------------*/
1262 W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1265 else if (STRCASEEQ('h','H',"href",name)) {
1266 /*----------------------------------------------------------------------*/
1268 /*----------------------------------------------------------------------*/
1269 value = chxj_encoding_parameter(r, value, 1);
1270 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1271 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1277 else if (STRCASEEQ('a','A',"accesskey",name)) {
1278 /*----------------------------------------------------------------------*/
1280 /*----------------------------------------------------------------------*/
1281 W_L(" accesskey=\"");
1285 else if (STRCASEEQ('c','C',"cti",name)) {
1286 /*----------------------------------------------------------------------*/
1288 /*----------------------------------------------------------------------*/
1293 else if (STRCASEEQ('i','I',"ijam",name)) {
1294 /*----------------------------------------------------------------------*/
1296 /*----------------------------------------------------------------------*/
1299 else if (STRCASEEQ('u','U',"utn",name)) {
1300 /*----------------------------------------------------------------------*/
1302 /* It is special only for CHTML. */
1303 /*----------------------------------------------------------------------*/
1306 else if (STRCASEEQ('t','T',"telbook",name)) {
1307 /*----------------------------------------------------------------------*/
1309 /*----------------------------------------------------------------------*/
1312 else if (STRCASEEQ('k','K',"kana",name)) {
1313 /*----------------------------------------------------------------------*/
1315 /*----------------------------------------------------------------------*/
1318 else if (STRCASEEQ('e','E',"email",name)) {
1319 /*----------------------------------------------------------------------*/
1321 /*----------------------------------------------------------------------*/
1324 else if (STRCASEEQ('i','I',"ista",name)) {
1325 /*----------------------------------------------------------------------*/
1327 /*----------------------------------------------------------------------*/
1330 else if (STRCASEEQ('i','I',"ilet",name)) {
1331 /*----------------------------------------------------------------------*/
1333 /*----------------------------------------------------------------------*/
1336 else if (STRCASEEQ('i','I',"iswf",name)) {
1337 /*----------------------------------------------------------------------*/
1339 /*----------------------------------------------------------------------*/
1342 else if (STRCASEEQ('i','I',"irst",name)) {
1343 /*----------------------------------------------------------------------*/
1345 /*----------------------------------------------------------------------*/
1348 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1349 /*----------------------------------------------------------------------*/
1351 /*----------------------------------------------------------------------*/
1357 if (IS_CSS_ON(jxhtml->entryp)) {
1358 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1366 * It is a handler who processes the A tag.
1368 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1369 * destination is specified.
1370 * @param node [i] The A tag node is specified.
1371 * @return The conversion result is returned.
1374 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1380 jxhtml = GET_JXHTML(pdoc);
1386 if (IS_CSS_ON(jxhtml->entryp)) {
1387 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1395 * It is a handler who processes the BR tag.
1397 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1398 * destination is specified.
1399 * @param node [i] The BR tag node is specified.
1400 * @return The conversion result is returned.
1403 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1410 jxhtml = GET_JXHTML(pdoc);
1414 char *attr_style = NULL;
1415 char *attr_clear = NULL;
1417 /*--------------------------------------------------------------------------*/
1418 /* Get Attributes */
1419 /*--------------------------------------------------------------------------*/
1420 for (attr = qs_get_attr(doc,node);
1422 attr = qs_get_next_attr(doc,attr)) {
1423 char *name = qs_get_attr_name(doc,attr);
1424 char *value = qs_get_attr_value(doc,attr);
1425 if (STRCASEEQ('c','C',"clear",name)) {
1426 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1430 else if (STRCASEEQ('s','S',"style",name)) {
1431 attr_style = apr_pstrdup(doc->buf.pool, value);
1434 if (IS_CSS_ON(jxhtml->entryp)) {
1435 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1437 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1438 css_property_t *cur;
1439 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1440 if (cur->value && *cur->value) {
1441 if ( STRCASEEQ('l','L',"left", cur->value)
1442 || STRCASEEQ('r','R',"right", cur->value)
1443 || STRCASEEQ('b','B',"both" ,cur->value)) {
1444 attr_clear = apr_pstrdup(doc->pool, cur->value);
1462 * It is a handler who processes the BR tag.
1464 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1465 * destination is specified.
1466 * @param node [i] The BR tag node is specified.
1467 * @return The conversion result is returned.
1470 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1472 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1477 * It is a handler who processes the TABLE tag.
1479 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1480 * destination is specified.
1481 * @param node [i] The TR tag node is specified.
1482 * @return The conversion result is returned.
1485 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1492 char *attr_style = NULL;
1493 char *attr_align = NULL;
1494 char *attr_width = NULL;
1495 char *attr_height = NULL;
1496 char *attr_bgcolor = NULL;
1497 char *attr_border_width = NULL;
1498 char *attr_border_color = NULL;
1500 jxhtml = GET_JXHTML(pdoc);
1504 /*--------------------------------------------------------------------------*/
1505 /* Get Attributes */
1506 /*--------------------------------------------------------------------------*/
1507 for (attr = qs_get_attr(doc,node);
1509 attr = qs_get_next_attr(doc,attr)) {
1510 char *name = qs_get_attr_name(doc,attr);
1511 char *val = qs_get_attr_value(doc,attr);
1512 if (STRCASEEQ('a','A',"align",name)) {
1513 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1514 attr_align = apr_pstrdup(doc->buf.pool, val);
1517 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1518 attr_height = apr_pstrdup(doc->buf.pool, val);
1520 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1521 attr_width = apr_pstrdup(doc->buf.pool, val);
1523 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1524 attr_style = apr_pstrdup(doc->buf.pool, val);
1526 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1527 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1528 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1530 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1531 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1533 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1534 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1535 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1539 if (IS_CSS_ON(jxhtml->entryp)) {
1540 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1542 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1543 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1544 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1545 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1546 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1547 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1549 css_property_t *cur;
1550 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1551 char *tmp = apr_pstrdup(doc->pool, cur->value);
1552 char *tmpp = strstr(tmp, "px");
1554 size_t len = strlen(tmp) - strlen(tmpp);
1555 attr_width = apr_pstrndup(doc->pool, tmp,len);
1558 attr_width = apr_pstrdup(doc->pool, tmp);
1561 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1562 char *tmp = apr_pstrdup(doc->pool, cur->value);
1563 char *tmpp = strstr(tmp, "px");
1565 size_t len = strlen(tmp) - strlen(tmpp);
1566 attr_height = apr_pstrndup(doc->pool, tmp,len);
1569 attr_height = apr_pstrdup(doc->pool, tmp);
1572 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1573 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1574 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1577 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1578 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1579 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1581 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1582 char *tmp = apr_pstrdup(doc->pool, cur->value);
1583 char *tmpp = strstr(tmp, "px");
1585 size_t len = strlen(tmp) - strlen(tmpp);
1586 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1589 attr_border_width = apr_pstrdup(doc->pool, tmp);
1592 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1593 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1594 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1615 if (attr_bgcolor && *attr_bgcolor){
1620 if (attr_border_width || attr_border_color ){
1621 W_L(" style=\"border:");
1622 if (attr_border_width){
1623 W_V(attr_border_width);
1630 if (attr_border_color && *attr_border_color){
1632 W_V(attr_border_color);
1642 * It is a handler who processes the TABLE tag.
1644 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1645 * destination is specified.
1646 * @param node [i] The TR tag node is specified.
1647 * @return The conversion result is returned.
1650 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1656 jxhtml = GET_JXHTML(pdoc);
1666 * It is a handler who processes the TR tag.
1668 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1669 * destination is specified.
1670 * @param node [i] The TR tag node is specified.
1671 * @return The conversion result is returned.
1674 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1682 char *attr_style = NULL;
1683 char *attr_align = NULL;
1684 char *attr_valign = NULL;
1685 char *attr_bgcolor = NULL;
1687 jxhtml = GET_JXHTML(pdoc);
1691 /*--------------------------------------------------------------------------*/
1692 /* Get Attributes */
1693 /*--------------------------------------------------------------------------*/
1694 for (attr = qs_get_attr(doc,node);
1696 attr = qs_get_next_attr(doc,attr)) {
1697 char *name = qs_get_attr_name(doc,attr);
1698 char *val = qs_get_attr_value(doc,attr);
1699 if (STRCASEEQ('a','A',"align",name)) {
1700 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1701 attr_align = apr_pstrdup(doc->buf.pool, val);
1704 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1705 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1706 attr_valign = apr_pstrdup(doc->buf.pool, val);
1709 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1710 attr_style = apr_pstrdup(doc->buf.pool, val);
1712 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1713 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1714 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1718 if (IS_CSS_ON(jxhtml->entryp)) {
1719 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1721 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1722 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1723 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1725 css_property_t *cur;
1726 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1727 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1728 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1731 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1732 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1733 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1736 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1737 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1738 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1754 if (attr_bgcolor && *attr_bgcolor){
1765 * It is a handler who processes the TR tag.
1767 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1768 * destination is specified.
1769 * @param node [i] The TR tag node is specified.
1770 * @return The conversion result is returned.
1773 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1779 jxhtml = GET_JXHTML(pdoc);
1788 * It is a handler who processes the TD tag.
1790 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1791 * destination is specified.
1792 * @param node [i] The TR tag node is specified.
1793 * @return The conversion result is returned.
1796 s_jxhtml_start_td_tag(void *pdoc, Node *node)
1804 char *attr_style = NULL;
1805 char *attr_align = NULL;
1806 char *attr_valign = NULL;
1807 char *attr_bgcolor = NULL;
1808 char *attr_colspan = NULL;
1809 char *attr_rowspan = NULL;
1811 jxhtml = GET_JXHTML(pdoc);
1815 /*--------------------------------------------------------------------------*/
1816 /* Get Attributes */
1817 /*--------------------------------------------------------------------------*/
1818 for (attr = qs_get_attr(doc,node);
1820 attr = qs_get_next_attr(doc,attr)) {
1821 char *name = qs_get_attr_name(doc,attr);
1822 char *val = qs_get_attr_value(doc,attr);
1823 if (STRCASEEQ('a','A',"align",name)) {
1824 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1825 attr_align = apr_pstrdup(doc->buf.pool, val);
1828 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1829 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1830 attr_valign = apr_pstrdup(doc->buf.pool, val);
1833 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1834 attr_style = apr_pstrdup(doc->buf.pool, val);
1836 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1837 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1838 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1840 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1841 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1843 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1844 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1848 if (IS_CSS_ON(jxhtml->entryp)) {
1849 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1851 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1852 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1853 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1855 css_property_t *cur;
1856 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1857 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1858 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1861 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1862 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1863 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1866 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1867 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1868 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1894 if (attr_bgcolor && *attr_bgcolor){
1905 * It is a handler who processes the TD tag.
1907 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1908 * destination is specified.
1909 * @param node [i] The TR tag node is specified.
1910 * @return The conversion result is returned.
1913 s_jxhtml_end_td_tag(void *pdoc, Node *UNUSED(child))
1919 jxhtml = GET_JXHTML(pdoc);
1928 * It is a handler who processes the FONT tag.
1930 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1931 * destination is specified.
1932 * @param node [i] The FONT tag node is specified.
1933 * @return The conversion result is returned.
1936 s_jxhtml_start_font_tag(void *pdoc, Node *node)
1942 char *attr_color = NULL;
1943 char *attr_size = NULL;
1944 char *attr_style = NULL;
1946 jxhtml = GET_JXHTML(pdoc);
1950 /*--------------------------------------------------------------------------*/
1951 /* Get Attributes */
1952 /*--------------------------------------------------------------------------*/
1953 for (attr = qs_get_attr(doc,node);
1955 attr = qs_get_next_attr(doc,attr)) {
1956 char *name = qs_get_attr_name(doc,attr);
1957 char *value = qs_get_attr_value(doc,attr);
1958 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1959 attr_color = apr_pstrdup(doc->buf.pool, value);
1961 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1962 /*----------------------------------------------------------------------*/
1964 /*----------------------------------------------------------------------*/
1965 attr_size = apr_pstrdup(doc->buf.pool, value);
1967 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1968 attr_style = apr_pstrdup(doc->buf.pool, value);
1971 if (IS_CSS_ON(jxhtml->entryp)) {
1972 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1974 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1975 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1976 css_property_t *cur;
1977 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1978 if (cur->value && *cur->value) {
1979 attr_color = apr_pstrdup(doc->pool, cur->value);
1982 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1983 if (cur->value && *cur->value) {
1984 attr_size = apr_pstrdup(doc->pool, cur->value);
1985 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1986 attr_size = apr_pstrdup(doc->pool, "1");
1988 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1989 attr_size = apr_pstrdup(doc->pool, "2");
1991 else if (STRCASEEQ('s','S',"small",attr_size)) {
1992 attr_size = apr_pstrdup(doc->pool, "3");
1994 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1995 attr_size = apr_pstrdup(doc->pool, "4");
1997 else if (STRCASEEQ('l','L',"large",attr_size)) {
1998 attr_size = apr_pstrdup(doc->pool, "5");
2000 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2001 attr_size = apr_pstrdup(doc->pool, "6");
2003 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2004 attr_size = apr_pstrdup(doc->pool, "7");
2010 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2011 memset(flg, 0, sizeof(*flg));
2013 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2014 W_L("<font color=\"");
2017 flg->font_color_flag = 1;
2020 flg->font_size_flag = 1;
2021 switch(*attr_size) {
2022 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2023 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2024 case '3': W_L("<span style=\"font-size: small\">"); break;
2025 case '4': W_L("<span style=\"font-size: medium\">"); break;
2026 case '5': W_L("<span style=\"font-size: large\">"); break;
2027 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2028 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2030 if (*(attr_size + 1) == '1') {
2031 W_L("<span style=\"font-size: small\">");
2034 if (*(attr_size + 1) == '2') {
2035 W_L("<span style=\"font-size: x-small\">");
2038 if (*(attr_size + 1) == '3') {
2039 W_L("<span style=\"font-size: xx-small\">");
2042 flg->font_size_flag = 0;
2046 if (*(attr_size + 1) == '1') {
2047 W_L("<span style=\"font-size: large\">");
2050 if (*(attr_size + 1) == '2') {
2051 W_L("<span style=\"font-size: x-large\">");
2054 if (*(attr_size + 1) == '3') {
2055 W_L("<span style=\"font-size: xx-large\">");
2058 flg->font_size_flag = 0;
2062 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2063 flg->font_size_flag = 0;
2066 node->userData = flg;
2072 * It is a handler who processes the FONT tag.
2074 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2075 * destination is specified.
2076 * @param node [i] The FONT tag node is specified.
2077 * @return The conversion result is returned.
2080 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2086 jxhtml = GET_JXHTML(pdoc);
2090 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2091 if (flg && flg->font_size_flag) {
2094 if (flg && flg->font_color_flag) {
2097 if (IS_CSS_ON(jxhtml->entryp)) {
2098 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2106 * It is a handler who processes the FORM tag.
2108 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2109 * destination is specified.
2110 * @param node [i] The FORM tag node is specified.
2111 * @return The conversion result is returned.
2114 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2120 char *attr_action = NULL;
2121 char *attr_method = NULL;
2122 char *attr_style = NULL;
2123 char *attr_color = NULL;
2124 char *attr_align = NULL;
2125 char *attr_name = NULL;
2126 char *new_hidden_tag = NULL;
2128 jxhtml = GET_JXHTML(pdoc);
2132 /*--------------------------------------------------------------------------*/
2133 /* Get Attributes */
2134 /*--------------------------------------------------------------------------*/
2135 for (attr = qs_get_attr(doc,node);
2137 attr = qs_get_next_attr(doc,attr)) {
2138 char *name = qs_get_attr_name(doc,attr);
2139 char *value = qs_get_attr_value(doc,attr);
2143 if (strcasecmp(name, "action") == 0) {
2144 /*--------------------------------------------------------------------*/
2146 /*--------------------------------------------------------------------*/
2147 attr_action = value;
2153 if (strcasecmp(name, "method") == 0) {
2154 /*--------------------------------------------------------------------*/
2156 /*--------------------------------------------------------------------*/
2157 attr_method = value;
2163 if (strcasecmp(name, "name") == 0) {
2164 /*--------------------------------------------------------------------*/
2166 /*--------------------------------------------------------------------*/
2173 if (strcasecmp(name, "style") == 0) {
2182 if (IS_CSS_ON(jxhtml->entryp)) {
2183 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2185 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2186 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2187 css_property_t *cur;
2188 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2189 if (STRCASEEQ('l','L',"left", cur->value)) {
2190 attr_align = apr_pstrdup(doc->pool, "left");
2192 else if (STRCASEEQ('c','C',"center",cur->value)) {
2193 attr_align = apr_pstrdup(doc->pool, "center");
2195 else if (STRCASEEQ('r','R',"right",cur->value)) {
2196 attr_align = apr_pstrdup(doc->pool, "right");
2199 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2200 attr_color = apr_pstrdup(doc->pool, cur->value);
2205 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2209 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2210 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2212 char *old_qs = NULL;
2213 q = strchr(attr_action, '?');
2215 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, jxhtml->entryp);
2216 if (new_hidden_tag || old_qs) {
2240 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2241 memset(flg, 0, sizeof(*flg));
2243 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2244 W_L("<font color=\"");
2247 flg->with_font_flag = 1;
2250 W_L("<div align=\"");
2253 flg->with_div_flag = 1;
2255 node->userData = flg;
2256 if (new_hidden_tag) {
2257 W_V(new_hidden_tag);
2264 * It is a handler who processes the FORM tag.
2266 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2267 * destination is specified.
2268 * @param node [i] The FORM tag node is specified.
2269 * @return The conversion result is returned.
2272 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2274 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2275 Doc *doc = jxhtml->doc;
2277 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2278 if (flg && flg->with_div_flag) {
2281 if (flg && flg->with_font_flag) {
2285 if (IS_CSS_ON(jxhtml->entryp)) {
2286 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2294 * It is a handler who processes the INPUT tag.
2296 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2297 * destination is specified.
2298 * @param node [i] The INPUT tag node is specified.
2299 * @return The conversion result is returned.
2302 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2308 char *attr_accesskey = NULL;
2309 char *attr_max_length = NULL;
2310 char *attr_type = NULL;
2311 char *attr_name = NULL;
2312 char *attr_value = NULL;
2313 char *attr_istyle = NULL;
2314 char *attr_size = NULL;
2315 char *attr_checked = NULL;
2316 char *attr_style = NULL;
2318 jxhtml = GET_JXHTML(pdoc);
2322 /*--------------------------------------------------------------------------*/
2323 /* Get Attributes */
2324 /*--------------------------------------------------------------------------*/
2325 for (attr = qs_get_attr(doc,node);
2327 attr = qs_get_next_attr(doc,attr)) {
2328 char *name = qs_get_attr_name(doc,attr);
2329 char *value = qs_get_attr_value(doc,attr);
2330 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2331 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2332 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2333 STRCASEEQ('p','P',"password",tmp_type) ||
2334 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2335 STRCASEEQ('r','R',"radio", tmp_type) ||
2336 STRCASEEQ('h','H',"hidden", tmp_type) ||
2337 STRCASEEQ('s','S',"submit", tmp_type) ||
2338 STRCASEEQ('r','R',"reset", tmp_type))) {
2339 attr_type = tmp_type;
2342 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2345 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2348 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2349 attr_istyle = value;
2351 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2352 attr_max_length = value;
2354 else if (STRCASEEQ('c','C',"checked", name)) {
2355 attr_checked = value;
2357 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2358 attr_accesskey = value;
2360 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2363 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2368 if (IS_CSS_ON(jxhtml->entryp)) {
2369 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2371 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2372 css_property_t *cur;
2373 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2374 if (strcasestr(cur->value, "<ja:n>")) {
2377 else if (strcasestr(cur->value, "<ja:en>")) {
2380 else if (strcasestr(cur->value, "<ja:hk>")) {
2383 else if (strcasestr(cur->value, "<ja:h>")) {
2403 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2408 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2411 if (attr_accesskey) {
2412 W_L(" accesskey=\"");
2413 W_V(attr_accesskey);
2416 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2421 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2422 W_L(" istyle=\"4\"");
2424 /*--------------------------------------------------------------------------*/
2425 /* The figure is default for the password. */
2426 /*--------------------------------------------------------------------------*/
2427 if (attr_max_length && *attr_max_length) {
2428 if (chxj_chk_numeric(attr_max_length) == 0) {
2429 W_L(" maxlength=\"");
2430 W_V(attr_max_length);
2435 W_L(" checked=\"checked\"");
2451 jxhtml = GET_JXHTML(pdoc);
2464 /*--------------------------------------------------------------------------*/
2465 /* Get Attributes */
2466 /*--------------------------------------------------------------------------*/
2467 type = qs_get_type_attr(doc, node, doc->buf.pool);
2468 name = qs_get_name_attr(doc, node, doc->buf.pool);
2469 value = qs_get_value_attr(doc,node, doc->buf.pool);
2470 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2471 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2472 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2473 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2474 size = qs_get_size_attr(doc, node, doc->buf.pool);
2477 if (type && (STRCASEEQ('t','T',"text", type) ||
2478 STRCASEEQ('p','P',"password",type) ||
2479 STRCASEEQ('c','C',"checkbox",type) ||
2480 STRCASEEQ('r','R',"radio", type) ||
2481 STRCASEEQ('h','H',"hidden", type) ||
2482 STRCASEEQ('s','S',"submit", type) ||
2483 STRCASEEQ('r','R',"reset", type))) {
2489 if (size && *size) {
2494 if (name && *name) {
2496 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2499 if (value && *value) {
2500 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2501 apr_size_t value_len = strlen(value);
2502 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2506 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2509 if (accesskey && *accesskey) {
2510 W_L(" accesskey=\"");
2514 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2515 /*------------------------------------------------------------------------*/
2517 /*------------------------------------------------------------------------*/
2518 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2519 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2522 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2524 W_L("-wap-input-format:'*");
2530 else if (type && STRCASEEQ('p','P',"password",type)) {
2531 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2533 /*--------------------------------------------------------------------------*/
2534 /* The figure is default for the password. */
2535 /*--------------------------------------------------------------------------*/
2536 if (max_length && *max_length) {
2537 if (chxj_chk_numeric(max_length) == 0) {
2538 W_L(" maxlength=\"");
2545 W_L(" checked=\"checked\"");
2554 * It is a handler who processes the INPUT tag.
2556 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2557 * destination is specified.
2558 * @param node [i] The INPUT tag node is specified.
2559 * @return The conversion result is returned.
2562 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2564 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2570 * It is a handler who processes the CENTER tag.
2572 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2573 * destination is specified.
2574 * @param node [i] The CENTER tag node is specified.
2575 * @return The conversion result is returned.
2578 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2583 char *attr_style = NULL;
2584 char *attr_color = NULL;
2585 char *attr_size = NULL;
2587 jxhtml = GET_JXHTML(pdoc);
2590 for (attr = qs_get_attr(doc,node);
2592 attr = qs_get_next_attr(doc,attr)) {
2593 char *name = qs_get_attr_name(doc,attr);
2594 char *value = qs_get_attr_value(doc,attr);
2595 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2599 if (IS_CSS_ON(jxhtml->entryp)) {
2600 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2602 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2603 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2604 css_property_t *cur;
2605 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2606 if (cur->value && *cur->value) {
2607 attr_color = apr_pstrdup(doc->pool, cur->value);
2610 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2611 if (cur->value && *cur->value) {
2612 attr_size = apr_pstrdup(doc->pool, cur->value);
2619 if (attr_size || attr_color) {
2627 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2641 * It is a handler who processes the CENTER tag.
2643 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2644 * destination is specified.
2645 * @param node [i] The CENTER tag node is specified.
2646 * @return The conversion result is returned.
2649 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2655 jxhtml = GET_JXHTML(pdoc);
2660 if (IS_CSS_ON(jxhtml->entryp)) {
2661 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2668 * It is a handler who processes the li tag.
2670 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2671 * destination is specified.
2672 * @param node [i] The li tag node is specified.
2673 * @return The conversion result is returned.
2676 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2682 char *attr_type = NULL;
2683 char *attr_value = NULL;
2684 char *attr_style = NULL;
2686 jxhtml = GET_JXHTML(pdoc);
2690 for (attr = qs_get_attr(doc,node);
2692 attr = qs_get_next_attr(doc,attr)) {
2693 char *name = qs_get_attr_name(doc,attr);
2694 char *value = qs_get_attr_value(doc,attr);
2695 if (STRCASEEQ('t','T',"type",name)) {
2696 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2697 if (*value == '1') {
2698 attr_type = apr_pstrdup(doc->pool, "decimal");
2700 else if (*value == 'a') {
2701 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2703 else if (*value == 'A') {
2704 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2711 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2714 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2718 if (IS_CSS_ON(jxhtml->entryp)) {
2719 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2721 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2722 css_property_t *cur;
2723 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2724 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2725 attr_type = apr_pstrdup(doc->pool, "decimal");
2727 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2728 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2730 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2731 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2733 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2734 attr_type = apr_pstrdup(doc->pool, "disc");
2736 else if (STRCASEEQ('s','S',"square", cur->value)) {
2737 attr_type = apr_pstrdup(doc->pool, "square");
2739 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2740 attr_type = apr_pstrdup(doc->pool, "circle");
2750 W_L("list-style-type:");
2766 * It is a handler who processes the li tag.
2768 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2769 * destination is specified.
2770 * @param node [i] The li tag node is specified.
2771 * @return The conversion result is returned.
2774 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2780 jxhtml = GET_JXHTML(pdoc);
2784 if (IS_CSS_ON(jxhtml->entryp)) {
2785 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2793 * It is a handler who processes the OL tag.
2795 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2796 * destination is specified.
2797 * @param node [i] The OL tag node is specified.
2798 * @return The conversion result is returned.
2801 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2807 char *attr_style = NULL;
2808 char *attr_start = NULL;
2809 char *attr_type = NULL;
2811 jxhtml = GET_JXHTML(pdoc);
2815 /*--------------------------------------------------------------------------*/
2816 /* Get Attributes */
2817 /*--------------------------------------------------------------------------*/
2818 for (attr = qs_get_attr(doc,node);
2820 attr = qs_get_next_attr(doc,attr)) {
2821 char *name = qs_get_attr_name(doc,attr);
2822 char *value = qs_get_attr_value(doc,attr);
2823 if (STRCASEEQ('t','T',"type",name) && value) {
2824 if (*value == '1') {
2825 attr_type = apr_pstrdup(doc->pool, "decimal");
2827 else if (*value == 'a') {
2828 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2830 else if (*value == 'A') {
2831 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2834 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2837 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2841 if (IS_CSS_ON(jxhtml->entryp)) {
2842 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2844 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2845 css_property_t *cur;
2846 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2847 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2848 attr_type = apr_pstrdup(doc->pool, "decimal");
2850 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2851 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2853 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2854 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2862 W_L("list-style-type:");
2879 * It is a handler who processes the OL tag.
2881 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2882 * destination is specified.
2883 * @param node [i] The OL tag node is specified.
2884 * @return The conversion result is returned.
2887 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2893 jxhtml = GET_JXHTML(pdoc);
2898 if (IS_CSS_ON(jxhtml->entryp)) {
2899 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2906 * It is a handler who processes the P tag.
2908 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2909 * destination is specified.
2910 * @param node [i] The P tag node is specified.
2911 * @return The conversion result is returned.
2914 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2920 char *attr_align = NULL;
2921 char *attr_style = NULL;
2922 char *attr_color = NULL;
2923 char *attr_blink = NULL;
2924 char *css_clear = NULL;
2926 jxhtml = GET_JXHTML(pdoc);
2930 for (attr = qs_get_attr(doc,node);
2932 attr = qs_get_next_attr(doc,attr)) {
2933 char *nm = qs_get_attr_name(doc,attr);
2934 char *val = qs_get_attr_value(doc,attr);
2935 if (STRCASEEQ('a','A',"align", nm)) {
2936 /*----------------------------------------------------------------------*/
2937 /* CHTML 1.0 (W3C version 3.2) */
2938 /*----------------------------------------------------------------------*/
2939 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2940 attr_align = apr_pstrdup(doc->buf.pool, val);
2944 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2945 attr_style = apr_pstrdup(doc->buf.pool, val);
2948 if (IS_CSS_ON(jxhtml->entryp)) {
2949 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2951 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2952 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2953 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2954 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2955 css_property_t *cur;
2956 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2957 if (STRCASEEQ('l','L',"left",cur->value)) {
2958 attr_align = apr_pstrdup(doc->pool, "left");
2960 else if (STRCASEEQ('c','C',"center",cur->value)) {
2961 attr_align = apr_pstrdup(doc->pool, "center");
2963 else if (STRCASEEQ('r','R',"right",cur->value)) {
2964 attr_align = apr_pstrdup(doc->pool, "right");
2967 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2968 if (cur->value && *cur->value) {
2969 attr_color = apr_pstrdup(doc->pool, cur->value);
2972 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2973 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2974 attr_blink = apr_pstrdup(doc->pool, cur->value);
2977 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2978 css_clear = apr_pstrdup(doc->pool, cur->value);
2983 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2991 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2997 W_L("text-decoration:");
3014 * It is a handler who processes the P tag.
3016 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3017 * destination is specified.
3018 * @param node [i] The P tag node is specified.
3019 * @return The conversion result is returned.
3022 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3024 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3025 Doc *doc = jxhtml->doc;
3028 if (IS_CSS_ON(jxhtml->entryp)) {
3029 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3036 * It is a handler who processes the PRE tag.
3038 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3039 * destination is specified.
3040 * @param node [i] The PRE tag node is specified.
3041 * @return The conversion result is returned.
3044 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3046 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3047 Doc *doc = jxhtml->doc;
3049 char *attr_style = NULL;
3051 for (attr = qs_get_attr(doc,node);
3053 attr = qs_get_next_attr(doc,attr)) {
3054 char *nm = qs_get_attr_name(doc,attr);
3055 char *val = qs_get_attr_value(doc,attr);
3056 if (val && STRCASEEQ('s','S',"style", nm)) {
3061 if (IS_CSS_ON(jxhtml->entryp)) {
3062 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3072 * It is a handler who processes the PRE tag.
3074 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3075 * destination is specified.
3076 * @param node [i] The PRE tag node is specified.
3077 * @return The conversion result is returned.
3080 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3082 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3083 Doc *doc = jxhtml->doc;
3087 if (IS_CSS_ON(jxhtml->entryp)) {
3088 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3096 * It is a handler who processes the UL tag.
3098 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3099 * destination is specified.
3100 * @param node [i] The UL tag node is specified.
3101 * @return The conversion result is returned.
3104 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3106 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3107 Doc *doc = jxhtml->doc;
3109 char *attr_type = NULL;
3110 char *attr_style = NULL;
3111 /*--------------------------------------------------------------------------*/
3112 /* Get Attributes */
3113 /*--------------------------------------------------------------------------*/
3114 for (attr = qs_get_attr(doc,node);
3116 attr = qs_get_next_attr(doc,attr)) {
3117 char *name = qs_get_attr_name(doc,attr);
3118 char *value = qs_get_attr_value(doc,attr);
3119 if (STRCASEEQ('t','T',"type",name)) {
3120 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3124 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3128 if (IS_CSS_ON(jxhtml->entryp)) {
3129 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3131 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3132 css_property_t *cur;
3133 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3134 if (STRCASEEQ('d','D',"disc",cur->value)) {
3135 attr_type = apr_pstrdup(doc->pool, "disc");
3137 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3138 attr_type = apr_pstrdup(doc->pool, "circle");
3140 else if (STRCASEEQ('s','S',"square",cur->value)) {
3141 attr_type = apr_pstrdup(doc->pool, "square");
3149 W_L("list-style-type:");
3160 * It is a handler who processes the UL tag.
3162 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3163 * destination is specified.
3164 * @param node [i] The UL tag node is specified.
3165 * @return The conversion result is returned.
3168 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3170 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3171 Doc *doc = jxhtml->doc;
3174 if (IS_CSS_ON(jxhtml->entryp)) {
3175 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3182 * It is a handler who processes the HR tag.
3184 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3185 * destination is specified.
3186 * @param node [i] The HR tag node is specified.
3187 * @return The conversion result is returned.
3190 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3196 char *attr_align = NULL;
3197 char *attr_size = NULL;
3198 char *attr_width = NULL;
3199 char *attr_noshade = NULL;
3200 char *attr_style = NULL;
3201 char *attr_color = NULL;
3203 char *style_float = NULL;
3204 char *style_border_color = NULL;
3206 jxhtml = GET_JXHTML(pdoc);
3210 for (attr = qs_get_attr(doc,node);
3212 attr = qs_get_next_attr(doc,attr)) {
3213 char *name = qs_get_attr_name (doc,attr);
3214 char *value = qs_get_attr_value(doc,attr);
3218 if (strcasecmp(name, "align") == 0) {
3219 /*--------------------------------------------------------------------*/
3221 /*--------------------------------------------------------------------*/
3222 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3230 if (strcasecmp(name, "size") == 0) {
3231 /*--------------------------------------------------------------------*/
3233 /*--------------------------------------------------------------------*/
3234 if (value && *value) {
3238 else if (strcasecmp(name, "style") == 0) {
3239 if (value && *value) {
3247 if (strcasecmp(name, "width") == 0) {
3248 /*--------------------------------------------------------------------*/
3250 /*--------------------------------------------------------------------*/
3251 if (value && *value) {
3259 if (strcasecmp(name, "noshade") == 0) {
3260 /*--------------------------------------------------------------------*/
3262 /*--------------------------------------------------------------------*/
3263 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3269 if (strcasecmp(name, "color") == 0 && value && *value) {
3270 /*--------------------------------------------------------------------*/
3272 /*--------------------------------------------------------------------*/
3281 if (IS_CSS_ON(jxhtml->entryp)) {
3282 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3284 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3285 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3286 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3288 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3289 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3290 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3291 css_property_t *cur;
3293 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3294 if (STRCASEEQ('s','S',"solid",cur->value)) {
3295 attr_noshade = "noshade";
3298 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3299 char *tmp = apr_pstrdup(doc->pool, cur->value);
3300 char *tmpp = strstr(tmp, "px");
3302 attr_size = apr_pstrdup(doc->pool, tmp);
3306 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3307 char *tmp = apr_pstrdup(doc->pool,cur->value);
3308 attr_color = apr_pstrdup(doc->pool,tmp);
3311 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3312 char *tmp = apr_pstrdup(doc->pool, cur->value);
3313 char *tmpp = strstr(tmp,"none");
3315 style_float = "center";
3318 style_float = apr_pstrdup(doc->pool,tmp);
3323 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3324 char *tmp = apr_pstrdup(doc->pool, cur->value);
3325 char *tmpp = strstr(tmp, "px");
3327 attr_width = apr_pstrdup(doc->pool, tmp);
3330 tmpp = strstr(tmp, "%");
3332 attr_width = apr_pstrdup(doc->pool, tmp);
3337 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3338 char *tmp = apr_pstrdup(doc->pool, cur->value);
3340 style_border_color = apr_pstrdup(doc->pool, tmp);
3358 if (attr_size || attr_width || attr_noshade || style_border_color) {
3363 if (!strstr(attr_size, "px")) {
3371 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3377 W_L("border-style:solid;");
3379 if(style_border_color){
3380 W_L("border-color:");
3381 W_V(style_border_color);
3399 * It is a handler who processes the HR tag.
3401 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3402 * destination is specified.
3403 * @param node [i] The HR tag node is specified.
3404 * @return The conversion result is returned.
3407 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3409 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3415 * It is a handler who processes the IMG tag.
3417 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3418 * destination is specified.
3419 * @param node [i] The IMG tag node is specified.
3420 * @return The conversion result is returned.
3423 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3425 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3426 Doc *doc = jxhtml->doc;
3427 request_rec *r = doc->r;
3429 char *attr_src = NULL;
3430 char *attr_height = NULL;
3431 char *attr_width = NULL;
3432 char *attr_align = NULL;
3433 char *attr_alt = NULL;
3434 char *attr_style = NULL;
3435 char *attr_hspace = NULL;
3436 char *attr_vspace = NULL;
3438 char *css_float = NULL;
3439 char *css_margin_left = NULL;
3440 char *css_margin_right = NULL;
3441 char *css_margin_top = NULL;
3442 char *css_margin_bottom = NULL;
3443 char *css_display = NULL;
3444 char *css_valign = NULL;
3446 #ifndef IMG_NOT_CONVERT_FILENAME
3447 device_table *spec = jxhtml->spec;
3450 /*--------------------------------------------------------------------------*/
3451 /* Get Attributes */
3452 /*--------------------------------------------------------------------------*/
3453 for (attr = qs_get_attr(doc,node);
3455 attr = qs_get_next_attr(doc,attr)) {
3456 char *name = qs_get_attr_name(doc,attr);
3457 char *value = qs_get_attr_value(doc,attr);
3458 if (STRCASEEQ('s','S',"src",name)) {
3459 /*----------------------------------------------------------------------*/
3461 /*----------------------------------------------------------------------*/
3462 #ifdef IMG_NOT_CONVERT_FILENAME
3463 value = chxj_encoding_parameter(r, value, 1);
3464 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3465 value = chxj_add_cookie_no_update_parameter(r, value);
3468 value = chxj_img_conv(r, spec, value);
3469 value = chxj_encoding_parameter(r, value, 1);
3470 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3471 value = chxj_add_cookie_no_update_parameter(r, value);
3475 else if (STRCASEEQ('a','A',"align",name)) {
3476 /*----------------------------------------------------------------------*/
3478 /*----------------------------------------------------------------------*/
3480 if (STRCASEEQ('t','T',"top", value) ||
3481 STRCASEEQ('m','M',"middle",value) ||
3482 STRCASEEQ('b','B',"bottom",value)){
3484 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3487 else if (STRCASEEQ('c','C',"center",value)) {
3488 css_valign = apr_pstrdup(doc->pool, "middle");
3492 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3493 /*----------------------------------------------------------------------*/
3495 /*----------------------------------------------------------------------*/
3498 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3499 /*----------------------------------------------------------------------*/
3501 /*----------------------------------------------------------------------*/
3502 attr_height = value;
3504 else if (STRCASEEQ('h','H',"hspace",name)) {
3505 /*----------------------------------------------------------------------*/
3507 /*----------------------------------------------------------------------*/
3508 attr_hspace = value;
3510 else if (STRCASEEQ('v','V',"vspace",name)) {
3511 /*----------------------------------------------------------------------*/
3513 /*----------------------------------------------------------------------*/
3514 attr_vspace = value;
3516 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3517 /*----------------------------------------------------------------------*/
3519 /*----------------------------------------------------------------------*/
3522 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3523 /*----------------------------------------------------------------------*/
3525 /*----------------------------------------------------------------------*/
3530 if (IS_CSS_ON(jxhtml->entryp)) {
3531 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3533 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3534 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3535 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3536 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3537 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3538 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3539 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3542 css_property_t *cur;
3543 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3544 attr_height = apr_pstrdup(doc->pool, cur->value);
3546 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3547 attr_width = apr_pstrdup(doc->pool, cur->value);
3550 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3551 css_valign = apr_pstrdup(doc->pool, cur->value);
3554 if (! attr_hspace) {
3555 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3556 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3558 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3559 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3562 if (! attr_vspace) {
3563 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3564 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3566 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3567 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3571 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3572 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3573 css_float = apr_pstrdup(doc->pool, cur->value);
3577 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3578 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3579 char *tmp = apr_pstrdup(doc->pool, cur->value);
3580 char *tmpp = strstr(tmp, "none");
3582 css_display = apr_pstrdup(doc->pool, tmp);
3594 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3602 W_L("vertical-align:");
3607 W_L("margin-left:");
3610 W_L("margin-right:");
3615 if(css_margin_left){
3616 W_L("margin-left:");
3617 W_V(css_margin_left);
3620 if(css_margin_right){
3621 W_L("margin-right:");
3622 W_V(css_margin_right);
3630 W_L("margin-bottom:");
3637 W_V(css_margin_top);
3640 if(css_margin_bottom){
3641 W_L("margin-bottom:");
3642 W_V(css_margin_bottom);
3647 W_L("display:none;");
3676 * It is a handler who processes the IMG tag.
3678 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3679 * destination is specified.
3680 * @param node [i] The IMG tag node is specified.
3681 * @return The conversion result is returned.
3684 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3686 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3692 * It is a handler who processes the SELECT tag.
3694 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3695 * destination is specified.
3696 * @param node [i] The SELECT tag node is specified.
3697 * @return The conversion result is returned.
3700 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3702 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3703 Doc *doc = jxhtml->doc;
3707 char *multiple = NULL;
3708 char *attr_style = NULL;
3711 for (attr = qs_get_attr(doc,node);
3713 attr = qs_get_next_attr(doc,attr)) {
3714 char *nm = qs_get_attr_name(doc,attr);
3715 char *val = qs_get_attr_value(doc,attr);
3716 if (STRCASEEQ('s','S',"size",nm)) {
3717 /*----------------------------------------------------------------------*/
3718 /* CHTML 1.0 version 2.0 */
3719 /*----------------------------------------------------------------------*/
3720 size = apr_pstrdup(doc->buf.pool, val);
3722 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3723 /*----------------------------------------------------------------------*/
3724 /* CHTML 1.0 version 2.0 */
3725 /*----------------------------------------------------------------------*/
3726 attr_style = apr_pstrdup(doc->buf.pool, val);
3728 else if (STRCASEEQ('n','N',"name",nm)) {
3729 /*----------------------------------------------------------------------*/
3730 /* CHTML 1.0 version 2.0 */
3731 /*----------------------------------------------------------------------*/
3732 name = apr_pstrdup(doc->buf.pool, val);
3734 else if (STRCASEEQ('m','M',"multiple", nm)) {
3735 /*----------------------------------------------------------------------*/
3736 /* CHTML 1.0 version 2.0 */
3737 /*----------------------------------------------------------------------*/
3738 multiple = apr_pstrdup(doc->buf.pool, val);
3741 if (size && *size) {
3746 if (name && *name) {
3756 if (IS_CSS_ON(jxhtml->entryp)) {
3757 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3765 * It is a handler who processes the SELECT tag.
3767 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3768 * destination is specified.
3769 * @param node [i] The SELECT tag node is specified.
3770 * @return The conversion result is returned.
3773 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3775 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3776 Doc *doc = jxhtml->doc;
3779 if (IS_CSS_ON(jxhtml->entryp)) {
3780 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3787 * It is a handler who processes the OPTION tag.
3789 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3790 * destination is specified.
3791 * @param node [i] The OPTION tag node is specified.
3792 * @return The conversion result is returned.
3795 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3797 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3798 Doc *doc = jxhtml->doc;
3801 char *selected = NULL;
3803 char *attr_style = NULL;
3806 for (attr = qs_get_attr(doc,node);
3808 attr = qs_get_next_attr(doc,attr)) {
3809 char *nm = qs_get_attr_name(doc,attr);
3810 char *val = qs_get_attr_value(doc,attr);
3811 if (STRCASEEQ('s','S',"selected",nm)) {
3812 /*----------------------------------------------------------------------*/
3813 /* CHTML 1.0 version 2.0 */
3814 /*----------------------------------------------------------------------*/
3815 selected = apr_pstrdup(doc->buf.pool, val);
3817 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3818 /*----------------------------------------------------------------------*/
3819 /* CHTML 1.0 version 2.0 */
3820 /*----------------------------------------------------------------------*/
3821 attr_style = apr_pstrdup(doc->buf.pool, val);
3823 else if (STRCASEEQ('v','V',"value",nm)) {
3824 /*----------------------------------------------------------------------*/
3825 /* CHTML 1.0 version 2.0 */
3826 /*----------------------------------------------------------------------*/
3827 value = apr_pstrdup(doc->buf.pool, val);
3840 if (IS_CSS_ON(jxhtml->entryp)) {
3841 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3849 * It is a handler who processes the OPTION tag.
3851 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3852 * destination is specified.
3853 * @param node [i] The OPTION tag node is specified.
3854 * @return The conversion result is returned.
3857 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3859 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3860 Doc *doc = jxhtml->doc;
3863 if (IS_CSS_ON(jxhtml->entryp)) {
3864 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3872 * It is a handler who processes the DIV tag.
3874 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3875 * destination is specified.
3876 * @param node [i] The DIV tag node is specified.
3877 * @return The conversion result is returned.
3880 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3886 char *attr_style = NULL;
3887 char *attr_align = NULL;
3888 char *attr_display = NULL;
3889 char *attr_decoration = NULL;
3890 char *attr_wap_marquee_style = NULL;
3891 char *attr_wap_marquee_dir = NULL;
3892 char *attr_wap_marquee_loop = NULL;
3893 char *attr_color = NULL;
3894 char *attr_bgcolor = NULL;
3895 char *attr_font_size = NULL;
3896 char *css_clear = NULL;
3898 jxhtml = GET_JXHTML(pdoc);
3902 for (attr = qs_get_attr(doc,node);
3904 attr = qs_get_next_attr(doc,attr)) {
3905 char *nm = qs_get_attr_name(doc,attr);
3906 char *val = qs_get_attr_value(doc,attr);
3907 if (STRCASEEQ('a','A',"align",nm)) {
3908 /*----------------------------------------------------------------------*/
3909 /* CHTML 1.0 (W3C version 3.2) */
3910 /*----------------------------------------------------------------------*/
3911 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3912 attr_align = apr_pstrdup(doc->buf.pool, val);
3915 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3916 attr_style = apr_pstrdup(doc->buf.pool, val);
3920 if (IS_CSS_ON(jxhtml->entryp)) {
3921 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3923 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3924 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3925 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3926 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3927 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3928 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3929 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3930 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3932 css_property_t *cur;
3933 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3934 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3935 attr_display = apr_pstrdup(doc->pool, cur->value);
3938 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3939 if (STRCASEEQ('b','B',"blink", cur->value)) {
3940 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3943 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3944 attr_color = apr_pstrdup(doc->pool, cur->value);
3946 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3947 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3948 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3950 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3951 char *ss = strchr(cur->value, '#');
3953 ss = strstr(cur->value, "rgb");
3956 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3957 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3960 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3961 attr_align = apr_pstrdup(doc->pool, cur->value);
3963 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3964 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3965 || STRCASEEQ('x','X',"x-small",cur->value)
3966 || STRCASEEQ('s','S',"small",cur->value)
3967 || STRCASEEQ('m','M',"medium",cur->value)
3968 || STRCASEEQ('l','L',"large",cur->value)
3969 || STRCASEEQ('x','X',"x-large",cur->value)
3970 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3971 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3975 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3976 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3977 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3978 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3979 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3980 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3983 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3984 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3985 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3987 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3988 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3991 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3992 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
3993 attr_wap_marquee_loop = "infinite";
3996 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4000 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4001 css_clear = apr_pstrdup(doc->pool, cur->value);
4009 || attr_wap_marquee_style
4010 || attr_wap_marquee_dir
4011 || attr_wap_marquee_loop
4027 if (attr_decoration) {
4028 W_L("text-decoration:");
4029 W_V(attr_decoration);
4032 if (attr_wap_marquee_style) {
4033 W_L("-wap-marquee-style:");
4034 W_V(attr_wap_marquee_style);
4037 if (attr_wap_marquee_dir) {
4038 W_L("-wap-marquee-dir:");
4039 W_V(attr_wap_marquee_dir);
4042 if (attr_wap_marquee_loop) {
4043 W_L("-wap-marquee-loop:");
4044 W_V(attr_wap_marquee_loop);
4053 W_L("background-color:");
4057 if (attr_font_size) {
4059 W_V(attr_font_size);
4075 * It is a handler who processes the DIV tag.
4077 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4078 * destination is specified.
4079 * @param node [i] The DIV tag node is specified.
4080 * @return The conversion result is returned.
4083 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4089 jxhtml = GET_JXHTML(pdoc);
4094 if (IS_CSS_ON(jxhtml->entryp)) {
4095 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4102 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4109 jxhtml = GET_JXHTML(pdoc);
4113 for (child = qs_get_child_node(doc, node);
4115 child = qs_get_next_node(doc, child)) {
4117 s_jxhtml_chxjif_tag(jxhtml, child);
4124 * It is a handler who processes the TEXTARE tag.
4126 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4127 * destination is specified.
4128 * @param node [i] The TEXTAREA tag node is specified.
4129 * @return The conversion result is returned.
4132 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4138 char *attr_accesskey = NULL;
4139 char *attr_name = NULL;
4140 char *attr_rows = NULL;
4141 char *attr_cols = NULL;
4142 char *attr_istyle = NULL;
4143 char *attr_style = NULL;
4146 jxhtml = GET_JXHTML(pdoc);
4150 jxhtml->textarea_flag++;
4151 for (attr = qs_get_attr(doc,node);
4153 attr = qs_get_next_attr(doc,attr)) {
4154 char *name = qs_get_attr_name(doc,attr);
4155 char *value = qs_get_attr_value(doc,attr);
4156 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4157 attr_accesskey = value;
4159 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4160 attr_istyle = value;
4162 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4165 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4168 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4171 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4175 if (IS_CSS_ON(jxhtml->entryp)) {
4176 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4178 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4179 css_property_t *cur;
4180 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4181 if (strcasestr(cur->value, "<ja:n>")) {
4184 else if (strcasestr(cur->value, "<ja:en>")) {
4187 else if (strcasestr(cur->value, "<ja:hk>")) {
4190 else if (strcasestr(cur->value, "<ja:h>")) {
4197 if (attr_accesskey) {
4198 W_L(" accesskey=\"");
4199 W_V(attr_accesskey);
4228 * It is a handler who processes the TEXTAREA tag.
4230 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4231 * destination is specified.
4232 * @param node [i] The TEXTAREA tag node is specified.
4233 * @return The conversion result is returned.
4236 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4242 jxhtml = GET_JXHTML(pdoc);
4247 jxhtml->textarea_flag--;
4254 * It is a handler who processes the B tag.
4256 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4257 * destination is specified.
4258 * @param node [i] The B tag node is specified.
4259 * @return The conversion result is returned.
4262 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4268 jxhtml = GET_JXHTML(pdoc);
4278 * It is a handler who processes the B tag.
4280 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4281 * destination is specified.
4282 * @param node [i] The B tag node is specified.
4283 * @return The conversion result is returned.
4286 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4288 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4289 Doc* doc = jxhtml->doc;
4296 s_jxhtml_text_tag(void* pdoc, Node* child)
4307 apr_size_t z2h_input_len;
4309 jxhtml = GET_JXHTML(pdoc);
4313 textval = qs_get_node_value(doc,child);
4314 if (strlen(textval) == 0) {
4318 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4319 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4321 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4322 memset(one_byte, 0, sizeof(one_byte));
4325 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4327 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4329 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4334 if (is_sjis_kanji(textval[ii])) {
4335 one_byte[0] = textval[ii+0];
4336 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4337 one_byte[0] = textval[ii+1];
4338 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4342 if (jxhtml->pre_flag) {
4343 one_byte[0] = textval[ii+0];
4344 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4347 if (jxhtml->textarea_flag) {
4348 one_byte[0] = textval[ii+0];
4349 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4352 if (textval[ii] != '\r' && textval[ii] != '\n') {
4353 one_byte[0] = textval[ii+0];
4354 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4358 z2h_input_len = strlen(tdst);
4359 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4367 * It is a handler who processes the BLOCKQUOTE tag.
4369 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4370 * destination is specified.
4371 * @param node [i] The BLOCKQUOTE tag node is specified.
4372 * @return The conversion result is returned.
4375 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4380 char *attr_style = NULL;
4381 char *attr_color = NULL;
4382 char *attr_size = NULL;
4384 jxhtml = GET_JXHTML(pdoc);
4386 for (attr = qs_get_attr(doc,node);
4388 attr = qs_get_next_attr(doc,attr)) {
4389 char *nm = qs_get_attr_name(doc,attr);
4390 char *val = qs_get_attr_value(doc,attr);
4391 if (val && STRCASEEQ('s','S',"style", nm)) {
4395 if (IS_CSS_ON(jxhtml->entryp)) {
4396 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4398 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4399 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4400 css_property_t *cur;
4401 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4402 if (cur->value && *cur->value) {
4403 attr_color = apr_pstrdup(doc->pool, cur->value);
4406 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4407 if (cur->value && *cur->value) {
4408 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4409 attr_size = apr_pstrdup(doc->pool, cur->value);
4411 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4412 attr_size = apr_pstrdup(doc->pool, cur->value);
4414 else if (STRCASEEQ('s','S',"small",cur->value)) {
4415 attr_size = apr_pstrdup(doc->pool, cur->value);
4417 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4418 attr_size = apr_pstrdup(doc->pool, cur->value);
4420 else if (STRCASEEQ('l','L',"large",cur->value)) {
4421 attr_size = apr_pstrdup(doc->pool, cur->value);
4423 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4424 attr_size = apr_pstrdup(doc->pool, cur->value);
4426 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4427 attr_size = apr_pstrdup(doc->pool, cur->value);
4434 if (attr_color || attr_size) {
4437 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4455 * It is a handler who processes the BLOCKQUOTE tag.
4457 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4458 * destination is specified.
4459 * @param node [i] The BLOCKQUOTE tag node is specified.
4460 * @return The conversion result is returned.
4463 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4465 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4466 Doc *doc = jxhtml->doc;
4467 W_L("</blockquote>");
4468 if (IS_CSS_ON(jxhtml->entryp)) {
4469 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4476 * It is a handler who processes the DIR tag.
4478 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4479 * destination is specified.
4480 * @param node [i] The DIR tag node is specified.
4481 * @return The conversion result is returned.
4484 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4486 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4487 Doc *doc = jxhtml->doc;
4489 char *attr_style = NULL;
4490 char *attr_color = NULL;
4491 char *attr_type = NULL;
4492 char *attr_size = NULL;
4493 for (attr = qs_get_attr(doc,node);
4495 attr = qs_get_next_attr(doc,attr)) {
4496 char *name = qs_get_attr_name(doc,attr);
4497 char *value = qs_get_attr_value(doc,attr);
4498 if (STRCASEEQ('t','T',"type",name)) {
4499 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4503 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4507 if (IS_CSS_ON(jxhtml->entryp)) {
4508 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4510 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4511 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4512 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4513 css_property_t *cur;
4514 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4515 if (cur->value && *cur->value) {
4516 attr_color = apr_pstrdup(doc->pool, cur->value);
4519 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4520 if (cur->value && *cur->value) {
4521 attr_type = apr_pstrdup(doc->pool, cur->value);
4524 for (cur = size_prop->next; cur != 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_type || attr_color || attr_size) {
4555 W_L("list-style-type:");
4560 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4578 * It is a handler who processes the DIR tag.
4580 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4581 * destination is specified.
4582 * @param node [i] The DIR tag node is specified.
4583 * @return The conversion result is returned.
4586 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4588 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4589 Doc *doc = jxhtml->doc;
4591 if (IS_CSS_ON(jxhtml->entryp)) {
4592 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4599 * It is a handler who processes the DL tag.
4601 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4602 * destination is specified.
4603 * @param node [i] The DL tag node is specified.
4604 * @return The conversion result is returned.
4607 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4609 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4610 Doc *doc = jxhtml->doc;
4612 char *attr_style = NULL;
4613 char *attr_color = NULL;
4614 char *attr_size = NULL;
4615 for (attr = qs_get_attr(doc,node);
4617 attr = qs_get_next_attr(doc,attr)) {
4618 char *name = qs_get_attr_name(doc,attr);
4619 char *value = qs_get_attr_value(doc,attr);
4620 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4624 if (IS_CSS_ON(jxhtml->entryp)) {
4625 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4627 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4628 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4629 css_property_t *cur;
4630 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4631 if (cur->value && *cur->value) {
4632 attr_color = apr_pstrdup(doc->pool, cur->value);
4635 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4636 if (cur->value && *cur->value) {
4637 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4638 attr_size = apr_pstrdup(doc->pool, cur->value);
4640 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4641 attr_size = apr_pstrdup(doc->pool, cur->value);
4643 else if (STRCASEEQ('s','S',"small",cur->value)) {
4644 attr_size = apr_pstrdup(doc->pool, cur->value);
4646 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4647 attr_size = apr_pstrdup(doc->pool, cur->value);
4649 else if (STRCASEEQ('l','L',"large",cur->value)) {
4650 attr_size = apr_pstrdup(doc->pool, cur->value);
4652 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4653 attr_size = apr_pstrdup(doc->pool, cur->value);
4655 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4656 attr_size = apr_pstrdup(doc->pool, cur->value);
4663 if (attr_color || attr_size) {
4666 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4684 * It is a handler who processes the DL tag.
4686 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4687 * destination is specified.
4688 * @param node [i] The DL tag node is specified.
4689 * @return The conversion result is returned.
4692 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4694 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4695 Doc *doc = jxhtml->doc;
4697 if (IS_CSS_ON(jxhtml->entryp)) {
4698 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4705 * It is a handler who processes the DT tag.
4707 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4708 * destination is specified.
4709 * @param node [i] The DT tag node is specified.
4710 * @return The conversion result is returned.
4713 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4715 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4716 Doc *doc = jxhtml->doc;
4718 char *attr_style = NULL;
4719 char *attr_color = NULL;
4720 char *attr_size = NULL;
4721 for (attr = qs_get_attr(doc,node);
4723 attr = qs_get_next_attr(doc,attr)) {
4724 char *name = qs_get_attr_name(doc,attr);
4725 char *value = qs_get_attr_value(doc,attr);
4726 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4730 if (IS_CSS_ON(jxhtml->entryp)) {
4731 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4733 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4734 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4735 css_property_t *cur;
4736 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4737 if (cur->value && *cur->value) {
4738 attr_color = apr_pstrdup(doc->pool, cur->value);
4741 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4742 if (cur->value && *cur->value) {
4743 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4744 attr_size = apr_pstrdup(doc->pool, cur->value);
4746 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4747 attr_size = apr_pstrdup(doc->pool, cur->value);
4749 else if (STRCASEEQ('s','S',"small",cur->value)) {
4750 attr_size = apr_pstrdup(doc->pool, cur->value);
4752 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4753 attr_size = apr_pstrdup(doc->pool, cur->value);
4755 else if (STRCASEEQ('l','L',"large",cur->value)) {
4756 attr_size = apr_pstrdup(doc->pool, cur->value);
4758 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4759 attr_size = apr_pstrdup(doc->pool, cur->value);
4761 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4762 attr_size = apr_pstrdup(doc->pool, cur->value);
4769 if (attr_color || attr_size) {
4772 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4790 * It is a handler who processes the DT tag.
4792 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4793 * destination is specified.
4794 * @param node [i] The DT tag node is specified.
4795 * @return The conversion result is returned.
4798 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4800 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4801 Doc *doc = jxhtml->doc;
4803 if (IS_CSS_ON(jxhtml->entryp)) {
4804 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4811 * It is a handler who processes the DD tag.
4813 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4814 * destination is specified.
4815 * @param node [i] The DD tag node is specified.
4816 * @return The conversion result is returned.
4819 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4821 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4822 Doc *doc = jxhtml->doc;
4824 char *attr_style = NULL;
4825 char *attr_color = NULL;
4826 char *attr_size = NULL;
4827 for (attr = qs_get_attr(doc,node);
4829 attr = qs_get_next_attr(doc,attr)) {
4830 char *name = qs_get_attr_name(doc,attr);
4831 char *value = qs_get_attr_value(doc,attr);
4832 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4836 if (IS_CSS_ON(jxhtml->entryp)) {
4837 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4839 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4840 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4841 css_property_t *cur;
4842 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4843 if (cur->value && *cur->value) {
4844 attr_color = apr_pstrdup(doc->pool, cur->value);
4847 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4848 if (cur->value && *cur->value) {
4849 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4850 attr_size = apr_pstrdup(doc->pool, cur->value);
4852 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4853 attr_size = apr_pstrdup(doc->pool, cur->value);
4855 else if (STRCASEEQ('s','S',"small",cur->value)) {
4856 attr_size = apr_pstrdup(doc->pool, cur->value);
4858 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4859 attr_size = apr_pstrdup(doc->pool, cur->value);
4861 else if (STRCASEEQ('l','L',"large",cur->value)) {
4862 attr_size = apr_pstrdup(doc->pool, cur->value);
4864 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4865 attr_size = apr_pstrdup(doc->pool, cur->value);
4867 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4868 attr_size = apr_pstrdup(doc->pool, cur->value);
4875 if (attr_color || attr_size) {
4878 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4896 * It is a handler who processes the DD tag.
4898 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4899 * destination is specified.
4900 * @param node [i] The DD tag node is specified.
4901 * @return The conversion result is returned.
4904 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4906 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4907 Doc *doc = jxhtml->doc;
4909 if (IS_CSS_ON(jxhtml->entryp)) {
4910 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4917 * It is a handler who processes the H1 tag.
4919 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4920 * destination is specified.
4921 * @param node [i] The H1 tag node is specified.
4922 * @return The conversion result is returned.
4925 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4931 char *attr_style = NULL;
4932 char *attr_align = NULL;
4933 char *css_clear = NULL;
4935 jxhtml = GET_JXHTML(pdoc);
4939 for (attr = qs_get_attr(doc,node);
4941 attr = qs_get_next_attr(doc,attr)) {
4942 char *name = qs_get_attr_name(doc,attr);
4943 char *value = qs_get_attr_value(doc,attr);
4944 if (STRCASEEQ('a','A',"align", name)) {
4945 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4949 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4953 if (IS_CSS_ON(jxhtml->entryp)) {
4954 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4956 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4957 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4958 css_property_t *cur;
4959 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4960 if (STRCASEEQ('l','L',"left", cur->value)) {
4961 attr_align = apr_pstrdup(doc->pool, "left");
4963 else if (STRCASEEQ('c','C',"center",cur->value)) {
4964 attr_align = apr_pstrdup(doc->pool, "center");
4966 else if (STRCASEEQ('r','R',"right",cur->value)) {
4967 attr_align = apr_pstrdup(doc->pool, "right");
4970 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4971 if (STRCASEEQ('b','B',"both", cur->value)) {
4972 css_clear = apr_pstrdup(doc->pool, "both");
4974 else if (STRCASEEQ('r','R',"right", cur->value)) {
4975 css_clear = apr_pstrdup(doc->pool, "right");
4977 else if (STRCASEEQ('l','L',"left", cur->value)) {
4978 css_clear = apr_pstrdup(doc->pool, "left");
4984 if (attr_align || css_clear ) {
5005 * It is a handler who processes the H1 tag.
5007 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5008 * destination is specified.
5009 * @param node [i] The H1 tag node is specified.
5010 * @return The conversion result is returned.
5013 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5019 jxhtml = GET_JXHTML(pdoc);
5024 if (IS_CSS_ON(jxhtml->entryp)) {
5025 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5033 * It is a handler who processes the H2 tag.
5035 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5036 * destination is specified.
5037 * @param node [i] The H1 tag node is specified.
5038 * @return The conversion result is returned.
5041 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5047 char *attr_style = NULL;
5048 char *attr_align = NULL;
5049 char *css_clear = NULL;
5051 jxhtml = GET_JXHTML(pdoc);
5055 for (attr = qs_get_attr(doc,node);
5057 attr = qs_get_next_attr(doc,attr)) {
5058 char *name = qs_get_attr_name(doc,attr);
5059 char *value = qs_get_attr_value(doc,attr);
5060 if (STRCASEEQ('a','A',"align", name)) {
5061 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5065 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5069 if (IS_CSS_ON(jxhtml->entryp)) {
5070 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5072 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5073 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5074 css_property_t *cur;
5075 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5076 if (STRCASEEQ('l','L',"left", cur->value)) {
5077 attr_align = apr_pstrdup(doc->pool, "left");
5079 else if (STRCASEEQ('c','C',"center",cur->value)) {
5080 attr_align = apr_pstrdup(doc->pool, "center");
5082 else if (STRCASEEQ('r','R',"right",cur->value)) {
5083 attr_align = apr_pstrdup(doc->pool, "right");
5086 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5087 if (STRCASEEQ('b','B',"both", cur->value)) {
5088 css_clear = apr_pstrdup(doc->pool, "both");
5090 else if (STRCASEEQ('r','R',"right", cur->value)) {
5091 css_clear = apr_pstrdup(doc->pool, "right");
5093 else if (STRCASEEQ('l','L',"left", cur->value)) {
5094 css_clear = apr_pstrdup(doc->pool, "left");
5100 if (attr_align || css_clear ) {
5121 * It is a handler who processes the H2 tag.
5123 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5124 * destination is specified.
5125 * @param node [i] The H1 tag node is specified.
5126 * @return The conversion result is returned.
5129 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5135 jxhtml = GET_JXHTML(pdoc);
5140 if (IS_CSS_ON(jxhtml->entryp)) {
5141 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5148 * It is a handler who processes the H3 tag.
5150 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5151 * destination is specified.
5152 * @param node [i] The H1 tag node is specified.
5153 * @return The conversion result is returned.
5156 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5162 char *attr_style = NULL;
5163 char *attr_align = NULL;
5164 char *css_clear = NULL;
5166 jxhtml = GET_JXHTML(pdoc);
5170 for (attr = qs_get_attr(doc,node);
5172 attr = qs_get_next_attr(doc,attr)) {
5173 char *name = qs_get_attr_name(doc,attr);
5174 char *value = qs_get_attr_value(doc,attr);
5175 if (STRCASEEQ('a','A',"align", name)) {
5176 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5180 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5184 if (IS_CSS_ON(jxhtml->entryp)) {
5185 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5187 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5188 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5189 css_property_t *cur;
5190 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5191 if (STRCASEEQ('l','L',"left", cur->value)) {
5192 attr_align = apr_pstrdup(doc->pool, "left");
5194 else if (STRCASEEQ('c','C',"center",cur->value)) {
5195 attr_align = apr_pstrdup(doc->pool, "center");
5197 else if (STRCASEEQ('r','R',"right",cur->value)) {
5198 attr_align = apr_pstrdup(doc->pool, "right");
5201 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5202 if (STRCASEEQ('b','B',"both", cur->value)) {
5203 css_clear = apr_pstrdup(doc->pool, "both");
5205 else if (STRCASEEQ('r','R',"right", cur->value)) {
5206 css_clear = apr_pstrdup(doc->pool, "right");
5208 else if (STRCASEEQ('l','L',"left", cur->value)) {
5209 css_clear = apr_pstrdup(doc->pool, "left");
5215 if (attr_align || css_clear ) {
5236 * It is a handler who processes the H3 tag.
5238 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5239 * destination is specified.
5240 * @param node [i] The H1 tag node is specified.
5241 * @return The conversion result is returned.
5244 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5250 jxhtml = GET_JXHTML(pdoc);
5255 if (IS_CSS_ON(jxhtml->entryp)) {
5256 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5263 * It is a handler who processes the H4 tag.
5265 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5266 * destination is specified.
5267 * @param node [i] The H1 tag node is specified.
5268 * @return The conversion result is returned.
5271 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5277 char *attr_style = NULL;
5278 char *attr_align = NULL;
5279 char *css_clear = NULL;
5281 jxhtml = GET_JXHTML(pdoc);
5285 for (attr = qs_get_attr(doc,node);
5287 attr = qs_get_next_attr(doc,attr)) {
5288 char *name = qs_get_attr_name(doc,attr);
5289 char *value = qs_get_attr_value(doc,attr);
5290 if (STRCASEEQ('a','A',"align", name)) {
5291 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5295 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5299 if (IS_CSS_ON(jxhtml->entryp)) {
5300 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5302 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5303 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5304 css_property_t *cur;
5305 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5306 if (STRCASEEQ('l','L',"left", cur->value)) {
5307 attr_align = apr_pstrdup(doc->pool, "left");
5309 else if (STRCASEEQ('c','C',"center",cur->value)) {
5310 attr_align = apr_pstrdup(doc->pool, "center");
5312 else if (STRCASEEQ('r','R',"right",cur->value)) {
5313 attr_align = apr_pstrdup(doc->pool, "right");
5316 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5317 if (STRCASEEQ('b','B',"both", cur->value)) {
5318 css_clear = apr_pstrdup(doc->pool, "both");
5320 else if (STRCASEEQ('r','R',"right", cur->value)) {
5321 css_clear = apr_pstrdup(doc->pool, "right");
5323 else if (STRCASEEQ('l','L',"left", cur->value)) {
5324 css_clear = apr_pstrdup(doc->pool, "left");
5330 if (attr_align || css_clear ) {
5351 * It is a handler who processes the H4 tag.
5353 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5354 * destination is specified.
5355 * @param node [i] The H1 tag node is specified.
5356 * @return The conversion result is returned.
5359 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5365 jxhtml = GET_JXHTML(pdoc);
5370 if (IS_CSS_ON(jxhtml->entryp)) {
5371 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5379 * It is a handler who processes the H5 tag.
5381 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5382 * destination is specified.
5383 * @param node [i] The H1 tag node is specified.
5384 * @return The conversion result is returned.
5387 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5393 char *attr_style = NULL;
5394 char *attr_align = NULL;
5395 char *css_clear = NULL;
5397 jxhtml = GET_JXHTML(pdoc);
5401 for (attr = qs_get_attr(doc,node);
5403 attr = qs_get_next_attr(doc,attr)) {
5404 char *name = qs_get_attr_name(doc,attr);
5405 char *value = qs_get_attr_value(doc,attr);
5406 if (STRCASEEQ('a','A',"align", name)) {
5407 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5411 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5415 if (IS_CSS_ON(jxhtml->entryp)) {
5416 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5418 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5419 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5420 css_property_t *cur;
5421 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5422 if (STRCASEEQ('l','L',"left", cur->value)) {
5423 attr_align = apr_pstrdup(doc->pool, "left");
5425 else if (STRCASEEQ('c','C',"center",cur->value)) {
5426 attr_align = apr_pstrdup(doc->pool, "center");
5428 else if (STRCASEEQ('r','R',"right",cur->value)) {
5429 attr_align = apr_pstrdup(doc->pool, "right");
5432 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5433 if (STRCASEEQ('b','B',"both", cur->value)) {
5434 css_clear = apr_pstrdup(doc->pool, "both");
5436 else if (STRCASEEQ('r','R',"right", cur->value)) {
5437 css_clear = apr_pstrdup(doc->pool, "right");
5439 else if (STRCASEEQ('l','L',"left", cur->value)) {
5440 css_clear = apr_pstrdup(doc->pool, "left");
5446 if (attr_align || css_clear ) {
5467 * It is a handler who processes the H5 tag.
5469 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5470 * destination is specified.
5471 * @param node [i] The H1 tag node is specified.
5472 * @return The conversion result is returned.
5475 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5481 jxhtml = GET_JXHTML(pdoc);
5486 if (IS_CSS_ON(jxhtml->entryp)) {
5487 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5495 * It is a handler who processes the H6 tag.
5497 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5498 * destination is specified.
5499 * @param node [i] The H1 tag node is specified.
5500 * @return The conversion result is returned.
5503 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5509 char *attr_style = NULL;
5510 char *attr_align = NULL;
5511 char *css_clear = NULL;
5513 jxhtml = GET_JXHTML(pdoc);
5517 for (attr = qs_get_attr(doc,node);
5519 attr = qs_get_next_attr(doc,attr)) {
5520 char *name = qs_get_attr_name(doc,attr);
5521 char *value = qs_get_attr_value(doc,attr);
5522 if (STRCASEEQ('a','A',"align", name)) {
5523 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5527 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5531 if (IS_CSS_ON(jxhtml->entryp)) {
5532 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5534 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5535 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5536 css_property_t *cur;
5537 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5538 if (STRCASEEQ('l','L',"left", cur->value)) {
5539 attr_align = apr_pstrdup(doc->pool, "left");
5541 else if (STRCASEEQ('c','C',"center",cur->value)) {
5542 attr_align = apr_pstrdup(doc->pool, "center");
5544 else if (STRCASEEQ('r','R',"right",cur->value)) {
5545 attr_align = apr_pstrdup(doc->pool, "right");
5548 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5549 if (STRCASEEQ('b','B',"both", cur->value)) {
5550 css_clear = apr_pstrdup(doc->pool, "both");
5552 else if (STRCASEEQ('r','R',"right", cur->value)) {
5553 css_clear = apr_pstrdup(doc->pool, "right");
5555 else if (STRCASEEQ('l','L',"left", cur->value)) {
5556 css_clear = apr_pstrdup(doc->pool, "left");
5562 if (attr_align || css_clear ) {
5583 * It is a handler who processes the H6 tag.
5585 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5586 * destination is specified.
5587 * @param node [i] The H1 tag node is specified.
5588 * @return The conversion result is returned.
5591 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5597 jxhtml = GET_JXHTML(pdoc);
5602 if (IS_CSS_ON(jxhtml->entryp)) {
5603 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5611 * It is a handler who processes the MENU tag.
5613 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5614 * destination is specified.
5615 * @param node [i] The MENU tag node is specified.
5616 * @return The conversion result is returned.
5619 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5621 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5622 Doc *doc = jxhtml->doc;
5624 char *attr_style = NULL;
5625 char *attr_color = NULL;
5626 char *attr_type = NULL;
5627 char *attr_size = NULL;
5628 for (attr = qs_get_attr(doc,node);
5630 attr = qs_get_next_attr(doc,attr)) {
5631 char *name = qs_get_attr_name(doc,attr);
5632 char *value = qs_get_attr_value(doc,attr);
5633 if (STRCASEEQ('t','T',"type",name)) {
5634 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5638 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5642 if (IS_CSS_ON(jxhtml->entryp)) {
5643 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5645 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5646 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5647 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5648 css_property_t *cur;
5649 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5650 if (cur->value && *cur->value) {
5651 attr_color = apr_pstrdup(doc->pool, cur->value);
5654 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5655 if (cur->value && *cur->value) {
5656 attr_type = apr_pstrdup(doc->pool, cur->value);
5659 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5660 if (cur->value && *cur->value) {
5661 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5662 attr_size = apr_pstrdup(doc->pool, cur->value);
5664 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5665 attr_size = apr_pstrdup(doc->pool, cur->value);
5667 else if (STRCASEEQ('s','S',"small",cur->value)) {
5668 attr_size = apr_pstrdup(doc->pool, cur->value);
5670 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5671 attr_size = apr_pstrdup(doc->pool, cur->value);
5673 else if (STRCASEEQ('l','L',"large",cur->value)) {
5674 attr_size = apr_pstrdup(doc->pool, cur->value);
5676 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5677 attr_size = apr_pstrdup(doc->pool, cur->value);
5679 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5680 attr_size = apr_pstrdup(doc->pool, cur->value);
5687 if (attr_type || attr_color || attr_size) {
5690 W_L("list-style-type:");
5695 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5713 * It is a handler who processes the MENU tag.
5715 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5716 * destination is specified.
5717 * @param node [i] The MENU tag node is specified.
5718 * @return The conversion result is returned.
5721 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5723 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5724 Doc *doc = jxhtml->doc;
5726 if (IS_CSS_ON(jxhtml->entryp)) {
5727 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5734 * It is a handler who processes the PLAINTEXT tag.
5736 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5737 * destination is specified.
5738 * @param node [i] The PLAINTEXT tag node is specified.
5739 * @return The conversion result is returned.
5742 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5747 jxhtml = GET_JXHTML(pdoc);
5750 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5755 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5760 jxhtml = GET_JXHTML(pdoc);
5762 for (child = qs_get_child_node(doc, node);
5764 child = qs_get_next_node(doc, child)) {
5766 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5773 * It is a handler who processes the PLAINTEXT tag.
5775 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5776 * destination is specified.
5777 * @param node [i] The PLAINTEXT tag node is specified.
5778 * @return The conversion result is returned.
5781 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5783 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5789 * It is a handler who processes the BLINK tag.
5791 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5792 * destination is specified.
5793 * @param node [i] The BLINK tag node is specified.
5794 * @return The conversion result is returned.
5797 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5799 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5800 Doc *doc = jxhtml->doc;
5802 char *attr_style = NULL;
5803 char *attr_color = NULL;
5804 char *attr_size = NULL;
5805 for (attr = qs_get_attr(doc,node);
5807 attr = qs_get_next_attr(doc,attr)) {
5808 char *name = qs_get_attr_name(doc,attr);
5809 char *value = qs_get_attr_value(doc,attr);
5810 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5814 if (IS_CSS_ON(jxhtml->entryp)) {
5815 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5817 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5818 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5819 css_property_t *cur;
5820 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5821 if (cur->value && *cur->value) {
5822 attr_color = apr_pstrdup(doc->pool, cur->value);
5825 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5826 if (cur->value && *cur->value) {
5827 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5828 attr_size = apr_pstrdup(doc->pool, cur->value);
5830 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5831 attr_size = apr_pstrdup(doc->pool, cur->value);
5833 else if (STRCASEEQ('s','S',"small",cur->value)) {
5834 attr_size = apr_pstrdup(doc->pool, cur->value);
5836 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5837 attr_size = apr_pstrdup(doc->pool, cur->value);
5839 else if (STRCASEEQ('l','L',"large",cur->value)) {
5840 attr_size = apr_pstrdup(doc->pool, cur->value);
5842 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5843 attr_size = apr_pstrdup(doc->pool, cur->value);
5845 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5846 attr_size = apr_pstrdup(doc->pool, cur->value);
5853 if (attr_color || attr_size) {
5856 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5874 * It is a handler who processes the BLINK tag.
5876 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5877 * destination is specified.
5878 * @param node [i] The BLINK tag node is specified.
5879 * @return The conversion result is returned.
5882 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5884 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5885 Doc *doc = jxhtml->doc;
5887 if (IS_CSS_ON(jxhtml->entryp)) {
5888 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5895 * It is a handler who processes the MARQUEE tag.
5897 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5898 * destination is specified.
5899 * @param node [i] The MARQUEE tag node is specified.
5900 * @return The conversion result is returned.
5903 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5905 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5906 Doc *doc = jxhtml->doc;
5908 char *attr_direction = NULL;
5909 char *attr_style = NULL;
5910 char *attr_color = NULL;
5911 char *attr_size = NULL;
5912 char *attr_bgcolor = NULL;
5913 /*--------------------------------------------------------------------------*/
5914 /* Get Attributes */
5915 /*--------------------------------------------------------------------------*/
5916 for (attr = qs_get_attr(doc,node);
5918 attr = qs_get_next_attr(doc,attr)) {
5919 char *name = qs_get_attr_name(doc,attr);
5920 char *value = qs_get_attr_value(doc,attr);
5921 if (STRCASEEQ('d','D',"direction", name)) {
5923 if (STRCASEEQ('l','L',"left",value)) {
5924 attr_direction = "rtl";
5926 else if (STRCASEEQ('r','R',"right",value)) {
5927 attr_direction = "ltr";
5931 else if (STRCASEEQ('b','B',"behavior",name)) {
5934 else if (STRCASEEQ('l','L',"loop",name)) {
5937 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5938 if (value && *value) {
5939 attr_bgcolor = value;
5942 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5946 if (IS_CSS_ON(jxhtml->entryp)) {
5947 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5949 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5950 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5951 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5952 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5953 css_property_t *cur;
5954 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5955 if (cur->value && *cur->value) {
5956 attr_color = apr_pstrdup(doc->pool, cur->value);
5959 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5960 if (cur->value && *cur->value) {
5961 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5964 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5965 if (cur->value && *cur->value) {
5966 attr_direction = apr_pstrdup(doc->pool, cur->value);
5969 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5970 if (cur->value && *cur->value) {
5971 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5972 || STRCASEEQ('x','X',"x-small", cur->value)
5973 || STRCASEEQ('s','S',"small", cur->value)
5974 || STRCASEEQ('m','M',"medium", cur->value)
5975 || STRCASEEQ('l','L',"large", cur->value)
5976 || STRCASEEQ('x','X',"x-large", cur->value)
5977 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5978 attr_size = apr_pstrdup(doc->pool, cur->value);
5985 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5987 if (attr_direction) {
5988 W_L("-wap-marquee-dir:");
5989 W_V(attr_direction);
5993 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5994 W_L("background-color:");
5999 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6018 * It is a handler who processes the MARQUEE tag.
6020 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6021 * destination is specified.
6022 * @param node [i] The MARQUEE tag node is specified.
6023 * @return The conversion result is returned.
6026 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6028 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6029 Doc *doc = jxhtml->doc;
6031 if (IS_CSS_ON(jxhtml->entryp)) {
6032 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6039 * It is handler who processes the New Line Code.
6042 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6044 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6045 if (jxhtml->start_html_flag) {
6046 Doc *doc = jxhtml->doc;
6054 * It is a handler who processes the LINK tag.
6056 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6057 * destination is specified.
6058 * @param node [i] The LINK tag node is specified.
6059 * @return The conversion result is returned.
6062 s_jxhtml_link_tag(void *pdoc, Node *node)
6071 jxhtml = GET_JXHTML(pdoc);
6074 if (! IS_CSS_ON(jxhtml->entryp)) {
6078 for (attr = qs_get_attr(doc,node);
6080 attr = qs_get_next_attr(doc,attr)) {
6081 char *name = qs_get_attr_name(doc,attr);
6082 char *value = qs_get_attr_value(doc,attr);
6083 if (STRCASEEQ('r','R',"rel", name)) {
6084 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6088 else if (STRCASEEQ('h','H',"href", name)) {
6089 if (value && *value) {
6093 else if (STRCASEEQ('t','T',"type", name)) {
6094 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6100 if (rel && href && type) {
6101 DBG(doc->r, "start load CSS. url:[%s]", href);
6102 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6103 DBG(doc->r, "end load CSS. url:[%s]", href);
6110 static css_prop_list_t *
6111 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6113 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6114 Doc *doc = jxhtml->doc;
6115 css_prop_list_t *last_css = NULL;
6116 if (IS_CSS_ON(jxhtml->entryp)) {
6117 css_prop_list_t *dup_css;
6118 css_selector_t *selector;
6120 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6121 dup_css = chxj_dup_css_prop_list(doc, last_css);
6122 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6124 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6126 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6127 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6129 if (style_attr_value) {
6130 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));
6132 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6140 static css_prop_list_t *
6141 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6143 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6144 Doc *doc = jxhtml->doc;
6145 css_prop_list_t *last_css = NULL;
6146 if (IS_CSS_ON(jxhtml->entryp)) {
6147 css_prop_list_t *dup_css;
6148 css_selector_t *selector;
6150 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6151 dup_css = chxj_dup_css_prop_list(doc, last_css);
6152 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6154 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6158 if (style_attr_value) {
6159 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));
6161 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6170 * It is a handler who processes the SPAN tag.
6172 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6173 * destination is specified.
6174 * @param node [i] The SPAN tag node is specified.
6175 * @return The conversion result is returned.
6178 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6183 char *attr_style = NULL;
6184 char *attr_color = NULL;
6185 char *attr_size = NULL;
6186 char *attr_align = NULL;
6187 char *attr_blink = NULL;
6188 char *attr_marquee = NULL;
6189 char *attr_marquee_dir = NULL;
6190 char *attr_marquee_style = NULL;
6191 char *attr_marquee_loop = NULL;
6192 char *css_bgcolor = NULL;
6194 jxhtml = GET_JXHTML(pdoc);
6197 for (attr = qs_get_attr(doc,node);
6199 attr = qs_get_next_attr(doc,attr)) {
6200 char *nm = qs_get_attr_name(doc,attr);
6201 char *val = qs_get_attr_value(doc,attr);
6202 if (val && STRCASEEQ('s','S',"style", nm)) {
6206 if (IS_CSS_ON(jxhtml->entryp)) {
6207 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
6209 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6210 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6211 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6212 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6213 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6214 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6215 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6216 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6217 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6219 css_property_t *cur;
6220 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6221 attr_color = apr_pstrdup(doc->pool, cur->value);
6223 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6224 if (cur->value && *cur->value) {
6225 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6226 || STRCASEEQ('x','X',"x-small", cur->value)
6227 || STRCASEEQ('s','S',"small", cur->value)
6228 || STRCASEEQ('m','M',"medium", cur->value)
6229 || STRCASEEQ('l','L',"large", cur->value)
6230 || STRCASEEQ('x','X',"x-large", cur->value)
6231 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6232 attr_size = apr_pstrdup(doc->pool, cur->value);
6236 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6237 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6238 attr_blink = apr_pstrdup(doc->pool, cur->value);
6241 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6242 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6243 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6246 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6247 if (cur->value && *cur->value) {
6248 if ( STRCASEEQ('l','L',"ltr",cur->value)
6249 || STRCASEEQ('r','R',"rtl",cur->value)) {
6250 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6254 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6255 if (cur->value && *cur->value) {
6256 if ( STRCASEEQ('s','S',"scroll",cur->value)
6257 || STRCASEEQ('s','S',"slide",cur->value)
6258 || STRCASEEQ('a','A',"alternate",cur->value)) {
6259 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6263 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6264 if (cur->value && *cur->value) {
6265 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6266 attr_marquee_loop = "infinite";
6269 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6273 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6274 if (STRCASEEQ('l','L',"left", cur->value)) {
6275 attr_align = apr_pstrdup(doc->pool, "left");
6277 else if (STRCASEEQ('c','C',"center",cur->value)) {
6278 attr_align = apr_pstrdup(doc->pool, "center");
6280 else if (STRCASEEQ('r','R',"right",cur->value)) {
6281 attr_align = apr_pstrdup(doc->pool, "right");
6284 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6285 if (cur->value && *cur->value) {
6286 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6293 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6296 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6312 W_L("text-decoration:");
6317 W_L("display:-wap-marquee;");
6318 if (attr_marquee_dir) {
6319 W_L("-wap-marquee-dir:");
6320 W_V(attr_marquee_dir);
6323 if (attr_marquee_style) {
6324 W_L("-wap-marquee-style:");
6325 W_V(attr_marquee_style);
6328 if (attr_marquee_loop) {
6329 W_L("-wap-marquee-loop:");
6330 W_V(attr_marquee_loop);
6335 W_L("background-color:");
6347 * It is a handler who processes the SPAN tag.
6349 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6350 * destination is specified.
6351 * @param node [i] The SPAN tag node is specified.
6352 * @return The conversion result is returned.
6355 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6357 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6358 Doc *doc = jxhtml->doc;
6361 if (IS_CSS_ON(jxhtml->entryp)) {
6362 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6369 * It is a handler who processes the STYLE tag.
6371 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6372 * destination is specified.
6373 * @param node [i] The STYLE tag node is specified.
6374 * @return The conversion result is returned.
6377 s_jxhtml_style_tag(void *pdoc, Node *node)
6384 jxhtml = GET_JXHTML(pdoc);
6387 if (! IS_CSS_ON(jxhtml->entryp)) {
6391 for (attr = qs_get_attr(doc,node);
6393 attr = qs_get_next_attr(doc,attr)) {
6394 char *name = qs_get_attr_name(doc,attr);
6395 char *value = qs_get_attr_value(doc,attr);
6396 if (STRCASEEQ('t','T',"type", name)) {
6397 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6403 Node *child = qs_get_child_node(doc, node);
6404 if (type && child) {
6405 char *name = qs_get_node_name(doc, child);
6406 if (STRCASEEQ('t','T',"text", name)) {
6407 char *value = qs_get_node_value(doc, child);
6408 DBG(doc->r, "start load CSS. buf:[%s]", value);
6409 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6410 DBG(doc->r, "end load CSS. value:[%s]", value);
6416 * It is a handler who processes the OBJECT tag.
6418 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6419 * destination is specified.
6420 * @param node [i] The OBJECT tag node is specified.
6421 * @return The conversion result is returned.
6424 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6426 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6427 Doc *doc = jxhtml->doc;
6430 char *attr_id = NULL;
6431 char *attr_width = NULL;
6432 char *attr_height = NULL;
6433 char *attr_data = NULL;
6434 char *attr_type = NULL;
6435 char *attr_declare = NULL;
6436 char *attr_classid = NULL;
6437 char *attr_codebase = NULL;
6439 /*--------------------------------------------------------------------------*/
6440 /* Get Attributes */
6441 /*--------------------------------------------------------------------------*/
6442 for (attr = qs_get_attr(doc,node);
6444 attr = qs_get_next_attr(doc,attr)) {
6445 char *name = qs_get_attr_name(doc,attr);
6446 char *value = qs_get_attr_value(doc,attr);
6447 if (STRCASEEQ('i','I',"id",name)) {
6448 attr_id = apr_pstrdup(doc->pool, value);
6450 else if (STRCASEEQ('w','W',"width",name)) {
6451 attr_width = apr_pstrdup(doc->pool, value);
6453 else if (STRCASEEQ('h','H',"height",name)) {
6454 attr_height = apr_pstrdup(doc->pool, value);
6456 else if (STRCASEEQ('d','D',"data",name)) {
6457 attr_data = apr_pstrdup(doc->pool, value);
6459 else if (STRCASEEQ('t','T',"type",name)) {
6460 attr_type = apr_pstrdup(doc->pool, value);
6462 else if (STRCASEEQ('d','D',"declare",name)) {
6463 attr_declare = apr_pstrdup(doc->pool, value);
6465 else if (STRCASEEQ('c','C',"classid",name)) {
6466 attr_classid = apr_pstrdup(doc->pool, value);
6468 else if (STRCASEEQ('c','C',"codebase",name)) {
6469 attr_codebase = apr_pstrdup(doc->pool, value);
6501 W_L(" declare=\"declare\"");
6509 W_L(" codebase=\"");
6518 * It is a handler who processes the OBJECT tag.
6520 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6521 * destination is specified.
6522 * @param node [i] The OBJECT tag node is specified.
6523 * @return The conversion result is returned.
6526 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6528 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6529 Doc *doc = jxhtml->doc;
6535 * It is a handler who processes the OBJECT tag.
6537 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6538 * destination is specified.
6539 * @param node [i] The OBJECT tag node is specified.
6540 * @return The conversion result is returned.
6543 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6545 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6546 Doc *doc = jxhtml->doc;
6549 char *attr_style = NULL;
6550 char *attr_name = NULL;
6551 char *attr_value = NULL;
6553 /*--------------------------------------------------------------------------*/
6554 /* Get Attributes */
6555 /*--------------------------------------------------------------------------*/
6556 for (attr = qs_get_attr(doc,node);
6558 attr = qs_get_next_attr(doc,attr)) {
6559 char *name = qs_get_attr_name(doc,attr);
6560 char *value = qs_get_attr_value(doc,attr);
6561 if (STRCASEEQ('n','N',"name",name)) {
6562 attr_name = apr_pstrdup(doc->pool, value);
6564 else if (STRCASEEQ('v','V',"value",name)) {
6565 attr_value = apr_pstrdup(doc->pool, value);