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')) {
1954 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1955 W_L(" istyle=\"4\"");
1957 /*--------------------------------------------------------------------------*/
1958 /* The figure is default for the password. */
1959 /*--------------------------------------------------------------------------*/
1960 if (attr_max_length && *attr_max_length) {
1961 if (chxj_chk_numeric(attr_max_length) == 0) {
1962 W_L(" maxlength=\"");
1963 W_V(attr_max_length);
1968 W_L(" checked=\"checked\"");
1984 jxhtml = GET_JXHTML(pdoc);
1997 /*--------------------------------------------------------------------------*/
1998 /* Get Attributes */
1999 /*--------------------------------------------------------------------------*/
2000 type = qs_get_type_attr(doc, node, doc->buf.pool);
2001 name = qs_get_name_attr(doc, node, doc->buf.pool);
2002 value = qs_get_value_attr(doc,node, doc->buf.pool);
2003 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2004 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2005 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2006 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2007 size = qs_get_size_attr(doc, node, doc->buf.pool);
2010 if (type && (STRCASEEQ('t','T',"text", type) ||
2011 STRCASEEQ('p','P',"password",type) ||
2012 STRCASEEQ('c','C',"checkbox",type) ||
2013 STRCASEEQ('r','R',"radio", type) ||
2014 STRCASEEQ('h','H',"hidden", type) ||
2015 STRCASEEQ('s','S',"submit", type) ||
2016 STRCASEEQ('r','R',"reset", type))) {
2022 if (size && *size) {
2027 if (name && *name) {
2029 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2032 if (value && *value) {
2033 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2034 apr_size_t value_len = strlen(value);
2035 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2039 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2042 if (accesskey && *accesskey) {
2043 W_L(" accesskey=\"");
2047 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2048 /*------------------------------------------------------------------------*/
2050 /*------------------------------------------------------------------------*/
2051 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2052 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2055 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2057 W_L("-wap-input-format:'*");
2063 else if (type && STRCASEEQ('p','P',"password",type)) {
2064 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2066 /*--------------------------------------------------------------------------*/
2067 /* The figure is default for the password. */
2068 /*--------------------------------------------------------------------------*/
2069 if (max_length && *max_length) {
2070 if (chxj_chk_numeric(max_length) == 0) {
2071 W_L(" maxlength=\"");
2078 W_L(" checked=\"checked\"");
2087 * It is a handler who processes the INPUT tag.
2089 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2090 * destination is specified.
2091 * @param node [i] The INPUT tag node is specified.
2092 * @return The conversion result is returned.
2095 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2097 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2103 * It is a handler who processes the CENTER tag.
2105 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2106 * destination is specified.
2107 * @param node [i] The CENTER tag node is specified.
2108 * @return The conversion result is returned.
2111 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2116 char *attr_style = NULL;
2117 char *attr_color = NULL;
2118 char *attr_size = NULL;
2120 jxhtml = GET_JXHTML(pdoc);
2123 for (attr = qs_get_attr(doc,node);
2125 attr = qs_get_next_attr(doc,attr)) {
2126 char *name = qs_get_attr_name(doc,attr);
2127 char *value = qs_get_attr_value(doc,attr);
2128 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2132 if (IS_CSS_ON(jxhtml->entryp)) {
2133 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2135 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2136 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2137 css_property_t *cur;
2138 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2139 if (cur->value && *cur->value) {
2140 attr_color = apr_pstrdup(doc->pool, cur->value);
2143 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2144 if (cur->value && *cur->value) {
2145 attr_size = apr_pstrdup(doc->pool, cur->value);
2152 if (attr_size || attr_color) {
2160 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2174 * It is a handler who processes the CENTER tag.
2176 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2177 * destination is specified.
2178 * @param node [i] The CENTER tag node is specified.
2179 * @return The conversion result is returned.
2182 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2188 jxhtml = GET_JXHTML(pdoc);
2193 if (IS_CSS_ON(jxhtml->entryp)) {
2194 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2201 * It is a handler who processes the li tag.
2203 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2204 * destination is specified.
2205 * @param node [i] The li tag node is specified.
2206 * @return The conversion result is returned.
2209 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2215 char *attr_type = NULL;
2216 char *attr_value = NULL;
2217 char *attr_style = NULL;
2219 jxhtml = GET_JXHTML(pdoc);
2223 for (attr = qs_get_attr(doc,node);
2225 attr = qs_get_next_attr(doc,attr)) {
2226 char *name = qs_get_attr_name(doc,attr);
2227 char *value = qs_get_attr_value(doc,attr);
2228 if (STRCASEEQ('t','T',"type",name)) {
2229 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2230 if (*value == '1') {
2231 attr_type = apr_pstrdup(doc->pool, "decimal");
2233 else if (*value == 'a') {
2234 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2236 else if (*value == 'A') {
2237 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2244 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2247 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2251 if (IS_CSS_ON(jxhtml->entryp)) {
2252 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2254 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2255 css_property_t *cur;
2256 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2257 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2258 attr_type = apr_pstrdup(doc->pool, "decimal");
2260 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2261 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2263 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2264 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2266 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2267 attr_type = apr_pstrdup(doc->pool, "disc");
2269 else if (STRCASEEQ('s','S',"square", cur->value)) {
2270 attr_type = apr_pstrdup(doc->pool, "square");
2272 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2273 attr_type = apr_pstrdup(doc->pool, "circle");
2283 W_L("list-style-type:");
2299 * It is a handler who processes the li tag.
2301 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2302 * destination is specified.
2303 * @param node [i] The li tag node is specified.
2304 * @return The conversion result is returned.
2307 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2313 jxhtml = GET_JXHTML(pdoc);
2317 if (IS_CSS_ON(jxhtml->entryp)) {
2318 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2326 * It is a handler who processes the OL tag.
2328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2329 * destination is specified.
2330 * @param node [i] The OL tag node is specified.
2331 * @return The conversion result is returned.
2334 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2340 char *attr_style = NULL;
2341 char *attr_start = NULL;
2342 char *attr_type = NULL;
2344 jxhtml = GET_JXHTML(pdoc);
2348 /*--------------------------------------------------------------------------*/
2349 /* Get Attributes */
2350 /*--------------------------------------------------------------------------*/
2351 for (attr = qs_get_attr(doc,node);
2353 attr = qs_get_next_attr(doc,attr)) {
2354 char *name = qs_get_attr_name(doc,attr);
2355 char *value = qs_get_attr_value(doc,attr);
2356 if (STRCASEEQ('t','T',"type",name) && value) {
2357 if (*value == '1') {
2358 attr_type = apr_pstrdup(doc->pool, "decimal");
2360 else if (*value == 'a') {
2361 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2363 else if (*value == 'A') {
2364 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2367 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2370 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2374 if (IS_CSS_ON(jxhtml->entryp)) {
2375 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2377 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2378 css_property_t *cur;
2379 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2380 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2381 attr_type = apr_pstrdup(doc->pool, "decimal");
2383 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2384 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2386 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2387 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2395 W_L("list-style-type:");
2412 * It is a handler who processes the OL tag.
2414 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2415 * destination is specified.
2416 * @param node [i] The OL tag node is specified.
2417 * @return The conversion result is returned.
2420 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2426 jxhtml = GET_JXHTML(pdoc);
2431 if (IS_CSS_ON(jxhtml->entryp)) {
2432 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2439 * It is a handler who processes the P tag.
2441 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2442 * destination is specified.
2443 * @param node [i] The P tag node is specified.
2444 * @return The conversion result is returned.
2447 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2453 char *attr_align = NULL;
2454 char *attr_style = NULL;
2455 char *attr_color = NULL;
2456 char *attr_blink = NULL;
2457 char *css_clear = NULL;
2459 jxhtml = GET_JXHTML(pdoc);
2463 for (attr = qs_get_attr(doc,node);
2465 attr = qs_get_next_attr(doc,attr)) {
2466 char *nm = qs_get_attr_name(doc,attr);
2467 char *val = qs_get_attr_value(doc,attr);
2468 if (STRCASEEQ('a','A',"align", nm)) {
2469 /*----------------------------------------------------------------------*/
2470 /* CHTML 1.0 (W3C version 3.2) */
2471 /*----------------------------------------------------------------------*/
2472 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2473 attr_align = apr_pstrdup(doc->buf.pool, val);
2477 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2478 attr_style = apr_pstrdup(doc->buf.pool, val);
2481 if (IS_CSS_ON(jxhtml->entryp)) {
2482 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2484 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2485 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2486 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2487 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2488 css_property_t *cur;
2489 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2490 if (STRCASEEQ('l','L',"left",cur->value)) {
2491 attr_align = apr_pstrdup(doc->pool, "left");
2493 else if (STRCASEEQ('c','C',"center",cur->value)) {
2494 attr_align = apr_pstrdup(doc->pool, "center");
2496 else if (STRCASEEQ('r','R',"right",cur->value)) {
2497 attr_align = apr_pstrdup(doc->pool, "right");
2500 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2501 if (cur->value && *cur->value) {
2502 attr_color = apr_pstrdup(doc->pool, cur->value);
2505 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2506 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2507 attr_blink = apr_pstrdup(doc->pool, cur->value);
2510 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2511 css_clear = apr_pstrdup(doc->pool, cur->value);
2516 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2524 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2530 W_L("text-decoration:");
2547 * It is a handler who processes the P tag.
2549 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2550 * destination is specified.
2551 * @param node [i] The P tag node is specified.
2552 * @return The conversion result is returned.
2555 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2557 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2558 Doc *doc = jxhtml->doc;
2561 if (IS_CSS_ON(jxhtml->entryp)) {
2562 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2569 * It is a handler who processes the PRE tag.
2571 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2572 * destination is specified.
2573 * @param node [i] The PRE tag node is specified.
2574 * @return The conversion result is returned.
2577 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
2579 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2580 Doc *doc = jxhtml->doc;
2582 char *attr_style = NULL;
2584 for (attr = qs_get_attr(doc,node);
2586 attr = qs_get_next_attr(doc,attr)) {
2587 char *nm = qs_get_attr_name(doc,attr);
2588 char *val = qs_get_attr_value(doc,attr);
2589 if (val && STRCASEEQ('s','S',"style", nm)) {
2594 if (IS_CSS_ON(jxhtml->entryp)) {
2595 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2605 * It is a handler who processes the PRE tag.
2607 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2608 * destination is specified.
2609 * @param node [i] The PRE tag node is specified.
2610 * @return The conversion result is returned.
2613 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2615 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2616 Doc *doc = jxhtml->doc;
2620 if (IS_CSS_ON(jxhtml->entryp)) {
2621 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2629 * It is a handler who processes the UL tag.
2631 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2632 * destination is specified.
2633 * @param node [i] The UL tag node is specified.
2634 * @return The conversion result is returned.
2637 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2639 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2640 Doc *doc = jxhtml->doc;
2642 char *attr_type = NULL;
2643 char *attr_style = NULL;
2644 /*--------------------------------------------------------------------------*/
2645 /* Get Attributes */
2646 /*--------------------------------------------------------------------------*/
2647 for (attr = qs_get_attr(doc,node);
2649 attr = qs_get_next_attr(doc,attr)) {
2650 char *name = qs_get_attr_name(doc,attr);
2651 char *value = qs_get_attr_value(doc,attr);
2652 if (STRCASEEQ('t','T',"type",name)) {
2653 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2657 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2661 if (IS_CSS_ON(jxhtml->entryp)) {
2662 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2664 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2665 css_property_t *cur;
2666 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2667 if (STRCASEEQ('d','D',"disc",cur->value)) {
2668 attr_type = apr_pstrdup(doc->pool, "disc");
2670 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2671 attr_type = apr_pstrdup(doc->pool, "circle");
2673 else if (STRCASEEQ('s','S',"square",cur->value)) {
2674 attr_type = apr_pstrdup(doc->pool, "square");
2682 W_L("list-style-type:");
2693 * It is a handler who processes the UL tag.
2695 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2696 * destination is specified.
2697 * @param node [i] The UL tag node is specified.
2698 * @return The conversion result is returned.
2701 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2703 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2704 Doc *doc = jxhtml->doc;
2707 if (IS_CSS_ON(jxhtml->entryp)) {
2708 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2715 * It is a handler who processes the HR tag.
2717 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2718 * destination is specified.
2719 * @param node [i] The HR tag node is specified.
2720 * @return The conversion result is returned.
2723 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
2729 char *attr_align = NULL;
2730 char *attr_size = NULL;
2731 char *attr_width = NULL;
2732 char *attr_noshade = NULL;
2733 char *attr_style = NULL;
2734 char *attr_color = NULL;
2736 char *style_float = NULL;
2737 char *style_border_color = NULL;
2739 jxhtml = GET_JXHTML(pdoc);
2743 for (attr = qs_get_attr(doc,node);
2745 attr = qs_get_next_attr(doc,attr)) {
2746 char *name = qs_get_attr_name (doc,attr);
2747 char *value = qs_get_attr_value(doc,attr);
2751 if (strcasecmp(name, "align") == 0) {
2752 /*--------------------------------------------------------------------*/
2754 /*--------------------------------------------------------------------*/
2755 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2763 if (strcasecmp(name, "size") == 0) {
2764 /*--------------------------------------------------------------------*/
2766 /*--------------------------------------------------------------------*/
2767 if (value && *value) {
2771 else if (strcasecmp(name, "style") == 0) {
2772 if (value && *value) {
2780 if (strcasecmp(name, "width") == 0) {
2781 /*--------------------------------------------------------------------*/
2783 /*--------------------------------------------------------------------*/
2784 if (value && *value) {
2792 if (strcasecmp(name, "noshade") == 0) {
2793 /*--------------------------------------------------------------------*/
2795 /*--------------------------------------------------------------------*/
2796 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2802 if (strcasecmp(name, "color") == 0 && value && *value) {
2803 /*--------------------------------------------------------------------*/
2805 /*--------------------------------------------------------------------*/
2814 if (IS_CSS_ON(jxhtml->entryp)) {
2815 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2817 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2818 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2819 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2821 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2822 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2823 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2824 css_property_t *cur;
2826 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2827 if (STRCASEEQ('s','S',"solid",cur->value)) {
2828 attr_noshade = "noshade";
2831 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2832 char *tmp = apr_pstrdup(doc->pool, cur->value);
2833 char *tmpp = strstr(tmp, "px");
2835 attr_size = apr_pstrdup(doc->pool, tmp);
2839 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
2840 char *tmp = apr_pstrdup(doc->pool,cur->value);
2841 attr_color = apr_pstrdup(doc->pool,tmp);
2844 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2845 char *tmp = apr_pstrdup(doc->pool, cur->value);
2846 char *tmpp = strstr(tmp,"none");
2848 style_float = "center";
2851 style_float = apr_pstrdup(doc->pool,tmp);
2856 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2857 char *tmp = apr_pstrdup(doc->pool, cur->value);
2858 char *tmpp = strstr(tmp, "px");
2860 attr_width = apr_pstrdup(doc->pool, tmp);
2863 tmpp = strstr(tmp, "%");
2865 attr_width = apr_pstrdup(doc->pool, tmp);
2870 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2871 char *tmp = apr_pstrdup(doc->pool, cur->value);
2873 style_border_color = apr_pstrdup(doc->pool, tmp);
2891 if (attr_size || attr_width || attr_noshade || style_border_color) {
2896 if (!strstr(attr_size, "px")) {
2904 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2910 W_L("border-style:solid;");
2912 if(style_border_color){
2913 W_L("border-color:");
2914 W_V(style_border_color);
2932 * It is a handler who processes the HR tag.
2934 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
2935 * destination is specified.
2936 * @param node [i] The HR tag node is specified.
2937 * @return The conversion result is returned.
2940 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2942 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2948 * It is a handler who processes the IMG tag.
2950 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2951 * destination is specified.
2952 * @param node [i] The IMG tag node is specified.
2953 * @return The conversion result is returned.
2956 s_jxhtml_start_img_tag(void *pdoc, Node *node)
2958 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2959 Doc *doc = jxhtml->doc;
2960 request_rec *r = doc->r;
2962 char *attr_src = NULL;
2963 char *attr_height = NULL;
2964 char *attr_width = NULL;
2965 char *attr_align = NULL;
2966 char *attr_alt = NULL;
2967 char *attr_style = NULL;
2968 char *attr_hspace = NULL;
2969 char *attr_vspace = NULL;
2971 char *css_float = NULL;
2972 char *css_margin_left = NULL;
2973 char *css_margin_right = NULL;
2974 char *css_margin_top = NULL;
2975 char *css_margin_bottom = NULL;
2976 char *css_display = NULL;
2977 char *css_valign = NULL;
2979 #ifndef IMG_NOT_CONVERT_FILENAME
2980 device_table *spec = jxhtml->spec;
2983 /*--------------------------------------------------------------------------*/
2984 /* Get Attributes */
2985 /*--------------------------------------------------------------------------*/
2986 for (attr = qs_get_attr(doc,node);
2988 attr = qs_get_next_attr(doc,attr)) {
2989 char *name = qs_get_attr_name(doc,attr);
2990 char *value = qs_get_attr_value(doc,attr);
2991 if (STRCASEEQ('s','S',"src",name)) {
2992 /*----------------------------------------------------------------------*/
2994 /*----------------------------------------------------------------------*/
2995 #ifdef IMG_NOT_CONVERT_FILENAME
2996 value = chxj_encoding_parameter(r, value, 1);
2997 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
2998 value = chxj_add_cookie_no_update_parameter(r, value);
3001 value = chxj_img_conv(r, spec, value);
3002 value = chxj_encoding_parameter(r, value, 1);
3003 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3004 value = chxj_add_cookie_no_update_parameter(r, value);
3008 else if (STRCASEEQ('a','A',"align",name)) {
3009 /*----------------------------------------------------------------------*/
3011 /*----------------------------------------------------------------------*/
3013 if (STRCASEEQ('t','T',"top", value) ||
3014 STRCASEEQ('m','M',"middle",value) ||
3015 STRCASEEQ('b','B',"bottom",value)){
3017 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3020 else if (STRCASEEQ('c','C',"center",value)) {
3021 css_valign = apr_pstrdup(doc->pool, "middle");
3025 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3026 /*----------------------------------------------------------------------*/
3028 /*----------------------------------------------------------------------*/
3031 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3032 /*----------------------------------------------------------------------*/
3034 /*----------------------------------------------------------------------*/
3035 attr_height = value;
3037 else if (STRCASEEQ('h','H',"hspace",name)) {
3038 /*----------------------------------------------------------------------*/
3040 /*----------------------------------------------------------------------*/
3041 attr_hspace = value;
3043 else if (STRCASEEQ('v','V',"vspace",name)) {
3044 /*----------------------------------------------------------------------*/
3046 /*----------------------------------------------------------------------*/
3047 attr_vspace = value;
3049 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3050 /*----------------------------------------------------------------------*/
3052 /*----------------------------------------------------------------------*/
3055 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3056 /*----------------------------------------------------------------------*/
3058 /*----------------------------------------------------------------------*/
3063 if (IS_CSS_ON(jxhtml->entryp)) {
3064 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3066 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3067 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3068 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3069 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3070 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3071 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3072 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3075 css_property_t *cur;
3076 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3077 attr_height = apr_pstrdup(doc->pool, cur->value);
3079 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3080 attr_width = apr_pstrdup(doc->pool, cur->value);
3083 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3084 css_valign = apr_pstrdup(doc->pool, cur->value);
3087 if (! attr_hspace) {
3088 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3089 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3091 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3092 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3095 if (! attr_vspace) {
3096 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3097 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3099 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3100 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3104 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3105 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3106 css_float = apr_pstrdup(doc->pool, cur->value);
3110 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3111 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3112 char *tmp = apr_pstrdup(doc->pool, cur->value);
3113 char *tmpp = strstr(tmp, "none");
3115 css_display = apr_pstrdup(doc->pool, tmp);
3127 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3135 W_L("vertical-align:");
3140 W_L("margin-left:");
3143 W_L("margin-right:");
3148 if(css_margin_left){
3149 W_L("margin-left:");
3150 W_V(css_margin_left);
3153 if(css_margin_right){
3154 W_L("margin-right:");
3155 W_V(css_margin_right);
3163 W_L("margin-bottom:");
3170 W_V(css_margin_top);
3173 if(css_margin_bottom){
3174 W_L("margin-bottom:");
3175 W_V(css_margin_bottom);
3180 W_L("display:none;");
3209 * It is a handler who processes the IMG tag.
3211 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3212 * destination is specified.
3213 * @param node [i] The IMG tag node is specified.
3214 * @return The conversion result is returned.
3217 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3219 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3225 * It is a handler who processes the SELECT tag.
3227 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3228 * destination is specified.
3229 * @param node [i] The SELECT tag node is specified.
3230 * @return The conversion result is returned.
3233 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3235 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3236 Doc *doc = jxhtml->doc;
3240 char *multiple = NULL;
3241 char *attr_style = NULL;
3244 for (attr = qs_get_attr(doc,node);
3246 attr = qs_get_next_attr(doc,attr)) {
3247 char *nm = qs_get_attr_name(doc,attr);
3248 char *val = qs_get_attr_value(doc,attr);
3249 if (STRCASEEQ('s','S',"size",nm)) {
3250 /*----------------------------------------------------------------------*/
3251 /* CHTML 1.0 version 2.0 */
3252 /*----------------------------------------------------------------------*/
3253 size = apr_pstrdup(doc->buf.pool, val);
3255 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3256 /*----------------------------------------------------------------------*/
3257 /* CHTML 1.0 version 2.0 */
3258 /*----------------------------------------------------------------------*/
3259 attr_style = apr_pstrdup(doc->buf.pool, val);
3261 else if (STRCASEEQ('n','N',"name",nm)) {
3262 /*----------------------------------------------------------------------*/
3263 /* CHTML 1.0 version 2.0 */
3264 /*----------------------------------------------------------------------*/
3265 name = apr_pstrdup(doc->buf.pool, val);
3267 else if (STRCASEEQ('m','M',"multiple", nm)) {
3268 /*----------------------------------------------------------------------*/
3269 /* CHTML 1.0 version 2.0 */
3270 /*----------------------------------------------------------------------*/
3271 multiple = apr_pstrdup(doc->buf.pool, val);
3274 if (size && *size) {
3279 if (name && *name) {
3289 if (IS_CSS_ON(jxhtml->entryp)) {
3290 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3298 * It is a handler who processes the SELECT tag.
3300 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3301 * destination is specified.
3302 * @param node [i] The SELECT tag node is specified.
3303 * @return The conversion result is returned.
3306 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3308 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3309 Doc *doc = jxhtml->doc;
3312 if (IS_CSS_ON(jxhtml->entryp)) {
3313 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3320 * It is a handler who processes the OPTION tag.
3322 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3323 * destination is specified.
3324 * @param node [i] The OPTION tag node is specified.
3325 * @return The conversion result is returned.
3328 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3330 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3331 Doc *doc = jxhtml->doc;
3334 char *selected = NULL;
3336 char *attr_style = NULL;
3339 for (attr = qs_get_attr(doc,node);
3341 attr = qs_get_next_attr(doc,attr)) {
3342 char *nm = qs_get_attr_name(doc,attr);
3343 char *val = qs_get_attr_value(doc,attr);
3344 if (STRCASEEQ('s','S',"selected",nm)) {
3345 /*----------------------------------------------------------------------*/
3346 /* CHTML 1.0 version 2.0 */
3347 /*----------------------------------------------------------------------*/
3348 selected = apr_pstrdup(doc->buf.pool, val);
3350 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3351 /*----------------------------------------------------------------------*/
3352 /* CHTML 1.0 version 2.0 */
3353 /*----------------------------------------------------------------------*/
3354 attr_style = apr_pstrdup(doc->buf.pool, val);
3356 else if (STRCASEEQ('v','V',"value",nm)) {
3357 /*----------------------------------------------------------------------*/
3358 /* CHTML 1.0 version 2.0 */
3359 /*----------------------------------------------------------------------*/
3360 value = apr_pstrdup(doc->buf.pool, val);
3373 if (IS_CSS_ON(jxhtml->entryp)) {
3374 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3382 * It is a handler who processes the OPTION tag.
3384 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3385 * destination is specified.
3386 * @param node [i] The OPTION tag node is specified.
3387 * @return The conversion result is returned.
3390 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3392 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3393 Doc *doc = jxhtml->doc;
3396 if (IS_CSS_ON(jxhtml->entryp)) {
3397 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3405 * It is a handler who processes the DIV tag.
3407 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3408 * destination is specified.
3409 * @param node [i] The DIV tag node is specified.
3410 * @return The conversion result is returned.
3413 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3419 char *attr_style = NULL;
3420 char *attr_align = NULL;
3421 char *attr_display = NULL;
3422 char *attr_decoration = NULL;
3423 char *attr_wap_marquee_style = NULL;
3424 char *attr_wap_marquee_dir = NULL;
3425 char *attr_wap_marquee_loop = NULL;
3426 char *attr_color = NULL;
3427 char *attr_bgcolor = NULL;
3428 char *attr_font_size = NULL;
3429 char *css_clear = NULL;
3431 jxhtml = GET_JXHTML(pdoc);
3435 for (attr = qs_get_attr(doc,node);
3437 attr = qs_get_next_attr(doc,attr)) {
3438 char *nm = qs_get_attr_name(doc,attr);
3439 char *val = qs_get_attr_value(doc,attr);
3440 if (STRCASEEQ('a','A',"align",nm)) {
3441 /*----------------------------------------------------------------------*/
3442 /* CHTML 1.0 (W3C version 3.2) */
3443 /*----------------------------------------------------------------------*/
3444 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3445 attr_align = apr_pstrdup(doc->buf.pool, val);
3448 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3449 attr_style = apr_pstrdup(doc->buf.pool, val);
3453 if (IS_CSS_ON(jxhtml->entryp)) {
3454 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3456 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3457 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3458 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3459 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3460 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3461 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3462 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3463 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3465 css_property_t *cur;
3466 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3467 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3468 attr_display = apr_pstrdup(doc->pool, cur->value);
3471 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3472 if (STRCASEEQ('b','B',"blink", cur->value)) {
3473 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3476 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3477 attr_color = apr_pstrdup(doc->pool, cur->value);
3479 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3480 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3481 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3483 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3484 char *ss = strchr(cur->value, '#');
3486 ss = strstr(cur->value, "rgb");
3489 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3490 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3493 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3494 attr_align = apr_pstrdup(doc->pool, cur->value);
3496 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3497 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3498 || STRCASEEQ('x','X',"x-small",cur->value)
3499 || STRCASEEQ('s','S',"small",cur->value)
3500 || STRCASEEQ('m','M',"medium",cur->value)
3501 || STRCASEEQ('l','L',"large",cur->value)
3502 || STRCASEEQ('x','X',"x-large",cur->value)
3503 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3504 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3508 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3509 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3510 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3511 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3512 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3513 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3516 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3517 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3518 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3520 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3521 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3524 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3525 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
3526 attr_wap_marquee_loop = "infinite";
3529 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3533 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3534 css_clear = apr_pstrdup(doc->pool, cur->value);
3542 || attr_wap_marquee_style
3543 || attr_wap_marquee_dir
3544 || attr_wap_marquee_loop
3560 if (attr_decoration) {
3561 W_L("text-decoration:");
3562 W_V(attr_decoration);
3565 if (attr_wap_marquee_style) {
3566 W_L("-wap-marquee-style:");
3567 W_V(attr_wap_marquee_style);
3570 if (attr_wap_marquee_dir) {
3571 W_L("-wap-marquee-dir:");
3572 W_V(attr_wap_marquee_dir);
3575 if (attr_wap_marquee_loop) {
3576 W_L("-wap-marquee-loop:");
3577 W_V(attr_wap_marquee_loop);
3586 W_L("background-color:");
3590 if (attr_font_size) {
3592 W_V(attr_font_size);
3608 * It is a handler who processes the DIV tag.
3610 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3611 * destination is specified.
3612 * @param node [i] The DIV tag node is specified.
3613 * @return The conversion result is returned.
3616 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
3622 jxhtml = GET_JXHTML(pdoc);
3627 if (IS_CSS_ON(jxhtml->entryp)) {
3628 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3635 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
3642 jxhtml = GET_JXHTML(pdoc);
3646 for (child = qs_get_child_node(doc, node);
3648 child = qs_get_next_node(doc, child)) {
3650 s_jxhtml_chxjif_tag(jxhtml, child);
3657 * It is a handler who processes the TEXTARE tag.
3659 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3660 * destination is specified.
3661 * @param node [i] The TEXTAREA tag node is specified.
3662 * @return The conversion result is returned.
3665 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
3671 char *attr_accesskey = NULL;
3672 char *attr_name = NULL;
3673 char *attr_rows = NULL;
3674 char *attr_cols = NULL;
3675 char *attr_istyle = NULL;
3676 char *attr_style = NULL;
3679 jxhtml = GET_JXHTML(pdoc);
3683 jxhtml->textarea_flag++;
3684 for (attr = qs_get_attr(doc,node);
3686 attr = qs_get_next_attr(doc,attr)) {
3687 char *name = qs_get_attr_name(doc,attr);
3688 char *value = qs_get_attr_value(doc,attr);
3689 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3690 attr_accesskey = value;
3692 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3693 attr_istyle = value;
3695 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3698 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3701 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3704 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3708 if (IS_CSS_ON(jxhtml->entryp)) {
3709 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3711 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3712 css_property_t *cur;
3713 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3714 if (strcasestr(cur->value, "<ja:n>")) {
3717 else if (strcasestr(cur->value, "<ja:en>")) {
3720 else if (strcasestr(cur->value, "<ja:hk>")) {
3723 else if (strcasestr(cur->value, "<ja:h>")) {
3730 if (attr_accesskey) {
3731 W_L(" accesskey=\"");
3732 W_V(attr_accesskey);
3751 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
3753 W_L("-wap-input-format:"*");
3764 * It is a handler who processes the TEXTAREA tag.
3766 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3767 * destination is specified.
3768 * @param node [i] The TEXTAREA tag node is specified.
3769 * @return The conversion result is returned.
3772 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3778 jxhtml = GET_JXHTML(pdoc);
3783 jxhtml->textarea_flag--;
3790 * It is a handler who processes the B tag.
3792 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3793 * destination is specified.
3794 * @param node [i] The B tag node is specified.
3795 * @return The conversion result is returned.
3798 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3804 jxhtml = GET_JXHTML(pdoc);
3814 * It is a handler who processes the B tag.
3816 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3817 * destination is specified.
3818 * @param node [i] The B tag node is specified.
3819 * @return The conversion result is returned.
3822 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3824 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
3825 Doc* doc = jxhtml->doc;
3832 s_jxhtml_text_tag(void* pdoc, Node* child)
3843 apr_size_t z2h_input_len;
3845 jxhtml = GET_JXHTML(pdoc);
3849 textval = qs_get_node_value(doc,child);
3850 if (strlen(textval) == 0) {
3854 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3855 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3857 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3858 memset(one_byte, 0, sizeof(one_byte));
3861 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3863 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
3865 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3870 if (is_sjis_kanji(textval[ii])) {
3871 one_byte[0] = textval[ii+0];
3872 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3873 one_byte[0] = textval[ii+1];
3874 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3878 if (jxhtml->pre_flag) {
3879 one_byte[0] = textval[ii+0];
3880 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3883 if (jxhtml->textarea_flag) {
3884 one_byte[0] = textval[ii+0];
3885 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3888 if (textval[ii] != '\r' && textval[ii] != '\n') {
3889 one_byte[0] = textval[ii+0];
3890 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3894 z2h_input_len = strlen(tdst);
3895 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
3903 * It is a handler who processes the BLOCKQUOTE tag.
3905 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3906 * destination is specified.
3907 * @param node [i] The BLOCKQUOTE tag node is specified.
3908 * @return The conversion result is returned.
3911 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
3916 char *attr_style = NULL;
3917 char *attr_color = NULL;
3918 char *attr_size = NULL;
3920 jxhtml = GET_JXHTML(pdoc);
3922 for (attr = qs_get_attr(doc,node);
3924 attr = qs_get_next_attr(doc,attr)) {
3925 char *nm = qs_get_attr_name(doc,attr);
3926 char *val = qs_get_attr_value(doc,attr);
3927 if (val && STRCASEEQ('s','S',"style", nm)) {
3931 if (IS_CSS_ON(jxhtml->entryp)) {
3932 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3934 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3935 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3936 css_property_t *cur;
3937 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3938 if (cur->value && *cur->value) {
3939 attr_color = apr_pstrdup(doc->pool, cur->value);
3942 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3943 if (cur->value && *cur->value) {
3944 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3945 attr_size = apr_pstrdup(doc->pool, cur->value);
3947 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3948 attr_size = apr_pstrdup(doc->pool, cur->value);
3950 else if (STRCASEEQ('s','S',"small",cur->value)) {
3951 attr_size = apr_pstrdup(doc->pool, cur->value);
3953 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3954 attr_size = apr_pstrdup(doc->pool, cur->value);
3956 else if (STRCASEEQ('l','L',"large",cur->value)) {
3957 attr_size = apr_pstrdup(doc->pool, cur->value);
3959 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3960 attr_size = apr_pstrdup(doc->pool, cur->value);
3962 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3963 attr_size = apr_pstrdup(doc->pool, cur->value);
3970 if (attr_color || attr_size) {
3973 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3991 * It is a handler who processes the BLOCKQUOTE tag.
3993 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3994 * destination is specified.
3995 * @param node [i] The BLOCKQUOTE tag node is specified.
3996 * @return The conversion result is returned.
3999 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4001 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4002 Doc *doc = jxhtml->doc;
4003 W_L("</blockquote>");
4004 if (IS_CSS_ON(jxhtml->entryp)) {
4005 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4012 * It is a handler who processes the DIR tag.
4014 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4015 * destination is specified.
4016 * @param node [i] The DIR tag node is specified.
4017 * @return The conversion result is returned.
4020 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4022 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4023 Doc *doc = jxhtml->doc;
4025 char *attr_style = NULL;
4026 char *attr_color = NULL;
4027 char *attr_type = NULL;
4028 char *attr_size = NULL;
4029 for (attr = qs_get_attr(doc,node);
4031 attr = qs_get_next_attr(doc,attr)) {
4032 char *name = qs_get_attr_name(doc,attr);
4033 char *value = qs_get_attr_value(doc,attr);
4034 if (STRCASEEQ('t','T',"type",name)) {
4035 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4039 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4043 if (IS_CSS_ON(jxhtml->entryp)) {
4044 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4046 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4047 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4048 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4049 css_property_t *cur;
4050 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4051 if (cur->value && *cur->value) {
4052 attr_color = apr_pstrdup(doc->pool, cur->value);
4055 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4056 if (cur->value && *cur->value) {
4057 attr_type = apr_pstrdup(doc->pool, cur->value);
4060 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4061 if (cur->value && *cur->value) {
4062 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4063 attr_size = apr_pstrdup(doc->pool, cur->value);
4065 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4066 attr_size = apr_pstrdup(doc->pool, cur->value);
4068 else if (STRCASEEQ('s','S',"small",cur->value)) {
4069 attr_size = apr_pstrdup(doc->pool, cur->value);
4071 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4072 attr_size = apr_pstrdup(doc->pool, cur->value);
4074 else if (STRCASEEQ('l','L',"large",cur->value)) {
4075 attr_size = apr_pstrdup(doc->pool, cur->value);
4077 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4078 attr_size = apr_pstrdup(doc->pool, cur->value);
4080 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4081 attr_size = apr_pstrdup(doc->pool, cur->value);
4088 if (attr_type || attr_color || attr_size) {
4091 W_L("list-style-type:");
4096 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4114 * It is a handler who processes the DIR tag.
4116 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4117 * destination is specified.
4118 * @param node [i] The DIR tag node is specified.
4119 * @return The conversion result is returned.
4122 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4124 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4125 Doc *doc = jxhtml->doc;
4127 if (IS_CSS_ON(jxhtml->entryp)) {
4128 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4135 * It is a handler who processes the DL tag.
4137 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4138 * destination is specified.
4139 * @param node [i] The DL tag node is specified.
4140 * @return The conversion result is returned.
4143 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4145 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4146 Doc *doc = jxhtml->doc;
4148 char *attr_style = NULL;
4149 char *attr_color = NULL;
4150 char *attr_size = NULL;
4151 for (attr = qs_get_attr(doc,node);
4153 attr = qs_get_next_attr(doc,attr)) {
4154 char *name = qs_get_attr_name(doc,attr);
4155 char *value = qs_get_attr_value(doc,attr);
4156 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4160 if (IS_CSS_ON(jxhtml->entryp)) {
4161 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4163 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4164 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4165 css_property_t *cur;
4166 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4167 if (cur->value && *cur->value) {
4168 attr_color = apr_pstrdup(doc->pool, cur->value);
4171 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4172 if (cur->value && *cur->value) {
4173 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4174 attr_size = apr_pstrdup(doc->pool, cur->value);
4176 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4177 attr_size = apr_pstrdup(doc->pool, cur->value);
4179 else if (STRCASEEQ('s','S',"small",cur->value)) {
4180 attr_size = apr_pstrdup(doc->pool, cur->value);
4182 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4183 attr_size = apr_pstrdup(doc->pool, cur->value);
4185 else if (STRCASEEQ('l','L',"large",cur->value)) {
4186 attr_size = apr_pstrdup(doc->pool, cur->value);
4188 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4189 attr_size = apr_pstrdup(doc->pool, cur->value);
4191 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4192 attr_size = apr_pstrdup(doc->pool, cur->value);
4199 if (attr_color || attr_size) {
4202 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4220 * It is a handler who processes the DL tag.
4222 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4223 * destination is specified.
4224 * @param node [i] The DL tag node is specified.
4225 * @return The conversion result is returned.
4228 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4230 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4231 Doc *doc = jxhtml->doc;
4233 if (IS_CSS_ON(jxhtml->entryp)) {
4234 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4241 * It is a handler who processes the DT tag.
4243 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4244 * destination is specified.
4245 * @param node [i] The DT tag node is specified.
4246 * @return The conversion result is returned.
4249 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4251 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4252 Doc *doc = jxhtml->doc;
4254 char *attr_style = NULL;
4255 char *attr_color = NULL;
4256 char *attr_size = NULL;
4257 for (attr = qs_get_attr(doc,node);
4259 attr = qs_get_next_attr(doc,attr)) {
4260 char *name = qs_get_attr_name(doc,attr);
4261 char *value = qs_get_attr_value(doc,attr);
4262 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4266 if (IS_CSS_ON(jxhtml->entryp)) {
4267 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4269 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4270 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4271 css_property_t *cur;
4272 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4273 if (cur->value && *cur->value) {
4274 attr_color = apr_pstrdup(doc->pool, cur->value);
4277 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4278 if (cur->value && *cur->value) {
4279 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4280 attr_size = apr_pstrdup(doc->pool, cur->value);
4282 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4283 attr_size = apr_pstrdup(doc->pool, cur->value);
4285 else if (STRCASEEQ('s','S',"small",cur->value)) {
4286 attr_size = apr_pstrdup(doc->pool, cur->value);
4288 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4289 attr_size = apr_pstrdup(doc->pool, cur->value);
4291 else if (STRCASEEQ('l','L',"large",cur->value)) {
4292 attr_size = apr_pstrdup(doc->pool, cur->value);
4294 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4295 attr_size = apr_pstrdup(doc->pool, cur->value);
4297 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4298 attr_size = apr_pstrdup(doc->pool, cur->value);
4305 if (attr_color || attr_size) {
4308 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4326 * It is a handler who processes the DT tag.
4328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4329 * destination is specified.
4330 * @param node [i] The DT tag node is specified.
4331 * @return The conversion result is returned.
4334 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4336 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4337 Doc *doc = jxhtml->doc;
4339 if (IS_CSS_ON(jxhtml->entryp)) {
4340 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4347 * It is a handler who processes the DD tag.
4349 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4350 * destination is specified.
4351 * @param node [i] The DD tag node is specified.
4352 * @return The conversion result is returned.
4355 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4357 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4358 Doc *doc = jxhtml->doc;
4360 char *attr_style = NULL;
4361 char *attr_color = NULL;
4362 char *attr_size = NULL;
4363 for (attr = qs_get_attr(doc,node);
4365 attr = qs_get_next_attr(doc,attr)) {
4366 char *name = qs_get_attr_name(doc,attr);
4367 char *value = qs_get_attr_value(doc,attr);
4368 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4372 if (IS_CSS_ON(jxhtml->entryp)) {
4373 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4375 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4376 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4377 css_property_t *cur;
4378 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4379 if (cur->value && *cur->value) {
4380 attr_color = apr_pstrdup(doc->pool, cur->value);
4383 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4384 if (cur->value && *cur->value) {
4385 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4386 attr_size = apr_pstrdup(doc->pool, cur->value);
4388 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4389 attr_size = apr_pstrdup(doc->pool, cur->value);
4391 else if (STRCASEEQ('s','S',"small",cur->value)) {
4392 attr_size = apr_pstrdup(doc->pool, cur->value);
4394 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4395 attr_size = apr_pstrdup(doc->pool, cur->value);
4397 else if (STRCASEEQ('l','L',"large",cur->value)) {
4398 attr_size = apr_pstrdup(doc->pool, cur->value);
4400 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4401 attr_size = apr_pstrdup(doc->pool, cur->value);
4403 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4404 attr_size = apr_pstrdup(doc->pool, cur->value);
4411 if (attr_color || attr_size) {
4414 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4432 * It is a handler who processes the DD tag.
4434 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4435 * destination is specified.
4436 * @param node [i] The DD tag node is specified.
4437 * @return The conversion result is returned.
4440 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4442 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4443 Doc *doc = jxhtml->doc;
4445 if (IS_CSS_ON(jxhtml->entryp)) {
4446 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4453 * It is a handler who processes the H1 tag.
4455 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4456 * destination is specified.
4457 * @param node [i] The H1 tag node is specified.
4458 * @return The conversion result is returned.
4461 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4467 char *attr_style = NULL;
4468 char *attr_align = NULL;
4469 char *css_clear = NULL;
4471 jxhtml = GET_JXHTML(pdoc);
4475 for (attr = qs_get_attr(doc,node);
4477 attr = qs_get_next_attr(doc,attr)) {
4478 char *name = qs_get_attr_name(doc,attr);
4479 char *value = qs_get_attr_value(doc,attr);
4480 if (STRCASEEQ('a','A',"align", name)) {
4481 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4485 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4489 if (IS_CSS_ON(jxhtml->entryp)) {
4490 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4492 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4493 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4494 css_property_t *cur;
4495 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4496 if (STRCASEEQ('l','L',"left", cur->value)) {
4497 attr_align = apr_pstrdup(doc->pool, "left");
4499 else if (STRCASEEQ('c','C',"center",cur->value)) {
4500 attr_align = apr_pstrdup(doc->pool, "center");
4502 else if (STRCASEEQ('r','R',"right",cur->value)) {
4503 attr_align = apr_pstrdup(doc->pool, "right");
4506 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4507 if (STRCASEEQ('b','B',"both", cur->value)) {
4508 css_clear = apr_pstrdup(doc->pool, "both");
4510 else if (STRCASEEQ('r','R',"right", cur->value)) {
4511 css_clear = apr_pstrdup(doc->pool, "right");
4513 else if (STRCASEEQ('l','L',"left", cur->value)) {
4514 css_clear = apr_pstrdup(doc->pool, "left");
4520 if (attr_align || css_clear ) {
4541 * It is a handler who processes the H1 tag.
4543 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4544 * destination is specified.
4545 * @param node [i] The H1 tag node is specified.
4546 * @return The conversion result is returned.
4549 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4555 jxhtml = GET_JXHTML(pdoc);
4560 if (IS_CSS_ON(jxhtml->entryp)) {
4561 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4569 * It is a handler who processes the H2 tag.
4571 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4572 * destination is specified.
4573 * @param node [i] The H1 tag node is specified.
4574 * @return The conversion result is returned.
4577 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
4583 char *attr_style = NULL;
4584 char *attr_align = NULL;
4585 char *css_clear = NULL;
4587 jxhtml = GET_JXHTML(pdoc);
4591 for (attr = qs_get_attr(doc,node);
4593 attr = qs_get_next_attr(doc,attr)) {
4594 char *name = qs_get_attr_name(doc,attr);
4595 char *value = qs_get_attr_value(doc,attr);
4596 if (STRCASEEQ('a','A',"align", name)) {
4597 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4601 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4605 if (IS_CSS_ON(jxhtml->entryp)) {
4606 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4608 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4609 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4610 css_property_t *cur;
4611 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4612 if (STRCASEEQ('l','L',"left", cur->value)) {
4613 attr_align = apr_pstrdup(doc->pool, "left");
4615 else if (STRCASEEQ('c','C',"center",cur->value)) {
4616 attr_align = apr_pstrdup(doc->pool, "center");
4618 else if (STRCASEEQ('r','R',"right",cur->value)) {
4619 attr_align = apr_pstrdup(doc->pool, "right");
4622 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4623 if (STRCASEEQ('b','B',"both", cur->value)) {
4624 css_clear = apr_pstrdup(doc->pool, "both");
4626 else if (STRCASEEQ('r','R',"right", cur->value)) {
4627 css_clear = apr_pstrdup(doc->pool, "right");
4629 else if (STRCASEEQ('l','L',"left", cur->value)) {
4630 css_clear = apr_pstrdup(doc->pool, "left");
4636 if (attr_align || css_clear ) {
4657 * It is a handler who processes the H2 tag.
4659 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4660 * destination is specified.
4661 * @param node [i] The H1 tag node is specified.
4662 * @return The conversion result is returned.
4665 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
4671 jxhtml = GET_JXHTML(pdoc);
4676 if (IS_CSS_ON(jxhtml->entryp)) {
4677 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4684 * It is a handler who processes the H3 tag.
4686 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4687 * destination is specified.
4688 * @param node [i] The H1 tag node is specified.
4689 * @return The conversion result is returned.
4692 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
4698 char *attr_style = NULL;
4699 char *attr_align = NULL;
4700 char *css_clear = NULL;
4702 jxhtml = GET_JXHTML(pdoc);
4706 for (attr = qs_get_attr(doc,node);
4708 attr = qs_get_next_attr(doc,attr)) {
4709 char *name = qs_get_attr_name(doc,attr);
4710 char *value = qs_get_attr_value(doc,attr);
4711 if (STRCASEEQ('a','A',"align", name)) {
4712 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4716 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4720 if (IS_CSS_ON(jxhtml->entryp)) {
4721 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4723 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4724 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4725 css_property_t *cur;
4726 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4727 if (STRCASEEQ('l','L',"left", cur->value)) {
4728 attr_align = apr_pstrdup(doc->pool, "left");
4730 else if (STRCASEEQ('c','C',"center",cur->value)) {
4731 attr_align = apr_pstrdup(doc->pool, "center");
4733 else if (STRCASEEQ('r','R',"right",cur->value)) {
4734 attr_align = apr_pstrdup(doc->pool, "right");
4737 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4738 if (STRCASEEQ('b','B',"both", cur->value)) {
4739 css_clear = apr_pstrdup(doc->pool, "both");
4741 else if (STRCASEEQ('r','R',"right", cur->value)) {
4742 css_clear = apr_pstrdup(doc->pool, "right");
4744 else if (STRCASEEQ('l','L',"left", cur->value)) {
4745 css_clear = apr_pstrdup(doc->pool, "left");
4751 if (attr_align || css_clear ) {
4772 * It is a handler who processes the H3 tag.
4774 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4775 * destination is specified.
4776 * @param node [i] The H1 tag node is specified.
4777 * @return The conversion result is returned.
4780 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
4786 jxhtml = GET_JXHTML(pdoc);
4791 if (IS_CSS_ON(jxhtml->entryp)) {
4792 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4799 * It is a handler who processes the H4 tag.
4801 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4802 * destination is specified.
4803 * @param node [i] The H1 tag node is specified.
4804 * @return The conversion result is returned.
4807 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
4813 char *attr_style = NULL;
4814 char *attr_align = NULL;
4815 char *css_clear = NULL;
4817 jxhtml = GET_JXHTML(pdoc);
4821 for (attr = qs_get_attr(doc,node);
4823 attr = qs_get_next_attr(doc,attr)) {
4824 char *name = qs_get_attr_name(doc,attr);
4825 char *value = qs_get_attr_value(doc,attr);
4826 if (STRCASEEQ('a','A',"align", name)) {
4827 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4831 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4835 if (IS_CSS_ON(jxhtml->entryp)) {
4836 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4838 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4839 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4840 css_property_t *cur;
4841 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4842 if (STRCASEEQ('l','L',"left", cur->value)) {
4843 attr_align = apr_pstrdup(doc->pool, "left");
4845 else if (STRCASEEQ('c','C',"center",cur->value)) {
4846 attr_align = apr_pstrdup(doc->pool, "center");
4848 else if (STRCASEEQ('r','R',"right",cur->value)) {
4849 attr_align = apr_pstrdup(doc->pool, "right");
4852 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4853 if (STRCASEEQ('b','B',"both", cur->value)) {
4854 css_clear = apr_pstrdup(doc->pool, "both");
4856 else if (STRCASEEQ('r','R',"right", cur->value)) {
4857 css_clear = apr_pstrdup(doc->pool, "right");
4859 else if (STRCASEEQ('l','L',"left", cur->value)) {
4860 css_clear = apr_pstrdup(doc->pool, "left");
4866 if (attr_align || css_clear ) {
4887 * It is a handler who processes the H4 tag.
4889 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4890 * destination is specified.
4891 * @param node [i] The H1 tag node is specified.
4892 * @return The conversion result is returned.
4895 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
4901 jxhtml = GET_JXHTML(pdoc);
4906 if (IS_CSS_ON(jxhtml->entryp)) {
4907 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4915 * It is a handler who processes the H5 tag.
4917 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4918 * destination is specified.
4919 * @param node [i] The H1 tag node is specified.
4920 * @return The conversion result is returned.
4923 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
4929 char *attr_style = NULL;
4930 char *attr_align = NULL;
4931 char *css_clear = NULL;
4933 jxhtml = GET_JXHTML(pdoc);
4937 for (attr = qs_get_attr(doc,node);
4939 attr = qs_get_next_attr(doc,attr)) {
4940 char *name = qs_get_attr_name(doc,attr);
4941 char *value = qs_get_attr_value(doc,attr);
4942 if (STRCASEEQ('a','A',"align", name)) {
4943 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4947 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4951 if (IS_CSS_ON(jxhtml->entryp)) {
4952 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4954 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4955 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4956 css_property_t *cur;
4957 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4958 if (STRCASEEQ('l','L',"left", cur->value)) {
4959 attr_align = apr_pstrdup(doc->pool, "left");
4961 else if (STRCASEEQ('c','C',"center",cur->value)) {
4962 attr_align = apr_pstrdup(doc->pool, "center");
4964 else if (STRCASEEQ('r','R',"right",cur->value)) {
4965 attr_align = apr_pstrdup(doc->pool, "right");
4968 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4969 if (STRCASEEQ('b','B',"both", cur->value)) {
4970 css_clear = apr_pstrdup(doc->pool, "both");
4972 else if (STRCASEEQ('r','R',"right", cur->value)) {
4973 css_clear = apr_pstrdup(doc->pool, "right");
4975 else if (STRCASEEQ('l','L',"left", cur->value)) {
4976 css_clear = apr_pstrdup(doc->pool, "left");
4982 if (attr_align || css_clear ) {
5003 * It is a handler who processes the H5 tag.
5005 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5006 * destination is specified.
5007 * @param node [i] The H1 tag node is specified.
5008 * @return The conversion result is returned.
5011 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5017 jxhtml = GET_JXHTML(pdoc);
5022 if (IS_CSS_ON(jxhtml->entryp)) {
5023 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5031 * It is a handler who processes the H6 tag.
5033 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5034 * destination is specified.
5035 * @param node [i] The H1 tag node is specified.
5036 * @return The conversion result is returned.
5039 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5045 char *attr_style = NULL;
5046 char *attr_align = NULL;
5047 char *css_clear = NULL;
5049 jxhtml = GET_JXHTML(pdoc);
5053 for (attr = qs_get_attr(doc,node);
5055 attr = qs_get_next_attr(doc,attr)) {
5056 char *name = qs_get_attr_name(doc,attr);
5057 char *value = qs_get_attr_value(doc,attr);
5058 if (STRCASEEQ('a','A',"align", name)) {
5059 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5063 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5067 if (IS_CSS_ON(jxhtml->entryp)) {
5068 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5070 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5071 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5072 css_property_t *cur;
5073 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5074 if (STRCASEEQ('l','L',"left", cur->value)) {
5075 attr_align = apr_pstrdup(doc->pool, "left");
5077 else if (STRCASEEQ('c','C',"center",cur->value)) {
5078 attr_align = apr_pstrdup(doc->pool, "center");
5080 else if (STRCASEEQ('r','R',"right",cur->value)) {
5081 attr_align = apr_pstrdup(doc->pool, "right");
5084 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5085 if (STRCASEEQ('b','B',"both", cur->value)) {
5086 css_clear = apr_pstrdup(doc->pool, "both");
5088 else if (STRCASEEQ('r','R',"right", cur->value)) {
5089 css_clear = apr_pstrdup(doc->pool, "right");
5091 else if (STRCASEEQ('l','L',"left", cur->value)) {
5092 css_clear = apr_pstrdup(doc->pool, "left");
5098 if (attr_align || css_clear ) {
5119 * It is a handler who processes the H6 tag.
5121 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5122 * destination is specified.
5123 * @param node [i] The H1 tag node is specified.
5124 * @return The conversion result is returned.
5127 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5133 jxhtml = GET_JXHTML(pdoc);
5138 if (IS_CSS_ON(jxhtml->entryp)) {
5139 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5147 * It is a handler who processes the MENU tag.
5149 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5150 * destination is specified.
5151 * @param node [i] The MENU tag node is specified.
5152 * @return The conversion result is returned.
5155 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5157 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5158 Doc *doc = jxhtml->doc;
5160 char *attr_style = NULL;
5161 char *attr_color = NULL;
5162 char *attr_type = NULL;
5163 char *attr_size = NULL;
5164 for (attr = qs_get_attr(doc,node);
5166 attr = qs_get_next_attr(doc,attr)) {
5167 char *name = qs_get_attr_name(doc,attr);
5168 char *value = qs_get_attr_value(doc,attr);
5169 if (STRCASEEQ('t','T',"type",name)) {
5170 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5174 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5178 if (IS_CSS_ON(jxhtml->entryp)) {
5179 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5181 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5182 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5183 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5184 css_property_t *cur;
5185 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5186 if (cur->value && *cur->value) {
5187 attr_color = apr_pstrdup(doc->pool, cur->value);
5190 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5191 if (cur->value && *cur->value) {
5192 attr_type = apr_pstrdup(doc->pool, cur->value);
5195 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5196 if (cur->value && *cur->value) {
5197 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5198 attr_size = apr_pstrdup(doc->pool, cur->value);
5200 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5201 attr_size = apr_pstrdup(doc->pool, cur->value);
5203 else if (STRCASEEQ('s','S',"small",cur->value)) {
5204 attr_size = apr_pstrdup(doc->pool, cur->value);
5206 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5207 attr_size = apr_pstrdup(doc->pool, cur->value);
5209 else if (STRCASEEQ('l','L',"large",cur->value)) {
5210 attr_size = apr_pstrdup(doc->pool, cur->value);
5212 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5213 attr_size = apr_pstrdup(doc->pool, cur->value);
5215 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5216 attr_size = apr_pstrdup(doc->pool, cur->value);
5223 if (attr_type || attr_color || attr_size) {
5226 W_L("list-style-type:");
5231 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5249 * It is a handler who processes the MENU tag.
5251 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5252 * destination is specified.
5253 * @param node [i] The MENU tag node is specified.
5254 * @return The conversion result is returned.
5257 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5259 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5260 Doc *doc = jxhtml->doc;
5262 if (IS_CSS_ON(jxhtml->entryp)) {
5263 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5270 * It is a handler who processes the PLAINTEXT tag.
5272 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5273 * destination is specified.
5274 * @param node [i] The PLAINTEXT tag node is specified.
5275 * @return The conversion result is returned.
5278 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5283 jxhtml = GET_JXHTML(pdoc);
5286 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5291 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5296 jxhtml = GET_JXHTML(pdoc);
5298 for (child = qs_get_child_node(doc, node);
5300 child = qs_get_next_node(doc, child)) {
5302 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5309 * It is a handler who processes the PLAINTEXT tag.
5311 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5312 * destination is specified.
5313 * @param node [i] The PLAINTEXT tag node is specified.
5314 * @return The conversion result is returned.
5317 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5319 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5325 * It is a handler who processes the BLINK tag.
5327 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5328 * destination is specified.
5329 * @param node [i] The BLINK tag node is specified.
5330 * @return The conversion result is returned.
5333 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5335 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5336 Doc *doc = jxhtml->doc;
5338 char *attr_style = NULL;
5339 char *attr_color = NULL;
5340 char *attr_size = NULL;
5341 for (attr = qs_get_attr(doc,node);
5343 attr = qs_get_next_attr(doc,attr)) {
5344 char *name = qs_get_attr_name(doc,attr);
5345 char *value = qs_get_attr_value(doc,attr);
5346 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5350 if (IS_CSS_ON(jxhtml->entryp)) {
5351 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5353 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5354 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5355 css_property_t *cur;
5356 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5357 if (cur->value && *cur->value) {
5358 attr_color = apr_pstrdup(doc->pool, cur->value);
5361 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5362 if (cur->value && *cur->value) {
5363 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5364 attr_size = apr_pstrdup(doc->pool, cur->value);
5366 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5367 attr_size = apr_pstrdup(doc->pool, cur->value);
5369 else if (STRCASEEQ('s','S',"small",cur->value)) {
5370 attr_size = apr_pstrdup(doc->pool, cur->value);
5372 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5373 attr_size = apr_pstrdup(doc->pool, cur->value);
5375 else if (STRCASEEQ('l','L',"large",cur->value)) {
5376 attr_size = apr_pstrdup(doc->pool, cur->value);
5378 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5379 attr_size = apr_pstrdup(doc->pool, cur->value);
5381 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5382 attr_size = apr_pstrdup(doc->pool, cur->value);
5389 if (attr_color || attr_size) {
5392 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5410 * It is a handler who processes the BLINK tag.
5412 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5413 * destination is specified.
5414 * @param node [i] The BLINK tag node is specified.
5415 * @return The conversion result is returned.
5418 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5420 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5421 Doc *doc = jxhtml->doc;
5423 if (IS_CSS_ON(jxhtml->entryp)) {
5424 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5431 * It is a handler who processes the MARQUEE tag.
5433 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5434 * destination is specified.
5435 * @param node [i] The MARQUEE tag node is specified.
5436 * @return The conversion result is returned.
5439 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5441 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5442 Doc *doc = jxhtml->doc;
5444 char *attr_direction = NULL;
5445 char *attr_style = NULL;
5446 char *attr_color = NULL;
5447 char *attr_size = NULL;
5448 char *attr_bgcolor = NULL;
5449 /*--------------------------------------------------------------------------*/
5450 /* Get Attributes */
5451 /*--------------------------------------------------------------------------*/
5452 for (attr = qs_get_attr(doc,node);
5454 attr = qs_get_next_attr(doc,attr)) {
5455 char *name = qs_get_attr_name(doc,attr);
5456 char *value = qs_get_attr_value(doc,attr);
5457 if (STRCASEEQ('d','D',"direction", name)) {
5459 if (STRCASEEQ('l','L',"left",value)) {
5460 attr_direction = "rtl";
5462 else if (STRCASEEQ('r','R',"right",value)) {
5463 attr_direction = "ltr";
5467 else if (STRCASEEQ('b','B',"behavior",name)) {
5470 else if (STRCASEEQ('l','L',"loop",name)) {
5473 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5474 if (value && *value) {
5475 attr_bgcolor = value;
5478 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5482 if (IS_CSS_ON(jxhtml->entryp)) {
5483 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5485 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5486 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5487 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5488 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5489 css_property_t *cur;
5490 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5491 if (cur->value && *cur->value) {
5492 attr_color = apr_pstrdup(doc->pool, cur->value);
5495 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5496 if (cur->value && *cur->value) {
5497 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5500 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5501 if (cur->value && *cur->value) {
5502 attr_direction = apr_pstrdup(doc->pool, cur->value);
5505 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5506 if (cur->value && *cur->value) {
5507 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5508 || STRCASEEQ('x','X',"x-small", cur->value)
5509 || STRCASEEQ('s','S',"small", cur->value)
5510 || STRCASEEQ('m','M',"medium", cur->value)
5511 || STRCASEEQ('l','L',"large", cur->value)
5512 || STRCASEEQ('x','X',"x-large", cur->value)
5513 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5514 attr_size = apr_pstrdup(doc->pool, cur->value);
5521 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5523 if (attr_direction) {
5524 W_L("-wap-marquee-dir:");
5525 W_V(attr_direction);
5529 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5530 W_L("background-color:");
5535 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5554 * It is a handler who processes the MARQUEE tag.
5556 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5557 * destination is specified.
5558 * @param node [i] The MARQUEE tag node is specified.
5559 * @return The conversion result is returned.
5562 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5564 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5565 Doc *doc = jxhtml->doc;
5567 if (IS_CSS_ON(jxhtml->entryp)) {
5568 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5575 * It is handler who processes the New Line Code.
5578 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5580 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5581 if (jxhtml->start_html_flag) {
5582 Doc *doc = jxhtml->doc;
5590 * It is a handler who processes the LINK tag.
5592 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5593 * destination is specified.
5594 * @param node [i] The LINK tag node is specified.
5595 * @return The conversion result is returned.
5598 s_jxhtml_link_tag(void *pdoc, Node *node)
5607 jxhtml = GET_JXHTML(pdoc);
5610 if (! IS_CSS_ON(jxhtml->entryp)) {
5614 for (attr = qs_get_attr(doc,node);
5616 attr = qs_get_next_attr(doc,attr)) {
5617 char *name = qs_get_attr_name(doc,attr);
5618 char *value = qs_get_attr_value(doc,attr);
5619 if (STRCASEEQ('r','R',"rel", name)) {
5620 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5624 else if (STRCASEEQ('h','H',"href", name)) {
5625 if (value && *value) {
5629 else if (STRCASEEQ('t','T',"type", name)) {
5630 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5636 if (rel && href && type) {
5637 DBG(doc->r, "start load CSS. url:[%s]", href);
5638 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
5639 DBG(doc->r, "end load CSS. url:[%s]", href);
5646 static css_prop_list_t *
5647 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5649 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5650 Doc *doc = jxhtml->doc;
5651 css_prop_list_t *last_css = NULL;
5652 if (IS_CSS_ON(jxhtml->entryp)) {
5653 css_prop_list_t *dup_css;
5654 css_selector_t *selector;
5656 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5657 dup_css = chxj_dup_css_prop_list(doc, last_css);
5658 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5660 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5662 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
5663 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5665 if (style_attr_value) {
5666 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));
5668 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5676 static css_prop_list_t *
5677 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5679 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5680 Doc *doc = jxhtml->doc;
5681 css_prop_list_t *last_css = NULL;
5682 if (IS_CSS_ON(jxhtml->entryp)) {
5683 css_prop_list_t *dup_css;
5684 css_selector_t *selector;
5686 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5687 dup_css = chxj_dup_css_prop_list(doc, last_css);
5688 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5690 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5694 if (style_attr_value) {
5695 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));
5697 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5706 * It is a handler who processes the SPAN tag.
5708 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5709 * destination is specified.
5710 * @param node [i] The SPAN tag node is specified.
5711 * @return The conversion result is returned.
5714 s_jxhtml_start_span_tag(void *pdoc, Node *node)
5719 char *attr_style = NULL;
5720 char *attr_color = NULL;
5721 char *attr_size = NULL;
5722 char *attr_align = NULL;
5723 char *attr_blink = NULL;
5724 char *attr_marquee = NULL;
5725 char *attr_marquee_dir = NULL;
5726 char *attr_marquee_style = NULL;
5727 char *attr_marquee_loop = NULL;
5728 char *css_bgcolor = NULL;
5730 jxhtml = GET_JXHTML(pdoc);
5733 for (attr = qs_get_attr(doc,node);
5735 attr = qs_get_next_attr(doc,attr)) {
5736 char *nm = qs_get_attr_name(doc,attr);
5737 char *val = qs_get_attr_value(doc,attr);
5738 if (val && STRCASEEQ('s','S',"style", nm)) {
5742 if (IS_CSS_ON(jxhtml->entryp)) {
5743 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5745 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5746 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5747 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5748 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5749 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5750 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5751 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5752 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5753 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5755 css_property_t *cur;
5756 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5757 attr_color = apr_pstrdup(doc->pool, cur->value);
5759 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5760 if (cur->value && *cur->value) {
5761 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5762 || STRCASEEQ('x','X',"x-small", cur->value)
5763 || STRCASEEQ('s','S',"small", cur->value)
5764 || STRCASEEQ('m','M',"medium", cur->value)
5765 || STRCASEEQ('l','L',"large", cur->value)
5766 || STRCASEEQ('x','X',"x-large", cur->value)
5767 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5768 attr_size = apr_pstrdup(doc->pool, cur->value);
5772 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5773 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5774 attr_blink = apr_pstrdup(doc->pool, cur->value);
5777 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5778 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5779 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5782 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5783 if (cur->value && *cur->value) {
5784 if ( STRCASEEQ('l','L',"ltr",cur->value)
5785 || STRCASEEQ('r','R',"rtl",cur->value)) {
5786 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5790 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5791 if (cur->value && *cur->value) {
5792 if ( STRCASEEQ('s','S',"scroll",cur->value)
5793 || STRCASEEQ('s','S',"slide",cur->value)
5794 || STRCASEEQ('a','A',"alternate",cur->value)) {
5795 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5799 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5800 if (cur->value && *cur->value) {
5801 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
5802 attr_marquee_loop = "infinite";
5805 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5809 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5810 if (STRCASEEQ('l','L',"left", cur->value)) {
5811 attr_align = apr_pstrdup(doc->pool, "left");
5813 else if (STRCASEEQ('c','C',"center",cur->value)) {
5814 attr_align = apr_pstrdup(doc->pool, "center");
5816 else if (STRCASEEQ('r','R',"right",cur->value)) {
5817 attr_align = apr_pstrdup(doc->pool, "right");
5820 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5821 if (cur->value && *cur->value) {
5822 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
5829 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
5832 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5848 W_L("text-decoration:");
5853 W_L("display:-wap-marquee;");
5854 if (attr_marquee_dir) {
5855 W_L("-wap-marquee-dir:");
5856 W_V(attr_marquee_dir);
5859 if (attr_marquee_style) {
5860 W_L("-wap-marquee-style:");
5861 W_V(attr_marquee_style);
5864 if (attr_marquee_loop) {
5865 W_L("-wap-marquee-loop:");
5866 W_V(attr_marquee_loop);
5871 W_L("background-color:");
5883 * It is a handler who processes the SPAN tag.
5885 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5886 * destination is specified.
5887 * @param node [i] The SPAN tag node is specified.
5888 * @return The conversion result is returned.
5891 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
5893 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5894 Doc *doc = jxhtml->doc;
5897 if (IS_CSS_ON(jxhtml->entryp)) {
5898 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5905 * It is a handler who processes the STYLE tag.
5907 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
5908 * destination is specified.
5909 * @param node [i] The STYLE tag node is specified.
5910 * @return The conversion result is returned.
5913 s_jxhtml_style_tag(void *pdoc, Node *node)
5920 jxhtml = GET_JXHTML(pdoc);
5923 if (! IS_CSS_ON(jxhtml->entryp)) {
5927 for (attr = qs_get_attr(doc,node);
5929 attr = qs_get_next_attr(doc,attr)) {
5930 char *name = qs_get_attr_name(doc,attr);
5931 char *value = qs_get_attr_value(doc,attr);
5932 if (STRCASEEQ('t','T',"type", name)) {
5933 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5939 Node *child = qs_get_child_node(doc, node);
5940 if (type && child) {
5941 char *name = qs_get_node_name(doc, child);
5942 if (STRCASEEQ('t','T',"text", name)) {
5943 char *value = qs_get_node_value(doc, child);
5944 DBG(doc->r, "start load CSS. buf:[%s]", value);
5945 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
5946 DBG(doc->r, "end load CSS. value:[%s]", value);