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_tr_tag (void *pdoc, Node *node);
66 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
71 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
72 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
73 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
76 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
77 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
116 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
117 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
121 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
122 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
123 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
126 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
128 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
130 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
132 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
133 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
137 tag_handler jxhtml_handler[] = {
140 s_jxhtml_start_html_tag,
141 s_jxhtml_end_html_tag,
145 s_jxhtml_start_meta_tag,
146 s_jxhtml_end_meta_tag,
150 s_jxhtml_start_textarea_tag,
151 s_jxhtml_end_textarea_tag,
155 s_jxhtml_start_p_tag,
160 s_jxhtml_start_pre_tag,
161 s_jxhtml_end_pre_tag,
165 s_jxhtml_start_ul_tag,
170 s_jxhtml_start_li_tag,
175 s_jxhtml_start_ol_tag,
180 s_jxhtml_start_h1_tag,
185 s_jxhtml_start_h2_tag,
190 s_jxhtml_start_h3_tag,
195 s_jxhtml_start_h4_tag,
200 s_jxhtml_start_h5_tag,
205 s_jxhtml_start_h6_tag,
210 s_jxhtml_start_head_tag,
211 s_jxhtml_end_head_tag,
215 s_jxhtml_start_title_tag,
216 s_jxhtml_end_title_tag,
220 s_jxhtml_start_base_tag,
221 s_jxhtml_end_base_tag,
225 s_jxhtml_start_body_tag,
226 s_jxhtml_end_body_tag,
230 s_jxhtml_start_a_tag,
235 s_jxhtml_start_br_tag,
245 s_jxhtml_start_tr_tag,
260 s_jxhtml_start_font_tag,
261 s_jxhtml_end_font_tag,
265 s_jxhtml_start_form_tag,
266 s_jxhtml_end_form_tag,
270 s_jxhtml_start_input_tag,
271 s_jxhtml_end_input_tag,
275 s_jxhtml_start_center_tag,
276 s_jxhtml_end_center_tag,
280 s_jxhtml_start_hr_tag,
285 s_jxhtml_start_img_tag,
286 s_jxhtml_end_img_tag,
290 s_jxhtml_start_select_tag,
291 s_jxhtml_end_select_tag,
295 s_jxhtml_start_option_tag,
296 s_jxhtml_end_option_tag,
300 s_jxhtml_start_div_tag,
301 s_jxhtml_end_div_tag,
325 s_jxhtml_start_span_tag,
326 s_jxhtml_end_span_tag,
340 s_jxhtml_start_b_tag,
350 s_jxhtml_start_dt_tag,
365 s_jxhtml_start_blockquote_tag,
366 s_jxhtml_end_blockquote_tag,
370 s_jxhtml_start_dir_tag,
371 s_jxhtml_end_dir_tag,
375 s_jxhtml_start_dl_tag,
380 s_jxhtml_start_dd_tag,
385 s_jxhtml_start_menu_tag,
386 s_jxhtml_end_menu_tag,
390 s_jxhtml_start_plaintext_tag,
391 s_jxhtml_end_plaintext_tag,
395 s_jxhtml_start_blink_tag,
396 s_jxhtml_end_blink_tag,
400 s_jxhtml_start_marquee_tag,
401 s_jxhtml_end_marquee_tag,
410 s_jxhtml_newline_mark,
417 * converts from CHTML5.0 to JXHTML.
419 * @param r [i] Requet_rec is appointed.
420 * @param spec [i] The result of the device specification processing which
421 * was done in advance is appointed.
422 * @param src [i] The character string before the converting is appointed.
423 * @return The character string after the converting is returned.
432 chxjconvrule_entry *entryp,
443 /*--------------------------------------------------------------------------*/
445 /*--------------------------------------------------------------------------*/
447 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
449 DBG(r,"I found qrcode xml");
452 DBG(r,"not found qrcode xml");
454 /*--------------------------------------------------------------------------*/
455 /* The CHTML structure is initialized. */
456 /*--------------------------------------------------------------------------*/
457 s_init_jxhtml(&jxhtml, &doc, r, spec);
459 jxhtml.entryp = entryp;
460 jxhtml.cookie = cookie;
462 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
464 /*--------------------------------------------------------------------------*/
465 /* The character string of the input is analyzed. */
466 /*--------------------------------------------------------------------------*/
467 qs_init_malloc(&doc);
468 qs_init_root_node(&doc);
470 ss = apr_pcalloc(r->pool, srclen + 1);
472 memset(ss, 0, srclen + 1);
473 memcpy(ss, src, srclen);
475 if (IS_CSS_ON(jxhtml.entryp)) {
476 /* current property list */
477 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
480 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
483 qs_parse_string(&doc,ss,strlen(ss));
485 chxj_buffered_write_init(r->pool, &doc.buf);
486 /*--------------------------------------------------------------------------*/
487 /* It converts it from CHTML to JXHTML. */
488 /*--------------------------------------------------------------------------*/
489 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
490 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
491 dst = apr_pstrdup(r->pool, jxhtml.out);
492 chxj_buffered_write_terminate(&doc.buf);
495 qs_all_free(&doc,QX_LOGMARK);
498 return apr_pstrdup(r->pool,ss);
501 dst = apr_psprintf(r->pool, "\n");
503 *dstlen = strlen(dst);
506 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
514 * The JXHTML structure is initialized.
516 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
517 * initialized is specified.
518 * @param doc [i] The Doc structure that should be set to the initialized
519 * JXHTML structure is specified.
520 * @param r [i] To use POOL, the pointer to request_rec is specified.
521 * @param spec [i] The pointer to the device_table
524 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
526 memset(doc, 0, sizeof(Doc));
527 memset(jxhtml, 0, sizeof(jxhtml_t));
532 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
533 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
534 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
539 * Corresponding EMOJI to a current character-code is retrieved.
540 * The substitution character string is stored in the rslt pointer if agreeing.
542 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
543 * @param txt [i] The character string to want to examine whether it is
544 * EMOJI is specified.
545 * @param rslt [o] The pointer to the pointer that stores the result is
547 * @return When corresponding EMOJI exists, it returns it excluding 0.
550 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
562 if (! spec) DBG(r,"spec is NULL");
564 for (ee = jxhtml->conf->emoji;
568 unsigned char hex1byte;
569 unsigned char hex2byte;
572 DBG(r,"emoji->imode is NULL");
576 hex1byte = ee->imode->hex1byte & 0xff;
577 hex2byte = ee->imode->hex2byte & 0xff;
579 if (ee->imode->string
580 && strlen(ee->imode->string) > 0
581 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
582 if (spec == NULL || spec->emoji_type == NULL) {
583 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
584 return strlen(ee->imode->string);
591 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
592 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
593 if (spec == NULL || spec->emoji_type == NULL) {
594 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
607 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
621 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
622 memset(doc, 0, sizeof(Doc));
623 memset(jxhtml, 0, sizeof(jxhtml_t));
628 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
629 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
630 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
632 apr_pool_create(&pool, r->pool);
634 chxj_buffered_write_init(pool, &doc->buf);
636 for (ii=0; ii<len; ii++) {
640 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
647 if (is_sjis_kanji(src[ii])) {
648 two_byte[0] = src[ii+0];
649 two_byte[1] = src[ii+1];
655 one_byte[0] = src[ii+0];
660 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
662 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
668 * It is a handler who processes the HTML tag.
670 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
671 * destination is specified.
672 * @param node [i] The HTML tag node is specified.
673 * @return The conversion result is returned.
676 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
683 jxhtml = GET_JXHTML(pdoc);
686 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
688 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
690 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
693 /*--------------------------------------------------------------------------*/
695 /*--------------------------------------------------------------------------*/
696 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
698 jxhtml->start_html_flag = 1;
700 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
707 * It is a handler who processes the HTML tag.
709 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
710 * destination is specified.
711 * @param node [i] The HTML tag node is specified.
712 * @return The conversion result is returned.
715 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
717 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
718 Doc *doc = jxhtml->doc;
727 * It is a handler who processes the META tag.
729 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
730 * destination is specified.
731 * @param node [i] The META tag node is specified.
732 * @return The conversion result is returned.
735 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
741 int content_type_flag;
744 jxhtml = GET_JXHTML(pdoc);
748 content_type_flag = 0;
751 /*--------------------------------------------------------------------------*/
753 /*--------------------------------------------------------------------------*/
754 for (attr = qs_get_attr(doc,node);
756 attr = qs_get_next_attr(doc,attr)) {
757 char *name = qs_get_attr_name(doc,attr);
758 char *value = qs_get_attr_value(doc,attr);
762 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
763 /*----------------------------------------------------------------------*/
765 /*----------------------------------------------------------------------*/
766 W_L(" http-equiv=\"");
769 if (STRCASEEQ('c','C',"content-type",value)) {
770 content_type_flag = 1;
772 if (STRCASEEQ('r','R',"refresh",value)) {
780 if (strcasecmp(name, "content") == 0 && value && *value) {
781 /*----------------------------------------------------------------------*/
783 /*----------------------------------------------------------------------*/
784 if (content_type_flag) {
788 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
797 buf = apr_pstrdup(r->pool, value);
799 url = strchr(buf, ';');
801 sec = apr_pstrdup(r->pool, buf);
804 url = chxj_encoding_parameter(r, url, 1);
834 * It is a handler who processes the META tag.
836 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
837 * destination is specified.
838 * @param node [i] The META tag node is specified.
839 * @return The conversion result is returned.
842 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
844 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
851 * It is a handler who processes the HEAD tag.
853 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
854 * destination is specified.
855 * @param node [i] The HEAD tag node is specified.
856 * @return The conversion result is returned.
859 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
865 jxhtml = GET_JXHTML(pdoc);
875 * It is a handler who processes the HEAD tag.
877 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
878 * destination is specified.
879 * @param node [i] The HEAD tag node is specified.
880 * @return The conversion result is returned.
883 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
889 jxhtml = GET_JXHTML(pdoc);
899 * It is a handler who processes the TITLE tag.
901 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
902 * destination is specified.
903 * @param node [i] The TITLE tag node is specified.
904 * @return The conversion result is returned.
907 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
913 jxhtml = GET_JXHTML(pdoc);
923 * It is a handler who processes the TITLE tag.
925 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
926 * destination is specified.
927 * @param node [i] The TITLE tag node is specified.
928 * @return The conversion result is returned.
931 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
937 jxhtml = GET_JXHTML(pdoc);
947 * It is a handler who processes the BASE tag.
949 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
950 * destination is specified.
951 * @param node [i] The BASE tag node is specified.
952 * @return The conversion result is returned.
955 s_jxhtml_start_base_tag(void *pdoc, Node *node)
962 jxhtml = GET_JXHTML(pdoc);
967 /*--------------------------------------------------------------------------*/
969 /*--------------------------------------------------------------------------*/
970 for (attr = qs_get_attr(doc,node);
972 attr = qs_get_next_attr(doc,attr)) {
973 char *name = qs_get_attr_name(doc,attr);
974 char *value = qs_get_attr_value(doc,attr);
975 if (STRCASEEQ('h','H',"href",name)) {
987 * It is a handler who processes the BASE tag.
989 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
990 * destination is specified.
991 * @param node [i] The BASE tag node is specified.
992 * @return The conversion result is returned.
995 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
997 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1003 * It is a handler who processes the BODY tag.
1005 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1006 * destination is specified.
1007 * @param node [i] The BODY tag node is specified.
1008 * @return The conversion result is returned.
1011 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1017 char *attr_bgcolor = NULL;
1018 char *attr_text = NULL;
1019 char *attr_link = NULL;
1020 char *attr_style = NULL;
1022 jxhtml = GET_JXHTML(pdoc);
1026 /*--------------------------------------------------------------------------*/
1027 /* Get Attributes */
1028 /*--------------------------------------------------------------------------*/
1029 for (attr = qs_get_attr(doc,node);
1031 attr = qs_get_next_attr(doc,attr)) {
1032 char *name = qs_get_attr_name(doc,attr);
1033 char *value = qs_get_attr_value(doc,attr);
1034 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1035 /*----------------------------------------------------------------------*/
1037 /*----------------------------------------------------------------------*/
1038 attr_bgcolor = value;
1040 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1041 /*----------------------------------------------------------------------*/
1043 /*----------------------------------------------------------------------*/
1046 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1047 /*----------------------------------------------------------------------*/
1049 /*----------------------------------------------------------------------*/
1052 else if (STRCASEEQ('a','A',"alink",name)) {
1053 /*----------------------------------------------------------------------*/
1055 /*----------------------------------------------------------------------*/
1058 else if (STRCASEEQ('v','V',"vlink",name)) {
1059 /*----------------------------------------------------------------------*/
1061 /*----------------------------------------------------------------------*/
1064 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1069 if (IS_CSS_ON(jxhtml->entryp)) {
1070 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1072 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1073 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1074 css_property_t *cur;
1075 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1076 if (cur->value && *cur->value) {
1077 attr_text = apr_pstrdup(doc->pool, cur->value);
1080 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1081 if (cur->value && *cur->value) {
1082 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1086 if (jxhtml->style) {
1087 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1088 css_selector_t *cur_sel;
1089 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1090 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1091 css_property_t *cur;
1092 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1093 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1094 attr_link = apr_pstrdup(doc->pool, cur->value);
1104 if (attr_bgcolor || attr_text) {
1107 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1108 W_L("background-color:");
1113 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1121 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1132 * It is a handler who processes the BODY tag.
1134 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1135 * destination is specified.
1136 * @param node [i] The BODY tag node is specified.
1137 * @return The conversion result is returned.
1140 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1146 jxhtml = GET_JXHTML(pdoc);
1150 W_L("</div></body>");
1151 if (IS_CSS_ON(jxhtml->entryp)) {
1152 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1159 * It is a handler who processes the A tag.
1161 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1162 * destination is specified.
1163 * @param node [i] The A tag node is specified.
1164 * @return The conversion result is returned.
1167 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1173 char *attr_style = NULL;
1175 jxhtml = GET_JXHTML(pdoc);
1180 /*--------------------------------------------------------------------------*/
1181 /* Get Attributes */
1182 /*--------------------------------------------------------------------------*/
1183 for (attr = qs_get_attr(doc,node);
1185 attr = qs_get_next_attr(doc,attr)) {
1186 char *name = qs_get_attr_name(doc,attr);
1187 char *value = qs_get_attr_value(doc,attr);
1188 if (STRCASEEQ('n','N',"name",name)) {
1189 /*----------------------------------------------------------------------*/
1191 /*----------------------------------------------------------------------*/
1193 W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1196 else if (STRCASEEQ('h','H',"href",name)) {
1197 /*----------------------------------------------------------------------*/
1199 /*----------------------------------------------------------------------*/
1200 value = chxj_encoding_parameter(r, value, 1);
1201 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1202 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1208 else if (STRCASEEQ('a','A',"accesskey",name)) {
1209 /*----------------------------------------------------------------------*/
1211 /*----------------------------------------------------------------------*/
1212 W_L(" accesskey=\"");
1216 else if (STRCASEEQ('c','C',"cti",name)) {
1217 /*----------------------------------------------------------------------*/
1219 /*----------------------------------------------------------------------*/
1224 else if (STRCASEEQ('i','I',"ijam",name)) {
1225 /*----------------------------------------------------------------------*/
1227 /*----------------------------------------------------------------------*/
1230 else if (STRCASEEQ('u','U',"utn",name)) {
1231 /*----------------------------------------------------------------------*/
1233 /* It is special only for CHTML. */
1234 /*----------------------------------------------------------------------*/
1237 else if (STRCASEEQ('t','T',"telbook",name)) {
1238 /*----------------------------------------------------------------------*/
1240 /*----------------------------------------------------------------------*/
1243 else if (STRCASEEQ('k','K',"kana",name)) {
1244 /*----------------------------------------------------------------------*/
1246 /*----------------------------------------------------------------------*/
1249 else if (STRCASEEQ('e','E',"email",name)) {
1250 /*----------------------------------------------------------------------*/
1252 /*----------------------------------------------------------------------*/
1255 else if (STRCASEEQ('i','I',"ista",name)) {
1256 /*----------------------------------------------------------------------*/
1258 /*----------------------------------------------------------------------*/
1261 else if (STRCASEEQ('i','I',"ilet",name)) {
1262 /*----------------------------------------------------------------------*/
1264 /*----------------------------------------------------------------------*/
1267 else if (STRCASEEQ('i','I',"iswf",name)) {
1268 /*----------------------------------------------------------------------*/
1270 /*----------------------------------------------------------------------*/
1273 else if (STRCASEEQ('i','I',"irst",name)) {
1274 /*----------------------------------------------------------------------*/
1276 /*----------------------------------------------------------------------*/
1279 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1280 /*----------------------------------------------------------------------*/
1282 /*----------------------------------------------------------------------*/
1288 if (IS_CSS_ON(jxhtml->entryp)) {
1289 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1297 * It is a handler who processes the A tag.
1299 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1300 * destination is specified.
1301 * @param node [i] The A tag node is specified.
1302 * @return The conversion result is returned.
1305 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1311 jxhtml = GET_JXHTML(pdoc);
1317 if (IS_CSS_ON(jxhtml->entryp)) {
1318 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1326 * It is a handler who processes the BR tag.
1328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1329 * destination is specified.
1330 * @param node [i] The BR tag node is specified.
1331 * @return The conversion result is returned.
1334 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1341 jxhtml = GET_JXHTML(pdoc);
1346 /*--------------------------------------------------------------------------*/
1347 /* Get Attributes */
1348 /*--------------------------------------------------------------------------*/
1349 for (attr = qs_get_attr(doc,node);
1351 attr = qs_get_next_attr(doc,attr)) {
1352 char *name = qs_get_attr_name(doc,attr);
1353 char *value = qs_get_attr_value(doc,attr);
1354 if (STRCASEEQ('c','C',"clear",name)) {
1355 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1368 * It is a handler who processes the BR tag.
1370 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1371 * destination is specified.
1372 * @param node [i] The BR tag node is specified.
1373 * @return The conversion result is returned.
1376 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1378 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1384 * It is a handler who processes the TR tag.
1386 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1387 * destination is specified.
1388 * @param node [i] The TR tag node is specified.
1389 * @return The conversion result is returned.
1392 s_jxhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1398 jxhtml = GET_JXHTML(pdoc);
1408 * It is a handler who processes the TR tag.
1410 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1411 * destination is specified.
1412 * @param node [i] The TR tag node is specified.
1413 * @return The conversion result is returned.
1416 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1418 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1424 * It is a handler who processes the FONT tag.
1426 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1427 * destination is specified.
1428 * @param node [i] The FONT tag node is specified.
1429 * @return The conversion result is returned.
1432 s_jxhtml_start_font_tag(void *pdoc, Node *node)
1438 char *attr_color = NULL;
1439 char *attr_size = NULL;
1440 char *attr_style = NULL;
1442 jxhtml = GET_JXHTML(pdoc);
1446 /*--------------------------------------------------------------------------*/
1447 /* Get Attributes */
1448 /*--------------------------------------------------------------------------*/
1449 for (attr = qs_get_attr(doc,node);
1451 attr = qs_get_next_attr(doc,attr)) {
1452 char *name = qs_get_attr_name(doc,attr);
1453 char *value = qs_get_attr_value(doc,attr);
1454 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1455 attr_color = apr_pstrdup(doc->buf.pool, value);
1457 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1458 /*----------------------------------------------------------------------*/
1460 /*----------------------------------------------------------------------*/
1461 attr_size = apr_pstrdup(doc->buf.pool, value);
1463 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1464 attr_style = apr_pstrdup(doc->buf.pool, value);
1467 if (IS_CSS_ON(jxhtml->entryp)) {
1468 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1470 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1471 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1472 css_property_t *cur;
1473 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1474 if (cur->value && *cur->value) {
1475 attr_color = apr_pstrdup(doc->pool, cur->value);
1478 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1479 if (cur->value && *cur->value) {
1480 attr_size = apr_pstrdup(doc->pool, cur->value);
1481 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1482 attr_size = apr_pstrdup(doc->pool, "1");
1484 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1485 attr_size = apr_pstrdup(doc->pool, "2");
1487 else if (STRCASEEQ('s','S',"small",attr_size)) {
1488 attr_size = apr_pstrdup(doc->pool, "3");
1490 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1491 attr_size = apr_pstrdup(doc->pool, "4");
1493 else if (STRCASEEQ('l','L',"large",attr_size)) {
1494 attr_size = apr_pstrdup(doc->pool, "5");
1496 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1497 attr_size = apr_pstrdup(doc->pool, "6");
1499 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1500 attr_size = apr_pstrdup(doc->pool, "7");
1506 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1507 memset(flg, 0, sizeof(*flg));
1509 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1510 W_L("<font color=\"");
1513 flg->font_color_flag = 1;
1516 flg->font_size_flag = 1;
1517 switch(*attr_size) {
1518 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1519 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1520 case '3': W_L("<span style=\"font-size: small\">"); break;
1521 case '4': W_L("<span style=\"font-size: medium\">"); break;
1522 case '5': W_L("<span style=\"font-size: large\">"); break;
1523 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1524 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1526 if (*(attr_size + 1) == '1') {
1527 W_L("<span style=\"font-size: small\">");
1530 if (*(attr_size + 1) == '2') {
1531 W_L("<span style=\"font-size: x-small\">");
1534 if (*(attr_size + 1) == '3') {
1535 W_L("<span style=\"font-size: xx-small\">");
1538 flg->font_size_flag = 0;
1542 if (*(attr_size + 1) == '1') {
1543 W_L("<span style=\"font-size: large\">");
1546 if (*(attr_size + 1) == '2') {
1547 W_L("<span style=\"font-size: x-large\">");
1550 if (*(attr_size + 1) == '3') {
1551 W_L("<span style=\"font-size: xx-large\">");
1554 flg->font_size_flag = 0;
1558 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1559 flg->font_size_flag = 0;
1562 node->userData = flg;
1568 * It is a handler who processes the FONT tag.
1570 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1571 * destination is specified.
1572 * @param node [i] The FONT tag node is specified.
1573 * @return The conversion result is returned.
1576 s_jxhtml_end_font_tag(void *pdoc, Node *node)
1582 jxhtml = GET_JXHTML(pdoc);
1586 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
1587 if (flg && flg->font_size_flag) {
1590 if (flg && flg->font_color_flag) {
1593 if (IS_CSS_ON(jxhtml->entryp)) {
1594 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1602 * It is a handler who processes the FORM tag.
1604 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1605 * destination is specified.
1606 * @param node [i] The FORM tag node is specified.
1607 * @return The conversion result is returned.
1610 s_jxhtml_start_form_tag(void *pdoc, Node *node)
1616 char *attr_action = NULL;
1617 char *attr_method = NULL;
1618 char *attr_style = NULL;
1619 char *attr_color = NULL;
1620 char *attr_align = NULL;
1621 char *attr_name = NULL;
1622 char *new_hidden_tag = NULL;
1624 jxhtml = GET_JXHTML(pdoc);
1628 /*--------------------------------------------------------------------------*/
1629 /* Get Attributes */
1630 /*--------------------------------------------------------------------------*/
1631 for (attr = qs_get_attr(doc,node);
1633 attr = qs_get_next_attr(doc,attr)) {
1634 char *name = qs_get_attr_name(doc,attr);
1635 char *value = qs_get_attr_value(doc,attr);
1639 if (strcasecmp(name, "action") == 0) {
1640 /*--------------------------------------------------------------------*/
1642 /*--------------------------------------------------------------------*/
1643 attr_action = value;
1649 if (strcasecmp(name, "method") == 0) {
1650 /*--------------------------------------------------------------------*/
1652 /*--------------------------------------------------------------------*/
1653 attr_method = value;
1659 if (strcasecmp(name, "name") == 0) {
1660 /*--------------------------------------------------------------------*/
1662 /*--------------------------------------------------------------------*/
1669 if (strcasecmp(name, "style") == 0) {
1678 if (IS_CSS_ON(jxhtml->entryp)) {
1679 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1681 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1682 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1683 css_property_t *cur;
1684 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1685 if (STRCASEEQ('l','L',"left", cur->value)) {
1686 attr_align = apr_pstrdup(doc->pool, "left");
1688 else if (STRCASEEQ('c','C',"center",cur->value)) {
1689 attr_align = apr_pstrdup(doc->pool, "center");
1691 else if (STRCASEEQ('r','R',"right",cur->value)) {
1692 attr_align = apr_pstrdup(doc->pool, "right");
1695 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1696 attr_color = apr_pstrdup(doc->pool, cur->value);
1701 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1705 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1706 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
1708 char *old_qs = NULL;
1709 q = strchr(attr_action, '?');
1711 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);
1712 if (new_hidden_tag || old_qs) {
1736 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
1737 memset(flg, 0, sizeof(*flg));
1739 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1740 W_L("<font color=\"");
1743 flg->with_font_flag = 1;
1746 W_L("<div align=\"");
1749 flg->with_div_flag = 1;
1751 node->userData = flg;
1752 if (new_hidden_tag) {
1753 W_V(new_hidden_tag);
1760 * It is a handler who processes the FORM tag.
1762 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1763 * destination is specified.
1764 * @param node [i] The FORM tag node is specified.
1765 * @return The conversion result is returned.
1768 s_jxhtml_end_form_tag(void *pdoc, Node *node)
1770 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1771 Doc *doc = jxhtml->doc;
1773 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
1774 if (flg && flg->with_div_flag) {
1777 if (flg && flg->with_font_flag) {
1781 if (IS_CSS_ON(jxhtml->entryp)) {
1782 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1790 * It is a handler who processes the INPUT tag.
1792 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1793 * destination is specified.
1794 * @param node [i] The INPUT tag node is specified.
1795 * @return The conversion result is returned.
1798 s_jxhtml_start_input_tag(void *pdoc, Node *node)
1804 char *attr_accesskey = NULL;
1805 char *attr_max_length = NULL;
1806 char *attr_type = NULL;
1807 char *attr_name = NULL;
1808 char *attr_value = NULL;
1809 char *attr_istyle = NULL;
1810 char *attr_size = NULL;
1811 char *attr_checked = NULL;
1812 char *attr_style = NULL;
1814 jxhtml = GET_JXHTML(pdoc);
1818 /*--------------------------------------------------------------------------*/
1819 /* Get Attributes */
1820 /*--------------------------------------------------------------------------*/
1821 for (attr = qs_get_attr(doc,node);
1823 attr = qs_get_next_attr(doc,attr)) {
1824 char *name = qs_get_attr_name(doc,attr);
1825 char *value = qs_get_attr_value(doc,attr);
1826 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1827 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1828 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1829 STRCASEEQ('p','P',"password",tmp_type) ||
1830 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1831 STRCASEEQ('r','R',"radio", tmp_type) ||
1832 STRCASEEQ('h','H',"hidden", tmp_type) ||
1833 STRCASEEQ('s','S',"submit", tmp_type) ||
1834 STRCASEEQ('r','R',"reset", tmp_type))) {
1835 attr_type = tmp_type;
1838 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1841 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1844 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1845 attr_istyle = value;
1847 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1848 attr_max_length = value;
1850 else if (STRCASEEQ('c','C',"checked", name)) {
1851 attr_checked = value;
1853 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1854 attr_accesskey = value;
1856 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1859 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1864 if (IS_CSS_ON(jxhtml->entryp)) {
1865 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1867 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1868 css_property_t *cur;
1869 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1870 if (strcasestr(cur->value, "<ja:n>")) {
1873 else if (strcasestr(cur->value, "<ja:en>")) {
1876 else if (strcasestr(cur->value, "<ja:hk>")) {
1879 else if (strcasestr(cur->value, "<ja:h>")) {
1899 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
1904 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1907 if (attr_accesskey) {
1908 W_L(" accesskey=\"");
1909 W_V(attr_accesskey);
1912 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1913 /*------------------------------------------------------------------------*/
1915 /*------------------------------------------------------------------------*/
1916 if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jxhtml->entryp->pc_flag ) {
1917 char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
1918 W_L(" style=\"-wap-input-format:"*");
1923 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
1925 W_L("-wap-input-format:"*");
1931 else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1932 char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
1933 W_L(" style=\"-wap-input-format:"*");
1937 /*--------------------------------------------------------------------------*/
1938 /* The figure is default for the password. */
1939 /*--------------------------------------------------------------------------*/
1940 if (attr_max_length && *attr_max_length) {
1941 if (chxj_chk_numeric(attr_max_length) == 0) {
1942 W_L(" maxlength=\"");
1943 W_V(attr_max_length);
1948 W_L(" checked=\"checked\"");
1964 jxhtml = GET_JXHTML(pdoc);
1977 /*--------------------------------------------------------------------------*/
1978 /* Get Attributes */
1979 /*--------------------------------------------------------------------------*/
1980 type = qs_get_type_attr(doc, node, doc->buf.pool);
1981 name = qs_get_name_attr(doc, node, doc->buf.pool);
1982 value = qs_get_value_attr(doc,node, doc->buf.pool);
1983 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1984 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1985 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
1986 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1987 size = qs_get_size_attr(doc, node, doc->buf.pool);
1990 if (type && (STRCASEEQ('t','T',"text", type) ||
1991 STRCASEEQ('p','P',"password",type) ||
1992 STRCASEEQ('c','C',"checkbox",type) ||
1993 STRCASEEQ('r','R',"radio", type) ||
1994 STRCASEEQ('h','H',"hidden", type) ||
1995 STRCASEEQ('s','S',"submit", type) ||
1996 STRCASEEQ('r','R',"reset", type))) {
2002 if (size && *size) {
2007 if (name && *name) {
2009 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2012 if (value && *value) {
2013 if (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type)) {
2014 apr_size_t value_len = strlen(value);
2015 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2019 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2022 if (accesskey && *accesskey) {
2023 W_L(" accesskey=\"");
2027 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2028 /*------------------------------------------------------------------------*/
2030 /*------------------------------------------------------------------------*/
2031 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2032 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2035 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2037 W_L("-wap-input-format:'*");
2043 else if (type && STRCASEEQ('p','P',"password",type)) {
2044 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2046 /*--------------------------------------------------------------------------*/
2047 /* The figure is default for the password. */
2048 /*--------------------------------------------------------------------------*/
2049 if (max_length && *max_length) {
2050 if (chxj_chk_numeric(max_length) == 0) {
2051 W_L(" maxlength=\"");
2058 W_L(" checked=\"checked\"");
2067 * It is a handler who processes the INPUT tag.
2069 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2070 * destination is specified.
2071 * @param node [i] The INPUT tag node is specified.
2072 * @return The conversion result is returned.
2075 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2077 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2083 * It is a handler who processes the CENTER tag.
2085 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2086 * destination is specified.
2087 * @param node [i] The CENTER tag node is specified.
2088 * @return The conversion result is returned.
2091 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2096 char *attr_style = NULL;
2097 char *attr_color = NULL;
2098 char *attr_size = NULL;
2100 jxhtml = GET_JXHTML(pdoc);
2103 for (attr = qs_get_attr(doc,node);
2105 attr = qs_get_next_attr(doc,attr)) {
2106 char *name = qs_get_attr_name(doc,attr);
2107 char *value = qs_get_attr_value(doc,attr);
2108 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2112 if (IS_CSS_ON(jxhtml->entryp)) {
2113 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2115 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2116 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2117 css_property_t *cur;
2118 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2119 if (cur->value && *cur->value) {
2120 attr_color = apr_pstrdup(doc->pool, cur->value);
2123 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2124 if (cur->value && *cur->value) {
2125 attr_size = apr_pstrdup(doc->pool, cur->value);
2132 if (attr_size || attr_color) {
2140 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2154 * It is a handler who processes the CENTER tag.
2156 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2157 * destination is specified.
2158 * @param node [i] The CENTER tag node is specified.
2159 * @return The conversion result is returned.
2162 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2168 jxhtml = GET_JXHTML(pdoc);
2173 if (IS_CSS_ON(jxhtml->entryp)) {
2174 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2181 * It is a handler who processes the li tag.
2183 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2184 * destination is specified.
2185 * @param node [i] The li tag node is specified.
2186 * @return The conversion result is returned.
2189 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2195 char *attr_type = NULL;
2196 char *attr_value = NULL;
2197 char *attr_style = NULL;
2199 jxhtml = GET_JXHTML(pdoc);
2203 for (attr = qs_get_attr(doc,node);
2205 attr = qs_get_next_attr(doc,attr)) {
2206 char *name = qs_get_attr_name(doc,attr);
2207 char *value = qs_get_attr_value(doc,attr);
2208 if (STRCASEEQ('t','T',"type",name)) {
2209 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2210 if (*value == '1') {
2211 attr_type = apr_pstrdup(doc->pool, "decimal");
2213 else if (*value == 'a') {
2214 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2216 else if (*value == 'A') {
2217 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2224 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2227 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2231 if (IS_CSS_ON(jxhtml->entryp)) {
2232 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2234 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2235 css_property_t *cur;
2236 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2237 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2238 attr_type = apr_pstrdup(doc->pool, "decimal");
2240 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2241 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2243 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2244 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2246 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2247 attr_type = apr_pstrdup(doc->pool, "disc");
2249 else if (STRCASEEQ('s','S',"square", cur->value)) {
2250 attr_type = apr_pstrdup(doc->pool, "square");
2252 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2253 attr_type = apr_pstrdup(doc->pool, "circle");
2263 W_L("list-style-type:");
2279 * It is a handler who processes the li tag.
2281 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2282 * destination is specified.
2283 * @param node [i] The li tag node is specified.
2284 * @return The conversion result is returned.
2287 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2293 jxhtml = GET_JXHTML(pdoc);
2297 if (IS_CSS_ON(jxhtml->entryp)) {
2298 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2306 * It is a handler who processes the OL tag.
2308 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2309 * destination is specified.
2310 * @param node [i] The OL tag node is specified.
2311 * @return The conversion result is returned.
2314 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2320 char *attr_style = NULL;
2321 char *attr_start = NULL;
2322 char *attr_type = NULL;
2324 jxhtml = GET_JXHTML(pdoc);
2328 /*--------------------------------------------------------------------------*/
2329 /* Get Attributes */
2330 /*--------------------------------------------------------------------------*/
2331 for (attr = qs_get_attr(doc,node);
2333 attr = qs_get_next_attr(doc,attr)) {
2334 char *name = qs_get_attr_name(doc,attr);
2335 char *value = qs_get_attr_value(doc,attr);
2336 if (STRCASEEQ('t','T',"type",name) && value) {
2337 if (*value == '1') {
2338 attr_type = apr_pstrdup(doc->pool, "decimal");
2340 else if (*value == 'a') {
2341 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2343 else if (*value == 'A') {
2344 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2347 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2350 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2354 if (IS_CSS_ON(jxhtml->entryp)) {
2355 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2357 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2358 css_property_t *cur;
2359 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2360 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2361 attr_type = apr_pstrdup(doc->pool, "decimal");
2363 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2364 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2366 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2367 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2375 W_L("list-style-type:");
2392 * It is a handler who processes the OL tag.
2394 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2395 * destination is specified.
2396 * @param node [i] The OL tag node is specified.
2397 * @return The conversion result is returned.
2400 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2406 jxhtml = GET_JXHTML(pdoc);
2411 if (IS_CSS_ON(jxhtml->entryp)) {
2412 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2419 * It is a handler who processes the P tag.
2421 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2422 * destination is specified.
2423 * @param node [i] The P tag node is specified.
2424 * @return The conversion result is returned.
2427 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2433 char *attr_align = NULL;
2434 char *attr_style = NULL;
2435 char *attr_color = NULL;
2436 char *attr_blink = NULL;
2438 jxhtml = GET_JXHTML(pdoc);
2442 for (attr = qs_get_attr(doc,node);
2444 attr = qs_get_next_attr(doc,attr)) {
2445 char *nm = qs_get_attr_name(doc,attr);
2446 char *val = qs_get_attr_value(doc,attr);
2447 if (STRCASEEQ('a','A',"align", nm)) {
2448 /*----------------------------------------------------------------------*/
2449 /* CHTML 1.0 (W3C version 3.2) */
2450 /*----------------------------------------------------------------------*/
2451 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2452 attr_align = apr_pstrdup(doc->buf.pool, val);
2456 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2457 attr_style = apr_pstrdup(doc->buf.pool, val);
2460 if (IS_CSS_ON(jxhtml->entryp)) {
2461 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2463 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2464 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2465 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2466 css_property_t *cur;
2467 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2468 if (STRCASEEQ('l','L',"left",cur->value)) {
2469 attr_align = apr_pstrdup(doc->pool, "left");
2471 else if (STRCASEEQ('c','C',"center",cur->value)) {
2472 attr_align = apr_pstrdup(doc->pool, "center");
2474 else if (STRCASEEQ('r','R',"right",cur->value)) {
2475 attr_align = apr_pstrdup(doc->pool, "right");
2478 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2479 if (cur->value && *cur->value) {
2480 attr_color = apr_pstrdup(doc->pool, cur->value);
2483 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2484 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2485 attr_blink = apr_pstrdup(doc->pool, cur->value);
2491 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2499 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2505 W_L("text-decoration:");
2517 * It is a handler who processes the P tag.
2519 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2520 * destination is specified.
2521 * @param node [i] The P tag node is specified.
2522 * @return The conversion result is returned.
2525 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2527 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2528 Doc *doc = jxhtml->doc;
2531 if (IS_CSS_ON(jxhtml->entryp)) {
2532 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2539 * It is a handler who processes the PRE tag.
2541 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2542 * destination is specified.
2543 * @param node [i] The PRE tag node is specified.
2544 * @return The conversion result is returned.
2547 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
2549 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2550 Doc *doc = jxhtml->doc;
2552 char *attr_style = NULL;
2554 for (attr = qs_get_attr(doc,node);
2556 attr = qs_get_next_attr(doc,attr)) {
2557 char *nm = qs_get_attr_name(doc,attr);
2558 char *val = qs_get_attr_value(doc,attr);
2559 if (val && STRCASEEQ('s','S',"style", nm)) {
2564 if (IS_CSS_ON(jxhtml->entryp)) {
2565 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2575 * It is a handler who processes the PRE tag.
2577 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2578 * destination is specified.
2579 * @param node [i] The PRE tag node is specified.
2580 * @return The conversion result is returned.
2583 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2585 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2586 Doc *doc = jxhtml->doc;
2590 if (IS_CSS_ON(jxhtml->entryp)) {
2591 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2599 * It is a handler who processes the UL tag.
2601 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2602 * destination is specified.
2603 * @param node [i] The UL tag node is specified.
2604 * @return The conversion result is returned.
2607 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2609 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2610 Doc *doc = jxhtml->doc;
2612 char *attr_type = NULL;
2613 char *attr_style = NULL;
2614 /*--------------------------------------------------------------------------*/
2615 /* Get Attributes */
2616 /*--------------------------------------------------------------------------*/
2617 for (attr = qs_get_attr(doc,node);
2619 attr = qs_get_next_attr(doc,attr)) {
2620 char *name = qs_get_attr_name(doc,attr);
2621 char *value = qs_get_attr_value(doc,attr);
2622 if (STRCASEEQ('t','T',"type",name)) {
2623 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2627 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2631 if (IS_CSS_ON(jxhtml->entryp)) {
2632 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2634 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2635 css_property_t *cur;
2636 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2637 if (STRCASEEQ('d','D',"disc",cur->value)) {
2638 attr_type = apr_pstrdup(doc->pool, "disc");
2640 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2641 attr_type = apr_pstrdup(doc->pool, "circle");
2643 else if (STRCASEEQ('s','S',"square",cur->value)) {
2644 attr_type = apr_pstrdup(doc->pool, "square");
2652 W_L("list-style-type:");
2663 * It is a handler who processes the UL tag.
2665 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2666 * destination is specified.
2667 * @param node [i] The UL tag node is specified.
2668 * @return The conversion result is returned.
2671 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2673 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2674 Doc *doc = jxhtml->doc;
2677 if (IS_CSS_ON(jxhtml->entryp)) {
2678 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2685 * It is a handler who processes the HR tag.
2687 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2688 * destination is specified.
2689 * @param node [i] The HR tag node is specified.
2690 * @return The conversion result is returned.
2693 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
2699 char *attr_align = NULL;
2700 char *attr_size = NULL;
2701 char *attr_width = NULL;
2702 char *attr_noshade = NULL;
2703 char *attr_style = NULL;
2704 char *attr_color = NULL;
2706 jxhtml = GET_JXHTML(pdoc);
2710 for (attr = qs_get_attr(doc,node);
2712 attr = qs_get_next_attr(doc,attr)) {
2713 char *name = qs_get_attr_name (doc,attr);
2714 char *value = qs_get_attr_value(doc,attr);
2718 if (strcasecmp(name, "align") == 0) {
2719 /*--------------------------------------------------------------------*/
2721 /*--------------------------------------------------------------------*/
2722 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2730 if (strcasecmp(name, "size") == 0) {
2731 /*--------------------------------------------------------------------*/
2733 /*--------------------------------------------------------------------*/
2734 if (value && *value) {
2738 else if (strcasecmp(name, "style") == 0) {
2739 if (value && *value) {
2747 if (strcasecmp(name, "width") == 0) {
2748 /*--------------------------------------------------------------------*/
2750 /*--------------------------------------------------------------------*/
2751 if (value && *value) {
2759 if (strcasecmp(name, "noshade") == 0) {
2760 /*--------------------------------------------------------------------*/
2762 /*--------------------------------------------------------------------*/
2763 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2769 if (strcasecmp(name, "color") == 0 && value && *value) {
2770 /*--------------------------------------------------------------------*/
2772 /*--------------------------------------------------------------------*/
2781 if (IS_CSS_ON(jxhtml->entryp)) {
2782 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2784 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2785 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2786 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2787 css_property_t *cur;
2788 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2789 if (STRCASEEQ('s','S',"solid",cur->value)) {
2790 attr_noshade = "noshade";
2793 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2794 char *tmp = apr_pstrdup(doc->pool, cur->value);
2795 char *tmpp = strstr(tmp, "px");
2797 attr_size = apr_pstrdup(doc->pool, tmp);
2800 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2801 char *tmp = apr_pstrdup(doc->pool, cur->value);
2802 char *tmpp = strstr(tmp, "px");
2804 attr_width = apr_pstrdup(doc->pool, tmp);
2807 tmpp = strstr(tmp, "%");
2809 attr_width = apr_pstrdup(doc->pool, tmp);
2821 if (attr_size || attr_width || attr_noshade) {
2826 if (!strstr(attr_size, "px")) {
2834 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2840 W_L("border-style:solid;");
2856 * It is a handler who processes the HR tag.
2858 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
2859 * destination is specified.
2860 * @param node [i] The HR tag node is specified.
2861 * @return The conversion result is returned.
2864 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2866 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2872 * It is a handler who processes the IMG tag.
2874 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2875 * destination is specified.
2876 * @param node [i] The IMG tag node is specified.
2877 * @return The conversion result is returned.
2880 s_jxhtml_start_img_tag(void *pdoc, Node *node)
2882 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2883 Doc *doc = jxhtml->doc;
2884 request_rec *r = doc->r;
2886 char *attr_src = NULL;
2887 char *attr_height = NULL;
2888 char *attr_width = NULL;
2889 char *attr_align = NULL;
2890 char *attr_alt = NULL;
2891 char *attr_style = NULL;
2892 #ifndef IMG_NOT_CONVERT_FILENAME
2893 device_table *spec = jxhtml->spec;
2896 /*--------------------------------------------------------------------------*/
2897 /* Get Attributes */
2898 /*--------------------------------------------------------------------------*/
2899 for (attr = qs_get_attr(doc,node);
2901 attr = qs_get_next_attr(doc,attr)) {
2902 char *name = qs_get_attr_name(doc,attr);
2903 char *value = qs_get_attr_value(doc,attr);
2904 if (STRCASEEQ('s','S',"src",name)) {
2905 /*----------------------------------------------------------------------*/
2907 /*----------------------------------------------------------------------*/
2908 #ifdef IMG_NOT_CONVERT_FILENAME
2909 value = chxj_encoding_parameter(r, value, 1);
2910 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
2911 value = chxj_add_cookie_no_update_parameter(r, value);
2914 value = chxj_img_conv(r, spec, value);
2915 value = chxj_encoding_parameter(r, value, 1);
2916 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
2917 value = chxj_add_cookie_no_update_parameter(r, value);
2921 else if (STRCASEEQ('a','A',"align",name)) {
2922 /*----------------------------------------------------------------------*/
2924 /*----------------------------------------------------------------------*/
2926 if (STRCASEEQ('t','T',"top", value) ||
2927 STRCASEEQ('m','M',"middle",value) ||
2928 STRCASEEQ('b','B',"bottom",value) ||
2929 STRCASEEQ('l','L',"left", value) ||
2930 STRCASEEQ('r','R',"right", value)) {
2933 else if (STRCASEEQ('c','C',"center",value)) {
2934 attr_align = apr_pstrdup(doc->pool, "middle");
2938 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2939 /*----------------------------------------------------------------------*/
2941 /*----------------------------------------------------------------------*/
2944 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2945 /*----------------------------------------------------------------------*/
2947 /*----------------------------------------------------------------------*/
2948 attr_height = value;
2950 else if (STRCASEEQ('h','H',"hspace",name)) {
2951 /*----------------------------------------------------------------------*/
2953 /*----------------------------------------------------------------------*/
2956 else if (STRCASEEQ('v','V',"vspace",name)) {
2957 /*----------------------------------------------------------------------*/
2959 /*----------------------------------------------------------------------*/
2962 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2963 /*----------------------------------------------------------------------*/
2965 /*----------------------------------------------------------------------*/
2968 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2969 /*----------------------------------------------------------------------*/
2971 /*----------------------------------------------------------------------*/
2976 if (IS_CSS_ON(jxhtml->entryp)) {
2977 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2979 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2980 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2981 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2982 css_property_t *cur;
2983 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2984 attr_height = apr_pstrdup(doc->pool, cur->value);
2986 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2987 attr_width = apr_pstrdup(doc->pool, cur->value);
2989 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2990 attr_align = apr_pstrdup(doc->pool, cur->value);
3030 * It is a handler who processes the IMG tag.
3032 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3033 * destination is specified.
3034 * @param node [i] The IMG tag node is specified.
3035 * @return The conversion result is returned.
3038 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3040 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3046 * It is a handler who processes the SELECT tag.
3048 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3049 * destination is specified.
3050 * @param node [i] The SELECT tag node is specified.
3051 * @return The conversion result is returned.
3054 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3056 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3057 Doc *doc = jxhtml->doc;
3061 char *multiple = NULL;
3062 char *attr_style = NULL;
3065 for (attr = qs_get_attr(doc,node);
3067 attr = qs_get_next_attr(doc,attr)) {
3068 char *nm = qs_get_attr_name(doc,attr);
3069 char *val = qs_get_attr_value(doc,attr);
3070 if (STRCASEEQ('s','S',"size",nm)) {
3071 /*----------------------------------------------------------------------*/
3072 /* CHTML 1.0 version 2.0 */
3073 /*----------------------------------------------------------------------*/
3074 size = apr_pstrdup(doc->buf.pool, val);
3076 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3077 /*----------------------------------------------------------------------*/
3078 /* CHTML 1.0 version 2.0 */
3079 /*----------------------------------------------------------------------*/
3080 attr_style = apr_pstrdup(doc->buf.pool, val);
3082 else if (STRCASEEQ('n','N',"name",nm)) {
3083 /*----------------------------------------------------------------------*/
3084 /* CHTML 1.0 version 2.0 */
3085 /*----------------------------------------------------------------------*/
3086 name = apr_pstrdup(doc->buf.pool, val);
3088 else if (STRCASEEQ('m','M',"multiple", nm)) {
3089 /*----------------------------------------------------------------------*/
3090 /* CHTML 1.0 version 2.0 */
3091 /*----------------------------------------------------------------------*/
3092 multiple = apr_pstrdup(doc->buf.pool, val);
3095 if (size && *size) {
3100 if (name && *name) {
3110 if (IS_CSS_ON(jxhtml->entryp)) {
3111 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3119 * It is a handler who processes the SELECT tag.
3121 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3122 * destination is specified.
3123 * @param node [i] The SELECT tag node is specified.
3124 * @return The conversion result is returned.
3127 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3129 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3130 Doc *doc = jxhtml->doc;
3133 if (IS_CSS_ON(jxhtml->entryp)) {
3134 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3141 * It is a handler who processes the OPTION tag.
3143 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3144 * destination is specified.
3145 * @param node [i] The OPTION tag node is specified.
3146 * @return The conversion result is returned.
3149 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3151 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3152 Doc *doc = jxhtml->doc;
3155 char *selected = NULL;
3157 char *attr_style = NULL;
3160 for (attr = qs_get_attr(doc,node);
3162 attr = qs_get_next_attr(doc,attr)) {
3163 char *nm = qs_get_attr_name(doc,attr);
3164 char *val = qs_get_attr_value(doc,attr);
3165 if (STRCASEEQ('s','S',"selected",nm)) {
3166 /*----------------------------------------------------------------------*/
3167 /* CHTML 1.0 version 2.0 */
3168 /*----------------------------------------------------------------------*/
3169 selected = apr_pstrdup(doc->buf.pool, val);
3171 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3172 /*----------------------------------------------------------------------*/
3173 /* CHTML 1.0 version 2.0 */
3174 /*----------------------------------------------------------------------*/
3175 attr_style = apr_pstrdup(doc->buf.pool, val);
3177 else if (STRCASEEQ('v','V',"value",nm)) {
3178 /*----------------------------------------------------------------------*/
3179 /* CHTML 1.0 version 2.0 */
3180 /*----------------------------------------------------------------------*/
3181 value = apr_pstrdup(doc->buf.pool, val);
3194 if (IS_CSS_ON(jxhtml->entryp)) {
3195 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3203 * It is a handler who processes the OPTION tag.
3205 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3206 * destination is specified.
3207 * @param node [i] The OPTION tag node is specified.
3208 * @return The conversion result is returned.
3211 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3213 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3214 Doc *doc = jxhtml->doc;
3217 if (IS_CSS_ON(jxhtml->entryp)) {
3218 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3226 * It is a handler who processes the DIV tag.
3228 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3229 * destination is specified.
3230 * @param node [i] The DIV tag node is specified.
3231 * @return The conversion result is returned.
3234 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3240 char *attr_style = NULL;
3241 char *attr_align = NULL;
3242 char *attr_display = NULL;
3243 char *attr_decoration = NULL;
3244 char *attr_wap_marquee_style = NULL;
3245 char *attr_wap_marquee_dir = NULL;
3246 char *attr_wap_marquee_loop = NULL;
3247 char *attr_color = NULL;
3248 char *attr_bgcolor = NULL;
3249 char *attr_font_size = NULL;
3251 jxhtml = GET_JXHTML(pdoc);
3255 for (attr = qs_get_attr(doc,node);
3257 attr = qs_get_next_attr(doc,attr)) {
3258 char *nm = qs_get_attr_name(doc,attr);
3259 char *val = qs_get_attr_value(doc,attr);
3260 if (STRCASEEQ('a','A',"align",nm)) {
3261 /*----------------------------------------------------------------------*/
3262 /* CHTML 1.0 (W3C version 3.2) */
3263 /*----------------------------------------------------------------------*/
3264 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3265 attr_align = apr_pstrdup(doc->buf.pool, val);
3268 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3269 attr_style = apr_pstrdup(doc->buf.pool, val);
3273 if (IS_CSS_ON(jxhtml->entryp)) {
3274 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3276 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3277 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3278 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3279 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3280 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3281 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3282 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3284 css_property_t *cur;
3285 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3286 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3287 attr_display = apr_pstrdup(doc->pool, cur->value);
3290 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3291 if (STRCASEEQ('b','B',"blink", cur->value)) {
3292 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3295 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3296 attr_color = apr_pstrdup(doc->pool, cur->value);
3298 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3299 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3300 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3302 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3303 char *ss = strchr(cur->value, '#');
3305 ss = strstr(cur->value, "rgb");
3308 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3309 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3312 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3313 attr_align = apr_pstrdup(doc->pool, cur->value);
3315 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3316 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3317 || STRCASEEQ('x','X',"x-small",cur->value)
3318 || STRCASEEQ('s','S',"small",cur->value)
3319 || STRCASEEQ('m','M',"medium",cur->value)
3320 || STRCASEEQ('l','L',"large",cur->value)
3321 || STRCASEEQ('x','X',"x-large",cur->value)
3322 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3323 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3327 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3328 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3329 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3330 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3331 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3332 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3335 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3336 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3337 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3339 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3340 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3343 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3344 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3353 || attr_wap_marquee_style
3354 || attr_wap_marquee_dir
3355 || attr_wap_marquee_loop
3358 || attr_font_size) {
3370 if (attr_decoration) {
3371 W_L("text-decoration:");
3372 W_V(attr_decoration);
3375 if (attr_wap_marquee_style) {
3376 W_L("-wap-marquee-style:");
3377 W_V(attr_wap_marquee_style);
3380 if (attr_wap_marquee_dir) {
3381 W_L("-wap-marquee-dir:");
3382 W_V(attr_wap_marquee_dir);
3385 if (attr_wap_marquee_loop) {
3386 W_L("-wap-marquee-loop:");
3387 W_V(attr_wap_marquee_loop);
3396 W_L("background-color:");
3400 if (attr_font_size) {
3402 W_V(attr_font_size);
3413 * It is a handler who processes the DIV tag.
3415 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3416 * destination is specified.
3417 * @param node [i] The DIV tag node is specified.
3418 * @return The conversion result is returned.
3421 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
3427 jxhtml = GET_JXHTML(pdoc);
3432 if (IS_CSS_ON(jxhtml->entryp)) {
3433 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3440 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
3447 jxhtml = GET_JXHTML(pdoc);
3451 for (child = qs_get_child_node(doc, node);
3453 child = qs_get_next_node(doc, child)) {
3455 s_jxhtml_chxjif_tag(jxhtml, child);
3462 * It is a handler who processes the TEXTARE tag.
3464 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3465 * destination is specified.
3466 * @param node [i] The TEXTAREA tag node is specified.
3467 * @return The conversion result is returned.
3470 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
3476 char *attr_accesskey = NULL;
3477 char *attr_name = NULL;
3478 char *attr_rows = NULL;
3479 char *attr_cols = NULL;
3480 char *attr_istyle = NULL;
3481 char *attr_style = NULL;
3484 jxhtml = GET_JXHTML(pdoc);
3488 jxhtml->textarea_flag++;
3489 for (attr = qs_get_attr(doc,node);
3491 attr = qs_get_next_attr(doc,attr)) {
3492 char *name = qs_get_attr_name(doc,attr);
3493 char *value = qs_get_attr_value(doc,attr);
3494 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3495 attr_accesskey = value;
3497 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3498 attr_istyle = value;
3500 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3503 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3506 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3509 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3513 if (IS_CSS_ON(jxhtml->entryp)) {
3514 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3516 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3517 css_property_t *cur;
3518 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3519 if (strcasestr(cur->value, "<ja:n>")) {
3522 else if (strcasestr(cur->value, "<ja:en>")) {
3525 else if (strcasestr(cur->value, "<ja:hk>")) {
3528 else if (strcasestr(cur->value, "<ja:h>")) {
3535 if (attr_accesskey) {
3536 W_L(" accesskey=\"");
3537 W_V(attr_accesskey);
3556 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
3558 W_L("-wap-input-format:"*");
3569 * It is a handler who processes the TEXTAREA tag.
3571 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3572 * destination is specified.
3573 * @param node [i] The TEXTAREA tag node is specified.
3574 * @return The conversion result is returned.
3577 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3583 jxhtml = GET_JXHTML(pdoc);
3588 jxhtml->textarea_flag--;
3595 * It is a handler who processes the B tag.
3597 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3598 * destination is specified.
3599 * @param node [i] The B tag node is specified.
3600 * @return The conversion result is returned.
3603 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3609 jxhtml = GET_JXHTML(pdoc);
3619 * It is a handler who processes the B tag.
3621 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3622 * destination is specified.
3623 * @param node [i] The B tag node is specified.
3624 * @return The conversion result is returned.
3627 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3629 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
3630 Doc* doc = jxhtml->doc;
3637 s_jxhtml_text_tag(void* pdoc, Node* child)
3648 apr_size_t z2h_input_len;
3650 jxhtml = GET_JXHTML(pdoc);
3654 textval = qs_get_node_value(doc,child);
3655 if (strlen(textval) == 0) {
3659 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3660 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3662 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3663 memset(one_byte, 0, sizeof(one_byte));
3666 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3668 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
3670 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3675 if (is_sjis_kanji(textval[ii])) {
3676 one_byte[0] = textval[ii+0];
3677 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3678 one_byte[0] = textval[ii+1];
3679 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3683 if (jxhtml->pre_flag) {
3684 one_byte[0] = textval[ii+0];
3685 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3688 if (jxhtml->textarea_flag) {
3689 one_byte[0] = textval[ii+0];
3690 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3693 if (textval[ii] != '\r' && textval[ii] != '\n') {
3694 one_byte[0] = textval[ii+0];
3695 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3699 z2h_input_len = strlen(tdst);
3700 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
3708 * It is a handler who processes the BLOCKQUOTE tag.
3710 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3711 * destination is specified.
3712 * @param node [i] The BLOCKQUOTE tag node is specified.
3713 * @return The conversion result is returned.
3716 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
3721 char *attr_style = NULL;
3722 char *attr_color = NULL;
3723 char *attr_size = NULL;
3725 jxhtml = GET_JXHTML(pdoc);
3727 for (attr = qs_get_attr(doc,node);
3729 attr = qs_get_next_attr(doc,attr)) {
3730 char *nm = qs_get_attr_name(doc,attr);
3731 char *val = qs_get_attr_value(doc,attr);
3732 if (val && STRCASEEQ('s','S',"style", nm)) {
3736 if (IS_CSS_ON(jxhtml->entryp)) {
3737 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3739 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3740 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3741 css_property_t *cur;
3742 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3743 if (cur->value && *cur->value) {
3744 attr_color = apr_pstrdup(doc->pool, cur->value);
3747 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3748 if (cur->value && *cur->value) {
3749 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3750 attr_size = apr_pstrdup(doc->pool, cur->value);
3752 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3753 attr_size = apr_pstrdup(doc->pool, cur->value);
3755 else if (STRCASEEQ('s','S',"small",cur->value)) {
3756 attr_size = apr_pstrdup(doc->pool, cur->value);
3758 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3759 attr_size = apr_pstrdup(doc->pool, cur->value);
3761 else if (STRCASEEQ('l','L',"large",cur->value)) {
3762 attr_size = apr_pstrdup(doc->pool, cur->value);
3764 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3765 attr_size = apr_pstrdup(doc->pool, cur->value);
3767 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3768 attr_size = apr_pstrdup(doc->pool, cur->value);
3775 if (attr_color || attr_size) {
3778 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3796 * It is a handler who processes the BLOCKQUOTE tag.
3798 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3799 * destination is specified.
3800 * @param node [i] The BLOCKQUOTE tag node is specified.
3801 * @return The conversion result is returned.
3804 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3806 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3807 Doc *doc = jxhtml->doc;
3808 W_L("</blockquote>");
3809 if (IS_CSS_ON(jxhtml->entryp)) {
3810 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3817 * It is a handler who processes the DIR tag.
3819 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3820 * destination is specified.
3821 * @param node [i] The DIR tag node is specified.
3822 * @return The conversion result is returned.
3825 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
3827 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3828 Doc *doc = jxhtml->doc;
3830 char *attr_style = NULL;
3831 char *attr_color = NULL;
3832 char *attr_type = NULL;
3833 char *attr_size = NULL;
3834 for (attr = qs_get_attr(doc,node);
3836 attr = qs_get_next_attr(doc,attr)) {
3837 char *name = qs_get_attr_name(doc,attr);
3838 char *value = qs_get_attr_value(doc,attr);
3839 if (STRCASEEQ('t','T',"type",name)) {
3840 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3844 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3848 if (IS_CSS_ON(jxhtml->entryp)) {
3849 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3851 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3852 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3853 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3854 css_property_t *cur;
3855 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3856 if (cur->value && *cur->value) {
3857 attr_color = apr_pstrdup(doc->pool, cur->value);
3860 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3861 if (cur->value && *cur->value) {
3862 attr_type = apr_pstrdup(doc->pool, cur->value);
3865 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3866 if (cur->value && *cur->value) {
3867 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3868 attr_size = apr_pstrdup(doc->pool, cur->value);
3870 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3871 attr_size = apr_pstrdup(doc->pool, cur->value);
3873 else if (STRCASEEQ('s','S',"small",cur->value)) {
3874 attr_size = apr_pstrdup(doc->pool, cur->value);
3876 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3877 attr_size = apr_pstrdup(doc->pool, cur->value);
3879 else if (STRCASEEQ('l','L',"large",cur->value)) {
3880 attr_size = apr_pstrdup(doc->pool, cur->value);
3882 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3883 attr_size = apr_pstrdup(doc->pool, cur->value);
3885 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3886 attr_size = apr_pstrdup(doc->pool, cur->value);
3893 if (attr_type || attr_color || attr_size) {
3896 W_L("list-style-type:");
3901 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3919 * It is a handler who processes the DIR tag.
3921 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3922 * destination is specified.
3923 * @param node [i] The DIR tag node is specified.
3924 * @return The conversion result is returned.
3927 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
3929 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3930 Doc *doc = jxhtml->doc;
3932 if (IS_CSS_ON(jxhtml->entryp)) {
3933 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3940 * It is a handler who processes the DL tag.
3942 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3943 * destination is specified.
3944 * @param node [i] The DL tag node is specified.
3945 * @return The conversion result is returned.
3948 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
3950 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3951 Doc *doc = jxhtml->doc;
3953 char *attr_style = NULL;
3954 char *attr_color = NULL;
3955 char *attr_size = NULL;
3956 for (attr = qs_get_attr(doc,node);
3958 attr = qs_get_next_attr(doc,attr)) {
3959 char *name = qs_get_attr_name(doc,attr);
3960 char *value = qs_get_attr_value(doc,attr);
3961 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3965 if (IS_CSS_ON(jxhtml->entryp)) {
3966 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3968 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3969 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3970 css_property_t *cur;
3971 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3972 if (cur->value && *cur->value) {
3973 attr_color = apr_pstrdup(doc->pool, cur->value);
3976 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3977 if (cur->value && *cur->value) {
3978 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3979 attr_size = apr_pstrdup(doc->pool, cur->value);
3981 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3982 attr_size = apr_pstrdup(doc->pool, cur->value);
3984 else if (STRCASEEQ('s','S',"small",cur->value)) {
3985 attr_size = apr_pstrdup(doc->pool, cur->value);
3987 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3988 attr_size = apr_pstrdup(doc->pool, cur->value);
3990 else if (STRCASEEQ('l','L',"large",cur->value)) {
3991 attr_size = apr_pstrdup(doc->pool, cur->value);
3993 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3994 attr_size = apr_pstrdup(doc->pool, cur->value);
3996 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3997 attr_size = apr_pstrdup(doc->pool, cur->value);
4004 if (attr_color || attr_size) {
4007 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4025 * It is a handler who processes the DL tag.
4027 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4028 * destination is specified.
4029 * @param node [i] The DL tag node is specified.
4030 * @return The conversion result is returned.
4033 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4035 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4036 Doc *doc = jxhtml->doc;
4038 if (IS_CSS_ON(jxhtml->entryp)) {
4039 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4046 * It is a handler who processes the DT tag.
4048 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4049 * destination is specified.
4050 * @param node [i] The DT tag node is specified.
4051 * @return The conversion result is returned.
4054 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4056 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4057 Doc *doc = jxhtml->doc;
4059 char *attr_style = NULL;
4060 char *attr_color = NULL;
4061 char *attr_size = NULL;
4062 for (attr = qs_get_attr(doc,node);
4064 attr = qs_get_next_attr(doc,attr)) {
4065 char *name = qs_get_attr_name(doc,attr);
4066 char *value = qs_get_attr_value(doc,attr);
4067 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4071 if (IS_CSS_ON(jxhtml->entryp)) {
4072 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4074 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4075 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4076 css_property_t *cur;
4077 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4078 if (cur->value && *cur->value) {
4079 attr_color = apr_pstrdup(doc->pool, cur->value);
4082 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4083 if (cur->value && *cur->value) {
4084 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4085 attr_size = apr_pstrdup(doc->pool, cur->value);
4087 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4088 attr_size = apr_pstrdup(doc->pool, cur->value);
4090 else if (STRCASEEQ('s','S',"small",cur->value)) {
4091 attr_size = apr_pstrdup(doc->pool, cur->value);
4093 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4094 attr_size = apr_pstrdup(doc->pool, cur->value);
4096 else if (STRCASEEQ('l','L',"large",cur->value)) {
4097 attr_size = apr_pstrdup(doc->pool, cur->value);
4099 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4100 attr_size = apr_pstrdup(doc->pool, cur->value);
4102 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4103 attr_size = apr_pstrdup(doc->pool, cur->value);
4110 if (attr_color || attr_size) {
4113 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4131 * It is a handler who processes the DT tag.
4133 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4134 * destination is specified.
4135 * @param node [i] The DT tag node is specified.
4136 * @return The conversion result is returned.
4139 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4141 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4142 Doc *doc = jxhtml->doc;
4144 if (IS_CSS_ON(jxhtml->entryp)) {
4145 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4152 * It is a handler who processes the DD tag.
4154 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4155 * destination is specified.
4156 * @param node [i] The DD tag node is specified.
4157 * @return The conversion result is returned.
4160 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4162 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4163 Doc *doc = jxhtml->doc;
4165 char *attr_style = NULL;
4166 char *attr_color = NULL;
4167 char *attr_size = NULL;
4168 for (attr = qs_get_attr(doc,node);
4170 attr = qs_get_next_attr(doc,attr)) {
4171 char *name = qs_get_attr_name(doc,attr);
4172 char *value = qs_get_attr_value(doc,attr);
4173 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4177 if (IS_CSS_ON(jxhtml->entryp)) {
4178 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4180 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4181 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4182 css_property_t *cur;
4183 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4184 if (cur->value && *cur->value) {
4185 attr_color = apr_pstrdup(doc->pool, cur->value);
4188 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4189 if (cur->value && *cur->value) {
4190 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4191 attr_size = apr_pstrdup(doc->pool, cur->value);
4193 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4194 attr_size = apr_pstrdup(doc->pool, cur->value);
4196 else if (STRCASEEQ('s','S',"small",cur->value)) {
4197 attr_size = apr_pstrdup(doc->pool, cur->value);
4199 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4200 attr_size = apr_pstrdup(doc->pool, cur->value);
4202 else if (STRCASEEQ('l','L',"large",cur->value)) {
4203 attr_size = apr_pstrdup(doc->pool, cur->value);
4205 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4206 attr_size = apr_pstrdup(doc->pool, cur->value);
4208 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4209 attr_size = apr_pstrdup(doc->pool, cur->value);
4216 if (attr_color || attr_size) {
4219 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4237 * It is a handler who processes the DD tag.
4239 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4240 * destination is specified.
4241 * @param node [i] The DD tag node is specified.
4242 * @return The conversion result is returned.
4245 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4247 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4248 Doc *doc = jxhtml->doc;
4250 if (IS_CSS_ON(jxhtml->entryp)) {
4251 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4258 * It is a handler who processes the H1 tag.
4260 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4261 * destination is specified.
4262 * @param node [i] The H1 tag node is specified.
4263 * @return The conversion result is returned.
4266 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4272 char *attr_style = NULL;
4273 char *attr_align = NULL;
4275 jxhtml = GET_JXHTML(pdoc);
4279 for (attr = qs_get_attr(doc,node);
4281 attr = qs_get_next_attr(doc,attr)) {
4282 char *name = qs_get_attr_name(doc,attr);
4283 char *value = qs_get_attr_value(doc,attr);
4284 if (STRCASEEQ('a','A',"align", name)) {
4285 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4289 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4293 if (IS_CSS_ON(jxhtml->entryp)) {
4294 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4296 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4297 css_property_t *cur;
4298 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4299 if (STRCASEEQ('l','L',"left", cur->value)) {
4300 attr_align = apr_pstrdup(doc->pool, "left");
4302 else if (STRCASEEQ('c','C',"center",cur->value)) {
4303 attr_align = apr_pstrdup(doc->pool, "center");
4305 else if (STRCASEEQ('r','R',"right",cur->value)) {
4306 attr_align = apr_pstrdup(doc->pool, "right");
4313 W_L("font-size:xx-large;");
4326 * It is a handler who processes the H1 tag.
4328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4329 * destination is specified.
4330 * @param node [i] The H1 tag node is specified.
4331 * @return The conversion result is returned.
4334 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4340 jxhtml = GET_JXHTML(pdoc);
4345 if (IS_CSS_ON(jxhtml->entryp)) {
4346 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4354 * It is a handler who processes the H2 tag.
4356 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4357 * destination is specified.
4358 * @param node [i] The H1 tag node is specified.
4359 * @return The conversion result is returned.
4362 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
4368 char *attr_style = NULL;
4369 char *attr_align = NULL;
4371 jxhtml = GET_JXHTML(pdoc);
4375 for (attr = qs_get_attr(doc,node);
4377 attr = qs_get_next_attr(doc,attr)) {
4378 char *name = qs_get_attr_name(doc,attr);
4379 char *value = qs_get_attr_value(doc,attr);
4380 if (STRCASEEQ('a','A',"align", name)) {
4381 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4385 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4389 if (IS_CSS_ON(jxhtml->entryp)) {
4390 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4392 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4393 css_property_t *cur;
4394 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4395 if (STRCASEEQ('l','L',"left", cur->value)) {
4396 attr_align = apr_pstrdup(doc->pool, "left");
4398 else if (STRCASEEQ('c','C',"center",cur->value)) {
4399 attr_align = apr_pstrdup(doc->pool, "center");
4401 else if (STRCASEEQ('r','R',"right",cur->value)) {
4402 attr_align = apr_pstrdup(doc->pool, "right");
4409 W_L("font-size:x-large;");
4422 * It is a handler who processes the H2 tag.
4424 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4425 * destination is specified.
4426 * @param node [i] The H1 tag node is specified.
4427 * @return The conversion result is returned.
4430 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
4436 jxhtml = GET_JXHTML(pdoc);
4441 if (IS_CSS_ON(jxhtml->entryp)) {
4442 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4449 * It is a handler who processes the H3 tag.
4451 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4452 * destination is specified.
4453 * @param node [i] The H1 tag node is specified.
4454 * @return The conversion result is returned.
4457 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
4463 char *attr_style = NULL;
4464 char *attr_align = NULL;
4466 jxhtml = GET_JXHTML(pdoc);
4470 for (attr = qs_get_attr(doc,node);
4472 attr = qs_get_next_attr(doc,attr)) {
4473 char *name = qs_get_attr_name(doc,attr);
4474 char *value = qs_get_attr_value(doc,attr);
4475 if (STRCASEEQ('a','A',"align", name)) {
4476 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4480 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4484 if (IS_CSS_ON(jxhtml->entryp)) {
4485 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4487 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4488 css_property_t *cur;
4489 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4490 if (STRCASEEQ('l','L',"left", cur->value)) {
4491 attr_align = apr_pstrdup(doc->pool, "left");
4493 else if (STRCASEEQ('c','C',"center",cur->value)) {
4494 attr_align = apr_pstrdup(doc->pool, "center");
4496 else if (STRCASEEQ('r','R',"right",cur->value)) {
4497 attr_align = apr_pstrdup(doc->pool, "right");
4504 W_L("font-size:large;");
4517 * It is a handler who processes the H3 tag.
4519 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4520 * destination is specified.
4521 * @param node [i] The H1 tag node is specified.
4522 * @return The conversion result is returned.
4525 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
4531 jxhtml = GET_JXHTML(pdoc);
4536 if (IS_CSS_ON(jxhtml->entryp)) {
4537 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4544 * It is a handler who processes the H4 tag.
4546 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4547 * destination is specified.
4548 * @param node [i] The H1 tag node is specified.
4549 * @return The conversion result is returned.
4552 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
4558 char *attr_style = NULL;
4559 char *attr_align = NULL;
4561 jxhtml = GET_JXHTML(pdoc);
4565 for (attr = qs_get_attr(doc,node);
4567 attr = qs_get_next_attr(doc,attr)) {
4568 char *name = qs_get_attr_name(doc,attr);
4569 char *value = qs_get_attr_value(doc,attr);
4570 if (STRCASEEQ('a','A',"align", name)) {
4571 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4575 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4579 if (IS_CSS_ON(jxhtml->entryp)) {
4580 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4582 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4583 css_property_t *cur;
4584 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4585 if (STRCASEEQ('l','L',"left", cur->value)) {
4586 attr_align = apr_pstrdup(doc->pool, "left");
4588 else if (STRCASEEQ('c','C',"center",cur->value)) {
4589 attr_align = apr_pstrdup(doc->pool, "center");
4591 else if (STRCASEEQ('r','R',"right",cur->value)) {
4592 attr_align = apr_pstrdup(doc->pool, "right");
4599 W_L("font-size:small;");
4612 * It is a handler who processes the H4 tag.
4614 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4615 * destination is specified.
4616 * @param node [i] The H1 tag node is specified.
4617 * @return The conversion result is returned.
4620 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
4626 jxhtml = GET_JXHTML(pdoc);
4631 if (IS_CSS_ON(jxhtml->entryp)) {
4632 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4640 * It is a handler who processes the H5 tag.
4642 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4643 * destination is specified.
4644 * @param node [i] The H1 tag node is specified.
4645 * @return The conversion result is returned.
4648 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
4654 char *attr_style = NULL;
4655 char *attr_align = NULL;
4657 jxhtml = GET_JXHTML(pdoc);
4661 for (attr = qs_get_attr(doc,node);
4663 attr = qs_get_next_attr(doc,attr)) {
4664 char *name = qs_get_attr_name(doc,attr);
4665 char *value = qs_get_attr_value(doc,attr);
4666 if (STRCASEEQ('a','A',"align", name)) {
4667 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4671 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4675 if (IS_CSS_ON(jxhtml->entryp)) {
4676 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4678 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4679 css_property_t *cur;
4680 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4681 if (STRCASEEQ('l','L',"left", cur->value)) {
4682 attr_align = apr_pstrdup(doc->pool, "left");
4684 else if (STRCASEEQ('c','C',"center",cur->value)) {
4685 attr_align = apr_pstrdup(doc->pool, "center");
4687 else if (STRCASEEQ('r','R',"right",cur->value)) {
4688 attr_align = apr_pstrdup(doc->pool, "right");
4695 W_L("font-size:x-small;");
4708 * It is a handler who processes the H5 tag.
4710 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4711 * destination is specified.
4712 * @param node [i] The H1 tag node is specified.
4713 * @return The conversion result is returned.
4716 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
4722 jxhtml = GET_JXHTML(pdoc);
4727 if (IS_CSS_ON(jxhtml->entryp)) {
4728 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4736 * It is a handler who processes the H6 tag.
4738 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4739 * destination is specified.
4740 * @param node [i] The H1 tag node is specified.
4741 * @return The conversion result is returned.
4744 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
4750 char *attr_style = NULL;
4751 char *attr_align = NULL;
4753 jxhtml = GET_JXHTML(pdoc);
4757 for (attr = qs_get_attr(doc,node);
4759 attr = qs_get_next_attr(doc,attr)) {
4760 char *name = qs_get_attr_name(doc,attr);
4761 char *value = qs_get_attr_value(doc,attr);
4762 if (STRCASEEQ('a','A',"align", name)) {
4763 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4767 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4771 if (IS_CSS_ON(jxhtml->entryp)) {
4772 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4774 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4775 css_property_t *cur;
4776 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4777 if (STRCASEEQ('l','L',"left", cur->value)) {
4778 attr_align = apr_pstrdup(doc->pool, "left");
4780 else if (STRCASEEQ('c','C',"center",cur->value)) {
4781 attr_align = apr_pstrdup(doc->pool, "center");
4783 else if (STRCASEEQ('r','R',"right",cur->value)) {
4784 attr_align = apr_pstrdup(doc->pool, "right");
4791 W_L("font-size:xx-small;");
4804 * It is a handler who processes the H6 tag.
4806 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4807 * destination is specified.
4808 * @param node [i] The H1 tag node is specified.
4809 * @return The conversion result is returned.
4812 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
4818 jxhtml = GET_JXHTML(pdoc);
4823 if (IS_CSS_ON(jxhtml->entryp)) {
4824 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4832 * It is a handler who processes the MENU tag.
4834 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4835 * destination is specified.
4836 * @param node [i] The MENU tag node is specified.
4837 * @return The conversion result is returned.
4840 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
4842 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4843 Doc *doc = jxhtml->doc;
4845 char *attr_style = NULL;
4846 char *attr_color = NULL;
4847 char *attr_type = NULL;
4848 char *attr_size = NULL;
4849 for (attr = qs_get_attr(doc,node);
4851 attr = qs_get_next_attr(doc,attr)) {
4852 char *name = qs_get_attr_name(doc,attr);
4853 char *value = qs_get_attr_value(doc,attr);
4854 if (STRCASEEQ('t','T',"type",name)) {
4855 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4859 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4863 if (IS_CSS_ON(jxhtml->entryp)) {
4864 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4866 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4867 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4868 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4869 css_property_t *cur;
4870 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4871 if (cur->value && *cur->value) {
4872 attr_color = apr_pstrdup(doc->pool, cur->value);
4875 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4876 if (cur->value && *cur->value) {
4877 attr_type = apr_pstrdup(doc->pool, cur->value);
4880 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4881 if (cur->value && *cur->value) {
4882 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4883 attr_size = apr_pstrdup(doc->pool, cur->value);
4885 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4886 attr_size = apr_pstrdup(doc->pool, cur->value);
4888 else if (STRCASEEQ('s','S',"small",cur->value)) {
4889 attr_size = apr_pstrdup(doc->pool, cur->value);
4891 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4892 attr_size = apr_pstrdup(doc->pool, cur->value);
4894 else if (STRCASEEQ('l','L',"large",cur->value)) {
4895 attr_size = apr_pstrdup(doc->pool, cur->value);
4897 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4898 attr_size = apr_pstrdup(doc->pool, cur->value);
4900 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4901 attr_size = apr_pstrdup(doc->pool, cur->value);
4908 if (attr_type || attr_color || attr_size) {
4911 W_L("list-style-type:");
4916 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4934 * It is a handler who processes the MENU tag.
4936 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4937 * destination is specified.
4938 * @param node [i] The MENU tag node is specified.
4939 * @return The conversion result is returned.
4942 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
4944 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4945 Doc *doc = jxhtml->doc;
4947 if (IS_CSS_ON(jxhtml->entryp)) {
4948 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4955 * It is a handler who processes the PLAINTEXT tag.
4957 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4958 * destination is specified.
4959 * @param node [i] The PLAINTEXT tag node is specified.
4960 * @return The conversion result is returned.
4963 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
4968 jxhtml = GET_JXHTML(pdoc);
4971 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
4976 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
4981 jxhtml = GET_JXHTML(pdoc);
4983 for (child = qs_get_child_node(doc, node);
4985 child = qs_get_next_node(doc, child)) {
4987 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
4994 * It is a handler who processes the PLAINTEXT tag.
4996 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4997 * destination is specified.
4998 * @param node [i] The PLAINTEXT tag node is specified.
4999 * @return The conversion result is returned.
5002 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5004 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5010 * It is a handler who processes the BLINK tag.
5012 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5013 * destination is specified.
5014 * @param node [i] The BLINK tag node is specified.
5015 * @return The conversion result is returned.
5018 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5020 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5021 Doc *doc = jxhtml->doc;
5023 char *attr_style = NULL;
5024 char *attr_color = NULL;
5025 char *attr_size = NULL;
5026 for (attr = qs_get_attr(doc,node);
5028 attr = qs_get_next_attr(doc,attr)) {
5029 char *name = qs_get_attr_name(doc,attr);
5030 char *value = qs_get_attr_value(doc,attr);
5031 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5035 if (IS_CSS_ON(jxhtml->entryp)) {
5036 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5038 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5039 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5040 css_property_t *cur;
5041 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5042 if (cur->value && *cur->value) {
5043 attr_color = apr_pstrdup(doc->pool, cur->value);
5046 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5047 if (cur->value && *cur->value) {
5048 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5049 attr_size = apr_pstrdup(doc->pool, cur->value);
5051 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5052 attr_size = apr_pstrdup(doc->pool, cur->value);
5054 else if (STRCASEEQ('s','S',"small",cur->value)) {
5055 attr_size = apr_pstrdup(doc->pool, cur->value);
5057 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5058 attr_size = apr_pstrdup(doc->pool, cur->value);
5060 else if (STRCASEEQ('l','L',"large",cur->value)) {
5061 attr_size = apr_pstrdup(doc->pool, cur->value);
5063 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5064 attr_size = apr_pstrdup(doc->pool, cur->value);
5066 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5067 attr_size = apr_pstrdup(doc->pool, cur->value);
5074 if (attr_color || attr_size) {
5077 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5095 * It is a handler who processes the BLINK tag.
5097 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5098 * destination is specified.
5099 * @param node [i] The BLINK tag node is specified.
5100 * @return The conversion result is returned.
5103 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5105 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5106 Doc *doc = jxhtml->doc;
5108 if (IS_CSS_ON(jxhtml->entryp)) {
5109 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5116 * It is a handler who processes the MARQUEE tag.
5118 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5119 * destination is specified.
5120 * @param node [i] The MARQUEE tag node is specified.
5121 * @return The conversion result is returned.
5124 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5126 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5127 Doc *doc = jxhtml->doc;
5129 char *attr_direction = NULL;
5130 char *attr_style = NULL;
5131 char *attr_color = NULL;
5132 char *attr_size = NULL;
5133 char *attr_bgcolor = NULL;
5134 /*--------------------------------------------------------------------------*/
5135 /* Get Attributes */
5136 /*--------------------------------------------------------------------------*/
5137 for (attr = qs_get_attr(doc,node);
5139 attr = qs_get_next_attr(doc,attr)) {
5140 char *name = qs_get_attr_name(doc,attr);
5141 char *value = qs_get_attr_value(doc,attr);
5142 if (STRCASEEQ('d','D',"direction", name)) {
5144 if (STRCASEEQ('l','L',"left",value)) {
5145 attr_direction = "rtl";
5147 else if (STRCASEEQ('r','R',"right",value)) {
5148 attr_direction = "ltr";
5152 else if (STRCASEEQ('b','B',"behavior",name)) {
5155 else if (STRCASEEQ('l','L',"loop",name)) {
5158 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5159 if (value && *value) {
5160 attr_bgcolor = value;
5163 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5167 if (IS_CSS_ON(jxhtml->entryp)) {
5168 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5170 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5171 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5172 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5173 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5174 css_property_t *cur;
5175 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5176 if (cur->value && *cur->value) {
5177 attr_color = apr_pstrdup(doc->pool, cur->value);
5180 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5181 if (cur->value && *cur->value) {
5182 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5185 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5186 if (cur->value && *cur->value) {
5187 attr_direction = apr_pstrdup(doc->pool, cur->value);
5190 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5191 if (cur->value && *cur->value) {
5192 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5193 || STRCASEEQ('x','X',"x-small", cur->value)
5194 || STRCASEEQ('s','S',"small", cur->value)
5195 || STRCASEEQ('m','M',"medium", cur->value)
5196 || STRCASEEQ('l','L',"large", cur->value)
5197 || STRCASEEQ('x','X',"x-large", cur->value)
5198 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5199 attr_size = apr_pstrdup(doc->pool, cur->value);
5206 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5208 if (attr_direction) {
5209 W_L("-wap-marquee-dir:");
5210 W_V(attr_direction);
5214 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5215 W_L("background-color:");
5220 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5239 * It is a handler who processes the MARQUEE tag.
5241 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5242 * destination is specified.
5243 * @param node [i] The MARQUEE tag node is specified.
5244 * @return The conversion result is returned.
5247 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5249 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5250 Doc *doc = jxhtml->doc;
5252 if (IS_CSS_ON(jxhtml->entryp)) {
5253 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5260 * It is handler who processes the New Line Code.
5263 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5265 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5266 if (jxhtml->start_html_flag) {
5267 Doc *doc = jxhtml->doc;
5275 * It is a handler who processes the LINK tag.
5277 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5278 * destination is specified.
5279 * @param node [i] The LINK tag node is specified.
5280 * @return The conversion result is returned.
5283 s_jxhtml_link_tag(void *pdoc, Node *node)
5292 jxhtml = GET_JXHTML(pdoc);
5295 if (! IS_CSS_ON(jxhtml->entryp)) {
5299 for (attr = qs_get_attr(doc,node);
5301 attr = qs_get_next_attr(doc,attr)) {
5302 char *name = qs_get_attr_name(doc,attr);
5303 char *value = qs_get_attr_value(doc,attr);
5304 if (STRCASEEQ('r','R',"rel", name)) {
5305 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5309 else if (STRCASEEQ('h','H',"href", name)) {
5310 if (value && *value) {
5314 else if (STRCASEEQ('t','T',"type", name)) {
5315 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5321 if (rel && href && type) {
5322 DBG(doc->r, "start load CSS. url:[%s]", href);
5323 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
5324 DBG(doc->r, "end load CSS. url:[%s]", href);
5331 static css_prop_list_t *
5332 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5334 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5335 Doc *doc = jxhtml->doc;
5336 css_prop_list_t *last_css = NULL;
5337 if (IS_CSS_ON(jxhtml->entryp)) {
5338 css_prop_list_t *dup_css;
5339 css_selector_t *selector;
5341 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5342 dup_css = chxj_dup_css_prop_list(doc, last_css);
5343 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5345 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5347 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
5348 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5350 if (style_attr_value) {
5351 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));
5353 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5361 static css_prop_list_t *
5362 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5364 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5365 Doc *doc = jxhtml->doc;
5366 css_prop_list_t *last_css = NULL;
5367 if (IS_CSS_ON(jxhtml->entryp)) {
5368 css_prop_list_t *dup_css;
5369 css_selector_t *selector;
5371 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5372 dup_css = chxj_dup_css_prop_list(doc, last_css);
5373 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5375 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5379 if (style_attr_value) {
5380 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));
5382 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5391 * It is a handler who processes the SPAN tag.
5393 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5394 * destination is specified.
5395 * @param node [i] The SPAN tag node is specified.
5396 * @return The conversion result is returned.
5399 s_jxhtml_start_span_tag(void *pdoc, Node *node)
5404 char *attr_style = NULL;
5405 char *attr_color = NULL;
5406 char *attr_size = NULL;
5407 char *attr_align = NULL;
5408 char *attr_blink = NULL;
5409 char *attr_marquee = NULL;
5410 char *attr_marquee_dir = NULL;
5411 char *attr_marquee_style = NULL;
5412 char *attr_marquee_loop = NULL;
5414 jxhtml = GET_JXHTML(pdoc);
5417 for (attr = qs_get_attr(doc,node);
5419 attr = qs_get_next_attr(doc,attr)) {
5420 char *nm = qs_get_attr_name(doc,attr);
5421 char *val = qs_get_attr_value(doc,attr);
5422 if (val && STRCASEEQ('s','S',"style", nm)) {
5426 if (IS_CSS_ON(jxhtml->entryp)) {
5427 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5429 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5430 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5431 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5432 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5433 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5434 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5435 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5436 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5437 css_property_t *cur;
5438 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5439 attr_color = apr_pstrdup(doc->pool, cur->value);
5441 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5442 if (cur->value && *cur->value) {
5443 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5444 || STRCASEEQ('x','X',"x-small", cur->value)
5445 || STRCASEEQ('s','S',"small", cur->value)
5446 || STRCASEEQ('m','M',"medium", cur->value)
5447 || STRCASEEQ('l','L',"large", cur->value)
5448 || STRCASEEQ('x','X',"x-large", cur->value)
5449 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5450 attr_size = apr_pstrdup(doc->pool, cur->value);
5454 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5455 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5456 attr_blink = apr_pstrdup(doc->pool, cur->value);
5459 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5460 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5461 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5464 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5465 if (cur->value && *cur->value) {
5466 if ( STRCASEEQ('l','L',"ltr",cur->value)
5467 || STRCASEEQ('r','R',"rtl",cur->value)) {
5468 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5472 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5473 if (cur->value && *cur->value) {
5474 if ( STRCASEEQ('s','S',"scroll",cur->value)
5475 || STRCASEEQ('s','S',"slide",cur->value)
5476 || STRCASEEQ('a','A',"alternate",cur->value)) {
5477 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5481 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5482 if (cur->value && *cur->value) {
5483 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5486 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5487 if (STRCASEEQ('l','L',"left", cur->value)) {
5488 attr_align = apr_pstrdup(doc->pool, "left");
5490 else if (STRCASEEQ('c','C',"center",cur->value)) {
5491 attr_align = apr_pstrdup(doc->pool, "center");
5493 else if (STRCASEEQ('r','R',"right",cur->value)) {
5494 attr_align = apr_pstrdup(doc->pool, "right");
5501 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5504 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5520 W_L("text-decoration:");
5525 W_L("display:-wap-marquee;");
5526 if (attr_marquee_dir) {
5527 W_L("-wap-marquee-dir:");
5528 W_V(attr_marquee_dir);
5531 if (attr_marquee_style) {
5532 W_L("-wap-marquee-style:");
5533 W_V(attr_marquee_style);
5536 if (attr_marquee_loop) {
5537 W_L("-wap-marquee-loop:");
5538 W_V(attr_marquee_loop);
5550 * It is a handler who processes the SPAN tag.
5552 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5553 * destination is specified.
5554 * @param node [i] The SPAN tag node is specified.
5555 * @return The conversion result is returned.
5558 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
5560 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5561 Doc *doc = jxhtml->doc;
5564 if (IS_CSS_ON(jxhtml->entryp)) {
5565 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5572 * It is a handler who processes the STYLE tag.
5574 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
5575 * destination is specified.
5576 * @param node [i] The STYLE tag node is specified.
5577 * @return The conversion result is returned.
5580 s_jxhtml_style_tag(void *pdoc, Node *node)
5587 jxhtml = GET_JXHTML(pdoc);
5590 if (! IS_CSS_ON(jxhtml->entryp)) {
5594 for (attr = qs_get_attr(doc,node);
5596 attr = qs_get_next_attr(doc,attr)) {
5597 char *name = qs_get_attr_name(doc,attr);
5598 char *value = qs_get_attr_value(doc,attr);
5599 if (STRCASEEQ('t','T',"type", name)) {
5600 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5606 Node *child = qs_get_child_node(doc, node);
5607 if (type && child) {
5608 char *name = qs_get_node_name(doc, child);
5609 if (STRCASEEQ('t','T',"text", name)) {
5610 char *value = qs_get_node_value(doc, child);
5611 DBG(doc->r, "start load CSS. buf:[%s]", value);
5612 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
5613 DBG(doc->r, "end load CSS. value:[%s]", value);