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,
330 s_jxhtml_start_span_tag,
331 s_jxhtml_end_span_tag,
345 s_jxhtml_start_b_tag,
355 s_jxhtml_start_dt_tag,
370 s_jxhtml_start_blockquote_tag,
371 s_jxhtml_end_blockquote_tag,
375 s_jxhtml_start_dir_tag,
376 s_jxhtml_end_dir_tag,
380 s_jxhtml_start_dl_tag,
385 s_jxhtml_start_dd_tag,
390 s_jxhtml_start_menu_tag,
391 s_jxhtml_end_menu_tag,
395 s_jxhtml_start_plaintext_tag,
396 s_jxhtml_end_plaintext_tag,
400 s_jxhtml_start_blink_tag,
401 s_jxhtml_end_blink_tag,
405 s_jxhtml_start_marquee_tag,
406 s_jxhtml_end_marquee_tag,
415 s_jxhtml_newline_mark,
422 * converts from CHTML5.0 to JXHTML.
424 * @param r [i] Requet_rec is appointed.
425 * @param spec [i] The result of the device specification processing which
426 * was done in advance is appointed.
427 * @param src [i] The character string before the converting is appointed.
428 * @return The character string after the converting is returned.
437 chxjconvrule_entry *entryp,
448 /*--------------------------------------------------------------------------*/
450 /*--------------------------------------------------------------------------*/
452 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
454 DBG(r,"I found qrcode xml");
457 DBG(r,"not found qrcode xml");
459 /*--------------------------------------------------------------------------*/
460 /* The CHTML structure is initialized. */
461 /*--------------------------------------------------------------------------*/
462 s_init_jxhtml(&jxhtml, &doc, r, spec);
464 jxhtml.entryp = entryp;
465 jxhtml.cookie = cookie;
467 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
469 /*--------------------------------------------------------------------------*/
470 /* The character string of the input is analyzed. */
471 /*--------------------------------------------------------------------------*/
472 qs_init_malloc(&doc);
473 qs_init_root_node(&doc);
475 ss = apr_pcalloc(r->pool, srclen + 1);
477 memset(ss, 0, srclen + 1);
478 memcpy(ss, src, srclen);
480 if (IS_CSS_ON(jxhtml.entryp)) {
481 /* current property list */
482 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
485 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
488 qs_parse_string(&doc,ss,strlen(ss));
490 chxj_buffered_write_init(r->pool, &doc.buf);
491 /*--------------------------------------------------------------------------*/
492 /* It converts it from CHTML to JXHTML. */
493 /*--------------------------------------------------------------------------*/
494 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
495 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
496 dst = apr_pstrdup(r->pool, jxhtml.out);
497 chxj_buffered_write_terminate(&doc.buf);
500 qs_all_free(&doc,QX_LOGMARK);
503 return apr_pstrdup(r->pool,ss);
506 dst = apr_psprintf(r->pool, "\n");
508 *dstlen = strlen(dst);
511 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
519 * The JXHTML structure is initialized.
521 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
522 * initialized is specified.
523 * @param doc [i] The Doc structure that should be set to the initialized
524 * JXHTML structure is specified.
525 * @param r [i] To use POOL, the pointer to request_rec is specified.
526 * @param spec [i] The pointer to the device_table
529 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
531 memset(doc, 0, sizeof(Doc));
532 memset(jxhtml, 0, sizeof(jxhtml_t));
537 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
538 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
539 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
544 * Corresponding EMOJI to a current character-code is retrieved.
545 * The substitution character string is stored in the rslt pointer if agreeing.
547 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
548 * @param txt [i] The character string to want to examine whether it is
549 * EMOJI is specified.
550 * @param rslt [o] The pointer to the pointer that stores the result is
552 * @return When corresponding EMOJI exists, it returns it excluding 0.
555 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
567 if (! spec) DBG(r,"spec is NULL");
569 for (ee = jxhtml->conf->emoji;
573 unsigned char hex1byte;
574 unsigned char hex2byte;
577 DBG(r,"emoji->imode is NULL");
581 hex1byte = ee->imode->hex1byte & 0xff;
582 hex2byte = ee->imode->hex2byte & 0xff;
584 if (ee->imode->string
585 && strlen(ee->imode->string) > 0
586 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
587 if (spec == NULL || spec->emoji_type == NULL) {
588 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
589 return strlen(ee->imode->string);
596 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
597 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
598 if (spec == NULL || spec->emoji_type == NULL) {
599 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
612 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
626 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
627 memset(doc, 0, sizeof(Doc));
628 memset(jxhtml, 0, sizeof(jxhtml_t));
633 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
634 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
635 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
637 apr_pool_create(&pool, r->pool);
639 chxj_buffered_write_init(pool, &doc->buf);
641 for (ii=0; ii<len; ii++) {
645 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
652 if (is_sjis_kanji(src[ii])) {
653 two_byte[0] = src[ii+0];
654 two_byte[1] = src[ii+1];
660 one_byte[0] = src[ii+0];
665 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
667 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
673 * It is a handler who processes the HTML tag.
675 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
676 * destination is specified.
677 * @param node [i] The HTML tag node is specified.
678 * @return The conversion result is returned.
681 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
688 jxhtml = GET_JXHTML(pdoc);
691 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
693 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
695 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
698 /*--------------------------------------------------------------------------*/
700 /*--------------------------------------------------------------------------*/
701 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
703 jxhtml->start_html_flag = 1;
705 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
712 * It is a handler who processes the HTML tag.
714 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
715 * destination is specified.
716 * @param node [i] The HTML tag node is specified.
717 * @return The conversion result is returned.
720 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
722 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
723 Doc *doc = jxhtml->doc;
732 * It is a handler who processes the META tag.
734 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
735 * destination is specified.
736 * @param node [i] The META tag node is specified.
737 * @return The conversion result is returned.
740 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
746 int content_type_flag;
749 jxhtml = GET_JXHTML(pdoc);
753 content_type_flag = 0;
756 /*--------------------------------------------------------------------------*/
758 /*--------------------------------------------------------------------------*/
759 for (attr = qs_get_attr(doc,node);
761 attr = qs_get_next_attr(doc,attr)) {
762 char *name = qs_get_attr_name(doc,attr);
763 char *value = qs_get_attr_value(doc,attr);
767 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
768 /*----------------------------------------------------------------------*/
770 /*----------------------------------------------------------------------*/
771 W_L(" http-equiv=\"");
774 if (STRCASEEQ('c','C',"content-type",value)) {
775 content_type_flag = 1;
777 if (STRCASEEQ('r','R',"refresh",value)) {
785 if (strcasecmp(name, "content") == 0 && value && *value) {
786 /*----------------------------------------------------------------------*/
788 /*----------------------------------------------------------------------*/
789 if (content_type_flag) {
793 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
802 buf = apr_pstrdup(r->pool, value);
804 url = strchr(buf, ';');
806 sec = apr_pstrdup(r->pool, buf);
809 url = chxj_encoding_parameter(r, url, 1);
830 if (strcasecmp(name, "name") == 0 && value && *value) {
846 * It is a handler who processes the META tag.
848 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
849 * destination is specified.
850 * @param node [i] The META tag node is specified.
851 * @return The conversion result is returned.
854 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
856 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
863 * It is a handler who processes the HEAD tag.
865 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
866 * destination is specified.
867 * @param node [i] The HEAD tag node is specified.
868 * @return The conversion result is returned.
871 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
877 jxhtml = GET_JXHTML(pdoc);
887 * It is a handler who processes the HEAD tag.
889 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
890 * destination is specified.
891 * @param node [i] The HEAD tag node is specified.
892 * @return The conversion result is returned.
895 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
901 jxhtml = GET_JXHTML(pdoc);
911 * It is a handler who processes the TITLE tag.
913 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
914 * destination is specified.
915 * @param node [i] The TITLE tag node is specified.
916 * @return The conversion result is returned.
919 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
925 jxhtml = GET_JXHTML(pdoc);
935 * It is a handler who processes the TITLE tag.
937 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
938 * destination is specified.
939 * @param node [i] The TITLE tag node is specified.
940 * @return The conversion result is returned.
943 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
949 jxhtml = GET_JXHTML(pdoc);
959 * It is a handler who processes the BASE tag.
961 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
962 * destination is specified.
963 * @param node [i] The BASE tag node is specified.
964 * @return The conversion result is returned.
967 s_jxhtml_start_base_tag(void *pdoc, Node *node)
974 jxhtml = GET_JXHTML(pdoc);
979 /*--------------------------------------------------------------------------*/
981 /*--------------------------------------------------------------------------*/
982 for (attr = qs_get_attr(doc,node);
984 attr = qs_get_next_attr(doc,attr)) {
985 char *name = qs_get_attr_name(doc,attr);
986 char *value = qs_get_attr_value(doc,attr);
987 if (STRCASEEQ('h','H',"href",name)) {
999 * It is a handler who processes the BASE tag.
1001 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1002 * destination is specified.
1003 * @param node [i] The BASE tag node is specified.
1004 * @return The conversion result is returned.
1007 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1009 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1015 * It is a handler who processes the BODY tag.
1017 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1018 * destination is specified.
1019 * @param node [i] The BODY tag node is specified.
1020 * @return The conversion result is returned.
1023 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1029 char *attr_bgcolor = NULL;
1030 char *attr_text = NULL;
1031 char *attr_link = NULL;
1032 char *attr_style = NULL;
1034 jxhtml = GET_JXHTML(pdoc);
1038 /*--------------------------------------------------------------------------*/
1039 /* Get Attributes */
1040 /*--------------------------------------------------------------------------*/
1041 for (attr = qs_get_attr(doc,node);
1043 attr = qs_get_next_attr(doc,attr)) {
1044 char *name = qs_get_attr_name(doc,attr);
1045 char *value = qs_get_attr_value(doc,attr);
1046 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1047 /*----------------------------------------------------------------------*/
1049 /*----------------------------------------------------------------------*/
1050 attr_bgcolor = value;
1052 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1053 /*----------------------------------------------------------------------*/
1055 /*----------------------------------------------------------------------*/
1058 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1059 /*----------------------------------------------------------------------*/
1061 /*----------------------------------------------------------------------*/
1064 else if (STRCASEEQ('a','A',"alink",name)) {
1065 /*----------------------------------------------------------------------*/
1067 /*----------------------------------------------------------------------*/
1070 else if (STRCASEEQ('v','V',"vlink",name)) {
1071 /*----------------------------------------------------------------------*/
1073 /*----------------------------------------------------------------------*/
1076 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1081 if (IS_CSS_ON(jxhtml->entryp)) {
1082 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1084 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1085 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1086 css_property_t *cur;
1087 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1088 if (cur->value && *cur->value) {
1089 attr_text = apr_pstrdup(doc->pool, cur->value);
1092 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1093 if (cur->value && *cur->value) {
1094 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1098 if (jxhtml->style) {
1099 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1100 css_selector_t *cur_sel;
1101 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1102 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1103 css_property_t *cur;
1104 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1105 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1106 attr_link = apr_pstrdup(doc->pool, cur->value);
1116 if (attr_bgcolor || attr_text) {
1119 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1120 W_L("background-color:");
1125 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1133 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1144 * It is a handler who processes the BODY tag.
1146 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1147 * destination is specified.
1148 * @param node [i] The BODY tag node is specified.
1149 * @return The conversion result is returned.
1152 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1158 jxhtml = GET_JXHTML(pdoc);
1162 W_L("</div></body>");
1163 if (IS_CSS_ON(jxhtml->entryp)) {
1164 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1171 * It is a handler who processes the A tag.
1173 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1174 * destination is specified.
1175 * @param node [i] The A tag node is specified.
1176 * @return The conversion result is returned.
1179 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1185 char *attr_style = NULL;
1187 jxhtml = GET_JXHTML(pdoc);
1192 /*--------------------------------------------------------------------------*/
1193 /* Get Attributes */
1194 /*--------------------------------------------------------------------------*/
1195 for (attr = qs_get_attr(doc,node);
1197 attr = qs_get_next_attr(doc,attr)) {
1198 char *name = qs_get_attr_name(doc,attr);
1199 char *value = qs_get_attr_value(doc,attr);
1200 if (STRCASEEQ('n','N',"name",name)) {
1201 /*----------------------------------------------------------------------*/
1203 /*----------------------------------------------------------------------*/
1205 W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1208 else if (STRCASEEQ('h','H',"href",name)) {
1209 /*----------------------------------------------------------------------*/
1211 /*----------------------------------------------------------------------*/
1212 value = chxj_encoding_parameter(r, value, 1);
1213 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1214 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1220 else if (STRCASEEQ('a','A',"accesskey",name)) {
1221 /*----------------------------------------------------------------------*/
1223 /*----------------------------------------------------------------------*/
1224 W_L(" accesskey=\"");
1228 else if (STRCASEEQ('c','C',"cti",name)) {
1229 /*----------------------------------------------------------------------*/
1231 /*----------------------------------------------------------------------*/
1236 else if (STRCASEEQ('i','I',"ijam",name)) {
1237 /*----------------------------------------------------------------------*/
1239 /*----------------------------------------------------------------------*/
1242 else if (STRCASEEQ('u','U',"utn",name)) {
1243 /*----------------------------------------------------------------------*/
1245 /* It is special only for CHTML. */
1246 /*----------------------------------------------------------------------*/
1249 else if (STRCASEEQ('t','T',"telbook",name)) {
1250 /*----------------------------------------------------------------------*/
1252 /*----------------------------------------------------------------------*/
1255 else if (STRCASEEQ('k','K',"kana",name)) {
1256 /*----------------------------------------------------------------------*/
1258 /*----------------------------------------------------------------------*/
1261 else if (STRCASEEQ('e','E',"email",name)) {
1262 /*----------------------------------------------------------------------*/
1264 /*----------------------------------------------------------------------*/
1267 else if (STRCASEEQ('i','I',"ista",name)) {
1268 /*----------------------------------------------------------------------*/
1270 /*----------------------------------------------------------------------*/
1273 else if (STRCASEEQ('i','I',"ilet",name)) {
1274 /*----------------------------------------------------------------------*/
1276 /*----------------------------------------------------------------------*/
1279 else if (STRCASEEQ('i','I',"iswf",name)) {
1280 /*----------------------------------------------------------------------*/
1282 /*----------------------------------------------------------------------*/
1285 else if (STRCASEEQ('i','I',"irst",name)) {
1286 /*----------------------------------------------------------------------*/
1288 /*----------------------------------------------------------------------*/
1291 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1292 /*----------------------------------------------------------------------*/
1294 /*----------------------------------------------------------------------*/
1300 if (IS_CSS_ON(jxhtml->entryp)) {
1301 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1309 * It is a handler who processes the A tag.
1311 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1312 * destination is specified.
1313 * @param node [i] The A tag node is specified.
1314 * @return The conversion result is returned.
1317 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1323 jxhtml = GET_JXHTML(pdoc);
1329 if (IS_CSS_ON(jxhtml->entryp)) {
1330 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1338 * It is a handler who processes the BR tag.
1340 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1341 * destination is specified.
1342 * @param node [i] The BR tag node is specified.
1343 * @return The conversion result is returned.
1346 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1353 jxhtml = GET_JXHTML(pdoc);
1357 char *attr_style = NULL;
1358 char *attr_clear = NULL;
1360 /*--------------------------------------------------------------------------*/
1361 /* Get Attributes */
1362 /*--------------------------------------------------------------------------*/
1363 for (attr = qs_get_attr(doc,node);
1365 attr = qs_get_next_attr(doc,attr)) {
1366 char *name = qs_get_attr_name(doc,attr);
1367 char *value = qs_get_attr_value(doc,attr);
1368 if (STRCASEEQ('c','C',"clear",name)) {
1369 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1373 else if (STRCASEEQ('s','S',"style",name)) {
1374 attr_style = apr_pstrdup(doc->buf.pool, value);
1377 if (IS_CSS_ON(jxhtml->entryp)) {
1378 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1380 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1381 css_property_t *cur;
1382 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1383 if (cur->value && *cur->value) {
1384 if ( STRCASEEQ('l','L',"left", cur->value)
1385 || STRCASEEQ('r','R',"right", cur->value)
1386 || STRCASEEQ('b','B',"both" ,cur->value)) {
1387 attr_clear = apr_pstrdup(doc->pool, cur->value);
1405 * It is a handler who processes the BR tag.
1407 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1408 * destination is specified.
1409 * @param node [i] The BR tag node is specified.
1410 * @return The conversion result is returned.
1413 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1415 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1421 * It is a handler who processes the TR tag.
1423 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1424 * destination is specified.
1425 * @param node [i] The TR tag node is specified.
1426 * @return The conversion result is returned.
1429 s_jxhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1435 jxhtml = GET_JXHTML(pdoc);
1445 * It is a handler who processes the TR tag.
1447 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1448 * destination is specified.
1449 * @param node [i] The TR tag node is specified.
1450 * @return The conversion result is returned.
1453 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1455 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1461 * It is a handler who processes the FONT tag.
1463 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1464 * destination is specified.
1465 * @param node [i] The FONT tag node is specified.
1466 * @return The conversion result is returned.
1469 s_jxhtml_start_font_tag(void *pdoc, Node *node)
1475 char *attr_color = NULL;
1476 char *attr_size = NULL;
1477 char *attr_style = NULL;
1479 jxhtml = GET_JXHTML(pdoc);
1483 /*--------------------------------------------------------------------------*/
1484 /* Get Attributes */
1485 /*--------------------------------------------------------------------------*/
1486 for (attr = qs_get_attr(doc,node);
1488 attr = qs_get_next_attr(doc,attr)) {
1489 char *name = qs_get_attr_name(doc,attr);
1490 char *value = qs_get_attr_value(doc,attr);
1491 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1492 attr_color = apr_pstrdup(doc->buf.pool, value);
1494 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1495 /*----------------------------------------------------------------------*/
1497 /*----------------------------------------------------------------------*/
1498 attr_size = apr_pstrdup(doc->buf.pool, value);
1500 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1501 attr_style = apr_pstrdup(doc->buf.pool, value);
1504 if (IS_CSS_ON(jxhtml->entryp)) {
1505 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1507 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1508 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1509 css_property_t *cur;
1510 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1511 if (cur->value && *cur->value) {
1512 attr_color = apr_pstrdup(doc->pool, cur->value);
1515 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1516 if (cur->value && *cur->value) {
1517 attr_size = apr_pstrdup(doc->pool, cur->value);
1518 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1519 attr_size = apr_pstrdup(doc->pool, "1");
1521 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1522 attr_size = apr_pstrdup(doc->pool, "2");
1524 else if (STRCASEEQ('s','S',"small",attr_size)) {
1525 attr_size = apr_pstrdup(doc->pool, "3");
1527 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1528 attr_size = apr_pstrdup(doc->pool, "4");
1530 else if (STRCASEEQ('l','L',"large",attr_size)) {
1531 attr_size = apr_pstrdup(doc->pool, "5");
1533 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1534 attr_size = apr_pstrdup(doc->pool, "6");
1536 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1537 attr_size = apr_pstrdup(doc->pool, "7");
1543 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1544 memset(flg, 0, sizeof(*flg));
1546 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1547 W_L("<font color=\"");
1550 flg->font_color_flag = 1;
1553 flg->font_size_flag = 1;
1554 switch(*attr_size) {
1555 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1556 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1557 case '3': W_L("<span style=\"font-size: small\">"); break;
1558 case '4': W_L("<span style=\"font-size: medium\">"); break;
1559 case '5': W_L("<span style=\"font-size: large\">"); break;
1560 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1561 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1563 if (*(attr_size + 1) == '1') {
1564 W_L("<span style=\"font-size: small\">");
1567 if (*(attr_size + 1) == '2') {
1568 W_L("<span style=\"font-size: x-small\">");
1571 if (*(attr_size + 1) == '3') {
1572 W_L("<span style=\"font-size: xx-small\">");
1575 flg->font_size_flag = 0;
1579 if (*(attr_size + 1) == '1') {
1580 W_L("<span style=\"font-size: large\">");
1583 if (*(attr_size + 1) == '2') {
1584 W_L("<span style=\"font-size: x-large\">");
1587 if (*(attr_size + 1) == '3') {
1588 W_L("<span style=\"font-size: xx-large\">");
1591 flg->font_size_flag = 0;
1595 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1596 flg->font_size_flag = 0;
1599 node->userData = flg;
1605 * It is a handler who processes the FONT tag.
1607 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1608 * destination is specified.
1609 * @param node [i] The FONT tag node is specified.
1610 * @return The conversion result is returned.
1613 s_jxhtml_end_font_tag(void *pdoc, Node *node)
1619 jxhtml = GET_JXHTML(pdoc);
1623 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
1624 if (flg && flg->font_size_flag) {
1627 if (flg && flg->font_color_flag) {
1630 if (IS_CSS_ON(jxhtml->entryp)) {
1631 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1639 * It is a handler who processes the FORM tag.
1641 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1642 * destination is specified.
1643 * @param node [i] The FORM tag node is specified.
1644 * @return The conversion result is returned.
1647 s_jxhtml_start_form_tag(void *pdoc, Node *node)
1653 char *attr_action = NULL;
1654 char *attr_method = NULL;
1655 char *attr_style = NULL;
1656 char *attr_color = NULL;
1657 char *attr_align = NULL;
1658 char *attr_name = NULL;
1659 char *new_hidden_tag = NULL;
1661 jxhtml = GET_JXHTML(pdoc);
1665 /*--------------------------------------------------------------------------*/
1666 /* Get Attributes */
1667 /*--------------------------------------------------------------------------*/
1668 for (attr = qs_get_attr(doc,node);
1670 attr = qs_get_next_attr(doc,attr)) {
1671 char *name = qs_get_attr_name(doc,attr);
1672 char *value = qs_get_attr_value(doc,attr);
1676 if (strcasecmp(name, "action") == 0) {
1677 /*--------------------------------------------------------------------*/
1679 /*--------------------------------------------------------------------*/
1680 attr_action = value;
1686 if (strcasecmp(name, "method") == 0) {
1687 /*--------------------------------------------------------------------*/
1689 /*--------------------------------------------------------------------*/
1690 attr_method = value;
1696 if (strcasecmp(name, "name") == 0) {
1697 /*--------------------------------------------------------------------*/
1699 /*--------------------------------------------------------------------*/
1706 if (strcasecmp(name, "style") == 0) {
1715 if (IS_CSS_ON(jxhtml->entryp)) {
1716 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1718 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1719 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1720 css_property_t *cur;
1721 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1722 if (STRCASEEQ('l','L',"left", cur->value)) {
1723 attr_align = apr_pstrdup(doc->pool, "left");
1725 else if (STRCASEEQ('c','C',"center",cur->value)) {
1726 attr_align = apr_pstrdup(doc->pool, "center");
1728 else if (STRCASEEQ('r','R',"right",cur->value)) {
1729 attr_align = apr_pstrdup(doc->pool, "right");
1732 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1733 attr_color = apr_pstrdup(doc->pool, cur->value);
1738 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1742 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1743 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
1745 char *old_qs = NULL;
1746 q = strchr(attr_action, '?');
1748 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);
1749 if (new_hidden_tag || old_qs) {
1773 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
1774 memset(flg, 0, sizeof(*flg));
1776 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1777 W_L("<font color=\"");
1780 flg->with_font_flag = 1;
1783 W_L("<div align=\"");
1786 flg->with_div_flag = 1;
1788 node->userData = flg;
1789 if (new_hidden_tag) {
1790 W_V(new_hidden_tag);
1797 * It is a handler who processes the FORM tag.
1799 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1800 * destination is specified.
1801 * @param node [i] The FORM tag node is specified.
1802 * @return The conversion result is returned.
1805 s_jxhtml_end_form_tag(void *pdoc, Node *node)
1807 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1808 Doc *doc = jxhtml->doc;
1810 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
1811 if (flg && flg->with_div_flag) {
1814 if (flg && flg->with_font_flag) {
1818 if (IS_CSS_ON(jxhtml->entryp)) {
1819 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1827 * It is a handler who processes the INPUT tag.
1829 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1830 * destination is specified.
1831 * @param node [i] The INPUT tag node is specified.
1832 * @return The conversion result is returned.
1835 s_jxhtml_start_input_tag(void *pdoc, Node *node)
1841 char *attr_accesskey = NULL;
1842 char *attr_max_length = NULL;
1843 char *attr_type = NULL;
1844 char *attr_name = NULL;
1845 char *attr_value = NULL;
1846 char *attr_istyle = NULL;
1847 char *attr_size = NULL;
1848 char *attr_checked = NULL;
1849 char *attr_style = NULL;
1851 jxhtml = GET_JXHTML(pdoc);
1855 /*--------------------------------------------------------------------------*/
1856 /* Get Attributes */
1857 /*--------------------------------------------------------------------------*/
1858 for (attr = qs_get_attr(doc,node);
1860 attr = qs_get_next_attr(doc,attr)) {
1861 char *name = qs_get_attr_name(doc,attr);
1862 char *value = qs_get_attr_value(doc,attr);
1863 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1864 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1865 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1866 STRCASEEQ('p','P',"password",tmp_type) ||
1867 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1868 STRCASEEQ('r','R',"radio", tmp_type) ||
1869 STRCASEEQ('h','H',"hidden", tmp_type) ||
1870 STRCASEEQ('s','S',"submit", tmp_type) ||
1871 STRCASEEQ('r','R',"reset", tmp_type))) {
1872 attr_type = tmp_type;
1875 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1878 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1881 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1882 attr_istyle = value;
1884 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1885 attr_max_length = value;
1887 else if (STRCASEEQ('c','C',"checked", name)) {
1888 attr_checked = value;
1890 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1891 attr_accesskey = value;
1893 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1896 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1901 if (IS_CSS_ON(jxhtml->entryp)) {
1902 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1904 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1905 css_property_t *cur;
1906 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1907 if (strcasestr(cur->value, "<ja:n>")) {
1910 else if (strcasestr(cur->value, "<ja:en>")) {
1913 else if (strcasestr(cur->value, "<ja:hk>")) {
1916 else if (strcasestr(cur->value, "<ja:h>")) {
1936 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
1941 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1944 if (attr_accesskey) {
1945 W_L(" accesskey=\"");
1946 W_V(attr_accesskey);
1949 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1950 /*------------------------------------------------------------------------*/
1952 /*------------------------------------------------------------------------*/
1953 if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jxhtml->entryp->pc_flag ) {
1954 char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
1955 W_L(" style=\"-wap-input-format:"*");
1960 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
1962 W_L("-wap-input-format:"*");
1968 else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1969 char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
1970 W_L(" style=\"-wap-input-format:"*");
1974 /*--------------------------------------------------------------------------*/
1975 /* The figure is default for the password. */
1976 /*--------------------------------------------------------------------------*/
1977 if (attr_max_length && *attr_max_length) {
1978 if (chxj_chk_numeric(attr_max_length) == 0) {
1979 W_L(" maxlength=\"");
1980 W_V(attr_max_length);
1985 W_L(" checked=\"checked\"");
2001 jxhtml = GET_JXHTML(pdoc);
2014 /*--------------------------------------------------------------------------*/
2015 /* Get Attributes */
2016 /*--------------------------------------------------------------------------*/
2017 type = qs_get_type_attr(doc, node, doc->buf.pool);
2018 name = qs_get_name_attr(doc, node, doc->buf.pool);
2019 value = qs_get_value_attr(doc,node, doc->buf.pool);
2020 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2021 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2022 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2023 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2024 size = qs_get_size_attr(doc, node, doc->buf.pool);
2027 if (type && (STRCASEEQ('t','T',"text", type) ||
2028 STRCASEEQ('p','P',"password",type) ||
2029 STRCASEEQ('c','C',"checkbox",type) ||
2030 STRCASEEQ('r','R',"radio", type) ||
2031 STRCASEEQ('h','H',"hidden", type) ||
2032 STRCASEEQ('s','S',"submit", type) ||
2033 STRCASEEQ('r','R',"reset", type))) {
2039 if (size && *size) {
2044 if (name && *name) {
2046 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2049 if (value && *value) {
2050 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2051 apr_size_t value_len = strlen(value);
2052 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2056 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2059 if (accesskey && *accesskey) {
2060 W_L(" accesskey=\"");
2064 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2065 /*------------------------------------------------------------------------*/
2067 /*------------------------------------------------------------------------*/
2068 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2069 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2072 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2074 W_L("-wap-input-format:'*");
2080 else if (type && STRCASEEQ('p','P',"password",type)) {
2081 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2083 /*--------------------------------------------------------------------------*/
2084 /* The figure is default for the password. */
2085 /*--------------------------------------------------------------------------*/
2086 if (max_length && *max_length) {
2087 if (chxj_chk_numeric(max_length) == 0) {
2088 W_L(" maxlength=\"");
2095 W_L(" checked=\"checked\"");
2104 * It is a handler who processes the INPUT tag.
2106 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2107 * destination is specified.
2108 * @param node [i] The INPUT tag node is specified.
2109 * @return The conversion result is returned.
2112 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2114 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2120 * It is a handler who processes the CENTER tag.
2122 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2123 * destination is specified.
2124 * @param node [i] The CENTER tag node is specified.
2125 * @return The conversion result is returned.
2128 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2133 char *attr_style = NULL;
2134 char *attr_color = NULL;
2135 char *attr_size = NULL;
2137 jxhtml = GET_JXHTML(pdoc);
2140 for (attr = qs_get_attr(doc,node);
2142 attr = qs_get_next_attr(doc,attr)) {
2143 char *name = qs_get_attr_name(doc,attr);
2144 char *value = qs_get_attr_value(doc,attr);
2145 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2149 if (IS_CSS_ON(jxhtml->entryp)) {
2150 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2152 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2153 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2154 css_property_t *cur;
2155 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2156 if (cur->value && *cur->value) {
2157 attr_color = apr_pstrdup(doc->pool, cur->value);
2160 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2161 if (cur->value && *cur->value) {
2162 attr_size = apr_pstrdup(doc->pool, cur->value);
2169 if (attr_size || attr_color) {
2177 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2191 * It is a handler who processes the CENTER tag.
2193 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2194 * destination is specified.
2195 * @param node [i] The CENTER tag node is specified.
2196 * @return The conversion result is returned.
2199 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2205 jxhtml = GET_JXHTML(pdoc);
2210 if (IS_CSS_ON(jxhtml->entryp)) {
2211 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2218 * It is a handler who processes the li tag.
2220 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2221 * destination is specified.
2222 * @param node [i] The li tag node is specified.
2223 * @return The conversion result is returned.
2226 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2232 char *attr_type = NULL;
2233 char *attr_value = NULL;
2234 char *attr_style = NULL;
2236 jxhtml = GET_JXHTML(pdoc);
2240 for (attr = qs_get_attr(doc,node);
2242 attr = qs_get_next_attr(doc,attr)) {
2243 char *name = qs_get_attr_name(doc,attr);
2244 char *value = qs_get_attr_value(doc,attr);
2245 if (STRCASEEQ('t','T',"type",name)) {
2246 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2247 if (*value == '1') {
2248 attr_type = apr_pstrdup(doc->pool, "decimal");
2250 else if (*value == 'a') {
2251 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2253 else if (*value == 'A') {
2254 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2261 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2264 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2268 if (IS_CSS_ON(jxhtml->entryp)) {
2269 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2271 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2272 css_property_t *cur;
2273 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2274 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2275 attr_type = apr_pstrdup(doc->pool, "decimal");
2277 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2278 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2280 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2281 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2283 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2284 attr_type = apr_pstrdup(doc->pool, "disc");
2286 else if (STRCASEEQ('s','S',"square", cur->value)) {
2287 attr_type = apr_pstrdup(doc->pool, "square");
2289 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2290 attr_type = apr_pstrdup(doc->pool, "circle");
2300 W_L("list-style-type:");
2316 * It is a handler who processes the li tag.
2318 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2319 * destination is specified.
2320 * @param node [i] The li tag node is specified.
2321 * @return The conversion result is returned.
2324 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2330 jxhtml = GET_JXHTML(pdoc);
2334 if (IS_CSS_ON(jxhtml->entryp)) {
2335 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2343 * It is a handler who processes the OL tag.
2345 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2346 * destination is specified.
2347 * @param node [i] The OL tag node is specified.
2348 * @return The conversion result is returned.
2351 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2357 char *attr_style = NULL;
2358 char *attr_start = NULL;
2359 char *attr_type = NULL;
2361 jxhtml = GET_JXHTML(pdoc);
2365 /*--------------------------------------------------------------------------*/
2366 /* Get Attributes */
2367 /*--------------------------------------------------------------------------*/
2368 for (attr = qs_get_attr(doc,node);
2370 attr = qs_get_next_attr(doc,attr)) {
2371 char *name = qs_get_attr_name(doc,attr);
2372 char *value = qs_get_attr_value(doc,attr);
2373 if (STRCASEEQ('t','T',"type",name) && value) {
2374 if (*value == '1') {
2375 attr_type = apr_pstrdup(doc->pool, "decimal");
2377 else if (*value == 'a') {
2378 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2380 else if (*value == 'A') {
2381 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2384 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2387 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2391 if (IS_CSS_ON(jxhtml->entryp)) {
2392 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2394 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2395 css_property_t *cur;
2396 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2397 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2398 attr_type = apr_pstrdup(doc->pool, "decimal");
2400 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2401 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2403 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2404 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2412 W_L("list-style-type:");
2429 * It is a handler who processes the OL tag.
2431 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2432 * destination is specified.
2433 * @param node [i] The OL tag node is specified.
2434 * @return The conversion result is returned.
2437 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2443 jxhtml = GET_JXHTML(pdoc);
2448 if (IS_CSS_ON(jxhtml->entryp)) {
2449 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2456 * It is a handler who processes the P tag.
2458 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2459 * destination is specified.
2460 * @param node [i] The P tag node is specified.
2461 * @return The conversion result is returned.
2464 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2470 char *attr_align = NULL;
2471 char *attr_style = NULL;
2472 char *attr_color = NULL;
2473 char *attr_blink = NULL;
2475 jxhtml = GET_JXHTML(pdoc);
2479 for (attr = qs_get_attr(doc,node);
2481 attr = qs_get_next_attr(doc,attr)) {
2482 char *nm = qs_get_attr_name(doc,attr);
2483 char *val = qs_get_attr_value(doc,attr);
2484 if (STRCASEEQ('a','A',"align", nm)) {
2485 /*----------------------------------------------------------------------*/
2486 /* CHTML 1.0 (W3C version 3.2) */
2487 /*----------------------------------------------------------------------*/
2488 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2489 attr_align = apr_pstrdup(doc->buf.pool, val);
2493 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2494 attr_style = apr_pstrdup(doc->buf.pool, val);
2497 if (IS_CSS_ON(jxhtml->entryp)) {
2498 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2500 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2501 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2502 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2503 css_property_t *cur;
2504 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2505 if (STRCASEEQ('l','L',"left",cur->value)) {
2506 attr_align = apr_pstrdup(doc->pool, "left");
2508 else if (STRCASEEQ('c','C',"center",cur->value)) {
2509 attr_align = apr_pstrdup(doc->pool, "center");
2511 else if (STRCASEEQ('r','R',"right",cur->value)) {
2512 attr_align = apr_pstrdup(doc->pool, "right");
2515 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2516 if (cur->value && *cur->value) {
2517 attr_color = apr_pstrdup(doc->pool, cur->value);
2520 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2521 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2522 attr_blink = apr_pstrdup(doc->pool, cur->value);
2528 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2536 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2542 W_L("text-decoration:");
2554 * It is a handler who processes the P tag.
2556 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2557 * destination is specified.
2558 * @param node [i] The P tag node is specified.
2559 * @return The conversion result is returned.
2562 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2564 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2565 Doc *doc = jxhtml->doc;
2568 if (IS_CSS_ON(jxhtml->entryp)) {
2569 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2576 * It is a handler who processes the PRE tag.
2578 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2579 * destination is specified.
2580 * @param node [i] The PRE tag node is specified.
2581 * @return The conversion result is returned.
2584 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
2586 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2587 Doc *doc = jxhtml->doc;
2589 char *attr_style = NULL;
2591 for (attr = qs_get_attr(doc,node);
2593 attr = qs_get_next_attr(doc,attr)) {
2594 char *nm = qs_get_attr_name(doc,attr);
2595 char *val = qs_get_attr_value(doc,attr);
2596 if (val && STRCASEEQ('s','S',"style", nm)) {
2601 if (IS_CSS_ON(jxhtml->entryp)) {
2602 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2612 * It is a handler who processes the PRE tag.
2614 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2615 * destination is specified.
2616 * @param node [i] The PRE tag node is specified.
2617 * @return The conversion result is returned.
2620 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2622 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2623 Doc *doc = jxhtml->doc;
2627 if (IS_CSS_ON(jxhtml->entryp)) {
2628 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2636 * It is a handler who processes the UL tag.
2638 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2639 * destination is specified.
2640 * @param node [i] The UL tag node is specified.
2641 * @return The conversion result is returned.
2644 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2646 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2647 Doc *doc = jxhtml->doc;
2649 char *attr_type = NULL;
2650 char *attr_style = NULL;
2651 /*--------------------------------------------------------------------------*/
2652 /* Get Attributes */
2653 /*--------------------------------------------------------------------------*/
2654 for (attr = qs_get_attr(doc,node);
2656 attr = qs_get_next_attr(doc,attr)) {
2657 char *name = qs_get_attr_name(doc,attr);
2658 char *value = qs_get_attr_value(doc,attr);
2659 if (STRCASEEQ('t','T',"type",name)) {
2660 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2664 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2668 if (IS_CSS_ON(jxhtml->entryp)) {
2669 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2671 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2672 css_property_t *cur;
2673 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2674 if (STRCASEEQ('d','D',"disc",cur->value)) {
2675 attr_type = apr_pstrdup(doc->pool, "disc");
2677 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2678 attr_type = apr_pstrdup(doc->pool, "circle");
2680 else if (STRCASEEQ('s','S',"square",cur->value)) {
2681 attr_type = apr_pstrdup(doc->pool, "square");
2689 W_L("list-style-type:");
2700 * It is a handler who processes the UL tag.
2702 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2703 * destination is specified.
2704 * @param node [i] The UL tag node is specified.
2705 * @return The conversion result is returned.
2708 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2710 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2711 Doc *doc = jxhtml->doc;
2714 if (IS_CSS_ON(jxhtml->entryp)) {
2715 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2722 * It is a handler who processes the HR tag.
2724 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2725 * destination is specified.
2726 * @param node [i] The HR tag node is specified.
2727 * @return The conversion result is returned.
2730 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
2736 char *attr_align = NULL;
2737 char *attr_size = NULL;
2738 char *attr_width = NULL;
2739 char *attr_noshade = NULL;
2740 char *attr_style = NULL;
2741 char *attr_color = NULL;
2743 char *style_float = NULL;
2744 char *style_border_color = NULL;
2746 jxhtml = GET_JXHTML(pdoc);
2750 for (attr = qs_get_attr(doc,node);
2752 attr = qs_get_next_attr(doc,attr)) {
2753 char *name = qs_get_attr_name (doc,attr);
2754 char *value = qs_get_attr_value(doc,attr);
2758 if (strcasecmp(name, "align") == 0) {
2759 /*--------------------------------------------------------------------*/
2761 /*--------------------------------------------------------------------*/
2762 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2770 if (strcasecmp(name, "size") == 0) {
2771 /*--------------------------------------------------------------------*/
2773 /*--------------------------------------------------------------------*/
2774 if (value && *value) {
2778 else if (strcasecmp(name, "style") == 0) {
2779 if (value && *value) {
2787 if (strcasecmp(name, "width") == 0) {
2788 /*--------------------------------------------------------------------*/
2790 /*--------------------------------------------------------------------*/
2791 if (value && *value) {
2799 if (strcasecmp(name, "noshade") == 0) {
2800 /*--------------------------------------------------------------------*/
2802 /*--------------------------------------------------------------------*/
2803 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2809 if (strcasecmp(name, "color") == 0 && value && *value) {
2810 /*--------------------------------------------------------------------*/
2812 /*--------------------------------------------------------------------*/
2821 if (IS_CSS_ON(jxhtml->entryp)) {
2822 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2824 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2825 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2826 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2828 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2829 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2830 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2831 css_property_t *cur;
2833 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2834 if (STRCASEEQ('s','S',"solid",cur->value)) {
2835 attr_noshade = "noshade";
2838 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2839 char *tmp = apr_pstrdup(doc->pool, cur->value);
2840 char *tmpp = strstr(tmp, "px");
2842 attr_size = apr_pstrdup(doc->pool, tmp);
2846 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
2847 char *tmp = apr_pstrdup(doc->pool,cur->value);
2848 attr_color = apr_pstrdup(doc->pool,tmp);
2851 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2852 char *tmp = apr_pstrdup(doc->pool, cur->value);
2853 char *tmpp = strstr(tmp,"none");
2855 style_float = "center";
2858 style_float = apr_pstrdup(doc->pool,tmp);
2863 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2864 char *tmp = apr_pstrdup(doc->pool, cur->value);
2865 char *tmpp = strstr(tmp, "px");
2867 attr_width = apr_pstrdup(doc->pool, tmp);
2870 tmpp = strstr(tmp, "%");
2872 attr_width = apr_pstrdup(doc->pool, tmp);
2877 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2878 char *tmp = apr_pstrdup(doc->pool, cur->value);
2880 style_border_color = apr_pstrdup(doc->pool, tmp);
2898 if (attr_size || attr_width || attr_noshade || style_border_color) {
2903 if (!strstr(attr_size, "px")) {
2911 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2917 W_L("border-style:solid;");
2919 if(style_border_color){
2920 W_L("border-color:");
2921 W_V(style_border_color);
2939 * It is a handler who processes the HR tag.
2941 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
2942 * destination is specified.
2943 * @param node [i] The HR tag node is specified.
2944 * @return The conversion result is returned.
2947 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2949 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2955 * It is a handler who processes the IMG tag.
2957 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2958 * destination is specified.
2959 * @param node [i] The IMG tag node is specified.
2960 * @return The conversion result is returned.
2963 s_jxhtml_start_img_tag(void *pdoc, Node *node)
2965 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2966 Doc *doc = jxhtml->doc;
2967 request_rec *r = doc->r;
2969 char *attr_src = NULL;
2970 char *attr_height = NULL;
2971 char *attr_width = NULL;
2972 char *attr_align = NULL;
2973 char *attr_alt = NULL;
2974 char *attr_style = NULL;
2975 char *attr_hspace = NULL;
2976 char *attr_vspace = NULL;
2978 char *css_float = NULL;
2979 char *css_margin_left = NULL;
2980 char *css_margin_right = NULL;
2981 char *css_margin_top = NULL;
2982 char *css_margin_bottom = NULL;
2983 char *css_display = NULL;
2984 char *css_valign = NULL;
2986 #ifndef IMG_NOT_CONVERT_FILENAME
2987 device_table *spec = jxhtml->spec;
2990 /*--------------------------------------------------------------------------*/
2991 /* Get Attributes */
2992 /*--------------------------------------------------------------------------*/
2993 for (attr = qs_get_attr(doc,node);
2995 attr = qs_get_next_attr(doc,attr)) {
2996 char *name = qs_get_attr_name(doc,attr);
2997 char *value = qs_get_attr_value(doc,attr);
2998 if (STRCASEEQ('s','S',"src",name)) {
2999 /*----------------------------------------------------------------------*/
3001 /*----------------------------------------------------------------------*/
3002 #ifdef IMG_NOT_CONVERT_FILENAME
3003 value = chxj_encoding_parameter(r, value, 1);
3004 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3005 value = chxj_add_cookie_no_update_parameter(r, value);
3008 value = chxj_img_conv(r, spec, value);
3009 value = chxj_encoding_parameter(r, value, 1);
3010 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3011 value = chxj_add_cookie_no_update_parameter(r, value);
3015 else if (STRCASEEQ('a','A',"align",name)) {
3016 /*----------------------------------------------------------------------*/
3018 /*----------------------------------------------------------------------*/
3020 if (STRCASEEQ('t','T',"top", value) ||
3021 STRCASEEQ('m','M',"middle",value) ||
3022 STRCASEEQ('b','B',"bottom",value)){
3024 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3027 else if (STRCASEEQ('c','C',"center",value)) {
3028 css_valign = apr_pstrdup(doc->pool, "middle");
3032 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3033 /*----------------------------------------------------------------------*/
3035 /*----------------------------------------------------------------------*/
3038 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3039 /*----------------------------------------------------------------------*/
3041 /*----------------------------------------------------------------------*/
3042 attr_height = value;
3044 else if (STRCASEEQ('h','H',"hspace",name)) {
3045 /*----------------------------------------------------------------------*/
3047 /*----------------------------------------------------------------------*/
3048 attr_hspace = value;
3050 else if (STRCASEEQ('v','V',"vspace",name)) {
3051 /*----------------------------------------------------------------------*/
3053 /*----------------------------------------------------------------------*/
3054 attr_vspace = value;
3056 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3057 /*----------------------------------------------------------------------*/
3059 /*----------------------------------------------------------------------*/
3062 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3063 /*----------------------------------------------------------------------*/
3065 /*----------------------------------------------------------------------*/
3070 if (IS_CSS_ON(jxhtml->entryp)) {
3071 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3073 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3074 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3075 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3076 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3077 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3078 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3079 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3082 css_property_t *cur;
3083 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3084 attr_height = apr_pstrdup(doc->pool, cur->value);
3086 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3087 attr_width = apr_pstrdup(doc->pool, cur->value);
3090 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3091 css_valign = apr_pstrdup(doc->pool, cur->value);
3094 if (! attr_hspace) {
3095 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3096 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3098 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3099 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3102 if (! attr_vspace) {
3103 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3104 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3106 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3107 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3111 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3112 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3113 css_float = apr_pstrdup(doc->pool, cur->value);
3117 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3118 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3119 char *tmp = apr_pstrdup(doc->pool, cur->value);
3120 char *tmpp = strstr(tmp, "none");
3122 css_display = apr_pstrdup(doc->pool, tmp);
3134 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3142 W_L("vertical-align:");
3147 W_L("margin-left:");
3150 W_L("margin-right:");
3155 if(css_margin_left){
3156 W_L("margin-left:");
3157 W_V(css_margin_left);
3160 if(css_margin_right){
3161 W_L("margin-right:");
3162 W_V(css_margin_right);
3170 W_L("margin-bottom:");
3177 W_V(css_margin_top);
3180 if(css_margin_bottom){
3181 W_L("margin-bottom:");
3182 W_V(css_margin_bottom);
3187 W_L("display:none;");
3216 * It is a handler who processes the IMG tag.
3218 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3219 * destination is specified.
3220 * @param node [i] The IMG tag node is specified.
3221 * @return The conversion result is returned.
3224 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3226 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3232 * It is a handler who processes the SELECT tag.
3234 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3235 * destination is specified.
3236 * @param node [i] The SELECT tag node is specified.
3237 * @return The conversion result is returned.
3240 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3242 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3243 Doc *doc = jxhtml->doc;
3247 char *multiple = NULL;
3248 char *attr_style = NULL;
3251 for (attr = qs_get_attr(doc,node);
3253 attr = qs_get_next_attr(doc,attr)) {
3254 char *nm = qs_get_attr_name(doc,attr);
3255 char *val = qs_get_attr_value(doc,attr);
3256 if (STRCASEEQ('s','S',"size",nm)) {
3257 /*----------------------------------------------------------------------*/
3258 /* CHTML 1.0 version 2.0 */
3259 /*----------------------------------------------------------------------*/
3260 size = apr_pstrdup(doc->buf.pool, val);
3262 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3263 /*----------------------------------------------------------------------*/
3264 /* CHTML 1.0 version 2.0 */
3265 /*----------------------------------------------------------------------*/
3266 attr_style = apr_pstrdup(doc->buf.pool, val);
3268 else if (STRCASEEQ('n','N',"name",nm)) {
3269 /*----------------------------------------------------------------------*/
3270 /* CHTML 1.0 version 2.0 */
3271 /*----------------------------------------------------------------------*/
3272 name = apr_pstrdup(doc->buf.pool, val);
3274 else if (STRCASEEQ('m','M',"multiple", nm)) {
3275 /*----------------------------------------------------------------------*/
3276 /* CHTML 1.0 version 2.0 */
3277 /*----------------------------------------------------------------------*/
3278 multiple = apr_pstrdup(doc->buf.pool, val);
3281 if (size && *size) {
3286 if (name && *name) {
3296 if (IS_CSS_ON(jxhtml->entryp)) {
3297 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3305 * It is a handler who processes the SELECT tag.
3307 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3308 * destination is specified.
3309 * @param node [i] The SELECT tag node is specified.
3310 * @return The conversion result is returned.
3313 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3315 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3316 Doc *doc = jxhtml->doc;
3319 if (IS_CSS_ON(jxhtml->entryp)) {
3320 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3327 * It is a handler who processes the OPTION tag.
3329 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3330 * destination is specified.
3331 * @param node [i] The OPTION tag node is specified.
3332 * @return The conversion result is returned.
3335 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3337 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3338 Doc *doc = jxhtml->doc;
3341 char *selected = NULL;
3343 char *attr_style = NULL;
3346 for (attr = qs_get_attr(doc,node);
3348 attr = qs_get_next_attr(doc,attr)) {
3349 char *nm = qs_get_attr_name(doc,attr);
3350 char *val = qs_get_attr_value(doc,attr);
3351 if (STRCASEEQ('s','S',"selected",nm)) {
3352 /*----------------------------------------------------------------------*/
3353 /* CHTML 1.0 version 2.0 */
3354 /*----------------------------------------------------------------------*/
3355 selected = apr_pstrdup(doc->buf.pool, val);
3357 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3358 /*----------------------------------------------------------------------*/
3359 /* CHTML 1.0 version 2.0 */
3360 /*----------------------------------------------------------------------*/
3361 attr_style = apr_pstrdup(doc->buf.pool, val);
3363 else if (STRCASEEQ('v','V',"value",nm)) {
3364 /*----------------------------------------------------------------------*/
3365 /* CHTML 1.0 version 2.0 */
3366 /*----------------------------------------------------------------------*/
3367 value = apr_pstrdup(doc->buf.pool, val);
3380 if (IS_CSS_ON(jxhtml->entryp)) {
3381 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3389 * It is a handler who processes the OPTION tag.
3391 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3392 * destination is specified.
3393 * @param node [i] The OPTION tag node is specified.
3394 * @return The conversion result is returned.
3397 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3399 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3400 Doc *doc = jxhtml->doc;
3403 if (IS_CSS_ON(jxhtml->entryp)) {
3404 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3412 * It is a handler who processes the DIV tag.
3414 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3415 * destination is specified.
3416 * @param node [i] The DIV tag node is specified.
3417 * @return The conversion result is returned.
3420 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3426 char *attr_style = NULL;
3427 char *attr_align = NULL;
3428 char *attr_display = NULL;
3429 char *attr_decoration = NULL;
3430 char *attr_wap_marquee_style = NULL;
3431 char *attr_wap_marquee_dir = NULL;
3432 char *attr_wap_marquee_loop = NULL;
3433 char *attr_color = NULL;
3434 char *attr_bgcolor = NULL;
3435 char *attr_font_size = NULL;
3436 char *css_clear = NULL;
3438 jxhtml = GET_JXHTML(pdoc);
3442 for (attr = qs_get_attr(doc,node);
3444 attr = qs_get_next_attr(doc,attr)) {
3445 char *nm = qs_get_attr_name(doc,attr);
3446 char *val = qs_get_attr_value(doc,attr);
3447 if (STRCASEEQ('a','A',"align",nm)) {
3448 /*----------------------------------------------------------------------*/
3449 /* CHTML 1.0 (W3C version 3.2) */
3450 /*----------------------------------------------------------------------*/
3451 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3452 attr_align = apr_pstrdup(doc->buf.pool, val);
3455 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3456 attr_style = apr_pstrdup(doc->buf.pool, val);
3460 if (IS_CSS_ON(jxhtml->entryp)) {
3461 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3463 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3464 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3465 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3466 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3467 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3468 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3469 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3470 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3472 css_property_t *cur;
3473 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3474 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3475 attr_display = apr_pstrdup(doc->pool, cur->value);
3478 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3479 if (STRCASEEQ('b','B',"blink", cur->value)) {
3480 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3483 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3484 attr_color = apr_pstrdup(doc->pool, cur->value);
3486 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3487 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3488 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3490 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3491 char *ss = strchr(cur->value, '#');
3493 ss = strstr(cur->value, "rgb");
3496 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3497 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3500 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3501 attr_align = apr_pstrdup(doc->pool, cur->value);
3503 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3504 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3505 || STRCASEEQ('x','X',"x-small",cur->value)
3506 || STRCASEEQ('s','S',"small",cur->value)
3507 || STRCASEEQ('m','M',"medium",cur->value)
3508 || STRCASEEQ('l','L',"large",cur->value)
3509 || STRCASEEQ('x','X',"x-large",cur->value)
3510 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3511 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3515 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3516 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3517 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3518 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3519 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3520 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3523 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3524 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3525 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3527 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3528 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3531 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3532 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
3533 attr_wap_marquee_loop = "infinite";
3536 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3540 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3541 css_clear = apr_pstrdup(doc->pool, cur->value);
3549 || attr_wap_marquee_style
3550 || attr_wap_marquee_dir
3551 || attr_wap_marquee_loop
3567 if (attr_decoration) {
3568 W_L("text-decoration:");
3569 W_V(attr_decoration);
3572 if (attr_wap_marquee_style) {
3573 W_L("-wap-marquee-style:");
3574 W_V(attr_wap_marquee_style);
3577 if (attr_wap_marquee_dir) {
3578 W_L("-wap-marquee-dir:");
3579 W_V(attr_wap_marquee_dir);
3582 if (attr_wap_marquee_loop) {
3583 W_L("-wap-marquee-loop:");
3584 W_V(attr_wap_marquee_loop);
3593 W_L("background-color:");
3597 if (attr_font_size) {
3599 W_V(attr_font_size);
3615 * It is a handler who processes the DIV tag.
3617 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3618 * destination is specified.
3619 * @param node [i] The DIV tag node is specified.
3620 * @return The conversion result is returned.
3623 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
3629 jxhtml = GET_JXHTML(pdoc);
3634 if (IS_CSS_ON(jxhtml->entryp)) {
3635 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3642 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
3649 jxhtml = GET_JXHTML(pdoc);
3653 for (child = qs_get_child_node(doc, node);
3655 child = qs_get_next_node(doc, child)) {
3657 s_jxhtml_chxjif_tag(jxhtml, child);
3664 * It is a handler who processes the TEXTARE tag.
3666 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3667 * destination is specified.
3668 * @param node [i] The TEXTAREA tag node is specified.
3669 * @return The conversion result is returned.
3672 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
3678 char *attr_accesskey = NULL;
3679 char *attr_name = NULL;
3680 char *attr_rows = NULL;
3681 char *attr_cols = NULL;
3682 char *attr_istyle = NULL;
3683 char *attr_style = NULL;
3686 jxhtml = GET_JXHTML(pdoc);
3690 jxhtml->textarea_flag++;
3691 for (attr = qs_get_attr(doc,node);
3693 attr = qs_get_next_attr(doc,attr)) {
3694 char *name = qs_get_attr_name(doc,attr);
3695 char *value = qs_get_attr_value(doc,attr);
3696 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3697 attr_accesskey = value;
3699 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3700 attr_istyle = value;
3702 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3705 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3708 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3711 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3715 if (IS_CSS_ON(jxhtml->entryp)) {
3716 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3718 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3719 css_property_t *cur;
3720 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3721 if (strcasestr(cur->value, "<ja:n>")) {
3724 else if (strcasestr(cur->value, "<ja:en>")) {
3727 else if (strcasestr(cur->value, "<ja:hk>")) {
3730 else if (strcasestr(cur->value, "<ja:h>")) {
3737 if (attr_accesskey) {
3738 W_L(" accesskey=\"");
3739 W_V(attr_accesskey);
3758 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
3760 W_L("-wap-input-format:"*");
3771 * It is a handler who processes the TEXTAREA tag.
3773 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3774 * destination is specified.
3775 * @param node [i] The TEXTAREA tag node is specified.
3776 * @return The conversion result is returned.
3779 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3785 jxhtml = GET_JXHTML(pdoc);
3790 jxhtml->textarea_flag--;
3797 * It is a handler who processes the B tag.
3799 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3800 * destination is specified.
3801 * @param node [i] The B tag node is specified.
3802 * @return The conversion result is returned.
3805 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3811 jxhtml = GET_JXHTML(pdoc);
3821 * It is a handler who processes the B tag.
3823 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3824 * destination is specified.
3825 * @param node [i] The B tag node is specified.
3826 * @return The conversion result is returned.
3829 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3831 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
3832 Doc* doc = jxhtml->doc;
3839 s_jxhtml_text_tag(void* pdoc, Node* child)
3850 apr_size_t z2h_input_len;
3852 jxhtml = GET_JXHTML(pdoc);
3856 textval = qs_get_node_value(doc,child);
3857 if (strlen(textval) == 0) {
3861 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3862 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3864 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3865 memset(one_byte, 0, sizeof(one_byte));
3868 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3870 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
3872 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3877 if (is_sjis_kanji(textval[ii])) {
3878 one_byte[0] = textval[ii+0];
3879 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3880 one_byte[0] = textval[ii+1];
3881 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3885 if (jxhtml->pre_flag) {
3886 one_byte[0] = textval[ii+0];
3887 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3890 if (jxhtml->textarea_flag) {
3891 one_byte[0] = textval[ii+0];
3892 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3895 if (textval[ii] != '\r' && textval[ii] != '\n') {
3896 one_byte[0] = textval[ii+0];
3897 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3901 z2h_input_len = strlen(tdst);
3902 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
3910 * It is a handler who processes the BLOCKQUOTE tag.
3912 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3913 * destination is specified.
3914 * @param node [i] The BLOCKQUOTE tag node is specified.
3915 * @return The conversion result is returned.
3918 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
3923 char *attr_style = NULL;
3924 char *attr_color = NULL;
3925 char *attr_size = NULL;
3927 jxhtml = GET_JXHTML(pdoc);
3929 for (attr = qs_get_attr(doc,node);
3931 attr = qs_get_next_attr(doc,attr)) {
3932 char *nm = qs_get_attr_name(doc,attr);
3933 char *val = qs_get_attr_value(doc,attr);
3934 if (val && STRCASEEQ('s','S',"style", nm)) {
3938 if (IS_CSS_ON(jxhtml->entryp)) {
3939 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3941 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3942 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3943 css_property_t *cur;
3944 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3945 if (cur->value && *cur->value) {
3946 attr_color = apr_pstrdup(doc->pool, cur->value);
3949 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3950 if (cur->value && *cur->value) {
3951 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3952 attr_size = apr_pstrdup(doc->pool, cur->value);
3954 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3955 attr_size = apr_pstrdup(doc->pool, cur->value);
3957 else if (STRCASEEQ('s','S',"small",cur->value)) {
3958 attr_size = apr_pstrdup(doc->pool, cur->value);
3960 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3961 attr_size = apr_pstrdup(doc->pool, cur->value);
3963 else if (STRCASEEQ('l','L',"large",cur->value)) {
3964 attr_size = apr_pstrdup(doc->pool, cur->value);
3966 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3967 attr_size = apr_pstrdup(doc->pool, cur->value);
3969 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3970 attr_size = apr_pstrdup(doc->pool, cur->value);
3977 if (attr_color || attr_size) {
3980 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3998 * It is a handler who processes the BLOCKQUOTE tag.
4000 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4001 * destination is specified.
4002 * @param node [i] The BLOCKQUOTE tag node is specified.
4003 * @return The conversion result is returned.
4006 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4008 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4009 Doc *doc = jxhtml->doc;
4010 W_L("</blockquote>");
4011 if (IS_CSS_ON(jxhtml->entryp)) {
4012 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4019 * It is a handler who processes the DIR tag.
4021 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4022 * destination is specified.
4023 * @param node [i] The DIR tag node is specified.
4024 * @return The conversion result is returned.
4027 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4029 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4030 Doc *doc = jxhtml->doc;
4032 char *attr_style = NULL;
4033 char *attr_color = NULL;
4034 char *attr_type = NULL;
4035 char *attr_size = NULL;
4036 for (attr = qs_get_attr(doc,node);
4038 attr = qs_get_next_attr(doc,attr)) {
4039 char *name = qs_get_attr_name(doc,attr);
4040 char *value = qs_get_attr_value(doc,attr);
4041 if (STRCASEEQ('t','T',"type",name)) {
4042 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4046 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4050 if (IS_CSS_ON(jxhtml->entryp)) {
4051 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4053 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4054 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4055 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4056 css_property_t *cur;
4057 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4058 if (cur->value && *cur->value) {
4059 attr_color = apr_pstrdup(doc->pool, cur->value);
4062 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4063 if (cur->value && *cur->value) {
4064 attr_type = apr_pstrdup(doc->pool, cur->value);
4067 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4068 if (cur->value && *cur->value) {
4069 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4070 attr_size = apr_pstrdup(doc->pool, cur->value);
4072 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4073 attr_size = apr_pstrdup(doc->pool, cur->value);
4075 else if (STRCASEEQ('s','S',"small",cur->value)) {
4076 attr_size = apr_pstrdup(doc->pool, cur->value);
4078 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4079 attr_size = apr_pstrdup(doc->pool, cur->value);
4081 else if (STRCASEEQ('l','L',"large",cur->value)) {
4082 attr_size = apr_pstrdup(doc->pool, cur->value);
4084 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4085 attr_size = apr_pstrdup(doc->pool, cur->value);
4087 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4088 attr_size = apr_pstrdup(doc->pool, cur->value);
4095 if (attr_type || attr_color || attr_size) {
4098 W_L("list-style-type:");
4103 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4121 * It is a handler who processes the DIR tag.
4123 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4124 * destination is specified.
4125 * @param node [i] The DIR tag node is specified.
4126 * @return The conversion result is returned.
4129 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4131 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4132 Doc *doc = jxhtml->doc;
4134 if (IS_CSS_ON(jxhtml->entryp)) {
4135 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4142 * It is a handler who processes the DL tag.
4144 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4145 * destination is specified.
4146 * @param node [i] The DL tag node is specified.
4147 * @return The conversion result is returned.
4150 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4152 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4153 Doc *doc = jxhtml->doc;
4155 char *attr_style = NULL;
4156 char *attr_color = NULL;
4157 char *attr_size = NULL;
4158 for (attr = qs_get_attr(doc,node);
4160 attr = qs_get_next_attr(doc,attr)) {
4161 char *name = qs_get_attr_name(doc,attr);
4162 char *value = qs_get_attr_value(doc,attr);
4163 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4167 if (IS_CSS_ON(jxhtml->entryp)) {
4168 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4170 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4171 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4172 css_property_t *cur;
4173 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4174 if (cur->value && *cur->value) {
4175 attr_color = apr_pstrdup(doc->pool, cur->value);
4178 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4179 if (cur->value && *cur->value) {
4180 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4181 attr_size = apr_pstrdup(doc->pool, cur->value);
4183 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4184 attr_size = apr_pstrdup(doc->pool, cur->value);
4186 else if (STRCASEEQ('s','S',"small",cur->value)) {
4187 attr_size = apr_pstrdup(doc->pool, cur->value);
4189 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4190 attr_size = apr_pstrdup(doc->pool, cur->value);
4192 else if (STRCASEEQ('l','L',"large",cur->value)) {
4193 attr_size = apr_pstrdup(doc->pool, cur->value);
4195 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4196 attr_size = apr_pstrdup(doc->pool, cur->value);
4198 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4199 attr_size = apr_pstrdup(doc->pool, cur->value);
4206 if (attr_color || attr_size) {
4209 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4227 * It is a handler who processes the DL tag.
4229 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4230 * destination is specified.
4231 * @param node [i] The DL tag node is specified.
4232 * @return The conversion result is returned.
4235 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4237 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4238 Doc *doc = jxhtml->doc;
4240 if (IS_CSS_ON(jxhtml->entryp)) {
4241 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4248 * It is a handler who processes the DT tag.
4250 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4251 * destination is specified.
4252 * @param node [i] The DT tag node is specified.
4253 * @return The conversion result is returned.
4256 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4258 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4259 Doc *doc = jxhtml->doc;
4261 char *attr_style = NULL;
4262 char *attr_color = NULL;
4263 char *attr_size = NULL;
4264 for (attr = qs_get_attr(doc,node);
4266 attr = qs_get_next_attr(doc,attr)) {
4267 char *name = qs_get_attr_name(doc,attr);
4268 char *value = qs_get_attr_value(doc,attr);
4269 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4273 if (IS_CSS_ON(jxhtml->entryp)) {
4274 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4276 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4277 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4278 css_property_t *cur;
4279 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4280 if (cur->value && *cur->value) {
4281 attr_color = apr_pstrdup(doc->pool, cur->value);
4284 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4285 if (cur->value && *cur->value) {
4286 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4287 attr_size = apr_pstrdup(doc->pool, cur->value);
4289 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4290 attr_size = apr_pstrdup(doc->pool, cur->value);
4292 else if (STRCASEEQ('s','S',"small",cur->value)) {
4293 attr_size = apr_pstrdup(doc->pool, cur->value);
4295 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4296 attr_size = apr_pstrdup(doc->pool, cur->value);
4298 else if (STRCASEEQ('l','L',"large",cur->value)) {
4299 attr_size = apr_pstrdup(doc->pool, cur->value);
4301 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4302 attr_size = apr_pstrdup(doc->pool, cur->value);
4304 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4305 attr_size = apr_pstrdup(doc->pool, cur->value);
4312 if (attr_color || attr_size) {
4315 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4333 * It is a handler who processes the DT tag.
4335 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4336 * destination is specified.
4337 * @param node [i] The DT tag node is specified.
4338 * @return The conversion result is returned.
4341 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4343 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4344 Doc *doc = jxhtml->doc;
4346 if (IS_CSS_ON(jxhtml->entryp)) {
4347 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4354 * It is a handler who processes the DD tag.
4356 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4357 * destination is specified.
4358 * @param node [i] The DD tag node is specified.
4359 * @return The conversion result is returned.
4362 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4364 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4365 Doc *doc = jxhtml->doc;
4367 char *attr_style = NULL;
4368 char *attr_color = NULL;
4369 char *attr_size = NULL;
4370 for (attr = qs_get_attr(doc,node);
4372 attr = qs_get_next_attr(doc,attr)) {
4373 char *name = qs_get_attr_name(doc,attr);
4374 char *value = qs_get_attr_value(doc,attr);
4375 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4379 if (IS_CSS_ON(jxhtml->entryp)) {
4380 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4382 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4383 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4384 css_property_t *cur;
4385 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4386 if (cur->value && *cur->value) {
4387 attr_color = apr_pstrdup(doc->pool, cur->value);
4390 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4391 if (cur->value && *cur->value) {
4392 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4393 attr_size = apr_pstrdup(doc->pool, cur->value);
4395 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4396 attr_size = apr_pstrdup(doc->pool, cur->value);
4398 else if (STRCASEEQ('s','S',"small",cur->value)) {
4399 attr_size = apr_pstrdup(doc->pool, cur->value);
4401 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4402 attr_size = apr_pstrdup(doc->pool, cur->value);
4404 else if (STRCASEEQ('l','L',"large",cur->value)) {
4405 attr_size = apr_pstrdup(doc->pool, cur->value);
4407 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4408 attr_size = apr_pstrdup(doc->pool, cur->value);
4410 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4411 attr_size = apr_pstrdup(doc->pool, cur->value);
4418 if (attr_color || attr_size) {
4421 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4439 * It is a handler who processes the DD tag.
4441 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4442 * destination is specified.
4443 * @param node [i] The DD tag node is specified.
4444 * @return The conversion result is returned.
4447 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4449 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4450 Doc *doc = jxhtml->doc;
4452 if (IS_CSS_ON(jxhtml->entryp)) {
4453 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4460 * It is a handler who processes the H1 tag.
4462 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4463 * destination is specified.
4464 * @param node [i] The H1 tag node is specified.
4465 * @return The conversion result is returned.
4468 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4474 char *attr_style = NULL;
4475 char *attr_align = NULL;
4477 jxhtml = GET_JXHTML(pdoc);
4481 for (attr = qs_get_attr(doc,node);
4483 attr = qs_get_next_attr(doc,attr)) {
4484 char *name = qs_get_attr_name(doc,attr);
4485 char *value = qs_get_attr_value(doc,attr);
4486 if (STRCASEEQ('a','A',"align", name)) {
4487 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4491 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4495 if (IS_CSS_ON(jxhtml->entryp)) {
4496 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4498 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4499 css_property_t *cur;
4500 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4501 if (STRCASEEQ('l','L',"left", cur->value)) {
4502 attr_align = apr_pstrdup(doc->pool, "left");
4504 else if (STRCASEEQ('c','C',"center",cur->value)) {
4505 attr_align = apr_pstrdup(doc->pool, "center");
4507 else if (STRCASEEQ('r','R',"right",cur->value)) {
4508 attr_align = apr_pstrdup(doc->pool, "right");
4515 W_L("font-size:xx-large;");
4528 * It is a handler who processes the H1 tag.
4530 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4531 * destination is specified.
4532 * @param node [i] The H1 tag node is specified.
4533 * @return The conversion result is returned.
4536 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4542 jxhtml = GET_JXHTML(pdoc);
4547 if (IS_CSS_ON(jxhtml->entryp)) {
4548 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4556 * It is a handler who processes the H2 tag.
4558 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4559 * destination is specified.
4560 * @param node [i] The H1 tag node is specified.
4561 * @return The conversion result is returned.
4564 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
4570 char *attr_style = NULL;
4571 char *attr_align = NULL;
4573 jxhtml = GET_JXHTML(pdoc);
4577 for (attr = qs_get_attr(doc,node);
4579 attr = qs_get_next_attr(doc,attr)) {
4580 char *name = qs_get_attr_name(doc,attr);
4581 char *value = qs_get_attr_value(doc,attr);
4582 if (STRCASEEQ('a','A',"align", name)) {
4583 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4587 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4591 if (IS_CSS_ON(jxhtml->entryp)) {
4592 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4594 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4595 css_property_t *cur;
4596 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4597 if (STRCASEEQ('l','L',"left", cur->value)) {
4598 attr_align = apr_pstrdup(doc->pool, "left");
4600 else if (STRCASEEQ('c','C',"center",cur->value)) {
4601 attr_align = apr_pstrdup(doc->pool, "center");
4603 else if (STRCASEEQ('r','R',"right",cur->value)) {
4604 attr_align = apr_pstrdup(doc->pool, "right");
4611 W_L("font-size:x-large;");
4624 * It is a handler who processes the H2 tag.
4626 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4627 * destination is specified.
4628 * @param node [i] The H1 tag node is specified.
4629 * @return The conversion result is returned.
4632 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
4638 jxhtml = GET_JXHTML(pdoc);
4643 if (IS_CSS_ON(jxhtml->entryp)) {
4644 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4651 * It is a handler who processes the H3 tag.
4653 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4654 * destination is specified.
4655 * @param node [i] The H1 tag node is specified.
4656 * @return The conversion result is returned.
4659 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
4665 char *attr_style = NULL;
4666 char *attr_align = NULL;
4668 jxhtml = GET_JXHTML(pdoc);
4672 for (attr = qs_get_attr(doc,node);
4674 attr = qs_get_next_attr(doc,attr)) {
4675 char *name = qs_get_attr_name(doc,attr);
4676 char *value = qs_get_attr_value(doc,attr);
4677 if (STRCASEEQ('a','A',"align", name)) {
4678 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4682 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4686 if (IS_CSS_ON(jxhtml->entryp)) {
4687 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4689 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4690 css_property_t *cur;
4691 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4692 if (STRCASEEQ('l','L',"left", cur->value)) {
4693 attr_align = apr_pstrdup(doc->pool, "left");
4695 else if (STRCASEEQ('c','C',"center",cur->value)) {
4696 attr_align = apr_pstrdup(doc->pool, "center");
4698 else if (STRCASEEQ('r','R',"right",cur->value)) {
4699 attr_align = apr_pstrdup(doc->pool, "right");
4706 W_L("font-size:large;");
4719 * It is a handler who processes the H3 tag.
4721 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4722 * destination is specified.
4723 * @param node [i] The H1 tag node is specified.
4724 * @return The conversion result is returned.
4727 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
4733 jxhtml = GET_JXHTML(pdoc);
4738 if (IS_CSS_ON(jxhtml->entryp)) {
4739 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4746 * It is a handler who processes the H4 tag.
4748 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4749 * destination is specified.
4750 * @param node [i] The H1 tag node is specified.
4751 * @return The conversion result is returned.
4754 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
4760 char *attr_style = NULL;
4761 char *attr_align = NULL;
4763 jxhtml = GET_JXHTML(pdoc);
4767 for (attr = qs_get_attr(doc,node);
4769 attr = qs_get_next_attr(doc,attr)) {
4770 char *name = qs_get_attr_name(doc,attr);
4771 char *value = qs_get_attr_value(doc,attr);
4772 if (STRCASEEQ('a','A',"align", name)) {
4773 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4777 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4781 if (IS_CSS_ON(jxhtml->entryp)) {
4782 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4784 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4785 css_property_t *cur;
4786 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4787 if (STRCASEEQ('l','L',"left", cur->value)) {
4788 attr_align = apr_pstrdup(doc->pool, "left");
4790 else if (STRCASEEQ('c','C',"center",cur->value)) {
4791 attr_align = apr_pstrdup(doc->pool, "center");
4793 else if (STRCASEEQ('r','R',"right",cur->value)) {
4794 attr_align = apr_pstrdup(doc->pool, "right");
4801 W_L("font-size:small;");
4814 * It is a handler who processes the H4 tag.
4816 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4817 * destination is specified.
4818 * @param node [i] The H1 tag node is specified.
4819 * @return The conversion result is returned.
4822 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
4828 jxhtml = GET_JXHTML(pdoc);
4833 if (IS_CSS_ON(jxhtml->entryp)) {
4834 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4842 * It is a handler who processes the H5 tag.
4844 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4845 * destination is specified.
4846 * @param node [i] The H1 tag node is specified.
4847 * @return The conversion result is returned.
4850 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
4856 char *attr_style = NULL;
4857 char *attr_align = NULL;
4859 jxhtml = GET_JXHTML(pdoc);
4863 for (attr = qs_get_attr(doc,node);
4865 attr = qs_get_next_attr(doc,attr)) {
4866 char *name = qs_get_attr_name(doc,attr);
4867 char *value = qs_get_attr_value(doc,attr);
4868 if (STRCASEEQ('a','A',"align", name)) {
4869 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4873 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4877 if (IS_CSS_ON(jxhtml->entryp)) {
4878 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4880 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4881 css_property_t *cur;
4882 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4883 if (STRCASEEQ('l','L',"left", cur->value)) {
4884 attr_align = apr_pstrdup(doc->pool, "left");
4886 else if (STRCASEEQ('c','C',"center",cur->value)) {
4887 attr_align = apr_pstrdup(doc->pool, "center");
4889 else if (STRCASEEQ('r','R',"right",cur->value)) {
4890 attr_align = apr_pstrdup(doc->pool, "right");
4897 W_L("font-size:x-small;");
4910 * It is a handler who processes the H5 tag.
4912 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4913 * destination is specified.
4914 * @param node [i] The H1 tag node is specified.
4915 * @return The conversion result is returned.
4918 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
4924 jxhtml = GET_JXHTML(pdoc);
4929 if (IS_CSS_ON(jxhtml->entryp)) {
4930 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4938 * It is a handler who processes the H6 tag.
4940 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4941 * destination is specified.
4942 * @param node [i] The H1 tag node is specified.
4943 * @return The conversion result is returned.
4946 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
4952 char *attr_style = NULL;
4953 char *attr_align = NULL;
4955 jxhtml = GET_JXHTML(pdoc);
4959 for (attr = qs_get_attr(doc,node);
4961 attr = qs_get_next_attr(doc,attr)) {
4962 char *name = qs_get_attr_name(doc,attr);
4963 char *value = qs_get_attr_value(doc,attr);
4964 if (STRCASEEQ('a','A',"align", name)) {
4965 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4969 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4973 if (IS_CSS_ON(jxhtml->entryp)) {
4974 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4976 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4977 css_property_t *cur;
4978 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4979 if (STRCASEEQ('l','L',"left", cur->value)) {
4980 attr_align = apr_pstrdup(doc->pool, "left");
4982 else if (STRCASEEQ('c','C',"center",cur->value)) {
4983 attr_align = apr_pstrdup(doc->pool, "center");
4985 else if (STRCASEEQ('r','R',"right",cur->value)) {
4986 attr_align = apr_pstrdup(doc->pool, "right");
4993 W_L("font-size:xx-small;");
5006 * It is a handler who processes the H6 tag.
5008 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5009 * destination is specified.
5010 * @param node [i] The H1 tag node is specified.
5011 * @return The conversion result is returned.
5014 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5020 jxhtml = GET_JXHTML(pdoc);
5025 if (IS_CSS_ON(jxhtml->entryp)) {
5026 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5034 * It is a handler who processes the MENU tag.
5036 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5037 * destination is specified.
5038 * @param node [i] The MENU tag node is specified.
5039 * @return The conversion result is returned.
5042 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5044 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5045 Doc *doc = jxhtml->doc;
5047 char *attr_style = NULL;
5048 char *attr_color = NULL;
5049 char *attr_type = NULL;
5050 char *attr_size = NULL;
5051 for (attr = qs_get_attr(doc,node);
5053 attr = qs_get_next_attr(doc,attr)) {
5054 char *name = qs_get_attr_name(doc,attr);
5055 char *value = qs_get_attr_value(doc,attr);
5056 if (STRCASEEQ('t','T',"type",name)) {
5057 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5061 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5065 if (IS_CSS_ON(jxhtml->entryp)) {
5066 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5068 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5069 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5070 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5071 css_property_t *cur;
5072 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5073 if (cur->value && *cur->value) {
5074 attr_color = apr_pstrdup(doc->pool, cur->value);
5077 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5078 if (cur->value && *cur->value) {
5079 attr_type = apr_pstrdup(doc->pool, cur->value);
5082 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5083 if (cur->value && *cur->value) {
5084 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5085 attr_size = apr_pstrdup(doc->pool, cur->value);
5087 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5088 attr_size = apr_pstrdup(doc->pool, cur->value);
5090 else if (STRCASEEQ('s','S',"small",cur->value)) {
5091 attr_size = apr_pstrdup(doc->pool, cur->value);
5093 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5094 attr_size = apr_pstrdup(doc->pool, cur->value);
5096 else if (STRCASEEQ('l','L',"large",cur->value)) {
5097 attr_size = apr_pstrdup(doc->pool, cur->value);
5099 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5100 attr_size = apr_pstrdup(doc->pool, cur->value);
5102 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5103 attr_size = apr_pstrdup(doc->pool, cur->value);
5110 if (attr_type || attr_color || attr_size) {
5113 W_L("list-style-type:");
5118 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5136 * It is a handler who processes the MENU tag.
5138 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5139 * destination is specified.
5140 * @param node [i] The MENU tag node is specified.
5141 * @return The conversion result is returned.
5144 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5146 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5147 Doc *doc = jxhtml->doc;
5149 if (IS_CSS_ON(jxhtml->entryp)) {
5150 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5157 * It is a handler who processes the PLAINTEXT tag.
5159 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5160 * destination is specified.
5161 * @param node [i] The PLAINTEXT tag node is specified.
5162 * @return The conversion result is returned.
5165 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5170 jxhtml = GET_JXHTML(pdoc);
5173 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5178 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5183 jxhtml = GET_JXHTML(pdoc);
5185 for (child = qs_get_child_node(doc, node);
5187 child = qs_get_next_node(doc, child)) {
5189 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5196 * It is a handler who processes the PLAINTEXT tag.
5198 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5199 * destination is specified.
5200 * @param node [i] The PLAINTEXT tag node is specified.
5201 * @return The conversion result is returned.
5204 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5206 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5212 * It is a handler who processes the BLINK tag.
5214 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5215 * destination is specified.
5216 * @param node [i] The BLINK tag node is specified.
5217 * @return The conversion result is returned.
5220 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5222 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5223 Doc *doc = jxhtml->doc;
5225 char *attr_style = NULL;
5226 char *attr_color = NULL;
5227 char *attr_size = NULL;
5228 for (attr = qs_get_attr(doc,node);
5230 attr = qs_get_next_attr(doc,attr)) {
5231 char *name = qs_get_attr_name(doc,attr);
5232 char *value = qs_get_attr_value(doc,attr);
5233 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5237 if (IS_CSS_ON(jxhtml->entryp)) {
5238 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5240 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5241 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5242 css_property_t *cur;
5243 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5244 if (cur->value && *cur->value) {
5245 attr_color = apr_pstrdup(doc->pool, cur->value);
5248 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5249 if (cur->value && *cur->value) {
5250 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5251 attr_size = apr_pstrdup(doc->pool, cur->value);
5253 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5254 attr_size = apr_pstrdup(doc->pool, cur->value);
5256 else if (STRCASEEQ('s','S',"small",cur->value)) {
5257 attr_size = apr_pstrdup(doc->pool, cur->value);
5259 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5260 attr_size = apr_pstrdup(doc->pool, cur->value);
5262 else if (STRCASEEQ('l','L',"large",cur->value)) {
5263 attr_size = apr_pstrdup(doc->pool, cur->value);
5265 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5266 attr_size = apr_pstrdup(doc->pool, cur->value);
5268 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5269 attr_size = apr_pstrdup(doc->pool, cur->value);
5276 if (attr_color || attr_size) {
5279 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5297 * It is a handler who processes the BLINK tag.
5299 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5300 * destination is specified.
5301 * @param node [i] The BLINK tag node is specified.
5302 * @return The conversion result is returned.
5305 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5307 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5308 Doc *doc = jxhtml->doc;
5310 if (IS_CSS_ON(jxhtml->entryp)) {
5311 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5318 * It is a handler who processes the MARQUEE tag.
5320 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5321 * destination is specified.
5322 * @param node [i] The MARQUEE tag node is specified.
5323 * @return The conversion result is returned.
5326 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5328 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5329 Doc *doc = jxhtml->doc;
5331 char *attr_direction = NULL;
5332 char *attr_style = NULL;
5333 char *attr_color = NULL;
5334 char *attr_size = NULL;
5335 char *attr_bgcolor = NULL;
5336 /*--------------------------------------------------------------------------*/
5337 /* Get Attributes */
5338 /*--------------------------------------------------------------------------*/
5339 for (attr = qs_get_attr(doc,node);
5341 attr = qs_get_next_attr(doc,attr)) {
5342 char *name = qs_get_attr_name(doc,attr);
5343 char *value = qs_get_attr_value(doc,attr);
5344 if (STRCASEEQ('d','D',"direction", name)) {
5346 if (STRCASEEQ('l','L',"left",value)) {
5347 attr_direction = "rtl";
5349 else if (STRCASEEQ('r','R',"right",value)) {
5350 attr_direction = "ltr";
5354 else if (STRCASEEQ('b','B',"behavior",name)) {
5357 else if (STRCASEEQ('l','L',"loop",name)) {
5360 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5361 if (value && *value) {
5362 attr_bgcolor = value;
5365 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5369 if (IS_CSS_ON(jxhtml->entryp)) {
5370 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5372 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5373 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5374 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5375 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5376 css_property_t *cur;
5377 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5378 if (cur->value && *cur->value) {
5379 attr_color = apr_pstrdup(doc->pool, cur->value);
5382 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5383 if (cur->value && *cur->value) {
5384 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5387 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5388 if (cur->value && *cur->value) {
5389 attr_direction = apr_pstrdup(doc->pool, cur->value);
5392 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5393 if (cur->value && *cur->value) {
5394 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5395 || STRCASEEQ('x','X',"x-small", cur->value)
5396 || STRCASEEQ('s','S',"small", cur->value)
5397 || STRCASEEQ('m','M',"medium", cur->value)
5398 || STRCASEEQ('l','L',"large", cur->value)
5399 || STRCASEEQ('x','X',"x-large", cur->value)
5400 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5401 attr_size = apr_pstrdup(doc->pool, cur->value);
5408 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5410 if (attr_direction) {
5411 W_L("-wap-marquee-dir:");
5412 W_V(attr_direction);
5416 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5417 W_L("background-color:");
5422 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5441 * It is a handler who processes the MARQUEE tag.
5443 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5444 * destination is specified.
5445 * @param node [i] The MARQUEE tag node is specified.
5446 * @return The conversion result is returned.
5449 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5451 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5452 Doc *doc = jxhtml->doc;
5454 if (IS_CSS_ON(jxhtml->entryp)) {
5455 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5462 * It is handler who processes the New Line Code.
5465 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5467 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5468 if (jxhtml->start_html_flag) {
5469 Doc *doc = jxhtml->doc;
5477 * It is a handler who processes the LINK tag.
5479 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5480 * destination is specified.
5481 * @param node [i] The LINK tag node is specified.
5482 * @return The conversion result is returned.
5485 s_jxhtml_link_tag(void *pdoc, Node *node)
5494 jxhtml = GET_JXHTML(pdoc);
5497 if (! IS_CSS_ON(jxhtml->entryp)) {
5501 for (attr = qs_get_attr(doc,node);
5503 attr = qs_get_next_attr(doc,attr)) {
5504 char *name = qs_get_attr_name(doc,attr);
5505 char *value = qs_get_attr_value(doc,attr);
5506 if (STRCASEEQ('r','R',"rel", name)) {
5507 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5511 else if (STRCASEEQ('h','H',"href", name)) {
5512 if (value && *value) {
5516 else if (STRCASEEQ('t','T',"type", name)) {
5517 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5523 if (rel && href && type) {
5524 DBG(doc->r, "start load CSS. url:[%s]", href);
5525 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
5526 DBG(doc->r, "end load CSS. url:[%s]", href);
5533 static css_prop_list_t *
5534 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5536 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5537 Doc *doc = jxhtml->doc;
5538 css_prop_list_t *last_css = NULL;
5539 if (IS_CSS_ON(jxhtml->entryp)) {
5540 css_prop_list_t *dup_css;
5541 css_selector_t *selector;
5543 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5544 dup_css = chxj_dup_css_prop_list(doc, last_css);
5545 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5547 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5549 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
5550 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5552 if (style_attr_value) {
5553 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));
5555 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5563 static css_prop_list_t *
5564 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5566 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5567 Doc *doc = jxhtml->doc;
5568 css_prop_list_t *last_css = NULL;
5569 if (IS_CSS_ON(jxhtml->entryp)) {
5570 css_prop_list_t *dup_css;
5571 css_selector_t *selector;
5573 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5574 dup_css = chxj_dup_css_prop_list(doc, last_css);
5575 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5577 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5581 if (style_attr_value) {
5582 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));
5584 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5593 * It is a handler who processes the SPAN tag.
5595 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5596 * destination is specified.
5597 * @param node [i] The SPAN tag node is specified.
5598 * @return The conversion result is returned.
5601 s_jxhtml_start_span_tag(void *pdoc, Node *node)
5606 char *attr_style = NULL;
5607 char *attr_color = NULL;
5608 char *attr_size = NULL;
5609 char *attr_align = NULL;
5610 char *attr_blink = NULL;
5611 char *attr_marquee = NULL;
5612 char *attr_marquee_dir = NULL;
5613 char *attr_marquee_style = NULL;
5614 char *attr_marquee_loop = NULL;
5615 char *css_bgcolor = NULL;
5617 jxhtml = GET_JXHTML(pdoc);
5620 for (attr = qs_get_attr(doc,node);
5622 attr = qs_get_next_attr(doc,attr)) {
5623 char *nm = qs_get_attr_name(doc,attr);
5624 char *val = qs_get_attr_value(doc,attr);
5625 if (val && STRCASEEQ('s','S',"style", nm)) {
5629 if (IS_CSS_ON(jxhtml->entryp)) {
5630 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5632 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5633 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5634 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5635 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5636 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5637 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5638 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5639 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5640 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5642 css_property_t *cur;
5643 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5644 attr_color = apr_pstrdup(doc->pool, cur->value);
5646 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5647 if (cur->value && *cur->value) {
5648 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5649 || STRCASEEQ('x','X',"x-small", cur->value)
5650 || STRCASEEQ('s','S',"small", cur->value)
5651 || STRCASEEQ('m','M',"medium", cur->value)
5652 || STRCASEEQ('l','L',"large", cur->value)
5653 || STRCASEEQ('x','X',"x-large", cur->value)
5654 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5655 attr_size = apr_pstrdup(doc->pool, cur->value);
5659 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5660 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5661 attr_blink = apr_pstrdup(doc->pool, cur->value);
5664 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5665 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5666 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5669 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5670 if (cur->value && *cur->value) {
5671 if ( STRCASEEQ('l','L',"ltr",cur->value)
5672 || STRCASEEQ('r','R',"rtl",cur->value)) {
5673 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5677 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5678 if (cur->value && *cur->value) {
5679 if ( STRCASEEQ('s','S',"scroll",cur->value)
5680 || STRCASEEQ('s','S',"slide",cur->value)
5681 || STRCASEEQ('a','A',"alternate",cur->value)) {
5682 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5686 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5687 if (cur->value && *cur->value) {
5688 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
5689 attr_marquee_loop = "infinite";
5692 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5696 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5697 if (STRCASEEQ('l','L',"left", cur->value)) {
5698 attr_align = apr_pstrdup(doc->pool, "left");
5700 else if (STRCASEEQ('c','C',"center",cur->value)) {
5701 attr_align = apr_pstrdup(doc->pool, "center");
5703 else if (STRCASEEQ('r','R',"right",cur->value)) {
5704 attr_align = apr_pstrdup(doc->pool, "right");
5707 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5708 if (cur->value && *cur->value) {
5709 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
5716 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
5719 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5735 W_L("text-decoration:");
5740 W_L("display:-wap-marquee;");
5741 if (attr_marquee_dir) {
5742 W_L("-wap-marquee-dir:");
5743 W_V(attr_marquee_dir);
5746 if (attr_marquee_style) {
5747 W_L("-wap-marquee-style:");
5748 W_V(attr_marquee_style);
5751 if (attr_marquee_loop) {
5752 W_L("-wap-marquee-loop:");
5753 W_V(attr_marquee_loop);
5758 W_L("background-color:");
5770 * It is a handler who processes the SPAN tag.
5772 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5773 * destination is specified.
5774 * @param node [i] The SPAN tag node is specified.
5775 * @return The conversion result is returned.
5778 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
5780 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5781 Doc *doc = jxhtml->doc;
5784 if (IS_CSS_ON(jxhtml->entryp)) {
5785 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5792 * It is a handler who processes the STYLE tag.
5794 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
5795 * destination is specified.
5796 * @param node [i] The STYLE tag node is specified.
5797 * @return The conversion result is returned.
5800 s_jxhtml_style_tag(void *pdoc, Node *node)
5807 jxhtml = GET_JXHTML(pdoc);
5810 if (! IS_CSS_ON(jxhtml->entryp)) {
5814 for (attr = qs_get_attr(doc,node);
5816 attr = qs_get_next_attr(doc,attr)) {
5817 char *name = qs_get_attr_name(doc,attr);
5818 char *value = qs_get_attr_value(doc,attr);
5819 if (STRCASEEQ('t','T',"type", name)) {
5820 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5826 Node *child = qs_get_child_node(doc, node);
5827 if (type && child) {
5828 char *name = qs_get_node_name(doc, child);
5829 if (STRCASEEQ('t','T',"text", name)) {
5830 char *value = qs_get_node_value(doc, child);
5831 DBG(doc->r, "start load CSS. buf:[%s]", value);
5832 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
5833 DBG(doc->r, "end load CSS. value:[%s]", value);