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_alt = NULL;
3647 char *attr_style = NULL;
3648 char *attr_hspace = NULL;
3649 char *attr_vspace = NULL;
3651 char *css_float = NULL;
3652 char *css_margin_left = NULL;
3653 char *css_margin_right = NULL;
3654 char *css_margin_top = NULL;
3655 char *css_margin_bottom = NULL;
3656 char *css_display = NULL;
3657 char *css_valign = NULL;
3659 #ifndef IMG_NOT_CONVERT_FILENAME
3660 device_table *spec = jxhtml->spec;
3663 /*--------------------------------------------------------------------------*/
3664 /* Get Attributes */
3665 /*--------------------------------------------------------------------------*/
3666 for (attr = qs_get_attr(doc,node);
3668 attr = qs_get_next_attr(doc,attr)) {
3669 char *name = qs_get_attr_name(doc,attr);
3670 char *value = qs_get_attr_value(doc,attr);
3671 if (STRCASEEQ('s','S',"src",name)) {
3672 /*----------------------------------------------------------------------*/
3674 /*----------------------------------------------------------------------*/
3675 #ifdef IMG_NOT_CONVERT_FILENAME
3676 value = chxj_encoding_parameter(r, value, 1);
3677 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3678 value = chxj_add_cookie_no_update_parameter(r, value);
3679 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3682 value = chxj_img_conv(r, spec, value);
3683 value = chxj_encoding_parameter(r, value, 1);
3684 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3685 value = chxj_add_cookie_no_update_parameter(r, value);
3686 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3690 else if (STRCASEEQ('a','A',"align",name)) {
3691 /*----------------------------------------------------------------------*/
3693 /*----------------------------------------------------------------------*/
3695 if (STRCASEEQ('t','T',"top", value) ||
3696 STRCASEEQ('m','M',"middle",value) ||
3697 STRCASEEQ('b','B',"bottom",value)){
3699 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3702 else if (STRCASEEQ('c','C',"center",value)) {
3703 css_valign = apr_pstrdup(doc->pool, "middle");
3707 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3708 /*----------------------------------------------------------------------*/
3710 /*----------------------------------------------------------------------*/
3713 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3714 /*----------------------------------------------------------------------*/
3716 /*----------------------------------------------------------------------*/
3717 attr_height = value;
3719 else if (STRCASEEQ('h','H',"hspace",name)) {
3720 /*----------------------------------------------------------------------*/
3722 /*----------------------------------------------------------------------*/
3723 attr_hspace = value;
3725 else if (STRCASEEQ('v','V',"vspace",name)) {
3726 /*----------------------------------------------------------------------*/
3728 /*----------------------------------------------------------------------*/
3729 attr_vspace = value;
3731 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3732 /*----------------------------------------------------------------------*/
3734 /*----------------------------------------------------------------------*/
3737 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3738 /*----------------------------------------------------------------------*/
3740 /*----------------------------------------------------------------------*/
3745 if (IS_CSS_ON(jxhtml->entryp)) {
3746 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3748 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3749 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3750 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3751 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3752 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3753 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3754 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3757 css_property_t *cur;
3758 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3759 attr_height = apr_pstrdup(doc->pool, cur->value);
3761 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3762 attr_width = apr_pstrdup(doc->pool, cur->value);
3765 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3766 css_valign = apr_pstrdup(doc->pool, cur->value);
3769 if (! attr_hspace) {
3770 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3771 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3773 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3774 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3777 if (! attr_vspace) {
3778 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3779 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3781 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3782 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3786 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3787 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3788 css_float = apr_pstrdup(doc->pool, cur->value);
3792 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3793 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3794 char *tmp = apr_pstrdup(doc->pool, cur->value);
3795 char *tmpp = strstr(tmp, "none");
3797 css_display = apr_pstrdup(doc->pool, tmp);
3809 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3817 W_L("vertical-align:");
3822 W_L("margin-left:");
3825 W_L("margin-right:");
3830 if(css_margin_left){
3831 W_L("margin-left:");
3832 W_V(css_margin_left);
3835 if(css_margin_right){
3836 W_L("margin-right:");
3837 W_V(css_margin_right);
3845 W_L("margin-bottom:");
3852 W_V(css_margin_top);
3855 if(css_margin_bottom){
3856 W_L("margin-bottom:");
3857 W_V(css_margin_bottom);
3862 W_L("display:none;");
3891 * It is a handler who processes the IMG tag.
3893 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3894 * destination is specified.
3895 * @param node [i] The IMG tag node is specified.
3896 * @return The conversion result is returned.
3899 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3901 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3907 * It is a handler who processes the SELECT tag.
3909 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3910 * destination is specified.
3911 * @param node [i] The SELECT tag node is specified.
3912 * @return The conversion result is returned.
3915 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3917 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3918 Doc *doc = jxhtml->doc;
3922 char *multiple = NULL;
3923 char *attr_style = NULL;
3926 for (attr = qs_get_attr(doc,node);
3928 attr = qs_get_next_attr(doc,attr)) {
3929 char *nm = qs_get_attr_name(doc,attr);
3930 char *val = qs_get_attr_value(doc,attr);
3931 if (STRCASEEQ('s','S',"size",nm)) {
3932 /*----------------------------------------------------------------------*/
3933 /* CHTML 1.0 version 2.0 */
3934 /*----------------------------------------------------------------------*/
3935 size = apr_pstrdup(doc->buf.pool, val);
3937 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3938 /*----------------------------------------------------------------------*/
3939 /* CHTML 1.0 version 2.0 */
3940 /*----------------------------------------------------------------------*/
3941 attr_style = apr_pstrdup(doc->buf.pool, val);
3943 else if (STRCASEEQ('n','N',"name",nm)) {
3944 /*----------------------------------------------------------------------*/
3945 /* CHTML 1.0 version 2.0 */
3946 /*----------------------------------------------------------------------*/
3947 name = apr_pstrdup(doc->buf.pool, val);
3949 else if (STRCASEEQ('m','M',"multiple", nm)) {
3950 /*----------------------------------------------------------------------*/
3951 /* CHTML 1.0 version 2.0 */
3952 /*----------------------------------------------------------------------*/
3953 multiple = apr_pstrdup(doc->buf.pool, val);
3956 if (size && *size) {
3961 if (name && *name) {
3971 if (IS_CSS_ON(jxhtml->entryp)) {
3972 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3980 * It is a handler who processes the SELECT tag.
3982 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3983 * destination is specified.
3984 * @param node [i] The SELECT tag node is specified.
3985 * @return The conversion result is returned.
3988 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3990 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3991 Doc *doc = jxhtml->doc;
3994 if (IS_CSS_ON(jxhtml->entryp)) {
3995 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4002 * It is a handler who processes the OPTION tag.
4004 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4005 * destination is specified.
4006 * @param node [i] The OPTION tag node is specified.
4007 * @return The conversion result is returned.
4010 s_jxhtml_start_option_tag(void *pdoc, Node *node)
4012 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4013 Doc *doc = jxhtml->doc;
4016 char *selected = NULL;
4018 char *attr_style = NULL;
4021 for (attr = qs_get_attr(doc,node);
4023 attr = qs_get_next_attr(doc,attr)) {
4024 char *nm = qs_get_attr_name(doc,attr);
4025 char *val = qs_get_attr_value(doc,attr);
4026 if (STRCASEEQ('s','S',"selected",nm)) {
4027 /*----------------------------------------------------------------------*/
4028 /* CHTML 1.0 version 2.0 */
4029 /*----------------------------------------------------------------------*/
4030 selected = apr_pstrdup(doc->buf.pool, val);
4032 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4033 /*----------------------------------------------------------------------*/
4034 /* CHTML 1.0 version 2.0 */
4035 /*----------------------------------------------------------------------*/
4036 attr_style = apr_pstrdup(doc->buf.pool, val);
4038 else if (STRCASEEQ('v','V',"value",nm)) {
4039 /*----------------------------------------------------------------------*/
4040 /* CHTML 1.0 version 2.0 */
4041 /*----------------------------------------------------------------------*/
4042 value = apr_pstrdup(doc->buf.pool, val);
4055 if (IS_CSS_ON(jxhtml->entryp)) {
4056 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4064 * It is a handler who processes the OPTION tag.
4066 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4067 * destination is specified.
4068 * @param node [i] The OPTION tag node is specified.
4069 * @return The conversion result is returned.
4072 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
4074 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4075 Doc *doc = jxhtml->doc;
4078 if (IS_CSS_ON(jxhtml->entryp)) {
4079 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4087 * It is a handler who processes the DIV tag.
4089 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4090 * destination is specified.
4091 * @param node [i] The DIV tag node is specified.
4092 * @return The conversion result is returned.
4095 s_jxhtml_start_div_tag(void *pdoc, Node *node)
4101 char *attr_style = NULL;
4102 char *attr_align = NULL;
4103 char *attr_display = NULL;
4104 char *attr_decoration = NULL;
4105 char *attr_wap_marquee_style = NULL;
4106 char *attr_wap_marquee_dir = NULL;
4107 char *attr_wap_marquee_loop = NULL;
4108 char *attr_color = NULL;
4109 char *attr_bgcolor = NULL;
4110 char *attr_font_size = NULL;
4111 char *css_clear = NULL;
4113 jxhtml = GET_JXHTML(pdoc);
4117 for (attr = qs_get_attr(doc,node);
4119 attr = qs_get_next_attr(doc,attr)) {
4120 char *nm = qs_get_attr_name(doc,attr);
4121 char *val = qs_get_attr_value(doc,attr);
4122 if (STRCASEEQ('a','A',"align",nm)) {
4123 /*----------------------------------------------------------------------*/
4124 /* CHTML 1.0 (W3C version 3.2) */
4125 /*----------------------------------------------------------------------*/
4126 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4127 attr_align = apr_pstrdup(doc->buf.pool, val);
4130 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4131 attr_style = apr_pstrdup(doc->buf.pool, val);
4135 if (IS_CSS_ON(jxhtml->entryp)) {
4136 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4138 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4139 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4140 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4141 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4142 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4143 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4144 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4145 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4147 css_property_t *cur;
4148 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4149 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4150 attr_display = apr_pstrdup(doc->pool, cur->value);
4153 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4154 if (STRCASEEQ('b','B',"blink", cur->value)) {
4155 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4158 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4159 attr_color = apr_pstrdup(doc->pool, cur->value);
4161 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4162 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4163 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4165 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4166 char *ss = strchr(cur->value, '#');
4168 ss = strstr(cur->value, "rgb");
4171 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4172 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4175 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4176 attr_align = apr_pstrdup(doc->pool, cur->value);
4178 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4179 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4180 || STRCASEEQ('x','X',"x-small",cur->value)
4181 || STRCASEEQ('s','S',"small",cur->value)
4182 || STRCASEEQ('m','M',"medium",cur->value)
4183 || STRCASEEQ('l','L',"large",cur->value)
4184 || STRCASEEQ('x','X',"x-large",cur->value)
4185 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4186 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4190 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4191 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4192 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4193 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4194 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4195 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4198 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4199 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4200 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4202 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4203 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4206 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4207 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4208 attr_wap_marquee_loop = "infinite";
4211 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4215 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4216 css_clear = apr_pstrdup(doc->pool, cur->value);
4224 || attr_wap_marquee_style
4225 || attr_wap_marquee_dir
4226 || attr_wap_marquee_loop
4242 if (attr_decoration) {
4243 W_L("text-decoration:");
4244 W_V(attr_decoration);
4247 if (attr_wap_marquee_style) {
4248 W_L("-wap-marquee-style:");
4249 W_V(attr_wap_marquee_style);
4252 if (attr_wap_marquee_dir) {
4253 W_L("-wap-marquee-dir:");
4254 W_V(attr_wap_marquee_dir);
4257 if (attr_wap_marquee_loop) {
4258 W_L("-wap-marquee-loop:");
4259 W_V(attr_wap_marquee_loop);
4268 W_L("background-color:");
4272 if (attr_font_size) {
4274 W_V(attr_font_size);
4290 * It is a handler who processes the DIV tag.
4292 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4293 * destination is specified.
4294 * @param node [i] The DIV tag node is specified.
4295 * @return The conversion result is returned.
4298 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4304 jxhtml = GET_JXHTML(pdoc);
4309 if (IS_CSS_ON(jxhtml->entryp)) {
4310 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4317 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4324 jxhtml = GET_JXHTML(pdoc);
4328 for (child = qs_get_child_node(doc, node);
4330 child = qs_get_next_node(doc, child)) {
4332 s_jxhtml_chxjif_tag(jxhtml, child);
4339 * It is a handler who processes the TEXTARE tag.
4341 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4342 * destination is specified.
4343 * @param node [i] The TEXTAREA tag node is specified.
4344 * @return The conversion result is returned.
4347 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4353 char *attr_accesskey = NULL;
4354 char *attr_name = NULL;
4355 char *attr_rows = NULL;
4356 char *attr_cols = NULL;
4357 char *attr_istyle = NULL;
4358 char *attr_style = NULL;
4361 jxhtml = GET_JXHTML(pdoc);
4365 jxhtml->textarea_flag++;
4366 for (attr = qs_get_attr(doc,node);
4368 attr = qs_get_next_attr(doc,attr)) {
4369 char *name = qs_get_attr_name(doc,attr);
4370 char *value = qs_get_attr_value(doc,attr);
4371 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4372 attr_accesskey = value;
4374 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4375 attr_istyle = value;
4377 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4380 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4383 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4386 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4390 if (IS_CSS_ON(jxhtml->entryp)) {
4391 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4393 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4394 css_property_t *cur;
4395 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4396 if (strcasestr(cur->value, "<ja:n>")) {
4399 else if (strcasestr(cur->value, "<ja:en>")) {
4402 else if (strcasestr(cur->value, "<ja:hk>")) {
4405 else if (strcasestr(cur->value, "<ja:h>")) {
4412 if (attr_accesskey) {
4413 W_L(" accesskey=\"");
4414 W_V(attr_accesskey);
4437 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
4439 W_L("-wap-input-format:");
4451 * It is a handler who processes the TEXTAREA tag.
4453 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4454 * destination is specified.
4455 * @param node [i] The TEXTAREA tag node is specified.
4456 * @return The conversion result is returned.
4459 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4465 jxhtml = GET_JXHTML(pdoc);
4470 jxhtml->textarea_flag--;
4477 * It is a handler who processes the B tag.
4479 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4480 * destination is specified.
4481 * @param node [i] The B tag node is specified.
4482 * @return The conversion result is returned.
4485 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4491 jxhtml = GET_JXHTML(pdoc);
4501 * It is a handler who processes the B tag.
4503 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4504 * destination is specified.
4505 * @param node [i] The B tag node is specified.
4506 * @return The conversion result is returned.
4509 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4511 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4512 Doc* doc = jxhtml->doc;
4519 s_jxhtml_text_tag(void* pdoc, Node* child)
4530 apr_size_t z2h_input_len;
4532 jxhtml = GET_JXHTML(pdoc);
4536 textval = qs_get_node_value(doc,child);
4537 if (strlen(textval) == 0) {
4541 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4542 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4544 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4545 memset(one_byte, 0, sizeof(one_byte));
4548 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4550 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4552 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4557 if (is_sjis_kanji(textval[ii])) {
4558 one_byte[0] = textval[ii+0];
4559 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4560 one_byte[0] = textval[ii+1];
4561 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4565 if (jxhtml->pre_flag) {
4566 one_byte[0] = textval[ii+0];
4567 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4570 if (jxhtml->textarea_flag) {
4571 one_byte[0] = textval[ii+0];
4572 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4575 if (textval[ii] != '\r' && textval[ii] != '\n') {
4576 one_byte[0] = textval[ii+0];
4577 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4581 z2h_input_len = strlen(tdst);
4582 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4590 * It is a handler who processes the BLOCKQUOTE tag.
4592 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4593 * destination is specified.
4594 * @param node [i] The BLOCKQUOTE tag node is specified.
4595 * @return The conversion result is returned.
4598 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4603 char *attr_style = NULL;
4604 char *attr_color = NULL;
4605 char *attr_size = NULL;
4606 char *css_clear = NULL;
4608 jxhtml = GET_JXHTML(pdoc);
4610 for (attr = qs_get_attr(doc,node);
4612 attr = qs_get_next_attr(doc,attr)) {
4613 char *nm = qs_get_attr_name(doc,attr);
4614 char *val = qs_get_attr_value(doc,attr);
4615 if (val && STRCASEEQ('s','S',"style", nm)) {
4619 if (IS_CSS_ON(jxhtml->entryp)) {
4620 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4622 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4623 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4624 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4626 css_property_t *cur;
4627 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4628 if (cur->value && *cur->value) {
4629 attr_color = apr_pstrdup(doc->pool, cur->value);
4632 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4633 if (cur->value && *cur->value) {
4634 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4635 attr_size = apr_pstrdup(doc->pool, cur->value);
4637 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4638 attr_size = apr_pstrdup(doc->pool, cur->value);
4640 else if (STRCASEEQ('s','S',"small",cur->value)) {
4641 attr_size = apr_pstrdup(doc->pool, cur->value);
4643 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4644 attr_size = apr_pstrdup(doc->pool, cur->value);
4646 else if (STRCASEEQ('l','L',"large",cur->value)) {
4647 attr_size = apr_pstrdup(doc->pool, cur->value);
4649 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4650 attr_size = apr_pstrdup(doc->pool, cur->value);
4652 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4653 attr_size = apr_pstrdup(doc->pool, cur->value);
4657 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4658 css_clear = apr_pstrdup(doc->pool, cur->value);
4663 if (attr_color || attr_size || css_clear) {
4666 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4689 * It is a handler who processes the BLOCKQUOTE tag.
4691 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4692 * destination is specified.
4693 * @param node [i] The BLOCKQUOTE tag node is specified.
4694 * @return The conversion result is returned.
4697 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4699 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4700 Doc *doc = jxhtml->doc;
4701 W_L("</blockquote>");
4702 if (IS_CSS_ON(jxhtml->entryp)) {
4703 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4710 * It is a handler who processes the DIR tag.
4712 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4713 * destination is specified.
4714 * @param node [i] The DIR tag node is specified.
4715 * @return The conversion result is returned.
4718 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4720 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4721 Doc *doc = jxhtml->doc;
4723 char *attr_style = NULL;
4724 char *attr_color = NULL;
4725 char *attr_type = NULL;
4726 char *attr_size = NULL;
4727 for (attr = qs_get_attr(doc,node);
4729 attr = qs_get_next_attr(doc,attr)) {
4730 char *name = qs_get_attr_name(doc,attr);
4731 char *value = qs_get_attr_value(doc,attr);
4732 if (STRCASEEQ('t','T',"type",name)) {
4733 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4737 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4741 if (IS_CSS_ON(jxhtml->entryp)) {
4742 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4744 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4745 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4746 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4747 css_property_t *cur;
4748 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4749 if (cur->value && *cur->value) {
4750 attr_color = apr_pstrdup(doc->pool, cur->value);
4753 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4754 if (cur->value && *cur->value) {
4755 attr_type = apr_pstrdup(doc->pool, cur->value);
4758 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4759 if (cur->value && *cur->value) {
4760 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4761 attr_size = apr_pstrdup(doc->pool, cur->value);
4763 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4764 attr_size = apr_pstrdup(doc->pool, cur->value);
4766 else if (STRCASEEQ('s','S',"small",cur->value)) {
4767 attr_size = apr_pstrdup(doc->pool, cur->value);
4769 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4770 attr_size = apr_pstrdup(doc->pool, cur->value);
4772 else if (STRCASEEQ('l','L',"large",cur->value)) {
4773 attr_size = apr_pstrdup(doc->pool, cur->value);
4775 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4776 attr_size = apr_pstrdup(doc->pool, cur->value);
4778 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4779 attr_size = apr_pstrdup(doc->pool, cur->value);
4786 if (attr_type || attr_color || attr_size) {
4789 W_L("list-style-type:");
4794 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4812 * It is a handler who processes the DIR tag.
4814 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4815 * destination is specified.
4816 * @param node [i] The DIR tag node is specified.
4817 * @return The conversion result is returned.
4820 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4822 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4823 Doc *doc = jxhtml->doc;
4825 if (IS_CSS_ON(jxhtml->entryp)) {
4826 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4833 * It is a handler who processes the DL tag.
4835 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4836 * destination is specified.
4837 * @param node [i] The DL tag node is specified.
4838 * @return The conversion result is returned.
4841 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4843 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4844 Doc *doc = jxhtml->doc;
4846 char *attr_style = NULL;
4847 char *attr_color = NULL;
4848 char *attr_size = NULL;
4849 char *css_clear = NULL;
4851 for (attr = qs_get_attr(doc,node);
4853 attr = qs_get_next_attr(doc,attr)) {
4854 char *name = qs_get_attr_name(doc,attr);
4855 char *value = qs_get_attr_value(doc,attr);
4856 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4860 if (IS_CSS_ON(jxhtml->entryp)) {
4861 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4863 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4864 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4865 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4867 css_property_t *cur;
4868 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4869 if (cur->value && *cur->value) {
4870 attr_color = apr_pstrdup(doc->pool, cur->value);
4873 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4874 if (cur->value && *cur->value) {
4875 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4876 attr_size = apr_pstrdup(doc->pool, cur->value);
4878 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4879 attr_size = apr_pstrdup(doc->pool, cur->value);
4881 else if (STRCASEEQ('s','S',"small",cur->value)) {
4882 attr_size = apr_pstrdup(doc->pool, cur->value);
4884 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4885 attr_size = apr_pstrdup(doc->pool, cur->value);
4887 else if (STRCASEEQ('l','L',"large",cur->value)) {
4888 attr_size = apr_pstrdup(doc->pool, cur->value);
4890 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4891 attr_size = apr_pstrdup(doc->pool, cur->value);
4893 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4894 attr_size = apr_pstrdup(doc->pool, cur->value);
4898 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4899 css_clear = apr_pstrdup(doc->pool, cur->value);
4904 if (attr_color || attr_size || css_clear) {
4907 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4930 * It is a handler who processes the DL tag.
4932 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4933 * destination is specified.
4934 * @param node [i] The DL tag node is specified.
4935 * @return The conversion result is returned.
4938 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4940 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4941 Doc *doc = jxhtml->doc;
4943 if (IS_CSS_ON(jxhtml->entryp)) {
4944 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4951 * It is a handler who processes the DT tag.
4953 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4954 * destination is specified.
4955 * @param node [i] The DT tag node is specified.
4956 * @return The conversion result is returned.
4959 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4961 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4962 Doc *doc = jxhtml->doc;
4964 char *attr_style = NULL;
4965 char *attr_color = NULL;
4966 char *attr_size = NULL;
4967 for (attr = qs_get_attr(doc,node);
4969 attr = qs_get_next_attr(doc,attr)) {
4970 char *name = qs_get_attr_name(doc,attr);
4971 char *value = qs_get_attr_value(doc,attr);
4972 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4976 if (IS_CSS_ON(jxhtml->entryp)) {
4977 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4979 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4980 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4981 css_property_t *cur;
4982 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4983 if (cur->value && *cur->value) {
4984 attr_color = apr_pstrdup(doc->pool, cur->value);
4987 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4988 if (cur->value && *cur->value) {
4989 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4990 attr_size = apr_pstrdup(doc->pool, cur->value);
4992 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4993 attr_size = apr_pstrdup(doc->pool, cur->value);
4995 else if (STRCASEEQ('s','S',"small",cur->value)) {
4996 attr_size = apr_pstrdup(doc->pool, cur->value);
4998 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4999 attr_size = apr_pstrdup(doc->pool, cur->value);
5001 else if (STRCASEEQ('l','L',"large",cur->value)) {
5002 attr_size = apr_pstrdup(doc->pool, cur->value);
5004 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5005 attr_size = apr_pstrdup(doc->pool, cur->value);
5007 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5008 attr_size = apr_pstrdup(doc->pool, cur->value);
5015 if (attr_color || attr_size) {
5018 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5036 * It is a handler who processes the DT tag.
5038 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5039 * destination is specified.
5040 * @param node [i] The DT tag node is specified.
5041 * @return The conversion result is returned.
5044 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
5046 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5047 Doc *doc = jxhtml->doc;
5049 if (IS_CSS_ON(jxhtml->entryp)) {
5050 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5057 * It is a handler who processes the DD tag.
5059 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5060 * destination is specified.
5061 * @param node [i] The DD tag node is specified.
5062 * @return The conversion result is returned.
5065 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
5067 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5068 Doc *doc = jxhtml->doc;
5070 char *attr_style = NULL;
5071 char *attr_color = NULL;
5072 char *attr_size = NULL;
5073 char *css_clear = NULL;
5075 for (attr = qs_get_attr(doc,node);
5077 attr = qs_get_next_attr(doc,attr)) {
5078 char *name = qs_get_attr_name(doc,attr);
5079 char *value = qs_get_attr_value(doc,attr);
5080 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5084 if (IS_CSS_ON(jxhtml->entryp)) {
5085 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5087 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5088 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5089 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5090 css_property_t *cur;
5091 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5092 if (cur->value && *cur->value) {
5093 attr_color = apr_pstrdup(doc->pool, cur->value);
5096 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5097 if (cur->value && *cur->value) {
5098 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5099 attr_size = apr_pstrdup(doc->pool, cur->value);
5101 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5102 attr_size = apr_pstrdup(doc->pool, cur->value);
5104 else if (STRCASEEQ('s','S',"small",cur->value)) {
5105 attr_size = apr_pstrdup(doc->pool, cur->value);
5107 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5108 attr_size = apr_pstrdup(doc->pool, cur->value);
5110 else if (STRCASEEQ('l','L',"large",cur->value)) {
5111 attr_size = apr_pstrdup(doc->pool, cur->value);
5113 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5114 attr_size = apr_pstrdup(doc->pool, cur->value);
5116 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5117 attr_size = apr_pstrdup(doc->pool, cur->value);
5121 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5122 css_clear = apr_pstrdup(doc->pool, cur->value);
5127 if (attr_color || attr_size) {
5130 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5153 * It is a handler who processes the DD tag.
5155 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5156 * destination is specified.
5157 * @param node [i] The DD tag node is specified.
5158 * @return The conversion result is returned.
5161 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5163 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5164 Doc *doc = jxhtml->doc;
5166 if (IS_CSS_ON(jxhtml->entryp)) {
5167 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5174 * It is a handler who processes the H1 tag.
5176 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5177 * destination is specified.
5178 * @param node [i] The H1 tag node is specified.
5179 * @return The conversion result is returned.
5182 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5188 char *attr_style = NULL;
5189 char *attr_align = NULL;
5190 char *css_clear = NULL;
5192 jxhtml = GET_JXHTML(pdoc);
5196 for (attr = qs_get_attr(doc,node);
5198 attr = qs_get_next_attr(doc,attr)) {
5199 char *name = qs_get_attr_name(doc,attr);
5200 char *value = qs_get_attr_value(doc,attr);
5201 if (STRCASEEQ('a','A',"align", name)) {
5202 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5206 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5210 if (IS_CSS_ON(jxhtml->entryp)) {
5211 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5213 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5214 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5215 css_property_t *cur;
5216 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5217 if (STRCASEEQ('l','L',"left", cur->value)) {
5218 attr_align = apr_pstrdup(doc->pool, "left");
5220 else if (STRCASEEQ('c','C',"center",cur->value)) {
5221 attr_align = apr_pstrdup(doc->pool, "center");
5223 else if (STRCASEEQ('r','R',"right",cur->value)) {
5224 attr_align = apr_pstrdup(doc->pool, "right");
5227 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5228 if (STRCASEEQ('b','B',"both", cur->value)) {
5229 css_clear = apr_pstrdup(doc->pool, "both");
5231 else if (STRCASEEQ('r','R',"right", cur->value)) {
5232 css_clear = apr_pstrdup(doc->pool, "right");
5234 else if (STRCASEEQ('l','L',"left", cur->value)) {
5235 css_clear = apr_pstrdup(doc->pool, "left");
5241 if (attr_align || css_clear ) {
5262 * It is a handler who processes the H1 tag.
5264 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5265 * destination is specified.
5266 * @param node [i] The H1 tag node is specified.
5267 * @return The conversion result is returned.
5270 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5276 jxhtml = GET_JXHTML(pdoc);
5281 if (IS_CSS_ON(jxhtml->entryp)) {
5282 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5290 * It is a handler who processes the H2 tag.
5292 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5293 * destination is specified.
5294 * @param node [i] The H1 tag node is specified.
5295 * @return The conversion result is returned.
5298 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5304 char *attr_style = NULL;
5305 char *attr_align = NULL;
5306 char *css_clear = NULL;
5308 jxhtml = GET_JXHTML(pdoc);
5312 for (attr = qs_get_attr(doc,node);
5314 attr = qs_get_next_attr(doc,attr)) {
5315 char *name = qs_get_attr_name(doc,attr);
5316 char *value = qs_get_attr_value(doc,attr);
5317 if (STRCASEEQ('a','A',"align", name)) {
5318 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5322 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5326 if (IS_CSS_ON(jxhtml->entryp)) {
5327 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5329 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5330 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5331 css_property_t *cur;
5332 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5333 if (STRCASEEQ('l','L',"left", cur->value)) {
5334 attr_align = apr_pstrdup(doc->pool, "left");
5336 else if (STRCASEEQ('c','C',"center",cur->value)) {
5337 attr_align = apr_pstrdup(doc->pool, "center");
5339 else if (STRCASEEQ('r','R',"right",cur->value)) {
5340 attr_align = apr_pstrdup(doc->pool, "right");
5343 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5344 if (STRCASEEQ('b','B',"both", cur->value)) {
5345 css_clear = apr_pstrdup(doc->pool, "both");
5347 else if (STRCASEEQ('r','R',"right", cur->value)) {
5348 css_clear = apr_pstrdup(doc->pool, "right");
5350 else if (STRCASEEQ('l','L',"left", cur->value)) {
5351 css_clear = apr_pstrdup(doc->pool, "left");
5357 if (attr_align || css_clear ) {
5378 * It is a handler who processes the H2 tag.
5380 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5381 * destination is specified.
5382 * @param node [i] The H1 tag node is specified.
5383 * @return The conversion result is returned.
5386 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5392 jxhtml = GET_JXHTML(pdoc);
5397 if (IS_CSS_ON(jxhtml->entryp)) {
5398 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5405 * It is a handler who processes the H3 tag.
5407 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5408 * destination is specified.
5409 * @param node [i] The H1 tag node is specified.
5410 * @return The conversion result is returned.
5413 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5419 char *attr_style = NULL;
5420 char *attr_align = NULL;
5421 char *css_clear = NULL;
5423 jxhtml = GET_JXHTML(pdoc);
5427 for (attr = qs_get_attr(doc,node);
5429 attr = qs_get_next_attr(doc,attr)) {
5430 char *name = qs_get_attr_name(doc,attr);
5431 char *value = qs_get_attr_value(doc,attr);
5432 if (STRCASEEQ('a','A',"align", name)) {
5433 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5437 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5441 if (IS_CSS_ON(jxhtml->entryp)) {
5442 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5444 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5445 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5446 css_property_t *cur;
5447 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5448 if (STRCASEEQ('l','L',"left", cur->value)) {
5449 attr_align = apr_pstrdup(doc->pool, "left");
5451 else if (STRCASEEQ('c','C',"center",cur->value)) {
5452 attr_align = apr_pstrdup(doc->pool, "center");
5454 else if (STRCASEEQ('r','R',"right",cur->value)) {
5455 attr_align = apr_pstrdup(doc->pool, "right");
5458 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5459 if (STRCASEEQ('b','B',"both", cur->value)) {
5460 css_clear = apr_pstrdup(doc->pool, "both");
5462 else if (STRCASEEQ('r','R',"right", cur->value)) {
5463 css_clear = apr_pstrdup(doc->pool, "right");
5465 else if (STRCASEEQ('l','L',"left", cur->value)) {
5466 css_clear = apr_pstrdup(doc->pool, "left");
5472 if (attr_align || css_clear ) {
5493 * It is a handler who processes the H3 tag.
5495 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5496 * destination is specified.
5497 * @param node [i] The H1 tag node is specified.
5498 * @return The conversion result is returned.
5501 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5507 jxhtml = GET_JXHTML(pdoc);
5512 if (IS_CSS_ON(jxhtml->entryp)) {
5513 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5520 * It is a handler who processes the H4 tag.
5522 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5523 * destination is specified.
5524 * @param node [i] The H1 tag node is specified.
5525 * @return The conversion result is returned.
5528 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5534 char *attr_style = NULL;
5535 char *attr_align = NULL;
5536 char *css_clear = NULL;
5538 jxhtml = GET_JXHTML(pdoc);
5542 for (attr = qs_get_attr(doc,node);
5544 attr = qs_get_next_attr(doc,attr)) {
5545 char *name = qs_get_attr_name(doc,attr);
5546 char *value = qs_get_attr_value(doc,attr);
5547 if (STRCASEEQ('a','A',"align", name)) {
5548 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5552 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5556 if (IS_CSS_ON(jxhtml->entryp)) {
5557 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5559 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5560 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5561 css_property_t *cur;
5562 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5563 if (STRCASEEQ('l','L',"left", cur->value)) {
5564 attr_align = apr_pstrdup(doc->pool, "left");
5566 else if (STRCASEEQ('c','C',"center",cur->value)) {
5567 attr_align = apr_pstrdup(doc->pool, "center");
5569 else if (STRCASEEQ('r','R',"right",cur->value)) {
5570 attr_align = apr_pstrdup(doc->pool, "right");
5573 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5574 if (STRCASEEQ('b','B',"both", cur->value)) {
5575 css_clear = apr_pstrdup(doc->pool, "both");
5577 else if (STRCASEEQ('r','R',"right", cur->value)) {
5578 css_clear = apr_pstrdup(doc->pool, "right");
5580 else if (STRCASEEQ('l','L',"left", cur->value)) {
5581 css_clear = apr_pstrdup(doc->pool, "left");
5587 if (attr_align || css_clear ) {
5608 * It is a handler who processes the H4 tag.
5610 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5611 * destination is specified.
5612 * @param node [i] The H1 tag node is specified.
5613 * @return The conversion result is returned.
5616 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5622 jxhtml = GET_JXHTML(pdoc);
5627 if (IS_CSS_ON(jxhtml->entryp)) {
5628 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5636 * It is a handler who processes the H5 tag.
5638 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5639 * destination is specified.
5640 * @param node [i] The H1 tag node is specified.
5641 * @return The conversion result is returned.
5644 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5650 char *attr_style = NULL;
5651 char *attr_align = NULL;
5652 char *css_clear = NULL;
5654 jxhtml = GET_JXHTML(pdoc);
5658 for (attr = qs_get_attr(doc,node);
5660 attr = qs_get_next_attr(doc,attr)) {
5661 char *name = qs_get_attr_name(doc,attr);
5662 char *value = qs_get_attr_value(doc,attr);
5663 if (STRCASEEQ('a','A',"align", name)) {
5664 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5668 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5672 if (IS_CSS_ON(jxhtml->entryp)) {
5673 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5675 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5676 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5677 css_property_t *cur;
5678 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5679 if (STRCASEEQ('l','L',"left", cur->value)) {
5680 attr_align = apr_pstrdup(doc->pool, "left");
5682 else if (STRCASEEQ('c','C',"center",cur->value)) {
5683 attr_align = apr_pstrdup(doc->pool, "center");
5685 else if (STRCASEEQ('r','R',"right",cur->value)) {
5686 attr_align = apr_pstrdup(doc->pool, "right");
5689 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5690 if (STRCASEEQ('b','B',"both", cur->value)) {
5691 css_clear = apr_pstrdup(doc->pool, "both");
5693 else if (STRCASEEQ('r','R',"right", cur->value)) {
5694 css_clear = apr_pstrdup(doc->pool, "right");
5696 else if (STRCASEEQ('l','L',"left", cur->value)) {
5697 css_clear = apr_pstrdup(doc->pool, "left");
5703 if (attr_align || css_clear ) {
5724 * It is a handler who processes the H5 tag.
5726 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5727 * destination is specified.
5728 * @param node [i] The H1 tag node is specified.
5729 * @return The conversion result is returned.
5732 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5738 jxhtml = GET_JXHTML(pdoc);
5743 if (IS_CSS_ON(jxhtml->entryp)) {
5744 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5752 * It is a handler who processes the H6 tag.
5754 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5755 * destination is specified.
5756 * @param node [i] The H1 tag node is specified.
5757 * @return The conversion result is returned.
5760 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5766 char *attr_style = NULL;
5767 char *attr_align = NULL;
5768 char *css_clear = NULL;
5770 jxhtml = GET_JXHTML(pdoc);
5774 for (attr = qs_get_attr(doc,node);
5776 attr = qs_get_next_attr(doc,attr)) {
5777 char *name = qs_get_attr_name(doc,attr);
5778 char *value = qs_get_attr_value(doc,attr);
5779 if (STRCASEEQ('a','A',"align", name)) {
5780 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5784 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5788 if (IS_CSS_ON(jxhtml->entryp)) {
5789 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5791 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5792 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5793 css_property_t *cur;
5794 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5795 if (STRCASEEQ('l','L',"left", cur->value)) {
5796 attr_align = apr_pstrdup(doc->pool, "left");
5798 else if (STRCASEEQ('c','C',"center",cur->value)) {
5799 attr_align = apr_pstrdup(doc->pool, "center");
5801 else if (STRCASEEQ('r','R',"right",cur->value)) {
5802 attr_align = apr_pstrdup(doc->pool, "right");
5805 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5806 if (STRCASEEQ('b','B',"both", cur->value)) {
5807 css_clear = apr_pstrdup(doc->pool, "both");
5809 else if (STRCASEEQ('r','R',"right", cur->value)) {
5810 css_clear = apr_pstrdup(doc->pool, "right");
5812 else if (STRCASEEQ('l','L',"left", cur->value)) {
5813 css_clear = apr_pstrdup(doc->pool, "left");
5819 if (attr_align || css_clear ) {
5840 * It is a handler who processes the H6 tag.
5842 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5843 * destination is specified.
5844 * @param node [i] The H1 tag node is specified.
5845 * @return The conversion result is returned.
5848 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5854 jxhtml = GET_JXHTML(pdoc);
5859 if (IS_CSS_ON(jxhtml->entryp)) {
5860 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5868 * It is a handler who processes the MENU tag.
5870 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5871 * destination is specified.
5872 * @param node [i] The MENU tag node is specified.
5873 * @return The conversion result is returned.
5876 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5878 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5879 Doc *doc = jxhtml->doc;
5881 char *attr_style = NULL;
5882 char *attr_color = NULL;
5883 char *attr_type = NULL;
5884 char *attr_size = NULL;
5885 char *css_clear = NULL;
5887 for (attr = qs_get_attr(doc,node);
5889 attr = qs_get_next_attr(doc,attr)) {
5890 char *name = qs_get_attr_name(doc,attr);
5891 char *value = qs_get_attr_value(doc,attr);
5892 if (STRCASEEQ('t','T',"type",name)) {
5893 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5897 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5901 if (IS_CSS_ON(jxhtml->entryp)) {
5902 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5904 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5905 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5906 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5907 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5908 css_property_t *cur;
5909 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5910 if (cur->value && *cur->value) {
5911 attr_color = apr_pstrdup(doc->pool, cur->value);
5914 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5915 if (cur->value && *cur->value) {
5916 attr_type = apr_pstrdup(doc->pool, cur->value);
5919 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5920 if (cur->value && *cur->value) {
5921 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5922 attr_size = apr_pstrdup(doc->pool, cur->value);
5924 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5925 attr_size = apr_pstrdup(doc->pool, cur->value);
5927 else if (STRCASEEQ('s','S',"small",cur->value)) {
5928 attr_size = apr_pstrdup(doc->pool, cur->value);
5930 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5931 attr_size = apr_pstrdup(doc->pool, cur->value);
5933 else if (STRCASEEQ('l','L',"large",cur->value)) {
5934 attr_size = apr_pstrdup(doc->pool, cur->value);
5936 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5937 attr_size = apr_pstrdup(doc->pool, cur->value);
5939 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5940 attr_size = apr_pstrdup(doc->pool, cur->value);
5944 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5945 if (STRCASEEQ('b','B',"both", cur->value)) {
5946 css_clear = apr_pstrdup(doc->pool, "both");
5948 else if (STRCASEEQ('r','R',"right", cur->value)) {
5949 css_clear = apr_pstrdup(doc->pool, "right");
5951 else if (STRCASEEQ('l','L',"left", cur->value)) {
5952 css_clear = apr_pstrdup(doc->pool, "left");
5958 if (attr_type || attr_color || attr_size) {
5961 W_L("list-style-type:");
5966 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5989 * It is a handler who processes the MENU tag.
5991 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5992 * destination is specified.
5993 * @param node [i] The MENU tag node is specified.
5994 * @return The conversion result is returned.
5997 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5999 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6000 Doc *doc = jxhtml->doc;
6002 if (IS_CSS_ON(jxhtml->entryp)) {
6003 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6010 * It is a handler who processes the PLAINTEXT tag.
6012 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6013 * destination is specified.
6014 * @param node [i] The PLAINTEXT tag node is specified.
6015 * @return The conversion result is returned.
6018 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
6023 jxhtml = GET_JXHTML(pdoc);
6026 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
6031 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
6036 jxhtml = GET_JXHTML(pdoc);
6038 for (child = qs_get_child_node(doc, node);
6040 child = qs_get_next_node(doc, child)) {
6042 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
6049 * It is a handler who processes the PLAINTEXT tag.
6051 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6052 * destination is specified.
6053 * @param node [i] The PLAINTEXT tag node is specified.
6054 * @return The conversion result is returned.
6057 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6059 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6065 * It is a handler who processes the BLINK tag.
6067 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6068 * destination is specified.
6069 * @param node [i] The BLINK tag node is specified.
6070 * @return The conversion result is returned.
6073 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
6075 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6076 Doc *doc = jxhtml->doc;
6078 char *attr_style = NULL;
6079 char *attr_color = NULL;
6080 char *attr_size = NULL;
6082 for (attr = qs_get_attr(doc,node);
6084 attr = qs_get_next_attr(doc,attr)) {
6085 char *name = qs_get_attr_name(doc,attr);
6086 char *value = qs_get_attr_value(doc,attr);
6087 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6091 if (IS_CSS_ON(jxhtml->entryp)) {
6092 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6094 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6095 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6097 css_property_t *cur;
6098 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6099 if (cur->value && *cur->value) {
6100 attr_color = apr_pstrdup(doc->pool, cur->value);
6103 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6104 if (cur->value && *cur->value) {
6105 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6106 attr_size = apr_pstrdup(doc->pool, cur->value);
6108 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6109 attr_size = apr_pstrdup(doc->pool, cur->value);
6111 else if (STRCASEEQ('s','S',"small",cur->value)) {
6112 attr_size = apr_pstrdup(doc->pool, cur->value);
6114 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6115 attr_size = apr_pstrdup(doc->pool, cur->value);
6117 else if (STRCASEEQ('l','L',"large",cur->value)) {
6118 attr_size = apr_pstrdup(doc->pool, cur->value);
6120 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6121 attr_size = apr_pstrdup(doc->pool, cur->value);
6123 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6124 attr_size = apr_pstrdup(doc->pool, cur->value);
6131 if (attr_color || attr_size) {
6134 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6152 * It is a handler who processes the BLINK tag.
6154 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6155 * destination is specified.
6156 * @param node [i] The BLINK tag node is specified.
6157 * @return The conversion result is returned.
6160 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6162 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6163 Doc *doc = jxhtml->doc;
6165 if (IS_CSS_ON(jxhtml->entryp)) {
6166 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6173 * It is a handler who processes the MARQUEE tag.
6175 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6176 * destination is specified.
6177 * @param node [i] The MARQUEE tag node is specified.
6178 * @return The conversion result is returned.
6181 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6183 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6184 Doc *doc = jxhtml->doc;
6186 char *attr_direction = NULL;
6187 char *attr_style = NULL;
6188 char *attr_color = NULL;
6189 char *attr_size = NULL;
6190 char *attr_bgcolor = NULL;
6191 /*--------------------------------------------------------------------------*/
6192 /* Get Attributes */
6193 /*--------------------------------------------------------------------------*/
6194 for (attr = qs_get_attr(doc,node);
6196 attr = qs_get_next_attr(doc,attr)) {
6197 char *name = qs_get_attr_name(doc,attr);
6198 char *value = qs_get_attr_value(doc,attr);
6199 if (STRCASEEQ('d','D',"direction", name)) {
6201 if (STRCASEEQ('l','L',"left",value)) {
6202 attr_direction = "rtl";
6204 else if (STRCASEEQ('r','R',"right",value)) {
6205 attr_direction = "ltr";
6209 else if (STRCASEEQ('b','B',"behavior",name)) {
6212 else if (STRCASEEQ('l','L',"loop",name)) {
6215 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6216 if (value && *value) {
6217 attr_bgcolor = value;
6220 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6224 if (IS_CSS_ON(jxhtml->entryp)) {
6225 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6227 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6228 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6229 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6230 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6231 css_property_t *cur;
6232 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6233 if (cur->value && *cur->value) {
6234 attr_color = apr_pstrdup(doc->pool, cur->value);
6237 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6238 if (cur->value && *cur->value) {
6239 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6242 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6243 if (cur->value && *cur->value) {
6244 attr_direction = apr_pstrdup(doc->pool, cur->value);
6247 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6248 if (cur->value && *cur->value) {
6249 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6250 || STRCASEEQ('x','X',"x-small", cur->value)
6251 || STRCASEEQ('s','S',"small", cur->value)
6252 || STRCASEEQ('m','M',"medium", cur->value)
6253 || STRCASEEQ('l','L',"large", cur->value)
6254 || STRCASEEQ('x','X',"x-large", cur->value)
6255 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6256 attr_size = apr_pstrdup(doc->pool, cur->value);
6263 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6265 if (attr_direction) {
6266 W_L("-wap-marquee-dir:");
6267 W_V(attr_direction);
6271 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6272 W_L("background-color:");
6277 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6296 * It is a handler who processes the MARQUEE tag.
6298 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6299 * destination is specified.
6300 * @param node [i] The MARQUEE tag node is specified.
6301 * @return The conversion result is returned.
6304 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6306 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6307 Doc *doc = jxhtml->doc;
6309 if (IS_CSS_ON(jxhtml->entryp)) {
6310 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6317 * It is handler who processes the New Line Code.
6320 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6322 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6323 if (jxhtml->start_html_flag) {
6324 Doc *doc = jxhtml->doc;
6332 * It is a handler who processes the LINK tag.
6334 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6335 * destination is specified.
6336 * @param node [i] The LINK tag node is specified.
6337 * @return The conversion result is returned.
6340 s_jxhtml_link_tag(void *pdoc, Node *node)
6349 jxhtml = GET_JXHTML(pdoc);
6352 if (! IS_CSS_ON(jxhtml->entryp)) {
6356 for (attr = qs_get_attr(doc,node);
6358 attr = qs_get_next_attr(doc,attr)) {
6359 char *name = qs_get_attr_name(doc,attr);
6360 char *value = qs_get_attr_value(doc,attr);
6361 if (STRCASEEQ('r','R',"rel", name)) {
6362 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6366 else if (STRCASEEQ('h','H',"href", name)) {
6367 if (value && *value) {
6371 else if (STRCASEEQ('t','T',"type", name)) {
6372 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6378 if (rel && href && type) {
6379 DBG(doc->r, "start load CSS. url:[%s]", href);
6380 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6381 DBG(doc->r, "end load CSS. url:[%s]", href);
6388 static css_prop_list_t *
6389 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6391 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6392 Doc *doc = jxhtml->doc;
6393 css_prop_list_t *last_css = NULL;
6394 if (IS_CSS_ON(jxhtml->entryp)) {
6395 css_prop_list_t *dup_css;
6396 css_selector_t *selector;
6398 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6399 dup_css = chxj_dup_css_prop_list(doc, last_css);
6400 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6402 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6404 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6405 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6407 if (style_attr_value) {
6408 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));
6410 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6418 static css_prop_list_t *
6419 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6421 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6422 Doc *doc = jxhtml->doc;
6423 css_prop_list_t *last_css = NULL;
6424 if (IS_CSS_ON(jxhtml->entryp)) {
6425 css_prop_list_t *dup_css;
6426 css_selector_t *selector;
6428 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6429 dup_css = chxj_dup_css_prop_list(doc, last_css);
6430 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6432 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6436 if (style_attr_value) {
6437 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));
6439 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6448 * It is a handler who processes the SPAN tag.
6450 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6451 * destination is specified.
6452 * @param node [i] The SPAN tag node is specified.
6453 * @return The conversion result is returned.
6456 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6461 char *attr_style = NULL;
6462 char *attr_color = NULL;
6463 char *attr_size = NULL;
6464 char *attr_align = NULL;
6465 char *attr_blink = NULL;
6466 char *attr_marquee = NULL;
6467 char *attr_marquee_dir = NULL;
6468 char *attr_marquee_style = NULL;
6469 char *attr_marquee_loop = NULL;
6470 char *css_bgcolor = NULL;
6472 jxhtml = GET_JXHTML(pdoc);
6475 for (attr = qs_get_attr(doc,node);
6477 attr = qs_get_next_attr(doc,attr)) {
6478 char *nm = qs_get_attr_name(doc,attr);
6479 char *val = qs_get_attr_value(doc,attr);
6480 if (val && STRCASEEQ('s','S',"style", nm)) {
6484 if (IS_CSS_ON(jxhtml->entryp)) {
6485 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6487 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6488 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6489 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6490 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6491 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6492 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6493 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6494 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6495 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6497 css_property_t *cur;
6498 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6499 attr_color = apr_pstrdup(doc->pool, cur->value);
6501 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6502 if (cur->value && *cur->value) {
6503 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6504 || STRCASEEQ('x','X',"x-small", cur->value)
6505 || STRCASEEQ('s','S',"small", cur->value)
6506 || STRCASEEQ('m','M',"medium", cur->value)
6507 || STRCASEEQ('l','L',"large", cur->value)
6508 || STRCASEEQ('x','X',"x-large", cur->value)
6509 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6510 attr_size = apr_pstrdup(doc->pool, cur->value);
6514 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6515 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6516 attr_blink = apr_pstrdup(doc->pool, cur->value);
6519 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6520 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6521 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6524 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6525 if (cur->value && *cur->value) {
6526 if ( STRCASEEQ('l','L',"ltr",cur->value)
6527 || STRCASEEQ('r','R',"rtl",cur->value)) {
6528 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6532 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6533 if (cur->value && *cur->value) {
6534 if ( STRCASEEQ('s','S',"scroll",cur->value)
6535 || STRCASEEQ('s','S',"slide",cur->value)
6536 || STRCASEEQ('a','A',"alternate",cur->value)) {
6537 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6541 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6542 if (cur->value && *cur->value) {
6543 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6544 attr_marquee_loop = "infinite";
6547 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6551 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6552 if (STRCASEEQ('l','L',"left", cur->value)) {
6553 attr_align = apr_pstrdup(doc->pool, "left");
6555 else if (STRCASEEQ('c','C',"center",cur->value)) {
6556 attr_align = apr_pstrdup(doc->pool, "center");
6558 else if (STRCASEEQ('r','R',"right",cur->value)) {
6559 attr_align = apr_pstrdup(doc->pool, "right");
6562 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6563 if (cur->value && *cur->value) {
6564 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6571 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6574 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6590 W_L("text-decoration:");
6595 W_L("display:-wap-marquee;");
6596 if (attr_marquee_dir) {
6597 W_L("-wap-marquee-dir:");
6598 W_V(attr_marquee_dir);
6601 if (attr_marquee_style) {
6602 W_L("-wap-marquee-style:");
6603 W_V(attr_marquee_style);
6606 if (attr_marquee_loop) {
6607 W_L("-wap-marquee-loop:");
6608 W_V(attr_marquee_loop);
6613 W_L("background-color:");
6625 * It is a handler who processes the SPAN tag.
6627 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6628 * destination is specified.
6629 * @param node [i] The SPAN tag node is specified.
6630 * @return The conversion result is returned.
6633 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6635 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6636 Doc *doc = jxhtml->doc;
6639 if (IS_CSS_ON(jxhtml->entryp)) {
6640 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6647 * It is a handler who processes the STYLE tag.
6649 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6650 * destination is specified.
6651 * @param node [i] The STYLE tag node is specified.
6652 * @return The conversion result is returned.
6655 s_jxhtml_style_tag(void *pdoc, Node *node)
6662 jxhtml = GET_JXHTML(pdoc);
6665 if (! IS_CSS_ON(jxhtml->entryp)) {
6669 for (attr = qs_get_attr(doc,node);
6671 attr = qs_get_next_attr(doc,attr)) {
6672 char *name = qs_get_attr_name(doc,attr);
6673 char *value = qs_get_attr_value(doc,attr);
6674 if (STRCASEEQ('t','T',"type", name)) {
6675 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6681 Node *child = qs_get_child_node(doc, node);
6682 if (type && child) {
6683 char *name = qs_get_node_name(doc, child);
6684 if (STRCASEEQ('t','T',"text", name)) {
6685 char *value = qs_get_node_value(doc, child);
6686 DBG(doc->r, "start load CSS. buf:[%s]", value);
6687 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6688 DBG(doc->r, "end load CSS. value:[%s]", value);
6694 * It is a handler who processes the OBJECT tag.
6696 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6697 * destination is specified.
6698 * @param node [i] The OBJECT tag node is specified.
6699 * @return The conversion result is returned.
6702 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6704 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6705 Doc *doc = jxhtml->doc;
6708 char *attr_id = NULL;
6709 char *attr_width = NULL;
6710 char *attr_height = NULL;
6711 char *attr_data = NULL;
6712 char *attr_type = NULL;
6713 char *attr_declare = NULL;
6714 char *attr_classid = NULL;
6715 char *attr_codebase = NULL;
6717 /*--------------------------------------------------------------------------*/
6718 /* Get Attributes */
6719 /*--------------------------------------------------------------------------*/
6720 for (attr = qs_get_attr(doc,node);
6722 attr = qs_get_next_attr(doc,attr)) {
6723 char *name = qs_get_attr_name(doc,attr);
6724 char *value = qs_get_attr_value(doc,attr);
6725 if (STRCASEEQ('i','I',"id",name)) {
6726 attr_id = apr_pstrdup(doc->pool, value);
6728 else if (STRCASEEQ('w','W',"width",name)) {
6729 attr_width = apr_pstrdup(doc->pool, value);
6731 else if (STRCASEEQ('h','H',"height",name)) {
6732 attr_height = apr_pstrdup(doc->pool, value);
6734 else if (STRCASEEQ('d','D',"data",name)) {
6735 attr_data = apr_pstrdup(doc->pool, value);
6737 else if (STRCASEEQ('t','T',"type",name)) {
6738 attr_type = apr_pstrdup(doc->pool, value);
6740 else if (STRCASEEQ('d','D',"declare",name)) {
6741 attr_declare = apr_pstrdup(doc->pool, value);
6743 else if (STRCASEEQ('c','C',"classid",name)) {
6744 attr_classid = apr_pstrdup(doc->pool, value);
6746 else if (STRCASEEQ('c','C',"codebase",name)) {
6747 attr_codebase = apr_pstrdup(doc->pool, value);
6779 W_L(" declare=\"declare\"");
6787 W_L(" codebase=\"");
6796 * It is a handler who processes the OBJECT tag.
6798 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6799 * destination is specified.
6800 * @param node [i] The OBJECT tag node is specified.
6801 * @return The conversion result is returned.
6804 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6806 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6807 Doc *doc = jxhtml->doc;
6813 * It is a handler who processes the OBJECT tag.
6815 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6816 * destination is specified.
6817 * @param node [i] The OBJECT tag node is specified.
6818 * @return The conversion result is returned.
6821 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6823 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6824 Doc *doc = jxhtml->doc;
6827 char *attr_name = NULL;
6828 char *attr_value = NULL;
6829 char *attr_valuetype = NULL;
6831 /*--------------------------------------------------------------------------*/
6832 /* Get Attributes */
6833 /*--------------------------------------------------------------------------*/
6834 for (attr = qs_get_attr(doc,node);
6836 attr = qs_get_next_attr(doc,attr)) {
6837 char *name = qs_get_attr_name(doc,attr);
6838 char *value = qs_get_attr_value(doc,attr);
6839 if (STRCASEEQ('n','N',"name",name)) {
6840 attr_name = apr_pstrdup(doc->pool, value);
6842 else if (STRCASEEQ('v','V',"value",name)) {
6843 attr_value = apr_pstrdup(doc->pool, value);
6845 else if (STRCASEEQ('v','V',"valuetype",name)) {
6846 attr_valuetype = apr_pstrdup(doc->pool, value);
6862 W_L(" valuetype=\"");
6863 W_V(attr_valuetype);
6870 * It is a handler who processes the CAPTION tag.
6872 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6873 * destination is specified.
6874 * @param node [i] The CAPTION tag node is specified.
6875 * @return The conversion result is returned.
6878 s_jxhtml_start_caption_tag(void *pdoc, Node *node)
6884 char *attr_style = NULL;
6885 char *attr_align = NULL;
6887 jxhtml = GET_JXHTML(pdoc);
6891 for (attr = qs_get_attr(doc,node);
6893 attr = qs_get_next_attr(doc,attr)) {
6894 char *name = qs_get_attr_name(doc,attr);
6895 char *value = qs_get_attr_value(doc,attr);
6896 if (STRCASEEQ('a','A',"align", name)) {
6898 (STRCASEEQ('l','L',"left",value)
6899 || STRCASEEQ('r','R',"right",value)
6900 || STRCASEEQ('t','T',"top",value)
6901 || STRCASEEQ('b','B',"bottom",value)
6906 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6924 * It is a handler who processes the CAPTION tag.
6926 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6927 * destination is specified.
6928 * @param node [i] The CAPTION tag node is specified.
6929 * @return The conversion result is returned.
6932 s_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child))
6934 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
6935 Doc* doc = jxhtml->doc;