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"
29 #define GET_JXHTML(X) ((jxhtml_t *)(X))
32 #define W_L(X) do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
38 static char *s_jxhtml_start_html_tag (void *pdoc, Node *node);
39 static char *s_jxhtml_end_html_tag (void *pdoc, Node *node);
40 static char *s_jxhtml_start_meta_tag (void *pdoc, Node *node);
41 static char *s_jxhtml_end_meta_tag (void *pdoc, Node *node);
42 static char *s_jxhtml_start_head_tag (void *pdoc, Node *node);
43 static char *s_jxhtml_end_head_tag (void *pdoc, Node *node);
44 static char *s_jxhtml_start_title_tag (void *pdoc, Node *node);
45 static char *s_jxhtml_end_title_tag (void *pdoc, Node *node);
46 static char *s_jxhtml_start_base_tag (void *pdoc, Node *node);
47 static char *s_jxhtml_end_base_tag (void *pdoc, Node *node);
48 static char *s_jxhtml_start_body_tag (void *pdoc, Node *node);
49 static char *s_jxhtml_end_body_tag (void *pdoc, Node *node);
50 static char *s_jxhtml_start_a_tag (void *pdoc, Node *node);
51 static char *s_jxhtml_end_a_tag (void *pdoc, Node *node);
52 static char *s_jxhtml_start_pre_tag (void *pdoc, Node *node);
53 static char *s_jxhtml_end_pre_tag (void *pdoc, Node *node);
54 static char *s_jxhtml_start_p_tag (void *pdoc, Node *node);
55 static char *s_jxhtml_end_p_tag (void *pdoc, Node *node);
56 static char *s_jxhtml_start_ul_tag (void *pdoc, Node *node);
57 static char *s_jxhtml_end_ul_tag (void *pdoc, Node *node);
58 static char *s_jxhtml_start_ol_tag (void *pdoc, Node *node);
59 static char *s_jxhtml_end_ol_tag (void *pdoc, Node *node);
60 static char *s_jxhtml_start_li_tag (void *pdoc, Node *node);
61 static char *s_jxhtml_end_li_tag (void *pdoc, Node *node);
62 static char *s_jxhtml_start_br_tag (void *pdoc, Node *node);
63 static char *s_jxhtml_end_br_tag (void *pdoc, Node *node);
64 static char *s_jxhtml_start_tr_tag (void *pdoc, Node *node);
65 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
66 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
71 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
72 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
73 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
76 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
77 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
116 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
117 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
121 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
122 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
123 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
127 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
129 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
131 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
132 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
136 tag_handler jxhtml_handler[] = {
139 s_jxhtml_start_html_tag,
140 s_jxhtml_end_html_tag,
144 s_jxhtml_start_meta_tag,
145 s_jxhtml_end_meta_tag,
149 s_jxhtml_start_textarea_tag,
150 s_jxhtml_end_textarea_tag,
154 s_jxhtml_start_p_tag,
159 s_jxhtml_start_pre_tag,
160 s_jxhtml_end_pre_tag,
164 s_jxhtml_start_ul_tag,
169 s_jxhtml_start_li_tag,
174 s_jxhtml_start_ol_tag,
179 s_jxhtml_start_h1_tag,
184 s_jxhtml_start_h2_tag,
189 s_jxhtml_start_h3_tag,
194 s_jxhtml_start_h4_tag,
199 s_jxhtml_start_h5_tag,
204 s_jxhtml_start_h6_tag,
209 s_jxhtml_start_head_tag,
210 s_jxhtml_end_head_tag,
214 s_jxhtml_start_title_tag,
215 s_jxhtml_end_title_tag,
219 s_jxhtml_start_base_tag,
220 s_jxhtml_end_base_tag,
224 s_jxhtml_start_body_tag,
225 s_jxhtml_end_body_tag,
229 s_jxhtml_start_a_tag,
234 s_jxhtml_start_br_tag,
244 s_jxhtml_start_tr_tag,
259 s_jxhtml_start_font_tag,
260 s_jxhtml_end_font_tag,
264 s_jxhtml_start_form_tag,
265 s_jxhtml_end_form_tag,
269 s_jxhtml_start_input_tag,
270 s_jxhtml_end_input_tag,
274 s_jxhtml_start_center_tag,
275 s_jxhtml_end_center_tag,
279 s_jxhtml_start_hr_tag,
284 s_jxhtml_start_img_tag,
285 s_jxhtml_end_img_tag,
289 s_jxhtml_start_select_tag,
290 s_jxhtml_end_select_tag,
294 s_jxhtml_start_option_tag,
295 s_jxhtml_end_option_tag,
299 s_jxhtml_start_div_tag,
300 s_jxhtml_end_div_tag,
324 s_jxhtml_start_span_tag,
325 s_jxhtml_end_span_tag,
339 s_jxhtml_start_b_tag,
349 s_jxhtml_start_dt_tag,
364 s_jxhtml_start_blockquote_tag,
365 s_jxhtml_end_blockquote_tag,
369 s_jxhtml_start_dir_tag,
370 s_jxhtml_end_dir_tag,
374 s_jxhtml_start_dl_tag,
379 s_jxhtml_start_dd_tag,
384 s_jxhtml_start_menu_tag,
385 s_jxhtml_end_menu_tag,
389 s_jxhtml_start_plaintext_tag,
390 s_jxhtml_end_plaintext_tag,
394 s_jxhtml_start_blink_tag,
395 s_jxhtml_end_blink_tag,
399 s_jxhtml_start_marquee_tag,
400 s_jxhtml_end_marquee_tag,
409 s_jxhtml_newline_mark,
416 * converts from CHTML5.0 to JXHTML.
418 * @param r [i] Requet_rec is appointed.
419 * @param spec [i] The result of the device specification processing which
420 * was done in advance is appointed.
421 * @param src [i] The character string before the converting is appointed.
422 * @return The character string after the converting is returned.
431 chxjconvrule_entry *entryp,
442 /*--------------------------------------------------------------------------*/
444 /*--------------------------------------------------------------------------*/
446 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
448 DBG(r,"I found qrcode xml");
451 DBG(r,"not found qrcode xml");
453 /*--------------------------------------------------------------------------*/
454 /* The CHTML structure is initialized. */
455 /*--------------------------------------------------------------------------*/
456 s_init_jxhtml(&jxhtml, &doc, r, spec);
458 jxhtml.entryp = entryp;
459 jxhtml.cookie = cookie;
461 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
463 /*--------------------------------------------------------------------------*/
464 /* The character string of the input is analyzed. */
465 /*--------------------------------------------------------------------------*/
466 qs_init_malloc(&doc);
467 qs_init_root_node(&doc);
469 ss = apr_pcalloc(r->pool, srclen + 1);
471 memset(ss, 0, srclen + 1);
472 memcpy(ss, src, srclen);
474 if (IS_CSS_ON(jxhtml.entryp)) {
475 /* current property list */
476 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
479 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
482 qs_parse_string(&doc,ss,strlen(ss));
484 chxj_buffered_write_init(r->pool, &doc.buf);
485 /*--------------------------------------------------------------------------*/
486 /* It converts it from CHTML to JXHTML. */
487 /*--------------------------------------------------------------------------*/
488 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
489 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
490 dst = apr_pstrdup(r->pool, jxhtml.out);
491 chxj_buffered_write_terminate(&doc.buf);
494 qs_all_free(&doc,QX_LOGMARK);
497 return apr_pstrdup(r->pool,ss);
500 dst = apr_psprintf(r->pool, "\n");
502 *dstlen = strlen(dst);
505 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
513 * The JXHTML structure is initialized.
515 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
516 * initialized is specified.
517 * @param doc [i] The Doc structure that should be set to the initialized
518 * JXHTML structure is specified.
519 * @param r [i] To use POOL, the pointer to request_rec is specified.
520 * @param spec [i] The pointer to the device_table
523 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
525 memset(doc, 0, sizeof(Doc));
526 memset(jxhtml, 0, sizeof(jxhtml_t));
531 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
532 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
533 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
538 * Corresponding EMOJI to a current character-code is retrieved.
539 * The substitution character string is stored in the rslt pointer if agreeing.
541 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
542 * @param txt [i] The character string to want to examine whether it is
543 * EMOJI is specified.
544 * @param rslt [o] The pointer to the pointer that stores the result is
546 * @return When corresponding EMOJI exists, it returns it excluding 0.
549 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
561 if (! spec) DBG(r,"spec is NULL");
563 for (ee = jxhtml->conf->emoji;
567 unsigned char hex1byte;
568 unsigned char hex2byte;
571 DBG(r,"emoji->imode is NULL");
575 hex1byte = ee->imode->hex1byte & 0xff;
576 hex2byte = ee->imode->hex2byte & 0xff;
578 if (ee->imode->string
579 && strlen(ee->imode->string) > 0
580 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
581 if (spec == NULL || spec->emoji_type == NULL) {
582 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
583 return strlen(ee->imode->string);
590 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
591 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
592 if (spec == NULL || spec->emoji_type == NULL) {
593 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
606 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
620 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
621 memset(doc, 0, sizeof(Doc));
622 memset(jxhtml, 0, sizeof(jxhtml_t));
627 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
628 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
629 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
631 apr_pool_create(&pool, r->pool);
633 chxj_buffered_write_init(pool, &doc->buf);
635 for (ii=0; ii<len; ii++) {
639 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
646 if (is_sjis_kanji(src[ii])) {
647 two_byte[0] = src[ii+0];
648 two_byte[1] = src[ii+1];
654 one_byte[0] = src[ii+0];
659 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
661 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
667 * It is a handler who processes the HTML tag.
669 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
670 * destination is specified.
671 * @param node [i] The HTML tag node is specified.
672 * @return The conversion result is returned.
675 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
682 jxhtml = GET_JXHTML(pdoc);
685 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
687 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
689 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
692 /*--------------------------------------------------------------------------*/
694 /*--------------------------------------------------------------------------*/
695 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
697 jxhtml->start_html_flag = 1;
699 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
706 * It is a handler who processes the HTML tag.
708 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
709 * destination is specified.
710 * @param node [i] The HTML tag node is specified.
711 * @return The conversion result is returned.
714 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
716 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
717 Doc *doc = jxhtml->doc;
726 * It is a handler who processes the META tag.
728 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
729 * destination is specified.
730 * @param node [i] The META tag node is specified.
731 * @return The conversion result is returned.
734 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
740 int content_type_flag;
743 jxhtml = GET_JXHTML(pdoc);
747 content_type_flag = 0;
750 /*--------------------------------------------------------------------------*/
752 /*--------------------------------------------------------------------------*/
753 for (attr = qs_get_attr(doc,node);
755 attr = qs_get_next_attr(doc,attr)) {
756 char *name = qs_get_attr_name(doc,attr);
757 char *value = qs_get_attr_value(doc,attr);
761 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
762 /*----------------------------------------------------------------------*/
764 /*----------------------------------------------------------------------*/
765 W_L(" http-equiv=\"");
768 if (STRCASEEQ('c','C',"content-type",value)) {
769 content_type_flag = 1;
771 if (STRCASEEQ('r','R',"refresh",value)) {
779 if (strcasecmp(name, "content") == 0 && value && *value) {
780 /*----------------------------------------------------------------------*/
782 /*----------------------------------------------------------------------*/
783 if (content_type_flag) {
787 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
796 buf = apr_pstrdup(r->pool, value);
798 url = strchr(buf, ';');
800 sec = apr_pstrdup(r->pool, buf);
803 url = chxj_encoding_parameter(r, url, 1);
833 * It is a handler who processes the META tag.
835 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
836 * destination is specified.
837 * @param node [i] The META tag node is specified.
838 * @return The conversion result is returned.
841 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
843 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
850 * It is a handler who processes the HEAD tag.
852 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
853 * destination is specified.
854 * @param node [i] The HEAD tag node is specified.
855 * @return The conversion result is returned.
858 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
864 jxhtml = GET_JXHTML(pdoc);
874 * It is a handler who processes the HEAD tag.
876 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
877 * destination is specified.
878 * @param node [i] The HEAD tag node is specified.
879 * @return The conversion result is returned.
882 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
888 jxhtml = GET_JXHTML(pdoc);
898 * It is a handler who processes the TITLE tag.
900 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
901 * destination is specified.
902 * @param node [i] The TITLE tag node is specified.
903 * @return The conversion result is returned.
906 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
912 jxhtml = GET_JXHTML(pdoc);
922 * It is a handler who processes the TITLE tag.
924 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
925 * destination is specified.
926 * @param node [i] The TITLE tag node is specified.
927 * @return The conversion result is returned.
930 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
936 jxhtml = GET_JXHTML(pdoc);
946 * It is a handler who processes the BASE tag.
948 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
949 * destination is specified.
950 * @param node [i] The BASE tag node is specified.
951 * @return The conversion result is returned.
954 s_jxhtml_start_base_tag(void *pdoc, Node *node)
961 jxhtml = GET_JXHTML(pdoc);
966 /*--------------------------------------------------------------------------*/
968 /*--------------------------------------------------------------------------*/
969 for (attr = qs_get_attr(doc,node);
971 attr = qs_get_next_attr(doc,attr)) {
972 char *name = qs_get_attr_name(doc,attr);
973 char *value = qs_get_attr_value(doc,attr);
974 if (STRCASEEQ('h','H',"href",name)) {
986 * It is a handler who processes the BASE tag.
988 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
989 * destination is specified.
990 * @param node [i] The BASE tag node is specified.
991 * @return The conversion result is returned.
994 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
996 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1002 * It is a handler who processes the BODY tag.
1004 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1005 * destination is specified.
1006 * @param node [i] The BODY tag node is specified.
1007 * @return The conversion result is returned.
1010 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1016 char *attr_bgcolor = NULL;
1017 char *attr_text = NULL;
1018 char *attr_link = NULL;
1019 char *attr_style = NULL;
1021 jxhtml = GET_JXHTML(pdoc);
1025 /*--------------------------------------------------------------------------*/
1026 /* Get Attributes */
1027 /*--------------------------------------------------------------------------*/
1028 for (attr = qs_get_attr(doc,node);
1030 attr = qs_get_next_attr(doc,attr)) {
1031 char *name = qs_get_attr_name(doc,attr);
1032 char *value = qs_get_attr_value(doc,attr);
1033 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1034 /*----------------------------------------------------------------------*/
1036 /*----------------------------------------------------------------------*/
1037 attr_bgcolor = value;
1039 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1040 /*----------------------------------------------------------------------*/
1042 /*----------------------------------------------------------------------*/
1045 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1051 else if (STRCASEEQ('a','A',"alink",name)) {
1052 /*----------------------------------------------------------------------*/
1054 /*----------------------------------------------------------------------*/
1057 else if (STRCASEEQ('v','V',"vlink",name)) {
1058 /*----------------------------------------------------------------------*/
1060 /*----------------------------------------------------------------------*/
1063 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1068 if (IS_CSS_ON(jxhtml->entryp)) {
1069 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1071 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1072 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1073 css_property_t *cur;
1074 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1075 if (cur->value && *cur->value) {
1076 attr_text = apr_pstrdup(doc->pool, cur->value);
1079 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1080 if (cur->value && *cur->value) {
1081 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1085 if (jxhtml->style) {
1086 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1087 css_selector_t *cur_sel;
1088 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1089 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1090 css_property_t *cur;
1091 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1092 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1093 attr_link = apr_pstrdup(doc->pool, cur->value);
1103 if (attr_bgcolor || attr_text) {
1106 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1107 W_L("background-color:");
1112 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1120 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1131 * It is a handler who processes the BODY tag.
1133 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1134 * destination is specified.
1135 * @param node [i] The BODY tag node is specified.
1136 * @return The conversion result is returned.
1139 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1145 jxhtml = GET_JXHTML(pdoc);
1149 W_L("</div></body>");
1150 if (IS_CSS_ON(jxhtml->entryp)) {
1151 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1158 * It is a handler who processes the A tag.
1160 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1161 * destination is specified.
1162 * @param node [i] The A tag node is specified.
1163 * @return The conversion result is returned.
1166 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1172 char *attr_style = NULL;
1174 jxhtml = GET_JXHTML(pdoc);
1179 /*--------------------------------------------------------------------------*/
1180 /* Get Attributes */
1181 /*--------------------------------------------------------------------------*/
1182 for (attr = qs_get_attr(doc,node);
1184 attr = qs_get_next_attr(doc,attr)) {
1185 char *name = qs_get_attr_name(doc,attr);
1186 char *value = qs_get_attr_value(doc,attr);
1187 if (STRCASEEQ('n','N',"name",name)) {
1188 /*----------------------------------------------------------------------*/
1190 /*----------------------------------------------------------------------*/
1192 W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1195 else if (STRCASEEQ('h','H',"href",name)) {
1196 /*----------------------------------------------------------------------*/
1198 /*----------------------------------------------------------------------*/
1199 value = chxj_encoding_parameter(r, value, 1);
1200 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1201 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1207 else if (STRCASEEQ('a','A',"accesskey",name)) {
1208 /*----------------------------------------------------------------------*/
1210 /*----------------------------------------------------------------------*/
1211 W_L(" accesskey=\"");
1215 else if (STRCASEEQ('c','C',"cti",name)) {
1216 /*----------------------------------------------------------------------*/
1218 /*----------------------------------------------------------------------*/
1223 else if (STRCASEEQ('i','I',"ijam",name)) {
1224 /*----------------------------------------------------------------------*/
1226 /*----------------------------------------------------------------------*/
1229 else if (STRCASEEQ('u','U',"utn",name)) {
1230 /*----------------------------------------------------------------------*/
1232 /* It is special only for CHTML. */
1233 /*----------------------------------------------------------------------*/
1236 else if (STRCASEEQ('t','T',"telbook",name)) {
1237 /*----------------------------------------------------------------------*/
1239 /*----------------------------------------------------------------------*/
1242 else if (STRCASEEQ('k','K',"kana",name)) {
1243 /*----------------------------------------------------------------------*/
1245 /*----------------------------------------------------------------------*/
1248 else if (STRCASEEQ('e','E',"email",name)) {
1249 /*----------------------------------------------------------------------*/
1251 /*----------------------------------------------------------------------*/
1254 else if (STRCASEEQ('i','I',"ista",name)) {
1255 /*----------------------------------------------------------------------*/
1257 /*----------------------------------------------------------------------*/
1260 else if (STRCASEEQ('i','I',"ilet",name)) {
1261 /*----------------------------------------------------------------------*/
1263 /*----------------------------------------------------------------------*/
1266 else if (STRCASEEQ('i','I',"iswf",name)) {
1267 /*----------------------------------------------------------------------*/
1269 /*----------------------------------------------------------------------*/
1272 else if (STRCASEEQ('i','I',"irst",name)) {
1273 /*----------------------------------------------------------------------*/
1275 /*----------------------------------------------------------------------*/
1278 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1279 /*----------------------------------------------------------------------*/
1281 /*----------------------------------------------------------------------*/
1287 if (IS_CSS_ON(jxhtml->entryp)) {
1288 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1296 * It is a handler who processes the A tag.
1298 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1299 * destination is specified.
1300 * @param node [i] The A tag node is specified.
1301 * @return The conversion result is returned.
1304 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1310 jxhtml = GET_JXHTML(pdoc);
1316 if (IS_CSS_ON(jxhtml->entryp)) {
1317 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1325 * It is a handler who processes the BR tag.
1327 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1328 * destination is specified.
1329 * @param node [i] The BR tag node is specified.
1330 * @return The conversion result is returned.
1333 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1340 jxhtml = GET_JXHTML(pdoc);
1345 /*--------------------------------------------------------------------------*/
1346 /* Get Attributes */
1347 /*--------------------------------------------------------------------------*/
1348 for (attr = qs_get_attr(doc,node);
1350 attr = qs_get_next_attr(doc,attr)) {
1351 char *name = qs_get_attr_name(doc,attr);
1352 char *value = qs_get_attr_value(doc,attr);
1353 if (STRCASEEQ('c','C',"clear",name)) {
1354 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1367 * It is a handler who processes the BR tag.
1369 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1370 * destination is specified.
1371 * @param node [i] The BR tag node is specified.
1372 * @return The conversion result is returned.
1375 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1377 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1383 * It is a handler who processes the TR tag.
1385 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1386 * destination is specified.
1387 * @param node [i] The TR tag node is specified.
1388 * @return The conversion result is returned.
1391 s_jxhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1397 jxhtml = GET_JXHTML(pdoc);
1407 * It is a handler who processes the TR tag.
1409 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1410 * destination is specified.
1411 * @param node [i] The TR tag node is specified.
1412 * @return The conversion result is returned.
1415 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1417 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1423 * It is a handler who processes the FONT tag.
1425 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1426 * destination is specified.
1427 * @param node [i] The FONT tag node is specified.
1428 * @return The conversion result is returned.
1431 s_jxhtml_start_font_tag(void *pdoc, Node *node)
1437 char *attr_color = NULL;
1438 char *attr_size = NULL;
1439 char *attr_style = NULL;
1441 jxhtml = GET_JXHTML(pdoc);
1445 /*--------------------------------------------------------------------------*/
1446 /* Get Attributes */
1447 /*--------------------------------------------------------------------------*/
1448 for (attr = qs_get_attr(doc,node);
1450 attr = qs_get_next_attr(doc,attr)) {
1451 char *name = qs_get_attr_name(doc,attr);
1452 char *value = qs_get_attr_value(doc,attr);
1453 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1454 attr_color = apr_pstrdup(doc->buf.pool, value);
1456 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1457 /*----------------------------------------------------------------------*/
1459 /*----------------------------------------------------------------------*/
1460 attr_size = apr_pstrdup(doc->buf.pool, value);
1462 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1463 attr_style = apr_pstrdup(doc->buf.pool, value);
1466 if (IS_CSS_ON(jxhtml->entryp)) {
1467 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1469 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1470 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1471 css_property_t *cur;
1472 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1473 if (cur->value && *cur->value) {
1474 attr_color = apr_pstrdup(doc->pool, cur->value);
1477 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1478 if (cur->value && *cur->value) {
1479 attr_size = apr_pstrdup(doc->pool, cur->value);
1480 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1481 attr_size = apr_pstrdup(doc->pool, "1");
1483 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1484 attr_size = apr_pstrdup(doc->pool, "2");
1486 else if (STRCASEEQ('s','S',"small",attr_size)) {
1487 attr_size = apr_pstrdup(doc->pool, "3");
1489 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1490 attr_size = apr_pstrdup(doc->pool, "4");
1492 else if (STRCASEEQ('l','L',"large",attr_size)) {
1493 attr_size = apr_pstrdup(doc->pool, "5");
1495 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1496 attr_size = apr_pstrdup(doc->pool, "6");
1498 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1499 attr_size = apr_pstrdup(doc->pool, "7");
1505 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1506 memset(flg, 0, sizeof(*flg));
1508 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1509 W_L("<font color=\"");
1512 flg->font_color_flag = 1;
1515 flg->font_size_flag = 1;
1516 switch(*attr_size) {
1517 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1518 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1519 case '3': W_L("<span style=\"font-size: small\">"); break;
1520 case '4': W_L("<span style=\"font-size: medium\">"); break;
1521 case '5': W_L("<span style=\"font-size: large\">"); break;
1522 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1523 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1525 if (*(attr_size + 1) == '1') {
1526 W_L("<span style=\"font-size: small\">");
1529 if (*(attr_size + 1) == '2') {
1530 W_L("<span style=\"font-size: x-small\">");
1533 if (*(attr_size + 1) == '3') {
1534 W_L("<span style=\"font-size: xx-small\">");
1537 flg->font_size_flag = 0;
1541 if (*(attr_size + 1) == '1') {
1542 W_L("<span style=\"font-size: large\">");
1545 if (*(attr_size + 1) == '2') {
1546 W_L("<span style=\"font-size: x-large\">");
1549 if (*(attr_size + 1) == '3') {
1550 W_L("<span style=\"font-size: xx-large\">");
1553 flg->font_size_flag = 0;
1557 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1558 flg->font_size_flag = 0;
1561 node->userData = flg;
1567 * It is a handler who processes the FONT tag.
1569 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1570 * destination is specified.
1571 * @param node [i] The FONT tag node is specified.
1572 * @return The conversion result is returned.
1575 s_jxhtml_end_font_tag(void *pdoc, Node *node)
1581 jxhtml = GET_JXHTML(pdoc);
1585 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
1586 if (flg && flg->font_size_flag) {
1589 if (flg && flg->font_color_flag) {
1592 if (IS_CSS_ON(jxhtml->entryp)) {
1593 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1601 * It is a handler who processes the FORM tag.
1603 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1604 * destination is specified.
1605 * @param node [i] The FORM tag node is specified.
1606 * @return The conversion result is returned.
1609 s_jxhtml_start_form_tag(void *pdoc, Node *node)
1615 char *attr_action = NULL;
1616 char *attr_method = NULL;
1617 char *attr_style = NULL;
1618 char *attr_color = NULL;
1619 char *attr_align = NULL;
1620 char *attr_name = NULL;
1621 char *new_hidden_tag = NULL;
1623 jxhtml = GET_JXHTML(pdoc);
1627 /*--------------------------------------------------------------------------*/
1628 /* Get Attributes */
1629 /*--------------------------------------------------------------------------*/
1630 for (attr = qs_get_attr(doc,node);
1632 attr = qs_get_next_attr(doc,attr)) {
1633 char *name = qs_get_attr_name(doc,attr);
1634 char *value = qs_get_attr_value(doc,attr);
1638 if (strcasecmp(name, "action") == 0) {
1639 /*--------------------------------------------------------------------*/
1641 /*--------------------------------------------------------------------*/
1642 attr_action = value;
1648 if (strcasecmp(name, "method") == 0) {
1649 /*--------------------------------------------------------------------*/
1651 /*--------------------------------------------------------------------*/
1652 attr_method = value;
1658 if (strcasecmp(name, "name") == 0) {
1659 /*--------------------------------------------------------------------*/
1661 /*--------------------------------------------------------------------*/
1668 if (strcasecmp(name, "style") == 0) {
1677 if (IS_CSS_ON(jxhtml->entryp)) {
1678 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1680 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1681 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1682 css_property_t *cur;
1683 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1684 if (STRCASEEQ('l','L',"left", cur->value)) {
1685 attr_align = apr_pstrdup(doc->pool, "left");
1687 else if (STRCASEEQ('c','C',"center",cur->value)) {
1688 attr_align = apr_pstrdup(doc->pool, "center");
1690 else if (STRCASEEQ('r','R',"right",cur->value)) {
1691 attr_align = apr_pstrdup(doc->pool, "right");
1694 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1695 attr_color = apr_pstrdup(doc->pool, cur->value);
1700 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1704 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1705 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
1707 char *old_qs = NULL;
1708 q = strchr(attr_action, '?');
1710 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);
1711 if (new_hidden_tag || old_qs) {
1735 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
1736 memset(flg, 0, sizeof(*flg));
1738 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1739 W_L("<font color=\"");
1742 flg->with_font_flag = 1;
1745 W_L("<div align=\"");
1748 flg->with_div_flag = 1;
1750 node->userData = flg;
1751 if (new_hidden_tag) {
1752 W_V(new_hidden_tag);
1759 * It is a handler who processes the FORM tag.
1761 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1762 * destination is specified.
1763 * @param node [i] The FORM tag node is specified.
1764 * @return The conversion result is returned.
1767 s_jxhtml_end_form_tag(void *pdoc, Node *node)
1769 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1770 Doc *doc = jxhtml->doc;
1772 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
1773 if (flg && flg->with_div_flag) {
1776 if (flg && flg->with_font_flag) {
1780 if (IS_CSS_ON(jxhtml->entryp)) {
1781 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1789 * It is a handler who processes the INPUT tag.
1791 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1792 * destination is specified.
1793 * @param node [i] The INPUT tag node is specified.
1794 * @return The conversion result is returned.
1797 s_jxhtml_start_input_tag(void *pdoc, Node *node)
1803 char *attr_accesskey = NULL;
1804 char *attr_max_length = NULL;
1805 char *attr_type = NULL;
1806 char *attr_name = NULL;
1807 char *attr_value = NULL;
1808 char *attr_istyle = NULL;
1809 char *attr_size = NULL;
1810 char *attr_checked = NULL;
1811 char *attr_style = NULL;
1813 jxhtml = GET_JXHTML(pdoc);
1817 /*--------------------------------------------------------------------------*/
1818 /* Get Attributes */
1819 /*--------------------------------------------------------------------------*/
1820 for (attr = qs_get_attr(doc,node);
1822 attr = qs_get_next_attr(doc,attr)) {
1823 char *name = qs_get_attr_name(doc,attr);
1824 char *value = qs_get_attr_value(doc,attr);
1825 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1826 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1827 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1828 STRCASEEQ('p','P',"password",tmp_type) ||
1829 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1830 STRCASEEQ('r','R',"radio", tmp_type) ||
1831 STRCASEEQ('h','H',"hidden", tmp_type) ||
1832 STRCASEEQ('s','S',"submit", tmp_type) ||
1833 STRCASEEQ('r','R',"reset", tmp_type))) {
1834 attr_type = tmp_type;
1837 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1840 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1843 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1844 attr_istyle = value;
1846 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1847 attr_max_length = value;
1849 else if (STRCASEEQ('c','C',"checked", name)) {
1850 attr_checked = value;
1852 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1853 attr_accesskey = value;
1855 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1858 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1863 if (IS_CSS_ON(jxhtml->entryp)) {
1864 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1866 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1867 css_property_t *cur;
1868 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1869 if (strcasestr(cur->value, "<ja:n>")) {
1872 else if (strcasestr(cur->value, "<ja:en>")) {
1875 else if (strcasestr(cur->value, "<ja:hk>")) {
1878 else if (strcasestr(cur->value, "<ja:h>")) {
1898 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
1903 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1906 if (attr_accesskey) {
1907 W_L(" accesskey=\"");
1908 W_V(attr_accesskey);
1911 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1912 /*------------------------------------------------------------------------*/
1914 /*------------------------------------------------------------------------*/
1915 if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jxhtml->entryp->pc_flag ) {
1916 char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
1917 W_L(" style=\"-wap-input-format:"*");
1922 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
1924 W_L("-wap-input-format:"*");
1930 else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1931 char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
1932 W_L(" style=\"-wap-input-format:"*");
1936 /*--------------------------------------------------------------------------*/
1937 /* The figure is default for the password. */
1938 /*--------------------------------------------------------------------------*/
1939 if (attr_max_length && *attr_max_length) {
1940 if (chxj_chk_numeric(attr_max_length) == 0) {
1941 W_L(" maxlength=\"");
1942 W_V(attr_max_length);
1947 W_L(" checked=\"checked\"");
1963 jxhtml = GET_JXHTML(pdoc);
1976 /*--------------------------------------------------------------------------*/
1977 /* Get Attributes */
1978 /*--------------------------------------------------------------------------*/
1979 type = qs_get_type_attr(doc, node, doc->buf.pool);
1980 name = qs_get_name_attr(doc, node, doc->buf.pool);
1981 value = qs_get_value_attr(doc,node, doc->buf.pool);
1982 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1983 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1984 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
1985 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1986 size = qs_get_size_attr(doc, node, doc->buf.pool);
1989 if (type && (STRCASEEQ('t','T',"text", type) ||
1990 STRCASEEQ('p','P',"password",type) ||
1991 STRCASEEQ('c','C',"checkbox",type) ||
1992 STRCASEEQ('r','R',"radio", type) ||
1993 STRCASEEQ('h','H',"hidden", type) ||
1994 STRCASEEQ('s','S',"submit", type) ||
1995 STRCASEEQ('r','R',"reset", type))) {
2001 if (size && *size) {
2006 if (name && *name) {
2008 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2011 if (value && *value) {
2013 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2016 if (accesskey && *accesskey) {
2017 W_L(" accesskey=\"");
2021 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2022 /*------------------------------------------------------------------------*/
2024 /*------------------------------------------------------------------------*/
2025 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2026 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2029 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2031 W_L("-wap-input-format:'*");
2037 else if (type && STRCASEEQ('p','P',"password",type)) {
2038 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2040 /*--------------------------------------------------------------------------*/
2041 /* The figure is default for the password. */
2042 /*--------------------------------------------------------------------------*/
2043 if (max_length && *max_length) {
2044 if (chxj_chk_numeric(max_length) == 0) {
2045 W_L(" maxlength=\"");
2052 W_L(" checked=\"checked\"");
2061 * It is a handler who processes the INPUT tag.
2063 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2064 * destination is specified.
2065 * @param node [i] The INPUT tag node is specified.
2066 * @return The conversion result is returned.
2069 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2071 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2077 * It is a handler who processes the CENTER tag.
2079 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2080 * destination is specified.
2081 * @param node [i] The CENTER tag node is specified.
2082 * @return The conversion result is returned.
2085 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2090 char *attr_style = NULL;
2091 char *attr_color = NULL;
2092 char *attr_size = NULL;
2094 jxhtml = GET_JXHTML(pdoc);
2097 for (attr = qs_get_attr(doc,node);
2099 attr = qs_get_next_attr(doc,attr)) {
2100 char *name = qs_get_attr_name(doc,attr);
2101 char *value = qs_get_attr_value(doc,attr);
2102 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2106 if (IS_CSS_ON(jxhtml->entryp)) {
2107 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2109 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2110 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2111 css_property_t *cur;
2112 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2113 if (cur->value && *cur->value) {
2114 attr_color = apr_pstrdup(doc->pool, cur->value);
2117 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2118 if (cur->value && *cur->value) {
2119 attr_size = apr_pstrdup(doc->pool, cur->value);
2126 if (attr_size || attr_color) {
2134 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2148 * It is a handler who processes the CENTER tag.
2150 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2151 * destination is specified.
2152 * @param node [i] The CENTER tag node is specified.
2153 * @return The conversion result is returned.
2156 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2162 jxhtml = GET_JXHTML(pdoc);
2167 if (IS_CSS_ON(jxhtml->entryp)) {
2168 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2175 * It is a handler who processes the li tag.
2177 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2178 * destination is specified.
2179 * @param node [i] The li tag node is specified.
2180 * @return The conversion result is returned.
2183 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2189 char *attr_type = NULL;
2190 char *attr_value = NULL;
2191 char *attr_style = NULL;
2193 jxhtml = GET_JXHTML(pdoc);
2197 for (attr = qs_get_attr(doc,node);
2199 attr = qs_get_next_attr(doc,attr)) {
2200 char *name = qs_get_attr_name(doc,attr);
2201 char *value = qs_get_attr_value(doc,attr);
2202 if (STRCASEEQ('t','T',"type",name)) {
2203 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2204 if (*value == '1') {
2205 attr_type = apr_pstrdup(doc->pool, "decimal");
2207 else if (*value == 'a') {
2208 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2210 else if (*value == 'A') {
2211 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2218 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2221 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2225 if (IS_CSS_ON(jxhtml->entryp)) {
2226 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2228 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2229 css_property_t *cur;
2230 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2231 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2232 attr_type = apr_pstrdup(doc->pool, "decimal");
2234 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2235 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2237 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2238 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2240 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2241 attr_type = apr_pstrdup(doc->pool, "disc");
2243 else if (STRCASEEQ('s','S',"square", cur->value)) {
2244 attr_type = apr_pstrdup(doc->pool, "square");
2246 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2247 attr_type = apr_pstrdup(doc->pool, "circle");
2257 W_L("list-style-type:");
2273 * It is a handler who processes the li tag.
2275 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2276 * destination is specified.
2277 * @param node [i] The li tag node is specified.
2278 * @return The conversion result is returned.
2281 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2287 jxhtml = GET_JXHTML(pdoc);
2291 if (IS_CSS_ON(jxhtml->entryp)) {
2292 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2300 * It is a handler who processes the OL tag.
2302 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2303 * destination is specified.
2304 * @param node [i] The OL tag node is specified.
2305 * @return The conversion result is returned.
2308 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2314 char *attr_style = NULL;
2315 char *attr_start = NULL;
2316 char *attr_type = NULL;
2318 jxhtml = GET_JXHTML(pdoc);
2322 /*--------------------------------------------------------------------------*/
2323 /* Get Attributes */
2324 /*--------------------------------------------------------------------------*/
2325 for (attr = qs_get_attr(doc,node);
2327 attr = qs_get_next_attr(doc,attr)) {
2328 char *name = qs_get_attr_name(doc,attr);
2329 char *value = qs_get_attr_value(doc,attr);
2330 if (STRCASEEQ('t','T',"type",name) && value) {
2331 if (*value == '1') {
2332 attr_type = apr_pstrdup(doc->pool, "decimal");
2334 else if (*value == 'a') {
2335 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2337 else if (*value == 'A') {
2338 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2341 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2344 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2348 if (IS_CSS_ON(jxhtml->entryp)) {
2349 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2351 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2352 css_property_t *cur;
2353 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2354 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2355 attr_type = apr_pstrdup(doc->pool, "decimal");
2357 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2358 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2360 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2361 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2369 W_L("list-style-type:");
2386 * It is a handler who processes the OL tag.
2388 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2389 * destination is specified.
2390 * @param node [i] The OL tag node is specified.
2391 * @return The conversion result is returned.
2394 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2400 jxhtml = GET_JXHTML(pdoc);
2405 if (IS_CSS_ON(jxhtml->entryp)) {
2406 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2413 * It is a handler who processes the P tag.
2415 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2416 * destination is specified.
2417 * @param node [i] The P tag node is specified.
2418 * @return The conversion result is returned.
2421 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2427 char *attr_align = NULL;
2428 char *attr_style = NULL;
2429 char *attr_color = NULL;
2430 char *attr_blink = NULL;
2432 jxhtml = GET_JXHTML(pdoc);
2436 for (attr = qs_get_attr(doc,node);
2438 attr = qs_get_next_attr(doc,attr)) {
2439 char *nm = qs_get_attr_name(doc,attr);
2440 char *val = qs_get_attr_value(doc,attr);
2441 if (STRCASEEQ('a','A',"align", nm)) {
2442 /*----------------------------------------------------------------------*/
2443 /* CHTML 1.0 (W3C version 3.2) */
2444 /*----------------------------------------------------------------------*/
2445 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2446 attr_align = apr_pstrdup(doc->buf.pool, val);
2450 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2451 attr_style = apr_pstrdup(doc->buf.pool, val);
2454 if (IS_CSS_ON(jxhtml->entryp)) {
2455 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2457 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2458 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2459 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2460 css_property_t *cur;
2461 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2462 if (STRCASEEQ('l','L',"left",cur->value)) {
2463 attr_align = apr_pstrdup(doc->pool, "left");
2465 else if (STRCASEEQ('c','C',"center",cur->value)) {
2466 attr_align = apr_pstrdup(doc->pool, "center");
2468 else if (STRCASEEQ('r','R',"right",cur->value)) {
2469 attr_align = apr_pstrdup(doc->pool, "right");
2472 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2473 if (cur->value && *cur->value) {
2474 attr_color = apr_pstrdup(doc->pool, cur->value);
2477 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2478 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2479 attr_blink = apr_pstrdup(doc->pool, cur->value);
2485 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2493 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2499 W_L("text-decoration:");
2511 * It is a handler who processes the P tag.
2513 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2514 * destination is specified.
2515 * @param node [i] The P tag node is specified.
2516 * @return The conversion result is returned.
2519 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2521 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2522 Doc *doc = jxhtml->doc;
2525 if (IS_CSS_ON(jxhtml->entryp)) {
2526 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2533 * It is a handler who processes the PRE tag.
2535 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2536 * destination is specified.
2537 * @param node [i] The PRE tag node is specified.
2538 * @return The conversion result is returned.
2541 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
2543 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2544 Doc *doc = jxhtml->doc;
2546 char *attr_style = NULL;
2548 for (attr = qs_get_attr(doc,node);
2550 attr = qs_get_next_attr(doc,attr)) {
2551 char *nm = qs_get_attr_name(doc,attr);
2552 char *val = qs_get_attr_value(doc,attr);
2553 if (val && STRCASEEQ('s','S',"style", nm)) {
2558 if (IS_CSS_ON(jxhtml->entryp)) {
2559 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2569 * It is a handler who processes the PRE tag.
2571 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2572 * destination is specified.
2573 * @param node [i] The PRE tag node is specified.
2574 * @return The conversion result is returned.
2577 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2579 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2580 Doc *doc = jxhtml->doc;
2584 if (IS_CSS_ON(jxhtml->entryp)) {
2585 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2593 * It is a handler who processes the UL tag.
2595 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2596 * destination is specified.
2597 * @param node [i] The UL tag node is specified.
2598 * @return The conversion result is returned.
2601 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2603 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2604 Doc *doc = jxhtml->doc;
2606 char *attr_type = NULL;
2607 char *attr_style = NULL;
2608 /*--------------------------------------------------------------------------*/
2609 /* Get Attributes */
2610 /*--------------------------------------------------------------------------*/
2611 for (attr = qs_get_attr(doc,node);
2613 attr = qs_get_next_attr(doc,attr)) {
2614 char *name = qs_get_attr_name(doc,attr);
2615 char *value = qs_get_attr_value(doc,attr);
2616 if (STRCASEEQ('t','T',"type",name)) {
2617 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2621 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2625 if (IS_CSS_ON(jxhtml->entryp)) {
2626 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2628 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2629 css_property_t *cur;
2630 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2631 if (STRCASEEQ('d','D',"disc",cur->value)) {
2632 attr_type = apr_pstrdup(doc->pool, "disc");
2634 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2635 attr_type = apr_pstrdup(doc->pool, "circle");
2637 else if (STRCASEEQ('s','S',"square",cur->value)) {
2638 attr_type = apr_pstrdup(doc->pool, "square");
2646 W_L("list-style-type:");
2657 * It is a handler who processes the UL tag.
2659 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2660 * destination is specified.
2661 * @param node [i] The UL tag node is specified.
2662 * @return The conversion result is returned.
2665 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2667 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2668 Doc *doc = jxhtml->doc;
2671 if (IS_CSS_ON(jxhtml->entryp)) {
2672 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2679 * It is a handler who processes the HR tag.
2681 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The HR tag node is specified.
2684 * @return The conversion result is returned.
2687 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
2693 char *attr_align = NULL;
2694 char *attr_size = NULL;
2695 char *attr_width = NULL;
2696 char *attr_noshade = NULL;
2697 char *attr_style = NULL;
2698 char *attr_color = NULL;
2700 jxhtml = GET_JXHTML(pdoc);
2704 for (attr = qs_get_attr(doc,node);
2706 attr = qs_get_next_attr(doc,attr)) {
2707 char *name = qs_get_attr_name (doc,attr);
2708 char *value = qs_get_attr_value(doc,attr);
2712 if (strcasecmp(name, "align") == 0) {
2713 /*--------------------------------------------------------------------*/
2715 /*--------------------------------------------------------------------*/
2716 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2724 if (strcasecmp(name, "size") == 0) {
2725 /*--------------------------------------------------------------------*/
2727 /*--------------------------------------------------------------------*/
2728 if (value && *value) {
2732 else if (strcasecmp(name, "style") == 0) {
2733 if (value && *value) {
2741 if (strcasecmp(name, "width") == 0) {
2742 /*--------------------------------------------------------------------*/
2744 /*--------------------------------------------------------------------*/
2745 if (value && *value) {
2753 if (strcasecmp(name, "noshade") == 0) {
2754 /*--------------------------------------------------------------------*/
2756 /*--------------------------------------------------------------------*/
2757 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2763 if (strcasecmp(name, "color") == 0 && value && *value) {
2764 /*--------------------------------------------------------------------*/
2766 /*--------------------------------------------------------------------*/
2775 if (IS_CSS_ON(jxhtml->entryp)) {
2776 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2778 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2779 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2780 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2781 css_property_t *cur;
2782 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2783 if (STRCASEEQ('s','S',"solid",cur->value)) {
2784 attr_noshade = "noshade";
2787 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2788 char *tmp = apr_pstrdup(doc->pool, cur->value);
2789 char *tmpp = strstr(tmp, "px");
2791 attr_size = apr_pstrdup(doc->pool, tmp);
2794 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2795 char *tmp = apr_pstrdup(doc->pool, cur->value);
2796 char *tmpp = strstr(tmp, "px");
2798 attr_width = apr_pstrdup(doc->pool, tmp);
2801 tmpp = strstr(tmp, "%");
2803 attr_width = apr_pstrdup(doc->pool, tmp);
2815 if (attr_size || attr_width || attr_noshade) {
2820 if (!strstr(attr_size, "px")) {
2828 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2834 W_L("border-style:solid;");
2850 * It is a handler who processes the HR tag.
2852 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
2853 * destination is specified.
2854 * @param node [i] The HR tag node is specified.
2855 * @return The conversion result is returned.
2858 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2860 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2866 * It is a handler who processes the IMG tag.
2868 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2869 * destination is specified.
2870 * @param node [i] The IMG tag node is specified.
2871 * @return The conversion result is returned.
2874 s_jxhtml_start_img_tag(void *pdoc, Node *node)
2876 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2877 Doc *doc = jxhtml->doc;
2878 request_rec *r = doc->r;
2880 char *attr_src = NULL;
2881 char *attr_height = NULL;
2882 char *attr_width = NULL;
2883 char *attr_align = NULL;
2884 char *attr_alt = NULL;
2885 char *attr_style = NULL;
2886 #ifndef IMG_NOT_CONVERT_FILENAME
2887 device_table *spec = jxhtml->spec;
2890 /*--------------------------------------------------------------------------*/
2891 /* Get Attributes */
2892 /*--------------------------------------------------------------------------*/
2893 for (attr = qs_get_attr(doc,node);
2895 attr = qs_get_next_attr(doc,attr)) {
2896 char *name = qs_get_attr_name(doc,attr);
2897 char *value = qs_get_attr_value(doc,attr);
2898 if (STRCASEEQ('s','S',"src",name)) {
2899 /*----------------------------------------------------------------------*/
2901 /*----------------------------------------------------------------------*/
2902 #ifdef IMG_NOT_CONVERT_FILENAME
2903 value = chxj_encoding_parameter(r, value, 1);
2904 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
2905 value = chxj_add_cookie_no_update_parameter(r, value);
2908 value = chxj_img_conv(r, spec, value);
2909 value = chxj_encoding_parameter(r, value, 1);
2910 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
2911 value = chxj_add_cookie_no_update_parameter(r, value);
2915 else if (STRCASEEQ('a','A',"align",name)) {
2916 /*----------------------------------------------------------------------*/
2918 /*----------------------------------------------------------------------*/
2920 if (STRCASEEQ('t','T',"top", value) ||
2921 STRCASEEQ('m','M',"middle",value) ||
2922 STRCASEEQ('b','B',"bottom",value) ||
2923 STRCASEEQ('l','L',"left", value) ||
2924 STRCASEEQ('r','R',"right", value)) {
2927 else if (STRCASEEQ('c','C',"center",value)) {
2928 attr_align = apr_pstrdup(doc->pool, "middle");
2932 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2933 /*----------------------------------------------------------------------*/
2935 /*----------------------------------------------------------------------*/
2938 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2939 /*----------------------------------------------------------------------*/
2941 /*----------------------------------------------------------------------*/
2942 attr_height = value;
2944 else if (STRCASEEQ('h','H',"hspace",name)) {
2945 /*----------------------------------------------------------------------*/
2947 /*----------------------------------------------------------------------*/
2950 else if (STRCASEEQ('v','V',"vspace",name)) {
2951 /*----------------------------------------------------------------------*/
2953 /*----------------------------------------------------------------------*/
2956 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2957 /*----------------------------------------------------------------------*/
2959 /*----------------------------------------------------------------------*/
2962 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2963 /*----------------------------------------------------------------------*/
2965 /*----------------------------------------------------------------------*/
2970 if (IS_CSS_ON(jxhtml->entryp)) {
2971 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2973 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2974 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2975 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2976 css_property_t *cur;
2977 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2978 attr_height = apr_pstrdup(doc->pool, cur->value);
2980 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2981 attr_width = apr_pstrdup(doc->pool, cur->value);
2983 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2984 attr_align = apr_pstrdup(doc->pool, cur->value);
3024 * It is a handler who processes the IMG tag.
3026 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3027 * destination is specified.
3028 * @param node [i] The IMG tag node is specified.
3029 * @return The conversion result is returned.
3032 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3034 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3040 * It is a handler who processes the SELECT tag.
3042 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3043 * destination is specified.
3044 * @param node [i] The SELECT tag node is specified.
3045 * @return The conversion result is returned.
3048 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3050 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3051 Doc *doc = jxhtml->doc;
3055 char *multiple = NULL;
3056 char *attr_style = NULL;
3059 for (attr = qs_get_attr(doc,node);
3061 attr = qs_get_next_attr(doc,attr)) {
3062 char *nm = qs_get_attr_name(doc,attr);
3063 char *val = qs_get_attr_value(doc,attr);
3064 if (STRCASEEQ('s','S',"size",nm)) {
3065 /*----------------------------------------------------------------------*/
3066 /* CHTML 1.0 version 2.0 */
3067 /*----------------------------------------------------------------------*/
3068 size = apr_pstrdup(doc->buf.pool, val);
3070 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3071 /*----------------------------------------------------------------------*/
3072 /* CHTML 1.0 version 2.0 */
3073 /*----------------------------------------------------------------------*/
3074 attr_style = apr_pstrdup(doc->buf.pool, val);
3076 else if (STRCASEEQ('n','N',"name",nm)) {
3077 /*----------------------------------------------------------------------*/
3078 /* CHTML 1.0 version 2.0 */
3079 /*----------------------------------------------------------------------*/
3080 name = apr_pstrdup(doc->buf.pool, val);
3082 else if (STRCASEEQ('m','M',"multiple", nm)) {
3083 /*----------------------------------------------------------------------*/
3084 /* CHTML 1.0 version 2.0 */
3085 /*----------------------------------------------------------------------*/
3086 multiple = apr_pstrdup(doc->buf.pool, val);
3089 if (size && *size) {
3094 if (name && *name) {
3104 if (IS_CSS_ON(jxhtml->entryp)) {
3105 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3113 * It is a handler who processes the SELECT tag.
3115 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3116 * destination is specified.
3117 * @param node [i] The SELECT tag node is specified.
3118 * @return The conversion result is returned.
3121 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3123 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3124 Doc *doc = jxhtml->doc;
3127 if (IS_CSS_ON(jxhtml->entryp)) {
3128 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3135 * It is a handler who processes the OPTION tag.
3137 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3138 * destination is specified.
3139 * @param node [i] The OPTION tag node is specified.
3140 * @return The conversion result is returned.
3143 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3145 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3146 Doc *doc = jxhtml->doc;
3149 char *selected = NULL;
3151 char *attr_style = NULL;
3154 for (attr = qs_get_attr(doc,node);
3156 attr = qs_get_next_attr(doc,attr)) {
3157 char *nm = qs_get_attr_name(doc,attr);
3158 char *val = qs_get_attr_value(doc,attr);
3159 if (STRCASEEQ('s','S',"selected",nm)) {
3160 /*----------------------------------------------------------------------*/
3161 /* CHTML 1.0 version 2.0 */
3162 /*----------------------------------------------------------------------*/
3163 selected = apr_pstrdup(doc->buf.pool, val);
3165 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3166 /*----------------------------------------------------------------------*/
3167 /* CHTML 1.0 version 2.0 */
3168 /*----------------------------------------------------------------------*/
3169 attr_style = apr_pstrdup(doc->buf.pool, val);
3171 else if (STRCASEEQ('v','V',"value",nm)) {
3172 /*----------------------------------------------------------------------*/
3173 /* CHTML 1.0 version 2.0 */
3174 /*----------------------------------------------------------------------*/
3175 value = apr_pstrdup(doc->buf.pool, val);
3188 if (IS_CSS_ON(jxhtml->entryp)) {
3189 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3197 * It is a handler who processes the OPTION tag.
3199 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3200 * destination is specified.
3201 * @param node [i] The OPTION tag node is specified.
3202 * @return The conversion result is returned.
3205 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3207 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3208 Doc *doc = jxhtml->doc;
3211 if (IS_CSS_ON(jxhtml->entryp)) {
3212 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3220 * It is a handler who processes the DIV tag.
3222 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3223 * destination is specified.
3224 * @param node [i] The DIV tag node is specified.
3225 * @return The conversion result is returned.
3228 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3234 char *attr_style = NULL;
3235 char *attr_align = NULL;
3236 char *attr_display = NULL;
3237 char *attr_decoration = NULL;
3238 char *attr_wap_marquee_style = NULL;
3239 char *attr_wap_marquee_dir = NULL;
3240 char *attr_wap_marquee_loop = NULL;
3241 char *attr_color = NULL;
3242 char *attr_bgcolor = NULL;
3243 char *attr_font_size = NULL;
3245 jxhtml = GET_JXHTML(pdoc);
3249 for (attr = qs_get_attr(doc,node);
3251 attr = qs_get_next_attr(doc,attr)) {
3252 char *nm = qs_get_attr_name(doc,attr);
3253 char *val = qs_get_attr_value(doc,attr);
3254 if (STRCASEEQ('a','A',"align",nm)) {
3255 /*----------------------------------------------------------------------*/
3256 /* CHTML 1.0 (W3C version 3.2) */
3257 /*----------------------------------------------------------------------*/
3258 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3259 attr_align = apr_pstrdup(doc->buf.pool, val);
3262 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3263 attr_style = apr_pstrdup(doc->buf.pool, val);
3267 if (IS_CSS_ON(jxhtml->entryp)) {
3268 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3270 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3271 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3272 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3273 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3274 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3275 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3276 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3278 css_property_t *cur;
3279 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3280 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3281 attr_display = apr_pstrdup(doc->pool, cur->value);
3284 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3285 if (STRCASEEQ('b','B',"blink", cur->value)) {
3286 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3289 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3290 attr_color = apr_pstrdup(doc->pool, cur->value);
3292 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3293 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3294 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3296 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3297 char *ss = strchr(cur->value, '#');
3299 ss = strstr(cur->value, "rgb");
3302 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3303 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3306 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3307 attr_align = apr_pstrdup(doc->pool, cur->value);
3309 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3310 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3311 || STRCASEEQ('x','X',"x-small",cur->value)
3312 || STRCASEEQ('s','S',"small",cur->value)
3313 || STRCASEEQ('m','M',"medium",cur->value)
3314 || STRCASEEQ('l','L',"large",cur->value)
3315 || STRCASEEQ('x','X',"x-large",cur->value)
3316 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3317 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3321 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3322 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3323 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3324 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3325 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3326 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3329 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3330 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3331 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3333 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3334 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3337 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3338 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3347 || attr_wap_marquee_style
3348 || attr_wap_marquee_dir
3349 || attr_wap_marquee_loop
3352 || attr_font_size) {
3364 if (attr_decoration) {
3365 W_L("text-decoration:");
3366 W_V(attr_decoration);
3369 if (attr_wap_marquee_style) {
3370 W_L("-wap-marquee-style:");
3371 W_V(attr_wap_marquee_style);
3374 if (attr_wap_marquee_dir) {
3375 W_L("-wap-marquee-dir:");
3376 W_V(attr_wap_marquee_dir);
3379 if (attr_wap_marquee_loop) {
3380 W_L("-wap-marquee-loop:");
3381 W_V(attr_wap_marquee_loop);
3390 W_L("background-color:");
3394 if (attr_font_size) {
3396 W_V(attr_font_size);
3407 * It is a handler who processes the DIV tag.
3409 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3410 * destination is specified.
3411 * @param node [i] The DIV tag node is specified.
3412 * @return The conversion result is returned.
3415 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
3421 jxhtml = GET_JXHTML(pdoc);
3426 if (IS_CSS_ON(jxhtml->entryp)) {
3427 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3434 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
3441 jxhtml = GET_JXHTML(pdoc);
3445 for (child = qs_get_child_node(doc, node);
3447 child = qs_get_next_node(doc, child)) {
3449 s_jxhtml_chxjif_tag(jxhtml, child);
3456 * It is a handler who processes the TEXTARE tag.
3458 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3459 * destination is specified.
3460 * @param node [i] The TEXTAREA tag node is specified.
3461 * @return The conversion result is returned.
3464 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
3470 char *attr_accesskey = NULL;
3471 char *attr_name = NULL;
3472 char *attr_rows = NULL;
3473 char *attr_cols = NULL;
3474 char *attr_istyle = NULL;
3475 char *attr_style = NULL;
3478 jxhtml = GET_JXHTML(pdoc);
3482 jxhtml->textarea_flag++;
3483 for (attr = qs_get_attr(doc,node);
3485 attr = qs_get_next_attr(doc,attr)) {
3486 char *name = qs_get_attr_name(doc,attr);
3487 char *value = qs_get_attr_value(doc,attr);
3488 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3489 attr_accesskey = value;
3491 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3492 attr_istyle = value;
3494 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3497 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3500 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3503 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3507 if (IS_CSS_ON(jxhtml->entryp)) {
3508 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3510 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3511 css_property_t *cur;
3512 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3513 if (strcasestr(cur->value, "<ja:n>")) {
3516 else if (strcasestr(cur->value, "<ja:en>")) {
3519 else if (strcasestr(cur->value, "<ja:hk>")) {
3522 else if (strcasestr(cur->value, "<ja:h>")) {
3529 if (attr_accesskey) {
3530 W_L(" accesskey=\"");
3531 W_V(attr_accesskey);
3550 char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
3552 W_L("-wap-input-format:"*");
3563 * It is a handler who processes the TEXTAREA tag.
3565 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3566 * destination is specified.
3567 * @param node [i] The TEXTAREA tag node is specified.
3568 * @return The conversion result is returned.
3571 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3577 jxhtml = GET_JXHTML(pdoc);
3582 jxhtml->textarea_flag--;
3589 * It is a handler who processes the B tag.
3591 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3592 * destination is specified.
3593 * @param node [i] The B tag node is specified.
3594 * @return The conversion result is returned.
3597 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3603 jxhtml = GET_JXHTML(pdoc);
3613 * It is a handler who processes the B tag.
3615 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3616 * destination is specified.
3617 * @param node [i] The B tag node is specified.
3618 * @return The conversion result is returned.
3621 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3623 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
3624 Doc* doc = jxhtml->doc;
3631 s_jxhtml_text_tag(void* pdoc, Node* child)
3643 jxhtml = GET_JXHTML(pdoc);
3647 textval = qs_get_node_value(doc,child);
3648 if (strlen(textval) == 0) {
3652 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3653 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3655 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3656 memset(one_byte, 0, sizeof(one_byte));
3659 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3661 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
3663 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3668 if (is_sjis_kanji(textval[ii])) {
3669 one_byte[0] = textval[ii+0];
3670 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3671 one_byte[0] = textval[ii+1];
3672 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3676 if (jxhtml->pre_flag) {
3677 one_byte[0] = textval[ii+0];
3678 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3681 if (jxhtml->textarea_flag) {
3682 one_byte[0] = textval[ii+0];
3683 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3686 if (textval[ii] != '\r' && textval[ii] != '\n') {
3687 one_byte[0] = textval[ii+0];
3688 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3698 * It is a handler who processes the BLOCKQUOTE tag.
3700 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3701 * destination is specified.
3702 * @param node [i] The BLOCKQUOTE tag node is specified.
3703 * @return The conversion result is returned.
3706 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
3711 char *attr_style = NULL;
3712 char *attr_color = NULL;
3713 char *attr_size = NULL;
3715 jxhtml = GET_JXHTML(pdoc);
3717 for (attr = qs_get_attr(doc,node);
3719 attr = qs_get_next_attr(doc,attr)) {
3720 char *nm = qs_get_attr_name(doc,attr);
3721 char *val = qs_get_attr_value(doc,attr);
3722 if (val && STRCASEEQ('s','S',"style", nm)) {
3726 if (IS_CSS_ON(jxhtml->entryp)) {
3727 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3729 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3730 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3731 css_property_t *cur;
3732 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3733 if (cur->value && *cur->value) {
3734 attr_color = apr_pstrdup(doc->pool, cur->value);
3737 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3738 if (cur->value && *cur->value) {
3739 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3740 attr_size = apr_pstrdup(doc->pool, cur->value);
3742 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3743 attr_size = apr_pstrdup(doc->pool, cur->value);
3745 else if (STRCASEEQ('s','S',"small",cur->value)) {
3746 attr_size = apr_pstrdup(doc->pool, cur->value);
3748 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3749 attr_size = apr_pstrdup(doc->pool, cur->value);
3751 else if (STRCASEEQ('l','L',"large",cur->value)) {
3752 attr_size = apr_pstrdup(doc->pool, cur->value);
3754 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3755 attr_size = apr_pstrdup(doc->pool, cur->value);
3757 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3758 attr_size = apr_pstrdup(doc->pool, cur->value);
3765 if (attr_color || attr_size) {
3768 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3786 * It is a handler who processes the BLOCKQUOTE tag.
3788 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3789 * destination is specified.
3790 * @param node [i] The BLOCKQUOTE tag node is specified.
3791 * @return The conversion result is returned.
3794 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3796 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3797 Doc *doc = jxhtml->doc;
3798 W_L("</blockquote>");
3799 if (IS_CSS_ON(jxhtml->entryp)) {
3800 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3807 * It is a handler who processes the DIR tag.
3809 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3810 * destination is specified.
3811 * @param node [i] The DIR tag node is specified.
3812 * @return The conversion result is returned.
3815 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
3817 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3818 Doc *doc = jxhtml->doc;
3820 char *attr_style = NULL;
3821 char *attr_color = NULL;
3822 char *attr_type = NULL;
3823 char *attr_size = NULL;
3824 for (attr = qs_get_attr(doc,node);
3826 attr = qs_get_next_attr(doc,attr)) {
3827 char *name = qs_get_attr_name(doc,attr);
3828 char *value = qs_get_attr_value(doc,attr);
3829 if (STRCASEEQ('t','T',"type",name)) {
3830 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3834 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3838 if (IS_CSS_ON(jxhtml->entryp)) {
3839 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3841 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3842 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3843 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3844 css_property_t *cur;
3845 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3846 if (cur->value && *cur->value) {
3847 attr_color = apr_pstrdup(doc->pool, cur->value);
3850 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3851 if (cur->value && *cur->value) {
3852 attr_type = apr_pstrdup(doc->pool, cur->value);
3855 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3856 if (cur->value && *cur->value) {
3857 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3858 attr_size = apr_pstrdup(doc->pool, cur->value);
3860 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3861 attr_size = apr_pstrdup(doc->pool, cur->value);
3863 else if (STRCASEEQ('s','S',"small",cur->value)) {
3864 attr_size = apr_pstrdup(doc->pool, cur->value);
3866 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3867 attr_size = apr_pstrdup(doc->pool, cur->value);
3869 else if (STRCASEEQ('l','L',"large",cur->value)) {
3870 attr_size = apr_pstrdup(doc->pool, cur->value);
3872 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3873 attr_size = apr_pstrdup(doc->pool, cur->value);
3875 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3876 attr_size = apr_pstrdup(doc->pool, cur->value);
3883 if (attr_type || attr_color || attr_size) {
3886 W_L("list-style-type:");
3891 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3909 * It is a handler who processes the DIR tag.
3911 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3912 * destination is specified.
3913 * @param node [i] The DIR tag node is specified.
3914 * @return The conversion result is returned.
3917 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
3919 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3920 Doc *doc = jxhtml->doc;
3922 if (IS_CSS_ON(jxhtml->entryp)) {
3923 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3930 * It is a handler who processes the DL tag.
3932 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3933 * destination is specified.
3934 * @param node [i] The DL tag node is specified.
3935 * @return The conversion result is returned.
3938 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
3940 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3941 Doc *doc = jxhtml->doc;
3943 char *attr_style = NULL;
3944 char *attr_color = NULL;
3945 char *attr_size = NULL;
3946 for (attr = qs_get_attr(doc,node);
3948 attr = qs_get_next_attr(doc,attr)) {
3949 char *name = qs_get_attr_name(doc,attr);
3950 char *value = qs_get_attr_value(doc,attr);
3951 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3955 if (IS_CSS_ON(jxhtml->entryp)) {
3956 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3958 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3959 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3960 css_property_t *cur;
3961 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3962 if (cur->value && *cur->value) {
3963 attr_color = apr_pstrdup(doc->pool, cur->value);
3966 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3967 if (cur->value && *cur->value) {
3968 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3969 attr_size = apr_pstrdup(doc->pool, cur->value);
3971 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3972 attr_size = apr_pstrdup(doc->pool, cur->value);
3974 else if (STRCASEEQ('s','S',"small",cur->value)) {
3975 attr_size = apr_pstrdup(doc->pool, cur->value);
3977 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3978 attr_size = apr_pstrdup(doc->pool, cur->value);
3980 else if (STRCASEEQ('l','L',"large",cur->value)) {
3981 attr_size = apr_pstrdup(doc->pool, cur->value);
3983 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3984 attr_size = apr_pstrdup(doc->pool, cur->value);
3986 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3987 attr_size = apr_pstrdup(doc->pool, cur->value);
3994 if (attr_color || attr_size) {
3997 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4015 * It is a handler who processes the DL tag.
4017 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4018 * destination is specified.
4019 * @param node [i] The DL tag node is specified.
4020 * @return The conversion result is returned.
4023 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4025 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4026 Doc *doc = jxhtml->doc;
4028 if (IS_CSS_ON(jxhtml->entryp)) {
4029 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4036 * It is a handler who processes the DT tag.
4038 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4039 * destination is specified.
4040 * @param node [i] The DT tag node is specified.
4041 * @return The conversion result is returned.
4044 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4046 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4047 Doc *doc = jxhtml->doc;
4049 char *attr_style = NULL;
4050 char *attr_color = NULL;
4051 char *attr_size = NULL;
4052 for (attr = qs_get_attr(doc,node);
4054 attr = qs_get_next_attr(doc,attr)) {
4055 char *name = qs_get_attr_name(doc,attr);
4056 char *value = qs_get_attr_value(doc,attr);
4057 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4061 if (IS_CSS_ON(jxhtml->entryp)) {
4062 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4064 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4065 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4066 css_property_t *cur;
4067 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4068 if (cur->value && *cur->value) {
4069 attr_color = apr_pstrdup(doc->pool, cur->value);
4072 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4073 if (cur->value && *cur->value) {
4074 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4075 attr_size = apr_pstrdup(doc->pool, cur->value);
4077 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4078 attr_size = apr_pstrdup(doc->pool, cur->value);
4080 else if (STRCASEEQ('s','S',"small",cur->value)) {
4081 attr_size = apr_pstrdup(doc->pool, cur->value);
4083 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4084 attr_size = apr_pstrdup(doc->pool, cur->value);
4086 else if (STRCASEEQ('l','L',"large",cur->value)) {
4087 attr_size = apr_pstrdup(doc->pool, cur->value);
4089 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4090 attr_size = apr_pstrdup(doc->pool, cur->value);
4092 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4093 attr_size = apr_pstrdup(doc->pool, cur->value);
4100 if (attr_color || attr_size) {
4103 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4121 * It is a handler who processes the DT tag.
4123 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4124 * destination is specified.
4125 * @param node [i] The DT tag node is specified.
4126 * @return The conversion result is returned.
4129 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4131 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4132 Doc *doc = jxhtml->doc;
4134 if (IS_CSS_ON(jxhtml->entryp)) {
4135 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4142 * It is a handler who processes the DD tag.
4144 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4145 * destination is specified.
4146 * @param node [i] The DD tag node is specified.
4147 * @return The conversion result is returned.
4150 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4152 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4153 Doc *doc = jxhtml->doc;
4155 char *attr_style = NULL;
4156 char *attr_color = NULL;
4157 char *attr_size = NULL;
4158 for (attr = qs_get_attr(doc,node);
4160 attr = qs_get_next_attr(doc,attr)) {
4161 char *name = qs_get_attr_name(doc,attr);
4162 char *value = qs_get_attr_value(doc,attr);
4163 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4167 if (IS_CSS_ON(jxhtml->entryp)) {
4168 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4170 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4171 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4172 css_property_t *cur;
4173 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4174 if (cur->value && *cur->value) {
4175 attr_color = apr_pstrdup(doc->pool, cur->value);
4178 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4179 if (cur->value && *cur->value) {
4180 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4181 attr_size = apr_pstrdup(doc->pool, cur->value);
4183 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4184 attr_size = apr_pstrdup(doc->pool, cur->value);
4186 else if (STRCASEEQ('s','S',"small",cur->value)) {
4187 attr_size = apr_pstrdup(doc->pool, cur->value);
4189 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4190 attr_size = apr_pstrdup(doc->pool, cur->value);
4192 else if (STRCASEEQ('l','L',"large",cur->value)) {
4193 attr_size = apr_pstrdup(doc->pool, cur->value);
4195 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4196 attr_size = apr_pstrdup(doc->pool, cur->value);
4198 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4199 attr_size = apr_pstrdup(doc->pool, cur->value);
4206 if (attr_color || attr_size) {
4209 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4227 * It is a handler who processes the DD tag.
4229 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4230 * destination is specified.
4231 * @param node [i] The DD tag node is specified.
4232 * @return The conversion result is returned.
4235 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4237 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4238 Doc *doc = jxhtml->doc;
4240 if (IS_CSS_ON(jxhtml->entryp)) {
4241 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4248 * It is a handler who processes the H1 tag.
4250 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4251 * destination is specified.
4252 * @param node [i] The H1 tag node is specified.
4253 * @return The conversion result is returned.
4256 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4262 char *attr_style = NULL;
4263 char *attr_align = NULL;
4265 jxhtml = GET_JXHTML(pdoc);
4269 for (attr = qs_get_attr(doc,node);
4271 attr = qs_get_next_attr(doc,attr)) {
4272 char *name = qs_get_attr_name(doc,attr);
4273 char *value = qs_get_attr_value(doc,attr);
4274 if (STRCASEEQ('a','A',"align", name)) {
4275 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4279 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4283 if (IS_CSS_ON(jxhtml->entryp)) {
4284 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4286 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4287 css_property_t *cur;
4288 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4289 if (STRCASEEQ('l','L',"left", cur->value)) {
4290 attr_align = apr_pstrdup(doc->pool, "left");
4292 else if (STRCASEEQ('c','C',"center",cur->value)) {
4293 attr_align = apr_pstrdup(doc->pool, "center");
4295 else if (STRCASEEQ('r','R',"right",cur->value)) {
4296 attr_align = apr_pstrdup(doc->pool, "right");
4303 W_L("font-size:xx-large;");
4316 * It is a handler who processes the H1 tag.
4318 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4319 * destination is specified.
4320 * @param node [i] The H1 tag node is specified.
4321 * @return The conversion result is returned.
4324 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4330 jxhtml = GET_JXHTML(pdoc);
4335 if (IS_CSS_ON(jxhtml->entryp)) {
4336 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4344 * It is a handler who processes the H2 tag.
4346 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4347 * destination is specified.
4348 * @param node [i] The H1 tag node is specified.
4349 * @return The conversion result is returned.
4352 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
4358 char *attr_style = NULL;
4359 char *attr_align = NULL;
4361 jxhtml = GET_JXHTML(pdoc);
4365 for (attr = qs_get_attr(doc,node);
4367 attr = qs_get_next_attr(doc,attr)) {
4368 char *name = qs_get_attr_name(doc,attr);
4369 char *value = qs_get_attr_value(doc,attr);
4370 if (STRCASEEQ('a','A',"align", name)) {
4371 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4375 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4379 if (IS_CSS_ON(jxhtml->entryp)) {
4380 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4382 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4383 css_property_t *cur;
4384 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4385 if (STRCASEEQ('l','L',"left", cur->value)) {
4386 attr_align = apr_pstrdup(doc->pool, "left");
4388 else if (STRCASEEQ('c','C',"center",cur->value)) {
4389 attr_align = apr_pstrdup(doc->pool, "center");
4391 else if (STRCASEEQ('r','R',"right",cur->value)) {
4392 attr_align = apr_pstrdup(doc->pool, "right");
4399 W_L("font-size:x-large;");
4412 * It is a handler who processes the H2 tag.
4414 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4415 * destination is specified.
4416 * @param node [i] The H1 tag node is specified.
4417 * @return The conversion result is returned.
4420 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
4426 jxhtml = GET_JXHTML(pdoc);
4431 if (IS_CSS_ON(jxhtml->entryp)) {
4432 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4439 * It is a handler who processes the H3 tag.
4441 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4442 * destination is specified.
4443 * @param node [i] The H1 tag node is specified.
4444 * @return The conversion result is returned.
4447 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
4453 char *attr_style = NULL;
4454 char *attr_align = NULL;
4456 jxhtml = GET_JXHTML(pdoc);
4460 for (attr = qs_get_attr(doc,node);
4462 attr = qs_get_next_attr(doc,attr)) {
4463 char *name = qs_get_attr_name(doc,attr);
4464 char *value = qs_get_attr_value(doc,attr);
4465 if (STRCASEEQ('a','A',"align", name)) {
4466 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4470 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4474 if (IS_CSS_ON(jxhtml->entryp)) {
4475 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4477 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4478 css_property_t *cur;
4479 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4480 if (STRCASEEQ('l','L',"left", cur->value)) {
4481 attr_align = apr_pstrdup(doc->pool, "left");
4483 else if (STRCASEEQ('c','C',"center",cur->value)) {
4484 attr_align = apr_pstrdup(doc->pool, "center");
4486 else if (STRCASEEQ('r','R',"right",cur->value)) {
4487 attr_align = apr_pstrdup(doc->pool, "right");
4494 W_L("font-size:large;");
4507 * It is a handler who processes the H3 tag.
4509 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4510 * destination is specified.
4511 * @param node [i] The H1 tag node is specified.
4512 * @return The conversion result is returned.
4515 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
4521 jxhtml = GET_JXHTML(pdoc);
4526 if (IS_CSS_ON(jxhtml->entryp)) {
4527 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4534 * It is a handler who processes the H4 tag.
4536 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4537 * destination is specified.
4538 * @param node [i] The H1 tag node is specified.
4539 * @return The conversion result is returned.
4542 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
4548 char *attr_style = NULL;
4549 char *attr_align = NULL;
4551 jxhtml = GET_JXHTML(pdoc);
4555 for (attr = qs_get_attr(doc,node);
4557 attr = qs_get_next_attr(doc,attr)) {
4558 char *name = qs_get_attr_name(doc,attr);
4559 char *value = qs_get_attr_value(doc,attr);
4560 if (STRCASEEQ('a','A',"align", name)) {
4561 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4565 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4569 if (IS_CSS_ON(jxhtml->entryp)) {
4570 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4572 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4573 css_property_t *cur;
4574 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4575 if (STRCASEEQ('l','L',"left", cur->value)) {
4576 attr_align = apr_pstrdup(doc->pool, "left");
4578 else if (STRCASEEQ('c','C',"center",cur->value)) {
4579 attr_align = apr_pstrdup(doc->pool, "center");
4581 else if (STRCASEEQ('r','R',"right",cur->value)) {
4582 attr_align = apr_pstrdup(doc->pool, "right");
4589 W_L("font-size:small;");
4602 * It is a handler who processes the H4 tag.
4604 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4605 * destination is specified.
4606 * @param node [i] The H1 tag node is specified.
4607 * @return The conversion result is returned.
4610 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
4616 jxhtml = GET_JXHTML(pdoc);
4621 if (IS_CSS_ON(jxhtml->entryp)) {
4622 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4630 * It is a handler who processes the H5 tag.
4632 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4633 * destination is specified.
4634 * @param node [i] The H1 tag node is specified.
4635 * @return The conversion result is returned.
4638 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
4644 char *attr_style = NULL;
4645 char *attr_align = NULL;
4647 jxhtml = GET_JXHTML(pdoc);
4651 for (attr = qs_get_attr(doc,node);
4653 attr = qs_get_next_attr(doc,attr)) {
4654 char *name = qs_get_attr_name(doc,attr);
4655 char *value = qs_get_attr_value(doc,attr);
4656 if (STRCASEEQ('a','A',"align", name)) {
4657 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4661 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4665 if (IS_CSS_ON(jxhtml->entryp)) {
4666 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4668 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4669 css_property_t *cur;
4670 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4671 if (STRCASEEQ('l','L',"left", cur->value)) {
4672 attr_align = apr_pstrdup(doc->pool, "left");
4674 else if (STRCASEEQ('c','C',"center",cur->value)) {
4675 attr_align = apr_pstrdup(doc->pool, "center");
4677 else if (STRCASEEQ('r','R',"right",cur->value)) {
4678 attr_align = apr_pstrdup(doc->pool, "right");
4685 W_L("font-size:x-small;");
4698 * It is a handler who processes the H5 tag.
4700 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4701 * destination is specified.
4702 * @param node [i] The H1 tag node is specified.
4703 * @return The conversion result is returned.
4706 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
4712 jxhtml = GET_JXHTML(pdoc);
4717 if (IS_CSS_ON(jxhtml->entryp)) {
4718 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4726 * It is a handler who processes the H6 tag.
4728 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4729 * destination is specified.
4730 * @param node [i] The H1 tag node is specified.
4731 * @return The conversion result is returned.
4734 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
4740 char *attr_style = NULL;
4741 char *attr_align = NULL;
4743 jxhtml = GET_JXHTML(pdoc);
4747 for (attr = qs_get_attr(doc,node);
4749 attr = qs_get_next_attr(doc,attr)) {
4750 char *name = qs_get_attr_name(doc,attr);
4751 char *value = qs_get_attr_value(doc,attr);
4752 if (STRCASEEQ('a','A',"align", name)) {
4753 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4757 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4761 if (IS_CSS_ON(jxhtml->entryp)) {
4762 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4764 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4765 css_property_t *cur;
4766 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4767 if (STRCASEEQ('l','L',"left", cur->value)) {
4768 attr_align = apr_pstrdup(doc->pool, "left");
4770 else if (STRCASEEQ('c','C',"center",cur->value)) {
4771 attr_align = apr_pstrdup(doc->pool, "center");
4773 else if (STRCASEEQ('r','R',"right",cur->value)) {
4774 attr_align = apr_pstrdup(doc->pool, "right");
4781 W_L("font-size:xx-small;");
4794 * It is a handler who processes the H6 tag.
4796 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4797 * destination is specified.
4798 * @param node [i] The H1 tag node is specified.
4799 * @return The conversion result is returned.
4802 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
4808 jxhtml = GET_JXHTML(pdoc);
4813 if (IS_CSS_ON(jxhtml->entryp)) {
4814 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4822 * It is a handler who processes the MENU tag.
4824 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4825 * destination is specified.
4826 * @param node [i] The MENU tag node is specified.
4827 * @return The conversion result is returned.
4830 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
4832 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4833 Doc *doc = jxhtml->doc;
4835 char *attr_style = NULL;
4836 char *attr_color = NULL;
4837 char *attr_type = NULL;
4838 char *attr_size = NULL;
4839 for (attr = qs_get_attr(doc,node);
4841 attr = qs_get_next_attr(doc,attr)) {
4842 char *name = qs_get_attr_name(doc,attr);
4843 char *value = qs_get_attr_value(doc,attr);
4844 if (STRCASEEQ('t','T',"type",name)) {
4845 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4849 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4853 if (IS_CSS_ON(jxhtml->entryp)) {
4854 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4856 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4857 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4858 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4859 css_property_t *cur;
4860 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4861 if (cur->value && *cur->value) {
4862 attr_color = apr_pstrdup(doc->pool, cur->value);
4865 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4866 if (cur->value && *cur->value) {
4867 attr_type = apr_pstrdup(doc->pool, cur->value);
4870 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4871 if (cur->value && *cur->value) {
4872 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4873 attr_size = apr_pstrdup(doc->pool, cur->value);
4875 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4876 attr_size = apr_pstrdup(doc->pool, cur->value);
4878 else if (STRCASEEQ('s','S',"small",cur->value)) {
4879 attr_size = apr_pstrdup(doc->pool, cur->value);
4881 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4882 attr_size = apr_pstrdup(doc->pool, cur->value);
4884 else if (STRCASEEQ('l','L',"large",cur->value)) {
4885 attr_size = apr_pstrdup(doc->pool, cur->value);
4887 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4888 attr_size = apr_pstrdup(doc->pool, cur->value);
4890 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4891 attr_size = apr_pstrdup(doc->pool, cur->value);
4898 if (attr_type || attr_color || attr_size) {
4901 W_L("list-style-type:");
4906 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4924 * It is a handler who processes the MENU tag.
4926 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4927 * destination is specified.
4928 * @param node [i] The MENU tag node is specified.
4929 * @return The conversion result is returned.
4932 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
4934 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4935 Doc *doc = jxhtml->doc;
4937 if (IS_CSS_ON(jxhtml->entryp)) {
4938 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4945 * It is a handler who processes the PLAINTEXT tag.
4947 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4948 * destination is specified.
4949 * @param node [i] The PLAINTEXT tag node is specified.
4950 * @return The conversion result is returned.
4953 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
4958 jxhtml = GET_JXHTML(pdoc);
4961 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
4966 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
4971 jxhtml = GET_JXHTML(pdoc);
4973 for (child = qs_get_child_node(doc, node);
4975 child = qs_get_next_node(doc, child)) {
4977 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
4984 * It is a handler who processes the PLAINTEXT tag.
4986 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4987 * destination is specified.
4988 * @param node [i] The PLAINTEXT tag node is specified.
4989 * @return The conversion result is returned.
4992 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4994 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5000 * It is a handler who processes the BLINK tag.
5002 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5003 * destination is specified.
5004 * @param node [i] The BLINK tag node is specified.
5005 * @return The conversion result is returned.
5008 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5010 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5011 Doc *doc = jxhtml->doc;
5013 char *attr_style = NULL;
5014 char *attr_color = NULL;
5015 char *attr_size = NULL;
5016 for (attr = qs_get_attr(doc,node);
5018 attr = qs_get_next_attr(doc,attr)) {
5019 char *name = qs_get_attr_name(doc,attr);
5020 char *value = qs_get_attr_value(doc,attr);
5021 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5025 if (IS_CSS_ON(jxhtml->entryp)) {
5026 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5028 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5029 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5030 css_property_t *cur;
5031 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5032 if (cur->value && *cur->value) {
5033 attr_color = apr_pstrdup(doc->pool, cur->value);
5036 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5037 if (cur->value && *cur->value) {
5038 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5039 attr_size = apr_pstrdup(doc->pool, cur->value);
5041 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5042 attr_size = apr_pstrdup(doc->pool, cur->value);
5044 else if (STRCASEEQ('s','S',"small",cur->value)) {
5045 attr_size = apr_pstrdup(doc->pool, cur->value);
5047 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5048 attr_size = apr_pstrdup(doc->pool, cur->value);
5050 else if (STRCASEEQ('l','L',"large",cur->value)) {
5051 attr_size = apr_pstrdup(doc->pool, cur->value);
5053 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5054 attr_size = apr_pstrdup(doc->pool, cur->value);
5056 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5057 attr_size = apr_pstrdup(doc->pool, cur->value);
5064 if (attr_color || attr_size) {
5067 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5085 * It is a handler who processes the BLINK tag.
5087 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5088 * destination is specified.
5089 * @param node [i] The BLINK tag node is specified.
5090 * @return The conversion result is returned.
5093 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5095 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5096 Doc *doc = jxhtml->doc;
5098 if (IS_CSS_ON(jxhtml->entryp)) {
5099 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5106 * It is a handler who processes the MARQUEE tag.
5108 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5109 * destination is specified.
5110 * @param node [i] The MARQUEE tag node is specified.
5111 * @return The conversion result is returned.
5114 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5116 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5117 Doc *doc = jxhtml->doc;
5119 char *attr_direction = NULL;
5120 char *attr_style = NULL;
5121 char *attr_color = NULL;
5122 char *attr_size = NULL;
5123 char *attr_bgcolor = NULL;
5124 /*--------------------------------------------------------------------------*/
5125 /* Get Attributes */
5126 /*--------------------------------------------------------------------------*/
5127 for (attr = qs_get_attr(doc,node);
5129 attr = qs_get_next_attr(doc,attr)) {
5130 char *name = qs_get_attr_name(doc,attr);
5131 char *value = qs_get_attr_value(doc,attr);
5132 if (STRCASEEQ('d','D',"direction", name)) {
5134 if (STRCASEEQ('l','L',"left",value)) {
5135 attr_direction = "rtl";
5137 else if (STRCASEEQ('r','R',"right",value)) {
5138 attr_direction = "ltr";
5142 else if (STRCASEEQ('b','B',"behavior",name)) {
5145 else if (STRCASEEQ('l','L',"loop",name)) {
5148 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5149 if (value && *value) {
5150 attr_bgcolor = value;
5153 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5157 if (IS_CSS_ON(jxhtml->entryp)) {
5158 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5160 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5161 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5162 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5163 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5164 css_property_t *cur;
5165 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5166 if (cur->value && *cur->value) {
5167 attr_color = apr_pstrdup(doc->pool, cur->value);
5170 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5171 if (cur->value && *cur->value) {
5172 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5175 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5176 if (cur->value && *cur->value) {
5177 attr_direction = apr_pstrdup(doc->pool, cur->value);
5180 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5181 if (cur->value && *cur->value) {
5182 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5183 || STRCASEEQ('x','X',"x-small", cur->value)
5184 || STRCASEEQ('s','S',"small", cur->value)
5185 || STRCASEEQ('m','M',"medium", cur->value)
5186 || STRCASEEQ('l','L',"large", cur->value)
5187 || STRCASEEQ('x','X',"x-large", cur->value)
5188 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5189 attr_size = apr_pstrdup(doc->pool, cur->value);
5196 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5198 if (attr_direction) {
5199 W_L("-wap-marquee-dir:");
5200 W_V(attr_direction);
5204 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5205 W_L("background-color:");
5210 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5229 * It is a handler who processes the MARQUEE tag.
5231 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5232 * destination is specified.
5233 * @param node [i] The MARQUEE tag node is specified.
5234 * @return The conversion result is returned.
5237 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5239 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5240 Doc *doc = jxhtml->doc;
5242 if (IS_CSS_ON(jxhtml->entryp)) {
5243 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5250 * It is handler who processes the New Line Code.
5253 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5255 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5256 if (jxhtml->start_html_flag) {
5257 Doc *doc = jxhtml->doc;
5265 * It is a handler who processes the LINK tag.
5267 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5268 * destination is specified.
5269 * @param node [i] The LINK tag node is specified.
5270 * @return The conversion result is returned.
5273 s_jxhtml_link_tag(void *pdoc, Node *node)
5282 jxhtml = GET_JXHTML(pdoc);
5285 if (! IS_CSS_ON(jxhtml->entryp)) {
5289 for (attr = qs_get_attr(doc,node);
5291 attr = qs_get_next_attr(doc,attr)) {
5292 char *name = qs_get_attr_name(doc,attr);
5293 char *value = qs_get_attr_value(doc,attr);
5294 if (STRCASEEQ('r','R',"rel", name)) {
5295 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5299 else if (STRCASEEQ('h','H',"href", name)) {
5300 if (value && *value) {
5304 else if (STRCASEEQ('t','T',"type", name)) {
5305 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5311 if (rel && href && type) {
5312 DBG(doc->r, "start load CSS. url:[%s]", href);
5313 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
5314 DBG(doc->r, "end load CSS. url:[%s]", href);
5321 static css_prop_list_t *
5322 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5324 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5325 Doc *doc = jxhtml->doc;
5326 css_prop_list_t *last_css = NULL;
5327 if (IS_CSS_ON(jxhtml->entryp)) {
5328 css_prop_list_t *dup_css;
5329 css_selector_t *selector;
5331 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5332 dup_css = chxj_dup_css_prop_list(doc, last_css);
5333 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5335 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5337 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
5338 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5340 if (style_attr_value) {
5341 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));
5343 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5351 static css_prop_list_t *
5352 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5354 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5355 Doc *doc = jxhtml->doc;
5356 css_prop_list_t *last_css = NULL;
5357 if (IS_CSS_ON(jxhtml->entryp)) {
5358 css_prop_list_t *dup_css;
5359 css_selector_t *selector;
5361 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
5362 dup_css = chxj_dup_css_prop_list(doc, last_css);
5363 selector = chxj_css_find_selector(doc, jxhtml->style, node);
5365 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5369 if (style_attr_value) {
5370 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));
5372 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5381 * It is a handler who processes the SPAN tag.
5383 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5384 * destination is specified.
5385 * @param node [i] The SPAN tag node is specified.
5386 * @return The conversion result is returned.
5389 s_jxhtml_start_span_tag(void *pdoc, Node *node)
5394 char *attr_style = NULL;
5395 char *attr_color = NULL;
5396 char *attr_size = NULL;
5397 char *attr_align = NULL;
5398 char *attr_blink = NULL;
5399 char *attr_marquee = NULL;
5400 char *attr_marquee_dir = NULL;
5401 char *attr_marquee_style = NULL;
5402 char *attr_marquee_loop = NULL;
5404 jxhtml = GET_JXHTML(pdoc);
5407 for (attr = qs_get_attr(doc,node);
5409 attr = qs_get_next_attr(doc,attr)) {
5410 char *nm = qs_get_attr_name(doc,attr);
5411 char *val = qs_get_attr_value(doc,attr);
5412 if (val && STRCASEEQ('s','S',"style", nm)) {
5416 if (IS_CSS_ON(jxhtml->entryp)) {
5417 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5419 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5420 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5421 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5422 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5423 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5424 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5425 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5426 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5427 css_property_t *cur;
5428 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5429 attr_color = apr_pstrdup(doc->pool, cur->value);
5431 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5432 if (cur->value && *cur->value) {
5433 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5434 || STRCASEEQ('x','X',"x-small", cur->value)
5435 || STRCASEEQ('s','S',"small", cur->value)
5436 || STRCASEEQ('m','M',"medium", cur->value)
5437 || STRCASEEQ('l','L',"large", cur->value)
5438 || STRCASEEQ('x','X',"x-large", cur->value)
5439 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5440 attr_size = apr_pstrdup(doc->pool, cur->value);
5444 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5445 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5446 attr_blink = apr_pstrdup(doc->pool, cur->value);
5449 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5450 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5451 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5454 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5455 if (cur->value && *cur->value) {
5456 if ( STRCASEEQ('l','L',"ltr",cur->value)
5457 || STRCASEEQ('r','R',"rtl",cur->value)) {
5458 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5462 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5463 if (cur->value && *cur->value) {
5464 if ( STRCASEEQ('s','S',"scroll",cur->value)
5465 || STRCASEEQ('s','S',"slide",cur->value)
5466 || STRCASEEQ('a','A',"alternate",cur->value)) {
5467 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5471 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5472 if (cur->value && *cur->value) {
5473 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5476 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5477 if (STRCASEEQ('l','L',"left", cur->value)) {
5478 attr_align = apr_pstrdup(doc->pool, "left");
5480 else if (STRCASEEQ('c','C',"center",cur->value)) {
5481 attr_align = apr_pstrdup(doc->pool, "center");
5483 else if (STRCASEEQ('r','R',"right",cur->value)) {
5484 attr_align = apr_pstrdup(doc->pool, "right");
5491 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5494 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5510 W_L("text-decoration:");
5515 W_L("display:-wap-marquee;");
5516 if (attr_marquee_dir) {
5517 W_L("-wap-marquee-dir:");
5518 W_V(attr_marquee_dir);
5521 if (attr_marquee_style) {
5522 W_L("-wap-marquee-style:");
5523 W_V(attr_marquee_style);
5526 if (attr_marquee_loop) {
5527 W_L("-wap-marquee-loop:");
5528 W_V(attr_marquee_loop);
5540 * It is a handler who processes the SPAN tag.
5542 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5543 * destination is specified.
5544 * @param node [i] The SPAN tag node is specified.
5545 * @return The conversion result is returned.
5548 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
5550 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5551 Doc *doc = jxhtml->doc;
5554 if (IS_CSS_ON(jxhtml->entryp)) {
5555 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5562 * It is a handler who processes the STYLE tag.
5564 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
5565 * destination is specified.
5566 * @param node [i] The STYLE tag node is specified.
5567 * @return The conversion result is returned.
5570 s_jxhtml_style_tag(void *pdoc, Node *node)
5577 jxhtml = GET_JXHTML(pdoc);
5580 if (! IS_CSS_ON(jxhtml->entryp)) {
5584 for (attr = qs_get_attr(doc,node);
5586 attr = qs_get_next_attr(doc,attr)) {
5587 char *name = qs_get_attr_name(doc,attr);
5588 char *value = qs_get_attr_value(doc,attr);
5589 if (STRCASEEQ('t','T',"type", name)) {
5590 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5596 Node *child = qs_get_child_node(doc, node);
5597 if (type && child) {
5598 char *name = qs_get_node_name(doc, child);
5599 if (STRCASEEQ('t','T',"text", name)) {
5600 char *value = qs_get_node_value(doc, child);
5601 DBG(doc->r, "start load CSS. buf:[%s]", value);
5602 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
5603 DBG(doc->r, "end load CSS. value:[%s]", value);