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);
5143 * It is a handler who processes the DD tag.
5145 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5146 * destination is specified.
5147 * @param node [i] The DD tag node is specified.
5148 * @return The conversion result is returned.
5151 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5153 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5154 Doc *doc = jxhtml->doc;
5156 if (IS_CSS_ON(jxhtml->entryp)) {
5157 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5164 * It is a handler who processes the H1 tag.
5166 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5167 * destination is specified.
5168 * @param node [i] The H1 tag node is specified.
5169 * @return The conversion result is returned.
5172 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5178 char *attr_style = NULL;
5179 char *attr_align = NULL;
5180 char *css_clear = NULL;
5182 jxhtml = GET_JXHTML(pdoc);
5186 for (attr = qs_get_attr(doc,node);
5188 attr = qs_get_next_attr(doc,attr)) {
5189 char *name = qs_get_attr_name(doc,attr);
5190 char *value = qs_get_attr_value(doc,attr);
5191 if (STRCASEEQ('a','A',"align", name)) {
5192 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5196 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5200 if (IS_CSS_ON(jxhtml->entryp)) {
5201 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5203 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5204 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5205 css_property_t *cur;
5206 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5207 if (STRCASEEQ('l','L',"left", cur->value)) {
5208 attr_align = apr_pstrdup(doc->pool, "left");
5210 else if (STRCASEEQ('c','C',"center",cur->value)) {
5211 attr_align = apr_pstrdup(doc->pool, "center");
5213 else if (STRCASEEQ('r','R',"right",cur->value)) {
5214 attr_align = apr_pstrdup(doc->pool, "right");
5217 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5218 if (STRCASEEQ('b','B',"both", cur->value)) {
5219 css_clear = apr_pstrdup(doc->pool, "both");
5221 else if (STRCASEEQ('r','R',"right", cur->value)) {
5222 css_clear = apr_pstrdup(doc->pool, "right");
5224 else if (STRCASEEQ('l','L',"left", cur->value)) {
5225 css_clear = apr_pstrdup(doc->pool, "left");
5231 if (attr_align || css_clear ) {
5252 * It is a handler who processes the H1 tag.
5254 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5255 * destination is specified.
5256 * @param node [i] The H1 tag node is specified.
5257 * @return The conversion result is returned.
5260 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5266 jxhtml = GET_JXHTML(pdoc);
5271 if (IS_CSS_ON(jxhtml->entryp)) {
5272 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5280 * It is a handler who processes the H2 tag.
5282 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5283 * destination is specified.
5284 * @param node [i] The H1 tag node is specified.
5285 * @return The conversion result is returned.
5288 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5294 char *attr_style = NULL;
5295 char *attr_align = NULL;
5296 char *css_clear = NULL;
5298 jxhtml = GET_JXHTML(pdoc);
5302 for (attr = qs_get_attr(doc,node);
5304 attr = qs_get_next_attr(doc,attr)) {
5305 char *name = qs_get_attr_name(doc,attr);
5306 char *value = qs_get_attr_value(doc,attr);
5307 if (STRCASEEQ('a','A',"align", name)) {
5308 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5312 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5316 if (IS_CSS_ON(jxhtml->entryp)) {
5317 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5319 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5320 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5321 css_property_t *cur;
5322 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5323 if (STRCASEEQ('l','L',"left", cur->value)) {
5324 attr_align = apr_pstrdup(doc->pool, "left");
5326 else if (STRCASEEQ('c','C',"center",cur->value)) {
5327 attr_align = apr_pstrdup(doc->pool, "center");
5329 else if (STRCASEEQ('r','R',"right",cur->value)) {
5330 attr_align = apr_pstrdup(doc->pool, "right");
5333 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5334 if (STRCASEEQ('b','B',"both", cur->value)) {
5335 css_clear = apr_pstrdup(doc->pool, "both");
5337 else if (STRCASEEQ('r','R',"right", cur->value)) {
5338 css_clear = apr_pstrdup(doc->pool, "right");
5340 else if (STRCASEEQ('l','L',"left", cur->value)) {
5341 css_clear = apr_pstrdup(doc->pool, "left");
5347 if (attr_align || css_clear ) {
5368 * It is a handler who processes the H2 tag.
5370 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5371 * destination is specified.
5372 * @param node [i] The H1 tag node is specified.
5373 * @return The conversion result is returned.
5376 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5382 jxhtml = GET_JXHTML(pdoc);
5387 if (IS_CSS_ON(jxhtml->entryp)) {
5388 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5395 * It is a handler who processes the H3 tag.
5397 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5398 * destination is specified.
5399 * @param node [i] The H1 tag node is specified.
5400 * @return The conversion result is returned.
5403 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5409 char *attr_style = NULL;
5410 char *attr_align = NULL;
5411 char *css_clear = NULL;
5413 jxhtml = GET_JXHTML(pdoc);
5417 for (attr = qs_get_attr(doc,node);
5419 attr = qs_get_next_attr(doc,attr)) {
5420 char *name = qs_get_attr_name(doc,attr);
5421 char *value = qs_get_attr_value(doc,attr);
5422 if (STRCASEEQ('a','A',"align", name)) {
5423 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5427 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5431 if (IS_CSS_ON(jxhtml->entryp)) {
5432 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5434 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5435 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5436 css_property_t *cur;
5437 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5438 if (STRCASEEQ('l','L',"left", cur->value)) {
5439 attr_align = apr_pstrdup(doc->pool, "left");
5441 else if (STRCASEEQ('c','C',"center",cur->value)) {
5442 attr_align = apr_pstrdup(doc->pool, "center");
5444 else if (STRCASEEQ('r','R',"right",cur->value)) {
5445 attr_align = apr_pstrdup(doc->pool, "right");
5448 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5449 if (STRCASEEQ('b','B',"both", cur->value)) {
5450 css_clear = apr_pstrdup(doc->pool, "both");
5452 else if (STRCASEEQ('r','R',"right", cur->value)) {
5453 css_clear = apr_pstrdup(doc->pool, "right");
5455 else if (STRCASEEQ('l','L',"left", cur->value)) {
5456 css_clear = apr_pstrdup(doc->pool, "left");
5462 if (attr_align || css_clear ) {
5483 * It is a handler who processes the H3 tag.
5485 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5486 * destination is specified.
5487 * @param node [i] The H1 tag node is specified.
5488 * @return The conversion result is returned.
5491 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5497 jxhtml = GET_JXHTML(pdoc);
5502 if (IS_CSS_ON(jxhtml->entryp)) {
5503 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5510 * It is a handler who processes the H4 tag.
5512 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5513 * destination is specified.
5514 * @param node [i] The H1 tag node is specified.
5515 * @return The conversion result is returned.
5518 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5524 char *attr_style = NULL;
5525 char *attr_align = NULL;
5526 char *css_clear = NULL;
5528 jxhtml = GET_JXHTML(pdoc);
5532 for (attr = qs_get_attr(doc,node);
5534 attr = qs_get_next_attr(doc,attr)) {
5535 char *name = qs_get_attr_name(doc,attr);
5536 char *value = qs_get_attr_value(doc,attr);
5537 if (STRCASEEQ('a','A',"align", name)) {
5538 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5542 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5546 if (IS_CSS_ON(jxhtml->entryp)) {
5547 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5549 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5550 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5551 css_property_t *cur;
5552 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5553 if (STRCASEEQ('l','L',"left", cur->value)) {
5554 attr_align = apr_pstrdup(doc->pool, "left");
5556 else if (STRCASEEQ('c','C',"center",cur->value)) {
5557 attr_align = apr_pstrdup(doc->pool, "center");
5559 else if (STRCASEEQ('r','R',"right",cur->value)) {
5560 attr_align = apr_pstrdup(doc->pool, "right");
5563 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5564 if (STRCASEEQ('b','B',"both", cur->value)) {
5565 css_clear = apr_pstrdup(doc->pool, "both");
5567 else if (STRCASEEQ('r','R',"right", cur->value)) {
5568 css_clear = apr_pstrdup(doc->pool, "right");
5570 else if (STRCASEEQ('l','L',"left", cur->value)) {
5571 css_clear = apr_pstrdup(doc->pool, "left");
5577 if (attr_align || css_clear ) {
5598 * It is a handler who processes the H4 tag.
5600 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5601 * destination is specified.
5602 * @param node [i] The H1 tag node is specified.
5603 * @return The conversion result is returned.
5606 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5612 jxhtml = GET_JXHTML(pdoc);
5617 if (IS_CSS_ON(jxhtml->entryp)) {
5618 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5626 * It is a handler who processes the H5 tag.
5628 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5629 * destination is specified.
5630 * @param node [i] The H1 tag node is specified.
5631 * @return The conversion result is returned.
5634 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5640 char *attr_style = NULL;
5641 char *attr_align = NULL;
5642 char *css_clear = NULL;
5644 jxhtml = GET_JXHTML(pdoc);
5648 for (attr = qs_get_attr(doc,node);
5650 attr = qs_get_next_attr(doc,attr)) {
5651 char *name = qs_get_attr_name(doc,attr);
5652 char *value = qs_get_attr_value(doc,attr);
5653 if (STRCASEEQ('a','A',"align", name)) {
5654 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5658 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5662 if (IS_CSS_ON(jxhtml->entryp)) {
5663 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5665 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5666 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5667 css_property_t *cur;
5668 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5669 if (STRCASEEQ('l','L',"left", cur->value)) {
5670 attr_align = apr_pstrdup(doc->pool, "left");
5672 else if (STRCASEEQ('c','C',"center",cur->value)) {
5673 attr_align = apr_pstrdup(doc->pool, "center");
5675 else if (STRCASEEQ('r','R',"right",cur->value)) {
5676 attr_align = apr_pstrdup(doc->pool, "right");
5679 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5680 if (STRCASEEQ('b','B',"both", cur->value)) {
5681 css_clear = apr_pstrdup(doc->pool, "both");
5683 else if (STRCASEEQ('r','R',"right", cur->value)) {
5684 css_clear = apr_pstrdup(doc->pool, "right");
5686 else if (STRCASEEQ('l','L',"left", cur->value)) {
5687 css_clear = apr_pstrdup(doc->pool, "left");
5693 if (attr_align || css_clear ) {
5714 * It is a handler who processes the H5 tag.
5716 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5717 * destination is specified.
5718 * @param node [i] The H1 tag node is specified.
5719 * @return The conversion result is returned.
5722 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5728 jxhtml = GET_JXHTML(pdoc);
5733 if (IS_CSS_ON(jxhtml->entryp)) {
5734 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5742 * It is a handler who processes the H6 tag.
5744 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5745 * destination is specified.
5746 * @param node [i] The H1 tag node is specified.
5747 * @return The conversion result is returned.
5750 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5756 char *attr_style = NULL;
5757 char *attr_align = NULL;
5758 char *css_clear = NULL;
5760 jxhtml = GET_JXHTML(pdoc);
5764 for (attr = qs_get_attr(doc,node);
5766 attr = qs_get_next_attr(doc,attr)) {
5767 char *name = qs_get_attr_name(doc,attr);
5768 char *value = qs_get_attr_value(doc,attr);
5769 if (STRCASEEQ('a','A',"align", name)) {
5770 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5774 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5778 if (IS_CSS_ON(jxhtml->entryp)) {
5779 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5781 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5782 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5783 css_property_t *cur;
5784 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5785 if (STRCASEEQ('l','L',"left", cur->value)) {
5786 attr_align = apr_pstrdup(doc->pool, "left");
5788 else if (STRCASEEQ('c','C',"center",cur->value)) {
5789 attr_align = apr_pstrdup(doc->pool, "center");
5791 else if (STRCASEEQ('r','R',"right",cur->value)) {
5792 attr_align = apr_pstrdup(doc->pool, "right");
5795 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5796 if (STRCASEEQ('b','B',"both", cur->value)) {
5797 css_clear = apr_pstrdup(doc->pool, "both");
5799 else if (STRCASEEQ('r','R',"right", cur->value)) {
5800 css_clear = apr_pstrdup(doc->pool, "right");
5802 else if (STRCASEEQ('l','L',"left", cur->value)) {
5803 css_clear = apr_pstrdup(doc->pool, "left");
5809 if (attr_align || css_clear ) {
5830 * It is a handler who processes the H6 tag.
5832 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5833 * destination is specified.
5834 * @param node [i] The H1 tag node is specified.
5835 * @return The conversion result is returned.
5838 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5844 jxhtml = GET_JXHTML(pdoc);
5849 if (IS_CSS_ON(jxhtml->entryp)) {
5850 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5858 * It is a handler who processes the MENU tag.
5860 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5861 * destination is specified.
5862 * @param node [i] The MENU tag node is specified.
5863 * @return The conversion result is returned.
5866 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5868 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5869 Doc *doc = jxhtml->doc;
5871 char *attr_style = NULL;
5872 char *attr_color = NULL;
5873 char *attr_type = NULL;
5874 char *attr_size = NULL;
5875 for (attr = qs_get_attr(doc,node);
5877 attr = qs_get_next_attr(doc,attr)) {
5878 char *name = qs_get_attr_name(doc,attr);
5879 char *value = qs_get_attr_value(doc,attr);
5880 if (STRCASEEQ('t','T',"type",name)) {
5881 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5885 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5889 if (IS_CSS_ON(jxhtml->entryp)) {
5890 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5892 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5893 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5894 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5895 css_property_t *cur;
5896 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5897 if (cur->value && *cur->value) {
5898 attr_color = apr_pstrdup(doc->pool, cur->value);
5901 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5902 if (cur->value && *cur->value) {
5903 attr_type = apr_pstrdup(doc->pool, cur->value);
5906 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5907 if (cur->value && *cur->value) {
5908 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5909 attr_size = apr_pstrdup(doc->pool, cur->value);
5911 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5912 attr_size = apr_pstrdup(doc->pool, cur->value);
5914 else if (STRCASEEQ('s','S',"small",cur->value)) {
5915 attr_size = apr_pstrdup(doc->pool, cur->value);
5917 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5918 attr_size = apr_pstrdup(doc->pool, cur->value);
5920 else if (STRCASEEQ('l','L',"large",cur->value)) {
5921 attr_size = apr_pstrdup(doc->pool, cur->value);
5923 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5924 attr_size = apr_pstrdup(doc->pool, cur->value);
5926 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5927 attr_size = apr_pstrdup(doc->pool, cur->value);
5934 if (attr_type || attr_color || attr_size) {
5937 W_L("list-style-type:");
5942 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5960 * It is a handler who processes the MENU tag.
5962 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5963 * destination is specified.
5964 * @param node [i] The MENU tag node is specified.
5965 * @return The conversion result is returned.
5968 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5970 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5971 Doc *doc = jxhtml->doc;
5973 if (IS_CSS_ON(jxhtml->entryp)) {
5974 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5981 * It is a handler who processes the PLAINTEXT tag.
5983 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5984 * destination is specified.
5985 * @param node [i] The PLAINTEXT tag node is specified.
5986 * @return The conversion result is returned.
5989 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5994 jxhtml = GET_JXHTML(pdoc);
5997 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
6002 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
6007 jxhtml = GET_JXHTML(pdoc);
6009 for (child = qs_get_child_node(doc, node);
6011 child = qs_get_next_node(doc, child)) {
6013 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
6020 * It is a handler who processes the PLAINTEXT tag.
6022 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6023 * destination is specified.
6024 * @param node [i] The PLAINTEXT tag node is specified.
6025 * @return The conversion result is returned.
6028 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6030 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6036 * It is a handler who processes the BLINK tag.
6038 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6039 * destination is specified.
6040 * @param node [i] The BLINK tag node is specified.
6041 * @return The conversion result is returned.
6044 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
6046 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6047 Doc *doc = jxhtml->doc;
6049 char *attr_style = NULL;
6050 char *attr_color = NULL;
6051 char *attr_size = NULL;
6052 for (attr = qs_get_attr(doc,node);
6054 attr = qs_get_next_attr(doc,attr)) {
6055 char *name = qs_get_attr_name(doc,attr);
6056 char *value = qs_get_attr_value(doc,attr);
6057 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6061 if (IS_CSS_ON(jxhtml->entryp)) {
6062 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6064 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6065 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6066 css_property_t *cur;
6067 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6068 if (cur->value && *cur->value) {
6069 attr_color = apr_pstrdup(doc->pool, cur->value);
6072 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6073 if (cur->value && *cur->value) {
6074 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6075 attr_size = apr_pstrdup(doc->pool, cur->value);
6077 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6078 attr_size = apr_pstrdup(doc->pool, cur->value);
6080 else if (STRCASEEQ('s','S',"small",cur->value)) {
6081 attr_size = apr_pstrdup(doc->pool, cur->value);
6083 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6084 attr_size = apr_pstrdup(doc->pool, cur->value);
6086 else if (STRCASEEQ('l','L',"large",cur->value)) {
6087 attr_size = apr_pstrdup(doc->pool, cur->value);
6089 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6090 attr_size = apr_pstrdup(doc->pool, cur->value);
6092 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6093 attr_size = apr_pstrdup(doc->pool, cur->value);
6100 if (attr_color || attr_size) {
6103 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6121 * It is a handler who processes the BLINK tag.
6123 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6124 * destination is specified.
6125 * @param node [i] The BLINK tag node is specified.
6126 * @return The conversion result is returned.
6129 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6131 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6132 Doc *doc = jxhtml->doc;
6134 if (IS_CSS_ON(jxhtml->entryp)) {
6135 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6142 * It is a handler who processes the MARQUEE tag.
6144 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6145 * destination is specified.
6146 * @param node [i] The MARQUEE tag node is specified.
6147 * @return The conversion result is returned.
6150 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6152 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6153 Doc *doc = jxhtml->doc;
6155 char *attr_direction = NULL;
6156 char *attr_style = NULL;
6157 char *attr_color = NULL;
6158 char *attr_size = NULL;
6159 char *attr_bgcolor = NULL;
6160 /*--------------------------------------------------------------------------*/
6161 /* Get Attributes */
6162 /*--------------------------------------------------------------------------*/
6163 for (attr = qs_get_attr(doc,node);
6165 attr = qs_get_next_attr(doc,attr)) {
6166 char *name = qs_get_attr_name(doc,attr);
6167 char *value = qs_get_attr_value(doc,attr);
6168 if (STRCASEEQ('d','D',"direction", name)) {
6170 if (STRCASEEQ('l','L',"left",value)) {
6171 attr_direction = "rtl";
6173 else if (STRCASEEQ('r','R',"right",value)) {
6174 attr_direction = "ltr";
6178 else if (STRCASEEQ('b','B',"behavior",name)) {
6181 else if (STRCASEEQ('l','L',"loop",name)) {
6184 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6185 if (value && *value) {
6186 attr_bgcolor = value;
6189 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6193 if (IS_CSS_ON(jxhtml->entryp)) {
6194 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6196 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6197 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6198 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6199 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6200 css_property_t *cur;
6201 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6202 if (cur->value && *cur->value) {
6203 attr_color = apr_pstrdup(doc->pool, cur->value);
6206 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6207 if (cur->value && *cur->value) {
6208 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6211 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6212 if (cur->value && *cur->value) {
6213 attr_direction = apr_pstrdup(doc->pool, cur->value);
6216 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6217 if (cur->value && *cur->value) {
6218 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6219 || STRCASEEQ('x','X',"x-small", cur->value)
6220 || STRCASEEQ('s','S',"small", cur->value)
6221 || STRCASEEQ('m','M',"medium", cur->value)
6222 || STRCASEEQ('l','L',"large", cur->value)
6223 || STRCASEEQ('x','X',"x-large", cur->value)
6224 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6225 attr_size = apr_pstrdup(doc->pool, cur->value);
6232 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6234 if (attr_direction) {
6235 W_L("-wap-marquee-dir:");
6236 W_V(attr_direction);
6240 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6241 W_L("background-color:");
6246 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6265 * It is a handler who processes the MARQUEE tag.
6267 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6268 * destination is specified.
6269 * @param node [i] The MARQUEE tag node is specified.
6270 * @return The conversion result is returned.
6273 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6275 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6276 Doc *doc = jxhtml->doc;
6278 if (IS_CSS_ON(jxhtml->entryp)) {
6279 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6286 * It is handler who processes the New Line Code.
6289 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6291 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6292 if (jxhtml->start_html_flag) {
6293 Doc *doc = jxhtml->doc;
6301 * It is a handler who processes the LINK tag.
6303 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6304 * destination is specified.
6305 * @param node [i] The LINK tag node is specified.
6306 * @return The conversion result is returned.
6309 s_jxhtml_link_tag(void *pdoc, Node *node)
6318 jxhtml = GET_JXHTML(pdoc);
6321 if (! IS_CSS_ON(jxhtml->entryp)) {
6325 for (attr = qs_get_attr(doc,node);
6327 attr = qs_get_next_attr(doc,attr)) {
6328 char *name = qs_get_attr_name(doc,attr);
6329 char *value = qs_get_attr_value(doc,attr);
6330 if (STRCASEEQ('r','R',"rel", name)) {
6331 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6335 else if (STRCASEEQ('h','H',"href", name)) {
6336 if (value && *value) {
6340 else if (STRCASEEQ('t','T',"type", name)) {
6341 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6347 if (rel && href && type) {
6348 DBG(doc->r, "start load CSS. url:[%s]", href);
6349 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6350 DBG(doc->r, "end load CSS. url:[%s]", href);
6357 static css_prop_list_t *
6358 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6360 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6361 Doc *doc = jxhtml->doc;
6362 css_prop_list_t *last_css = NULL;
6363 if (IS_CSS_ON(jxhtml->entryp)) {
6364 css_prop_list_t *dup_css;
6365 css_selector_t *selector;
6367 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6368 dup_css = chxj_dup_css_prop_list(doc, last_css);
6369 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6371 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6373 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6374 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6376 if (style_attr_value) {
6377 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));
6379 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6387 static css_prop_list_t *
6388 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6390 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6391 Doc *doc = jxhtml->doc;
6392 css_prop_list_t *last_css = NULL;
6393 if (IS_CSS_ON(jxhtml->entryp)) {
6394 css_prop_list_t *dup_css;
6395 css_selector_t *selector;
6397 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6398 dup_css = chxj_dup_css_prop_list(doc, last_css);
6399 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6401 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6405 if (style_attr_value) {
6406 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));
6408 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6417 * It is a handler who processes the SPAN tag.
6419 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6420 * destination is specified.
6421 * @param node [i] The SPAN tag node is specified.
6422 * @return The conversion result is returned.
6425 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6430 char *attr_style = NULL;
6431 char *attr_color = NULL;
6432 char *attr_size = NULL;
6433 char *attr_align = NULL;
6434 char *attr_blink = NULL;
6435 char *attr_marquee = NULL;
6436 char *attr_marquee_dir = NULL;
6437 char *attr_marquee_style = NULL;
6438 char *attr_marquee_loop = NULL;
6439 char *css_bgcolor = NULL;
6441 jxhtml = GET_JXHTML(pdoc);
6444 for (attr = qs_get_attr(doc,node);
6446 attr = qs_get_next_attr(doc,attr)) {
6447 char *nm = qs_get_attr_name(doc,attr);
6448 char *val = qs_get_attr_value(doc,attr);
6449 if (val && STRCASEEQ('s','S',"style", nm)) {
6453 if (IS_CSS_ON(jxhtml->entryp)) {
6454 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6456 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6457 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6458 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6459 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6460 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6461 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6462 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6463 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6464 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6466 css_property_t *cur;
6467 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6468 attr_color = apr_pstrdup(doc->pool, cur->value);
6470 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6471 if (cur->value && *cur->value) {
6472 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6473 || STRCASEEQ('x','X',"x-small", cur->value)
6474 || STRCASEEQ('s','S',"small", cur->value)
6475 || STRCASEEQ('m','M',"medium", cur->value)
6476 || STRCASEEQ('l','L',"large", cur->value)
6477 || STRCASEEQ('x','X',"x-large", cur->value)
6478 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6479 attr_size = apr_pstrdup(doc->pool, cur->value);
6483 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6484 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6485 attr_blink = apr_pstrdup(doc->pool, cur->value);
6488 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6489 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6490 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6493 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6494 if (cur->value && *cur->value) {
6495 if ( STRCASEEQ('l','L',"ltr",cur->value)
6496 || STRCASEEQ('r','R',"rtl",cur->value)) {
6497 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6501 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6502 if (cur->value && *cur->value) {
6503 if ( STRCASEEQ('s','S',"scroll",cur->value)
6504 || STRCASEEQ('s','S',"slide",cur->value)
6505 || STRCASEEQ('a','A',"alternate",cur->value)) {
6506 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6510 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6511 if (cur->value && *cur->value) {
6512 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6513 attr_marquee_loop = "infinite";
6516 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6520 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6521 if (STRCASEEQ('l','L',"left", cur->value)) {
6522 attr_align = apr_pstrdup(doc->pool, "left");
6524 else if (STRCASEEQ('c','C',"center",cur->value)) {
6525 attr_align = apr_pstrdup(doc->pool, "center");
6527 else if (STRCASEEQ('r','R',"right",cur->value)) {
6528 attr_align = apr_pstrdup(doc->pool, "right");
6531 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6532 if (cur->value && *cur->value) {
6533 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6540 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6543 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6559 W_L("text-decoration:");
6564 W_L("display:-wap-marquee;");
6565 if (attr_marquee_dir) {
6566 W_L("-wap-marquee-dir:");
6567 W_V(attr_marquee_dir);
6570 if (attr_marquee_style) {
6571 W_L("-wap-marquee-style:");
6572 W_V(attr_marquee_style);
6575 if (attr_marquee_loop) {
6576 W_L("-wap-marquee-loop:");
6577 W_V(attr_marquee_loop);
6582 W_L("background-color:");
6594 * It is a handler who processes the SPAN tag.
6596 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6597 * destination is specified.
6598 * @param node [i] The SPAN tag node is specified.
6599 * @return The conversion result is returned.
6602 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6604 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6605 Doc *doc = jxhtml->doc;
6608 if (IS_CSS_ON(jxhtml->entryp)) {
6609 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6616 * It is a handler who processes the STYLE tag.
6618 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6619 * destination is specified.
6620 * @param node [i] The STYLE tag node is specified.
6621 * @return The conversion result is returned.
6624 s_jxhtml_style_tag(void *pdoc, Node *node)
6631 jxhtml = GET_JXHTML(pdoc);
6634 if (! IS_CSS_ON(jxhtml->entryp)) {
6638 for (attr = qs_get_attr(doc,node);
6640 attr = qs_get_next_attr(doc,attr)) {
6641 char *name = qs_get_attr_name(doc,attr);
6642 char *value = qs_get_attr_value(doc,attr);
6643 if (STRCASEEQ('t','T',"type", name)) {
6644 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6650 Node *child = qs_get_child_node(doc, node);
6651 if (type && child) {
6652 char *name = qs_get_node_name(doc, child);
6653 if (STRCASEEQ('t','T',"text", name)) {
6654 char *value = qs_get_node_value(doc, child);
6655 DBG(doc->r, "start load CSS. buf:[%s]", value);
6656 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6657 DBG(doc->r, "end load CSS. value:[%s]", value);
6663 * It is a handler who processes the OBJECT tag.
6665 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6666 * destination is specified.
6667 * @param node [i] The OBJECT tag node is specified.
6668 * @return The conversion result is returned.
6671 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6673 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6674 Doc *doc = jxhtml->doc;
6677 char *attr_id = NULL;
6678 char *attr_width = NULL;
6679 char *attr_height = NULL;
6680 char *attr_data = NULL;
6681 char *attr_type = NULL;
6682 char *attr_declare = NULL;
6683 char *attr_classid = NULL;
6684 char *attr_codebase = NULL;
6686 /*--------------------------------------------------------------------------*/
6687 /* Get Attributes */
6688 /*--------------------------------------------------------------------------*/
6689 for (attr = qs_get_attr(doc,node);
6691 attr = qs_get_next_attr(doc,attr)) {
6692 char *name = qs_get_attr_name(doc,attr);
6693 char *value = qs_get_attr_value(doc,attr);
6694 if (STRCASEEQ('i','I',"id",name)) {
6695 attr_id = apr_pstrdup(doc->pool, value);
6697 else if (STRCASEEQ('w','W',"width",name)) {
6698 attr_width = apr_pstrdup(doc->pool, value);
6700 else if (STRCASEEQ('h','H',"height",name)) {
6701 attr_height = apr_pstrdup(doc->pool, value);
6703 else if (STRCASEEQ('d','D',"data",name)) {
6704 attr_data = apr_pstrdup(doc->pool, value);
6706 else if (STRCASEEQ('t','T',"type",name)) {
6707 attr_type = apr_pstrdup(doc->pool, value);
6709 else if (STRCASEEQ('d','D',"declare",name)) {
6710 attr_declare = apr_pstrdup(doc->pool, value);
6712 else if (STRCASEEQ('c','C',"classid",name)) {
6713 attr_classid = apr_pstrdup(doc->pool, value);
6715 else if (STRCASEEQ('c','C',"codebase",name)) {
6716 attr_codebase = apr_pstrdup(doc->pool, value);
6748 W_L(" declare=\"declare\"");
6756 W_L(" codebase=\"");
6765 * It is a handler who processes the OBJECT tag.
6767 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6768 * destination is specified.
6769 * @param node [i] The OBJECT tag node is specified.
6770 * @return The conversion result is returned.
6773 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6775 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6776 Doc *doc = jxhtml->doc;
6782 * It is a handler who processes the OBJECT tag.
6784 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6785 * destination is specified.
6786 * @param node [i] The OBJECT tag node is specified.
6787 * @return The conversion result is returned.
6790 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6792 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6793 Doc *doc = jxhtml->doc;
6796 char *attr_style = NULL;
6797 char *attr_name = NULL;
6798 char *attr_value = NULL;
6799 char *attr_valuetype = NULL;
6801 /*--------------------------------------------------------------------------*/
6802 /* Get Attributes */
6803 /*--------------------------------------------------------------------------*/
6804 for (attr = qs_get_attr(doc,node);
6806 attr = qs_get_next_attr(doc,attr)) {
6807 char *name = qs_get_attr_name(doc,attr);
6808 char *value = qs_get_attr_value(doc,attr);
6809 if (STRCASEEQ('n','N',"name",name)) {
6810 attr_name = apr_pstrdup(doc->pool, value);
6812 else if (STRCASEEQ('v','V',"value",name)) {
6813 attr_value = apr_pstrdup(doc->pool, value);
6815 else if (STRCASEEQ('v','V',"valuetype",name)) {
6816 attr_valuetype = apr_pstrdup(doc->pool, value);
6832 W_L(" valuetype=\"");
6833 W_V(attr_valuetype);
6840 * It is a handler who processes the CAPTION tag.
6842 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6843 * destination is specified.
6844 * @param node [i] The CAPTION tag node is specified.
6845 * @return The conversion result is returned.
6848 s_jxhtml_start_caption_tag(void *pdoc, Node *node)
6854 char *attr_style = NULL;
6855 char *attr_align = NULL;
6857 jxhtml = GET_JXHTML(pdoc);
6861 for (attr = qs_get_attr(doc,node);
6863 attr = qs_get_next_attr(doc,attr)) {
6864 char *name = qs_get_attr_name(doc,attr);
6865 char *value = qs_get_attr_value(doc,attr);
6866 if (STRCASEEQ('a','A',"align", name)) {
6868 (STRCASEEQ('l','L',"left",value)
6869 || STRCASEEQ('r','R',"right",value)
6870 || STRCASEEQ('t','T',"top",value)
6871 || STRCASEEQ('b','B',"bottom",value)
6876 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6894 * It is a handler who processes the CAPTION tag.
6896 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6897 * destination is specified.
6898 * @param node [i] The CAPTION tag node is specified.
6899 * @return The conversion result is returned.
6902 s_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child))
6904 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
6905 Doc* doc = jxhtml->doc;