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 /*--------------------------------------------------------------------------*/
1955 /* The figure is default for the password. */
1956 /*--------------------------------------------------------------------------*/
1957 if (attr_max_length && *attr_max_length) {
1958 if (chxj_chk_numeric(attr_max_length) == 0) {
1959 W_L(" maxlength=\"");
1960 W_V(attr_max_length);
1965 W_L(" checked=\"checked\"");
1981 jxhtml = GET_JXHTML(pdoc);
1994 /*--------------------------------------------------------------------------*/
1995 /* Get Attributes */
1996 /*--------------------------------------------------------------------------*/
1997 type = qs_get_type_attr(doc, node, doc->buf.pool);
1998 name = qs_get_name_attr(doc, node, doc->buf.pool);
1999 value = qs_get_value_attr(doc,node, doc->buf.pool);
2000 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2001 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2002 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2003 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2004 size = qs_get_size_attr(doc, node, doc->buf.pool);
2007 if (type && (STRCASEEQ('t','T',"text", type) ||
2008 STRCASEEQ('p','P',"password",type) ||
2009 STRCASEEQ('c','C',"checkbox",type) ||
2010 STRCASEEQ('r','R',"radio", type) ||
2011 STRCASEEQ('h','H',"hidden", type) ||
2012 STRCASEEQ('s','S',"submit", type) ||
2013 STRCASEEQ('r','R',"reset", type))) {
2019 if (size && *size) {
2024 if (name && *name) {
2026 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2029 if (value && *value) {
2030 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2031 apr_size_t value_len = strlen(value);
2032 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2036 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2039 if (accesskey && *accesskey) {
2040 W_L(" accesskey=\"");
2044 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2045 /*------------------------------------------------------------------------*/
2047 /*------------------------------------------------------------------------*/
2048 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2049 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2052 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2054 W_L("-wap-input-format:'*");
2060 else if (type && STRCASEEQ('p','P',"password",type)) {
2061 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2063 /*--------------------------------------------------------------------------*/
2064 /* The figure is default for the password. */
2065 /*--------------------------------------------------------------------------*/
2066 if (max_length && *max_length) {
2067 if (chxj_chk_numeric(max_length) == 0) {
2068 W_L(" maxlength=\"");
2075 W_L(" checked=\"checked\"");
2084 * It is a handler who processes the INPUT tag.
2086 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2087 * destination is specified.
2088 * @param node [i] The INPUT tag node is specified.
2089 * @return The conversion result is returned.
2092 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2094 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2100 * It is a handler who processes the CENTER tag.
2102 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2103 * destination is specified.
2104 * @param node [i] The CENTER tag node is specified.
2105 * @return The conversion result is returned.
2108 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2113 char *attr_style = NULL;
2114 char *attr_color = NULL;
2115 char *attr_size = NULL;
2117 jxhtml = GET_JXHTML(pdoc);
2120 for (attr = qs_get_attr(doc,node);
2122 attr = qs_get_next_attr(doc,attr)) {
2123 char *name = qs_get_attr_name(doc,attr);
2124 char *value = qs_get_attr_value(doc,attr);
2125 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2129 if (IS_CSS_ON(jxhtml->entryp)) {
2130 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2132 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2133 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2134 css_property_t *cur;
2135 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2136 if (cur->value && *cur->value) {
2137 attr_color = apr_pstrdup(doc->pool, cur->value);
2140 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2141 if (cur->value && *cur->value) {
2142 attr_size = apr_pstrdup(doc->pool, cur->value);
2149 if (attr_size || attr_color) {
2157 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2171 * It is a handler who processes the CENTER tag.
2173 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2174 * destination is specified.
2175 * @param node [i] The CENTER tag node is specified.
2176 * @return The conversion result is returned.
2179 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2185 jxhtml = GET_JXHTML(pdoc);
2190 if (IS_CSS_ON(jxhtml->entryp)) {
2191 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2198 * It is a handler who processes the li tag.
2200 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2201 * destination is specified.
2202 * @param node [i] The li tag node is specified.
2203 * @return The conversion result is returned.
2206 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2212 char *attr_type = NULL;
2213 char *attr_value = NULL;
2214 char *attr_style = NULL;
2216 jxhtml = GET_JXHTML(pdoc);
2220 for (attr = qs_get_attr(doc,node);
2222 attr = qs_get_next_attr(doc,attr)) {
2223 char *name = qs_get_attr_name(doc,attr);
2224 char *value = qs_get_attr_value(doc,attr);
2225 if (STRCASEEQ('t','T',"type",name)) {
2226 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2227 if (*value == '1') {
2228 attr_type = apr_pstrdup(doc->pool, "decimal");
2230 else if (*value == 'a') {
2231 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2233 else if (*value == 'A') {
2234 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2241 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2244 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2248 if (IS_CSS_ON(jxhtml->entryp)) {
2249 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2251 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2252 css_property_t *cur;
2253 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2254 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2255 attr_type = apr_pstrdup(doc->pool, "decimal");
2257 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2258 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2260 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2261 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2263 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2264 attr_type = apr_pstrdup(doc->pool, "disc");
2266 else if (STRCASEEQ('s','S',"square", cur->value)) {
2267 attr_type = apr_pstrdup(doc->pool, "square");
2269 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2270 attr_type = apr_pstrdup(doc->pool, "circle");
2280 W_L("list-style-type:");
2296 * It is a handler who processes the li tag.
2298 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2299 * destination is specified.
2300 * @param node [i] The li tag node is specified.
2301 * @return The conversion result is returned.
2304 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2310 jxhtml = GET_JXHTML(pdoc);
2314 if (IS_CSS_ON(jxhtml->entryp)) {
2315 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2323 * It is a handler who processes the OL tag.
2325 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2326 * destination is specified.
2327 * @param node [i] The OL tag node is specified.
2328 * @return The conversion result is returned.
2331 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2337 char *attr_style = NULL;
2338 char *attr_start = NULL;
2339 char *attr_type = NULL;
2341 jxhtml = GET_JXHTML(pdoc);
2345 /*--------------------------------------------------------------------------*/
2346 /* Get Attributes */
2347 /*--------------------------------------------------------------------------*/
2348 for (attr = qs_get_attr(doc,node);
2350 attr = qs_get_next_attr(doc,attr)) {
2351 char *name = qs_get_attr_name(doc,attr);
2352 char *value = qs_get_attr_value(doc,attr);
2353 if (STRCASEEQ('t','T',"type",name) && value) {
2354 if (*value == '1') {
2355 attr_type = apr_pstrdup(doc->pool, "decimal");
2357 else if (*value == 'a') {
2358 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2360 else if (*value == 'A') {
2361 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2364 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2367 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2371 if (IS_CSS_ON(jxhtml->entryp)) {
2372 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2374 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2375 css_property_t *cur;
2376 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2377 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2378 attr_type = apr_pstrdup(doc->pool, "decimal");
2380 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2381 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2383 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2384 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2392 W_L("list-style-type:");
2409 * It is a handler who processes the OL tag.
2411 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2412 * destination is specified.
2413 * @param node [i] The OL tag node is specified.
2414 * @return The conversion result is returned.
2417 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2423 jxhtml = GET_JXHTML(pdoc);
2428 if (IS_CSS_ON(jxhtml->entryp)) {
2429 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2436 * It is a handler who processes the P tag.
2438 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2439 * destination is specified.
2440 * @param node [i] The P tag node is specified.
2441 * @return The conversion result is returned.
2444 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2450 char *attr_align = NULL;
2451 char *attr_style = NULL;
2452 char *attr_color = NULL;
2453 char *attr_blink = NULL;
2454 char *css_clear = NULL;
2456 jxhtml = GET_JXHTML(pdoc);
2460 for (attr = qs_get_attr(doc,node);
2462 attr = qs_get_next_attr(doc,attr)) {
2463 char *nm = qs_get_attr_name(doc,attr);
2464 char *val = qs_get_attr_value(doc,attr);
2465 if (STRCASEEQ('a','A',"align", nm)) {
2466 /*----------------------------------------------------------------------*/
2467 /* CHTML 1.0 (W3C version 3.2) */
2468 /*----------------------------------------------------------------------*/
2469 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2470 attr_align = apr_pstrdup(doc->buf.pool, val);
2474 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2475 attr_style = apr_pstrdup(doc->buf.pool, val);
2478 if (IS_CSS_ON(jxhtml->entryp)) {
2479 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2481 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2482 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2483 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2484 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2485 css_property_t *cur;
2486 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2487 if (STRCASEEQ('l','L',"left",cur->value)) {
2488 attr_align = apr_pstrdup(doc->pool, "left");
2490 else if (STRCASEEQ('c','C',"center",cur->value)) {
2491 attr_align = apr_pstrdup(doc->pool, "center");
2493 else if (STRCASEEQ('r','R',"right",cur->value)) {
2494 attr_align = apr_pstrdup(doc->pool, "right");
2497 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2498 if (cur->value && *cur->value) {
2499 attr_color = apr_pstrdup(doc->pool, cur->value);
2502 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2503 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2504 attr_blink = apr_pstrdup(doc->pool, cur->value);
2507 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2508 css_clear = apr_pstrdup(doc->pool, cur->value);
2513 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2521 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2527 W_L("text-decoration:");
2544 * It is a handler who processes the P tag.
2546 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2547 * destination is specified.
2548 * @param node [i] The P tag node is specified.
2549 * @return The conversion result is returned.
2552 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2554 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2555 Doc *doc = jxhtml->doc;
2558 if (IS_CSS_ON(jxhtml->entryp)) {
2559 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2566 * It is a handler who processes the PRE tag.
2568 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2569 * destination is specified.
2570 * @param node [i] The PRE tag node is specified.
2571 * @return The conversion result is returned.
2574 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
2576 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2577 Doc *doc = jxhtml->doc;
2579 char *attr_style = NULL;
2581 for (attr = qs_get_attr(doc,node);
2583 attr = qs_get_next_attr(doc,attr)) {
2584 char *nm = qs_get_attr_name(doc,attr);
2585 char *val = qs_get_attr_value(doc,attr);
2586 if (val && STRCASEEQ('s','S',"style", nm)) {
2591 if (IS_CSS_ON(jxhtml->entryp)) {
2592 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2602 * It is a handler who processes the PRE tag.
2604 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2605 * destination is specified.
2606 * @param node [i] The PRE tag node is specified.
2607 * @return The conversion result is returned.
2610 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2612 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2613 Doc *doc = jxhtml->doc;
2617 if (IS_CSS_ON(jxhtml->entryp)) {
2618 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2626 * It is a handler who processes the UL tag.
2628 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2629 * destination is specified.
2630 * @param node [i] The UL tag node is specified.
2631 * @return The conversion result is returned.
2634 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2636 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2637 Doc *doc = jxhtml->doc;
2639 char *attr_type = NULL;
2640 char *attr_style = NULL;
2641 /*--------------------------------------------------------------------------*/
2642 /* Get Attributes */
2643 /*--------------------------------------------------------------------------*/
2644 for (attr = qs_get_attr(doc,node);
2646 attr = qs_get_next_attr(doc,attr)) {
2647 char *name = qs_get_attr_name(doc,attr);
2648 char *value = qs_get_attr_value(doc,attr);
2649 if (STRCASEEQ('t','T',"type",name)) {
2650 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2654 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2658 if (IS_CSS_ON(jxhtml->entryp)) {
2659 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2661 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2662 css_property_t *cur;
2663 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2664 if (STRCASEEQ('d','D',"disc",cur->value)) {
2665 attr_type = apr_pstrdup(doc->pool, "disc");
2667 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2668 attr_type = apr_pstrdup(doc->pool, "circle");
2670 else if (STRCASEEQ('s','S',"square",cur->value)) {
2671 attr_type = apr_pstrdup(doc->pool, "square");
2679 W_L("list-style-type:");
2690 * It is a handler who processes the UL tag.
2692 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2693 * destination is specified.
2694 * @param node [i] The UL tag node is specified.
2695 * @return The conversion result is returned.
2698 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2700 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2701 Doc *doc = jxhtml->doc;
2704 if (IS_CSS_ON(jxhtml->entryp)) {
2705 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2712 * It is a handler who processes the HR tag.
2714 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2715 * destination is specified.
2716 * @param node [i] The HR tag node is specified.
2717 * @return The conversion result is returned.
2720 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
2726 char *attr_align = NULL;
2727 char *attr_size = NULL;
2728 char *attr_width = NULL;
2729 char *attr_noshade = NULL;
2730 char *attr_style = NULL;
2731 char *attr_color = NULL;
2733 char *style_float = NULL;
2734 char *style_border_color = NULL;
2736 jxhtml = GET_JXHTML(pdoc);
2740 for (attr = qs_get_attr(doc,node);
2742 attr = qs_get_next_attr(doc,attr)) {
2743 char *name = qs_get_attr_name (doc,attr);
2744 char *value = qs_get_attr_value(doc,attr);
2748 if (strcasecmp(name, "align") == 0) {
2749 /*--------------------------------------------------------------------*/
2751 /*--------------------------------------------------------------------*/
2752 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2760 if (strcasecmp(name, "size") == 0) {
2761 /*--------------------------------------------------------------------*/
2763 /*--------------------------------------------------------------------*/
2764 if (value && *value) {
2768 else if (strcasecmp(name, "style") == 0) {
2769 if (value && *value) {
2777 if (strcasecmp(name, "width") == 0) {
2778 /*--------------------------------------------------------------------*/
2780 /*--------------------------------------------------------------------*/
2781 if (value && *value) {
2789 if (strcasecmp(name, "noshade") == 0) {
2790 /*--------------------------------------------------------------------*/
2792 /*--------------------------------------------------------------------*/
2793 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2799 if (strcasecmp(name, "color") == 0 && value && *value) {
2800 /*--------------------------------------------------------------------*/
2802 /*--------------------------------------------------------------------*/
2811 if (IS_CSS_ON(jxhtml->entryp)) {
2812 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2814 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2815 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2816 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2818 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2819 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2820 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2821 css_property_t *cur;
2823 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2824 if (STRCASEEQ('s','S',"solid",cur->value)) {
2825 attr_noshade = "noshade";
2828 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2829 char *tmp = apr_pstrdup(doc->pool, cur->value);
2830 char *tmpp = strstr(tmp, "px");
2832 attr_size = apr_pstrdup(doc->pool, tmp);
2836 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
2837 char *tmp = apr_pstrdup(doc->pool,cur->value);
2838 attr_color = apr_pstrdup(doc->pool,tmp);
2841 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2842 char *tmp = apr_pstrdup(doc->pool, cur->value);
2843 char *tmpp = strstr(tmp,"none");
2845 style_float = "center";
2848 style_float = apr_pstrdup(doc->pool,tmp);
2853 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2854 char *tmp = apr_pstrdup(doc->pool, cur->value);
2855 char *tmpp = strstr(tmp, "px");
2857 attr_width = apr_pstrdup(doc->pool, tmp);
2860 tmpp = strstr(tmp, "%");
2862 attr_width = apr_pstrdup(doc->pool, tmp);
2867 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2868 char *tmp = apr_pstrdup(doc->pool, cur->value);
2870 style_border_color = apr_pstrdup(doc->pool, tmp);
2888 if (attr_size || attr_width || attr_noshade || style_border_color) {
2893 if (!strstr(attr_size, "px")) {
2901 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2907 W_L("border-style:solid;");
2909 if(style_border_color){
2910 W_L("border-color:");
2911 W_V(style_border_color);
2929 * It is a handler who processes the HR tag.
2931 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
2932 * destination is specified.
2933 * @param node [i] The HR tag node is specified.
2934 * @return The conversion result is returned.
2937 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2939 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2945 * It is a handler who processes the IMG tag.
2947 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2948 * destination is specified.
2949 * @param node [i] The IMG tag node is specified.
2950 * @return The conversion result is returned.
2953 s_jxhtml_start_img_tag(void *pdoc, Node *node)
2955 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2956 Doc *doc = jxhtml->doc;
2957 request_rec *r = doc->r;
2959 char *attr_src = NULL;
2960 char *attr_height = NULL;
2961 char *attr_width = NULL;
2962 char *attr_align = NULL;
2963 char *attr_alt = NULL;
2964 char *attr_style = NULL;
2965 char *attr_hspace = NULL;
2966 char *attr_vspace = NULL;
2968 char *css_float = NULL;
2969 char *css_margin_left = NULL;
2970 char *css_margin_right = NULL;
2971 char *css_margin_top = NULL;
2972 char *css_margin_bottom = NULL;
2973 char *css_display = NULL;
2974 char *css_valign = NULL;
2976 #ifndef IMG_NOT_CONVERT_FILENAME
2977 device_table *spec = jxhtml->spec;
2980 /*--------------------------------------------------------------------------*/
2981 /* Get Attributes */
2982 /*--------------------------------------------------------------------------*/
2983 for (attr = qs_get_attr(doc,node);
2985 attr = qs_get_next_attr(doc,attr)) {
2986 char *name = qs_get_attr_name(doc,attr);
2987 char *value = qs_get_attr_value(doc,attr);
2988 if (STRCASEEQ('s','S',"src",name)) {
2989 /*----------------------------------------------------------------------*/
2991 /*----------------------------------------------------------------------*/
2992 #ifdef IMG_NOT_CONVERT_FILENAME
2993 value = chxj_encoding_parameter(r, value, 1);
2994 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
2995 value = chxj_add_cookie_no_update_parameter(r, value);
2998 value = chxj_img_conv(r, spec, value);
2999 value = chxj_encoding_parameter(r, value, 1);
3000 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3001 value = chxj_add_cookie_no_update_parameter(r, value);
3005 else if (STRCASEEQ('a','A',"align",name)) {
3006 /*----------------------------------------------------------------------*/
3008 /*----------------------------------------------------------------------*/
3010 if (STRCASEEQ('t','T',"top", value) ||
3011 STRCASEEQ('m','M',"middle",value) ||
3012 STRCASEEQ('b','B',"bottom",value)){
3014 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3017 else if (STRCASEEQ('c','C',"center",value)) {
3018 css_valign = apr_pstrdup(doc->pool, "middle");
3022 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3023 /*----------------------------------------------------------------------*/
3025 /*----------------------------------------------------------------------*/
3028 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3029 /*----------------------------------------------------------------------*/
3031 /*----------------------------------------------------------------------*/
3032 attr_height = value;
3034 else if (STRCASEEQ('h','H',"hspace",name)) {
3035 /*----------------------------------------------------------------------*/
3037 /*----------------------------------------------------------------------*/
3038 attr_hspace = value;
3040 else if (STRCASEEQ('v','V',"vspace",name)) {
3041 /*----------------------------------------------------------------------*/
3043 /*----------------------------------------------------------------------*/
3044 attr_vspace = value;
3046 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3047 /*----------------------------------------------------------------------*/
3049 /*----------------------------------------------------------------------*/
3052 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3053 /*----------------------------------------------------------------------*/
3055 /*----------------------------------------------------------------------*/
3060 if (IS_CSS_ON(jxhtml->entryp)) {
3061 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3063 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3064 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3065 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3066 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3067 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3068 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3069 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3072 css_property_t *cur;
3073 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3074 attr_height = apr_pstrdup(doc->pool, cur->value);
3076 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3077 attr_width = apr_pstrdup(doc->pool, cur->value);
3080 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3081 css_valign = apr_pstrdup(doc->pool, cur->value);
3084 if (! attr_hspace) {
3085 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3086 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3088 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3089 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3092 if (! attr_vspace) {
3093 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3094 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3096 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3097 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3101 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3102 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3103 css_float = apr_pstrdup(doc->pool, cur->value);
3107 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3108 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3109 char *tmp = apr_pstrdup(doc->pool, cur->value);
3110 char *tmpp = strstr(tmp, "none");
3112 css_display = apr_pstrdup(doc->pool, tmp);
3124 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3132 W_L("vertical-align:");
3137 W_L("margin-left:");
3140 W_L("margin-right:");
3145 if(css_margin_left){
3146 W_L("margin-left:");
3147 W_V(css_margin_left);
3150 if(css_margin_right){
3151 W_L("margin-right:");
3152 W_V(css_margin_right);
3160 W_L("margin-bottom:");
3167 W_V(css_margin_top);
3170 if(css_margin_bottom){
3171 W_L("margin-bottom:");
3172 W_V(css_margin_bottom);
3177 W_L("display:none;");
3206 * It is a handler who processes the IMG tag.
3208 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3209 * destination is specified.
3210 * @param node [i] The IMG tag node is specified.
3211 * @return The conversion result is returned.
3214 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3216 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3222 * It is a handler who processes the SELECT tag.
3224 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3225 * destination is specified.
3226 * @param node [i] The SELECT tag node is specified.
3227 * @return The conversion result is returned.
3230 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3232 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3233 Doc *doc = jxhtml->doc;
3237 char *multiple = NULL;
3238 char *attr_style = NULL;
3241 for (attr = qs_get_attr(doc,node);
3243 attr = qs_get_next_attr(doc,attr)) {
3244 char *nm = qs_get_attr_name(doc,attr);
3245 char *val = qs_get_attr_value(doc,attr);
3246 if (STRCASEEQ('s','S',"size",nm)) {
3247 /*----------------------------------------------------------------------*/
3248 /* CHTML 1.0 version 2.0 */
3249 /*----------------------------------------------------------------------*/
3250 size = apr_pstrdup(doc->buf.pool, val);
3252 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3253 /*----------------------------------------------------------------------*/
3254 /* CHTML 1.0 version 2.0 */
3255 /*----------------------------------------------------------------------*/
3256 attr_style = apr_pstrdup(doc->buf.pool, val);
3258 else if (STRCASEEQ('n','N',"name",nm)) {
3259 /*----------------------------------------------------------------------*/
3260 /* CHTML 1.0 version 2.0 */
3261 /*----------------------------------------------------------------------*/
3262 name = apr_pstrdup(doc->buf.pool, val);
3264 else if (STRCASEEQ('m','M',"multiple", nm)) {
3265 /*----------------------------------------------------------------------*/
3266 /* CHTML 1.0 version 2.0 */
3267 /*----------------------------------------------------------------------*/
3268 multiple = apr_pstrdup(doc->buf.pool, val);
3271 if (size && *size) {
3276 if (name && *name) {
3286 if (IS_CSS_ON(jxhtml->entryp)) {
3287 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3295 * It is a handler who processes the SELECT tag.
3297 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3298 * destination is specified.
3299 * @param node [i] The SELECT tag node is specified.
3300 * @return The conversion result is returned.
3303 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3305 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3306 Doc *doc = jxhtml->doc;
3309 if (IS_CSS_ON(jxhtml->entryp)) {
3310 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3317 * It is a handler who processes the OPTION tag.
3319 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3320 * destination is specified.
3321 * @param node [i] The OPTION tag node is specified.
3322 * @return The conversion result is returned.
3325 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3327 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3328 Doc *doc = jxhtml->doc;
3331 char *selected = NULL;
3333 char *attr_style = NULL;
3336 for (attr = qs_get_attr(doc,node);
3338 attr = qs_get_next_attr(doc,attr)) {
3339 char *nm = qs_get_attr_name(doc,attr);
3340 char *val = qs_get_attr_value(doc,attr);
3341 if (STRCASEEQ('s','S',"selected",nm)) {
3342 /*----------------------------------------------------------------------*/
3343 /* CHTML 1.0 version 2.0 */
3344 /*----------------------------------------------------------------------*/
3345 selected = apr_pstrdup(doc->buf.pool, val);
3347 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3348 /*----------------------------------------------------------------------*/
3349 /* CHTML 1.0 version 2.0 */
3350 /*----------------------------------------------------------------------*/
3351 attr_style = apr_pstrdup(doc->buf.pool, val);
3353 else if (STRCASEEQ('v','V',"value",nm)) {
3354 /*----------------------------------------------------------------------*/
3355 /* CHTML 1.0 version 2.0 */
3356 /*----------------------------------------------------------------------*/
3357 value = apr_pstrdup(doc->buf.pool, val);
3370 if (IS_CSS_ON(jxhtml->entryp)) {
3371 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3379 * It is a handler who processes the OPTION tag.
3381 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3382 * destination is specified.
3383 * @param node [i] The OPTION tag node is specified.
3384 * @return The conversion result is returned.
3387 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3389 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3390 Doc *doc = jxhtml->doc;
3393 if (IS_CSS_ON(jxhtml->entryp)) {
3394 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3402 * It is a handler who processes the DIV tag.
3404 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3405 * destination is specified.
3406 * @param node [i] The DIV tag node is specified.
3407 * @return The conversion result is returned.
3410 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3416 char *attr_style = NULL;
3417 char *attr_align = NULL;
3418 char *attr_display = NULL;
3419 char *attr_decoration = NULL;
3420 char *attr_wap_marquee_style = NULL;
3421 char *attr_wap_marquee_dir = NULL;
3422 char *attr_wap_marquee_loop = NULL;
3423 char *attr_color = NULL;
3424 char *attr_bgcolor = NULL;
3425 char *attr_font_size = NULL;
3426 char *css_clear = NULL;
3428 jxhtml = GET_JXHTML(pdoc);
3432 for (attr = qs_get_attr(doc,node);
3434 attr = qs_get_next_attr(doc,attr)) {
3435 char *nm = qs_get_attr_name(doc,attr);
3436 char *val = qs_get_attr_value(doc,attr);
3437 if (STRCASEEQ('a','A',"align",nm)) {
3438 /*----------------------------------------------------------------------*/
3439 /* CHTML 1.0 (W3C version 3.2) */
3440 /*----------------------------------------------------------------------*/
3441 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3442 attr_align = apr_pstrdup(doc->buf.pool, val);
3445 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3446 attr_style = apr_pstrdup(doc->buf.pool, val);
3450 if (IS_CSS_ON(jxhtml->entryp)) {
3451 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3453 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3454 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3455 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3456 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3457 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3458 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3459 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3460 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3462 css_property_t *cur;
3463 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3464 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3465 attr_display = apr_pstrdup(doc->pool, cur->value);
3468 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3469 if (STRCASEEQ('b','B',"blink", cur->value)) {
3470 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3473 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3474 attr_color = apr_pstrdup(doc->pool, cur->value);
3476 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3477 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3478 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3480 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3481 char *ss = strchr(cur->value, '#');
3483 ss = strstr(cur->value, "rgb");
3486 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3487 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3490 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3491 attr_align = apr_pstrdup(doc->pool, cur->value);
3493 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3494 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3495 || STRCASEEQ('x','X',"x-small",cur->value)
3496 || STRCASEEQ('s','S',"small",cur->value)
3497 || STRCASEEQ('m','M',"medium",cur->value)
3498 || STRCASEEQ('l','L',"large",cur->value)
3499 || STRCASEEQ('x','X',"x-large",cur->value)
3500 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3501 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3505 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3506 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3507 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3508 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3509 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3510 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3513 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3514 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3515 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3517 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3518 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3521 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3522 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
3523 attr_wap_marquee_loop = "infinite";
3526 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3530 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3531 css_clear = apr_pstrdup(doc->pool, cur->value);
3539 || attr_wap_marquee_style
3540 || attr_wap_marquee_dir
3541 || attr_wap_marquee_loop
3557 if (attr_decoration) {
3558 W_L("text-decoration:");
3559 W_V(attr_decoration);
3562 if (attr_wap_marquee_style) {
3563 W_L("-wap-marquee-style:");
3564 W_V(attr_wap_marquee_style);
3567 if (attr_wap_marquee_dir) {
3568 W_L("-wap-marquee-dir:");
3569 W_V(attr_wap_marquee_dir);
3572 if (attr_wap_marquee_loop) {
3573 W_L("-wap-marquee-loop:");
3574 W_V(attr_wap_marquee_loop);
3583 W_L("background-color:");
3587 if (attr_font_size) {
3589 W_V(attr_font_size);
3605 * It is a handler who processes the DIV tag.
3607 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3608 * destination is specified.
3609 * @param node [i] The DIV tag node is specified.
3610 * @return The conversion result is returned.
3613 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
3619 jxhtml = GET_JXHTML(pdoc);
3624 if (IS_CSS_ON(jxhtml->entryp)) {
3625 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3632 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
3639 jxhtml = GET_JXHTML(pdoc);
3643 for (child = qs_get_child_node(doc, node);
3645 child = qs_get_next_node(doc, child)) {
3647 s_jxhtml_chxjif_tag(jxhtml, child);
3654 * It is a handler who processes the TEXTARE tag.
3656 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3657 * destination is specified.
3658 * @param node [i] The TEXTAREA tag node is specified.
3659 * @return The conversion result is returned.
3662 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
3668 char *attr_accesskey = NULL;
3669 char *attr_name = NULL;
3670 char *attr_rows = NULL;
3671 char *attr_cols = NULL;
3672 char *attr_istyle = NULL;
3673 char *attr_style = NULL;
3676 jxhtml = GET_JXHTML(pdoc);
3680 jxhtml->textarea_flag++;
3681 for (attr = qs_get_attr(doc,node);
3683 attr = qs_get_next_attr(doc,attr)) {
3684 char *name = qs_get_attr_name(doc,attr);
3685 char *value = qs_get_attr_value(doc,attr);
3686 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3687 attr_accesskey = value;
3689 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3690 attr_istyle = value;
3692 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3695 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3698 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3701 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3705 if (IS_CSS_ON(jxhtml->entryp)) {
3706 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3708 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3709 css_property_t *cur;
3710 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3711 if (strcasestr(cur->value, "<ja:n>")) {
3714 else if (strcasestr(cur->value, "<ja:en>")) {
3717 else if (strcasestr(cur->value, "<ja:hk>")) {
3720 else if (strcasestr(cur->value, "<ja:h>")) {
3727 if (attr_accesskey) {
3728 W_L(" accesskey=\"");
3729 W_V(attr_accesskey);
3748 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
3750 W_L("-wap-input-format:"*");
3761 * It is a handler who processes the TEXTAREA tag.
3763 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3764 * destination is specified.
3765 * @param node [i] The TEXTAREA tag node is specified.
3766 * @return The conversion result is returned.
3769 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3775 jxhtml = GET_JXHTML(pdoc);
3780 jxhtml->textarea_flag--;
3787 * It is a handler who processes the B tag.
3789 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3790 * destination is specified.
3791 * @param node [i] The B tag node is specified.
3792 * @return The conversion result is returned.
3795 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3801 jxhtml = GET_JXHTML(pdoc);
3811 * It is a handler who processes the B tag.
3813 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3814 * destination is specified.
3815 * @param node [i] The B tag node is specified.
3816 * @return The conversion result is returned.
3819 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3821 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
3822 Doc* doc = jxhtml->doc;
3829 s_jxhtml_text_tag(void* pdoc, Node* child)
3840 apr_size_t z2h_input_len;
3842 jxhtml = GET_JXHTML(pdoc);
3846 textval = qs_get_node_value(doc,child);
3847 if (strlen(textval) == 0) {
3851 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3852 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3854 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3855 memset(one_byte, 0, sizeof(one_byte));
3858 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3860 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
3862 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3867 if (is_sjis_kanji(textval[ii])) {
3868 one_byte[0] = textval[ii+0];
3869 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3870 one_byte[0] = textval[ii+1];
3871 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3875 if (jxhtml->pre_flag) {
3876 one_byte[0] = textval[ii+0];
3877 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3880 if (jxhtml->textarea_flag) {
3881 one_byte[0] = textval[ii+0];
3882 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3885 if (textval[ii] != '\r' && textval[ii] != '\n') {
3886 one_byte[0] = textval[ii+0];
3887 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3891 z2h_input_len = strlen(tdst);
3892 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
3900 * It is a handler who processes the BLOCKQUOTE tag.
3902 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3903 * destination is specified.
3904 * @param node [i] The BLOCKQUOTE tag node is specified.
3905 * @return The conversion result is returned.
3908 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
3913 char *attr_style = NULL;
3914 char *attr_color = NULL;
3915 char *attr_size = NULL;
3917 jxhtml = GET_JXHTML(pdoc);
3919 for (attr = qs_get_attr(doc,node);
3921 attr = qs_get_next_attr(doc,attr)) {
3922 char *nm = qs_get_attr_name(doc,attr);
3923 char *val = qs_get_attr_value(doc,attr);
3924 if (val && STRCASEEQ('s','S',"style", nm)) {
3928 if (IS_CSS_ON(jxhtml->entryp)) {
3929 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3931 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3932 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3933 css_property_t *cur;
3934 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3935 if (cur->value && *cur->value) {
3936 attr_color = apr_pstrdup(doc->pool, cur->value);
3939 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3940 if (cur->value && *cur->value) {
3941 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3942 attr_size = apr_pstrdup(doc->pool, cur->value);
3944 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3945 attr_size = apr_pstrdup(doc->pool, cur->value);
3947 else if (STRCASEEQ('s','S',"small",cur->value)) {
3948 attr_size = apr_pstrdup(doc->pool, cur->value);
3950 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3951 attr_size = apr_pstrdup(doc->pool, cur->value);
3953 else if (STRCASEEQ('l','L',"large",cur->value)) {
3954 attr_size = apr_pstrdup(doc->pool, cur->value);
3956 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3957 attr_size = apr_pstrdup(doc->pool, cur->value);
3959 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3960 attr_size = apr_pstrdup(doc->pool, cur->value);
3967 if (attr_color || attr_size) {
3970 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3988 * It is a handler who processes the BLOCKQUOTE tag.
3990 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3991 * destination is specified.
3992 * @param node [i] The BLOCKQUOTE tag node is specified.
3993 * @return The conversion result is returned.
3996 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3998 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3999 Doc *doc = jxhtml->doc;
4000 W_L("</blockquote>");
4001 if (IS_CSS_ON(jxhtml->entryp)) {
4002 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4009 * It is a handler who processes the DIR tag.
4011 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4012 * destination is specified.
4013 * @param node [i] The DIR tag node is specified.
4014 * @return The conversion result is returned.
4017 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4019 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4020 Doc *doc = jxhtml->doc;
4022 char *attr_style = NULL;
4023 char *attr_color = NULL;
4024 char *attr_type = NULL;
4025 char *attr_size = NULL;
4026 for (attr = qs_get_attr(doc,node);
4028 attr = qs_get_next_attr(doc,attr)) {
4029 char *name = qs_get_attr_name(doc,attr);
4030 char *value = qs_get_attr_value(doc,attr);
4031 if (STRCASEEQ('t','T',"type",name)) {
4032 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4036 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4040 if (IS_CSS_ON(jxhtml->entryp)) {
4041 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4043 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4044 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4045 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4046 css_property_t *cur;
4047 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4048 if (cur->value && *cur->value) {
4049 attr_color = apr_pstrdup(doc->pool, cur->value);
4052 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4053 if (cur->value && *cur->value) {
4054 attr_type = apr_pstrdup(doc->pool, cur->value);
4057 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4058 if (cur->value && *cur->value) {
4059 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4060 attr_size = apr_pstrdup(doc->pool, cur->value);
4062 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4063 attr_size = apr_pstrdup(doc->pool, cur->value);
4065 else if (STRCASEEQ('s','S',"small",cur->value)) {
4066 attr_size = apr_pstrdup(doc->pool, cur->value);
4068 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4069 attr_size = apr_pstrdup(doc->pool, cur->value);
4071 else if (STRCASEEQ('l','L',"large",cur->value)) {
4072 attr_size = apr_pstrdup(doc->pool, cur->value);
4074 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4075 attr_size = apr_pstrdup(doc->pool, cur->value);
4077 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4078 attr_size = apr_pstrdup(doc->pool, cur->value);
4085 if (attr_type || attr_color || attr_size) {
4088 W_L("list-style-type:");
4093 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4111 * It is a handler who processes the DIR tag.
4113 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4114 * destination is specified.
4115 * @param node [i] The DIR tag node is specified.
4116 * @return The conversion result is returned.
4119 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4121 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4122 Doc *doc = jxhtml->doc;
4124 if (IS_CSS_ON(jxhtml->entryp)) {
4125 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4132 * It is a handler who processes the DL tag.
4134 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4135 * destination is specified.
4136 * @param node [i] The DL tag node is specified.
4137 * @return The conversion result is returned.
4140 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4142 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4143 Doc *doc = jxhtml->doc;
4145 char *attr_style = NULL;
4146 char *attr_color = NULL;
4147 char *attr_size = NULL;
4148 for (attr = qs_get_attr(doc,node);
4150 attr = qs_get_next_attr(doc,attr)) {
4151 char *name = qs_get_attr_name(doc,attr);
4152 char *value = qs_get_attr_value(doc,attr);
4153 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4157 if (IS_CSS_ON(jxhtml->entryp)) {
4158 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4160 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4161 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4162 css_property_t *cur;
4163 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4164 if (cur->value && *cur->value) {
4165 attr_color = apr_pstrdup(doc->pool, cur->value);
4168 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4169 if (cur->value && *cur->value) {
4170 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4171 attr_size = apr_pstrdup(doc->pool, cur->value);
4173 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4174 attr_size = apr_pstrdup(doc->pool, cur->value);
4176 else if (STRCASEEQ('s','S',"small",cur->value)) {
4177 attr_size = apr_pstrdup(doc->pool, cur->value);
4179 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4180 attr_size = apr_pstrdup(doc->pool, cur->value);
4182 else if (STRCASEEQ('l','L',"large",cur->value)) {
4183 attr_size = apr_pstrdup(doc->pool, cur->value);
4185 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4186 attr_size = apr_pstrdup(doc->pool, cur->value);
4188 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4189 attr_size = apr_pstrdup(doc->pool, cur->value);
4196 if (attr_color || attr_size) {
4199 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4217 * It is a handler who processes the DL tag.
4219 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4220 * destination is specified.
4221 * @param node [i] The DL tag node is specified.
4222 * @return The conversion result is returned.
4225 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4227 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4228 Doc *doc = jxhtml->doc;
4230 if (IS_CSS_ON(jxhtml->entryp)) {
4231 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4238 * It is a handler who processes the DT tag.
4240 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4241 * destination is specified.
4242 * @param node [i] The DT tag node is specified.
4243 * @return The conversion result is returned.
4246 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4248 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4249 Doc *doc = jxhtml->doc;
4251 char *attr_style = NULL;
4252 char *attr_color = NULL;
4253 char *attr_size = NULL;
4254 for (attr = qs_get_attr(doc,node);
4256 attr = qs_get_next_attr(doc,attr)) {
4257 char *name = qs_get_attr_name(doc,attr);
4258 char *value = qs_get_attr_value(doc,attr);
4259 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4263 if (IS_CSS_ON(jxhtml->entryp)) {
4264 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4266 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4267 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4268 css_property_t *cur;
4269 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4270 if (cur->value && *cur->value) {
4271 attr_color = apr_pstrdup(doc->pool, cur->value);
4274 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4275 if (cur->value && *cur->value) {
4276 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4277 attr_size = apr_pstrdup(doc->pool, cur->value);
4279 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4280 attr_size = apr_pstrdup(doc->pool, cur->value);
4282 else if (STRCASEEQ('s','S',"small",cur->value)) {
4283 attr_size = apr_pstrdup(doc->pool, cur->value);
4285 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4286 attr_size = apr_pstrdup(doc->pool, cur->value);
4288 else if (STRCASEEQ('l','L',"large",cur->value)) {
4289 attr_size = apr_pstrdup(doc->pool, cur->value);
4291 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4292 attr_size = apr_pstrdup(doc->pool, cur->value);
4294 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4295 attr_size = apr_pstrdup(doc->pool, cur->value);
4302 if (attr_color || attr_size) {
4305 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4323 * It is a handler who processes the DT tag.
4325 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4326 * destination is specified.
4327 * @param node [i] The DT tag node is specified.
4328 * @return The conversion result is returned.
4331 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4333 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4334 Doc *doc = jxhtml->doc;
4336 if (IS_CSS_ON(jxhtml->entryp)) {
4337 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4344 * It is a handler who processes the DD tag.
4346 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4347 * destination is specified.
4348 * @param node [i] The DD tag node is specified.
4349 * @return The conversion result is returned.
4352 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4354 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4355 Doc *doc = jxhtml->doc;
4357 char *attr_style = NULL;
4358 char *attr_color = NULL;
4359 char *attr_size = NULL;
4360 for (attr = qs_get_attr(doc,node);
4362 attr = qs_get_next_attr(doc,attr)) {
4363 char *name = qs_get_attr_name(doc,attr);
4364 char *value = qs_get_attr_value(doc,attr);
4365 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4369 if (IS_CSS_ON(jxhtml->entryp)) {
4370 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4372 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4373 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4374 css_property_t *cur;
4375 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4376 if (cur->value && *cur->value) {
4377 attr_color = apr_pstrdup(doc->pool, cur->value);
4380 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4381 if (cur->value && *cur->value) {
4382 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4383 attr_size = apr_pstrdup(doc->pool, cur->value);
4385 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4386 attr_size = apr_pstrdup(doc->pool, cur->value);
4388 else if (STRCASEEQ('s','S',"small",cur->value)) {
4389 attr_size = apr_pstrdup(doc->pool, cur->value);
4391 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4392 attr_size = apr_pstrdup(doc->pool, cur->value);
4394 else if (STRCASEEQ('l','L',"large",cur->value)) {
4395 attr_size = apr_pstrdup(doc->pool, cur->value);
4397 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4398 attr_size = apr_pstrdup(doc->pool, cur->value);
4400 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4401 attr_size = apr_pstrdup(doc->pool, cur->value);
4408 if (attr_color || attr_size) {
4411 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4429 * It is a handler who processes the DD tag.
4431 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4432 * destination is specified.
4433 * @param node [i] The DD tag node is specified.
4434 * @return The conversion result is returned.
4437 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4439 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4440 Doc *doc = jxhtml->doc;
4442 if (IS_CSS_ON(jxhtml->entryp)) {
4443 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4450 * It is a handler who processes the H1 tag.
4452 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4453 * destination is specified.
4454 * @param node [i] The H1 tag node is specified.
4455 * @return The conversion result is returned.
4458 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4464 char *attr_style = NULL;
4465 char *attr_align = NULL;
4466 char *css_clear = NULL;
4468 jxhtml = GET_JXHTML(pdoc);
4472 for (attr = qs_get_attr(doc,node);
4474 attr = qs_get_next_attr(doc,attr)) {
4475 char *name = qs_get_attr_name(doc,attr);
4476 char *value = qs_get_attr_value(doc,attr);
4477 if (STRCASEEQ('a','A',"align", name)) {
4478 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4482 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4486 if (IS_CSS_ON(jxhtml->entryp)) {
4487 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4489 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4490 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4491 css_property_t *cur;
4492 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4493 if (STRCASEEQ('l','L',"left", cur->value)) {
4494 attr_align = apr_pstrdup(doc->pool, "left");
4496 else if (STRCASEEQ('c','C',"center",cur->value)) {
4497 attr_align = apr_pstrdup(doc->pool, "center");
4499 else if (STRCASEEQ('r','R',"right",cur->value)) {
4500 attr_align = apr_pstrdup(doc->pool, "right");
4503 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4504 if (STRCASEEQ('b','B',"both", cur->value)) {
4505 css_clear = apr_pstrdup(doc->pool, "both");
4507 else if (STRCASEEQ('r','R',"right", cur->value)) {
4508 css_clear = apr_pstrdup(doc->pool, "right");
4510 else if (STRCASEEQ('l','L',"left", cur->value)) {
4511 css_clear = apr_pstrdup(doc->pool, "left");
4517 if (attr_align || css_clear ) {
4538 * It is a handler who processes the H1 tag.
4540 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4541 * destination is specified.
4542 * @param node [i] The H1 tag node is specified.
4543 * @return The conversion result is returned.
4546 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4552 jxhtml = GET_JXHTML(pdoc);
4557 if (IS_CSS_ON(jxhtml->entryp)) {
4558 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4566 * It is a handler who processes the H2 tag.
4568 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4569 * destination is specified.
4570 * @param node [i] The H1 tag node is specified.
4571 * @return The conversion result is returned.
4574 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
4580 char *attr_style = NULL;
4581 char *attr_align = NULL;
4582 char *css_clear = NULL;
4584 jxhtml = GET_JXHTML(pdoc);
4588 for (attr = qs_get_attr(doc,node);
4590 attr = qs_get_next_attr(doc,attr)) {
4591 char *name = qs_get_attr_name(doc,attr);
4592 char *value = qs_get_attr_value(doc,attr);
4593 if (STRCASEEQ('a','A',"align", name)) {
4594 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4598 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4602 if (IS_CSS_ON(jxhtml->entryp)) {
4603 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4605 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4606 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4607 css_property_t *cur;
4608 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4609 if (STRCASEEQ('l','L',"left", cur->value)) {
4610 attr_align = apr_pstrdup(doc->pool, "left");
4612 else if (STRCASEEQ('c','C',"center",cur->value)) {
4613 attr_align = apr_pstrdup(doc->pool, "center");
4615 else if (STRCASEEQ('r','R',"right",cur->value)) {
4616 attr_align = apr_pstrdup(doc->pool, "right");
4619 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4620 if (STRCASEEQ('b','B',"both", cur->value)) {
4621 css_clear = apr_pstrdup(doc->pool, "both");
4623 else if (STRCASEEQ('r','R',"right", cur->value)) {
4624 css_clear = apr_pstrdup(doc->pool, "right");
4626 else if (STRCASEEQ('l','L',"left", cur->value)) {
4627 css_clear = apr_pstrdup(doc->pool, "left");
4633 if (attr_align || css_clear ) {
4654 * It is a handler who processes the H2 tag.
4656 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4657 * destination is specified.
4658 * @param node [i] The H1 tag node is specified.
4659 * @return The conversion result is returned.
4662 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
4668 jxhtml = GET_JXHTML(pdoc);
4673 if (IS_CSS_ON(jxhtml->entryp)) {
4674 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4681 * It is a handler who processes the H3 tag.
4683 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4684 * destination is specified.
4685 * @param node [i] The H1 tag node is specified.
4686 * @return The conversion result is returned.
4689 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
4695 char *attr_style = NULL;
4696 char *attr_align = NULL;
4697 char *css_clear = NULL;
4699 jxhtml = GET_JXHTML(pdoc);
4703 for (attr = qs_get_attr(doc,node);
4705 attr = qs_get_next_attr(doc,attr)) {
4706 char *name = qs_get_attr_name(doc,attr);
4707 char *value = qs_get_attr_value(doc,attr);
4708 if (STRCASEEQ('a','A',"align", name)) {
4709 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4713 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4717 if (IS_CSS_ON(jxhtml->entryp)) {
4718 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4720 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4721 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4722 css_property_t *cur;
4723 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4724 if (STRCASEEQ('l','L',"left", cur->value)) {
4725 attr_align = apr_pstrdup(doc->pool, "left");
4727 else if (STRCASEEQ('c','C',"center",cur->value)) {
4728 attr_align = apr_pstrdup(doc->pool, "center");
4730 else if (STRCASEEQ('r','R',"right",cur->value)) {
4731 attr_align = apr_pstrdup(doc->pool, "right");
4734 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4735 if (STRCASEEQ('b','B',"both", cur->value)) {
4736 css_clear = apr_pstrdup(doc->pool, "both");
4738 else if (STRCASEEQ('r','R',"right", cur->value)) {
4739 css_clear = apr_pstrdup(doc->pool, "right");
4741 else if (STRCASEEQ('l','L',"left", cur->value)) {
4742 css_clear = apr_pstrdup(doc->pool, "left");
4748 if (attr_align || css_clear ) {
4769 * It is a handler who processes the H3 tag.
4771 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4772 * destination is specified.
4773 * @param node [i] The H1 tag node is specified.
4774 * @return The conversion result is returned.
4777 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
4783 jxhtml = GET_JXHTML(pdoc);
4788 if (IS_CSS_ON(jxhtml->entryp)) {
4789 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4796 * It is a handler who processes the H4 tag.
4798 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4799 * destination is specified.
4800 * @param node [i] The H1 tag node is specified.
4801 * @return The conversion result is returned.
4804 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
4810 char *attr_style = NULL;
4811 char *attr_align = NULL;
4812 char *css_clear = NULL;
4814 jxhtml = GET_JXHTML(pdoc);
4818 for (attr = qs_get_attr(doc,node);
4820 attr = qs_get_next_attr(doc,attr)) {
4821 char *name = qs_get_attr_name(doc,attr);
4822 char *value = qs_get_attr_value(doc,attr);
4823 if (STRCASEEQ('a','A',"align", name)) {
4824 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4828 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4832 if (IS_CSS_ON(jxhtml->entryp)) {
4833 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4835 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4836 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4837 css_property_t *cur;
4838 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4839 if (STRCASEEQ('l','L',"left", cur->value)) {
4840 attr_align = apr_pstrdup(doc->pool, "left");
4842 else if (STRCASEEQ('c','C',"center",cur->value)) {
4843 attr_align = apr_pstrdup(doc->pool, "center");
4845 else if (STRCASEEQ('r','R',"right",cur->value)) {
4846 attr_align = apr_pstrdup(doc->pool, "right");
4849 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4850 if (STRCASEEQ('b','B',"both", cur->value)) {
4851 css_clear = apr_pstrdup(doc->pool, "both");
4853 else if (STRCASEEQ('r','R',"right", cur->value)) {
4854 css_clear = apr_pstrdup(doc->pool, "right");
4856 else if (STRCASEEQ('l','L',"left", cur->value)) {
4857 css_clear = apr_pstrdup(doc->pool, "left");
4863 if (attr_align || css_clear ) {
4884 * It is a handler who processes the H4 tag.
4886 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4887 * destination is specified.
4888 * @param node [i] The H1 tag node is specified.
4889 * @return The conversion result is returned.
4892 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
4898 jxhtml = GET_JXHTML(pdoc);
4903 if (IS_CSS_ON(jxhtml->entryp)) {
4904 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4912 * It is a handler who processes the H5 tag.
4914 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4915 * destination is specified.
4916 * @param node [i] The H1 tag node is specified.
4917 * @return The conversion result is returned.
4920 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
4926 char *attr_style = NULL;
4927 char *attr_align = NULL;
4928 char *css_clear = NULL;
4930 jxhtml = GET_JXHTML(pdoc);
4934 for (attr = qs_get_attr(doc,node);
4936 attr = qs_get_next_attr(doc,attr)) {
4937 char *name = qs_get_attr_name(doc,attr);
4938 char *value = qs_get_attr_value(doc,attr);
4939 if (STRCASEEQ('a','A',"align", name)) {
4940 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4944 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4948 if (IS_CSS_ON(jxhtml->entryp)) {
4949 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4951 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4952 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4953 css_property_t *cur;
4954 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4955 if (STRCASEEQ('l','L',"left", cur->value)) {
4956 attr_align = apr_pstrdup(doc->pool, "left");
4958 else if (STRCASEEQ('c','C',"center",cur->value)) {
4959 attr_align = apr_pstrdup(doc->pool, "center");
4961 else if (STRCASEEQ('r','R',"right",cur->value)) {
4962 attr_align = apr_pstrdup(doc->pool, "right");
4965 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4966 if (STRCASEEQ('b','B',"both", cur->value)) {
4967 css_clear = apr_pstrdup(doc->pool, "both");
4969 else if (STRCASEEQ('r','R',"right", cur->value)) {
4970 css_clear = apr_pstrdup(doc->pool, "right");
4972 else if (STRCASEEQ('l','L',"left", cur->value)) {
4973 css_clear = apr_pstrdup(doc->pool, "left");
4979 if (attr_align || css_clear ) {
5000 * It is a handler who processes the H5 tag.
5002 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5003 * destination is specified.
5004 * @param node [i] The H1 tag node is specified.
5005 * @return The conversion result is returned.
5008 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5014 jxhtml = GET_JXHTML(pdoc);
5019 if (IS_CSS_ON(jxhtml->entryp)) {
5020 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5028 * It is a handler who processes the H6 tag.
5030 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5031 * destination is specified.
5032 * @param node [i] The H1 tag node is specified.
5033 * @return The conversion result is returned.
5036 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5042 char *attr_style = NULL;
5043 char *attr_align = NULL;
5044 char *css_clear = NULL;
5046 jxhtml = GET_JXHTML(pdoc);
5050 for (attr = qs_get_attr(doc,node);
5052 attr = qs_get_next_attr(doc,attr)) {
5053 char *name = qs_get_attr_name(doc,attr);
5054 char *value = qs_get_attr_value(doc,attr);
5055 if (STRCASEEQ('a','A',"align", name)) {
5056 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5060 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5064 if (IS_CSS_ON(jxhtml->entryp)) {
5065 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5067 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5068 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5069 css_property_t *cur;
5070 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5071 if (STRCASEEQ('l','L',"left", cur->value)) {
5072 attr_align = apr_pstrdup(doc->pool, "left");
5074 else if (STRCASEEQ('c','C',"center",cur->value)) {
5075 attr_align = apr_pstrdup(doc->pool, "center");
5077 else if (STRCASEEQ('r','R',"right",cur->value)) {
5078 attr_align = apr_pstrdup(doc->pool, "right");
5081 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5082 if (STRCASEEQ('b','B',"both", cur->value)) {
5083 css_clear = apr_pstrdup(doc->pool, "both");
5085 else if (STRCASEEQ('r','R',"right", cur->value)) {
5086 css_clear = apr_pstrdup(doc->pool, "right");
5088 else if (STRCASEEQ('l','L',"left", cur->value)) {
5089 css_clear = apr_pstrdup(doc->pool, "left");
5095 if (attr_align || css_clear ) {
5116 * It is a handler who processes the H6 tag.
5118 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5119 * destination is specified.
5120 * @param node [i] The H1 tag node is specified.
5121 * @return The conversion result is returned.
5124 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5130 jxhtml = GET_JXHTML(pdoc);
5135 if (IS_CSS_ON(jxhtml->entryp)) {
5136 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5144 * It is a handler who processes the MENU tag.
5146 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5147 * destination is specified.
5148 * @param node [i] The MENU tag node is specified.
5149 * @return The conversion result is returned.
5152 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5154 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5155 Doc *doc = jxhtml->doc;
5157 char *attr_style = NULL;
5158 char *attr_color = NULL;
5159 char *attr_type = NULL;
5160 char *attr_size = NULL;
5161 for (attr = qs_get_attr(doc,node);
5163 attr = qs_get_next_attr(doc,attr)) {
5164 char *name = qs_get_attr_name(doc,attr);
5165 char *value = qs_get_attr_value(doc,attr);
5166 if (STRCASEEQ('t','T',"type",name)) {
5167 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5171 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5175 if (IS_CSS_ON(jxhtml->entryp)) {
5176 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5178 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5179 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5180 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5181 css_property_t *cur;
5182 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5183 if (cur->value && *cur->value) {
5184 attr_color = apr_pstrdup(doc->pool, cur->value);
5187 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5188 if (cur->value && *cur->value) {
5189 attr_type = apr_pstrdup(doc->pool, cur->value);
5192 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5193 if (cur->value && *cur->value) {
5194 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5195 attr_size = apr_pstrdup(doc->pool, cur->value);
5197 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5198 attr_size = apr_pstrdup(doc->pool, cur->value);
5200 else if (STRCASEEQ('s','S',"small",cur->value)) {
5201 attr_size = apr_pstrdup(doc->pool, cur->value);
5203 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5204 attr_size = apr_pstrdup(doc->pool, cur->value);
5206 else if (STRCASEEQ('l','L',"large",cur->value)) {
5207 attr_size = apr_pstrdup(doc->pool, cur->value);
5209 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5210 attr_size = apr_pstrdup(doc->pool, cur->value);
5212 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5213 attr_size = apr_pstrdup(doc->pool, cur->value);
5220 if (attr_type || attr_color || attr_size) {
5223 W_L("list-style-type:");
5228 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5246 * It is a handler who processes the MENU tag.
5248 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5249 * destination is specified.
5250 * @param node [i] The MENU tag node is specified.
5251 * @return The conversion result is returned.
5254 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5256 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5257 Doc *doc = jxhtml->doc;
5259 if (IS_CSS_ON(jxhtml->entryp)) {
5260 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5267 * It is a handler who processes the PLAINTEXT tag.
5269 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5270 * destination is specified.
5271 * @param node [i] The PLAINTEXT tag node is specified.
5272 * @return The conversion result is returned.
5275 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5280 jxhtml = GET_JXHTML(pdoc);
5283 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5288 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5293 jxhtml = GET_JXHTML(pdoc);
5295 for (child = qs_get_child_node(doc, node);
5297 child = qs_get_next_node(doc, child)) {
5299 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5306 * It is a handler who processes the PLAINTEXT tag.
5308 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5309 * destination is specified.
5310 * @param node [i] The PLAINTEXT tag node is specified.
5311 * @return The conversion result is returned.
5314 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5316 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5322 * It is a handler who processes the BLINK tag.
5324 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5325 * destination is specified.
5326 * @param node [i] The BLINK tag node is specified.
5327 * @return The conversion result is returned.
5330 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5332 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5333 Doc *doc = jxhtml->doc;
5335 char *attr_style = NULL;
5336 char *attr_color = NULL;
5337 char *attr_size = NULL;
5338 for (attr = qs_get_attr(doc,node);
5340 attr = qs_get_next_attr(doc,attr)) {
5341 char *name = qs_get_attr_name(doc,attr);
5342 char *value = qs_get_attr_value(doc,attr);
5343 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5347 if (IS_CSS_ON(jxhtml->entryp)) {
5348 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5350 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5351 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5352 css_property_t *cur;
5353 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5354 if (cur->value && *cur->value) {
5355 attr_color = apr_pstrdup(doc->pool, cur->value);
5358 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5359 if (cur->value && *cur->value) {
5360 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5361 attr_size = apr_pstrdup(doc->pool, cur->value);
5363 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5364 attr_size = apr_pstrdup(doc->pool, cur->value);
5366 else if (STRCASEEQ('s','S',"small",cur->value)) {
5367 attr_size = apr_pstrdup(doc->pool, cur->value);
5369 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5370 attr_size = apr_pstrdup(doc->pool, cur->value);
5372 else if (STRCASEEQ('l','L',"large",cur->value)) {
5373 attr_size = apr_pstrdup(doc->pool, cur->value);
5375 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5376 attr_size = apr_pstrdup(doc->pool, cur->value);
5378 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5379 attr_size = apr_pstrdup(doc->pool, cur->value);
5386 if (attr_color || attr_size) {
5389 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5407 * It is a handler who processes the BLINK tag.
5409 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5410 * destination is specified.
5411 * @param node [i] The BLINK tag node is specified.
5412 * @return The conversion result is returned.
5415 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5417 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5418 Doc *doc = jxhtml->doc;
5420 if (IS_CSS_ON(jxhtml->entryp)) {
5421 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5428 * It is a handler who processes the MARQUEE tag.
5430 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5431 * destination is specified.
5432 * @param node [i] The MARQUEE tag node is specified.
5433 * @return The conversion result is returned.
5436 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5438 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5439 Doc *doc = jxhtml->doc;
5441 char *attr_direction = NULL;
5442 char *attr_style = NULL;
5443 char *attr_color = NULL;
5444 char *attr_size = NULL;
5445 char *attr_bgcolor = NULL;
5446 /*--------------------------------------------------------------------------*/
5447 /* Get Attributes */
5448 /*--------------------------------------------------------------------------*/
5449 for (attr = qs_get_attr(doc,node);
5451 attr = qs_get_next_attr(doc,attr)) {
5452 char *name = qs_get_attr_name(doc,attr);
5453 char *value = qs_get_attr_value(doc,attr);
5454 if (STRCASEEQ('d','D',"direction", name)) {
5456 if (STRCASEEQ('l','L',"left",value)) {
5457 attr_direction = "rtl";
5459 else if (STRCASEEQ('r','R',"right",value)) {
5460 attr_direction = "ltr";
5464 else if (STRCASEEQ('b','B',"behavior",name)) {
5467 else if (STRCASEEQ('l','L',"loop",name)) {
5470 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5471 if (value && *value) {
5472 attr_bgcolor = value;
5475 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5479 if (IS_CSS_ON(jxhtml->entryp)) {
5480 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5482 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5483 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5484 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5485 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5486 css_property_t *cur;
5487 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5488 if (cur->value && *cur->value) {
5489 attr_color = apr_pstrdup(doc->pool, cur->value);
5492 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5493 if (cur->value && *cur->value) {
5494 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5497 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5498 if (cur->value && *cur->value) {
5499 attr_direction = apr_pstrdup(doc->pool, cur->value);
5502 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5503 if (cur->value && *cur->value) {
5504 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5505 || STRCASEEQ('x','X',"x-small", cur->value)
5506 || STRCASEEQ('s','S',"small", cur->value)
5507 || STRCASEEQ('m','M',"medium", cur->value)
5508 || STRCASEEQ('l','L',"large", cur->value)
5509 || STRCASEEQ('x','X',"x-large", cur->value)
5510 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5511 attr_size = apr_pstrdup(doc->pool, cur->value);
5518 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5520 if (attr_direction) {
5521 W_L("-wap-marquee-dir:");
5522 W_V(attr_direction);
5526 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5527 W_L("background-color:");
5532 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5551 * It is a handler who processes the MARQUEE tag.
5553 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5554 * destination is specified.
5555 * @param node [i] The MARQUEE tag node is specified.
5556 * @return The conversion result is returned.
5559 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5561 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5562 Doc *doc = jxhtml->doc;
5564 if (IS_CSS_ON(jxhtml->entryp)) {
5565 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5572 * It is handler who processes the New Line Code.
5575 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5577 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5578 if (jxhtml->start_html_flag) {
5579 Doc *doc = jxhtml->doc;
5587 * It is a handler who processes the LINK tag.
5589 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5590 * destination is specified.
5591 * @param node [i] The LINK tag node is specified.
5592 * @return The conversion result is returned.
5595 s_jxhtml_link_tag(void *pdoc, Node *node)
5604 jxhtml = GET_JXHTML(pdoc);
5607 if (! IS_CSS_ON(jxhtml->entryp)) {
5611 for (attr = qs_get_attr(doc,node);
5613 attr = qs_get_next_attr(doc,attr)) {
5614 char *name = qs_get_attr_name(doc,attr);
5615 char *value = qs_get_attr_value(doc,attr);
5616 if (STRCASEEQ('r','R',"rel", name)) {
5617 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5621 else if (STRCASEEQ('h','H',"href", name)) {
5622 if (value && *value) {
5626 else if (STRCASEEQ('t','T',"type", name)) {
5627 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5633 if (rel && href && type) {
5634 DBG(doc->r, "start load CSS. url:[%s]", href);
5635 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
5636 DBG(doc->r, "end load CSS. url:[%s]", href);
5643 static css_prop_list_t *
5644 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5646 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5647 Doc *doc = jxhtml->doc;
5648 css_prop_list_t *last_css = NULL;
5649 if (IS_CSS_ON(jxhtml->entryp)) {
5650 css_prop_list_t *dup_css;
5651 css_selector_t *selector;
5653 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5654 dup_css = chxj_dup_css_prop_list(doc, last_css);
5655 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5657 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5659 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
5660 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5662 if (style_attr_value) {
5663 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));
5665 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5673 static css_prop_list_t *
5674 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5676 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5677 Doc *doc = jxhtml->doc;
5678 css_prop_list_t *last_css = NULL;
5679 if (IS_CSS_ON(jxhtml->entryp)) {
5680 css_prop_list_t *dup_css;
5681 css_selector_t *selector;
5683 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5684 dup_css = chxj_dup_css_prop_list(doc, last_css);
5685 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5687 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5691 if (style_attr_value) {
5692 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));
5694 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5703 * It is a handler who processes the SPAN tag.
5705 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5706 * destination is specified.
5707 * @param node [i] The SPAN tag node is specified.
5708 * @return The conversion result is returned.
5711 s_jxhtml_start_span_tag(void *pdoc, Node *node)
5716 char *attr_style = NULL;
5717 char *attr_color = NULL;
5718 char *attr_size = NULL;
5719 char *attr_align = NULL;
5720 char *attr_blink = NULL;
5721 char *attr_marquee = NULL;
5722 char *attr_marquee_dir = NULL;
5723 char *attr_marquee_style = NULL;
5724 char *attr_marquee_loop = NULL;
5725 char *css_bgcolor = NULL;
5727 jxhtml = GET_JXHTML(pdoc);
5730 for (attr = qs_get_attr(doc,node);
5732 attr = qs_get_next_attr(doc,attr)) {
5733 char *nm = qs_get_attr_name(doc,attr);
5734 char *val = qs_get_attr_value(doc,attr);
5735 if (val && STRCASEEQ('s','S',"style", nm)) {
5739 if (IS_CSS_ON(jxhtml->entryp)) {
5740 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5742 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5743 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5744 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5745 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5746 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5747 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5748 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5749 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5750 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5752 css_property_t *cur;
5753 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5754 attr_color = apr_pstrdup(doc->pool, cur->value);
5756 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5757 if (cur->value && *cur->value) {
5758 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5759 || STRCASEEQ('x','X',"x-small", cur->value)
5760 || STRCASEEQ('s','S',"small", cur->value)
5761 || STRCASEEQ('m','M',"medium", cur->value)
5762 || STRCASEEQ('l','L',"large", cur->value)
5763 || STRCASEEQ('x','X',"x-large", cur->value)
5764 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5765 attr_size = apr_pstrdup(doc->pool, cur->value);
5769 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5770 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5771 attr_blink = apr_pstrdup(doc->pool, cur->value);
5774 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5775 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5776 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5779 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5780 if (cur->value && *cur->value) {
5781 if ( STRCASEEQ('l','L',"ltr",cur->value)
5782 || STRCASEEQ('r','R',"rtl",cur->value)) {
5783 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5787 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5788 if (cur->value && *cur->value) {
5789 if ( STRCASEEQ('s','S',"scroll",cur->value)
5790 || STRCASEEQ('s','S',"slide",cur->value)
5791 || STRCASEEQ('a','A',"alternate",cur->value)) {
5792 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5796 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5797 if (cur->value && *cur->value) {
5798 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
5799 attr_marquee_loop = "infinite";
5802 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5806 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5807 if (STRCASEEQ('l','L',"left", cur->value)) {
5808 attr_align = apr_pstrdup(doc->pool, "left");
5810 else if (STRCASEEQ('c','C',"center",cur->value)) {
5811 attr_align = apr_pstrdup(doc->pool, "center");
5813 else if (STRCASEEQ('r','R',"right",cur->value)) {
5814 attr_align = apr_pstrdup(doc->pool, "right");
5817 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5818 if (cur->value && *cur->value) {
5819 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
5826 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
5829 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5845 W_L("text-decoration:");
5850 W_L("display:-wap-marquee;");
5851 if (attr_marquee_dir) {
5852 W_L("-wap-marquee-dir:");
5853 W_V(attr_marquee_dir);
5856 if (attr_marquee_style) {
5857 W_L("-wap-marquee-style:");
5858 W_V(attr_marquee_style);
5861 if (attr_marquee_loop) {
5862 W_L("-wap-marquee-loop:");
5863 W_V(attr_marquee_loop);
5868 W_L("background-color:");
5880 * It is a handler who processes the SPAN tag.
5882 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5883 * destination is specified.
5884 * @param node [i] The SPAN tag node is specified.
5885 * @return The conversion result is returned.
5888 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
5890 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5891 Doc *doc = jxhtml->doc;
5894 if (IS_CSS_ON(jxhtml->entryp)) {
5895 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5902 * It is a handler who processes the STYLE tag.
5904 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
5905 * destination is specified.
5906 * @param node [i] The STYLE tag node is specified.
5907 * @return The conversion result is returned.
5910 s_jxhtml_style_tag(void *pdoc, Node *node)
5917 jxhtml = GET_JXHTML(pdoc);
5920 if (! IS_CSS_ON(jxhtml->entryp)) {
5924 for (attr = qs_get_attr(doc,node);
5926 attr = qs_get_next_attr(doc,attr)) {
5927 char *name = qs_get_attr_name(doc,attr);
5928 char *value = qs_get_attr_value(doc,attr);
5929 if (STRCASEEQ('t','T',"type", name)) {
5930 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5936 Node *child = qs_get_child_node(doc, node);
5937 if (type && child) {
5938 char *name = qs_get_node_name(doc, child);
5939 if (STRCASEEQ('t','T',"text", name)) {
5940 char *value = qs_get_node_value(doc, child);
5941 DBG(doc->r, "start load CSS. buf:[%s]", value);
5942 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
5943 DBG(doc->r, "end load CSS. value:[%s]", value);