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;
2474 char *css_clear = NULL;
2476 jxhtml = GET_JXHTML(pdoc);
2480 for (attr = qs_get_attr(doc,node);
2482 attr = qs_get_next_attr(doc,attr)) {
2483 char *nm = qs_get_attr_name(doc,attr);
2484 char *val = qs_get_attr_value(doc,attr);
2485 if (STRCASEEQ('a','A',"align", nm)) {
2486 /*----------------------------------------------------------------------*/
2487 /* CHTML 1.0 (W3C version 3.2) */
2488 /*----------------------------------------------------------------------*/
2489 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2490 attr_align = apr_pstrdup(doc->buf.pool, val);
2494 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2495 attr_style = apr_pstrdup(doc->buf.pool, val);
2498 if (IS_CSS_ON(jxhtml->entryp)) {
2499 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2501 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2502 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2503 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2504 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2505 css_property_t *cur;
2506 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2507 if (STRCASEEQ('l','L',"left",cur->value)) {
2508 attr_align = apr_pstrdup(doc->pool, "left");
2510 else if (STRCASEEQ('c','C',"center",cur->value)) {
2511 attr_align = apr_pstrdup(doc->pool, "center");
2513 else if (STRCASEEQ('r','R',"right",cur->value)) {
2514 attr_align = apr_pstrdup(doc->pool, "right");
2517 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2518 if (cur->value && *cur->value) {
2519 attr_color = apr_pstrdup(doc->pool, cur->value);
2522 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2523 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2524 attr_blink = apr_pstrdup(doc->pool, cur->value);
2527 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2528 css_clear = apr_pstrdup(doc->pool, cur->value);
2533 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2541 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2547 W_L("text-decoration:");
2564 * It is a handler who processes the P tag.
2566 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2567 * destination is specified.
2568 * @param node [i] The P tag node is specified.
2569 * @return The conversion result is returned.
2572 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2574 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2575 Doc *doc = jxhtml->doc;
2578 if (IS_CSS_ON(jxhtml->entryp)) {
2579 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2586 * It is a handler who processes the PRE tag.
2588 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2589 * destination is specified.
2590 * @param node [i] The PRE tag node is specified.
2591 * @return The conversion result is returned.
2594 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
2596 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2597 Doc *doc = jxhtml->doc;
2599 char *attr_style = NULL;
2601 for (attr = qs_get_attr(doc,node);
2603 attr = qs_get_next_attr(doc,attr)) {
2604 char *nm = qs_get_attr_name(doc,attr);
2605 char *val = qs_get_attr_value(doc,attr);
2606 if (val && STRCASEEQ('s','S',"style", nm)) {
2611 if (IS_CSS_ON(jxhtml->entryp)) {
2612 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2622 * It is a handler who processes the PRE tag.
2624 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2625 * destination is specified.
2626 * @param node [i] The PRE tag node is specified.
2627 * @return The conversion result is returned.
2630 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2632 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2633 Doc *doc = jxhtml->doc;
2637 if (IS_CSS_ON(jxhtml->entryp)) {
2638 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2646 * It is a handler who processes the UL tag.
2648 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2649 * destination is specified.
2650 * @param node [i] The UL tag node is specified.
2651 * @return The conversion result is returned.
2654 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2656 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2657 Doc *doc = jxhtml->doc;
2659 char *attr_type = NULL;
2660 char *attr_style = NULL;
2661 /*--------------------------------------------------------------------------*/
2662 /* Get Attributes */
2663 /*--------------------------------------------------------------------------*/
2664 for (attr = qs_get_attr(doc,node);
2666 attr = qs_get_next_attr(doc,attr)) {
2667 char *name = qs_get_attr_name(doc,attr);
2668 char *value = qs_get_attr_value(doc,attr);
2669 if (STRCASEEQ('t','T',"type",name)) {
2670 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2674 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2678 if (IS_CSS_ON(jxhtml->entryp)) {
2679 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2681 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2682 css_property_t *cur;
2683 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2684 if (STRCASEEQ('d','D',"disc",cur->value)) {
2685 attr_type = apr_pstrdup(doc->pool, "disc");
2687 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2688 attr_type = apr_pstrdup(doc->pool, "circle");
2690 else if (STRCASEEQ('s','S',"square",cur->value)) {
2691 attr_type = apr_pstrdup(doc->pool, "square");
2699 W_L("list-style-type:");
2710 * It is a handler who processes the UL tag.
2712 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2713 * destination is specified.
2714 * @param node [i] The UL tag node is specified.
2715 * @return The conversion result is returned.
2718 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2720 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2721 Doc *doc = jxhtml->doc;
2724 if (IS_CSS_ON(jxhtml->entryp)) {
2725 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2732 * It is a handler who processes the HR tag.
2734 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2735 * destination is specified.
2736 * @param node [i] The HR tag node is specified.
2737 * @return The conversion result is returned.
2740 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
2746 char *attr_align = NULL;
2747 char *attr_size = NULL;
2748 char *attr_width = NULL;
2749 char *attr_noshade = NULL;
2750 char *attr_style = NULL;
2751 char *attr_color = NULL;
2753 char *style_float = NULL;
2754 char *style_border_color = NULL;
2756 jxhtml = GET_JXHTML(pdoc);
2760 for (attr = qs_get_attr(doc,node);
2762 attr = qs_get_next_attr(doc,attr)) {
2763 char *name = qs_get_attr_name (doc,attr);
2764 char *value = qs_get_attr_value(doc,attr);
2768 if (strcasecmp(name, "align") == 0) {
2769 /*--------------------------------------------------------------------*/
2771 /*--------------------------------------------------------------------*/
2772 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2780 if (strcasecmp(name, "size") == 0) {
2781 /*--------------------------------------------------------------------*/
2783 /*--------------------------------------------------------------------*/
2784 if (value && *value) {
2788 else if (strcasecmp(name, "style") == 0) {
2789 if (value && *value) {
2797 if (strcasecmp(name, "width") == 0) {
2798 /*--------------------------------------------------------------------*/
2800 /*--------------------------------------------------------------------*/
2801 if (value && *value) {
2809 if (strcasecmp(name, "noshade") == 0) {
2810 /*--------------------------------------------------------------------*/
2812 /*--------------------------------------------------------------------*/
2813 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2819 if (strcasecmp(name, "color") == 0 && value && *value) {
2820 /*--------------------------------------------------------------------*/
2822 /*--------------------------------------------------------------------*/
2831 if (IS_CSS_ON(jxhtml->entryp)) {
2832 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2834 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2835 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2836 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2838 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2839 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2840 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2841 css_property_t *cur;
2843 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2844 if (STRCASEEQ('s','S',"solid",cur->value)) {
2845 attr_noshade = "noshade";
2848 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2849 char *tmp = apr_pstrdup(doc->pool, cur->value);
2850 char *tmpp = strstr(tmp, "px");
2852 attr_size = apr_pstrdup(doc->pool, tmp);
2856 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
2857 char *tmp = apr_pstrdup(doc->pool,cur->value);
2858 attr_color = apr_pstrdup(doc->pool,tmp);
2861 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2862 char *tmp = apr_pstrdup(doc->pool, cur->value);
2863 char *tmpp = strstr(tmp,"none");
2865 style_float = "center";
2868 style_float = apr_pstrdup(doc->pool,tmp);
2873 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2874 char *tmp = apr_pstrdup(doc->pool, cur->value);
2875 char *tmpp = strstr(tmp, "px");
2877 attr_width = apr_pstrdup(doc->pool, tmp);
2880 tmpp = strstr(tmp, "%");
2882 attr_width = apr_pstrdup(doc->pool, tmp);
2887 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2888 char *tmp = apr_pstrdup(doc->pool, cur->value);
2890 style_border_color = apr_pstrdup(doc->pool, tmp);
2908 if (attr_size || attr_width || attr_noshade || style_border_color) {
2913 if (!strstr(attr_size, "px")) {
2921 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2927 W_L("border-style:solid;");
2929 if(style_border_color){
2930 W_L("border-color:");
2931 W_V(style_border_color);
2949 * It is a handler who processes the HR tag.
2951 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
2952 * destination is specified.
2953 * @param node [i] The HR tag node is specified.
2954 * @return The conversion result is returned.
2957 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2959 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2965 * It is a handler who processes the IMG tag.
2967 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2968 * destination is specified.
2969 * @param node [i] The IMG tag node is specified.
2970 * @return The conversion result is returned.
2973 s_jxhtml_start_img_tag(void *pdoc, Node *node)
2975 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2976 Doc *doc = jxhtml->doc;
2977 request_rec *r = doc->r;
2979 char *attr_src = NULL;
2980 char *attr_height = NULL;
2981 char *attr_width = NULL;
2982 char *attr_align = NULL;
2983 char *attr_alt = NULL;
2984 char *attr_style = NULL;
2985 char *attr_hspace = NULL;
2986 char *attr_vspace = NULL;
2988 char *css_float = NULL;
2989 char *css_margin_left = NULL;
2990 char *css_margin_right = NULL;
2991 char *css_margin_top = NULL;
2992 char *css_margin_bottom = NULL;
2993 char *css_display = NULL;
2994 char *css_valign = NULL;
2996 #ifndef IMG_NOT_CONVERT_FILENAME
2997 device_table *spec = jxhtml->spec;
3000 /*--------------------------------------------------------------------------*/
3001 /* Get Attributes */
3002 /*--------------------------------------------------------------------------*/
3003 for (attr = qs_get_attr(doc,node);
3005 attr = qs_get_next_attr(doc,attr)) {
3006 char *name = qs_get_attr_name(doc,attr);
3007 char *value = qs_get_attr_value(doc,attr);
3008 if (STRCASEEQ('s','S',"src",name)) {
3009 /*----------------------------------------------------------------------*/
3011 /*----------------------------------------------------------------------*/
3012 #ifdef IMG_NOT_CONVERT_FILENAME
3013 value = chxj_encoding_parameter(r, value, 1);
3014 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3015 value = chxj_add_cookie_no_update_parameter(r, value);
3018 value = chxj_img_conv(r, spec, value);
3019 value = chxj_encoding_parameter(r, value, 1);
3020 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3021 value = chxj_add_cookie_no_update_parameter(r, value);
3025 else if (STRCASEEQ('a','A',"align",name)) {
3026 /*----------------------------------------------------------------------*/
3028 /*----------------------------------------------------------------------*/
3030 if (STRCASEEQ('t','T',"top", value) ||
3031 STRCASEEQ('m','M',"middle",value) ||
3032 STRCASEEQ('b','B',"bottom",value)){
3034 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3037 else if (STRCASEEQ('c','C',"center",value)) {
3038 css_valign = apr_pstrdup(doc->pool, "middle");
3042 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3043 /*----------------------------------------------------------------------*/
3045 /*----------------------------------------------------------------------*/
3048 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3049 /*----------------------------------------------------------------------*/
3051 /*----------------------------------------------------------------------*/
3052 attr_height = value;
3054 else if (STRCASEEQ('h','H',"hspace",name)) {
3055 /*----------------------------------------------------------------------*/
3057 /*----------------------------------------------------------------------*/
3058 attr_hspace = value;
3060 else if (STRCASEEQ('v','V',"vspace",name)) {
3061 /*----------------------------------------------------------------------*/
3063 /*----------------------------------------------------------------------*/
3064 attr_vspace = value;
3066 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3067 /*----------------------------------------------------------------------*/
3069 /*----------------------------------------------------------------------*/
3072 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3073 /*----------------------------------------------------------------------*/
3075 /*----------------------------------------------------------------------*/
3080 if (IS_CSS_ON(jxhtml->entryp)) {
3081 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3083 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3084 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3085 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3086 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3087 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3088 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3089 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3092 css_property_t *cur;
3093 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3094 attr_height = apr_pstrdup(doc->pool, cur->value);
3096 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3097 attr_width = apr_pstrdup(doc->pool, cur->value);
3100 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3101 css_valign = apr_pstrdup(doc->pool, cur->value);
3104 if (! attr_hspace) {
3105 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3106 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3108 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3109 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3112 if (! attr_vspace) {
3113 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3114 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3116 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3117 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3121 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3122 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3123 css_float = apr_pstrdup(doc->pool, cur->value);
3127 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3128 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3129 char *tmp = apr_pstrdup(doc->pool, cur->value);
3130 char *tmpp = strstr(tmp, "none");
3132 css_display = apr_pstrdup(doc->pool, tmp);
3144 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3152 W_L("vertical-align:");
3157 W_L("margin-left:");
3160 W_L("margin-right:");
3165 if(css_margin_left){
3166 W_L("margin-left:");
3167 W_V(css_margin_left);
3170 if(css_margin_right){
3171 W_L("margin-right:");
3172 W_V(css_margin_right);
3180 W_L("margin-bottom:");
3187 W_V(css_margin_top);
3190 if(css_margin_bottom){
3191 W_L("margin-bottom:");
3192 W_V(css_margin_bottom);
3197 W_L("display:none;");
3226 * It is a handler who processes the IMG tag.
3228 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3229 * destination is specified.
3230 * @param node [i] The IMG tag node is specified.
3231 * @return The conversion result is returned.
3234 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3236 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3242 * It is a handler who processes the SELECT tag.
3244 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3245 * destination is specified.
3246 * @param node [i] The SELECT tag node is specified.
3247 * @return The conversion result is returned.
3250 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3252 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3253 Doc *doc = jxhtml->doc;
3257 char *multiple = NULL;
3258 char *attr_style = NULL;
3261 for (attr = qs_get_attr(doc,node);
3263 attr = qs_get_next_attr(doc,attr)) {
3264 char *nm = qs_get_attr_name(doc,attr);
3265 char *val = qs_get_attr_value(doc,attr);
3266 if (STRCASEEQ('s','S',"size",nm)) {
3267 /*----------------------------------------------------------------------*/
3268 /* CHTML 1.0 version 2.0 */
3269 /*----------------------------------------------------------------------*/
3270 size = apr_pstrdup(doc->buf.pool, val);
3272 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3273 /*----------------------------------------------------------------------*/
3274 /* CHTML 1.0 version 2.0 */
3275 /*----------------------------------------------------------------------*/
3276 attr_style = apr_pstrdup(doc->buf.pool, val);
3278 else if (STRCASEEQ('n','N',"name",nm)) {
3279 /*----------------------------------------------------------------------*/
3280 /* CHTML 1.0 version 2.0 */
3281 /*----------------------------------------------------------------------*/
3282 name = apr_pstrdup(doc->buf.pool, val);
3284 else if (STRCASEEQ('m','M',"multiple", nm)) {
3285 /*----------------------------------------------------------------------*/
3286 /* CHTML 1.0 version 2.0 */
3287 /*----------------------------------------------------------------------*/
3288 multiple = apr_pstrdup(doc->buf.pool, val);
3291 if (size && *size) {
3296 if (name && *name) {
3306 if (IS_CSS_ON(jxhtml->entryp)) {
3307 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3315 * It is a handler who processes the SELECT tag.
3317 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3318 * destination is specified.
3319 * @param node [i] The SELECT tag node is specified.
3320 * @return The conversion result is returned.
3323 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3325 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3326 Doc *doc = jxhtml->doc;
3329 if (IS_CSS_ON(jxhtml->entryp)) {
3330 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3337 * It is a handler who processes the OPTION tag.
3339 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3340 * destination is specified.
3341 * @param node [i] The OPTION tag node is specified.
3342 * @return The conversion result is returned.
3345 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3347 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3348 Doc *doc = jxhtml->doc;
3351 char *selected = NULL;
3353 char *attr_style = NULL;
3356 for (attr = qs_get_attr(doc,node);
3358 attr = qs_get_next_attr(doc,attr)) {
3359 char *nm = qs_get_attr_name(doc,attr);
3360 char *val = qs_get_attr_value(doc,attr);
3361 if (STRCASEEQ('s','S',"selected",nm)) {
3362 /*----------------------------------------------------------------------*/
3363 /* CHTML 1.0 version 2.0 */
3364 /*----------------------------------------------------------------------*/
3365 selected = apr_pstrdup(doc->buf.pool, val);
3367 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3368 /*----------------------------------------------------------------------*/
3369 /* CHTML 1.0 version 2.0 */
3370 /*----------------------------------------------------------------------*/
3371 attr_style = apr_pstrdup(doc->buf.pool, val);
3373 else if (STRCASEEQ('v','V',"value",nm)) {
3374 /*----------------------------------------------------------------------*/
3375 /* CHTML 1.0 version 2.0 */
3376 /*----------------------------------------------------------------------*/
3377 value = apr_pstrdup(doc->buf.pool, val);
3390 if (IS_CSS_ON(jxhtml->entryp)) {
3391 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3399 * It is a handler who processes the OPTION tag.
3401 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3402 * destination is specified.
3403 * @param node [i] The OPTION tag node is specified.
3404 * @return The conversion result is returned.
3407 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3409 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3410 Doc *doc = jxhtml->doc;
3413 if (IS_CSS_ON(jxhtml->entryp)) {
3414 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3422 * It is a handler who processes the DIV tag.
3424 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3425 * destination is specified.
3426 * @param node [i] The DIV tag node is specified.
3427 * @return The conversion result is returned.
3430 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3436 char *attr_style = NULL;
3437 char *attr_align = NULL;
3438 char *attr_display = NULL;
3439 char *attr_decoration = NULL;
3440 char *attr_wap_marquee_style = NULL;
3441 char *attr_wap_marquee_dir = NULL;
3442 char *attr_wap_marquee_loop = NULL;
3443 char *attr_color = NULL;
3444 char *attr_bgcolor = NULL;
3445 char *attr_font_size = NULL;
3446 char *css_clear = NULL;
3448 jxhtml = GET_JXHTML(pdoc);
3452 for (attr = qs_get_attr(doc,node);
3454 attr = qs_get_next_attr(doc,attr)) {
3455 char *nm = qs_get_attr_name(doc,attr);
3456 char *val = qs_get_attr_value(doc,attr);
3457 if (STRCASEEQ('a','A',"align",nm)) {
3458 /*----------------------------------------------------------------------*/
3459 /* CHTML 1.0 (W3C version 3.2) */
3460 /*----------------------------------------------------------------------*/
3461 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3462 attr_align = apr_pstrdup(doc->buf.pool, val);
3465 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3466 attr_style = apr_pstrdup(doc->buf.pool, val);
3470 if (IS_CSS_ON(jxhtml->entryp)) {
3471 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3473 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3474 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3475 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3476 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3477 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3478 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3479 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3480 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3482 css_property_t *cur;
3483 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3484 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3485 attr_display = apr_pstrdup(doc->pool, cur->value);
3488 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3489 if (STRCASEEQ('b','B',"blink", cur->value)) {
3490 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3493 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3494 attr_color = apr_pstrdup(doc->pool, cur->value);
3496 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3497 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3498 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3500 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3501 char *ss = strchr(cur->value, '#');
3503 ss = strstr(cur->value, "rgb");
3506 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3507 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3510 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3511 attr_align = apr_pstrdup(doc->pool, cur->value);
3513 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3514 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3515 || STRCASEEQ('x','X',"x-small",cur->value)
3516 || STRCASEEQ('s','S',"small",cur->value)
3517 || STRCASEEQ('m','M',"medium",cur->value)
3518 || STRCASEEQ('l','L',"large",cur->value)
3519 || STRCASEEQ('x','X',"x-large",cur->value)
3520 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3521 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3525 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3526 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3527 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3528 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3529 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3530 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3533 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3534 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3535 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3537 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3538 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3541 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3542 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
3543 attr_wap_marquee_loop = "infinite";
3546 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3550 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3551 css_clear = apr_pstrdup(doc->pool, cur->value);
3559 || attr_wap_marquee_style
3560 || attr_wap_marquee_dir
3561 || attr_wap_marquee_loop
3577 if (attr_decoration) {
3578 W_L("text-decoration:");
3579 W_V(attr_decoration);
3582 if (attr_wap_marquee_style) {
3583 W_L("-wap-marquee-style:");
3584 W_V(attr_wap_marquee_style);
3587 if (attr_wap_marquee_dir) {
3588 W_L("-wap-marquee-dir:");
3589 W_V(attr_wap_marquee_dir);
3592 if (attr_wap_marquee_loop) {
3593 W_L("-wap-marquee-loop:");
3594 W_V(attr_wap_marquee_loop);
3603 W_L("background-color:");
3607 if (attr_font_size) {
3609 W_V(attr_font_size);
3625 * It is a handler who processes the DIV tag.
3627 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3628 * destination is specified.
3629 * @param node [i] The DIV tag node is specified.
3630 * @return The conversion result is returned.
3633 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
3639 jxhtml = GET_JXHTML(pdoc);
3644 if (IS_CSS_ON(jxhtml->entryp)) {
3645 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3652 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
3659 jxhtml = GET_JXHTML(pdoc);
3663 for (child = qs_get_child_node(doc, node);
3665 child = qs_get_next_node(doc, child)) {
3667 s_jxhtml_chxjif_tag(jxhtml, child);
3674 * It is a handler who processes the TEXTARE tag.
3676 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3677 * destination is specified.
3678 * @param node [i] The TEXTAREA tag node is specified.
3679 * @return The conversion result is returned.
3682 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
3688 char *attr_accesskey = NULL;
3689 char *attr_name = NULL;
3690 char *attr_rows = NULL;
3691 char *attr_cols = NULL;
3692 char *attr_istyle = NULL;
3693 char *attr_style = NULL;
3696 jxhtml = GET_JXHTML(pdoc);
3700 jxhtml->textarea_flag++;
3701 for (attr = qs_get_attr(doc,node);
3703 attr = qs_get_next_attr(doc,attr)) {
3704 char *name = qs_get_attr_name(doc,attr);
3705 char *value = qs_get_attr_value(doc,attr);
3706 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3707 attr_accesskey = value;
3709 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3710 attr_istyle = value;
3712 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3715 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3718 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3721 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3725 if (IS_CSS_ON(jxhtml->entryp)) {
3726 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3728 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3729 css_property_t *cur;
3730 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3731 if (strcasestr(cur->value, "<ja:n>")) {
3734 else if (strcasestr(cur->value, "<ja:en>")) {
3737 else if (strcasestr(cur->value, "<ja:hk>")) {
3740 else if (strcasestr(cur->value, "<ja:h>")) {
3747 if (attr_accesskey) {
3748 W_L(" accesskey=\"");
3749 W_V(attr_accesskey);
3768 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
3770 W_L("-wap-input-format:"*");
3781 * It is a handler who processes the TEXTAREA tag.
3783 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3784 * destination is specified.
3785 * @param node [i] The TEXTAREA tag node is specified.
3786 * @return The conversion result is returned.
3789 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3795 jxhtml = GET_JXHTML(pdoc);
3800 jxhtml->textarea_flag--;
3807 * It is a handler who processes the B tag.
3809 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3810 * destination is specified.
3811 * @param node [i] The B tag node is specified.
3812 * @return The conversion result is returned.
3815 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3821 jxhtml = GET_JXHTML(pdoc);
3831 * It is a handler who processes the B tag.
3833 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3834 * destination is specified.
3835 * @param node [i] The B tag node is specified.
3836 * @return The conversion result is returned.
3839 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3841 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
3842 Doc* doc = jxhtml->doc;
3849 s_jxhtml_text_tag(void* pdoc, Node* child)
3860 apr_size_t z2h_input_len;
3862 jxhtml = GET_JXHTML(pdoc);
3866 textval = qs_get_node_value(doc,child);
3867 if (strlen(textval) == 0) {
3871 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3872 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3874 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3875 memset(one_byte, 0, sizeof(one_byte));
3878 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3880 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
3882 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3887 if (is_sjis_kanji(textval[ii])) {
3888 one_byte[0] = textval[ii+0];
3889 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3890 one_byte[0] = textval[ii+1];
3891 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3895 if (jxhtml->pre_flag) {
3896 one_byte[0] = textval[ii+0];
3897 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3900 if (jxhtml->textarea_flag) {
3901 one_byte[0] = textval[ii+0];
3902 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3905 if (textval[ii] != '\r' && textval[ii] != '\n') {
3906 one_byte[0] = textval[ii+0];
3907 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3911 z2h_input_len = strlen(tdst);
3912 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
3920 * It is a handler who processes the BLOCKQUOTE tag.
3922 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3923 * destination is specified.
3924 * @param node [i] The BLOCKQUOTE tag node is specified.
3925 * @return The conversion result is returned.
3928 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
3933 char *attr_style = NULL;
3934 char *attr_color = NULL;
3935 char *attr_size = NULL;
3937 jxhtml = GET_JXHTML(pdoc);
3939 for (attr = qs_get_attr(doc,node);
3941 attr = qs_get_next_attr(doc,attr)) {
3942 char *nm = qs_get_attr_name(doc,attr);
3943 char *val = qs_get_attr_value(doc,attr);
3944 if (val && STRCASEEQ('s','S',"style", nm)) {
3948 if (IS_CSS_ON(jxhtml->entryp)) {
3949 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3951 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3952 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3953 css_property_t *cur;
3954 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3955 if (cur->value && *cur->value) {
3956 attr_color = apr_pstrdup(doc->pool, cur->value);
3959 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3960 if (cur->value && *cur->value) {
3961 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3962 attr_size = apr_pstrdup(doc->pool, cur->value);
3964 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3965 attr_size = apr_pstrdup(doc->pool, cur->value);
3967 else if (STRCASEEQ('s','S',"small",cur->value)) {
3968 attr_size = apr_pstrdup(doc->pool, cur->value);
3970 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3971 attr_size = apr_pstrdup(doc->pool, cur->value);
3973 else if (STRCASEEQ('l','L',"large",cur->value)) {
3974 attr_size = apr_pstrdup(doc->pool, cur->value);
3976 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3977 attr_size = apr_pstrdup(doc->pool, cur->value);
3979 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3980 attr_size = apr_pstrdup(doc->pool, cur->value);
3987 if (attr_color || attr_size) {
3990 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4008 * It is a handler who processes the BLOCKQUOTE tag.
4010 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4011 * destination is specified.
4012 * @param node [i] The BLOCKQUOTE tag node is specified.
4013 * @return The conversion result is returned.
4016 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4018 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4019 Doc *doc = jxhtml->doc;
4020 W_L("</blockquote>");
4021 if (IS_CSS_ON(jxhtml->entryp)) {
4022 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4029 * It is a handler who processes the DIR tag.
4031 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4032 * destination is specified.
4033 * @param node [i] The DIR tag node is specified.
4034 * @return The conversion result is returned.
4037 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4039 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4040 Doc *doc = jxhtml->doc;
4042 char *attr_style = NULL;
4043 char *attr_color = NULL;
4044 char *attr_type = NULL;
4045 char *attr_size = NULL;
4046 for (attr = qs_get_attr(doc,node);
4048 attr = qs_get_next_attr(doc,attr)) {
4049 char *name = qs_get_attr_name(doc,attr);
4050 char *value = qs_get_attr_value(doc,attr);
4051 if (STRCASEEQ('t','T',"type",name)) {
4052 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4056 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4060 if (IS_CSS_ON(jxhtml->entryp)) {
4061 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4063 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4064 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4065 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4066 css_property_t *cur;
4067 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4068 if (cur->value && *cur->value) {
4069 attr_color = apr_pstrdup(doc->pool, cur->value);
4072 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4073 if (cur->value && *cur->value) {
4074 attr_type = apr_pstrdup(doc->pool, cur->value);
4077 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4078 if (cur->value && *cur->value) {
4079 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4080 attr_size = apr_pstrdup(doc->pool, cur->value);
4082 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4083 attr_size = apr_pstrdup(doc->pool, cur->value);
4085 else if (STRCASEEQ('s','S',"small",cur->value)) {
4086 attr_size = apr_pstrdup(doc->pool, cur->value);
4088 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4089 attr_size = apr_pstrdup(doc->pool, cur->value);
4091 else if (STRCASEEQ('l','L',"large",cur->value)) {
4092 attr_size = apr_pstrdup(doc->pool, cur->value);
4094 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4095 attr_size = apr_pstrdup(doc->pool, cur->value);
4097 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4098 attr_size = apr_pstrdup(doc->pool, cur->value);
4105 if (attr_type || attr_color || attr_size) {
4108 W_L("list-style-type:");
4113 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4131 * It is a handler who processes the DIR tag.
4133 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4134 * destination is specified.
4135 * @param node [i] The DIR tag node is specified.
4136 * @return The conversion result is returned.
4139 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4141 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4142 Doc *doc = jxhtml->doc;
4144 if (IS_CSS_ON(jxhtml->entryp)) {
4145 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4152 * It is a handler who processes the DL tag.
4154 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4155 * destination is specified.
4156 * @param node [i] The DL tag node is specified.
4157 * @return The conversion result is returned.
4160 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4162 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4163 Doc *doc = jxhtml->doc;
4165 char *attr_style = NULL;
4166 char *attr_color = NULL;
4167 char *attr_size = NULL;
4168 for (attr = qs_get_attr(doc,node);
4170 attr = qs_get_next_attr(doc,attr)) {
4171 char *name = qs_get_attr_name(doc,attr);
4172 char *value = qs_get_attr_value(doc,attr);
4173 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4177 if (IS_CSS_ON(jxhtml->entryp)) {
4178 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4180 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4181 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4182 css_property_t *cur;
4183 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4184 if (cur->value && *cur->value) {
4185 attr_color = apr_pstrdup(doc->pool, cur->value);
4188 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4189 if (cur->value && *cur->value) {
4190 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4191 attr_size = apr_pstrdup(doc->pool, cur->value);
4193 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4194 attr_size = apr_pstrdup(doc->pool, cur->value);
4196 else if (STRCASEEQ('s','S',"small",cur->value)) {
4197 attr_size = apr_pstrdup(doc->pool, cur->value);
4199 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4200 attr_size = apr_pstrdup(doc->pool, cur->value);
4202 else if (STRCASEEQ('l','L',"large",cur->value)) {
4203 attr_size = apr_pstrdup(doc->pool, cur->value);
4205 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4206 attr_size = apr_pstrdup(doc->pool, cur->value);
4208 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4209 attr_size = apr_pstrdup(doc->pool, cur->value);
4216 if (attr_color || attr_size) {
4219 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4237 * It is a handler who processes the DL tag.
4239 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4240 * destination is specified.
4241 * @param node [i] The DL tag node is specified.
4242 * @return The conversion result is returned.
4245 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4247 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4248 Doc *doc = jxhtml->doc;
4250 if (IS_CSS_ON(jxhtml->entryp)) {
4251 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4258 * It is a handler who processes the DT tag.
4260 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4261 * destination is specified.
4262 * @param node [i] The DT tag node is specified.
4263 * @return The conversion result is returned.
4266 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4268 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4269 Doc *doc = jxhtml->doc;
4271 char *attr_style = NULL;
4272 char *attr_color = NULL;
4273 char *attr_size = NULL;
4274 for (attr = qs_get_attr(doc,node);
4276 attr = qs_get_next_attr(doc,attr)) {
4277 char *name = qs_get_attr_name(doc,attr);
4278 char *value = qs_get_attr_value(doc,attr);
4279 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4283 if (IS_CSS_ON(jxhtml->entryp)) {
4284 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4286 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4287 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4288 css_property_t *cur;
4289 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4290 if (cur->value && *cur->value) {
4291 attr_color = apr_pstrdup(doc->pool, cur->value);
4294 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4295 if (cur->value && *cur->value) {
4296 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4297 attr_size = apr_pstrdup(doc->pool, cur->value);
4299 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4300 attr_size = apr_pstrdup(doc->pool, cur->value);
4302 else if (STRCASEEQ('s','S',"small",cur->value)) {
4303 attr_size = apr_pstrdup(doc->pool, cur->value);
4305 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4306 attr_size = apr_pstrdup(doc->pool, cur->value);
4308 else if (STRCASEEQ('l','L',"large",cur->value)) {
4309 attr_size = apr_pstrdup(doc->pool, cur->value);
4311 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4312 attr_size = apr_pstrdup(doc->pool, cur->value);
4314 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4315 attr_size = apr_pstrdup(doc->pool, cur->value);
4322 if (attr_color || attr_size) {
4325 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4343 * It is a handler who processes the DT tag.
4345 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4346 * destination is specified.
4347 * @param node [i] The DT tag node is specified.
4348 * @return The conversion result is returned.
4351 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4353 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4354 Doc *doc = jxhtml->doc;
4356 if (IS_CSS_ON(jxhtml->entryp)) {
4357 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4364 * It is a handler who processes the DD tag.
4366 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4367 * destination is specified.
4368 * @param node [i] The DD tag node is specified.
4369 * @return The conversion result is returned.
4372 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4374 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4375 Doc *doc = jxhtml->doc;
4377 char *attr_style = NULL;
4378 char *attr_color = NULL;
4379 char *attr_size = NULL;
4380 for (attr = qs_get_attr(doc,node);
4382 attr = qs_get_next_attr(doc,attr)) {
4383 char *name = qs_get_attr_name(doc,attr);
4384 char *value = qs_get_attr_value(doc,attr);
4385 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4389 if (IS_CSS_ON(jxhtml->entryp)) {
4390 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4392 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4393 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4394 css_property_t *cur;
4395 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4396 if (cur->value && *cur->value) {
4397 attr_color = apr_pstrdup(doc->pool, cur->value);
4400 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4401 if (cur->value && *cur->value) {
4402 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4403 attr_size = apr_pstrdup(doc->pool, cur->value);
4405 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4406 attr_size = apr_pstrdup(doc->pool, cur->value);
4408 else if (STRCASEEQ('s','S',"small",cur->value)) {
4409 attr_size = apr_pstrdup(doc->pool, cur->value);
4411 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4412 attr_size = apr_pstrdup(doc->pool, cur->value);
4414 else if (STRCASEEQ('l','L',"large",cur->value)) {
4415 attr_size = apr_pstrdup(doc->pool, cur->value);
4417 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4418 attr_size = apr_pstrdup(doc->pool, cur->value);
4420 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4421 attr_size = apr_pstrdup(doc->pool, cur->value);
4428 if (attr_color || attr_size) {
4431 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4449 * It is a handler who processes the DD tag.
4451 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4452 * destination is specified.
4453 * @param node [i] The DD tag node is specified.
4454 * @return The conversion result is returned.
4457 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4459 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4460 Doc *doc = jxhtml->doc;
4462 if (IS_CSS_ON(jxhtml->entryp)) {
4463 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4470 * It is a handler who processes the H1 tag.
4472 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4473 * destination is specified.
4474 * @param node [i] The H1 tag node is specified.
4475 * @return The conversion result is returned.
4478 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4484 char *attr_style = NULL;
4485 char *attr_align = NULL;
4486 char *css_clear = NULL;
4488 jxhtml = GET_JXHTML(pdoc);
4492 for (attr = qs_get_attr(doc,node);
4494 attr = qs_get_next_attr(doc,attr)) {
4495 char *name = qs_get_attr_name(doc,attr);
4496 char *value = qs_get_attr_value(doc,attr);
4497 if (STRCASEEQ('a','A',"align", name)) {
4498 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4502 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4506 if (IS_CSS_ON(jxhtml->entryp)) {
4507 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4509 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4510 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4511 css_property_t *cur;
4512 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4513 if (STRCASEEQ('l','L',"left", cur->value)) {
4514 attr_align = apr_pstrdup(doc->pool, "left");
4516 else if (STRCASEEQ('c','C',"center",cur->value)) {
4517 attr_align = apr_pstrdup(doc->pool, "center");
4519 else if (STRCASEEQ('r','R',"right",cur->value)) {
4520 attr_align = apr_pstrdup(doc->pool, "right");
4523 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4524 if (STRCASEEQ('b','B',"both", cur->value)) {
4525 css_clear = apr_pstrdup(doc->pool, "both");
4527 else if (STRCASEEQ('r','R',"right", cur->value)) {
4528 css_clear = apr_pstrdup(doc->pool, "right");
4530 else if (STRCASEEQ('l','L',"left", cur->value)) {
4531 css_clear = apr_pstrdup(doc->pool, "left");
4537 if (attr_align || css_clear ) {
4558 * It is a handler who processes the H1 tag.
4560 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4561 * destination is specified.
4562 * @param node [i] The H1 tag node is specified.
4563 * @return The conversion result is returned.
4566 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4572 jxhtml = GET_JXHTML(pdoc);
4577 if (IS_CSS_ON(jxhtml->entryp)) {
4578 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4586 * It is a handler who processes the H2 tag.
4588 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4589 * destination is specified.
4590 * @param node [i] The H1 tag node is specified.
4591 * @return The conversion result is returned.
4594 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
4600 char *attr_style = NULL;
4601 char *attr_align = NULL;
4602 char *css_clear = NULL;
4604 jxhtml = GET_JXHTML(pdoc);
4608 for (attr = qs_get_attr(doc,node);
4610 attr = qs_get_next_attr(doc,attr)) {
4611 char *name = qs_get_attr_name(doc,attr);
4612 char *value = qs_get_attr_value(doc,attr);
4613 if (STRCASEEQ('a','A',"align", name)) {
4614 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4618 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4622 if (IS_CSS_ON(jxhtml->entryp)) {
4623 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4625 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4626 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4627 css_property_t *cur;
4628 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4629 if (STRCASEEQ('l','L',"left", cur->value)) {
4630 attr_align = apr_pstrdup(doc->pool, "left");
4632 else if (STRCASEEQ('c','C',"center",cur->value)) {
4633 attr_align = apr_pstrdup(doc->pool, "center");
4635 else if (STRCASEEQ('r','R',"right",cur->value)) {
4636 attr_align = apr_pstrdup(doc->pool, "right");
4639 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4640 if (STRCASEEQ('b','B',"both", cur->value)) {
4641 css_clear = apr_pstrdup(doc->pool, "both");
4643 else if (STRCASEEQ('r','R',"right", cur->value)) {
4644 css_clear = apr_pstrdup(doc->pool, "right");
4646 else if (STRCASEEQ('l','L',"left", cur->value)) {
4647 css_clear = apr_pstrdup(doc->pool, "left");
4653 if (attr_align || css_clear ) {
4674 * It is a handler who processes the H2 tag.
4676 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4677 * destination is specified.
4678 * @param node [i] The H1 tag node is specified.
4679 * @return The conversion result is returned.
4682 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
4688 jxhtml = GET_JXHTML(pdoc);
4693 if (IS_CSS_ON(jxhtml->entryp)) {
4694 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4701 * It is a handler who processes the H3 tag.
4703 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4704 * destination is specified.
4705 * @param node [i] The H1 tag node is specified.
4706 * @return The conversion result is returned.
4709 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
4715 char *attr_style = NULL;
4716 char *attr_align = NULL;
4717 char *css_clear = NULL;
4719 jxhtml = GET_JXHTML(pdoc);
4723 for (attr = qs_get_attr(doc,node);
4725 attr = qs_get_next_attr(doc,attr)) {
4726 char *name = qs_get_attr_name(doc,attr);
4727 char *value = qs_get_attr_value(doc,attr);
4728 if (STRCASEEQ('a','A',"align", name)) {
4729 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4733 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4737 if (IS_CSS_ON(jxhtml->entryp)) {
4738 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4740 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4741 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4742 css_property_t *cur;
4743 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4744 if (STRCASEEQ('l','L',"left", cur->value)) {
4745 attr_align = apr_pstrdup(doc->pool, "left");
4747 else if (STRCASEEQ('c','C',"center",cur->value)) {
4748 attr_align = apr_pstrdup(doc->pool, "center");
4750 else if (STRCASEEQ('r','R',"right",cur->value)) {
4751 attr_align = apr_pstrdup(doc->pool, "right");
4754 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4755 if (STRCASEEQ('b','B',"both", cur->value)) {
4756 css_clear = apr_pstrdup(doc->pool, "both");
4758 else if (STRCASEEQ('r','R',"right", cur->value)) {
4759 css_clear = apr_pstrdup(doc->pool, "right");
4761 else if (STRCASEEQ('l','L',"left", cur->value)) {
4762 css_clear = apr_pstrdup(doc->pool, "left");
4768 if (attr_align || css_clear ) {
4789 * It is a handler who processes the H3 tag.
4791 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4792 * destination is specified.
4793 * @param node [i] The H1 tag node is specified.
4794 * @return The conversion result is returned.
4797 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
4803 jxhtml = GET_JXHTML(pdoc);
4808 if (IS_CSS_ON(jxhtml->entryp)) {
4809 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4816 * It is a handler who processes the H4 tag.
4818 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4819 * destination is specified.
4820 * @param node [i] The H1 tag node is specified.
4821 * @return The conversion result is returned.
4824 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
4830 char *attr_style = NULL;
4831 char *attr_align = NULL;
4832 char *css_clear = NULL;
4834 jxhtml = GET_JXHTML(pdoc);
4838 for (attr = qs_get_attr(doc,node);
4840 attr = qs_get_next_attr(doc,attr)) {
4841 char *name = qs_get_attr_name(doc,attr);
4842 char *value = qs_get_attr_value(doc,attr);
4843 if (STRCASEEQ('a','A',"align", name)) {
4844 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4848 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4852 if (IS_CSS_ON(jxhtml->entryp)) {
4853 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4855 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4856 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4857 css_property_t *cur;
4858 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4859 if (STRCASEEQ('l','L',"left", cur->value)) {
4860 attr_align = apr_pstrdup(doc->pool, "left");
4862 else if (STRCASEEQ('c','C',"center",cur->value)) {
4863 attr_align = apr_pstrdup(doc->pool, "center");
4865 else if (STRCASEEQ('r','R',"right",cur->value)) {
4866 attr_align = apr_pstrdup(doc->pool, "right");
4869 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4870 if (STRCASEEQ('b','B',"both", cur->value)) {
4871 css_clear = apr_pstrdup(doc->pool, "both");
4873 else if (STRCASEEQ('r','R',"right", cur->value)) {
4874 css_clear = apr_pstrdup(doc->pool, "right");
4876 else if (STRCASEEQ('l','L',"left", cur->value)) {
4877 css_clear = apr_pstrdup(doc->pool, "left");
4883 if (attr_align || css_clear ) {
4904 * It is a handler who processes the H4 tag.
4906 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4907 * destination is specified.
4908 * @param node [i] The H1 tag node is specified.
4909 * @return The conversion result is returned.
4912 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
4918 jxhtml = GET_JXHTML(pdoc);
4923 if (IS_CSS_ON(jxhtml->entryp)) {
4924 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4932 * It is a handler who processes the H5 tag.
4934 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4935 * destination is specified.
4936 * @param node [i] The H1 tag node is specified.
4937 * @return The conversion result is returned.
4940 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
4946 char *attr_style = NULL;
4947 char *attr_align = NULL;
4948 char *css_clear = NULL;
4950 jxhtml = GET_JXHTML(pdoc);
4954 for (attr = qs_get_attr(doc,node);
4956 attr = qs_get_next_attr(doc,attr)) {
4957 char *name = qs_get_attr_name(doc,attr);
4958 char *value = qs_get_attr_value(doc,attr);
4959 if (STRCASEEQ('a','A',"align", name)) {
4960 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4964 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4968 if (IS_CSS_ON(jxhtml->entryp)) {
4969 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4971 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4972 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4973 css_property_t *cur;
4974 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4975 if (STRCASEEQ('l','L',"left", cur->value)) {
4976 attr_align = apr_pstrdup(doc->pool, "left");
4978 else if (STRCASEEQ('c','C',"center",cur->value)) {
4979 attr_align = apr_pstrdup(doc->pool, "center");
4981 else if (STRCASEEQ('r','R',"right",cur->value)) {
4982 attr_align = apr_pstrdup(doc->pool, "right");
4985 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4986 if (STRCASEEQ('b','B',"both", cur->value)) {
4987 css_clear = apr_pstrdup(doc->pool, "both");
4989 else if (STRCASEEQ('r','R',"right", cur->value)) {
4990 css_clear = apr_pstrdup(doc->pool, "right");
4992 else if (STRCASEEQ('l','L',"left", cur->value)) {
4993 css_clear = apr_pstrdup(doc->pool, "left");
4999 if (attr_align || css_clear ) {
5020 * It is a handler who processes the H5 tag.
5022 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5023 * destination is specified.
5024 * @param node [i] The H1 tag node is specified.
5025 * @return The conversion result is returned.
5028 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5034 jxhtml = GET_JXHTML(pdoc);
5039 if (IS_CSS_ON(jxhtml->entryp)) {
5040 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5048 * It is a handler who processes the H6 tag.
5050 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5051 * destination is specified.
5052 * @param node [i] The H1 tag node is specified.
5053 * @return The conversion result is returned.
5056 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5062 char *attr_style = NULL;
5063 char *attr_align = NULL;
5064 char *css_clear = NULL;
5066 jxhtml = GET_JXHTML(pdoc);
5070 for (attr = qs_get_attr(doc,node);
5072 attr = qs_get_next_attr(doc,attr)) {
5073 char *name = qs_get_attr_name(doc,attr);
5074 char *value = qs_get_attr_value(doc,attr);
5075 if (STRCASEEQ('a','A',"align", name)) {
5076 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5080 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5084 if (IS_CSS_ON(jxhtml->entryp)) {
5085 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5087 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5088 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5089 css_property_t *cur;
5090 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5091 if (STRCASEEQ('l','L',"left", cur->value)) {
5092 attr_align = apr_pstrdup(doc->pool, "left");
5094 else if (STRCASEEQ('c','C',"center",cur->value)) {
5095 attr_align = apr_pstrdup(doc->pool, "center");
5097 else if (STRCASEEQ('r','R',"right",cur->value)) {
5098 attr_align = apr_pstrdup(doc->pool, "right");
5101 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5102 if (STRCASEEQ('b','B',"both", cur->value)) {
5103 css_clear = apr_pstrdup(doc->pool, "both");
5105 else if (STRCASEEQ('r','R',"right", cur->value)) {
5106 css_clear = apr_pstrdup(doc->pool, "right");
5108 else if (STRCASEEQ('l','L',"left", cur->value)) {
5109 css_clear = apr_pstrdup(doc->pool, "left");
5115 if (attr_align || css_clear ) {
5136 * It is a handler who processes the H6 tag.
5138 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5139 * destination is specified.
5140 * @param node [i] The H1 tag node is specified.
5141 * @return The conversion result is returned.
5144 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5150 jxhtml = GET_JXHTML(pdoc);
5155 if (IS_CSS_ON(jxhtml->entryp)) {
5156 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5164 * It is a handler who processes the MENU tag.
5166 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5167 * destination is specified.
5168 * @param node [i] The MENU tag node is specified.
5169 * @return The conversion result is returned.
5172 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5174 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5175 Doc *doc = jxhtml->doc;
5177 char *attr_style = NULL;
5178 char *attr_color = NULL;
5179 char *attr_type = NULL;
5180 char *attr_size = NULL;
5181 for (attr = qs_get_attr(doc,node);
5183 attr = qs_get_next_attr(doc,attr)) {
5184 char *name = qs_get_attr_name(doc,attr);
5185 char *value = qs_get_attr_value(doc,attr);
5186 if (STRCASEEQ('t','T',"type",name)) {
5187 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5191 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5195 if (IS_CSS_ON(jxhtml->entryp)) {
5196 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5198 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5199 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5200 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5201 css_property_t *cur;
5202 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5203 if (cur->value && *cur->value) {
5204 attr_color = apr_pstrdup(doc->pool, cur->value);
5207 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5208 if (cur->value && *cur->value) {
5209 attr_type = apr_pstrdup(doc->pool, cur->value);
5212 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5213 if (cur->value && *cur->value) {
5214 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5215 attr_size = apr_pstrdup(doc->pool, cur->value);
5217 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5218 attr_size = apr_pstrdup(doc->pool, cur->value);
5220 else if (STRCASEEQ('s','S',"small",cur->value)) {
5221 attr_size = apr_pstrdup(doc->pool, cur->value);
5223 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5224 attr_size = apr_pstrdup(doc->pool, cur->value);
5226 else if (STRCASEEQ('l','L',"large",cur->value)) {
5227 attr_size = apr_pstrdup(doc->pool, cur->value);
5229 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5230 attr_size = apr_pstrdup(doc->pool, cur->value);
5232 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5233 attr_size = apr_pstrdup(doc->pool, cur->value);
5240 if (attr_type || attr_color || attr_size) {
5243 W_L("list-style-type:");
5248 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5266 * It is a handler who processes the MENU tag.
5268 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5269 * destination is specified.
5270 * @param node [i] The MENU tag node is specified.
5271 * @return The conversion result is returned.
5274 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5276 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5277 Doc *doc = jxhtml->doc;
5279 if (IS_CSS_ON(jxhtml->entryp)) {
5280 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5287 * It is a handler who processes the PLAINTEXT tag.
5289 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5290 * destination is specified.
5291 * @param node [i] The PLAINTEXT tag node is specified.
5292 * @return The conversion result is returned.
5295 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5300 jxhtml = GET_JXHTML(pdoc);
5303 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5308 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5313 jxhtml = GET_JXHTML(pdoc);
5315 for (child = qs_get_child_node(doc, node);
5317 child = qs_get_next_node(doc, child)) {
5319 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5326 * It is a handler who processes the PLAINTEXT tag.
5328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5329 * destination is specified.
5330 * @param node [i] The PLAINTEXT tag node is specified.
5331 * @return The conversion result is returned.
5334 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5336 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5342 * It is a handler who processes the BLINK tag.
5344 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5345 * destination is specified.
5346 * @param node [i] The BLINK tag node is specified.
5347 * @return The conversion result is returned.
5350 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5352 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5353 Doc *doc = jxhtml->doc;
5355 char *attr_style = NULL;
5356 char *attr_color = NULL;
5357 char *attr_size = NULL;
5358 for (attr = qs_get_attr(doc,node);
5360 attr = qs_get_next_attr(doc,attr)) {
5361 char *name = qs_get_attr_name(doc,attr);
5362 char *value = qs_get_attr_value(doc,attr);
5363 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5367 if (IS_CSS_ON(jxhtml->entryp)) {
5368 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5370 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5371 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5372 css_property_t *cur;
5373 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5374 if (cur->value && *cur->value) {
5375 attr_color = apr_pstrdup(doc->pool, cur->value);
5378 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5379 if (cur->value && *cur->value) {
5380 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5381 attr_size = apr_pstrdup(doc->pool, cur->value);
5383 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5384 attr_size = apr_pstrdup(doc->pool, cur->value);
5386 else if (STRCASEEQ('s','S',"small",cur->value)) {
5387 attr_size = apr_pstrdup(doc->pool, cur->value);
5389 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5390 attr_size = apr_pstrdup(doc->pool, cur->value);
5392 else if (STRCASEEQ('l','L',"large",cur->value)) {
5393 attr_size = apr_pstrdup(doc->pool, cur->value);
5395 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5396 attr_size = apr_pstrdup(doc->pool, cur->value);
5398 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5399 attr_size = apr_pstrdup(doc->pool, cur->value);
5406 if (attr_color || attr_size) {
5409 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5427 * It is a handler who processes the BLINK tag.
5429 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5430 * destination is specified.
5431 * @param node [i] The BLINK tag node is specified.
5432 * @return The conversion result is returned.
5435 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5437 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5438 Doc *doc = jxhtml->doc;
5440 if (IS_CSS_ON(jxhtml->entryp)) {
5441 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5448 * It is a handler who processes the MARQUEE tag.
5450 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5451 * destination is specified.
5452 * @param node [i] The MARQUEE tag node is specified.
5453 * @return The conversion result is returned.
5456 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5458 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5459 Doc *doc = jxhtml->doc;
5461 char *attr_direction = NULL;
5462 char *attr_style = NULL;
5463 char *attr_color = NULL;
5464 char *attr_size = NULL;
5465 char *attr_bgcolor = NULL;
5466 /*--------------------------------------------------------------------------*/
5467 /* Get Attributes */
5468 /*--------------------------------------------------------------------------*/
5469 for (attr = qs_get_attr(doc,node);
5471 attr = qs_get_next_attr(doc,attr)) {
5472 char *name = qs_get_attr_name(doc,attr);
5473 char *value = qs_get_attr_value(doc,attr);
5474 if (STRCASEEQ('d','D',"direction", name)) {
5476 if (STRCASEEQ('l','L',"left",value)) {
5477 attr_direction = "rtl";
5479 else if (STRCASEEQ('r','R',"right",value)) {
5480 attr_direction = "ltr";
5484 else if (STRCASEEQ('b','B',"behavior",name)) {
5487 else if (STRCASEEQ('l','L',"loop",name)) {
5490 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5491 if (value && *value) {
5492 attr_bgcolor = value;
5495 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5499 if (IS_CSS_ON(jxhtml->entryp)) {
5500 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5502 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5503 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5504 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5505 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5506 css_property_t *cur;
5507 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5508 if (cur->value && *cur->value) {
5509 attr_color = apr_pstrdup(doc->pool, cur->value);
5512 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5513 if (cur->value && *cur->value) {
5514 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5517 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5518 if (cur->value && *cur->value) {
5519 attr_direction = apr_pstrdup(doc->pool, cur->value);
5522 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5523 if (cur->value && *cur->value) {
5524 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5525 || STRCASEEQ('x','X',"x-small", cur->value)
5526 || STRCASEEQ('s','S',"small", cur->value)
5527 || STRCASEEQ('m','M',"medium", cur->value)
5528 || STRCASEEQ('l','L',"large", cur->value)
5529 || STRCASEEQ('x','X',"x-large", cur->value)
5530 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5531 attr_size = apr_pstrdup(doc->pool, cur->value);
5538 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5540 if (attr_direction) {
5541 W_L("-wap-marquee-dir:");
5542 W_V(attr_direction);
5546 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5547 W_L("background-color:");
5552 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5571 * It is a handler who processes the MARQUEE tag.
5573 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5574 * destination is specified.
5575 * @param node [i] The MARQUEE tag node is specified.
5576 * @return The conversion result is returned.
5579 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5581 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5582 Doc *doc = jxhtml->doc;
5584 if (IS_CSS_ON(jxhtml->entryp)) {
5585 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5592 * It is handler who processes the New Line Code.
5595 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5597 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5598 if (jxhtml->start_html_flag) {
5599 Doc *doc = jxhtml->doc;
5607 * It is a handler who processes the LINK tag.
5609 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5610 * destination is specified.
5611 * @param node [i] The LINK tag node is specified.
5612 * @return The conversion result is returned.
5615 s_jxhtml_link_tag(void *pdoc, Node *node)
5624 jxhtml = GET_JXHTML(pdoc);
5627 if (! IS_CSS_ON(jxhtml->entryp)) {
5631 for (attr = qs_get_attr(doc,node);
5633 attr = qs_get_next_attr(doc,attr)) {
5634 char *name = qs_get_attr_name(doc,attr);
5635 char *value = qs_get_attr_value(doc,attr);
5636 if (STRCASEEQ('r','R',"rel", name)) {
5637 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5641 else if (STRCASEEQ('h','H',"href", name)) {
5642 if (value && *value) {
5646 else if (STRCASEEQ('t','T',"type", name)) {
5647 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5653 if (rel && href && type) {
5654 DBG(doc->r, "start load CSS. url:[%s]", href);
5655 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
5656 DBG(doc->r, "end load CSS. url:[%s]", href);
5663 static css_prop_list_t *
5664 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5666 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5667 Doc *doc = jxhtml->doc;
5668 css_prop_list_t *last_css = NULL;
5669 if (IS_CSS_ON(jxhtml->entryp)) {
5670 css_prop_list_t *dup_css;
5671 css_selector_t *selector;
5673 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5674 dup_css = chxj_dup_css_prop_list(doc, last_css);
5675 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5677 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5679 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
5680 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5682 if (style_attr_value) {
5683 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));
5685 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5693 static css_prop_list_t *
5694 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5696 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5697 Doc *doc = jxhtml->doc;
5698 css_prop_list_t *last_css = NULL;
5699 if (IS_CSS_ON(jxhtml->entryp)) {
5700 css_prop_list_t *dup_css;
5701 css_selector_t *selector;
5703 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5704 dup_css = chxj_dup_css_prop_list(doc, last_css);
5705 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5707 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5711 if (style_attr_value) {
5712 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));
5714 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5723 * It is a handler who processes the SPAN tag.
5725 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5726 * destination is specified.
5727 * @param node [i] The SPAN tag node is specified.
5728 * @return The conversion result is returned.
5731 s_jxhtml_start_span_tag(void *pdoc, Node *node)
5736 char *attr_style = NULL;
5737 char *attr_color = NULL;
5738 char *attr_size = NULL;
5739 char *attr_align = NULL;
5740 char *attr_blink = NULL;
5741 char *attr_marquee = NULL;
5742 char *attr_marquee_dir = NULL;
5743 char *attr_marquee_style = NULL;
5744 char *attr_marquee_loop = NULL;
5745 char *css_bgcolor = NULL;
5747 jxhtml = GET_JXHTML(pdoc);
5750 for (attr = qs_get_attr(doc,node);
5752 attr = qs_get_next_attr(doc,attr)) {
5753 char *nm = qs_get_attr_name(doc,attr);
5754 char *val = qs_get_attr_value(doc,attr);
5755 if (val && STRCASEEQ('s','S',"style", nm)) {
5759 if (IS_CSS_ON(jxhtml->entryp)) {
5760 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5762 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5763 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5764 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5765 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5766 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5767 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5768 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5769 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5770 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5772 css_property_t *cur;
5773 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5774 attr_color = apr_pstrdup(doc->pool, cur->value);
5776 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5777 if (cur->value && *cur->value) {
5778 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5779 || STRCASEEQ('x','X',"x-small", cur->value)
5780 || STRCASEEQ('s','S',"small", cur->value)
5781 || STRCASEEQ('m','M',"medium", cur->value)
5782 || STRCASEEQ('l','L',"large", cur->value)
5783 || STRCASEEQ('x','X',"x-large", cur->value)
5784 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5785 attr_size = apr_pstrdup(doc->pool, cur->value);
5789 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5790 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5791 attr_blink = apr_pstrdup(doc->pool, cur->value);
5794 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5795 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5796 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5799 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5800 if (cur->value && *cur->value) {
5801 if ( STRCASEEQ('l','L',"ltr",cur->value)
5802 || STRCASEEQ('r','R',"rtl",cur->value)) {
5803 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5807 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5808 if (cur->value && *cur->value) {
5809 if ( STRCASEEQ('s','S',"scroll",cur->value)
5810 || STRCASEEQ('s','S',"slide",cur->value)
5811 || STRCASEEQ('a','A',"alternate",cur->value)) {
5812 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5816 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5817 if (cur->value && *cur->value) {
5818 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
5819 attr_marquee_loop = "infinite";
5822 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5826 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5827 if (STRCASEEQ('l','L',"left", cur->value)) {
5828 attr_align = apr_pstrdup(doc->pool, "left");
5830 else if (STRCASEEQ('c','C',"center",cur->value)) {
5831 attr_align = apr_pstrdup(doc->pool, "center");
5833 else if (STRCASEEQ('r','R',"right",cur->value)) {
5834 attr_align = apr_pstrdup(doc->pool, "right");
5837 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5838 if (cur->value && *cur->value) {
5839 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
5846 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
5849 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5865 W_L("text-decoration:");
5870 W_L("display:-wap-marquee;");
5871 if (attr_marquee_dir) {
5872 W_L("-wap-marquee-dir:");
5873 W_V(attr_marquee_dir);
5876 if (attr_marquee_style) {
5877 W_L("-wap-marquee-style:");
5878 W_V(attr_marquee_style);
5881 if (attr_marquee_loop) {
5882 W_L("-wap-marquee-loop:");
5883 W_V(attr_marquee_loop);
5888 W_L("background-color:");
5900 * It is a handler who processes the SPAN tag.
5902 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5903 * destination is specified.
5904 * @param node [i] The SPAN tag node is specified.
5905 * @return The conversion result is returned.
5908 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
5910 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5911 Doc *doc = jxhtml->doc;
5914 if (IS_CSS_ON(jxhtml->entryp)) {
5915 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5922 * It is a handler who processes the STYLE tag.
5924 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
5925 * destination is specified.
5926 * @param node [i] The STYLE tag node is specified.
5927 * @return The conversion result is returned.
5930 s_jxhtml_style_tag(void *pdoc, Node *node)
5937 jxhtml = GET_JXHTML(pdoc);
5940 if (! IS_CSS_ON(jxhtml->entryp)) {
5944 for (attr = qs_get_attr(doc,node);
5946 attr = qs_get_next_attr(doc,attr)) {
5947 char *name = qs_get_attr_name(doc,attr);
5948 char *value = qs_get_attr_value(doc,attr);
5949 if (STRCASEEQ('t','T',"type", name)) {
5950 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5956 Node *child = qs_get_child_node(doc, node);
5957 if (type && child) {
5958 char *name = qs_get_node_name(doc, child);
5959 if (STRCASEEQ('t','T',"text", name)) {
5960 char *value = qs_get_node_value(doc, child);
5961 DBG(doc->r, "start load CSS. buf:[%s]", value);
5962 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
5963 DBG(doc->r, "end load CSS. value:[%s]", value);