2 * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_jxhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_conv_z2h.h"
30 #define GET_JXHTML(X) ((jxhtml_t *)(X))
33 #define W_L(X) do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
34 #define W_V(X) do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X)) \
35 : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
39 static char *s_jxhtml_start_html_tag (void *pdoc, Node *node);
40 static char *s_jxhtml_end_html_tag (void *pdoc, Node *node);
41 static char *s_jxhtml_start_meta_tag (void *pdoc, Node *node);
42 static char *s_jxhtml_end_meta_tag (void *pdoc, Node *node);
43 static char *s_jxhtml_start_head_tag (void *pdoc, Node *node);
44 static char *s_jxhtml_end_head_tag (void *pdoc, Node *node);
45 static char *s_jxhtml_start_title_tag (void *pdoc, Node *node);
46 static char *s_jxhtml_end_title_tag (void *pdoc, Node *node);
47 static char *s_jxhtml_start_base_tag (void *pdoc, Node *node);
48 static char *s_jxhtml_end_base_tag (void *pdoc, Node *node);
49 static char *s_jxhtml_start_body_tag (void *pdoc, Node *node);
50 static char *s_jxhtml_end_body_tag (void *pdoc, Node *node);
51 static char *s_jxhtml_start_a_tag (void *pdoc, Node *node);
52 static char *s_jxhtml_end_a_tag (void *pdoc, Node *node);
53 static char *s_jxhtml_start_pre_tag (void *pdoc, Node *node);
54 static char *s_jxhtml_end_pre_tag (void *pdoc, Node *node);
55 static char *s_jxhtml_start_p_tag (void *pdoc, Node *node);
56 static char *s_jxhtml_end_p_tag (void *pdoc, Node *node);
57 static char *s_jxhtml_start_ul_tag (void *pdoc, Node *node);
58 static char *s_jxhtml_end_ul_tag (void *pdoc, Node *node);
59 static char *s_jxhtml_start_ol_tag (void *pdoc, Node *node);
60 static char *s_jxhtml_end_ol_tag (void *pdoc, Node *node);
61 static char *s_jxhtml_start_li_tag (void *pdoc, Node *node);
62 static char *s_jxhtml_end_li_tag (void *pdoc, Node *node);
63 static char *s_jxhtml_start_br_tag (void *pdoc, Node *node);
64 static char *s_jxhtml_end_br_tag (void *pdoc, Node *node);
66 static char *s_jxhtml_start_table_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_end_table_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_start_tr_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_start_td_or_th_tag (void *pdoc, Node *node,char *tagName);
71 static char *s_jxhtml_end_td_or_th_tag (void *pdoc, Node *node,char *tagName);
72 static char *s_jxhtml_start_td_tag (void *pdoc, Node *node);
73 static char *s_jxhtml_end_td_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_start_th_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_end_th_tag (void *pdoc, Node *node);
77 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
116 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
117 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
121 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
122 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
123 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
126 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
127 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
128 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
129 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
130 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
131 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
132 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
133 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
134 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
135 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
136 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
137 static char *s_jxhtml_start_object_tag (void *pdoc, Node *node);
138 static char *s_jxhtml_end_object_tag (void *pdoc, Node *node);
139 static char *s_jxhtml_start_param_tag (void *pdoc, Node *node);
140 static char *s_jxhtml_start_caption_tag (void *pdoc, Node *node);
141 static char *s_jxhtml_end_caption_tag (void *pdoc, Node *node);
143 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
145 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
147 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
148 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
152 tag_handler jxhtml_handler[] = {
155 s_jxhtml_start_html_tag,
156 s_jxhtml_end_html_tag,
160 s_jxhtml_start_meta_tag,
161 s_jxhtml_end_meta_tag,
165 s_jxhtml_start_textarea_tag,
166 s_jxhtml_end_textarea_tag,
170 s_jxhtml_start_p_tag,
175 s_jxhtml_start_pre_tag,
176 s_jxhtml_end_pre_tag,
180 s_jxhtml_start_ul_tag,
185 s_jxhtml_start_li_tag,
190 s_jxhtml_start_ol_tag,
195 s_jxhtml_start_h1_tag,
200 s_jxhtml_start_h2_tag,
205 s_jxhtml_start_h3_tag,
210 s_jxhtml_start_h4_tag,
215 s_jxhtml_start_h5_tag,
220 s_jxhtml_start_h6_tag,
225 s_jxhtml_start_head_tag,
226 s_jxhtml_end_head_tag,
230 s_jxhtml_start_title_tag,
231 s_jxhtml_end_title_tag,
235 s_jxhtml_start_base_tag,
236 s_jxhtml_end_base_tag,
240 s_jxhtml_start_body_tag,
241 s_jxhtml_end_body_tag,
245 s_jxhtml_start_a_tag,
250 s_jxhtml_start_br_tag,
255 s_jxhtml_start_table_tag,
256 s_jxhtml_end_table_tag,
260 s_jxhtml_start_tr_tag,
265 s_jxhtml_start_td_tag,
275 s_jxhtml_start_font_tag,
276 s_jxhtml_end_font_tag,
280 s_jxhtml_start_form_tag,
281 s_jxhtml_end_form_tag,
285 s_jxhtml_start_input_tag,
286 s_jxhtml_end_input_tag,
290 s_jxhtml_start_center_tag,
291 s_jxhtml_end_center_tag,
295 s_jxhtml_start_hr_tag,
300 s_jxhtml_start_img_tag,
301 s_jxhtml_end_img_tag,
305 s_jxhtml_start_select_tag,
306 s_jxhtml_end_select_tag,
310 s_jxhtml_start_option_tag,
311 s_jxhtml_end_option_tag,
315 s_jxhtml_start_div_tag,
316 s_jxhtml_end_div_tag,
345 s_jxhtml_start_span_tag,
346 s_jxhtml_end_span_tag,
355 s_jxhtml_start_th_tag,
360 s_jxhtml_start_b_tag,
370 s_jxhtml_start_dt_tag,
385 s_jxhtml_start_blockquote_tag,
386 s_jxhtml_end_blockquote_tag,
390 s_jxhtml_start_dir_tag,
391 s_jxhtml_end_dir_tag,
395 s_jxhtml_start_dl_tag,
400 s_jxhtml_start_dd_tag,
405 s_jxhtml_start_menu_tag,
406 s_jxhtml_end_menu_tag,
410 s_jxhtml_start_plaintext_tag,
411 s_jxhtml_end_plaintext_tag,
415 s_jxhtml_start_blink_tag,
416 s_jxhtml_end_blink_tag,
420 s_jxhtml_start_marquee_tag,
421 s_jxhtml_end_marquee_tag,
430 s_jxhtml_newline_mark,
435 s_jxhtml_start_object_tag,
436 s_jxhtml_end_object_tag,
440 s_jxhtml_start_param_tag,
445 s_jxhtml_start_caption_tag,
446 s_jxhtml_end_caption_tag,
452 * converts from CHTML5.0 to JXHTML.
454 * @param r [i] Requet_rec is appointed.
455 * @param spec [i] The result of the device specification processing which
456 * was done in advance is appointed.
457 * @param src [i] The character string before the converting is appointed.
458 * @return The character string after the converting is returned.
467 chxjconvrule_entry *entryp,
478 /*--------------------------------------------------------------------------*/
480 /*--------------------------------------------------------------------------*/
482 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
484 DBG(r,"REQ[%X] I found qrcode xml",TO_ADDR(r));
488 /*--------------------------------------------------------------------------*/
489 /* The CHTML structure is initialized. */
490 /*--------------------------------------------------------------------------*/
491 s_init_jxhtml(&jxhtml, &doc, r, spec);
493 jxhtml.entryp = entryp;
494 jxhtml.cookie = cookie;
495 if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
496 apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"application/xhtml+xml; charset=UTF-8");
498 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
500 /*--------------------------------------------------------------------------*/
501 /* The character string of the input is analyzed. */
502 /*--------------------------------------------------------------------------*/
503 qs_init_malloc(&doc);
504 qs_init_root_node(&doc);
506 ss = apr_pcalloc(r->pool, srclen + 1);
508 memset(ss, 0, srclen + 1);
509 memcpy(ss, src, srclen);
511 if (IS_CSS_ON(jxhtml.entryp)) {
512 /* current property list */
513 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
516 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
519 qs_parse_string(&doc,ss,strlen(ss));
521 chxj_buffered_write_init(r->pool, &doc.buf);
522 /*--------------------------------------------------------------------------*/
523 /* It converts it from CHTML to JXHTML. */
524 /*--------------------------------------------------------------------------*/
525 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
526 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
527 dst = apr_pstrdup(r->pool, jxhtml.out);
528 chxj_buffered_write_terminate(&doc.buf);
531 qs_all_free(&doc,QX_LOGMARK);
534 return apr_pstrdup(r->pool,ss);
537 dst = apr_psprintf(r->pool, "\n");
539 *dstlen = strlen(dst);
542 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
550 * The JXHTML structure is initialized.
552 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
553 * initialized is specified.
554 * @param doc [i] The Doc structure that should be set to the initialized
555 * JXHTML structure is specified.
556 * @param r [i] To use POOL, the pointer to request_rec is specified.
557 * @param spec [i] The pointer to the device_table
560 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
562 memset(doc, 0, sizeof(Doc));
563 memset(jxhtml, 0, sizeof(jxhtml_t));
568 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
569 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
570 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
575 * Corresponding EMOJI to a current character-code is retrieved.
576 * The substitution character string is stored in the rslt pointer if agreeing.
578 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
579 * @param txt [i] The character string to want to examine whether it is
580 * EMOJI is specified.
581 * @param rslt [o] The pointer to the pointer that stores the result is
583 * @return When corresponding EMOJI exists, it returns it excluding 0.
586 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
598 if (! spec) DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
600 for (ee = jxhtml->conf->emoji;
604 unsigned char hex1byte;
605 unsigned char hex2byte;
608 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
612 hex1byte = ee->imode->hex1byte & 0xff;
613 hex2byte = ee->imode->hex2byte & 0xff;
615 if (ee->imode->string
616 && strlen(ee->imode->string) > 0
617 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
618 if (spec == NULL || spec->emoji_type == NULL) {
619 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
620 return strlen(ee->imode->string);
627 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
628 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
629 if (spec == NULL || spec->emoji_type == NULL) {
630 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
643 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
657 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
658 memset(doc, 0, sizeof(Doc));
659 memset(jxhtml, 0, sizeof(jxhtml_t));
664 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
665 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
666 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
668 apr_pool_create(&pool, r->pool);
670 chxj_buffered_write_init(pool, &doc->buf);
672 for (ii=0; ii<len; ii++) {
676 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
683 if (is_sjis_kanji(src[ii])) {
684 two_byte[0] = src[ii+0];
685 two_byte[1] = src[ii+1];
691 one_byte[0] = src[ii+0];
696 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
698 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
704 * It is a handler who processes the HTML tag.
706 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
707 * destination is specified.
708 * @param node [i] The HTML tag node is specified.
709 * @return The conversion result is returned.
712 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
719 jxhtml = GET_JXHTML(pdoc);
722 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
724 W_L("<?xml version=\"1.0\" encoding=\"");
725 W_V(jxhtml->spec->output_encoding);
728 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
731 /*--------------------------------------------------------------------------*/
733 /*--------------------------------------------------------------------------*/
734 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
736 jxhtml->start_html_flag = 1;
738 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
745 * It is a handler who processes the HTML tag.
747 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
748 * destination is specified.
749 * @param node [i] The HTML tag node is specified.
750 * @return The conversion result is returned.
753 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
755 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
756 Doc *doc = jxhtml->doc;
765 * It is a handler who processes the META tag.
767 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
768 * destination is specified.
769 * @param node [i] The META tag node is specified.
770 * @return The conversion result is returned.
773 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
779 int content_type_flag;
782 jxhtml = GET_JXHTML(pdoc);
786 content_type_flag = 0;
789 /*--------------------------------------------------------------------------*/
791 /*--------------------------------------------------------------------------*/
792 for (attr = qs_get_attr(doc,node);
794 attr = qs_get_next_attr(doc,attr)) {
795 char *name = qs_get_attr_name(doc,attr);
796 char *value = qs_get_attr_value(doc,attr);
800 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
801 /*----------------------------------------------------------------------*/
803 /*----------------------------------------------------------------------*/
804 W_L(" http-equiv=\"");
807 if (STRCASEEQ('c','C',"content-type",value)) {
808 content_type_flag = 1;
810 if (STRCASEEQ('r','R',"refresh",value)) {
818 if (strcasecmp(name, "content") == 0 && value && *value) {
819 /*----------------------------------------------------------------------*/
821 /*----------------------------------------------------------------------*/
822 if (content_type_flag) {
826 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
835 buf = apr_pstrdup(r->pool, value);
837 url = strchr(buf, ';');
839 sec = apr_pstrdup(r->pool, buf);
842 url = chxj_encoding_parameter(r, url, 1);
863 if (strcasecmp(name, "name") == 0 && value && *value) {
879 * It is a handler who processes the META tag.
881 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
882 * destination is specified.
883 * @param node [i] The META tag node is specified.
884 * @return The conversion result is returned.
887 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
889 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
896 * It is a handler who processes the HEAD tag.
898 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
899 * destination is specified.
900 * @param node [i] The HEAD tag node is specified.
901 * @return The conversion result is returned.
904 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
910 jxhtml = GET_JXHTML(pdoc);
920 * It is a handler who processes the HEAD tag.
922 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
923 * destination is specified.
924 * @param node [i] The HEAD tag node is specified.
925 * @return The conversion result is returned.
928 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
934 jxhtml = GET_JXHTML(pdoc);
944 * It is a handler who processes the TITLE tag.
946 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
947 * destination is specified.
948 * @param node [i] The TITLE tag node is specified.
949 * @return The conversion result is returned.
952 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
958 jxhtml = GET_JXHTML(pdoc);
968 * It is a handler who processes the TITLE tag.
970 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
971 * destination is specified.
972 * @param node [i] The TITLE tag node is specified.
973 * @return The conversion result is returned.
976 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
982 jxhtml = GET_JXHTML(pdoc);
992 * It is a handler who processes the BASE tag.
994 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
995 * destination is specified.
996 * @param node [i] The BASE tag node is specified.
997 * @return The conversion result is returned.
1000 s_jxhtml_start_base_tag(void *pdoc, Node *node)
1007 jxhtml = GET_JXHTML(pdoc);
1012 /*--------------------------------------------------------------------------*/
1013 /* Get Attributes */
1014 /*--------------------------------------------------------------------------*/
1015 for (attr = qs_get_attr(doc,node);
1017 attr = qs_get_next_attr(doc,attr)) {
1018 char *name = qs_get_attr_name(doc,attr);
1019 char *value = qs_get_attr_value(doc,attr);
1020 if (STRCASEEQ('h','H',"href",name)) {
1032 * It is a handler who processes the BASE tag.
1034 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1035 * destination is specified.
1036 * @param node [i] The BASE tag node is specified.
1037 * @return The conversion result is returned.
1040 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1042 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1048 * It is a handler who processes the BODY tag.
1050 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1051 * destination is specified.
1052 * @param node [i] The BODY tag node is specified.
1053 * @return The conversion result is returned.
1056 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1062 char *attr_bgcolor = NULL;
1063 char *attr_text = NULL;
1064 char *attr_link = NULL;
1065 char *attr_vlink = NULL;
1066 char *attr_style = NULL;
1067 char *attr_background = NULL;
1069 jxhtml = GET_JXHTML(pdoc);
1073 /*--------------------------------------------------------------------------*/
1074 /* Get Attributes */
1075 /*--------------------------------------------------------------------------*/
1076 for (attr = qs_get_attr(doc,node);
1078 attr = qs_get_next_attr(doc,attr)) {
1079 char *name = qs_get_attr_name(doc,attr);
1080 char *value = qs_get_attr_value(doc,attr);
1081 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1082 /*----------------------------------------------------------------------*/
1084 /*----------------------------------------------------------------------*/
1085 attr_bgcolor = value;
1087 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1088 /*----------------------------------------------------------------------*/
1090 /*----------------------------------------------------------------------*/
1093 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1094 /*----------------------------------------------------------------------*/
1096 /*----------------------------------------------------------------------*/
1099 else if (STRCASEEQ('a','A',"alink",name)) {
1100 /*----------------------------------------------------------------------*/
1102 /*----------------------------------------------------------------------*/
1105 else if (STRCASEEQ('v','V',"vlink",name)) {
1106 /*----------------------------------------------------------------------*/
1108 /*----------------------------------------------------------------------*/
1111 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1112 /*----------------------------------------------------------------------*/
1114 /*----------------------------------------------------------------------*/
1115 attr_background = value;
1117 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1122 if (IS_CSS_ON(jxhtml->entryp)) {
1123 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1125 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1126 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1127 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1128 css_property_t *cur;
1129 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1130 if (cur->value && *cur->value) {
1131 attr_text = apr_pstrdup(doc->pool, cur->value);
1134 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1135 if (cur->value && *cur->value) {
1136 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1139 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1140 if (cur->value && *cur->value) {
1141 char *tmp = apr_pstrdup(doc->pool, cur->value);
1142 char *tmps = strstr(tmp,"(");
1144 char *tmpe = strstr(tmp,")");
1145 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1147 attr_background = apr_pstrndup(doc->pool, tmps,len);
1152 if (jxhtml->style) {
1153 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1154 css_selector_t *cur_sel;
1155 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1156 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1157 css_property_t *cur;
1158 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1159 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1160 attr_link = apr_pstrdup(doc->pool, cur->value);
1164 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1165 css_property_t *cur;
1166 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1167 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1168 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1178 if (attr_bgcolor || attr_text) {
1181 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1182 W_L("background-color:");
1187 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1195 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1201 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1206 if (attr_background) {
1207 W_L(" background=\"");
1208 W_V(attr_background);
1217 * It is a handler who processes the BODY tag.
1219 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1220 * destination is specified.
1221 * @param node [i] The BODY tag node is specified.
1222 * @return The conversion result is returned.
1225 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1231 jxhtml = GET_JXHTML(pdoc);
1235 W_L("</div></body>");
1236 if (IS_CSS_ON(jxhtml->entryp)) {
1237 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1244 * It is a handler who processes the A tag.
1246 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1247 * destination is specified.
1248 * @param node [i] The A tag node is specified.
1249 * @return The conversion result is returned.
1252 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1258 char *attr_style = NULL;
1259 char *attr_id = NULL;
1261 jxhtml = GET_JXHTML(pdoc);
1266 /*--------------------------------------------------------------------------*/
1267 /* Get Attributes */
1268 /*--------------------------------------------------------------------------*/
1269 for (attr = qs_get_attr(doc,node);
1271 attr = qs_get_next_attr(doc,attr)) {
1272 char *name = qs_get_attr_name(doc,attr);
1273 char *value = qs_get_attr_value(doc,attr);
1274 if (STRCASEEQ('i','I',"id",name)){
1275 attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
1277 else if (STRCASEEQ('n','N',"name",name)) {
1278 attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
1280 else if (STRCASEEQ('h','H',"href",name)) {
1281 /*----------------------------------------------------------------------*/
1283 /*----------------------------------------------------------------------*/
1284 value = chxj_encoding_parameter(r, value, 1);
1285 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1286 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1292 else if (STRCASEEQ('a','A',"accesskey",name)) {
1293 /*----------------------------------------------------------------------*/
1295 /*----------------------------------------------------------------------*/
1296 W_L(" accesskey=\"");
1300 else if (STRCASEEQ('c','C',"cti",name)) {
1301 /*----------------------------------------------------------------------*/
1303 /*----------------------------------------------------------------------*/
1308 else if (STRCASEEQ('i','I',"ijam",name)) {
1309 /*----------------------------------------------------------------------*/
1311 /*----------------------------------------------------------------------*/
1314 else if (STRCASEEQ('u','U',"utn",name)) {
1315 /*----------------------------------------------------------------------*/
1317 /* It is special only for CHTML. */
1318 /*----------------------------------------------------------------------*/
1321 else if (STRCASEEQ('t','T',"telbook",name)) {
1322 /*----------------------------------------------------------------------*/
1324 /*----------------------------------------------------------------------*/
1327 else if (STRCASEEQ('k','K',"kana",name)) {
1328 /*----------------------------------------------------------------------*/
1330 /*----------------------------------------------------------------------*/
1333 else if (STRCASEEQ('e','E',"email",name)) {
1334 /*----------------------------------------------------------------------*/
1336 /*----------------------------------------------------------------------*/
1339 else if (STRCASEEQ('i','I',"ista",name)) {
1340 /*----------------------------------------------------------------------*/
1342 /*----------------------------------------------------------------------*/
1345 else if (STRCASEEQ('i','I',"ilet",name)) {
1346 /*----------------------------------------------------------------------*/
1348 /*----------------------------------------------------------------------*/
1351 else if (STRCASEEQ('i','I',"iswf",name)) {
1352 /*----------------------------------------------------------------------*/
1354 /*----------------------------------------------------------------------*/
1357 else if (STRCASEEQ('i','I',"irst",name)) {
1358 /*----------------------------------------------------------------------*/
1360 /*----------------------------------------------------------------------*/
1363 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1364 /*----------------------------------------------------------------------*/
1366 /*----------------------------------------------------------------------*/
1377 if (IS_CSS_ON(jxhtml->entryp)) {
1378 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1386 * It is a handler who processes the A tag.
1388 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1389 * destination is specified.
1390 * @param node [i] The A tag node is specified.
1391 * @return The conversion result is returned.
1394 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1400 jxhtml = GET_JXHTML(pdoc);
1406 if (IS_CSS_ON(jxhtml->entryp)) {
1407 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1415 * It is a handler who processes the BR tag.
1417 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1418 * destination is specified.
1419 * @param node [i] The BR tag node is specified.
1420 * @return The conversion result is returned.
1423 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1430 jxhtml = GET_JXHTML(pdoc);
1434 char *attr_style = NULL;
1435 char *attr_clear = NULL;
1437 /*--------------------------------------------------------------------------*/
1438 /* Get Attributes */
1439 /*--------------------------------------------------------------------------*/
1440 for (attr = qs_get_attr(doc,node);
1442 attr = qs_get_next_attr(doc,attr)) {
1443 char *name = qs_get_attr_name(doc,attr);
1444 char *value = qs_get_attr_value(doc,attr);
1445 if (STRCASEEQ('c','C',"clear",name)) {
1446 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1450 else if (STRCASEEQ('s','S',"style",name)) {
1451 attr_style = apr_pstrdup(doc->buf.pool, value);
1454 if (IS_CSS_ON(jxhtml->entryp)) {
1455 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1457 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1458 css_property_t *cur;
1459 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1460 if (cur->value && *cur->value) {
1461 if ( STRCASEEQ('l','L',"left", cur->value)
1462 || STRCASEEQ('r','R',"right", cur->value)) {
1463 attr_clear = apr_pstrdup(doc->pool, cur->value);
1465 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1466 attr_clear = apr_pstrdup(doc->pool, "all");
1484 * It is a handler who processes the BR tag.
1486 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1487 * destination is specified.
1488 * @param node [i] The BR tag node is specified.
1489 * @return The conversion result is returned.
1492 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1494 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1499 * It is a handler who processes the TABLE tag.
1501 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1502 * destination is specified.
1503 * @param node [i] The TR tag node is specified.
1504 * @return The conversion result is returned.
1507 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1514 char *attr_style = NULL;
1515 char *attr_align = NULL;
1516 char *attr_width = NULL;
1517 char *attr_height = NULL;
1518 char *attr_bgcolor = NULL;
1519 char *attr_border_width = NULL;
1520 char *attr_border_color = NULL;
1522 jxhtml = GET_JXHTML(pdoc);
1526 /*--------------------------------------------------------------------------*/
1527 /* Get Attributes */
1528 /*--------------------------------------------------------------------------*/
1529 for (attr = qs_get_attr(doc,node);
1531 attr = qs_get_next_attr(doc,attr)) {
1532 char *name = qs_get_attr_name(doc,attr);
1533 char *val = qs_get_attr_value(doc,attr);
1534 if (STRCASEEQ('a','A',"align",name)) {
1535 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1536 attr_align = apr_pstrdup(doc->buf.pool, val);
1539 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1540 attr_height = apr_pstrdup(doc->buf.pool, val);
1542 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1543 attr_width = apr_pstrdup(doc->buf.pool, val);
1545 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1546 attr_style = apr_pstrdup(doc->buf.pool, val);
1548 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1549 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1550 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1552 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1553 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1555 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1556 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1557 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1561 if (IS_CSS_ON(jxhtml->entryp)) {
1562 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1564 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1565 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1566 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1567 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1568 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1569 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1571 css_property_t *cur;
1572 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1573 char *tmp = apr_pstrdup(doc->pool, cur->value);
1574 char *tmpp = strstr(tmp, "px");
1576 size_t len = strlen(tmp) - strlen(tmpp);
1577 attr_width = apr_pstrndup(doc->pool, tmp,len);
1580 attr_width = apr_pstrdup(doc->pool, tmp);
1583 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1584 char *tmp = apr_pstrdup(doc->pool, cur->value);
1585 char *tmpp = strstr(tmp, "px");
1587 size_t len = strlen(tmp) - strlen(tmpp);
1588 attr_height = apr_pstrndup(doc->pool, tmp,len);
1591 attr_height = apr_pstrdup(doc->pool, tmp);
1594 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1595 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1596 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1599 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1600 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1601 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1603 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1604 char *tmp = apr_pstrdup(doc->pool, cur->value);
1605 char *tmpp = strstr(tmp, "px");
1607 size_t len = strlen(tmp) - strlen(tmpp);
1608 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1611 attr_border_width = apr_pstrdup(doc->pool, tmp);
1614 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1615 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1616 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1637 if (attr_bgcolor && *attr_bgcolor){
1642 if (attr_border_width || attr_border_color ){
1643 W_L(" style=\"border:");
1644 if (attr_border_width){
1645 W_V(attr_border_width);
1652 if (attr_border_color && *attr_border_color){
1654 W_V(attr_border_color);
1664 * It is a handler who processes the TABLE tag.
1666 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1667 * destination is specified.
1668 * @param node [i] The TR tag node is specified.
1669 * @return The conversion result is returned.
1672 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1678 jxhtml = GET_JXHTML(pdoc);
1688 * It is a handler who processes the TR tag.
1690 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1691 * destination is specified.
1692 * @param node [i] The TR tag node is specified.
1693 * @return The conversion result is returned.
1696 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1704 char *attr_style = NULL;
1705 char *attr_align = NULL;
1706 char *attr_valign = NULL;
1707 char *attr_bgcolor = NULL;
1709 jxhtml = GET_JXHTML(pdoc);
1713 /*--------------------------------------------------------------------------*/
1714 /* Get Attributes */
1715 /*--------------------------------------------------------------------------*/
1716 for (attr = qs_get_attr(doc,node);
1718 attr = qs_get_next_attr(doc,attr)) {
1719 char *name = qs_get_attr_name(doc,attr);
1720 char *val = qs_get_attr_value(doc,attr);
1721 if (STRCASEEQ('a','A',"align",name)) {
1722 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1723 attr_align = apr_pstrdup(doc->buf.pool, val);
1726 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1727 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1728 attr_valign = apr_pstrdup(doc->buf.pool, val);
1731 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1732 attr_style = apr_pstrdup(doc->buf.pool, val);
1734 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1735 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1736 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1740 if (IS_CSS_ON(jxhtml->entryp)) {
1741 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1743 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1744 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1745 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1747 css_property_t *cur;
1748 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1749 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1750 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1753 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1754 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1755 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1758 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1759 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1760 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1776 if (attr_bgcolor && *attr_bgcolor){
1787 * It is a handler who processes the TR tag.
1789 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1790 * destination is specified.
1791 * @param node [i] The TR tag node is specified.
1792 * @return The conversion result is returned.
1795 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1801 jxhtml = GET_JXHTML(pdoc);
1810 * It is a handler who processes the TD tag.
1812 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1813 * destination is specified.
1814 * @param node [i] The TR tag node is specified.
1815 * @return The conversion result is returned.
1818 s_jxhtml_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1826 char *attr_style = NULL;
1827 char *attr_align = NULL;
1828 char *attr_valign = NULL;
1829 char *attr_bgcolor = NULL;
1830 char *attr_colspan = NULL;
1831 char *attr_rowspan = NULL;
1832 char *attr_width = NULL;
1833 char *attr_height = NULL;
1835 jxhtml = GET_JXHTML(pdoc);
1839 /*--------------------------------------------------------------------------*/
1840 /* Get Attributes */
1841 /*--------------------------------------------------------------------------*/
1842 for (attr = qs_get_attr(doc,node);
1844 attr = qs_get_next_attr(doc,attr)) {
1845 char *name = qs_get_attr_name(doc,attr);
1846 char *val = qs_get_attr_value(doc,attr);
1847 if (STRCASEEQ('a','A',"align",name)) {
1848 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1849 attr_align = apr_pstrdup(doc->buf.pool, val);
1852 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1853 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1854 attr_valign = apr_pstrdup(doc->buf.pool, val);
1857 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1858 attr_style = apr_pstrdup(doc->buf.pool, val);
1860 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1861 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1862 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1864 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1865 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1867 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1868 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1870 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1871 char *tmp = strstr(val, "%");
1873 attr_width = apr_pstrdup(doc->buf.pool, val);
1876 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1879 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1880 char *tmp = strstr(val, "%");
1882 attr_height = apr_pstrdup(doc->buf.pool, val);
1885 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1890 if (IS_CSS_ON(jxhtml->entryp)) {
1891 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1893 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1894 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1895 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1896 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1897 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1899 css_property_t *cur;
1900 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1901 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1902 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1905 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1906 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1907 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1910 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1911 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1912 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1914 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1915 attr_width = apr_pstrdup(doc->pool, cur->value);
1917 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1918 attr_height = apr_pstrdup(doc->pool, cur->value);
1945 if (attr_bgcolor && *attr_bgcolor){
1950 if (attr_width || attr_height ){
1970 * It is a handler who processes the TD tag.
1972 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1973 * destination is specified.
1974 * @param node [i] The TR tag node is specified.
1975 * @return The conversion result is returned.
1978 s_jxhtml_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1984 jxhtml = GET_JXHTML(pdoc);
1995 * It is a handler who processes the TD tag.
1997 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1998 * destination is specified.
1999 * @param node [i] The TD tag node is specified.
2000 * @return The conversion result is returned.
2003 s_jxhtml_start_td_tag(void *pdoc, Node *node)
2005 return s_jxhtml_start_td_or_th_tag(pdoc,node,"td");
2008 * It is a handler who processes the TD tag.
2010 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2011 * destination is specified.
2012 * @param node [i] The TD tag node is specified.
2013 * @return The conversion result is returned.
2016 s_jxhtml_end_td_tag(void *pdoc, Node *node)
2018 return s_jxhtml_end_td_or_th_tag(pdoc,node,"td");
2022 * It is a handler who processes the TD tag.
2024 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2025 * destination is specified.
2026 * @param node [i] The TD tag node is specified.
2027 * @return The conversion result is returned.
2030 s_jxhtml_start_th_tag(void *pdoc, Node *node)
2032 return s_jxhtml_start_td_or_th_tag(pdoc,node,"th");
2035 * It is a handler who processes the TD tag.
2037 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2038 * destination is specified.
2039 * @param node [i] The TD tag node is specified.
2040 * @return The conversion result is returned.
2043 s_jxhtml_end_th_tag(void *pdoc, Node *node)
2045 return s_jxhtml_end_td_or_th_tag(pdoc,node,"th");
2049 * It is a handler who processes the FONT tag.
2051 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2052 * destination is specified.
2053 * @param node [i] The FONT tag node is specified.
2054 * @return The conversion result is returned.
2057 s_jxhtml_start_font_tag(void *pdoc, Node *node)
2063 char *attr_color = NULL;
2064 char *attr_size = NULL;
2065 char *attr_style = NULL;
2067 jxhtml = GET_JXHTML(pdoc);
2071 /*--------------------------------------------------------------------------*/
2072 /* Get Attributes */
2073 /*--------------------------------------------------------------------------*/
2074 for (attr = qs_get_attr(doc,node);
2076 attr = qs_get_next_attr(doc,attr)) {
2077 char *name = qs_get_attr_name(doc,attr);
2078 char *value = qs_get_attr_value(doc,attr);
2079 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2080 attr_color = apr_pstrdup(doc->buf.pool, value);
2082 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2083 /*----------------------------------------------------------------------*/
2085 /*----------------------------------------------------------------------*/
2086 attr_size = apr_pstrdup(doc->buf.pool, value);
2088 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2089 attr_style = apr_pstrdup(doc->buf.pool, value);
2092 if (IS_CSS_ON(jxhtml->entryp)) {
2093 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2095 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2096 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2097 css_property_t *cur;
2098 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2099 if (cur->value && *cur->value) {
2100 attr_color = apr_pstrdup(doc->pool, cur->value);
2103 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2104 if (cur->value && *cur->value) {
2105 attr_size = apr_pstrdup(doc->pool, cur->value);
2106 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2107 attr_size = apr_pstrdup(doc->pool, "1");
2109 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2110 attr_size = apr_pstrdup(doc->pool, "2");
2112 else if (STRCASEEQ('s','S',"small",attr_size)) {
2113 attr_size = apr_pstrdup(doc->pool, "3");
2115 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2116 attr_size = apr_pstrdup(doc->pool, "4");
2118 else if (STRCASEEQ('l','L',"large",attr_size)) {
2119 attr_size = apr_pstrdup(doc->pool, "5");
2121 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2122 attr_size = apr_pstrdup(doc->pool, "6");
2124 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2125 attr_size = apr_pstrdup(doc->pool, "7");
2131 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2132 memset(flg, 0, sizeof(*flg));
2134 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2135 W_L("<font color=\"");
2138 flg->font_color_flag = 1;
2141 flg->font_size_flag = 1;
2142 switch(*attr_size) {
2143 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2144 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2145 case '3': W_L("<span style=\"font-size: small\">"); break;
2146 case '4': W_L("<span style=\"font-size: medium\">"); break;
2147 case '5': W_L("<span style=\"font-size: large\">"); break;
2148 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2149 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2151 if (*(attr_size + 1) == '1') {
2152 W_L("<span style=\"font-size: small\">");
2155 if (*(attr_size + 1) == '2') {
2156 W_L("<span style=\"font-size: x-small\">");
2159 if (*(attr_size + 1) == '3') {
2160 W_L("<span style=\"font-size: xx-small\">");
2163 flg->font_size_flag = 0;
2167 if (*(attr_size + 1) == '1') {
2168 W_L("<span style=\"font-size: large\">");
2171 if (*(attr_size + 1) == '2') {
2172 W_L("<span style=\"font-size: x-large\">");
2175 if (*(attr_size + 1) == '3') {
2176 W_L("<span style=\"font-size: xx-large\">");
2179 flg->font_size_flag = 0;
2183 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2184 flg->font_size_flag = 0;
2187 node->userData = flg;
2193 * It is a handler who processes the FONT tag.
2195 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2196 * destination is specified.
2197 * @param node [i] The FONT tag node is specified.
2198 * @return The conversion result is returned.
2201 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2207 jxhtml = GET_JXHTML(pdoc);
2211 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2212 if (flg && flg->font_size_flag) {
2215 if (flg && flg->font_color_flag) {
2218 if (IS_CSS_ON(jxhtml->entryp)) {
2219 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2227 * It is a handler who processes the FORM tag.
2229 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2230 * destination is specified.
2231 * @param node [i] The FORM tag node is specified.
2232 * @return The conversion result is returned.
2235 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2241 char *attr_action = NULL;
2242 char *attr_method = NULL;
2243 char *attr_style = NULL;
2244 char *attr_color = NULL;
2245 char *attr_align = NULL;
2246 char *attr_name = NULL;
2247 char *css_clear = NULL;
2248 char *new_hidden_tag = NULL;
2250 jxhtml = GET_JXHTML(pdoc);
2254 /*--------------------------------------------------------------------------*/
2255 /* Get Attributes */
2256 /*--------------------------------------------------------------------------*/
2257 for (attr = qs_get_attr(doc,node);
2259 attr = qs_get_next_attr(doc,attr)) {
2260 char *name = qs_get_attr_name(doc,attr);
2261 char *value = qs_get_attr_value(doc,attr);
2265 if (strcasecmp(name, "action") == 0) {
2266 /*--------------------------------------------------------------------*/
2268 /*--------------------------------------------------------------------*/
2269 attr_action = value;
2275 if (strcasecmp(name, "method") == 0) {
2276 /*--------------------------------------------------------------------*/
2278 /*--------------------------------------------------------------------*/
2279 attr_method = value;
2285 if (strcasecmp(name, "name") == 0) {
2286 /*--------------------------------------------------------------------*/
2288 /*--------------------------------------------------------------------*/
2295 if (strcasecmp(name, "style") == 0) {
2304 if (IS_CSS_ON(jxhtml->entryp)) {
2305 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2307 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2308 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2309 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2310 css_property_t *cur;
2311 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2312 if (STRCASEEQ('l','L',"left", cur->value)) {
2313 attr_align = apr_pstrdup(doc->pool, "left");
2315 else if (STRCASEEQ('c','C',"center",cur->value)) {
2316 attr_align = apr_pstrdup(doc->pool, "center");
2318 else if (STRCASEEQ('r','R',"right",cur->value)) {
2319 attr_align = apr_pstrdup(doc->pool, "right");
2322 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2323 attr_color = apr_pstrdup(doc->pool, cur->value);
2325 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2326 css_clear = apr_pstrdup(doc->pool, cur->value);
2331 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2335 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2336 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2338 char *old_qs = NULL;
2339 q = strchr(attr_action, '?');
2341 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);
2342 if (new_hidden_tag || old_qs) {
2372 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2373 memset(flg, 0, sizeof(*flg));
2375 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2376 W_L("<font color=\"");
2379 flg->with_font_flag = 1;
2382 W_L("<div align=\"");
2385 flg->with_div_flag = 1;
2387 node->userData = flg;
2388 if (new_hidden_tag) {
2389 W_V(new_hidden_tag);
2396 * It is a handler who processes the FORM tag.
2398 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2399 * destination is specified.
2400 * @param node [i] The FORM tag node is specified.
2401 * @return The conversion result is returned.
2404 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2406 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2407 Doc *doc = jxhtml->doc;
2409 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2410 if (flg && flg->with_div_flag) {
2413 if (flg && flg->with_font_flag) {
2417 if (IS_CSS_ON(jxhtml->entryp)) {
2418 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2425 s_jxhtml_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
2429 case '1': return apr_psprintf(p, ""*<ja:h>"");
2430 case '2': return apr_psprintf(p, ""*<ja:hk>"");
2431 case '3': return apr_psprintf(p, ""*<ja:en>"");
2432 case '4': return apr_psprintf(p, ""*<ja:n>"");
2434 return apr_pstrdup(p, "");
2438 return apr_pstrdup(p,"");
2443 * It is a handler who processes the INPUT tag.
2445 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2446 * destination is specified.
2447 * @param node [i] The INPUT tag node is specified.
2448 * @return The conversion result is returned.
2451 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2457 char *attr_accesskey = NULL;
2458 char *attr_max_length = NULL;
2459 char *attr_type = NULL;
2460 char *attr_name = NULL;
2461 char *attr_value = NULL;
2462 char *attr_istyle = NULL;
2463 char *attr_size = NULL;
2464 char *attr_checked = NULL;
2465 char *attr_style = NULL;
2467 jxhtml = GET_JXHTML(pdoc);
2471 /*--------------------------------------------------------------------------*/
2472 /* Get Attributes */
2473 /*--------------------------------------------------------------------------*/
2474 for (attr = qs_get_attr(doc,node);
2476 attr = qs_get_next_attr(doc,attr)) {
2477 char *name = qs_get_attr_name(doc,attr);
2478 char *value = qs_get_attr_value(doc,attr);
2479 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2480 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2481 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2482 STRCASEEQ('p','P',"password",tmp_type) ||
2483 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2484 STRCASEEQ('r','R',"radio", tmp_type) ||
2485 STRCASEEQ('h','H',"hidden", tmp_type) ||
2486 STRCASEEQ('s','S',"submit", tmp_type) ||
2487 STRCASEEQ('r','R',"reset", tmp_type))) {
2488 attr_type = tmp_type;
2491 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2494 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2497 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2498 attr_istyle = value;
2500 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2501 attr_max_length = value;
2503 else if (STRCASEEQ('c','C',"checked", name)) {
2504 attr_checked = value;
2506 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2507 attr_accesskey = value;
2509 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2512 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2517 if (IS_CSS_ON(jxhtml->entryp)) {
2518 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2520 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2521 css_property_t *cur;
2522 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2523 if (strcasestr(cur->value, "<ja:n>")) {
2526 else if (strcasestr(cur->value, "<ja:en>")) {
2529 else if (strcasestr(cur->value, "<ja:hk>")) {
2532 else if (strcasestr(cur->value, "<ja:h>")) {
2552 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2557 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2560 if (attr_accesskey) {
2561 W_L(" accesskey=\"");
2562 W_V(attr_accesskey);
2565 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2570 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
2572 W_L("-wap-input-format:");
2577 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2578 W_L(" istyle=\"4\"");
2580 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,"4");
2582 W_L("-wap-input-format:");
2587 /*--------------------------------------------------------------------------*/
2588 /* The figure is default for the password. */
2589 /*--------------------------------------------------------------------------*/
2590 if (attr_max_length && *attr_max_length) {
2591 if (chxj_chk_numeric(attr_max_length) == 0) {
2592 W_L(" maxlength=\"");
2593 W_V(attr_max_length);
2598 W_L(" checked=\"checked\"");
2614 jxhtml = GET_JXHTML(pdoc);
2627 /*--------------------------------------------------------------------------*/
2628 /* Get Attributes */
2629 /*--------------------------------------------------------------------------*/
2630 type = qs_get_type_attr(doc, node, doc->buf.pool);
2631 name = qs_get_name_attr(doc, node, doc->buf.pool);
2632 value = qs_get_value_attr(doc,node, doc->buf.pool);
2633 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2634 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2635 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2636 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2637 size = qs_get_size_attr(doc, node, doc->buf.pool);
2640 if (type && (STRCASEEQ('t','T',"text", type) ||
2641 STRCASEEQ('p','P',"password",type) ||
2642 STRCASEEQ('c','C',"checkbox",type) ||
2643 STRCASEEQ('r','R',"radio", type) ||
2644 STRCASEEQ('h','H',"hidden", type) ||
2645 STRCASEEQ('s','S',"submit", type) ||
2646 STRCASEEQ('r','R',"reset", type))) {
2652 if (size && *size) {
2657 if (name && *name) {
2659 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2662 if (value && *value) {
2663 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2664 apr_size_t value_len = strlen(value);
2665 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2669 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2672 if (accesskey && *accesskey) {
2673 W_L(" accesskey=\"");
2677 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2678 /*------------------------------------------------------------------------*/
2680 /*------------------------------------------------------------------------*/
2681 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2682 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2685 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2687 W_L("-wap-input-format:'*");
2693 else if (type && STRCASEEQ('p','P',"password",type)) {
2694 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2696 /*--------------------------------------------------------------------------*/
2697 /* The figure is default for the password. */
2698 /*--------------------------------------------------------------------------*/
2699 if (max_length && *max_length) {
2700 if (chxj_chk_numeric(max_length) == 0) {
2701 W_L(" maxlength=\"");
2708 W_L(" checked=\"checked\"");
2717 * It is a handler who processes the INPUT tag.
2719 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2720 * destination is specified.
2721 * @param node [i] The INPUT tag node is specified.
2722 * @return The conversion result is returned.
2725 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2727 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2733 * It is a handler who processes the CENTER tag.
2735 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2736 * destination is specified.
2737 * @param node [i] The CENTER tag node is specified.
2738 * @return The conversion result is returned.
2741 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2746 char *attr_style = NULL;
2747 char *attr_color = NULL;
2748 char *attr_size = NULL;
2750 jxhtml = GET_JXHTML(pdoc);
2753 for (attr = qs_get_attr(doc,node);
2755 attr = qs_get_next_attr(doc,attr)) {
2756 char *name = qs_get_attr_name(doc,attr);
2757 char *value = qs_get_attr_value(doc,attr);
2758 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2762 if (IS_CSS_ON(jxhtml->entryp)) {
2763 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2765 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2766 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2767 css_property_t *cur;
2768 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2769 if (cur->value && *cur->value) {
2770 attr_color = apr_pstrdup(doc->pool, cur->value);
2773 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2774 if (cur->value && *cur->value) {
2775 attr_size = apr_pstrdup(doc->pool, cur->value);
2782 if (attr_size || attr_color) {
2790 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2804 * It is a handler who processes the CENTER tag.
2806 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2807 * destination is specified.
2808 * @param node [i] The CENTER tag node is specified.
2809 * @return The conversion result is returned.
2812 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2818 jxhtml = GET_JXHTML(pdoc);
2823 if (IS_CSS_ON(jxhtml->entryp)) {
2824 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2831 * It is a handler who processes the li tag.
2833 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2834 * destination is specified.
2835 * @param node [i] The li tag node is specified.
2836 * @return The conversion result is returned.
2839 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2845 char *attr_type = NULL;
2846 char *attr_value = NULL;
2847 char *attr_style = NULL;
2849 jxhtml = GET_JXHTML(pdoc);
2853 for (attr = qs_get_attr(doc,node);
2855 attr = qs_get_next_attr(doc,attr)) {
2856 char *name = qs_get_attr_name(doc,attr);
2857 char *value = qs_get_attr_value(doc,attr);
2858 if (STRCASEEQ('t','T',"type",name)) {
2859 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2860 if (*value == '1') {
2861 attr_type = apr_pstrdup(doc->pool, "decimal");
2863 else if (*value == 'a') {
2864 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2866 else if (*value == 'A') {
2867 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2874 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2877 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2881 if (IS_CSS_ON(jxhtml->entryp)) {
2882 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2884 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2885 css_property_t *cur;
2886 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2887 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2888 attr_type = apr_pstrdup(doc->pool, "decimal");
2890 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2891 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2893 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2894 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2896 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2897 attr_type = apr_pstrdup(doc->pool, "disc");
2899 else if (STRCASEEQ('s','S',"square", cur->value)) {
2900 attr_type = apr_pstrdup(doc->pool, "square");
2902 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2903 attr_type = apr_pstrdup(doc->pool, "circle");
2913 W_L("list-style-type:");
2929 * It is a handler who processes the li tag.
2931 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2932 * destination is specified.
2933 * @param node [i] The li tag node is specified.
2934 * @return The conversion result is returned.
2937 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2943 jxhtml = GET_JXHTML(pdoc);
2947 if (IS_CSS_ON(jxhtml->entryp)) {
2948 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2956 * It is a handler who processes the OL tag.
2958 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2959 * destination is specified.
2960 * @param node [i] The OL tag node is specified.
2961 * @return The conversion result is returned.
2964 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2970 char *attr_style = NULL;
2971 char *attr_start = NULL;
2972 char *attr_type = NULL;
2973 char *css_clear = NULL;
2975 jxhtml = GET_JXHTML(pdoc);
2979 /*--------------------------------------------------------------------------*/
2980 /* Get Attributes */
2981 /*--------------------------------------------------------------------------*/
2982 for (attr = qs_get_attr(doc,node);
2984 attr = qs_get_next_attr(doc,attr)) {
2985 char *name = qs_get_attr_name(doc,attr);
2986 char *value = qs_get_attr_value(doc,attr);
2987 if (STRCASEEQ('t','T',"type",name) && value) {
2988 if (*value == '1') {
2989 attr_type = apr_pstrdup(doc->pool, "decimal");
2991 else if (*value == 'a') {
2992 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2994 else if (*value == 'A') {
2995 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2998 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3001 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3005 if (IS_CSS_ON(jxhtml->entryp)) {
3006 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3008 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3009 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3011 css_property_t *cur;
3012 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3013 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3014 attr_type = apr_pstrdup(doc->pool, "decimal");
3016 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3017 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3019 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3020 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3023 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3024 css_clear = apr_pstrdup(doc->pool, cur->value);
3029 if (attr_type || css_clear) {
3032 W_L("list-style-type:");
3055 * It is a handler who processes the OL tag.
3057 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3058 * destination is specified.
3059 * @param node [i] The OL tag node is specified.
3060 * @return The conversion result is returned.
3063 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
3069 jxhtml = GET_JXHTML(pdoc);
3074 if (IS_CSS_ON(jxhtml->entryp)) {
3075 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3082 * It is a handler who processes the P tag.
3084 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3085 * destination is specified.
3086 * @param node [i] The P tag node is specified.
3087 * @return The conversion result is returned.
3090 s_jxhtml_start_p_tag(void *pdoc, Node *node)
3096 char *attr_align = NULL;
3097 char *attr_style = NULL;
3098 char *attr_color = NULL;
3099 char *attr_blink = NULL;
3100 char *css_clear = NULL;
3102 jxhtml = GET_JXHTML(pdoc);
3106 for (attr = qs_get_attr(doc,node);
3108 attr = qs_get_next_attr(doc,attr)) {
3109 char *nm = qs_get_attr_name(doc,attr);
3110 char *val = qs_get_attr_value(doc,attr);
3111 if (STRCASEEQ('a','A',"align", nm)) {
3112 /*----------------------------------------------------------------------*/
3113 /* CHTML 1.0 (W3C version 3.2) */
3114 /*----------------------------------------------------------------------*/
3115 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3116 attr_align = apr_pstrdup(doc->buf.pool, val);
3120 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3121 attr_style = apr_pstrdup(doc->buf.pool, val);
3124 if (IS_CSS_ON(jxhtml->entryp)) {
3125 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3127 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3128 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3129 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3130 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3131 css_property_t *cur;
3132 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3133 if (STRCASEEQ('l','L',"left",cur->value)) {
3134 attr_align = apr_pstrdup(doc->pool, "left");
3136 else if (STRCASEEQ('c','C',"center",cur->value)) {
3137 attr_align = apr_pstrdup(doc->pool, "center");
3139 else if (STRCASEEQ('r','R',"right",cur->value)) {
3140 attr_align = apr_pstrdup(doc->pool, "right");
3143 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3144 if (cur->value && *cur->value) {
3145 attr_color = apr_pstrdup(doc->pool, cur->value);
3148 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3149 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3150 attr_blink = apr_pstrdup(doc->pool, cur->value);
3153 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3154 css_clear = apr_pstrdup(doc->pool, cur->value);
3159 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3167 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3173 W_L("text-decoration:");
3190 * It is a handler who processes the P tag.
3192 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3193 * destination is specified.
3194 * @param node [i] The P tag node is specified.
3195 * @return The conversion result is returned.
3198 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3200 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3201 Doc *doc = jxhtml->doc;
3204 if (IS_CSS_ON(jxhtml->entryp)) {
3205 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3212 * It is a handler who processes the PRE tag.
3214 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3215 * destination is specified.
3216 * @param node [i] The PRE tag node is specified.
3217 * @return The conversion result is returned.
3220 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3222 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3223 Doc *doc = jxhtml->doc;
3225 char *attr_style = NULL;
3226 char *css_clear = NULL;
3228 for (attr = qs_get_attr(doc,node);
3230 attr = qs_get_next_attr(doc,attr)) {
3231 char *nm = qs_get_attr_name(doc,attr);
3232 char *val = qs_get_attr_value(doc,attr);
3233 if (val && STRCASEEQ('s','S',"style", nm)) {
3238 if (IS_CSS_ON(jxhtml->entryp)) {
3239 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3241 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3243 css_property_t *cur;
3244 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3245 css_clear = apr_pstrdup(doc->pool, cur->value);
3265 * It is a handler who processes the PRE tag.
3267 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3268 * destination is specified.
3269 * @param node [i] The PRE tag node is specified.
3270 * @return The conversion result is returned.
3273 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3275 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3276 Doc *doc = jxhtml->doc;
3280 if (IS_CSS_ON(jxhtml->entryp)) {
3281 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3289 * It is a handler who processes the UL tag.
3291 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3292 * destination is specified.
3293 * @param node [i] The UL tag node is specified.
3294 * @return The conversion result is returned.
3297 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3299 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3300 Doc *doc = jxhtml->doc;
3302 char *attr_type = NULL;
3303 char *attr_style = NULL;
3304 char *css_clear = NULL;
3306 /*--------------------------------------------------------------------------*/
3307 /* Get Attributes */
3308 /*--------------------------------------------------------------------------*/
3309 for (attr = qs_get_attr(doc,node);
3311 attr = qs_get_next_attr(doc,attr)) {
3312 char *name = qs_get_attr_name(doc,attr);
3313 char *value = qs_get_attr_value(doc,attr);
3314 if (STRCASEEQ('t','T',"type",name)) {
3315 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3319 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3323 if (IS_CSS_ON(jxhtml->entryp)) {
3324 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3326 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3327 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3329 css_property_t *cur;
3330 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3331 if (STRCASEEQ('d','D',"disc",cur->value)) {
3332 attr_type = apr_pstrdup(doc->pool, "disc");
3334 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3335 attr_type = apr_pstrdup(doc->pool, "circle");
3337 else if (STRCASEEQ('s','S',"square",cur->value)) {
3338 attr_type = apr_pstrdup(doc->pool, "square");
3341 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3342 css_clear = apr_pstrdup(doc->pool, cur->value);
3347 if (attr_type || css_clear) {
3350 W_L("list-style-type:");
3367 * It is a handler who processes the UL tag.
3369 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3370 * destination is specified.
3371 * @param node [i] The UL tag node is specified.
3372 * @return The conversion result is returned.
3375 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3377 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3378 Doc *doc = jxhtml->doc;
3381 if (IS_CSS_ON(jxhtml->entryp)) {
3382 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3389 * It is a handler who processes the HR tag.
3391 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3392 * destination is specified.
3393 * @param node [i] The HR tag node is specified.
3394 * @return The conversion result is returned.
3397 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3403 char *attr_align = NULL;
3404 char *attr_size = NULL;
3405 char *attr_width = NULL;
3406 char *attr_noshade = NULL;
3407 char *attr_style = NULL;
3408 char *attr_color = NULL;
3410 char *style_float = NULL;
3411 char *style_border_color = NULL;
3412 char *css_clear = NULL;
3414 jxhtml = GET_JXHTML(pdoc);
3418 for (attr = qs_get_attr(doc,node);
3420 attr = qs_get_next_attr(doc,attr)) {
3421 char *name = qs_get_attr_name (doc,attr);
3422 char *value = qs_get_attr_value(doc,attr);
3426 if (strcasecmp(name, "align") == 0) {
3427 /*--------------------------------------------------------------------*/
3429 /*--------------------------------------------------------------------*/
3430 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3438 if (strcasecmp(name, "size") == 0) {
3439 /*--------------------------------------------------------------------*/
3441 /*--------------------------------------------------------------------*/
3442 if (value && *value) {
3446 else if (strcasecmp(name, "style") == 0) {
3447 if (value && *value) {
3455 if (strcasecmp(name, "width") == 0) {
3456 /*--------------------------------------------------------------------*/
3458 /*--------------------------------------------------------------------*/
3459 if (value && *value) {
3467 if (strcasecmp(name, "noshade") == 0) {
3468 /*--------------------------------------------------------------------*/
3470 /*--------------------------------------------------------------------*/
3471 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3477 if (strcasecmp(name, "color") == 0 && value && *value) {
3478 /*--------------------------------------------------------------------*/
3480 /*--------------------------------------------------------------------*/
3489 if (IS_CSS_ON(jxhtml->entryp)) {
3490 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3492 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3493 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3494 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3496 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3497 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3498 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3499 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3500 css_property_t *cur;
3502 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3503 if (STRCASEEQ('s','S',"solid",cur->value)) {
3504 attr_noshade = "noshade";
3507 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3508 attr_size = apr_pstrdup(doc->pool, cur->value);
3511 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3512 char *tmp = apr_pstrdup(doc->pool,cur->value);
3513 attr_color = apr_pstrdup(doc->pool,tmp);
3516 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3517 char *tmp = apr_pstrdup(doc->pool, cur->value);
3518 char *tmpp = strstr(tmp,"none");
3520 style_float = "center";
3523 style_float = apr_pstrdup(doc->pool,tmp);
3528 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3529 char *tmp = apr_pstrdup(doc->pool, cur->value);
3530 char *tmpp = strstr(tmp, "px");
3532 attr_width = apr_pstrdup(doc->pool, tmp);
3535 tmpp = strstr(tmp, "%");
3537 attr_width = apr_pstrdup(doc->pool, tmp);
3542 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3543 char *tmp = apr_pstrdup(doc->pool, cur->value);
3545 style_border_color = apr_pstrdup(doc->pool, tmp);
3548 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3549 css_clear = apr_pstrdup(doc->pool, cur->value);
3566 if (attr_size || attr_width || attr_noshade || style_border_color || css_clear) {
3571 if (chxj_chk_numeric(attr_size) == 0) {
3579 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3585 W_L("border-style:solid;");
3587 if(style_border_color){
3588 W_L("border-color:");
3589 W_V(style_border_color);
3612 * It is a handler who processes the HR tag.
3614 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3615 * destination is specified.
3616 * @param node [i] The HR tag node is specified.
3617 * @return The conversion result is returned.
3620 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3622 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3628 * It is a handler who processes the IMG tag.
3630 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3631 * destination is specified.
3632 * @param node [i] The IMG tag node is specified.
3633 * @return The conversion result is returned.
3636 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3638 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3639 Doc *doc = jxhtml->doc;
3640 request_rec *r = doc->r;
3642 char *attr_src = NULL;
3643 char *attr_height = NULL;
3644 char *attr_width = NULL;
3645 char *attr_alt = NULL;
3646 char *attr_style = NULL;
3647 char *attr_hspace = NULL;
3648 char *attr_vspace = NULL;
3650 char *css_float = NULL;
3651 char *css_margin_left = NULL;
3652 char *css_margin_right = NULL;
3653 char *css_margin_top = NULL;
3654 char *css_margin_bottom = NULL;
3655 char *css_display = NULL;
3656 char *css_valign = NULL;
3658 #ifndef IMG_NOT_CONVERT_FILENAME
3659 device_table *spec = jxhtml->spec;
3662 /*--------------------------------------------------------------------------*/
3663 /* Get Attributes */
3664 /*--------------------------------------------------------------------------*/
3665 for (attr = qs_get_attr(doc,node);
3667 attr = qs_get_next_attr(doc,attr)) {
3668 char *name = qs_get_attr_name(doc,attr);
3669 char *value = qs_get_attr_value(doc,attr);
3670 if (STRCASEEQ('s','S',"src",name)) {
3671 /*----------------------------------------------------------------------*/
3673 /*----------------------------------------------------------------------*/
3674 #ifdef IMG_NOT_CONVERT_FILENAME
3675 value = chxj_encoding_parameter(r, value, 1);
3676 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3677 value = chxj_add_cookie_no_update_parameter(r, value);
3678 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3681 value = chxj_img_conv(r, spec, value);
3682 value = chxj_encoding_parameter(r, value, 1);
3683 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3684 value = chxj_add_cookie_no_update_parameter(r, value);
3685 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3689 else if (STRCASEEQ('a','A',"align",name)) {
3690 /*----------------------------------------------------------------------*/
3692 /*----------------------------------------------------------------------*/
3694 if (STRCASEEQ('t','T',"top", value) ||
3695 STRCASEEQ('m','M',"middle",value) ||
3696 STRCASEEQ('b','B',"bottom",value)){
3698 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3701 else if (STRCASEEQ('c','C',"center",value)) {
3702 css_valign = apr_pstrdup(doc->pool, "middle");
3706 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3707 /*----------------------------------------------------------------------*/
3709 /*----------------------------------------------------------------------*/
3712 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3713 /*----------------------------------------------------------------------*/
3715 /*----------------------------------------------------------------------*/
3716 attr_height = value;
3718 else if (STRCASEEQ('h','H',"hspace",name)) {
3719 /*----------------------------------------------------------------------*/
3721 /*----------------------------------------------------------------------*/
3722 attr_hspace = value;
3724 else if (STRCASEEQ('v','V',"vspace",name)) {
3725 /*----------------------------------------------------------------------*/
3727 /*----------------------------------------------------------------------*/
3728 attr_vspace = value;
3730 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3731 /*----------------------------------------------------------------------*/
3733 /*----------------------------------------------------------------------*/
3736 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3737 /*----------------------------------------------------------------------*/
3739 /*----------------------------------------------------------------------*/
3744 if (IS_CSS_ON(jxhtml->entryp)) {
3745 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3747 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3748 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3749 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3750 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3751 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3752 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3753 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3756 css_property_t *cur;
3757 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3758 attr_height = apr_pstrdup(doc->pool, cur->value);
3760 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3761 attr_width = apr_pstrdup(doc->pool, cur->value);
3764 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3765 css_valign = apr_pstrdup(doc->pool, cur->value);
3768 if (! attr_hspace) {
3769 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3770 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3772 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3773 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3776 if (! attr_vspace) {
3777 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3778 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3780 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3781 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3785 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3786 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3787 css_float = apr_pstrdup(doc->pool, cur->value);
3791 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3792 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3793 char *tmp = apr_pstrdup(doc->pool, cur->value);
3794 char *tmpp = strstr(tmp, "none");
3796 css_display = apr_pstrdup(doc->pool, tmp);
3808 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3816 W_L("vertical-align:");
3821 W_L("margin-left:");
3824 W_L("margin-right:");
3829 if(css_margin_left){
3830 W_L("margin-left:");
3831 W_V(css_margin_left);
3834 if(css_margin_right){
3835 W_L("margin-right:");
3836 W_V(css_margin_right);
3844 W_L("margin-bottom:");
3851 W_V(css_margin_top);
3854 if(css_margin_bottom){
3855 W_L("margin-bottom:");
3856 W_V(css_margin_bottom);
3861 W_L("display:none;");
3890 * It is a handler who processes the IMG tag.
3892 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3893 * destination is specified.
3894 * @param node [i] The IMG tag node is specified.
3895 * @return The conversion result is returned.
3898 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3900 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3906 * It is a handler who processes the SELECT tag.
3908 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3909 * destination is specified.
3910 * @param node [i] The SELECT tag node is specified.
3911 * @return The conversion result is returned.
3914 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3916 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3917 Doc *doc = jxhtml->doc;
3921 char *multiple = NULL;
3922 char *attr_style = NULL;
3925 for (attr = qs_get_attr(doc,node);
3927 attr = qs_get_next_attr(doc,attr)) {
3928 char *nm = qs_get_attr_name(doc,attr);
3929 char *val = qs_get_attr_value(doc,attr);
3930 if (STRCASEEQ('s','S',"size",nm)) {
3931 /*----------------------------------------------------------------------*/
3932 /* CHTML 1.0 version 2.0 */
3933 /*----------------------------------------------------------------------*/
3934 size = apr_pstrdup(doc->buf.pool, val);
3936 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3937 /*----------------------------------------------------------------------*/
3938 /* CHTML 1.0 version 2.0 */
3939 /*----------------------------------------------------------------------*/
3940 attr_style = apr_pstrdup(doc->buf.pool, val);
3942 else if (STRCASEEQ('n','N',"name",nm)) {
3943 /*----------------------------------------------------------------------*/
3944 /* CHTML 1.0 version 2.0 */
3945 /*----------------------------------------------------------------------*/
3946 name = apr_pstrdup(doc->buf.pool, val);
3948 else if (STRCASEEQ('m','M',"multiple", nm)) {
3949 /*----------------------------------------------------------------------*/
3950 /* CHTML 1.0 version 2.0 */
3951 /*----------------------------------------------------------------------*/
3952 multiple = apr_pstrdup(doc->buf.pool, val);
3955 if (size && *size) {
3960 if (name && *name) {
3970 if (IS_CSS_ON(jxhtml->entryp)) {
3971 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3979 * It is a handler who processes the SELECT tag.
3981 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3982 * destination is specified.
3983 * @param node [i] The SELECT tag node is specified.
3984 * @return The conversion result is returned.
3987 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3989 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3990 Doc *doc = jxhtml->doc;
3993 if (IS_CSS_ON(jxhtml->entryp)) {
3994 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4001 * It is a handler who processes the OPTION tag.
4003 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4004 * destination is specified.
4005 * @param node [i] The OPTION tag node is specified.
4006 * @return The conversion result is returned.
4009 s_jxhtml_start_option_tag(void *pdoc, Node *node)
4011 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4012 Doc *doc = jxhtml->doc;
4015 char *selected = NULL;
4017 char *attr_style = NULL;
4020 for (attr = qs_get_attr(doc,node);
4022 attr = qs_get_next_attr(doc,attr)) {
4023 char *nm = qs_get_attr_name(doc,attr);
4024 char *val = qs_get_attr_value(doc,attr);
4025 if (STRCASEEQ('s','S',"selected",nm)) {
4026 /*----------------------------------------------------------------------*/
4027 /* CHTML 1.0 version 2.0 */
4028 /*----------------------------------------------------------------------*/
4029 selected = apr_pstrdup(doc->buf.pool, val);
4031 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4032 /*----------------------------------------------------------------------*/
4033 /* CHTML 1.0 version 2.0 */
4034 /*----------------------------------------------------------------------*/
4035 attr_style = apr_pstrdup(doc->buf.pool, val);
4037 else if (STRCASEEQ('v','V',"value",nm)) {
4038 /*----------------------------------------------------------------------*/
4039 /* CHTML 1.0 version 2.0 */
4040 /*----------------------------------------------------------------------*/
4041 value = apr_pstrdup(doc->buf.pool, val);
4054 if (IS_CSS_ON(jxhtml->entryp)) {
4055 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4063 * It is a handler who processes the OPTION tag.
4065 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4066 * destination is specified.
4067 * @param node [i] The OPTION tag node is specified.
4068 * @return The conversion result is returned.
4071 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
4073 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4074 Doc *doc = jxhtml->doc;
4077 if (IS_CSS_ON(jxhtml->entryp)) {
4078 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4086 * It is a handler who processes the DIV tag.
4088 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4089 * destination is specified.
4090 * @param node [i] The DIV tag node is specified.
4091 * @return The conversion result is returned.
4094 s_jxhtml_start_div_tag(void *pdoc, Node *node)
4100 char *attr_style = NULL;
4101 char *attr_align = NULL;
4102 char *attr_display = NULL;
4103 char *attr_decoration = NULL;
4104 char *attr_wap_marquee_style = NULL;
4105 char *attr_wap_marquee_dir = NULL;
4106 char *attr_wap_marquee_loop = NULL;
4107 char *attr_color = NULL;
4108 char *attr_bgcolor = NULL;
4109 char *attr_font_size = NULL;
4110 char *css_clear = NULL;
4112 jxhtml = GET_JXHTML(pdoc);
4116 for (attr = qs_get_attr(doc,node);
4118 attr = qs_get_next_attr(doc,attr)) {
4119 char *nm = qs_get_attr_name(doc,attr);
4120 char *val = qs_get_attr_value(doc,attr);
4121 if (STRCASEEQ('a','A',"align",nm)) {
4122 /*----------------------------------------------------------------------*/
4123 /* CHTML 1.0 (W3C version 3.2) */
4124 /*----------------------------------------------------------------------*/
4125 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4126 attr_align = apr_pstrdup(doc->buf.pool, val);
4129 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4130 attr_style = apr_pstrdup(doc->buf.pool, val);
4134 if (IS_CSS_ON(jxhtml->entryp)) {
4135 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4137 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4138 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4139 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4140 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4141 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4142 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4143 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4144 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4146 css_property_t *cur;
4147 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4148 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4149 attr_display = apr_pstrdup(doc->pool, cur->value);
4152 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4153 if (STRCASEEQ('b','B',"blink", cur->value)) {
4154 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4157 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4158 attr_color = apr_pstrdup(doc->pool, cur->value);
4160 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4161 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4162 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4164 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4165 char *ss = strchr(cur->value, '#');
4167 ss = strstr(cur->value, "rgb");
4170 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4171 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4174 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4175 attr_align = apr_pstrdup(doc->pool, cur->value);
4177 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4178 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4179 || STRCASEEQ('x','X',"x-small",cur->value)
4180 || STRCASEEQ('s','S',"small",cur->value)
4181 || STRCASEEQ('m','M',"medium",cur->value)
4182 || STRCASEEQ('l','L',"large",cur->value)
4183 || STRCASEEQ('x','X',"x-large",cur->value)
4184 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4185 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4189 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4190 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4191 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4192 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4193 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4194 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4197 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4198 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4199 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4201 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4202 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4205 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4206 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4207 attr_wap_marquee_loop = "infinite";
4210 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4214 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4215 css_clear = apr_pstrdup(doc->pool, cur->value);
4223 || attr_wap_marquee_style
4224 || attr_wap_marquee_dir
4225 || attr_wap_marquee_loop
4241 if (attr_decoration) {
4242 W_L("text-decoration:");
4243 W_V(attr_decoration);
4246 if (attr_wap_marquee_style) {
4247 W_L("-wap-marquee-style:");
4248 W_V(attr_wap_marquee_style);
4251 if (attr_wap_marquee_dir) {
4252 W_L("-wap-marquee-dir:");
4253 W_V(attr_wap_marquee_dir);
4256 if (attr_wap_marquee_loop) {
4257 W_L("-wap-marquee-loop:");
4258 W_V(attr_wap_marquee_loop);
4267 W_L("background-color:");
4271 if (attr_font_size) {
4273 W_V(attr_font_size);
4289 * It is a handler who processes the DIV tag.
4291 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4292 * destination is specified.
4293 * @param node [i] The DIV tag node is specified.
4294 * @return The conversion result is returned.
4297 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4303 jxhtml = GET_JXHTML(pdoc);
4308 if (IS_CSS_ON(jxhtml->entryp)) {
4309 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4316 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4323 jxhtml = GET_JXHTML(pdoc);
4327 for (child = qs_get_child_node(doc, node);
4329 child = qs_get_next_node(doc, child)) {
4331 s_jxhtml_chxjif_tag(jxhtml, child);
4338 * It is a handler who processes the TEXTARE tag.
4340 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4341 * destination is specified.
4342 * @param node [i] The TEXTAREA tag node is specified.
4343 * @return The conversion result is returned.
4346 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4352 char *attr_accesskey = NULL;
4353 char *attr_name = NULL;
4354 char *attr_rows = NULL;
4355 char *attr_cols = NULL;
4356 char *attr_istyle = NULL;
4357 char *attr_style = NULL;
4360 jxhtml = GET_JXHTML(pdoc);
4364 jxhtml->textarea_flag++;
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',"accesskey",name) && value && *value != 0) {
4371 attr_accesskey = value;
4373 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4374 attr_istyle = value;
4376 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4379 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4382 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4385 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4389 if (IS_CSS_ON(jxhtml->entryp)) {
4390 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4392 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4393 css_property_t *cur;
4394 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4395 if (strcasestr(cur->value, "<ja:n>")) {
4398 else if (strcasestr(cur->value, "<ja:en>")) {
4401 else if (strcasestr(cur->value, "<ja:hk>")) {
4404 else if (strcasestr(cur->value, "<ja:h>")) {
4411 if (attr_accesskey) {
4412 W_L(" accesskey=\"");
4413 W_V(attr_accesskey);
4436 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
4438 W_L("-wap-input-format:");
4450 * It is a handler who processes the TEXTAREA tag.
4452 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4453 * destination is specified.
4454 * @param node [i] The TEXTAREA tag node is specified.
4455 * @return The conversion result is returned.
4458 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4464 jxhtml = GET_JXHTML(pdoc);
4469 jxhtml->textarea_flag--;
4476 * It is a handler who processes the B tag.
4478 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4479 * destination is specified.
4480 * @param node [i] The B tag node is specified.
4481 * @return The conversion result is returned.
4484 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4490 jxhtml = GET_JXHTML(pdoc);
4500 * It is a handler who processes the B tag.
4502 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4503 * destination is specified.
4504 * @param node [i] The B tag node is specified.
4505 * @return The conversion result is returned.
4508 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4510 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4511 Doc* doc = jxhtml->doc;
4518 s_jxhtml_text_tag(void* pdoc, Node* child)
4529 apr_size_t z2h_input_len;
4531 jxhtml = GET_JXHTML(pdoc);
4535 textval = qs_get_node_value(doc,child);
4536 if (strlen(textval) == 0) {
4540 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4541 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4543 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4544 memset(one_byte, 0, sizeof(one_byte));
4547 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4549 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4551 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4556 if (is_sjis_kanji(textval[ii])) {
4557 one_byte[0] = textval[ii+0];
4558 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4559 one_byte[0] = textval[ii+1];
4560 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4564 if (jxhtml->pre_flag) {
4565 one_byte[0] = textval[ii+0];
4566 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4569 if (jxhtml->textarea_flag) {
4570 one_byte[0] = textval[ii+0];
4571 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4574 if (textval[ii] != '\r' && textval[ii] != '\n') {
4575 one_byte[0] = textval[ii+0];
4576 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4580 z2h_input_len = strlen(tdst);
4581 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4589 * It is a handler who processes the BLOCKQUOTE tag.
4591 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4592 * destination is specified.
4593 * @param node [i] The BLOCKQUOTE tag node is specified.
4594 * @return The conversion result is returned.
4597 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4602 char *attr_style = NULL;
4603 char *attr_color = NULL;
4604 char *attr_size = NULL;
4605 char *css_clear = NULL;
4607 jxhtml = GET_JXHTML(pdoc);
4609 for (attr = qs_get_attr(doc,node);
4611 attr = qs_get_next_attr(doc,attr)) {
4612 char *nm = qs_get_attr_name(doc,attr);
4613 char *val = qs_get_attr_value(doc,attr);
4614 if (val && STRCASEEQ('s','S',"style", nm)) {
4618 if (IS_CSS_ON(jxhtml->entryp)) {
4619 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4621 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4622 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4623 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4625 css_property_t *cur;
4626 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4627 if (cur->value && *cur->value) {
4628 attr_color = apr_pstrdup(doc->pool, cur->value);
4631 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4632 if (cur->value && *cur->value) {
4633 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4634 attr_size = apr_pstrdup(doc->pool, cur->value);
4636 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4637 attr_size = apr_pstrdup(doc->pool, cur->value);
4639 else if (STRCASEEQ('s','S',"small",cur->value)) {
4640 attr_size = apr_pstrdup(doc->pool, cur->value);
4642 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4643 attr_size = apr_pstrdup(doc->pool, cur->value);
4645 else if (STRCASEEQ('l','L',"large",cur->value)) {
4646 attr_size = apr_pstrdup(doc->pool, cur->value);
4648 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4649 attr_size = apr_pstrdup(doc->pool, cur->value);
4651 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4652 attr_size = apr_pstrdup(doc->pool, cur->value);
4656 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4657 css_clear = apr_pstrdup(doc->pool, cur->value);
4662 if (attr_color || attr_size || css_clear) {
4665 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4688 * It is a handler who processes the BLOCKQUOTE tag.
4690 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4691 * destination is specified.
4692 * @param node [i] The BLOCKQUOTE tag node is specified.
4693 * @return The conversion result is returned.
4696 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4698 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4699 Doc *doc = jxhtml->doc;
4700 W_L("</blockquote>");
4701 if (IS_CSS_ON(jxhtml->entryp)) {
4702 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4709 * It is a handler who processes the DIR tag.
4711 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4712 * destination is specified.
4713 * @param node [i] The DIR tag node is specified.
4714 * @return The conversion result is returned.
4717 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4719 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4720 Doc *doc = jxhtml->doc;
4722 char *attr_style = NULL;
4723 char *attr_color = NULL;
4724 char *attr_type = NULL;
4725 char *attr_size = NULL;
4726 for (attr = qs_get_attr(doc,node);
4728 attr = qs_get_next_attr(doc,attr)) {
4729 char *name = qs_get_attr_name(doc,attr);
4730 char *value = qs_get_attr_value(doc,attr);
4731 if (STRCASEEQ('t','T',"type",name)) {
4732 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4736 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4740 if (IS_CSS_ON(jxhtml->entryp)) {
4741 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4743 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4744 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4745 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4746 css_property_t *cur;
4747 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4748 if (cur->value && *cur->value) {
4749 attr_color = apr_pstrdup(doc->pool, cur->value);
4752 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4753 if (cur->value && *cur->value) {
4754 attr_type = apr_pstrdup(doc->pool, cur->value);
4757 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4758 if (cur->value && *cur->value) {
4759 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4760 attr_size = apr_pstrdup(doc->pool, cur->value);
4762 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4763 attr_size = apr_pstrdup(doc->pool, cur->value);
4765 else if (STRCASEEQ('s','S',"small",cur->value)) {
4766 attr_size = apr_pstrdup(doc->pool, cur->value);
4768 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4769 attr_size = apr_pstrdup(doc->pool, cur->value);
4771 else if (STRCASEEQ('l','L',"large",cur->value)) {
4772 attr_size = apr_pstrdup(doc->pool, cur->value);
4774 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4775 attr_size = apr_pstrdup(doc->pool, cur->value);
4777 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4778 attr_size = apr_pstrdup(doc->pool, cur->value);
4785 if (attr_type || attr_color || attr_size) {
4788 W_L("list-style-type:");
4793 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4811 * It is a handler who processes the DIR tag.
4813 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4814 * destination is specified.
4815 * @param node [i] The DIR tag node is specified.
4816 * @return The conversion result is returned.
4819 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4821 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4822 Doc *doc = jxhtml->doc;
4824 if (IS_CSS_ON(jxhtml->entryp)) {
4825 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4832 * It is a handler who processes the DL tag.
4834 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4835 * destination is specified.
4836 * @param node [i] The DL tag node is specified.
4837 * @return The conversion result is returned.
4840 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4842 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4843 Doc *doc = jxhtml->doc;
4845 char *attr_style = NULL;
4846 char *attr_color = NULL;
4847 char *attr_size = NULL;
4848 char *css_clear = NULL;
4850 for (attr = qs_get_attr(doc,node);
4852 attr = qs_get_next_attr(doc,attr)) {
4853 char *name = qs_get_attr_name(doc,attr);
4854 char *value = qs_get_attr_value(doc,attr);
4855 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4859 if (IS_CSS_ON(jxhtml->entryp)) {
4860 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4862 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4863 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4864 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4866 css_property_t *cur;
4867 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4868 if (cur->value && *cur->value) {
4869 attr_color = apr_pstrdup(doc->pool, cur->value);
4872 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4873 if (cur->value && *cur->value) {
4874 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4875 attr_size = apr_pstrdup(doc->pool, cur->value);
4877 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4878 attr_size = apr_pstrdup(doc->pool, cur->value);
4880 else if (STRCASEEQ('s','S',"small",cur->value)) {
4881 attr_size = apr_pstrdup(doc->pool, cur->value);
4883 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4884 attr_size = apr_pstrdup(doc->pool, cur->value);
4886 else if (STRCASEEQ('l','L',"large",cur->value)) {
4887 attr_size = apr_pstrdup(doc->pool, cur->value);
4889 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4890 attr_size = apr_pstrdup(doc->pool, cur->value);
4892 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4893 attr_size = apr_pstrdup(doc->pool, cur->value);
4897 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4898 css_clear = apr_pstrdup(doc->pool, cur->value);
4903 if (attr_color || attr_size || css_clear) {
4906 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4929 * It is a handler who processes the DL tag.
4931 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4932 * destination is specified.
4933 * @param node [i] The DL tag node is specified.
4934 * @return The conversion result is returned.
4937 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4939 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4940 Doc *doc = jxhtml->doc;
4942 if (IS_CSS_ON(jxhtml->entryp)) {
4943 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4950 * It is a handler who processes the DT tag.
4952 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4953 * destination is specified.
4954 * @param node [i] The DT tag node is specified.
4955 * @return The conversion result is returned.
4958 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4960 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4961 Doc *doc = jxhtml->doc;
4963 char *attr_style = NULL;
4964 char *attr_color = NULL;
4965 char *attr_size = NULL;
4966 for (attr = qs_get_attr(doc,node);
4968 attr = qs_get_next_attr(doc,attr)) {
4969 char *name = qs_get_attr_name(doc,attr);
4970 char *value = qs_get_attr_value(doc,attr);
4971 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4975 if (IS_CSS_ON(jxhtml->entryp)) {
4976 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4978 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4979 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4980 css_property_t *cur;
4981 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4982 if (cur->value && *cur->value) {
4983 attr_color = apr_pstrdup(doc->pool, cur->value);
4986 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4987 if (cur->value && *cur->value) {
4988 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4989 attr_size = apr_pstrdup(doc->pool, cur->value);
4991 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4992 attr_size = apr_pstrdup(doc->pool, cur->value);
4994 else if (STRCASEEQ('s','S',"small",cur->value)) {
4995 attr_size = apr_pstrdup(doc->pool, cur->value);
4997 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4998 attr_size = apr_pstrdup(doc->pool, cur->value);
5000 else if (STRCASEEQ('l','L',"large",cur->value)) {
5001 attr_size = apr_pstrdup(doc->pool, cur->value);
5003 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5004 attr_size = apr_pstrdup(doc->pool, cur->value);
5006 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5007 attr_size = apr_pstrdup(doc->pool, cur->value);
5014 if (attr_color || attr_size) {
5017 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5035 * It is a handler who processes the DT tag.
5037 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5038 * destination is specified.
5039 * @param node [i] The DT tag node is specified.
5040 * @return The conversion result is returned.
5043 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
5045 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5046 Doc *doc = jxhtml->doc;
5048 if (IS_CSS_ON(jxhtml->entryp)) {
5049 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5056 * It is a handler who processes the DD tag.
5058 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5059 * destination is specified.
5060 * @param node [i] The DD tag node is specified.
5061 * @return The conversion result is returned.
5064 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
5066 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5067 Doc *doc = jxhtml->doc;
5069 char *attr_style = NULL;
5070 char *attr_color = NULL;
5071 char *attr_size = NULL;
5072 for (attr = qs_get_attr(doc,node);
5074 attr = qs_get_next_attr(doc,attr)) {
5075 char *name = qs_get_attr_name(doc,attr);
5076 char *value = qs_get_attr_value(doc,attr);
5077 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5081 if (IS_CSS_ON(jxhtml->entryp)) {
5082 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5084 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5085 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5086 css_property_t *cur;
5087 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5088 if (cur->value && *cur->value) {
5089 attr_color = apr_pstrdup(doc->pool, cur->value);
5092 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5093 if (cur->value && *cur->value) {
5094 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5095 attr_size = apr_pstrdup(doc->pool, cur->value);
5097 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5098 attr_size = apr_pstrdup(doc->pool, cur->value);
5100 else if (STRCASEEQ('s','S',"small",cur->value)) {
5101 attr_size = apr_pstrdup(doc->pool, cur->value);
5103 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5104 attr_size = apr_pstrdup(doc->pool, cur->value);
5106 else if (STRCASEEQ('l','L',"large",cur->value)) {
5107 attr_size = apr_pstrdup(doc->pool, cur->value);
5109 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5110 attr_size = apr_pstrdup(doc->pool, cur->value);
5112 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5113 attr_size = apr_pstrdup(doc->pool, cur->value);
5120 if (attr_color || attr_size) {
5123 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5141 * It is a handler who processes the DD tag.
5143 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5144 * destination is specified.
5145 * @param node [i] The DD tag node is specified.
5146 * @return The conversion result is returned.
5149 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5151 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5152 Doc *doc = jxhtml->doc;
5154 if (IS_CSS_ON(jxhtml->entryp)) {
5155 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5162 * It is a handler who processes the H1 tag.
5164 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5165 * destination is specified.
5166 * @param node [i] The H1 tag node is specified.
5167 * @return The conversion result is returned.
5170 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5176 char *attr_style = NULL;
5177 char *attr_align = NULL;
5178 char *css_clear = NULL;
5180 jxhtml = GET_JXHTML(pdoc);
5184 for (attr = qs_get_attr(doc,node);
5186 attr = qs_get_next_attr(doc,attr)) {
5187 char *name = qs_get_attr_name(doc,attr);
5188 char *value = qs_get_attr_value(doc,attr);
5189 if (STRCASEEQ('a','A',"align", name)) {
5190 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5194 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5198 if (IS_CSS_ON(jxhtml->entryp)) {
5199 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5201 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5202 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5203 css_property_t *cur;
5204 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5205 if (STRCASEEQ('l','L',"left", cur->value)) {
5206 attr_align = apr_pstrdup(doc->pool, "left");
5208 else if (STRCASEEQ('c','C',"center",cur->value)) {
5209 attr_align = apr_pstrdup(doc->pool, "center");
5211 else if (STRCASEEQ('r','R',"right",cur->value)) {
5212 attr_align = apr_pstrdup(doc->pool, "right");
5215 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5216 if (STRCASEEQ('b','B',"both", cur->value)) {
5217 css_clear = apr_pstrdup(doc->pool, "both");
5219 else if (STRCASEEQ('r','R',"right", cur->value)) {
5220 css_clear = apr_pstrdup(doc->pool, "right");
5222 else if (STRCASEEQ('l','L',"left", cur->value)) {
5223 css_clear = apr_pstrdup(doc->pool, "left");
5229 if (attr_align || css_clear ) {
5250 * It is a handler who processes the H1 tag.
5252 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5253 * destination is specified.
5254 * @param node [i] The H1 tag node is specified.
5255 * @return The conversion result is returned.
5258 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5264 jxhtml = GET_JXHTML(pdoc);
5269 if (IS_CSS_ON(jxhtml->entryp)) {
5270 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5278 * It is a handler who processes the H2 tag.
5280 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5281 * destination is specified.
5282 * @param node [i] The H1 tag node is specified.
5283 * @return The conversion result is returned.
5286 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5292 char *attr_style = NULL;
5293 char *attr_align = NULL;
5294 char *css_clear = NULL;
5296 jxhtml = GET_JXHTML(pdoc);
5300 for (attr = qs_get_attr(doc,node);
5302 attr = qs_get_next_attr(doc,attr)) {
5303 char *name = qs_get_attr_name(doc,attr);
5304 char *value = qs_get_attr_value(doc,attr);
5305 if (STRCASEEQ('a','A',"align", name)) {
5306 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5310 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5314 if (IS_CSS_ON(jxhtml->entryp)) {
5315 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5317 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5318 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5319 css_property_t *cur;
5320 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5321 if (STRCASEEQ('l','L',"left", cur->value)) {
5322 attr_align = apr_pstrdup(doc->pool, "left");
5324 else if (STRCASEEQ('c','C',"center",cur->value)) {
5325 attr_align = apr_pstrdup(doc->pool, "center");
5327 else if (STRCASEEQ('r','R',"right",cur->value)) {
5328 attr_align = apr_pstrdup(doc->pool, "right");
5331 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5332 if (STRCASEEQ('b','B',"both", cur->value)) {
5333 css_clear = apr_pstrdup(doc->pool, "both");
5335 else if (STRCASEEQ('r','R',"right", cur->value)) {
5336 css_clear = apr_pstrdup(doc->pool, "right");
5338 else if (STRCASEEQ('l','L',"left", cur->value)) {
5339 css_clear = apr_pstrdup(doc->pool, "left");
5345 if (attr_align || css_clear ) {
5366 * It is a handler who processes the H2 tag.
5368 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5369 * destination is specified.
5370 * @param node [i] The H1 tag node is specified.
5371 * @return The conversion result is returned.
5374 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5380 jxhtml = GET_JXHTML(pdoc);
5385 if (IS_CSS_ON(jxhtml->entryp)) {
5386 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5393 * It is a handler who processes the H3 tag.
5395 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5396 * destination is specified.
5397 * @param node [i] The H1 tag node is specified.
5398 * @return The conversion result is returned.
5401 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5407 char *attr_style = NULL;
5408 char *attr_align = NULL;
5409 char *css_clear = NULL;
5411 jxhtml = GET_JXHTML(pdoc);
5415 for (attr = qs_get_attr(doc,node);
5417 attr = qs_get_next_attr(doc,attr)) {
5418 char *name = qs_get_attr_name(doc,attr);
5419 char *value = qs_get_attr_value(doc,attr);
5420 if (STRCASEEQ('a','A',"align", name)) {
5421 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5425 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5429 if (IS_CSS_ON(jxhtml->entryp)) {
5430 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5432 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5433 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5434 css_property_t *cur;
5435 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5436 if (STRCASEEQ('l','L',"left", cur->value)) {
5437 attr_align = apr_pstrdup(doc->pool, "left");
5439 else if (STRCASEEQ('c','C',"center",cur->value)) {
5440 attr_align = apr_pstrdup(doc->pool, "center");
5442 else if (STRCASEEQ('r','R',"right",cur->value)) {
5443 attr_align = apr_pstrdup(doc->pool, "right");
5446 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5447 if (STRCASEEQ('b','B',"both", cur->value)) {
5448 css_clear = apr_pstrdup(doc->pool, "both");
5450 else if (STRCASEEQ('r','R',"right", cur->value)) {
5451 css_clear = apr_pstrdup(doc->pool, "right");
5453 else if (STRCASEEQ('l','L',"left", cur->value)) {
5454 css_clear = apr_pstrdup(doc->pool, "left");
5460 if (attr_align || css_clear ) {
5481 * It is a handler who processes the H3 tag.
5483 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5484 * destination is specified.
5485 * @param node [i] The H1 tag node is specified.
5486 * @return The conversion result is returned.
5489 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5495 jxhtml = GET_JXHTML(pdoc);
5500 if (IS_CSS_ON(jxhtml->entryp)) {
5501 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5508 * It is a handler who processes the H4 tag.
5510 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5511 * destination is specified.
5512 * @param node [i] The H1 tag node is specified.
5513 * @return The conversion result is returned.
5516 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5522 char *attr_style = NULL;
5523 char *attr_align = NULL;
5524 char *css_clear = NULL;
5526 jxhtml = GET_JXHTML(pdoc);
5530 for (attr = qs_get_attr(doc,node);
5532 attr = qs_get_next_attr(doc,attr)) {
5533 char *name = qs_get_attr_name(doc,attr);
5534 char *value = qs_get_attr_value(doc,attr);
5535 if (STRCASEEQ('a','A',"align", name)) {
5536 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5540 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5544 if (IS_CSS_ON(jxhtml->entryp)) {
5545 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5547 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5548 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5549 css_property_t *cur;
5550 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5551 if (STRCASEEQ('l','L',"left", cur->value)) {
5552 attr_align = apr_pstrdup(doc->pool, "left");
5554 else if (STRCASEEQ('c','C',"center",cur->value)) {
5555 attr_align = apr_pstrdup(doc->pool, "center");
5557 else if (STRCASEEQ('r','R',"right",cur->value)) {
5558 attr_align = apr_pstrdup(doc->pool, "right");
5561 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5562 if (STRCASEEQ('b','B',"both", cur->value)) {
5563 css_clear = apr_pstrdup(doc->pool, "both");
5565 else if (STRCASEEQ('r','R',"right", cur->value)) {
5566 css_clear = apr_pstrdup(doc->pool, "right");
5568 else if (STRCASEEQ('l','L',"left", cur->value)) {
5569 css_clear = apr_pstrdup(doc->pool, "left");
5575 if (attr_align || css_clear ) {
5596 * It is a handler who processes the H4 tag.
5598 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5599 * destination is specified.
5600 * @param node [i] The H1 tag node is specified.
5601 * @return The conversion result is returned.
5604 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5610 jxhtml = GET_JXHTML(pdoc);
5615 if (IS_CSS_ON(jxhtml->entryp)) {
5616 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5624 * It is a handler who processes the H5 tag.
5626 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5627 * destination is specified.
5628 * @param node [i] The H1 tag node is specified.
5629 * @return The conversion result is returned.
5632 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5638 char *attr_style = NULL;
5639 char *attr_align = NULL;
5640 char *css_clear = NULL;
5642 jxhtml = GET_JXHTML(pdoc);
5646 for (attr = qs_get_attr(doc,node);
5648 attr = qs_get_next_attr(doc,attr)) {
5649 char *name = qs_get_attr_name(doc,attr);
5650 char *value = qs_get_attr_value(doc,attr);
5651 if (STRCASEEQ('a','A',"align", name)) {
5652 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5656 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5660 if (IS_CSS_ON(jxhtml->entryp)) {
5661 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5663 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5664 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5665 css_property_t *cur;
5666 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5667 if (STRCASEEQ('l','L',"left", cur->value)) {
5668 attr_align = apr_pstrdup(doc->pool, "left");
5670 else if (STRCASEEQ('c','C',"center",cur->value)) {
5671 attr_align = apr_pstrdup(doc->pool, "center");
5673 else if (STRCASEEQ('r','R',"right",cur->value)) {
5674 attr_align = apr_pstrdup(doc->pool, "right");
5677 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5678 if (STRCASEEQ('b','B',"both", cur->value)) {
5679 css_clear = apr_pstrdup(doc->pool, "both");
5681 else if (STRCASEEQ('r','R',"right", cur->value)) {
5682 css_clear = apr_pstrdup(doc->pool, "right");
5684 else if (STRCASEEQ('l','L',"left", cur->value)) {
5685 css_clear = apr_pstrdup(doc->pool, "left");
5691 if (attr_align || css_clear ) {
5712 * It is a handler who processes the H5 tag.
5714 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5715 * destination is specified.
5716 * @param node [i] The H1 tag node is specified.
5717 * @return The conversion result is returned.
5720 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5726 jxhtml = GET_JXHTML(pdoc);
5731 if (IS_CSS_ON(jxhtml->entryp)) {
5732 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5740 * It is a handler who processes the H6 tag.
5742 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5743 * destination is specified.
5744 * @param node [i] The H1 tag node is specified.
5745 * @return The conversion result is returned.
5748 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5754 char *attr_style = NULL;
5755 char *attr_align = NULL;
5756 char *css_clear = NULL;
5758 jxhtml = GET_JXHTML(pdoc);
5762 for (attr = qs_get_attr(doc,node);
5764 attr = qs_get_next_attr(doc,attr)) {
5765 char *name = qs_get_attr_name(doc,attr);
5766 char *value = qs_get_attr_value(doc,attr);
5767 if (STRCASEEQ('a','A',"align", name)) {
5768 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5772 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5776 if (IS_CSS_ON(jxhtml->entryp)) {
5777 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5779 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5780 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5781 css_property_t *cur;
5782 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5783 if (STRCASEEQ('l','L',"left", cur->value)) {
5784 attr_align = apr_pstrdup(doc->pool, "left");
5786 else if (STRCASEEQ('c','C',"center",cur->value)) {
5787 attr_align = apr_pstrdup(doc->pool, "center");
5789 else if (STRCASEEQ('r','R',"right",cur->value)) {
5790 attr_align = apr_pstrdup(doc->pool, "right");
5793 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5794 if (STRCASEEQ('b','B',"both", cur->value)) {
5795 css_clear = apr_pstrdup(doc->pool, "both");
5797 else if (STRCASEEQ('r','R',"right", cur->value)) {
5798 css_clear = apr_pstrdup(doc->pool, "right");
5800 else if (STRCASEEQ('l','L',"left", cur->value)) {
5801 css_clear = apr_pstrdup(doc->pool, "left");
5807 if (attr_align || css_clear ) {
5828 * It is a handler who processes the H6 tag.
5830 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5831 * destination is specified.
5832 * @param node [i] The H1 tag node is specified.
5833 * @return The conversion result is returned.
5836 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5842 jxhtml = GET_JXHTML(pdoc);
5847 if (IS_CSS_ON(jxhtml->entryp)) {
5848 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5856 * It is a handler who processes the MENU tag.
5858 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5859 * destination is specified.
5860 * @param node [i] The MENU tag node is specified.
5861 * @return The conversion result is returned.
5864 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5866 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5867 Doc *doc = jxhtml->doc;
5869 char *attr_style = NULL;
5870 char *attr_color = NULL;
5871 char *attr_type = NULL;
5872 char *attr_size = NULL;
5873 for (attr = qs_get_attr(doc,node);
5875 attr = qs_get_next_attr(doc,attr)) {
5876 char *name = qs_get_attr_name(doc,attr);
5877 char *value = qs_get_attr_value(doc,attr);
5878 if (STRCASEEQ('t','T',"type",name)) {
5879 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5883 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5887 if (IS_CSS_ON(jxhtml->entryp)) {
5888 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5890 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5891 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5892 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5893 css_property_t *cur;
5894 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5895 if (cur->value && *cur->value) {
5896 attr_color = apr_pstrdup(doc->pool, cur->value);
5899 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5900 if (cur->value && *cur->value) {
5901 attr_type = apr_pstrdup(doc->pool, cur->value);
5904 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5905 if (cur->value && *cur->value) {
5906 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5907 attr_size = apr_pstrdup(doc->pool, cur->value);
5909 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5910 attr_size = apr_pstrdup(doc->pool, cur->value);
5912 else if (STRCASEEQ('s','S',"small",cur->value)) {
5913 attr_size = apr_pstrdup(doc->pool, cur->value);
5915 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5916 attr_size = apr_pstrdup(doc->pool, cur->value);
5918 else if (STRCASEEQ('l','L',"large",cur->value)) {
5919 attr_size = apr_pstrdup(doc->pool, cur->value);
5921 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5922 attr_size = apr_pstrdup(doc->pool, cur->value);
5924 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5925 attr_size = apr_pstrdup(doc->pool, cur->value);
5932 if (attr_type || attr_color || attr_size) {
5935 W_L("list-style-type:");
5940 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5958 * It is a handler who processes the MENU tag.
5960 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5961 * destination is specified.
5962 * @param node [i] The MENU tag node is specified.
5963 * @return The conversion result is returned.
5966 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5968 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5969 Doc *doc = jxhtml->doc;
5971 if (IS_CSS_ON(jxhtml->entryp)) {
5972 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5979 * It is a handler who processes the PLAINTEXT tag.
5981 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5982 * destination is specified.
5983 * @param node [i] The PLAINTEXT tag node is specified.
5984 * @return The conversion result is returned.
5987 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5992 jxhtml = GET_JXHTML(pdoc);
5995 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
6000 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
6005 jxhtml = GET_JXHTML(pdoc);
6007 for (child = qs_get_child_node(doc, node);
6009 child = qs_get_next_node(doc, child)) {
6011 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
6018 * It is a handler who processes the PLAINTEXT tag.
6020 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6021 * destination is specified.
6022 * @param node [i] The PLAINTEXT tag node is specified.
6023 * @return The conversion result is returned.
6026 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6028 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6034 * It is a handler who processes the BLINK tag.
6036 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6037 * destination is specified.
6038 * @param node [i] The BLINK tag node is specified.
6039 * @return The conversion result is returned.
6042 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
6044 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6045 Doc *doc = jxhtml->doc;
6047 char *attr_style = NULL;
6048 char *attr_color = NULL;
6049 char *attr_size = NULL;
6050 for (attr = qs_get_attr(doc,node);
6052 attr = qs_get_next_attr(doc,attr)) {
6053 char *name = qs_get_attr_name(doc,attr);
6054 char *value = qs_get_attr_value(doc,attr);
6055 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6059 if (IS_CSS_ON(jxhtml->entryp)) {
6060 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6062 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6063 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6064 css_property_t *cur;
6065 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6066 if (cur->value && *cur->value) {
6067 attr_color = apr_pstrdup(doc->pool, cur->value);
6070 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6071 if (cur->value && *cur->value) {
6072 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6073 attr_size = apr_pstrdup(doc->pool, cur->value);
6075 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6076 attr_size = apr_pstrdup(doc->pool, cur->value);
6078 else if (STRCASEEQ('s','S',"small",cur->value)) {
6079 attr_size = apr_pstrdup(doc->pool, cur->value);
6081 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6082 attr_size = apr_pstrdup(doc->pool, cur->value);
6084 else if (STRCASEEQ('l','L',"large",cur->value)) {
6085 attr_size = apr_pstrdup(doc->pool, cur->value);
6087 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6088 attr_size = apr_pstrdup(doc->pool, cur->value);
6090 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6091 attr_size = apr_pstrdup(doc->pool, cur->value);
6098 if (attr_color || attr_size) {
6101 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6119 * It is a handler who processes the BLINK tag.
6121 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6122 * destination is specified.
6123 * @param node [i] The BLINK tag node is specified.
6124 * @return The conversion result is returned.
6127 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6129 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6130 Doc *doc = jxhtml->doc;
6132 if (IS_CSS_ON(jxhtml->entryp)) {
6133 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6140 * It is a handler who processes the MARQUEE tag.
6142 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6143 * destination is specified.
6144 * @param node [i] The MARQUEE tag node is specified.
6145 * @return The conversion result is returned.
6148 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6150 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6151 Doc *doc = jxhtml->doc;
6153 char *attr_direction = NULL;
6154 char *attr_style = NULL;
6155 char *attr_color = NULL;
6156 char *attr_size = NULL;
6157 char *attr_bgcolor = NULL;
6158 /*--------------------------------------------------------------------------*/
6159 /* Get Attributes */
6160 /*--------------------------------------------------------------------------*/
6161 for (attr = qs_get_attr(doc,node);
6163 attr = qs_get_next_attr(doc,attr)) {
6164 char *name = qs_get_attr_name(doc,attr);
6165 char *value = qs_get_attr_value(doc,attr);
6166 if (STRCASEEQ('d','D',"direction", name)) {
6168 if (STRCASEEQ('l','L',"left",value)) {
6169 attr_direction = "rtl";
6171 else if (STRCASEEQ('r','R',"right",value)) {
6172 attr_direction = "ltr";
6176 else if (STRCASEEQ('b','B',"behavior",name)) {
6179 else if (STRCASEEQ('l','L',"loop",name)) {
6182 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6183 if (value && *value) {
6184 attr_bgcolor = value;
6187 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6191 if (IS_CSS_ON(jxhtml->entryp)) {
6192 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6194 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6195 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6196 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6197 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6198 css_property_t *cur;
6199 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6200 if (cur->value && *cur->value) {
6201 attr_color = apr_pstrdup(doc->pool, cur->value);
6204 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6205 if (cur->value && *cur->value) {
6206 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6209 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6210 if (cur->value && *cur->value) {
6211 attr_direction = apr_pstrdup(doc->pool, cur->value);
6214 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6215 if (cur->value && *cur->value) {
6216 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6217 || STRCASEEQ('x','X',"x-small", cur->value)
6218 || STRCASEEQ('s','S',"small", cur->value)
6219 || STRCASEEQ('m','M',"medium", cur->value)
6220 || STRCASEEQ('l','L',"large", cur->value)
6221 || STRCASEEQ('x','X',"x-large", cur->value)
6222 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6223 attr_size = apr_pstrdup(doc->pool, cur->value);
6230 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6232 if (attr_direction) {
6233 W_L("-wap-marquee-dir:");
6234 W_V(attr_direction);
6238 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6239 W_L("background-color:");
6244 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6263 * It is a handler who processes the MARQUEE tag.
6265 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6266 * destination is specified.
6267 * @param node [i] The MARQUEE tag node is specified.
6268 * @return The conversion result is returned.
6271 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6273 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6274 Doc *doc = jxhtml->doc;
6276 if (IS_CSS_ON(jxhtml->entryp)) {
6277 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6284 * It is handler who processes the New Line Code.
6287 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6289 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6290 if (jxhtml->start_html_flag) {
6291 Doc *doc = jxhtml->doc;
6299 * It is a handler who processes the LINK tag.
6301 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6302 * destination is specified.
6303 * @param node [i] The LINK tag node is specified.
6304 * @return The conversion result is returned.
6307 s_jxhtml_link_tag(void *pdoc, Node *node)
6316 jxhtml = GET_JXHTML(pdoc);
6319 if (! IS_CSS_ON(jxhtml->entryp)) {
6323 for (attr = qs_get_attr(doc,node);
6325 attr = qs_get_next_attr(doc,attr)) {
6326 char *name = qs_get_attr_name(doc,attr);
6327 char *value = qs_get_attr_value(doc,attr);
6328 if (STRCASEEQ('r','R',"rel", name)) {
6329 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6333 else if (STRCASEEQ('h','H',"href", name)) {
6334 if (value && *value) {
6338 else if (STRCASEEQ('t','T',"type", name)) {
6339 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6345 if (rel && href && type) {
6346 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6347 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6348 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6355 static css_prop_list_t *
6356 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6358 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6359 Doc *doc = jxhtml->doc;
6360 css_prop_list_t *last_css = NULL;
6361 if (IS_CSS_ON(jxhtml->entryp)) {
6362 css_prop_list_t *dup_css;
6363 css_selector_t *selector;
6365 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6366 dup_css = chxj_dup_css_prop_list(doc, last_css);
6367 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6369 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6371 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6372 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6374 if (style_attr_value) {
6375 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));
6377 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6385 static css_prop_list_t *
6386 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6388 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6389 Doc *doc = jxhtml->doc;
6390 css_prop_list_t *last_css = NULL;
6391 if (IS_CSS_ON(jxhtml->entryp)) {
6392 css_prop_list_t *dup_css;
6393 css_selector_t *selector;
6395 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6396 dup_css = chxj_dup_css_prop_list(doc, last_css);
6397 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6399 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6403 if (style_attr_value) {
6404 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));
6406 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6415 * It is a handler who processes the SPAN tag.
6417 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6418 * destination is specified.
6419 * @param node [i] The SPAN tag node is specified.
6420 * @return The conversion result is returned.
6423 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6428 char *attr_style = NULL;
6429 char *attr_color = NULL;
6430 char *attr_size = NULL;
6431 char *attr_align = NULL;
6432 char *attr_blink = NULL;
6433 char *attr_marquee = NULL;
6434 char *attr_marquee_dir = NULL;
6435 char *attr_marquee_style = NULL;
6436 char *attr_marquee_loop = NULL;
6437 char *css_bgcolor = NULL;
6439 jxhtml = GET_JXHTML(pdoc);
6442 for (attr = qs_get_attr(doc,node);
6444 attr = qs_get_next_attr(doc,attr)) {
6445 char *nm = qs_get_attr_name(doc,attr);
6446 char *val = qs_get_attr_value(doc,attr);
6447 if (val && STRCASEEQ('s','S',"style", nm)) {
6451 if (IS_CSS_ON(jxhtml->entryp)) {
6452 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6454 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6455 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6456 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6457 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6458 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6459 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6460 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6461 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6462 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6464 css_property_t *cur;
6465 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6466 attr_color = apr_pstrdup(doc->pool, cur->value);
6468 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6469 if (cur->value && *cur->value) {
6470 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6471 || STRCASEEQ('x','X',"x-small", cur->value)
6472 || STRCASEEQ('s','S',"small", cur->value)
6473 || STRCASEEQ('m','M',"medium", cur->value)
6474 || STRCASEEQ('l','L',"large", cur->value)
6475 || STRCASEEQ('x','X',"x-large", cur->value)
6476 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6477 attr_size = apr_pstrdup(doc->pool, cur->value);
6481 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6482 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6483 attr_blink = apr_pstrdup(doc->pool, cur->value);
6486 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6487 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6488 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6491 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6492 if (cur->value && *cur->value) {
6493 if ( STRCASEEQ('l','L',"ltr",cur->value)
6494 || STRCASEEQ('r','R',"rtl",cur->value)) {
6495 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6499 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6500 if (cur->value && *cur->value) {
6501 if ( STRCASEEQ('s','S',"scroll",cur->value)
6502 || STRCASEEQ('s','S',"slide",cur->value)
6503 || STRCASEEQ('a','A',"alternate",cur->value)) {
6504 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6508 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6509 if (cur->value && *cur->value) {
6510 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6511 attr_marquee_loop = "infinite";
6514 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6518 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6519 if (STRCASEEQ('l','L',"left", cur->value)) {
6520 attr_align = apr_pstrdup(doc->pool, "left");
6522 else if (STRCASEEQ('c','C',"center",cur->value)) {
6523 attr_align = apr_pstrdup(doc->pool, "center");
6525 else if (STRCASEEQ('r','R',"right",cur->value)) {
6526 attr_align = apr_pstrdup(doc->pool, "right");
6529 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6530 if (cur->value && *cur->value) {
6531 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6538 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6541 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6557 W_L("text-decoration:");
6562 W_L("display:-wap-marquee;");
6563 if (attr_marquee_dir) {
6564 W_L("-wap-marquee-dir:");
6565 W_V(attr_marquee_dir);
6568 if (attr_marquee_style) {
6569 W_L("-wap-marquee-style:");
6570 W_V(attr_marquee_style);
6573 if (attr_marquee_loop) {
6574 W_L("-wap-marquee-loop:");
6575 W_V(attr_marquee_loop);
6580 W_L("background-color:");
6592 * It is a handler who processes the SPAN tag.
6594 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6595 * destination is specified.
6596 * @param node [i] The SPAN tag node is specified.
6597 * @return The conversion result is returned.
6600 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6602 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6603 Doc *doc = jxhtml->doc;
6606 if (IS_CSS_ON(jxhtml->entryp)) {
6607 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6614 * It is a handler who processes the STYLE tag.
6616 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6617 * destination is specified.
6618 * @param node [i] The STYLE tag node is specified.
6619 * @return The conversion result is returned.
6622 s_jxhtml_style_tag(void *pdoc, Node *node)
6631 jxhtml = GET_JXHTML(pdoc);
6634 if (! IS_CSS_ON(jxhtml->entryp)) {
6638 for (attr = qs_get_attr(doc,node);
6640 attr = qs_get_next_attr(doc,attr)) {
6641 char *name = qs_get_attr_name(doc,attr);
6642 char *value = qs_get_attr_value(doc,attr);
6643 if (STRCASEEQ('t','T',"type", name)) {
6644 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6652 for (child = qs_get_child_node(doc, node);
6654 child = qs_get_next_node(doc, child)) {
6655 char *name = qs_get_node_name(doc, child);
6656 if (STRCASEEQ('t','T',"text", name)) {
6657 char *value = qs_get_node_value(doc, child);
6658 if (value && *value) {
6659 style = apr_pstrcat(doc->r->pool, style, value, NULL);
6663 if (strlen(style) > 0) {
6664 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
6665 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, style);
6666 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
6672 * It is a handler who processes the OBJECT tag.
6674 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6675 * destination is specified.
6676 * @param node [i] The OBJECT tag node is specified.
6677 * @return The conversion result is returned.
6680 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6682 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6683 Doc *doc = jxhtml->doc;
6686 char *attr_id = NULL;
6687 char *attr_width = NULL;
6688 char *attr_height = NULL;
6689 char *attr_data = NULL;
6690 char *attr_type = NULL;
6691 char *attr_declare = NULL;
6692 char *attr_classid = NULL;
6693 char *attr_codebase = NULL;
6695 /*--------------------------------------------------------------------------*/
6696 /* Get Attributes */
6697 /*--------------------------------------------------------------------------*/
6698 for (attr = qs_get_attr(doc,node);
6700 attr = qs_get_next_attr(doc,attr)) {
6701 char *name = qs_get_attr_name(doc,attr);
6702 char *value = qs_get_attr_value(doc,attr);
6703 if (STRCASEEQ('i','I',"id",name)) {
6704 attr_id = apr_pstrdup(doc->pool, value);
6706 else if (STRCASEEQ('w','W',"width",name)) {
6707 attr_width = apr_pstrdup(doc->pool, value);
6709 else if (STRCASEEQ('h','H',"height",name)) {
6710 attr_height = apr_pstrdup(doc->pool, value);
6712 else if (STRCASEEQ('d','D',"data",name)) {
6713 attr_data = apr_pstrdup(doc->pool, value);
6715 else if (STRCASEEQ('t','T',"type",name)) {
6716 attr_type = apr_pstrdup(doc->pool, value);
6718 else if (STRCASEEQ('d','D',"declare",name)) {
6719 attr_declare = apr_pstrdup(doc->pool, value);
6721 else if (STRCASEEQ('c','C',"classid",name)) {
6722 attr_classid = apr_pstrdup(doc->pool, value);
6724 else if (STRCASEEQ('c','C',"codebase",name)) {
6725 attr_codebase = apr_pstrdup(doc->pool, value);
6757 W_L(" declare=\"declare\"");
6765 W_L(" codebase=\"");
6774 * It is a handler who processes the OBJECT tag.
6776 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6777 * destination is specified.
6778 * @param node [i] The OBJECT tag node is specified.
6779 * @return The conversion result is returned.
6782 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6784 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6785 Doc *doc = jxhtml->doc;
6791 * It is a handler who processes the OBJECT tag.
6793 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6794 * destination is specified.
6795 * @param node [i] The OBJECT tag node is specified.
6796 * @return The conversion result is returned.
6799 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6801 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6802 Doc *doc = jxhtml->doc;
6805 char *attr_name = NULL;
6806 char *attr_value = NULL;
6807 char *attr_valuetype = NULL;
6809 /*--------------------------------------------------------------------------*/
6810 /* Get Attributes */
6811 /*--------------------------------------------------------------------------*/
6812 for (attr = qs_get_attr(doc,node);
6814 attr = qs_get_next_attr(doc,attr)) {
6815 char *name = qs_get_attr_name(doc,attr);
6816 char *value = qs_get_attr_value(doc,attr);
6817 if (STRCASEEQ('n','N',"name",name)) {
6818 attr_name = apr_pstrdup(doc->pool, value);
6820 else if (STRCASEEQ('v','V',"value",name)) {
6821 attr_value = apr_pstrdup(doc->pool, value);
6823 else if (STRCASEEQ('v','V',"valuetype",name)) {
6824 attr_valuetype = apr_pstrdup(doc->pool, value);
6840 W_L(" valuetype=\"");
6841 W_V(attr_valuetype);
6848 * It is a handler who processes the CAPTION tag.
6850 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6851 * destination is specified.
6852 * @param node [i] The CAPTION tag node is specified.
6853 * @return The conversion result is returned.
6856 s_jxhtml_start_caption_tag(void *pdoc, Node *node)
6862 char *attr_style = NULL;
6863 char *attr_align = NULL;
6865 jxhtml = GET_JXHTML(pdoc);
6869 for (attr = qs_get_attr(doc,node);
6871 attr = qs_get_next_attr(doc,attr)) {
6872 char *name = qs_get_attr_name(doc,attr);
6873 char *value = qs_get_attr_value(doc,attr);
6874 if (STRCASEEQ('a','A',"align", name)) {
6876 (STRCASEEQ('l','L',"left",value)
6877 || STRCASEEQ('r','R',"right",value)
6878 || STRCASEEQ('t','T',"top",value)
6879 || STRCASEEQ('b','B',"bottom",value)
6884 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6902 * It is a handler who processes the CAPTION tag.
6904 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6905 * destination is specified.
6906 * @param node [i] The CAPTION tag node is specified.
6907 * @return The conversion result is returned.
6910 s_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child))
6912 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
6913 Doc* doc = jxhtml->doc;