2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_jxhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_conv_z2h.h"
30 #define GET_JXHTML(X) ((jxhtml_t *)(X))
33 #define W_L(X) do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
34 #define W_V(X) do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X)) \
35 : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
39 static char *s_jxhtml_start_html_tag (void *pdoc, Node *node);
40 static char *s_jxhtml_end_html_tag (void *pdoc, Node *node);
41 static char *s_jxhtml_start_meta_tag (void *pdoc, Node *node);
42 static char *s_jxhtml_end_meta_tag (void *pdoc, Node *node);
43 static char *s_jxhtml_start_head_tag (void *pdoc, Node *node);
44 static char *s_jxhtml_end_head_tag (void *pdoc, Node *node);
45 static char *s_jxhtml_start_title_tag (void *pdoc, Node *node);
46 static char *s_jxhtml_end_title_tag (void *pdoc, Node *node);
47 static char *s_jxhtml_start_base_tag (void *pdoc, Node *node);
48 static char *s_jxhtml_end_base_tag (void *pdoc, Node *node);
49 static char *s_jxhtml_start_body_tag (void *pdoc, Node *node);
50 static char *s_jxhtml_end_body_tag (void *pdoc, Node *node);
51 static char *s_jxhtml_start_a_tag (void *pdoc, Node *node);
52 static char *s_jxhtml_end_a_tag (void *pdoc, Node *node);
53 static char *s_jxhtml_start_pre_tag (void *pdoc, Node *node);
54 static char *s_jxhtml_end_pre_tag (void *pdoc, Node *node);
55 static char *s_jxhtml_start_p_tag (void *pdoc, Node *node);
56 static char *s_jxhtml_end_p_tag (void *pdoc, Node *node);
57 static char *s_jxhtml_start_ul_tag (void *pdoc, Node *node);
58 static char *s_jxhtml_end_ul_tag (void *pdoc, Node *node);
59 static char *s_jxhtml_start_ol_tag (void *pdoc, Node *node);
60 static char *s_jxhtml_end_ol_tag (void *pdoc, Node *node);
61 static char *s_jxhtml_start_li_tag (void *pdoc, Node *node);
62 static char *s_jxhtml_end_li_tag (void *pdoc, Node *node);
63 static char *s_jxhtml_start_br_tag (void *pdoc, Node *node);
64 static char *s_jxhtml_end_br_tag (void *pdoc, Node *node);
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,"I found qrcode xml");
487 DBG(r,"not found qrcode xml");
489 /*--------------------------------------------------------------------------*/
490 /* The CHTML structure is initialized. */
491 /*--------------------------------------------------------------------------*/
492 s_init_jxhtml(&jxhtml, &doc, r, spec);
494 jxhtml.entryp = entryp;
495 jxhtml.cookie = cookie;
496 if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
497 apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"application/xhtml+xml; charset=UTF-8");
499 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
501 /*--------------------------------------------------------------------------*/
502 /* The character string of the input is analyzed. */
503 /*--------------------------------------------------------------------------*/
504 qs_init_malloc(&doc);
505 qs_init_root_node(&doc);
507 ss = apr_pcalloc(r->pool, srclen + 1);
509 memset(ss, 0, srclen + 1);
510 memcpy(ss, src, srclen);
512 if (IS_CSS_ON(jxhtml.entryp)) {
513 /* current property list */
514 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
517 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
520 qs_parse_string(&doc,ss,strlen(ss));
522 chxj_buffered_write_init(r->pool, &doc.buf);
523 /*--------------------------------------------------------------------------*/
524 /* It converts it from CHTML to JXHTML. */
525 /*--------------------------------------------------------------------------*/
526 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
527 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
528 dst = apr_pstrdup(r->pool, jxhtml.out);
529 chxj_buffered_write_terminate(&doc.buf);
532 qs_all_free(&doc,QX_LOGMARK);
535 return apr_pstrdup(r->pool,ss);
538 dst = apr_psprintf(r->pool, "\n");
540 *dstlen = strlen(dst);
543 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
551 * The JXHTML structure is initialized.
553 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
554 * initialized is specified.
555 * @param doc [i] The Doc structure that should be set to the initialized
556 * JXHTML structure is specified.
557 * @param r [i] To use POOL, the pointer to request_rec is specified.
558 * @param spec [i] The pointer to the device_table
561 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
563 memset(doc, 0, sizeof(Doc));
564 memset(jxhtml, 0, sizeof(jxhtml_t));
569 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
570 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
571 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
576 * Corresponding EMOJI to a current character-code is retrieved.
577 * The substitution character string is stored in the rslt pointer if agreeing.
579 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
580 * @param txt [i] The character string to want to examine whether it is
581 * EMOJI is specified.
582 * @param rslt [o] The pointer to the pointer that stores the result is
584 * @return When corresponding EMOJI exists, it returns it excluding 0.
587 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
599 if (! spec) DBG(r,"spec is NULL");
601 for (ee = jxhtml->conf->emoji;
605 unsigned char hex1byte;
606 unsigned char hex2byte;
609 DBG(r,"emoji->imode is NULL");
613 hex1byte = ee->imode->hex1byte & 0xff;
614 hex2byte = ee->imode->hex2byte & 0xff;
616 if (ee->imode->string
617 && strlen(ee->imode->string) > 0
618 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
619 if (spec == NULL || spec->emoji_type == NULL) {
620 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
621 return strlen(ee->imode->string);
628 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
629 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
630 if (spec == NULL || spec->emoji_type == NULL) {
631 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
644 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
658 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
659 memset(doc, 0, sizeof(Doc));
660 memset(jxhtml, 0, sizeof(jxhtml_t));
665 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
666 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
667 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
669 apr_pool_create(&pool, r->pool);
671 chxj_buffered_write_init(pool, &doc->buf);
673 for (ii=0; ii<len; ii++) {
677 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
684 if (is_sjis_kanji(src[ii])) {
685 two_byte[0] = src[ii+0];
686 two_byte[1] = src[ii+1];
692 one_byte[0] = src[ii+0];
697 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
699 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
705 * It is a handler who processes the HTML tag.
707 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
708 * destination is specified.
709 * @param node [i] The HTML tag node is specified.
710 * @return The conversion result is returned.
713 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
720 jxhtml = GET_JXHTML(pdoc);
723 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
725 W_L("<?xml version=\"1.0\" encoding=\"");
726 W_V(jxhtml->spec->output_encoding);
729 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
732 /*--------------------------------------------------------------------------*/
734 /*--------------------------------------------------------------------------*/
735 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
737 jxhtml->start_html_flag = 1;
739 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
746 * It is a handler who processes the HTML tag.
748 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
749 * destination is specified.
750 * @param node [i] The HTML tag node is specified.
751 * @return The conversion result is returned.
754 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
756 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
757 Doc *doc = jxhtml->doc;
766 * It is a handler who processes the META tag.
768 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
769 * destination is specified.
770 * @param node [i] The META tag node is specified.
771 * @return The conversion result is returned.
774 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
780 int content_type_flag;
783 jxhtml = GET_JXHTML(pdoc);
787 content_type_flag = 0;
790 /*--------------------------------------------------------------------------*/
792 /*--------------------------------------------------------------------------*/
793 for (attr = qs_get_attr(doc,node);
795 attr = qs_get_next_attr(doc,attr)) {
796 char *name = qs_get_attr_name(doc,attr);
797 char *value = qs_get_attr_value(doc,attr);
801 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
802 /*----------------------------------------------------------------------*/
804 /*----------------------------------------------------------------------*/
805 W_L(" http-equiv=\"");
808 if (STRCASEEQ('c','C',"content-type",value)) {
809 content_type_flag = 1;
811 if (STRCASEEQ('r','R',"refresh",value)) {
819 if (strcasecmp(name, "content") == 0 && value && *value) {
820 /*----------------------------------------------------------------------*/
822 /*----------------------------------------------------------------------*/
823 if (content_type_flag) {
827 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
836 buf = apr_pstrdup(r->pool, value);
838 url = strchr(buf, ';');
840 sec = apr_pstrdup(r->pool, buf);
843 url = chxj_encoding_parameter(r, url, 1);
864 if (strcasecmp(name, "name") == 0 && value && *value) {
880 * It is a handler who processes the META tag.
882 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
883 * destination is specified.
884 * @param node [i] The META tag node is specified.
885 * @return The conversion result is returned.
888 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
890 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
897 * It is a handler who processes the HEAD tag.
899 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
900 * destination is specified.
901 * @param node [i] The HEAD tag node is specified.
902 * @return The conversion result is returned.
905 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
911 jxhtml = GET_JXHTML(pdoc);
921 * It is a handler who processes the HEAD tag.
923 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
924 * destination is specified.
925 * @param node [i] The HEAD tag node is specified.
926 * @return The conversion result is returned.
929 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
935 jxhtml = GET_JXHTML(pdoc);
945 * It is a handler who processes the TITLE tag.
947 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
948 * destination is specified.
949 * @param node [i] The TITLE tag node is specified.
950 * @return The conversion result is returned.
953 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
959 jxhtml = GET_JXHTML(pdoc);
969 * It is a handler who processes the TITLE tag.
971 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
972 * destination is specified.
973 * @param node [i] The TITLE tag node is specified.
974 * @return The conversion result is returned.
977 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
983 jxhtml = GET_JXHTML(pdoc);
993 * It is a handler who processes the BASE tag.
995 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
996 * destination is specified.
997 * @param node [i] The BASE tag node is specified.
998 * @return The conversion result is returned.
1001 s_jxhtml_start_base_tag(void *pdoc, Node *node)
1008 jxhtml = GET_JXHTML(pdoc);
1013 /*--------------------------------------------------------------------------*/
1014 /* Get Attributes */
1015 /*--------------------------------------------------------------------------*/
1016 for (attr = qs_get_attr(doc,node);
1018 attr = qs_get_next_attr(doc,attr)) {
1019 char *name = qs_get_attr_name(doc,attr);
1020 char *value = qs_get_attr_value(doc,attr);
1021 if (STRCASEEQ('h','H',"href",name)) {
1033 * It is a handler who processes the BASE tag.
1035 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1036 * destination is specified.
1037 * @param node [i] The BASE tag node is specified.
1038 * @return The conversion result is returned.
1041 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1043 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1049 * It is a handler who processes the BODY tag.
1051 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1052 * destination is specified.
1053 * @param node [i] The BODY tag node is specified.
1054 * @return The conversion result is returned.
1057 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1063 char *attr_bgcolor = NULL;
1064 char *attr_text = NULL;
1065 char *attr_link = NULL;
1066 char *attr_vlink = NULL;
1067 char *attr_style = NULL;
1068 char *attr_background = NULL;
1070 jxhtml = GET_JXHTML(pdoc);
1074 /*--------------------------------------------------------------------------*/
1075 /* Get Attributes */
1076 /*--------------------------------------------------------------------------*/
1077 for (attr = qs_get_attr(doc,node);
1079 attr = qs_get_next_attr(doc,attr)) {
1080 char *name = qs_get_attr_name(doc,attr);
1081 char *value = qs_get_attr_value(doc,attr);
1082 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1083 /*----------------------------------------------------------------------*/
1085 /*----------------------------------------------------------------------*/
1086 attr_bgcolor = value;
1088 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1089 /*----------------------------------------------------------------------*/
1091 /*----------------------------------------------------------------------*/
1094 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1095 /*----------------------------------------------------------------------*/
1097 /*----------------------------------------------------------------------*/
1100 else if (STRCASEEQ('a','A',"alink",name)) {
1101 /*----------------------------------------------------------------------*/
1103 /*----------------------------------------------------------------------*/
1106 else if (STRCASEEQ('v','V',"vlink",name)) {
1107 /*----------------------------------------------------------------------*/
1109 /*----------------------------------------------------------------------*/
1112 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1113 /*----------------------------------------------------------------------*/
1115 /*----------------------------------------------------------------------*/
1116 attr_background = value;
1118 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1123 if (IS_CSS_ON(jxhtml->entryp)) {
1124 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1126 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1127 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1128 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1129 css_property_t *cur;
1130 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1131 if (cur->value && *cur->value) {
1132 attr_text = apr_pstrdup(doc->pool, cur->value);
1135 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1136 if (cur->value && *cur->value) {
1137 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1140 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1141 if (cur->value && *cur->value) {
1142 char *tmp = apr_pstrdup(doc->pool, cur->value);
1143 char *tmps = strstr(tmp,"(");
1145 char *tmpe = strstr(tmp,")");
1146 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1148 attr_background = apr_pstrndup(doc->pool, tmps,len);
1153 if (jxhtml->style) {
1154 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1155 css_selector_t *cur_sel;
1156 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1157 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1158 css_property_t *cur;
1159 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1160 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1161 attr_link = apr_pstrdup(doc->pool, cur->value);
1165 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1166 css_property_t *cur;
1167 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1168 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1169 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1179 if (attr_bgcolor || attr_text) {
1182 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1183 W_L("background-color:");
1188 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1196 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1202 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1207 if (attr_background) {
1208 W_L(" background=\"");
1209 W_V(attr_background);
1218 * It is a handler who processes the BODY tag.
1220 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1221 * destination is specified.
1222 * @param node [i] The BODY tag node is specified.
1223 * @return The conversion result is returned.
1226 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1232 jxhtml = GET_JXHTML(pdoc);
1236 W_L("</div></body>");
1237 if (IS_CSS_ON(jxhtml->entryp)) {
1238 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1245 * It is a handler who processes the A tag.
1247 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1248 * destination is specified.
1249 * @param node [i] The A tag node is specified.
1250 * @return The conversion result is returned.
1253 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1259 char *attr_style = NULL;
1260 char *attr_id = NULL;
1262 jxhtml = GET_JXHTML(pdoc);
1267 /*--------------------------------------------------------------------------*/
1268 /* Get Attributes */
1269 /*--------------------------------------------------------------------------*/
1270 for (attr = qs_get_attr(doc,node);
1272 attr = qs_get_next_attr(doc,attr)) {
1273 char *name = qs_get_attr_name(doc,attr);
1274 char *value = qs_get_attr_value(doc,attr);
1275 if (STRCASEEQ('i','I',"id",name)){
1276 attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
1278 else if (STRCASEEQ('n','N',"name",name)) {
1279 attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
1281 else if (STRCASEEQ('h','H',"href",name)) {
1282 /*----------------------------------------------------------------------*/
1284 /*----------------------------------------------------------------------*/
1285 value = chxj_encoding_parameter(r, value, 1);
1286 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1287 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1293 else if (STRCASEEQ('a','A',"accesskey",name)) {
1294 /*----------------------------------------------------------------------*/
1296 /*----------------------------------------------------------------------*/
1297 W_L(" accesskey=\"");
1301 else if (STRCASEEQ('c','C',"cti",name)) {
1302 /*----------------------------------------------------------------------*/
1304 /*----------------------------------------------------------------------*/
1309 else if (STRCASEEQ('i','I',"ijam",name)) {
1310 /*----------------------------------------------------------------------*/
1312 /*----------------------------------------------------------------------*/
1315 else if (STRCASEEQ('u','U',"utn",name)) {
1316 /*----------------------------------------------------------------------*/
1318 /* It is special only for CHTML. */
1319 /*----------------------------------------------------------------------*/
1322 else if (STRCASEEQ('t','T',"telbook",name)) {
1323 /*----------------------------------------------------------------------*/
1325 /*----------------------------------------------------------------------*/
1328 else if (STRCASEEQ('k','K',"kana",name)) {
1329 /*----------------------------------------------------------------------*/
1331 /*----------------------------------------------------------------------*/
1334 else if (STRCASEEQ('e','E',"email",name)) {
1335 /*----------------------------------------------------------------------*/
1337 /*----------------------------------------------------------------------*/
1340 else if (STRCASEEQ('i','I',"ista",name)) {
1341 /*----------------------------------------------------------------------*/
1343 /*----------------------------------------------------------------------*/
1346 else if (STRCASEEQ('i','I',"ilet",name)) {
1347 /*----------------------------------------------------------------------*/
1349 /*----------------------------------------------------------------------*/
1352 else if (STRCASEEQ('i','I',"iswf",name)) {
1353 /*----------------------------------------------------------------------*/
1355 /*----------------------------------------------------------------------*/
1358 else if (STRCASEEQ('i','I',"irst",name)) {
1359 /*----------------------------------------------------------------------*/
1361 /*----------------------------------------------------------------------*/
1364 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1365 /*----------------------------------------------------------------------*/
1367 /*----------------------------------------------------------------------*/
1378 if (IS_CSS_ON(jxhtml->entryp)) {
1379 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1387 * It is a handler who processes the A tag.
1389 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1390 * destination is specified.
1391 * @param node [i] The A tag node is specified.
1392 * @return The conversion result is returned.
1395 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1401 jxhtml = GET_JXHTML(pdoc);
1407 if (IS_CSS_ON(jxhtml->entryp)) {
1408 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1416 * It is a handler who processes the BR tag.
1418 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1419 * destination is specified.
1420 * @param node [i] The BR tag node is specified.
1421 * @return The conversion result is returned.
1424 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1431 jxhtml = GET_JXHTML(pdoc);
1435 char *attr_style = NULL;
1436 char *attr_clear = NULL;
1438 /*--------------------------------------------------------------------------*/
1439 /* Get Attributes */
1440 /*--------------------------------------------------------------------------*/
1441 for (attr = qs_get_attr(doc,node);
1443 attr = qs_get_next_attr(doc,attr)) {
1444 char *name = qs_get_attr_name(doc,attr);
1445 char *value = qs_get_attr_value(doc,attr);
1446 if (STRCASEEQ('c','C',"clear",name)) {
1447 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1451 else if (STRCASEEQ('s','S',"style",name)) {
1452 attr_style = apr_pstrdup(doc->buf.pool, value);
1455 if (IS_CSS_ON(jxhtml->entryp)) {
1456 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1458 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1459 css_property_t *cur;
1460 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1461 if (cur->value && *cur->value) {
1462 if ( STRCASEEQ('l','L',"left", cur->value)
1463 || STRCASEEQ('r','R',"right", cur->value)) {
1464 attr_clear = apr_pstrdup(doc->pool, cur->value);
1466 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1467 attr_clear = apr_pstrdup(doc->pool, "all");
1485 * It is a handler who processes the BR tag.
1487 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1488 * destination is specified.
1489 * @param node [i] The BR tag node is specified.
1490 * @return The conversion result is returned.
1493 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1495 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1500 * It is a handler who processes the TABLE tag.
1502 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1503 * destination is specified.
1504 * @param node [i] The TR tag node is specified.
1505 * @return The conversion result is returned.
1508 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1515 char *attr_style = NULL;
1516 char *attr_align = NULL;
1517 char *attr_width = NULL;
1518 char *attr_height = NULL;
1519 char *attr_bgcolor = NULL;
1520 char *attr_border_width = NULL;
1521 char *attr_border_color = NULL;
1523 jxhtml = GET_JXHTML(pdoc);
1527 /*--------------------------------------------------------------------------*/
1528 /* Get Attributes */
1529 /*--------------------------------------------------------------------------*/
1530 for (attr = qs_get_attr(doc,node);
1532 attr = qs_get_next_attr(doc,attr)) {
1533 char *name = qs_get_attr_name(doc,attr);
1534 char *val = qs_get_attr_value(doc,attr);
1535 if (STRCASEEQ('a','A',"align",name)) {
1536 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1537 attr_align = apr_pstrdup(doc->buf.pool, val);
1540 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1541 attr_height = apr_pstrdup(doc->buf.pool, val);
1543 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1544 attr_width = apr_pstrdup(doc->buf.pool, val);
1546 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1547 attr_style = apr_pstrdup(doc->buf.pool, val);
1549 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1550 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1551 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1553 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1554 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1556 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1557 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1558 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1562 if (IS_CSS_ON(jxhtml->entryp)) {
1563 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1565 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1566 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1567 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1568 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1569 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1570 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1572 css_property_t *cur;
1573 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1574 char *tmp = apr_pstrdup(doc->pool, cur->value);
1575 char *tmpp = strstr(tmp, "px");
1577 size_t len = strlen(tmp) - strlen(tmpp);
1578 attr_width = apr_pstrndup(doc->pool, tmp,len);
1581 attr_width = apr_pstrdup(doc->pool, tmp);
1584 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1585 char *tmp = apr_pstrdup(doc->pool, cur->value);
1586 char *tmpp = strstr(tmp, "px");
1588 size_t len = strlen(tmp) - strlen(tmpp);
1589 attr_height = apr_pstrndup(doc->pool, tmp,len);
1592 attr_height = apr_pstrdup(doc->pool, tmp);
1595 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1596 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1597 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1600 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1601 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1602 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1604 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1605 char *tmp = apr_pstrdup(doc->pool, cur->value);
1606 char *tmpp = strstr(tmp, "px");
1608 size_t len = strlen(tmp) - strlen(tmpp);
1609 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1612 attr_border_width = apr_pstrdup(doc->pool, tmp);
1615 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1616 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1617 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1638 if (attr_bgcolor && *attr_bgcolor){
1643 if (attr_border_width || attr_border_color ){
1644 W_L(" style=\"border:");
1645 if (attr_border_width){
1646 W_V(attr_border_width);
1653 if (attr_border_color && *attr_border_color){
1655 W_V(attr_border_color);
1665 * It is a handler who processes the TABLE tag.
1667 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1668 * destination is specified.
1669 * @param node [i] The TR tag node is specified.
1670 * @return The conversion result is returned.
1673 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1679 jxhtml = GET_JXHTML(pdoc);
1689 * It is a handler who processes the TR tag.
1691 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1692 * destination is specified.
1693 * @param node [i] The TR tag node is specified.
1694 * @return The conversion result is returned.
1697 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1705 char *attr_style = NULL;
1706 char *attr_align = NULL;
1707 char *attr_valign = NULL;
1708 char *attr_bgcolor = NULL;
1710 jxhtml = GET_JXHTML(pdoc);
1714 /*--------------------------------------------------------------------------*/
1715 /* Get Attributes */
1716 /*--------------------------------------------------------------------------*/
1717 for (attr = qs_get_attr(doc,node);
1719 attr = qs_get_next_attr(doc,attr)) {
1720 char *name = qs_get_attr_name(doc,attr);
1721 char *val = qs_get_attr_value(doc,attr);
1722 if (STRCASEEQ('a','A',"align",name)) {
1723 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1724 attr_align = apr_pstrdup(doc->buf.pool, val);
1727 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1728 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1729 attr_valign = apr_pstrdup(doc->buf.pool, val);
1732 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1733 attr_style = apr_pstrdup(doc->buf.pool, val);
1735 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1736 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1737 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1741 if (IS_CSS_ON(jxhtml->entryp)) {
1742 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1744 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1745 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1746 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1748 css_property_t *cur;
1749 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1750 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1751 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1754 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1755 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1756 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1759 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1760 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1761 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1777 if (attr_bgcolor && *attr_bgcolor){
1788 * It is a handler who processes the TR tag.
1790 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1791 * destination is specified.
1792 * @param node [i] The TR tag node is specified.
1793 * @return The conversion result is returned.
1796 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1802 jxhtml = GET_JXHTML(pdoc);
1811 * It is a handler who processes the TD tag.
1813 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1814 * destination is specified.
1815 * @param node [i] The TR tag node is specified.
1816 * @return The conversion result is returned.
1819 s_jxhtml_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1827 char *attr_style = NULL;
1828 char *attr_align = NULL;
1829 char *attr_valign = NULL;
1830 char *attr_bgcolor = NULL;
1831 char *attr_colspan = NULL;
1832 char *attr_rowspan = NULL;
1833 char *attr_width = NULL;
1834 char *attr_height = NULL;
1836 jxhtml = GET_JXHTML(pdoc);
1840 /*--------------------------------------------------------------------------*/
1841 /* Get Attributes */
1842 /*--------------------------------------------------------------------------*/
1843 for (attr = qs_get_attr(doc,node);
1845 attr = qs_get_next_attr(doc,attr)) {
1846 char *name = qs_get_attr_name(doc,attr);
1847 char *val = qs_get_attr_value(doc,attr);
1848 if (STRCASEEQ('a','A',"align",name)) {
1849 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1850 attr_align = apr_pstrdup(doc->buf.pool, val);
1853 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1854 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1855 attr_valign = apr_pstrdup(doc->buf.pool, val);
1858 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1859 attr_style = apr_pstrdup(doc->buf.pool, val);
1861 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1862 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1863 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1865 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1866 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1868 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1869 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1871 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1872 char *tmp = strstr(val, "%");
1874 attr_width = apr_pstrdup(doc->buf.pool, val);
1877 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1880 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1881 char *tmp = strstr(val, "%");
1883 attr_height = apr_pstrdup(doc->buf.pool, val);
1886 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1891 if (IS_CSS_ON(jxhtml->entryp)) {
1892 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1894 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1895 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1896 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1897 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1898 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1900 css_property_t *cur;
1901 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1902 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1903 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1906 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1907 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1908 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1911 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1912 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1913 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1915 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1916 attr_width = apr_pstrdup(doc->pool, cur->value);
1918 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1919 attr_height = apr_pstrdup(doc->pool, cur->value);
1946 if (attr_bgcolor && *attr_bgcolor){
1951 if (attr_width || attr_height ){
1971 * It is a handler who processes the TD tag.
1973 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1974 * destination is specified.
1975 * @param node [i] The TR tag node is specified.
1976 * @return The conversion result is returned.
1979 s_jxhtml_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1985 jxhtml = GET_JXHTML(pdoc);
1996 * It is a handler who processes the TD tag.
1998 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1999 * destination is specified.
2000 * @param node [i] The TD tag node is specified.
2001 * @return The conversion result is returned.
2004 s_jxhtml_start_td_tag(void *pdoc, Node *node)
2006 return s_jxhtml_start_td_or_th_tag(pdoc,node,"td");
2009 * It is a handler who processes the TD tag.
2011 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2012 * destination is specified.
2013 * @param node [i] The TD tag node is specified.
2014 * @return The conversion result is returned.
2017 s_jxhtml_end_td_tag(void *pdoc, Node *node)
2019 return s_jxhtml_end_td_or_th_tag(pdoc,node,"td");
2023 * It is a handler who processes the TD tag.
2025 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2026 * destination is specified.
2027 * @param node [i] The TD tag node is specified.
2028 * @return The conversion result is returned.
2031 s_jxhtml_start_th_tag(void *pdoc, Node *node)
2033 return s_jxhtml_start_td_or_th_tag(pdoc,node,"th");
2036 * It is a handler who processes the TD tag.
2038 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2039 * destination is specified.
2040 * @param node [i] The TD tag node is specified.
2041 * @return The conversion result is returned.
2044 s_jxhtml_end_th_tag(void *pdoc, Node *node)
2046 return s_jxhtml_end_td_or_th_tag(pdoc,node,"th");
2050 * It is a handler who processes the FONT tag.
2052 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2053 * destination is specified.
2054 * @param node [i] The FONT tag node is specified.
2055 * @return The conversion result is returned.
2058 s_jxhtml_start_font_tag(void *pdoc, Node *node)
2064 char *attr_color = NULL;
2065 char *attr_size = NULL;
2066 char *attr_style = NULL;
2068 jxhtml = GET_JXHTML(pdoc);
2072 /*--------------------------------------------------------------------------*/
2073 /* Get Attributes */
2074 /*--------------------------------------------------------------------------*/
2075 for (attr = qs_get_attr(doc,node);
2077 attr = qs_get_next_attr(doc,attr)) {
2078 char *name = qs_get_attr_name(doc,attr);
2079 char *value = qs_get_attr_value(doc,attr);
2080 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2081 attr_color = apr_pstrdup(doc->buf.pool, value);
2083 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2084 /*----------------------------------------------------------------------*/
2086 /*----------------------------------------------------------------------*/
2087 attr_size = apr_pstrdup(doc->buf.pool, value);
2089 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2090 attr_style = apr_pstrdup(doc->buf.pool, value);
2093 if (IS_CSS_ON(jxhtml->entryp)) {
2094 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2096 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2097 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2098 css_property_t *cur;
2099 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2100 if (cur->value && *cur->value) {
2101 attr_color = apr_pstrdup(doc->pool, cur->value);
2104 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2105 if (cur->value && *cur->value) {
2106 attr_size = apr_pstrdup(doc->pool, cur->value);
2107 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2108 attr_size = apr_pstrdup(doc->pool, "1");
2110 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2111 attr_size = apr_pstrdup(doc->pool, "2");
2113 else if (STRCASEEQ('s','S',"small",attr_size)) {
2114 attr_size = apr_pstrdup(doc->pool, "3");
2116 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2117 attr_size = apr_pstrdup(doc->pool, "4");
2119 else if (STRCASEEQ('l','L',"large",attr_size)) {
2120 attr_size = apr_pstrdup(doc->pool, "5");
2122 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2123 attr_size = apr_pstrdup(doc->pool, "6");
2125 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2126 attr_size = apr_pstrdup(doc->pool, "7");
2132 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2133 memset(flg, 0, sizeof(*flg));
2135 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2136 W_L("<font color=\"");
2139 flg->font_color_flag = 1;
2142 flg->font_size_flag = 1;
2143 switch(*attr_size) {
2144 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2145 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2146 case '3': W_L("<span style=\"font-size: small\">"); break;
2147 case '4': W_L("<span style=\"font-size: medium\">"); break;
2148 case '5': W_L("<span style=\"font-size: large\">"); break;
2149 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2150 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2152 if (*(attr_size + 1) == '1') {
2153 W_L("<span style=\"font-size: small\">");
2156 if (*(attr_size + 1) == '2') {
2157 W_L("<span style=\"font-size: x-small\">");
2160 if (*(attr_size + 1) == '3') {
2161 W_L("<span style=\"font-size: xx-small\">");
2164 flg->font_size_flag = 0;
2168 if (*(attr_size + 1) == '1') {
2169 W_L("<span style=\"font-size: large\">");
2172 if (*(attr_size + 1) == '2') {
2173 W_L("<span style=\"font-size: x-large\">");
2176 if (*(attr_size + 1) == '3') {
2177 W_L("<span style=\"font-size: xx-large\">");
2180 flg->font_size_flag = 0;
2184 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2185 flg->font_size_flag = 0;
2188 node->userData = flg;
2194 * It is a handler who processes the FONT tag.
2196 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2197 * destination is specified.
2198 * @param node [i] The FONT tag node is specified.
2199 * @return The conversion result is returned.
2202 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2208 jxhtml = GET_JXHTML(pdoc);
2212 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2213 if (flg && flg->font_size_flag) {
2216 if (flg && flg->font_color_flag) {
2219 if (IS_CSS_ON(jxhtml->entryp)) {
2220 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2228 * It is a handler who processes the FORM tag.
2230 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2231 * destination is specified.
2232 * @param node [i] The FORM tag node is specified.
2233 * @return The conversion result is returned.
2236 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2242 char *attr_action = NULL;
2243 char *attr_method = NULL;
2244 char *attr_style = NULL;
2245 char *attr_color = NULL;
2246 char *attr_align = NULL;
2247 char *attr_name = NULL;
2248 char *css_clear = NULL;
2249 char *new_hidden_tag = NULL;
2251 jxhtml = GET_JXHTML(pdoc);
2255 /*--------------------------------------------------------------------------*/
2256 /* Get Attributes */
2257 /*--------------------------------------------------------------------------*/
2258 for (attr = qs_get_attr(doc,node);
2260 attr = qs_get_next_attr(doc,attr)) {
2261 char *name = qs_get_attr_name(doc,attr);
2262 char *value = qs_get_attr_value(doc,attr);
2266 if (strcasecmp(name, "action") == 0) {
2267 /*--------------------------------------------------------------------*/
2269 /*--------------------------------------------------------------------*/
2270 attr_action = value;
2276 if (strcasecmp(name, "method") == 0) {
2277 /*--------------------------------------------------------------------*/
2279 /*--------------------------------------------------------------------*/
2280 attr_method = value;
2286 if (strcasecmp(name, "name") == 0) {
2287 /*--------------------------------------------------------------------*/
2289 /*--------------------------------------------------------------------*/
2296 if (strcasecmp(name, "style") == 0) {
2305 if (IS_CSS_ON(jxhtml->entryp)) {
2306 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2308 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2309 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2310 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2311 css_property_t *cur;
2312 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2313 if (STRCASEEQ('l','L',"left", cur->value)) {
2314 attr_align = apr_pstrdup(doc->pool, "left");
2316 else if (STRCASEEQ('c','C',"center",cur->value)) {
2317 attr_align = apr_pstrdup(doc->pool, "center");
2319 else if (STRCASEEQ('r','R',"right",cur->value)) {
2320 attr_align = apr_pstrdup(doc->pool, "right");
2323 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2324 attr_color = apr_pstrdup(doc->pool, cur->value);
2326 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2327 css_clear = apr_pstrdup(doc->pool, cur->value);
2332 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2336 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2337 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2339 char *old_qs = NULL;
2340 q = strchr(attr_action, '?');
2342 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);
2343 if (new_hidden_tag || old_qs) {
2373 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2374 memset(flg, 0, sizeof(*flg));
2376 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2377 W_L("<font color=\"");
2380 flg->with_font_flag = 1;
2383 W_L("<div align=\"");
2386 flg->with_div_flag = 1;
2388 node->userData = flg;
2389 if (new_hidden_tag) {
2390 W_V(new_hidden_tag);
2397 * It is a handler who processes the FORM tag.
2399 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2400 * destination is specified.
2401 * @param node [i] The FORM tag node is specified.
2402 * @return The conversion result is returned.
2405 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2407 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2408 Doc *doc = jxhtml->doc;
2410 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2411 if (flg && flg->with_div_flag) {
2414 if (flg && flg->with_font_flag) {
2418 if (IS_CSS_ON(jxhtml->entryp)) {
2419 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2426 s_jxhtml_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
2430 case '1': return apr_psprintf(p, ""*<ja:h>"");
2431 case '2': return apr_psprintf(p, ""*<ja:hk>"");
2432 case '3': return apr_psprintf(p, ""*<ja:en>"");
2433 case '4': return apr_psprintf(p, ""*<ja:n>"");
2435 return apr_pstrdup(p, "");
2439 return apr_pstrdup(p,"");
2444 * It is a handler who processes the INPUT tag.
2446 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2447 * destination is specified.
2448 * @param node [i] The INPUT tag node is specified.
2449 * @return The conversion result is returned.
2452 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2458 char *attr_accesskey = NULL;
2459 char *attr_max_length = NULL;
2460 char *attr_type = NULL;
2461 char *attr_name = NULL;
2462 char *attr_value = NULL;
2463 char *attr_istyle = NULL;
2464 char *attr_size = NULL;
2465 char *attr_checked = NULL;
2466 char *attr_style = NULL;
2468 jxhtml = GET_JXHTML(pdoc);
2472 /*--------------------------------------------------------------------------*/
2473 /* Get Attributes */
2474 /*--------------------------------------------------------------------------*/
2475 for (attr = qs_get_attr(doc,node);
2477 attr = qs_get_next_attr(doc,attr)) {
2478 char *name = qs_get_attr_name(doc,attr);
2479 char *value = qs_get_attr_value(doc,attr);
2480 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2481 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2482 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2483 STRCASEEQ('p','P',"password",tmp_type) ||
2484 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2485 STRCASEEQ('r','R',"radio", tmp_type) ||
2486 STRCASEEQ('h','H',"hidden", tmp_type) ||
2487 STRCASEEQ('s','S',"submit", tmp_type) ||
2488 STRCASEEQ('r','R',"reset", tmp_type))) {
2489 attr_type = tmp_type;
2492 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2495 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2498 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2499 attr_istyle = value;
2501 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2502 attr_max_length = value;
2504 else if (STRCASEEQ('c','C',"checked", name)) {
2505 attr_checked = value;
2507 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2508 attr_accesskey = value;
2510 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2513 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2518 if (IS_CSS_ON(jxhtml->entryp)) {
2519 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2521 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2522 css_property_t *cur;
2523 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2524 if (strcasestr(cur->value, "<ja:n>")) {
2527 else if (strcasestr(cur->value, "<ja:en>")) {
2530 else if (strcasestr(cur->value, "<ja:hk>")) {
2533 else if (strcasestr(cur->value, "<ja:h>")) {
2553 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2558 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2561 if (attr_accesskey) {
2562 W_L(" accesskey=\"");
2563 W_V(attr_accesskey);
2566 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2571 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
2573 W_L("-wrap-input-format:");
2578 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2579 W_L(" istyle=\"4\"");
2581 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,"4");
2583 W_L("-wrap-input-format:");
2588 /*--------------------------------------------------------------------------*/
2589 /* The figure is default for the password. */
2590 /*--------------------------------------------------------------------------*/
2591 if (attr_max_length && *attr_max_length) {
2592 if (chxj_chk_numeric(attr_max_length) == 0) {
2593 W_L(" maxlength=\"");
2594 W_V(attr_max_length);
2599 W_L(" checked=\"checked\"");
2615 jxhtml = GET_JXHTML(pdoc);
2628 /*--------------------------------------------------------------------------*/
2629 /* Get Attributes */
2630 /*--------------------------------------------------------------------------*/
2631 type = qs_get_type_attr(doc, node, doc->buf.pool);
2632 name = qs_get_name_attr(doc, node, doc->buf.pool);
2633 value = qs_get_value_attr(doc,node, doc->buf.pool);
2634 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2635 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2636 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2637 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2638 size = qs_get_size_attr(doc, node, doc->buf.pool);
2641 if (type && (STRCASEEQ('t','T',"text", type) ||
2642 STRCASEEQ('p','P',"password",type) ||
2643 STRCASEEQ('c','C',"checkbox",type) ||
2644 STRCASEEQ('r','R',"radio", type) ||
2645 STRCASEEQ('h','H',"hidden", type) ||
2646 STRCASEEQ('s','S',"submit", type) ||
2647 STRCASEEQ('r','R',"reset", type))) {
2653 if (size && *size) {
2658 if (name && *name) {
2660 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2663 if (value && *value) {
2664 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2665 apr_size_t value_len = strlen(value);
2666 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2670 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2673 if (accesskey && *accesskey) {
2674 W_L(" accesskey=\"");
2678 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2679 /*------------------------------------------------------------------------*/
2681 /*------------------------------------------------------------------------*/
2682 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2683 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2686 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2688 W_L("-wap-input-format:'*");
2694 else if (type && STRCASEEQ('p','P',"password",type)) {
2695 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2697 /*--------------------------------------------------------------------------*/
2698 /* The figure is default for the password. */
2699 /*--------------------------------------------------------------------------*/
2700 if (max_length && *max_length) {
2701 if (chxj_chk_numeric(max_length) == 0) {
2702 W_L(" maxlength=\"");
2709 W_L(" checked=\"checked\"");
2718 * It is a handler who processes the INPUT tag.
2720 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2721 * destination is specified.
2722 * @param node [i] The INPUT tag node is specified.
2723 * @return The conversion result is returned.
2726 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2728 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2734 * It is a handler who processes the CENTER tag.
2736 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2737 * destination is specified.
2738 * @param node [i] The CENTER tag node is specified.
2739 * @return The conversion result is returned.
2742 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2747 char *attr_style = NULL;
2748 char *attr_color = NULL;
2749 char *attr_size = NULL;
2751 jxhtml = GET_JXHTML(pdoc);
2754 for (attr = qs_get_attr(doc,node);
2756 attr = qs_get_next_attr(doc,attr)) {
2757 char *name = qs_get_attr_name(doc,attr);
2758 char *value = qs_get_attr_value(doc,attr);
2759 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2763 if (IS_CSS_ON(jxhtml->entryp)) {
2764 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2766 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2767 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2768 css_property_t *cur;
2769 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2770 if (cur->value && *cur->value) {
2771 attr_color = apr_pstrdup(doc->pool, cur->value);
2774 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2775 if (cur->value && *cur->value) {
2776 attr_size = apr_pstrdup(doc->pool, cur->value);
2783 if (attr_size || attr_color) {
2791 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2805 * It is a handler who processes the CENTER tag.
2807 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2808 * destination is specified.
2809 * @param node [i] The CENTER tag node is specified.
2810 * @return The conversion result is returned.
2813 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2819 jxhtml = GET_JXHTML(pdoc);
2824 if (IS_CSS_ON(jxhtml->entryp)) {
2825 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2832 * It is a handler who processes the li tag.
2834 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2835 * destination is specified.
2836 * @param node [i] The li tag node is specified.
2837 * @return The conversion result is returned.
2840 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2846 char *attr_type = NULL;
2847 char *attr_value = NULL;
2848 char *attr_style = NULL;
2850 jxhtml = GET_JXHTML(pdoc);
2854 for (attr = qs_get_attr(doc,node);
2856 attr = qs_get_next_attr(doc,attr)) {
2857 char *name = qs_get_attr_name(doc,attr);
2858 char *value = qs_get_attr_value(doc,attr);
2859 if (STRCASEEQ('t','T',"type",name)) {
2860 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2861 if (*value == '1') {
2862 attr_type = apr_pstrdup(doc->pool, "decimal");
2864 else if (*value == 'a') {
2865 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2867 else if (*value == 'A') {
2868 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2875 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2878 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2882 if (IS_CSS_ON(jxhtml->entryp)) {
2883 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2885 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2886 css_property_t *cur;
2887 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2888 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2889 attr_type = apr_pstrdup(doc->pool, "decimal");
2891 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2892 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2894 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2895 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2897 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2898 attr_type = apr_pstrdup(doc->pool, "disc");
2900 else if (STRCASEEQ('s','S',"square", cur->value)) {
2901 attr_type = apr_pstrdup(doc->pool, "square");
2903 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2904 attr_type = apr_pstrdup(doc->pool, "circle");
2914 W_L("list-style-type:");
2930 * It is a handler who processes the li tag.
2932 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2933 * destination is specified.
2934 * @param node [i] The li tag node is specified.
2935 * @return The conversion result is returned.
2938 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2944 jxhtml = GET_JXHTML(pdoc);
2948 if (IS_CSS_ON(jxhtml->entryp)) {
2949 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2957 * It is a handler who processes the OL tag.
2959 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2960 * destination is specified.
2961 * @param node [i] The OL tag node is specified.
2962 * @return The conversion result is returned.
2965 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2971 char *attr_style = NULL;
2972 char *attr_start = NULL;
2973 char *attr_type = NULL;
2974 char *css_clear = NULL;
2976 jxhtml = GET_JXHTML(pdoc);
2980 /*--------------------------------------------------------------------------*/
2981 /* Get Attributes */
2982 /*--------------------------------------------------------------------------*/
2983 for (attr = qs_get_attr(doc,node);
2985 attr = qs_get_next_attr(doc,attr)) {
2986 char *name = qs_get_attr_name(doc,attr);
2987 char *value = qs_get_attr_value(doc,attr);
2988 if (STRCASEEQ('t','T',"type",name) && value) {
2989 if (*value == '1') {
2990 attr_type = apr_pstrdup(doc->pool, "decimal");
2992 else if (*value == 'a') {
2993 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2995 else if (*value == 'A') {
2996 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2999 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3002 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3006 if (IS_CSS_ON(jxhtml->entryp)) {
3007 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3009 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3010 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3012 css_property_t *cur;
3013 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3014 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3015 attr_type = apr_pstrdup(doc->pool, "decimal");
3017 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3018 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3020 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3021 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3024 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3025 css_clear = apr_pstrdup(doc->pool, cur->value);
3030 if (attr_type || css_clear) {
3033 W_L("list-style-type:");
3056 * It is a handler who processes the OL tag.
3058 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3059 * destination is specified.
3060 * @param node [i] The OL tag node is specified.
3061 * @return The conversion result is returned.
3064 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
3070 jxhtml = GET_JXHTML(pdoc);
3075 if (IS_CSS_ON(jxhtml->entryp)) {
3076 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3083 * It is a handler who processes the P tag.
3085 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3086 * destination is specified.
3087 * @param node [i] The P tag node is specified.
3088 * @return The conversion result is returned.
3091 s_jxhtml_start_p_tag(void *pdoc, Node *node)
3097 char *attr_align = NULL;
3098 char *attr_style = NULL;
3099 char *attr_color = NULL;
3100 char *attr_blink = NULL;
3101 char *css_clear = NULL;
3103 jxhtml = GET_JXHTML(pdoc);
3107 for (attr = qs_get_attr(doc,node);
3109 attr = qs_get_next_attr(doc,attr)) {
3110 char *nm = qs_get_attr_name(doc,attr);
3111 char *val = qs_get_attr_value(doc,attr);
3112 if (STRCASEEQ('a','A',"align", nm)) {
3113 /*----------------------------------------------------------------------*/
3114 /* CHTML 1.0 (W3C version 3.2) */
3115 /*----------------------------------------------------------------------*/
3116 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3117 attr_align = apr_pstrdup(doc->buf.pool, val);
3121 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3122 attr_style = apr_pstrdup(doc->buf.pool, val);
3125 if (IS_CSS_ON(jxhtml->entryp)) {
3126 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3128 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3129 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3130 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3131 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3132 css_property_t *cur;
3133 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3134 if (STRCASEEQ('l','L',"left",cur->value)) {
3135 attr_align = apr_pstrdup(doc->pool, "left");
3137 else if (STRCASEEQ('c','C',"center",cur->value)) {
3138 attr_align = apr_pstrdup(doc->pool, "center");
3140 else if (STRCASEEQ('r','R',"right",cur->value)) {
3141 attr_align = apr_pstrdup(doc->pool, "right");
3144 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3145 if (cur->value && *cur->value) {
3146 attr_color = apr_pstrdup(doc->pool, cur->value);
3149 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3150 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3151 attr_blink = apr_pstrdup(doc->pool, cur->value);
3154 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3155 css_clear = apr_pstrdup(doc->pool, cur->value);
3160 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3168 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3174 W_L("text-decoration:");
3191 * It is a handler who processes the P tag.
3193 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3194 * destination is specified.
3195 * @param node [i] The P tag node is specified.
3196 * @return The conversion result is returned.
3199 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3201 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3202 Doc *doc = jxhtml->doc;
3205 if (IS_CSS_ON(jxhtml->entryp)) {
3206 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3213 * It is a handler who processes the PRE tag.
3215 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3216 * destination is specified.
3217 * @param node [i] The PRE tag node is specified.
3218 * @return The conversion result is returned.
3221 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3223 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3224 Doc *doc = jxhtml->doc;
3226 char *attr_style = NULL;
3227 char *css_clear = NULL;
3229 for (attr = qs_get_attr(doc,node);
3231 attr = qs_get_next_attr(doc,attr)) {
3232 char *nm = qs_get_attr_name(doc,attr);
3233 char *val = qs_get_attr_value(doc,attr);
3234 if (val && STRCASEEQ('s','S',"style", nm)) {
3239 if (IS_CSS_ON(jxhtml->entryp)) {
3240 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3242 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3244 css_property_t *cur;
3245 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3246 css_clear = apr_pstrdup(doc->pool, cur->value);
3266 * It is a handler who processes the PRE tag.
3268 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3269 * destination is specified.
3270 * @param node [i] The PRE tag node is specified.
3271 * @return The conversion result is returned.
3274 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3276 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3277 Doc *doc = jxhtml->doc;
3281 if (IS_CSS_ON(jxhtml->entryp)) {
3282 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3290 * It is a handler who processes the UL tag.
3292 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3293 * destination is specified.
3294 * @param node [i] The UL tag node is specified.
3295 * @return The conversion result is returned.
3298 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3300 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3301 Doc *doc = jxhtml->doc;
3303 char *attr_type = NULL;
3304 char *attr_style = NULL;
3305 char *css_clear = NULL;
3307 /*--------------------------------------------------------------------------*/
3308 /* Get Attributes */
3309 /*--------------------------------------------------------------------------*/
3310 for (attr = qs_get_attr(doc,node);
3312 attr = qs_get_next_attr(doc,attr)) {
3313 char *name = qs_get_attr_name(doc,attr);
3314 char *value = qs_get_attr_value(doc,attr);
3315 if (STRCASEEQ('t','T',"type",name)) {
3316 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3320 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3324 if (IS_CSS_ON(jxhtml->entryp)) {
3325 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3327 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3328 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3330 css_property_t *cur;
3331 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3332 if (STRCASEEQ('d','D',"disc",cur->value)) {
3333 attr_type = apr_pstrdup(doc->pool, "disc");
3335 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3336 attr_type = apr_pstrdup(doc->pool, "circle");
3338 else if (STRCASEEQ('s','S',"square",cur->value)) {
3339 attr_type = apr_pstrdup(doc->pool, "square");
3342 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3343 css_clear = apr_pstrdup(doc->pool, cur->value);
3348 if (attr_type || css_clear) {
3351 W_L("list-style-type:");
3368 * It is a handler who processes the UL tag.
3370 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3371 * destination is specified.
3372 * @param node [i] The UL tag node is specified.
3373 * @return The conversion result is returned.
3376 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3378 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3379 Doc *doc = jxhtml->doc;
3382 if (IS_CSS_ON(jxhtml->entryp)) {
3383 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3390 * It is a handler who processes the HR tag.
3392 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3393 * destination is specified.
3394 * @param node [i] The HR tag node is specified.
3395 * @return The conversion result is returned.
3398 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3404 char *attr_align = NULL;
3405 char *attr_size = NULL;
3406 char *attr_width = NULL;
3407 char *attr_noshade = NULL;
3408 char *attr_style = NULL;
3409 char *attr_color = NULL;
3411 char *style_float = NULL;
3412 char *style_border_color = NULL;
3413 char *css_clear = NULL;
3415 jxhtml = GET_JXHTML(pdoc);
3419 for (attr = qs_get_attr(doc,node);
3421 attr = qs_get_next_attr(doc,attr)) {
3422 char *name = qs_get_attr_name (doc,attr);
3423 char *value = qs_get_attr_value(doc,attr);
3427 if (strcasecmp(name, "align") == 0) {
3428 /*--------------------------------------------------------------------*/
3430 /*--------------------------------------------------------------------*/
3431 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3439 if (strcasecmp(name, "size") == 0) {
3440 /*--------------------------------------------------------------------*/
3442 /*--------------------------------------------------------------------*/
3443 if (value && *value) {
3447 else if (strcasecmp(name, "style") == 0) {
3448 if (value && *value) {
3456 if (strcasecmp(name, "width") == 0) {
3457 /*--------------------------------------------------------------------*/
3459 /*--------------------------------------------------------------------*/
3460 if (value && *value) {
3468 if (strcasecmp(name, "noshade") == 0) {
3469 /*--------------------------------------------------------------------*/
3471 /*--------------------------------------------------------------------*/
3472 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3478 if (strcasecmp(name, "color") == 0 && value && *value) {
3479 /*--------------------------------------------------------------------*/
3481 /*--------------------------------------------------------------------*/
3490 if (IS_CSS_ON(jxhtml->entryp)) {
3491 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3493 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3494 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3495 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3497 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3498 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3499 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3500 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3501 css_property_t *cur;
3503 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3504 if (STRCASEEQ('s','S',"solid",cur->value)) {
3505 attr_noshade = "noshade";
3508 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3509 attr_size = apr_pstrdup(doc->pool, cur->value);
3512 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3513 char *tmp = apr_pstrdup(doc->pool,cur->value);
3514 attr_color = apr_pstrdup(doc->pool,tmp);
3517 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3518 char *tmp = apr_pstrdup(doc->pool, cur->value);
3519 char *tmpp = strstr(tmp,"none");
3521 style_float = "center";
3524 style_float = apr_pstrdup(doc->pool,tmp);
3529 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3530 char *tmp = apr_pstrdup(doc->pool, cur->value);
3531 char *tmpp = strstr(tmp, "px");
3533 attr_width = apr_pstrdup(doc->pool, tmp);
3536 tmpp = strstr(tmp, "%");
3538 attr_width = apr_pstrdup(doc->pool, tmp);
3543 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3544 char *tmp = apr_pstrdup(doc->pool, cur->value);
3546 style_border_color = apr_pstrdup(doc->pool, tmp);
3549 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3550 css_clear = apr_pstrdup(doc->pool, cur->value);
3567 if (attr_size || attr_width || attr_noshade || style_border_color || css_clear) {
3572 if (chxj_chk_numeric(attr_size) == 0) {
3580 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3586 W_L("border-style:solid;");
3588 if(style_border_color){
3589 W_L("border-color:");
3590 W_V(style_border_color);
3613 * It is a handler who processes the HR tag.
3615 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3616 * destination is specified.
3617 * @param node [i] The HR tag node is specified.
3618 * @return The conversion result is returned.
3621 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3623 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3629 * It is a handler who processes the IMG tag.
3631 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3632 * destination is specified.
3633 * @param node [i] The IMG tag node is specified.
3634 * @return The conversion result is returned.
3637 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3639 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3640 Doc *doc = jxhtml->doc;
3641 request_rec *r = doc->r;
3643 char *attr_src = NULL;
3644 char *attr_height = NULL;
3645 char *attr_width = NULL;
3646 char *attr_align = NULL;
3647 char *attr_alt = NULL;
3648 char *attr_style = NULL;
3649 char *attr_hspace = NULL;
3650 char *attr_vspace = NULL;
3652 char *css_float = NULL;
3653 char *css_margin_left = NULL;
3654 char *css_margin_right = NULL;
3655 char *css_margin_top = NULL;
3656 char *css_margin_bottom = NULL;
3657 char *css_display = NULL;
3658 char *css_valign = NULL;
3660 #ifndef IMG_NOT_CONVERT_FILENAME
3661 device_table *spec = jxhtml->spec;
3664 /*--------------------------------------------------------------------------*/
3665 /* Get Attributes */
3666 /*--------------------------------------------------------------------------*/
3667 for (attr = qs_get_attr(doc,node);
3669 attr = qs_get_next_attr(doc,attr)) {
3670 char *name = qs_get_attr_name(doc,attr);
3671 char *value = qs_get_attr_value(doc,attr);
3672 if (STRCASEEQ('s','S',"src",name)) {
3673 /*----------------------------------------------------------------------*/
3675 /*----------------------------------------------------------------------*/
3676 #ifdef IMG_NOT_CONVERT_FILENAME
3677 value = chxj_encoding_parameter(r, value, 1);
3678 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3679 value = chxj_add_cookie_no_update_parameter(r, value);
3680 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3683 value = chxj_img_conv(r, spec, value);
3684 value = chxj_encoding_parameter(r, value, 1);
3685 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3686 value = chxj_add_cookie_no_update_parameter(r, value);
3687 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3691 else if (STRCASEEQ('a','A',"align",name)) {
3692 /*----------------------------------------------------------------------*/
3694 /*----------------------------------------------------------------------*/
3696 if (STRCASEEQ('t','T',"top", value) ||
3697 STRCASEEQ('m','M',"middle",value) ||
3698 STRCASEEQ('b','B',"bottom",value)){
3700 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3703 else if (STRCASEEQ('c','C',"center",value)) {
3704 css_valign = apr_pstrdup(doc->pool, "middle");
3708 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3709 /*----------------------------------------------------------------------*/
3711 /*----------------------------------------------------------------------*/
3714 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3715 /*----------------------------------------------------------------------*/
3717 /*----------------------------------------------------------------------*/
3718 attr_height = value;
3720 else if (STRCASEEQ('h','H',"hspace",name)) {
3721 /*----------------------------------------------------------------------*/
3723 /*----------------------------------------------------------------------*/
3724 attr_hspace = value;
3726 else if (STRCASEEQ('v','V',"vspace",name)) {
3727 /*----------------------------------------------------------------------*/
3729 /*----------------------------------------------------------------------*/
3730 attr_vspace = value;
3732 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3733 /*----------------------------------------------------------------------*/
3735 /*----------------------------------------------------------------------*/
3738 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3739 /*----------------------------------------------------------------------*/
3741 /*----------------------------------------------------------------------*/
3746 if (IS_CSS_ON(jxhtml->entryp)) {
3747 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3749 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3750 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3751 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3752 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3753 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3754 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3755 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3758 css_property_t *cur;
3759 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3760 attr_height = apr_pstrdup(doc->pool, cur->value);
3762 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3763 attr_width = apr_pstrdup(doc->pool, cur->value);
3766 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3767 css_valign = apr_pstrdup(doc->pool, cur->value);
3770 if (! attr_hspace) {
3771 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3772 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3774 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3775 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3778 if (! attr_vspace) {
3779 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3780 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3782 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3783 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3787 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3788 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3789 css_float = apr_pstrdup(doc->pool, cur->value);
3793 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3794 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3795 char *tmp = apr_pstrdup(doc->pool, cur->value);
3796 char *tmpp = strstr(tmp, "none");
3798 css_display = apr_pstrdup(doc->pool, tmp);
3810 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3818 W_L("vertical-align:");
3823 W_L("margin-left:");
3826 W_L("margin-right:");
3831 if(css_margin_left){
3832 W_L("margin-left:");
3833 W_V(css_margin_left);
3836 if(css_margin_right){
3837 W_L("margin-right:");
3838 W_V(css_margin_right);
3846 W_L("margin-bottom:");
3853 W_V(css_margin_top);
3856 if(css_margin_bottom){
3857 W_L("margin-bottom:");
3858 W_V(css_margin_bottom);
3863 W_L("display:none;");
3892 * It is a handler who processes the IMG tag.
3894 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3895 * destination is specified.
3896 * @param node [i] The IMG tag node is specified.
3897 * @return The conversion result is returned.
3900 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3902 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3908 * It is a handler who processes the SELECT tag.
3910 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3911 * destination is specified.
3912 * @param node [i] The SELECT tag node is specified.
3913 * @return The conversion result is returned.
3916 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3918 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3919 Doc *doc = jxhtml->doc;
3923 char *multiple = NULL;
3924 char *attr_style = NULL;
3927 for (attr = qs_get_attr(doc,node);
3929 attr = qs_get_next_attr(doc,attr)) {
3930 char *nm = qs_get_attr_name(doc,attr);
3931 char *val = qs_get_attr_value(doc,attr);
3932 if (STRCASEEQ('s','S',"size",nm)) {
3933 /*----------------------------------------------------------------------*/
3934 /* CHTML 1.0 version 2.0 */
3935 /*----------------------------------------------------------------------*/
3936 size = apr_pstrdup(doc->buf.pool, val);
3938 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3939 /*----------------------------------------------------------------------*/
3940 /* CHTML 1.0 version 2.0 */
3941 /*----------------------------------------------------------------------*/
3942 attr_style = apr_pstrdup(doc->buf.pool, val);
3944 else if (STRCASEEQ('n','N',"name",nm)) {
3945 /*----------------------------------------------------------------------*/
3946 /* CHTML 1.0 version 2.0 */
3947 /*----------------------------------------------------------------------*/
3948 name = apr_pstrdup(doc->buf.pool, val);
3950 else if (STRCASEEQ('m','M',"multiple", nm)) {
3951 /*----------------------------------------------------------------------*/
3952 /* CHTML 1.0 version 2.0 */
3953 /*----------------------------------------------------------------------*/
3954 multiple = apr_pstrdup(doc->buf.pool, val);
3957 if (size && *size) {
3962 if (name && *name) {
3972 if (IS_CSS_ON(jxhtml->entryp)) {
3973 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3981 * It is a handler who processes the SELECT tag.
3983 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3984 * destination is specified.
3985 * @param node [i] The SELECT tag node is specified.
3986 * @return The conversion result is returned.
3989 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3991 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3992 Doc *doc = jxhtml->doc;
3995 if (IS_CSS_ON(jxhtml->entryp)) {
3996 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4003 * It is a handler who processes the OPTION tag.
4005 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4006 * destination is specified.
4007 * @param node [i] The OPTION tag node is specified.
4008 * @return The conversion result is returned.
4011 s_jxhtml_start_option_tag(void *pdoc, Node *node)
4013 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4014 Doc *doc = jxhtml->doc;
4017 char *selected = NULL;
4019 char *attr_style = NULL;
4022 for (attr = qs_get_attr(doc,node);
4024 attr = qs_get_next_attr(doc,attr)) {
4025 char *nm = qs_get_attr_name(doc,attr);
4026 char *val = qs_get_attr_value(doc,attr);
4027 if (STRCASEEQ('s','S',"selected",nm)) {
4028 /*----------------------------------------------------------------------*/
4029 /* CHTML 1.0 version 2.0 */
4030 /*----------------------------------------------------------------------*/
4031 selected = apr_pstrdup(doc->buf.pool, val);
4033 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4034 /*----------------------------------------------------------------------*/
4035 /* CHTML 1.0 version 2.0 */
4036 /*----------------------------------------------------------------------*/
4037 attr_style = apr_pstrdup(doc->buf.pool, val);
4039 else if (STRCASEEQ('v','V',"value",nm)) {
4040 /*----------------------------------------------------------------------*/
4041 /* CHTML 1.0 version 2.0 */
4042 /*----------------------------------------------------------------------*/
4043 value = apr_pstrdup(doc->buf.pool, val);
4056 if (IS_CSS_ON(jxhtml->entryp)) {
4057 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4065 * It is a handler who processes the OPTION tag.
4067 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4068 * destination is specified.
4069 * @param node [i] The OPTION tag node is specified.
4070 * @return The conversion result is returned.
4073 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
4075 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4076 Doc *doc = jxhtml->doc;
4079 if (IS_CSS_ON(jxhtml->entryp)) {
4080 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4088 * It is a handler who processes the DIV tag.
4090 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4091 * destination is specified.
4092 * @param node [i] The DIV tag node is specified.
4093 * @return The conversion result is returned.
4096 s_jxhtml_start_div_tag(void *pdoc, Node *node)
4102 char *attr_style = NULL;
4103 char *attr_align = NULL;
4104 char *attr_display = NULL;
4105 char *attr_decoration = NULL;
4106 char *attr_wap_marquee_style = NULL;
4107 char *attr_wap_marquee_dir = NULL;
4108 char *attr_wap_marquee_loop = NULL;
4109 char *attr_color = NULL;
4110 char *attr_bgcolor = NULL;
4111 char *attr_font_size = NULL;
4112 char *css_clear = NULL;
4114 jxhtml = GET_JXHTML(pdoc);
4118 for (attr = qs_get_attr(doc,node);
4120 attr = qs_get_next_attr(doc,attr)) {
4121 char *nm = qs_get_attr_name(doc,attr);
4122 char *val = qs_get_attr_value(doc,attr);
4123 if (STRCASEEQ('a','A',"align",nm)) {
4124 /*----------------------------------------------------------------------*/
4125 /* CHTML 1.0 (W3C version 3.2) */
4126 /*----------------------------------------------------------------------*/
4127 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4128 attr_align = apr_pstrdup(doc->buf.pool, val);
4131 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4132 attr_style = apr_pstrdup(doc->buf.pool, val);
4136 if (IS_CSS_ON(jxhtml->entryp)) {
4137 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4139 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4140 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4141 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4142 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4143 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4144 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4145 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4146 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4148 css_property_t *cur;
4149 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4150 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4151 attr_display = apr_pstrdup(doc->pool, cur->value);
4154 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4155 if (STRCASEEQ('b','B',"blink", cur->value)) {
4156 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4159 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4160 attr_color = apr_pstrdup(doc->pool, cur->value);
4162 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4163 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4164 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4166 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4167 char *ss = strchr(cur->value, '#');
4169 ss = strstr(cur->value, "rgb");
4172 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4173 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4176 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4177 attr_align = apr_pstrdup(doc->pool, cur->value);
4179 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4180 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4181 || STRCASEEQ('x','X',"x-small",cur->value)
4182 || STRCASEEQ('s','S',"small",cur->value)
4183 || STRCASEEQ('m','M',"medium",cur->value)
4184 || STRCASEEQ('l','L',"large",cur->value)
4185 || STRCASEEQ('x','X',"x-large",cur->value)
4186 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4187 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4191 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4192 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4193 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4194 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4195 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4196 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4199 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4200 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4201 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4203 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4204 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4207 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4208 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4209 attr_wap_marquee_loop = "infinite";
4212 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4216 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4217 css_clear = apr_pstrdup(doc->pool, cur->value);
4225 || attr_wap_marquee_style
4226 || attr_wap_marquee_dir
4227 || attr_wap_marquee_loop
4243 if (attr_decoration) {
4244 W_L("text-decoration:");
4245 W_V(attr_decoration);
4248 if (attr_wap_marquee_style) {
4249 W_L("-wap-marquee-style:");
4250 W_V(attr_wap_marquee_style);
4253 if (attr_wap_marquee_dir) {
4254 W_L("-wap-marquee-dir:");
4255 W_V(attr_wap_marquee_dir);
4258 if (attr_wap_marquee_loop) {
4259 W_L("-wap-marquee-loop:");
4260 W_V(attr_wap_marquee_loop);
4269 W_L("background-color:");
4273 if (attr_font_size) {
4275 W_V(attr_font_size);
4291 * It is a handler who processes the DIV tag.
4293 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4294 * destination is specified.
4295 * @param node [i] The DIV tag node is specified.
4296 * @return The conversion result is returned.
4299 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4305 jxhtml = GET_JXHTML(pdoc);
4310 if (IS_CSS_ON(jxhtml->entryp)) {
4311 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4318 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4325 jxhtml = GET_JXHTML(pdoc);
4329 for (child = qs_get_child_node(doc, node);
4331 child = qs_get_next_node(doc, child)) {
4333 s_jxhtml_chxjif_tag(jxhtml, child);
4340 * It is a handler who processes the TEXTARE tag.
4342 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4343 * destination is specified.
4344 * @param node [i] The TEXTAREA tag node is specified.
4345 * @return The conversion result is returned.
4348 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4354 char *attr_accesskey = NULL;
4355 char *attr_name = NULL;
4356 char *attr_rows = NULL;
4357 char *attr_cols = NULL;
4358 char *attr_istyle = NULL;
4359 char *attr_style = NULL;
4362 jxhtml = GET_JXHTML(pdoc);
4366 jxhtml->textarea_flag++;
4367 for (attr = qs_get_attr(doc,node);
4369 attr = qs_get_next_attr(doc,attr)) {
4370 char *name = qs_get_attr_name(doc,attr);
4371 char *value = qs_get_attr_value(doc,attr);
4372 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4373 attr_accesskey = value;
4375 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4376 attr_istyle = value;
4378 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4381 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4384 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4387 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4391 if (IS_CSS_ON(jxhtml->entryp)) {
4392 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4394 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4395 css_property_t *cur;
4396 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4397 if (strcasestr(cur->value, "<ja:n>")) {
4400 else if (strcasestr(cur->value, "<ja:en>")) {
4403 else if (strcasestr(cur->value, "<ja:hk>")) {
4406 else if (strcasestr(cur->value, "<ja:h>")) {
4413 if (attr_accesskey) {
4414 W_L(" accesskey=\"");
4415 W_V(attr_accesskey);
4438 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
4440 W_L("-wap-input-format:");
4452 * It is a handler who processes the TEXTAREA tag.
4454 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4455 * destination is specified.
4456 * @param node [i] The TEXTAREA tag node is specified.
4457 * @return The conversion result is returned.
4460 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4466 jxhtml = GET_JXHTML(pdoc);
4471 jxhtml->textarea_flag--;
4478 * It is a handler who processes the B tag.
4480 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4481 * destination is specified.
4482 * @param node [i] The B tag node is specified.
4483 * @return The conversion result is returned.
4486 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4492 jxhtml = GET_JXHTML(pdoc);
4502 * It is a handler who processes the B tag.
4504 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4505 * destination is specified.
4506 * @param node [i] The B tag node is specified.
4507 * @return The conversion result is returned.
4510 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4512 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4513 Doc* doc = jxhtml->doc;
4520 s_jxhtml_text_tag(void* pdoc, Node* child)
4531 apr_size_t z2h_input_len;
4533 jxhtml = GET_JXHTML(pdoc);
4537 textval = qs_get_node_value(doc,child);
4538 if (strlen(textval) == 0) {
4542 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4543 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4545 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4546 memset(one_byte, 0, sizeof(one_byte));
4549 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4551 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4553 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4558 if (is_sjis_kanji(textval[ii])) {
4559 one_byte[0] = textval[ii+0];
4560 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4561 one_byte[0] = textval[ii+1];
4562 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4566 if (jxhtml->pre_flag) {
4567 one_byte[0] = textval[ii+0];
4568 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4571 if (jxhtml->textarea_flag) {
4572 one_byte[0] = textval[ii+0];
4573 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4576 if (textval[ii] != '\r' && textval[ii] != '\n') {
4577 one_byte[0] = textval[ii+0];
4578 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4582 z2h_input_len = strlen(tdst);
4583 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4591 * It is a handler who processes the BLOCKQUOTE tag.
4593 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4594 * destination is specified.
4595 * @param node [i] The BLOCKQUOTE tag node is specified.
4596 * @return The conversion result is returned.
4599 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4604 char *attr_style = NULL;
4605 char *attr_color = NULL;
4606 char *attr_size = NULL;
4607 char *css_clear = NULL;
4609 jxhtml = GET_JXHTML(pdoc);
4611 for (attr = qs_get_attr(doc,node);
4613 attr = qs_get_next_attr(doc,attr)) {
4614 char *nm = qs_get_attr_name(doc,attr);
4615 char *val = qs_get_attr_value(doc,attr);
4616 if (val && STRCASEEQ('s','S',"style", nm)) {
4620 if (IS_CSS_ON(jxhtml->entryp)) {
4621 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4623 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4624 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4625 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4627 css_property_t *cur;
4628 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4629 if (cur->value && *cur->value) {
4630 attr_color = apr_pstrdup(doc->pool, cur->value);
4633 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4634 if (cur->value && *cur->value) {
4635 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4636 attr_size = apr_pstrdup(doc->pool, cur->value);
4638 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4639 attr_size = apr_pstrdup(doc->pool, cur->value);
4641 else if (STRCASEEQ('s','S',"small",cur->value)) {
4642 attr_size = apr_pstrdup(doc->pool, cur->value);
4644 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4645 attr_size = apr_pstrdup(doc->pool, cur->value);
4647 else if (STRCASEEQ('l','L',"large",cur->value)) {
4648 attr_size = apr_pstrdup(doc->pool, cur->value);
4650 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4651 attr_size = apr_pstrdup(doc->pool, cur->value);
4653 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4654 attr_size = apr_pstrdup(doc->pool, cur->value);
4658 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4659 css_clear = apr_pstrdup(doc->pool, cur->value);
4664 if (attr_color || attr_size || css_clear) {
4667 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4690 * It is a handler who processes the BLOCKQUOTE tag.
4692 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4693 * destination is specified.
4694 * @param node [i] The BLOCKQUOTE tag node is specified.
4695 * @return The conversion result is returned.
4698 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4700 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4701 Doc *doc = jxhtml->doc;
4702 W_L("</blockquote>");
4703 if (IS_CSS_ON(jxhtml->entryp)) {
4704 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4711 * It is a handler who processes the DIR tag.
4713 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4714 * destination is specified.
4715 * @param node [i] The DIR tag node is specified.
4716 * @return The conversion result is returned.
4719 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4721 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4722 Doc *doc = jxhtml->doc;
4724 char *attr_style = NULL;
4725 char *attr_color = NULL;
4726 char *attr_type = NULL;
4727 char *attr_size = NULL;
4728 for (attr = qs_get_attr(doc,node);
4730 attr = qs_get_next_attr(doc,attr)) {
4731 char *name = qs_get_attr_name(doc,attr);
4732 char *value = qs_get_attr_value(doc,attr);
4733 if (STRCASEEQ('t','T',"type",name)) {
4734 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4738 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4742 if (IS_CSS_ON(jxhtml->entryp)) {
4743 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4745 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4746 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4747 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4748 css_property_t *cur;
4749 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4750 if (cur->value && *cur->value) {
4751 attr_color = apr_pstrdup(doc->pool, cur->value);
4754 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4755 if (cur->value && *cur->value) {
4756 attr_type = apr_pstrdup(doc->pool, cur->value);
4759 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4760 if (cur->value && *cur->value) {
4761 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4762 attr_size = apr_pstrdup(doc->pool, cur->value);
4764 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4765 attr_size = apr_pstrdup(doc->pool, cur->value);
4767 else if (STRCASEEQ('s','S',"small",cur->value)) {
4768 attr_size = apr_pstrdup(doc->pool, cur->value);
4770 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4771 attr_size = apr_pstrdup(doc->pool, cur->value);
4773 else if (STRCASEEQ('l','L',"large",cur->value)) {
4774 attr_size = apr_pstrdup(doc->pool, cur->value);
4776 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4777 attr_size = apr_pstrdup(doc->pool, cur->value);
4779 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4780 attr_size = apr_pstrdup(doc->pool, cur->value);
4787 if (attr_type || attr_color || attr_size) {
4790 W_L("list-style-type:");
4795 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4813 * It is a handler who processes the DIR tag.
4815 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4816 * destination is specified.
4817 * @param node [i] The DIR tag node is specified.
4818 * @return The conversion result is returned.
4821 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4823 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4824 Doc *doc = jxhtml->doc;
4826 if (IS_CSS_ON(jxhtml->entryp)) {
4827 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4834 * It is a handler who processes the DL tag.
4836 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4837 * destination is specified.
4838 * @param node [i] The DL tag node is specified.
4839 * @return The conversion result is returned.
4842 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4844 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4845 Doc *doc = jxhtml->doc;
4847 char *attr_style = NULL;
4848 char *attr_color = NULL;
4849 char *attr_size = NULL;
4850 char *css_clear = NULL;
4852 for (attr = qs_get_attr(doc,node);
4854 attr = qs_get_next_attr(doc,attr)) {
4855 char *name = qs_get_attr_name(doc,attr);
4856 char *value = qs_get_attr_value(doc,attr);
4857 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4861 if (IS_CSS_ON(jxhtml->entryp)) {
4862 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4864 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4865 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4866 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4868 css_property_t *cur;
4869 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4870 if (cur->value && *cur->value) {
4871 attr_color = apr_pstrdup(doc->pool, cur->value);
4874 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4875 if (cur->value && *cur->value) {
4876 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4877 attr_size = apr_pstrdup(doc->pool, cur->value);
4879 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4880 attr_size = apr_pstrdup(doc->pool, cur->value);
4882 else if (STRCASEEQ('s','S',"small",cur->value)) {
4883 attr_size = apr_pstrdup(doc->pool, cur->value);
4885 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4886 attr_size = apr_pstrdup(doc->pool, cur->value);
4888 else if (STRCASEEQ('l','L',"large",cur->value)) {
4889 attr_size = apr_pstrdup(doc->pool, cur->value);
4891 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4892 attr_size = apr_pstrdup(doc->pool, cur->value);
4894 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4895 attr_size = apr_pstrdup(doc->pool, cur->value);
4899 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4900 css_clear = apr_pstrdup(doc->pool, cur->value);
4905 if (attr_color || attr_size || css_clear) {
4908 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4931 * It is a handler who processes the DL tag.
4933 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4934 * destination is specified.
4935 * @param node [i] The DL tag node is specified.
4936 * @return The conversion result is returned.
4939 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4941 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4942 Doc *doc = jxhtml->doc;
4944 if (IS_CSS_ON(jxhtml->entryp)) {
4945 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4952 * It is a handler who processes the DT tag.
4954 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4955 * destination is specified.
4956 * @param node [i] The DT tag node is specified.
4957 * @return The conversion result is returned.
4960 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4962 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4963 Doc *doc = jxhtml->doc;
4965 char *attr_style = NULL;
4966 char *attr_color = NULL;
4967 char *attr_size = NULL;
4968 for (attr = qs_get_attr(doc,node);
4970 attr = qs_get_next_attr(doc,attr)) {
4971 char *name = qs_get_attr_name(doc,attr);
4972 char *value = qs_get_attr_value(doc,attr);
4973 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4977 if (IS_CSS_ON(jxhtml->entryp)) {
4978 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4980 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4981 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4982 css_property_t *cur;
4983 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4984 if (cur->value && *cur->value) {
4985 attr_color = apr_pstrdup(doc->pool, cur->value);
4988 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4989 if (cur->value && *cur->value) {
4990 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4991 attr_size = apr_pstrdup(doc->pool, cur->value);
4993 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4994 attr_size = apr_pstrdup(doc->pool, cur->value);
4996 else if (STRCASEEQ('s','S',"small",cur->value)) {
4997 attr_size = apr_pstrdup(doc->pool, cur->value);
4999 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5000 attr_size = apr_pstrdup(doc->pool, cur->value);
5002 else if (STRCASEEQ('l','L',"large",cur->value)) {
5003 attr_size = apr_pstrdup(doc->pool, cur->value);
5005 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5006 attr_size = apr_pstrdup(doc->pool, cur->value);
5008 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5009 attr_size = apr_pstrdup(doc->pool, cur->value);
5016 if (attr_color || attr_size) {
5019 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5037 * It is a handler who processes the DT tag.
5039 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5040 * destination is specified.
5041 * @param node [i] The DT tag node is specified.
5042 * @return The conversion result is returned.
5045 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
5047 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5048 Doc *doc = jxhtml->doc;
5050 if (IS_CSS_ON(jxhtml->entryp)) {
5051 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5058 * It is a handler who processes the DD tag.
5060 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5061 * destination is specified.
5062 * @param node [i] The DD tag node is specified.
5063 * @return The conversion result is returned.
5066 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
5068 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5069 Doc *doc = jxhtml->doc;
5071 char *attr_style = NULL;
5072 char *attr_color = NULL;
5073 char *attr_size = NULL;
5074 for (attr = qs_get_attr(doc,node);
5076 attr = qs_get_next_attr(doc,attr)) {
5077 char *name = qs_get_attr_name(doc,attr);
5078 char *value = qs_get_attr_value(doc,attr);
5079 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5083 if (IS_CSS_ON(jxhtml->entryp)) {
5084 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5086 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5087 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5088 css_property_t *cur;
5089 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5090 if (cur->value && *cur->value) {
5091 attr_color = apr_pstrdup(doc->pool, cur->value);
5094 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5095 if (cur->value && *cur->value) {
5096 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5097 attr_size = apr_pstrdup(doc->pool, cur->value);
5099 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5100 attr_size = apr_pstrdup(doc->pool, cur->value);
5102 else if (STRCASEEQ('s','S',"small",cur->value)) {
5103 attr_size = apr_pstrdup(doc->pool, cur->value);
5105 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5106 attr_size = apr_pstrdup(doc->pool, cur->value);
5108 else if (STRCASEEQ('l','L',"large",cur->value)) {
5109 attr_size = apr_pstrdup(doc->pool, cur->value);
5111 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5112 attr_size = apr_pstrdup(doc->pool, cur->value);
5114 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5115 attr_size = apr_pstrdup(doc->pool, cur->value);
5122 if (attr_color || attr_size) {
5125 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5148 * It is a handler who processes the DD tag.
5150 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5151 * destination is specified.
5152 * @param node [i] The DD tag node is specified.
5153 * @return The conversion result is returned.
5156 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5158 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5159 Doc *doc = jxhtml->doc;
5161 if (IS_CSS_ON(jxhtml->entryp)) {
5162 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5169 * It is a handler who processes the H1 tag.
5171 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5172 * destination is specified.
5173 * @param node [i] The H1 tag node is specified.
5174 * @return The conversion result is returned.
5177 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5183 char *attr_style = NULL;
5184 char *attr_align = NULL;
5185 char *css_clear = NULL;
5187 jxhtml = GET_JXHTML(pdoc);
5191 for (attr = qs_get_attr(doc,node);
5193 attr = qs_get_next_attr(doc,attr)) {
5194 char *name = qs_get_attr_name(doc,attr);
5195 char *value = qs_get_attr_value(doc,attr);
5196 if (STRCASEEQ('a','A',"align", name)) {
5197 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5201 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5205 if (IS_CSS_ON(jxhtml->entryp)) {
5206 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5208 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5209 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5210 css_property_t *cur;
5211 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5212 if (STRCASEEQ('l','L',"left", cur->value)) {
5213 attr_align = apr_pstrdup(doc->pool, "left");
5215 else if (STRCASEEQ('c','C',"center",cur->value)) {
5216 attr_align = apr_pstrdup(doc->pool, "center");
5218 else if (STRCASEEQ('r','R',"right",cur->value)) {
5219 attr_align = apr_pstrdup(doc->pool, "right");
5222 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5223 if (STRCASEEQ('b','B',"both", cur->value)) {
5224 css_clear = apr_pstrdup(doc->pool, "both");
5226 else if (STRCASEEQ('r','R',"right", cur->value)) {
5227 css_clear = apr_pstrdup(doc->pool, "right");
5229 else if (STRCASEEQ('l','L',"left", cur->value)) {
5230 css_clear = apr_pstrdup(doc->pool, "left");
5236 if (attr_align || css_clear ) {
5257 * It is a handler who processes the H1 tag.
5259 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5260 * destination is specified.
5261 * @param node [i] The H1 tag node is specified.
5262 * @return The conversion result is returned.
5265 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5271 jxhtml = GET_JXHTML(pdoc);
5276 if (IS_CSS_ON(jxhtml->entryp)) {
5277 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5285 * It is a handler who processes the H2 tag.
5287 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5288 * destination is specified.
5289 * @param node [i] The H1 tag node is specified.
5290 * @return The conversion result is returned.
5293 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5299 char *attr_style = NULL;
5300 char *attr_align = NULL;
5301 char *css_clear = NULL;
5303 jxhtml = GET_JXHTML(pdoc);
5307 for (attr = qs_get_attr(doc,node);
5309 attr = qs_get_next_attr(doc,attr)) {
5310 char *name = qs_get_attr_name(doc,attr);
5311 char *value = qs_get_attr_value(doc,attr);
5312 if (STRCASEEQ('a','A',"align", name)) {
5313 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5317 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5321 if (IS_CSS_ON(jxhtml->entryp)) {
5322 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5324 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5325 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5326 css_property_t *cur;
5327 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5328 if (STRCASEEQ('l','L',"left", cur->value)) {
5329 attr_align = apr_pstrdup(doc->pool, "left");
5331 else if (STRCASEEQ('c','C',"center",cur->value)) {
5332 attr_align = apr_pstrdup(doc->pool, "center");
5334 else if (STRCASEEQ('r','R',"right",cur->value)) {
5335 attr_align = apr_pstrdup(doc->pool, "right");
5338 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5339 if (STRCASEEQ('b','B',"both", cur->value)) {
5340 css_clear = apr_pstrdup(doc->pool, "both");
5342 else if (STRCASEEQ('r','R',"right", cur->value)) {
5343 css_clear = apr_pstrdup(doc->pool, "right");
5345 else if (STRCASEEQ('l','L',"left", cur->value)) {
5346 css_clear = apr_pstrdup(doc->pool, "left");
5352 if (attr_align || css_clear ) {
5373 * It is a handler who processes the H2 tag.
5375 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5376 * destination is specified.
5377 * @param node [i] The H1 tag node is specified.
5378 * @return The conversion result is returned.
5381 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5387 jxhtml = GET_JXHTML(pdoc);
5392 if (IS_CSS_ON(jxhtml->entryp)) {
5393 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5400 * It is a handler who processes the H3 tag.
5402 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5403 * destination is specified.
5404 * @param node [i] The H1 tag node is specified.
5405 * @return The conversion result is returned.
5408 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5414 char *attr_style = NULL;
5415 char *attr_align = NULL;
5416 char *css_clear = NULL;
5418 jxhtml = GET_JXHTML(pdoc);
5422 for (attr = qs_get_attr(doc,node);
5424 attr = qs_get_next_attr(doc,attr)) {
5425 char *name = qs_get_attr_name(doc,attr);
5426 char *value = qs_get_attr_value(doc,attr);
5427 if (STRCASEEQ('a','A',"align", name)) {
5428 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5432 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5436 if (IS_CSS_ON(jxhtml->entryp)) {
5437 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5439 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5440 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5441 css_property_t *cur;
5442 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5443 if (STRCASEEQ('l','L',"left", cur->value)) {
5444 attr_align = apr_pstrdup(doc->pool, "left");
5446 else if (STRCASEEQ('c','C',"center",cur->value)) {
5447 attr_align = apr_pstrdup(doc->pool, "center");
5449 else if (STRCASEEQ('r','R',"right",cur->value)) {
5450 attr_align = apr_pstrdup(doc->pool, "right");
5453 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5454 if (STRCASEEQ('b','B',"both", cur->value)) {
5455 css_clear = apr_pstrdup(doc->pool, "both");
5457 else if (STRCASEEQ('r','R',"right", cur->value)) {
5458 css_clear = apr_pstrdup(doc->pool, "right");
5460 else if (STRCASEEQ('l','L',"left", cur->value)) {
5461 css_clear = apr_pstrdup(doc->pool, "left");
5467 if (attr_align || css_clear ) {
5488 * It is a handler who processes the H3 tag.
5490 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5491 * destination is specified.
5492 * @param node [i] The H1 tag node is specified.
5493 * @return The conversion result is returned.
5496 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5502 jxhtml = GET_JXHTML(pdoc);
5507 if (IS_CSS_ON(jxhtml->entryp)) {
5508 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5515 * It is a handler who processes the H4 tag.
5517 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5518 * destination is specified.
5519 * @param node [i] The H1 tag node is specified.
5520 * @return The conversion result is returned.
5523 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5529 char *attr_style = NULL;
5530 char *attr_align = NULL;
5531 char *css_clear = NULL;
5533 jxhtml = GET_JXHTML(pdoc);
5537 for (attr = qs_get_attr(doc,node);
5539 attr = qs_get_next_attr(doc,attr)) {
5540 char *name = qs_get_attr_name(doc,attr);
5541 char *value = qs_get_attr_value(doc,attr);
5542 if (STRCASEEQ('a','A',"align", name)) {
5543 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5547 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5551 if (IS_CSS_ON(jxhtml->entryp)) {
5552 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5554 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5555 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5556 css_property_t *cur;
5557 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5558 if (STRCASEEQ('l','L',"left", cur->value)) {
5559 attr_align = apr_pstrdup(doc->pool, "left");
5561 else if (STRCASEEQ('c','C',"center",cur->value)) {
5562 attr_align = apr_pstrdup(doc->pool, "center");
5564 else if (STRCASEEQ('r','R',"right",cur->value)) {
5565 attr_align = apr_pstrdup(doc->pool, "right");
5568 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5569 if (STRCASEEQ('b','B',"both", cur->value)) {
5570 css_clear = apr_pstrdup(doc->pool, "both");
5572 else if (STRCASEEQ('r','R',"right", cur->value)) {
5573 css_clear = apr_pstrdup(doc->pool, "right");
5575 else if (STRCASEEQ('l','L',"left", cur->value)) {
5576 css_clear = apr_pstrdup(doc->pool, "left");
5582 if (attr_align || css_clear ) {
5603 * It is a handler who processes the H4 tag.
5605 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5606 * destination is specified.
5607 * @param node [i] The H1 tag node is specified.
5608 * @return The conversion result is returned.
5611 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5617 jxhtml = GET_JXHTML(pdoc);
5622 if (IS_CSS_ON(jxhtml->entryp)) {
5623 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5631 * It is a handler who processes the H5 tag.
5633 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5634 * destination is specified.
5635 * @param node [i] The H1 tag node is specified.
5636 * @return The conversion result is returned.
5639 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5645 char *attr_style = NULL;
5646 char *attr_align = NULL;
5647 char *css_clear = NULL;
5649 jxhtml = GET_JXHTML(pdoc);
5653 for (attr = qs_get_attr(doc,node);
5655 attr = qs_get_next_attr(doc,attr)) {
5656 char *name = qs_get_attr_name(doc,attr);
5657 char *value = qs_get_attr_value(doc,attr);
5658 if (STRCASEEQ('a','A',"align", name)) {
5659 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5663 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5667 if (IS_CSS_ON(jxhtml->entryp)) {
5668 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5670 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5671 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5672 css_property_t *cur;
5673 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5674 if (STRCASEEQ('l','L',"left", cur->value)) {
5675 attr_align = apr_pstrdup(doc->pool, "left");
5677 else if (STRCASEEQ('c','C',"center",cur->value)) {
5678 attr_align = apr_pstrdup(doc->pool, "center");
5680 else if (STRCASEEQ('r','R',"right",cur->value)) {
5681 attr_align = apr_pstrdup(doc->pool, "right");
5684 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5685 if (STRCASEEQ('b','B',"both", cur->value)) {
5686 css_clear = apr_pstrdup(doc->pool, "both");
5688 else if (STRCASEEQ('r','R',"right", cur->value)) {
5689 css_clear = apr_pstrdup(doc->pool, "right");
5691 else if (STRCASEEQ('l','L',"left", cur->value)) {
5692 css_clear = apr_pstrdup(doc->pool, "left");
5698 if (attr_align || css_clear ) {
5719 * It is a handler who processes the H5 tag.
5721 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5722 * destination is specified.
5723 * @param node [i] The H1 tag node is specified.
5724 * @return The conversion result is returned.
5727 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5733 jxhtml = GET_JXHTML(pdoc);
5738 if (IS_CSS_ON(jxhtml->entryp)) {
5739 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5747 * It is a handler who processes the H6 tag.
5749 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5750 * destination is specified.
5751 * @param node [i] The H1 tag node is specified.
5752 * @return The conversion result is returned.
5755 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5761 char *attr_style = NULL;
5762 char *attr_align = NULL;
5763 char *css_clear = NULL;
5765 jxhtml = GET_JXHTML(pdoc);
5769 for (attr = qs_get_attr(doc,node);
5771 attr = qs_get_next_attr(doc,attr)) {
5772 char *name = qs_get_attr_name(doc,attr);
5773 char *value = qs_get_attr_value(doc,attr);
5774 if (STRCASEEQ('a','A',"align", name)) {
5775 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5779 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5783 if (IS_CSS_ON(jxhtml->entryp)) {
5784 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5786 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5787 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5788 css_property_t *cur;
5789 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5790 if (STRCASEEQ('l','L',"left", cur->value)) {
5791 attr_align = apr_pstrdup(doc->pool, "left");
5793 else if (STRCASEEQ('c','C',"center",cur->value)) {
5794 attr_align = apr_pstrdup(doc->pool, "center");
5796 else if (STRCASEEQ('r','R',"right",cur->value)) {
5797 attr_align = apr_pstrdup(doc->pool, "right");
5800 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5801 if (STRCASEEQ('b','B',"both", cur->value)) {
5802 css_clear = apr_pstrdup(doc->pool, "both");
5804 else if (STRCASEEQ('r','R',"right", cur->value)) {
5805 css_clear = apr_pstrdup(doc->pool, "right");
5807 else if (STRCASEEQ('l','L',"left", cur->value)) {
5808 css_clear = apr_pstrdup(doc->pool, "left");
5814 if (attr_align || css_clear ) {
5835 * It is a handler who processes the H6 tag.
5837 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5838 * destination is specified.
5839 * @param node [i] The H1 tag node is specified.
5840 * @return The conversion result is returned.
5843 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5849 jxhtml = GET_JXHTML(pdoc);
5854 if (IS_CSS_ON(jxhtml->entryp)) {
5855 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5863 * It is a handler who processes the MENU tag.
5865 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5866 * destination is specified.
5867 * @param node [i] The MENU tag node is specified.
5868 * @return The conversion result is returned.
5871 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5873 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5874 Doc *doc = jxhtml->doc;
5876 char *attr_style = NULL;
5877 char *attr_color = NULL;
5878 char *attr_type = NULL;
5879 char *attr_size = NULL;
5880 for (attr = qs_get_attr(doc,node);
5882 attr = qs_get_next_attr(doc,attr)) {
5883 char *name = qs_get_attr_name(doc,attr);
5884 char *value = qs_get_attr_value(doc,attr);
5885 if (STRCASEEQ('t','T',"type",name)) {
5886 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5890 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5894 if (IS_CSS_ON(jxhtml->entryp)) {
5895 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5897 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5898 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5899 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5900 css_property_t *cur;
5901 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5902 if (cur->value && *cur->value) {
5903 attr_color = apr_pstrdup(doc->pool, cur->value);
5906 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5907 if (cur->value && *cur->value) {
5908 attr_type = apr_pstrdup(doc->pool, cur->value);
5911 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5912 if (cur->value && *cur->value) {
5913 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5914 attr_size = apr_pstrdup(doc->pool, cur->value);
5916 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5917 attr_size = apr_pstrdup(doc->pool, cur->value);
5919 else if (STRCASEEQ('s','S',"small",cur->value)) {
5920 attr_size = apr_pstrdup(doc->pool, cur->value);
5922 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5923 attr_size = apr_pstrdup(doc->pool, cur->value);
5925 else if (STRCASEEQ('l','L',"large",cur->value)) {
5926 attr_size = apr_pstrdup(doc->pool, cur->value);
5928 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5929 attr_size = apr_pstrdup(doc->pool, cur->value);
5931 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5932 attr_size = apr_pstrdup(doc->pool, cur->value);
5939 if (attr_type || attr_color || attr_size) {
5942 W_L("list-style-type:");
5947 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5970 * It is a handler who processes the MENU tag.
5972 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5973 * destination is specified.
5974 * @param node [i] The MENU tag node is specified.
5975 * @return The conversion result is returned.
5978 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5980 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5981 Doc *doc = jxhtml->doc;
5983 if (IS_CSS_ON(jxhtml->entryp)) {
5984 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5991 * It is a handler who processes the PLAINTEXT tag.
5993 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5994 * destination is specified.
5995 * @param node [i] The PLAINTEXT tag node is specified.
5996 * @return The conversion result is returned.
5999 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
6004 jxhtml = GET_JXHTML(pdoc);
6007 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
6012 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
6017 jxhtml = GET_JXHTML(pdoc);
6019 for (child = qs_get_child_node(doc, node);
6021 child = qs_get_next_node(doc, child)) {
6023 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
6030 * It is a handler who processes the PLAINTEXT tag.
6032 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6033 * destination is specified.
6034 * @param node [i] The PLAINTEXT tag node is specified.
6035 * @return The conversion result is returned.
6038 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6040 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6046 * It is a handler who processes the BLINK tag.
6048 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6049 * destination is specified.
6050 * @param node [i] The BLINK tag node is specified.
6051 * @return The conversion result is returned.
6054 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
6056 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6057 Doc *doc = jxhtml->doc;
6059 char *attr_style = NULL;
6060 char *attr_color = NULL;
6061 char *attr_size = NULL;
6062 char *css_clear = NULL;
6064 for (attr = qs_get_attr(doc,node);
6066 attr = qs_get_next_attr(doc,attr)) {
6067 char *name = qs_get_attr_name(doc,attr);
6068 char *value = qs_get_attr_value(doc,attr);
6069 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6073 if (IS_CSS_ON(jxhtml->entryp)) {
6074 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6076 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6077 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6078 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
6080 css_property_t *cur;
6081 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6082 if (cur->value && *cur->value) {
6083 attr_color = apr_pstrdup(doc->pool, cur->value);
6086 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6087 if (cur->value && *cur->value) {
6088 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6089 attr_size = apr_pstrdup(doc->pool, cur->value);
6091 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6092 attr_size = apr_pstrdup(doc->pool, cur->value);
6094 else if (STRCASEEQ('s','S',"small",cur->value)) {
6095 attr_size = apr_pstrdup(doc->pool, cur->value);
6097 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6098 attr_size = apr_pstrdup(doc->pool, cur->value);
6100 else if (STRCASEEQ('l','L',"large",cur->value)) {
6101 attr_size = apr_pstrdup(doc->pool, cur->value);
6103 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6104 attr_size = apr_pstrdup(doc->pool, cur->value);
6106 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6107 attr_size = apr_pstrdup(doc->pool, cur->value);
6114 if (attr_color || attr_size) {
6117 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6135 * It is a handler who processes the BLINK tag.
6137 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6138 * destination is specified.
6139 * @param node [i] The BLINK tag node is specified.
6140 * @return The conversion result is returned.
6143 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6145 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6146 Doc *doc = jxhtml->doc;
6148 if (IS_CSS_ON(jxhtml->entryp)) {
6149 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6156 * It is a handler who processes the MARQUEE tag.
6158 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6159 * destination is specified.
6160 * @param node [i] The MARQUEE tag node is specified.
6161 * @return The conversion result is returned.
6164 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6166 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6167 Doc *doc = jxhtml->doc;
6169 char *attr_direction = NULL;
6170 char *attr_style = NULL;
6171 char *attr_color = NULL;
6172 char *attr_size = NULL;
6173 char *attr_bgcolor = NULL;
6174 /*--------------------------------------------------------------------------*/
6175 /* Get Attributes */
6176 /*--------------------------------------------------------------------------*/
6177 for (attr = qs_get_attr(doc,node);
6179 attr = qs_get_next_attr(doc,attr)) {
6180 char *name = qs_get_attr_name(doc,attr);
6181 char *value = qs_get_attr_value(doc,attr);
6182 if (STRCASEEQ('d','D',"direction", name)) {
6184 if (STRCASEEQ('l','L',"left",value)) {
6185 attr_direction = "rtl";
6187 else if (STRCASEEQ('r','R',"right",value)) {
6188 attr_direction = "ltr";
6192 else if (STRCASEEQ('b','B',"behavior",name)) {
6195 else if (STRCASEEQ('l','L',"loop",name)) {
6198 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6199 if (value && *value) {
6200 attr_bgcolor = value;
6203 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6207 if (IS_CSS_ON(jxhtml->entryp)) {
6208 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6210 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6211 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6212 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6213 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6214 css_property_t *cur;
6215 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6216 if (cur->value && *cur->value) {
6217 attr_color = apr_pstrdup(doc->pool, cur->value);
6220 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6221 if (cur->value && *cur->value) {
6222 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6225 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6226 if (cur->value && *cur->value) {
6227 attr_direction = apr_pstrdup(doc->pool, cur->value);
6230 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6231 if (cur->value && *cur->value) {
6232 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6233 || STRCASEEQ('x','X',"x-small", cur->value)
6234 || STRCASEEQ('s','S',"small", cur->value)
6235 || STRCASEEQ('m','M',"medium", cur->value)
6236 || STRCASEEQ('l','L',"large", cur->value)
6237 || STRCASEEQ('x','X',"x-large", cur->value)
6238 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6239 attr_size = apr_pstrdup(doc->pool, cur->value);
6246 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6248 if (attr_direction) {
6249 W_L("-wap-marquee-dir:");
6250 W_V(attr_direction);
6254 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6255 W_L("background-color:");
6260 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6279 * It is a handler who processes the MARQUEE tag.
6281 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6282 * destination is specified.
6283 * @param node [i] The MARQUEE tag node is specified.
6284 * @return The conversion result is returned.
6287 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6289 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6290 Doc *doc = jxhtml->doc;
6292 if (IS_CSS_ON(jxhtml->entryp)) {
6293 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6300 * It is handler who processes the New Line Code.
6303 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6305 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6306 if (jxhtml->start_html_flag) {
6307 Doc *doc = jxhtml->doc;
6315 * It is a handler who processes the LINK tag.
6317 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6318 * destination is specified.
6319 * @param node [i] The LINK tag node is specified.
6320 * @return The conversion result is returned.
6323 s_jxhtml_link_tag(void *pdoc, Node *node)
6332 jxhtml = GET_JXHTML(pdoc);
6335 if (! IS_CSS_ON(jxhtml->entryp)) {
6339 for (attr = qs_get_attr(doc,node);
6341 attr = qs_get_next_attr(doc,attr)) {
6342 char *name = qs_get_attr_name(doc,attr);
6343 char *value = qs_get_attr_value(doc,attr);
6344 if (STRCASEEQ('r','R',"rel", name)) {
6345 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6349 else if (STRCASEEQ('h','H',"href", name)) {
6350 if (value && *value) {
6354 else if (STRCASEEQ('t','T',"type", name)) {
6355 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6361 if (rel && href && type) {
6362 DBG(doc->r, "start load CSS. url:[%s]", href);
6363 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6364 DBG(doc->r, "end load CSS. url:[%s]", href);
6371 static css_prop_list_t *
6372 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6374 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6375 Doc *doc = jxhtml->doc;
6376 css_prop_list_t *last_css = NULL;
6377 if (IS_CSS_ON(jxhtml->entryp)) {
6378 css_prop_list_t *dup_css;
6379 css_selector_t *selector;
6381 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6382 dup_css = chxj_dup_css_prop_list(doc, last_css);
6383 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6385 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6387 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6388 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6390 if (style_attr_value) {
6391 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));
6393 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6401 static css_prop_list_t *
6402 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6404 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6405 Doc *doc = jxhtml->doc;
6406 css_prop_list_t *last_css = NULL;
6407 if (IS_CSS_ON(jxhtml->entryp)) {
6408 css_prop_list_t *dup_css;
6409 css_selector_t *selector;
6411 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6412 dup_css = chxj_dup_css_prop_list(doc, last_css);
6413 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6415 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6419 if (style_attr_value) {
6420 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));
6422 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6431 * It is a handler who processes the SPAN tag.
6433 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6434 * destination is specified.
6435 * @param node [i] The SPAN tag node is specified.
6436 * @return The conversion result is returned.
6439 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6444 char *attr_style = NULL;
6445 char *attr_color = NULL;
6446 char *attr_size = NULL;
6447 char *attr_align = NULL;
6448 char *attr_blink = NULL;
6449 char *attr_marquee = NULL;
6450 char *attr_marquee_dir = NULL;
6451 char *attr_marquee_style = NULL;
6452 char *attr_marquee_loop = NULL;
6453 char *css_bgcolor = NULL;
6455 jxhtml = GET_JXHTML(pdoc);
6458 for (attr = qs_get_attr(doc,node);
6460 attr = qs_get_next_attr(doc,attr)) {
6461 char *nm = qs_get_attr_name(doc,attr);
6462 char *val = qs_get_attr_value(doc,attr);
6463 if (val && STRCASEEQ('s','S',"style", nm)) {
6467 if (IS_CSS_ON(jxhtml->entryp)) {
6468 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6470 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6471 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6472 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6473 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6474 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6475 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6476 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6477 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6478 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6480 css_property_t *cur;
6481 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6482 attr_color = apr_pstrdup(doc->pool, cur->value);
6484 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6485 if (cur->value && *cur->value) {
6486 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6487 || STRCASEEQ('x','X',"x-small", cur->value)
6488 || STRCASEEQ('s','S',"small", cur->value)
6489 || STRCASEEQ('m','M',"medium", cur->value)
6490 || STRCASEEQ('l','L',"large", cur->value)
6491 || STRCASEEQ('x','X',"x-large", cur->value)
6492 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6493 attr_size = apr_pstrdup(doc->pool, cur->value);
6497 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6498 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6499 attr_blink = apr_pstrdup(doc->pool, cur->value);
6502 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6503 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6504 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6507 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6508 if (cur->value && *cur->value) {
6509 if ( STRCASEEQ('l','L',"ltr",cur->value)
6510 || STRCASEEQ('r','R',"rtl",cur->value)) {
6511 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6515 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6516 if (cur->value && *cur->value) {
6517 if ( STRCASEEQ('s','S',"scroll",cur->value)
6518 || STRCASEEQ('s','S',"slide",cur->value)
6519 || STRCASEEQ('a','A',"alternate",cur->value)) {
6520 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6524 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6525 if (cur->value && *cur->value) {
6526 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6527 attr_marquee_loop = "infinite";
6530 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6534 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6535 if (STRCASEEQ('l','L',"left", cur->value)) {
6536 attr_align = apr_pstrdup(doc->pool, "left");
6538 else if (STRCASEEQ('c','C',"center",cur->value)) {
6539 attr_align = apr_pstrdup(doc->pool, "center");
6541 else if (STRCASEEQ('r','R',"right",cur->value)) {
6542 attr_align = apr_pstrdup(doc->pool, "right");
6545 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6546 if (cur->value && *cur->value) {
6547 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6554 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6557 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6573 W_L("text-decoration:");
6578 W_L("display:-wap-marquee;");
6579 if (attr_marquee_dir) {
6580 W_L("-wap-marquee-dir:");
6581 W_V(attr_marquee_dir);
6584 if (attr_marquee_style) {
6585 W_L("-wap-marquee-style:");
6586 W_V(attr_marquee_style);
6589 if (attr_marquee_loop) {
6590 W_L("-wap-marquee-loop:");
6591 W_V(attr_marquee_loop);
6596 W_L("background-color:");
6608 * It is a handler who processes the SPAN tag.
6610 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6611 * destination is specified.
6612 * @param node [i] The SPAN tag node is specified.
6613 * @return The conversion result is returned.
6616 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6618 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6619 Doc *doc = jxhtml->doc;
6622 if (IS_CSS_ON(jxhtml->entryp)) {
6623 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6630 * It is a handler who processes the STYLE tag.
6632 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6633 * destination is specified.
6634 * @param node [i] The STYLE tag node is specified.
6635 * @return The conversion result is returned.
6638 s_jxhtml_style_tag(void *pdoc, Node *node)
6645 jxhtml = GET_JXHTML(pdoc);
6648 if (! IS_CSS_ON(jxhtml->entryp)) {
6652 for (attr = qs_get_attr(doc,node);
6654 attr = qs_get_next_attr(doc,attr)) {
6655 char *name = qs_get_attr_name(doc,attr);
6656 char *value = qs_get_attr_value(doc,attr);
6657 if (STRCASEEQ('t','T',"type", name)) {
6658 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6664 Node *child = qs_get_child_node(doc, node);
6665 if (type && child) {
6666 char *name = qs_get_node_name(doc, child);
6667 if (STRCASEEQ('t','T',"text", name)) {
6668 char *value = qs_get_node_value(doc, child);
6669 DBG(doc->r, "start load CSS. buf:[%s]", value);
6670 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6671 DBG(doc->r, "end load CSS. value:[%s]", value);
6677 * It is a handler who processes the OBJECT tag.
6679 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6680 * destination is specified.
6681 * @param node [i] The OBJECT tag node is specified.
6682 * @return The conversion result is returned.
6685 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6687 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6688 Doc *doc = jxhtml->doc;
6691 char *attr_id = NULL;
6692 char *attr_width = NULL;
6693 char *attr_height = NULL;
6694 char *attr_data = NULL;
6695 char *attr_type = NULL;
6696 char *attr_declare = NULL;
6697 char *attr_classid = NULL;
6698 char *attr_codebase = NULL;
6700 /*--------------------------------------------------------------------------*/
6701 /* Get Attributes */
6702 /*--------------------------------------------------------------------------*/
6703 for (attr = qs_get_attr(doc,node);
6705 attr = qs_get_next_attr(doc,attr)) {
6706 char *name = qs_get_attr_name(doc,attr);
6707 char *value = qs_get_attr_value(doc,attr);
6708 if (STRCASEEQ('i','I',"id",name)) {
6709 attr_id = apr_pstrdup(doc->pool, value);
6711 else if (STRCASEEQ('w','W',"width",name)) {
6712 attr_width = apr_pstrdup(doc->pool, value);
6714 else if (STRCASEEQ('h','H',"height",name)) {
6715 attr_height = apr_pstrdup(doc->pool, value);
6717 else if (STRCASEEQ('d','D',"data",name)) {
6718 attr_data = apr_pstrdup(doc->pool, value);
6720 else if (STRCASEEQ('t','T',"type",name)) {
6721 attr_type = apr_pstrdup(doc->pool, value);
6723 else if (STRCASEEQ('d','D',"declare",name)) {
6724 attr_declare = apr_pstrdup(doc->pool, value);
6726 else if (STRCASEEQ('c','C',"classid",name)) {
6727 attr_classid = apr_pstrdup(doc->pool, value);
6729 else if (STRCASEEQ('c','C',"codebase",name)) {
6730 attr_codebase = apr_pstrdup(doc->pool, value);
6762 W_L(" declare=\"declare\"");
6770 W_L(" codebase=\"");
6779 * It is a handler who processes the OBJECT tag.
6781 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6782 * destination is specified.
6783 * @param node [i] The OBJECT tag node is specified.
6784 * @return The conversion result is returned.
6787 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6789 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6790 Doc *doc = jxhtml->doc;
6796 * It is a handler who processes the OBJECT tag.
6798 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6799 * destination is specified.
6800 * @param node [i] The OBJECT tag node is specified.
6801 * @return The conversion result is returned.
6804 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6806 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6807 Doc *doc = jxhtml->doc;
6810 char *attr_style = NULL;
6811 char *attr_name = NULL;
6812 char *attr_value = NULL;
6813 char *attr_valuetype = NULL;
6815 /*--------------------------------------------------------------------------*/
6816 /* Get Attributes */
6817 /*--------------------------------------------------------------------------*/
6818 for (attr = qs_get_attr(doc,node);
6820 attr = qs_get_next_attr(doc,attr)) {
6821 char *name = qs_get_attr_name(doc,attr);
6822 char *value = qs_get_attr_value(doc,attr);
6823 if (STRCASEEQ('n','N',"name",name)) {
6824 attr_name = apr_pstrdup(doc->pool, value);
6826 else if (STRCASEEQ('v','V',"value",name)) {
6827 attr_value = apr_pstrdup(doc->pool, value);
6829 else if (STRCASEEQ('v','V',"valuetype",name)) {
6830 attr_valuetype = apr_pstrdup(doc->pool, value);
6846 W_L(" valuetype=\"");
6847 W_V(attr_valuetype);
6854 * It is a handler who processes the CAPTION tag.
6856 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6857 * destination is specified.
6858 * @param node [i] The CAPTION tag node is specified.
6859 * @return The conversion result is returned.
6862 s_jxhtml_start_caption_tag(void *pdoc, Node *node)
6868 char *attr_style = NULL;
6869 char *attr_align = NULL;
6871 jxhtml = GET_JXHTML(pdoc);
6875 for (attr = qs_get_attr(doc,node);
6877 attr = qs_get_next_attr(doc,attr)) {
6878 char *name = qs_get_attr_name(doc,attr);
6879 char *value = qs_get_attr_value(doc,attr);
6880 if (STRCASEEQ('a','A',"align", name)) {
6882 (STRCASEEQ('l','L',"left",value)
6883 || STRCASEEQ('r','R',"right",value)
6884 || STRCASEEQ('t','T',"top",value)
6885 || STRCASEEQ('b','B',"bottom",value)
6890 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6908 * It is a handler who processes the CAPTION tag.
6910 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6911 * destination is specified.
6912 * @param node [i] The CAPTION tag node is specified.
6913 * @return The conversion result is returned.
6916 s_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child))
6918 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
6919 Doc* doc = jxhtml->doc;