2 * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_jxhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_conv_z2h.h"
28 #include "chxj_google.h"
31 #define GET_JXHTML(X) ((jxhtml_t *)(X))
34 #define W_L(X) do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
35 #define W_V(X) do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X)) \
36 : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
38 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
40 static char *s_jxhtml_start_html_tag (void *pdoc, Node *node);
41 static char *s_jxhtml_end_html_tag (void *pdoc, Node *node);
42 static char *s_jxhtml_start_meta_tag (void *pdoc, Node *node);
43 static char *s_jxhtml_end_meta_tag (void *pdoc, Node *node);
44 static char *s_jxhtml_start_head_tag (void *pdoc, Node *node);
45 static char *s_jxhtml_end_head_tag (void *pdoc, Node *node);
46 static char *s_jxhtml_start_title_tag (void *pdoc, Node *node);
47 static char *s_jxhtml_end_title_tag (void *pdoc, Node *node);
48 static char *s_jxhtml_start_base_tag (void *pdoc, Node *node);
49 static char *s_jxhtml_end_base_tag (void *pdoc, Node *node);
50 static char *s_jxhtml_start_body_tag (void *pdoc, Node *node);
51 static char *s_jxhtml_end_body_tag (void *pdoc, Node *node);
52 static char *s_jxhtml_start_a_tag (void *pdoc, Node *node);
53 static char *s_jxhtml_end_a_tag (void *pdoc, Node *node);
54 static char *s_jxhtml_start_pre_tag (void *pdoc, Node *node);
55 static char *s_jxhtml_end_pre_tag (void *pdoc, Node *node);
56 static char *s_jxhtml_start_p_tag (void *pdoc, Node *node);
57 static char *s_jxhtml_end_p_tag (void *pdoc, Node *node);
58 static char *s_jxhtml_start_ul_tag (void *pdoc, Node *node);
59 static char *s_jxhtml_end_ul_tag (void *pdoc, Node *node);
60 static char *s_jxhtml_start_ol_tag (void *pdoc, Node *node);
61 static char *s_jxhtml_end_ol_tag (void *pdoc, Node *node);
62 static char *s_jxhtml_start_li_tag (void *pdoc, Node *node);
63 static char *s_jxhtml_end_li_tag (void *pdoc, Node *node);
64 static char *s_jxhtml_start_br_tag (void *pdoc, Node *node);
65 static char *s_jxhtml_end_br_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_start_table_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_end_table_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_start_tr_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
71 static char *s_jxhtml_start_td_or_th_tag (void *pdoc, Node *node,char *tagName);
72 static char *s_jxhtml_end_td_or_th_tag (void *pdoc, Node *node,char *tagName);
73 static char *s_jxhtml_start_td_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_end_td_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_start_th_tag (void *pdoc, Node *node);
76 static char *s_jxhtml_end_th_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
116 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
117 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
121 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
122 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
123 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
126 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
127 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
128 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
129 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
130 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
131 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
132 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
133 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
134 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
135 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
136 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
137 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
138 static char *s_jxhtml_start_object_tag (void *pdoc, Node *node);
139 static char *s_jxhtml_end_object_tag (void *pdoc, Node *node);
140 static char *s_jxhtml_start_param_tag (void *pdoc, Node *node);
141 static char *s_jxhtml_start_caption_tag (void *pdoc, Node *node);
142 static char *s_jxhtml_end_caption_tag (void *pdoc, Node *node);
144 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
146 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
148 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
149 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
153 tag_handler jxhtml_handler[] = {
156 s_jxhtml_start_html_tag,
157 s_jxhtml_end_html_tag,
161 s_jxhtml_start_meta_tag,
162 s_jxhtml_end_meta_tag,
166 s_jxhtml_start_textarea_tag,
167 s_jxhtml_end_textarea_tag,
171 s_jxhtml_start_p_tag,
176 s_jxhtml_start_pre_tag,
177 s_jxhtml_end_pre_tag,
181 s_jxhtml_start_ul_tag,
186 s_jxhtml_start_li_tag,
191 s_jxhtml_start_ol_tag,
196 s_jxhtml_start_h1_tag,
201 s_jxhtml_start_h2_tag,
206 s_jxhtml_start_h3_tag,
211 s_jxhtml_start_h4_tag,
216 s_jxhtml_start_h5_tag,
221 s_jxhtml_start_h6_tag,
226 s_jxhtml_start_head_tag,
227 s_jxhtml_end_head_tag,
231 s_jxhtml_start_title_tag,
232 s_jxhtml_end_title_tag,
236 s_jxhtml_start_base_tag,
237 s_jxhtml_end_base_tag,
241 s_jxhtml_start_body_tag,
242 s_jxhtml_end_body_tag,
246 s_jxhtml_start_a_tag,
251 s_jxhtml_start_br_tag,
256 s_jxhtml_start_table_tag,
257 s_jxhtml_end_table_tag,
261 s_jxhtml_start_tr_tag,
266 s_jxhtml_start_td_tag,
276 s_jxhtml_start_font_tag,
277 s_jxhtml_end_font_tag,
281 s_jxhtml_start_form_tag,
282 s_jxhtml_end_form_tag,
286 s_jxhtml_start_input_tag,
287 s_jxhtml_end_input_tag,
291 s_jxhtml_start_center_tag,
292 s_jxhtml_end_center_tag,
296 s_jxhtml_start_hr_tag,
301 s_jxhtml_start_img_tag,
302 s_jxhtml_end_img_tag,
306 s_jxhtml_start_select_tag,
307 s_jxhtml_end_select_tag,
311 s_jxhtml_start_option_tag,
312 s_jxhtml_end_option_tag,
316 s_jxhtml_start_div_tag,
317 s_jxhtml_end_div_tag,
346 s_jxhtml_start_span_tag,
347 s_jxhtml_end_span_tag,
356 s_jxhtml_start_th_tag,
361 s_jxhtml_start_b_tag,
371 s_jxhtml_start_dt_tag,
386 s_jxhtml_start_blockquote_tag,
387 s_jxhtml_end_blockquote_tag,
391 s_jxhtml_start_dir_tag,
392 s_jxhtml_end_dir_tag,
396 s_jxhtml_start_dl_tag,
401 s_jxhtml_start_dd_tag,
406 s_jxhtml_start_menu_tag,
407 s_jxhtml_end_menu_tag,
411 s_jxhtml_start_plaintext_tag,
412 s_jxhtml_end_plaintext_tag,
416 s_jxhtml_start_blink_tag,
417 s_jxhtml_end_blink_tag,
421 s_jxhtml_start_marquee_tag,
422 s_jxhtml_end_marquee_tag,
431 s_jxhtml_newline_mark,
436 s_jxhtml_start_object_tag,
437 s_jxhtml_end_object_tag,
441 s_jxhtml_start_param_tag,
446 s_jxhtml_start_caption_tag,
447 s_jxhtml_end_caption_tag,
453 * converts from CHTML5.0 to JXHTML.
455 * @param r [i] Requet_rec is appointed.
456 * @param spec [i] The result of the device specification processing which
457 * was done in advance is appointed.
458 * @param src [i] The character string before the converting is appointed.
459 * @return The character string after the converting is returned.
468 chxjconvrule_entry *entryp,
479 /*--------------------------------------------------------------------------*/
481 /*--------------------------------------------------------------------------*/
483 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
485 DBG(r,"REQ[%X] I found qrcode xml",TO_ADDR(r));
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,"REQ[%X] spec is NULL",TO_ADDR(r));
601 for (ee = jxhtml->conf->emoji;
605 unsigned char hex1byte;
606 unsigned char hex2byte;
609 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
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 if (ee->jphone != NULL && ee->jphone->string != NULL) {
621 if (jxhtml->conf->use_emoji_image
622 && jxhtml->conf->emoji_image_url
623 && strcasecmp(ee->jphone->string,"image") == 0) {
624 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",jxhtml->conf->emoji_image_url, ee->no);
626 else if (strncasecmp(ee->jphone->string, "raw:",4) == 0) {
627 *rslt = apr_psprintf(r->pool,"%s", &(ee->jphone->string[4]));
630 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
633 return strlen(ee->imode->string);
640 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
641 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
642 if (spec == NULL || spec->emoji_type == NULL) {
643 if (ee->jphone != NULL && ee->jphone->string != NULL) {
644 if (jxhtml->conf->use_emoji_image
645 && jxhtml->conf->emoji_image_url
646 && strcasecmp(ee->jphone->string,"image") == 0) {
647 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",jxhtml->conf->emoji_image_url, ee->no);
649 else if (strncasecmp(ee->jphone->string, "raw:",4) == 0) {
650 *rslt = apr_psprintf(r->pool,"%s", &(ee->jphone->string[4]));
653 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
668 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
682 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
683 memset(doc, 0, sizeof(Doc));
684 memset(jxhtml, 0, sizeof(jxhtml_t));
689 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
690 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
691 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
693 apr_pool_create(&pool, r->pool);
695 chxj_buffered_write_init(pool, &doc->buf);
697 for (ii=0; ii<len; ii++) {
701 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
708 if (is_sjis_kanji(src[ii])) {
709 two_byte[0] = src[ii+0];
710 two_byte[1] = src[ii+1];
716 one_byte[0] = src[ii+0];
721 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
723 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
729 * It is a handler who processes the HTML tag.
731 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
732 * destination is specified.
733 * @param node [i] The HTML tag node is specified.
734 * @return The conversion result is returned.
737 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
744 jxhtml = GET_JXHTML(pdoc);
747 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
749 W_L("<?xml version=\"1.0\" encoding=\"");
750 W_V(jxhtml->spec->output_encoding);
753 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
756 /*--------------------------------------------------------------------------*/
758 /*--------------------------------------------------------------------------*/
759 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
761 jxhtml->start_html_flag = 1;
763 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
770 * It is a handler who processes the HTML tag.
772 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
773 * destination is specified.
774 * @param node [i] The HTML tag node is specified.
775 * @return The conversion result is returned.
778 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
780 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
781 Doc *doc = jxhtml->doc;
790 * It is a handler who processes the META tag.
792 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
793 * destination is specified.
794 * @param node [i] The META tag node is specified.
795 * @return The conversion result is returned.
798 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
804 int content_type_flag;
807 jxhtml = GET_JXHTML(pdoc);
811 content_type_flag = 0;
814 /*--------------------------------------------------------------------------*/
816 /*--------------------------------------------------------------------------*/
817 for (attr = qs_get_attr(doc,node);
819 attr = qs_get_next_attr(doc,attr)) {
820 char *name = qs_get_attr_name(doc,attr);
821 char *value = qs_get_attr_value(doc,attr);
825 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
826 /*----------------------------------------------------------------------*/
828 /*----------------------------------------------------------------------*/
829 W_L(" http-equiv=\"");
832 if (STRCASEEQ('c','C',"content-type",value)) {
833 content_type_flag = 1;
835 if (STRCASEEQ('r','R',"refresh",value)) {
843 if (strcasecmp(name, "content") == 0 && value && *value) {
844 /*----------------------------------------------------------------------*/
846 /*----------------------------------------------------------------------*/
847 if (content_type_flag) {
851 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
860 buf = apr_pstrdup(r->pool, value);
862 url = strchr(buf, ';');
864 sec = apr_pstrdup(r->pool, buf);
867 url = chxj_encoding_parameter(r, url, 1);
888 if (strcasecmp(name, "name") == 0 && value && *value) {
904 * It is a handler who processes the META tag.
906 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
907 * destination is specified.
908 * @param node [i] The META tag node is specified.
909 * @return The conversion result is returned.
912 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
914 jxhtml_t *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_start_head_tag(void *pdoc, Node *UNUSED(node))
935 jxhtml = GET_JXHTML(pdoc);
945 * It is a handler who processes the HEAD tag.
947 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
948 * destination is specified.
949 * @param node [i] The HEAD tag node is specified.
950 * @return The conversion result is returned.
953 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
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_start_title_tag(void *pdoc, Node *node)
983 jxhtml = GET_JXHTML(pdoc);
989 if (jxhtml->conf->use_google_analytics) {
990 jxhtml->pagetitle = "";
992 for (child = qs_get_child_node(doc,node);
994 child = qs_get_next_node(doc,child)) {
995 char *textval = qs_get_node_value(doc,child);
996 jxhtml->pagetitle = apr_pstrcat(doc->r->pool, jxhtml->pagetitle, textval, NULL);
1004 * It is a handler who processes the TITLE tag.
1006 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1007 * destination is specified.
1008 * @param node [i] The TITLE tag node is specified.
1009 * @return The conversion result is returned.
1012 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
1018 jxhtml = GET_JXHTML(pdoc);
1028 * It is a handler who processes the BASE tag.
1030 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1031 * destination is specified.
1032 * @param node [i] The BASE tag node is specified.
1033 * @return The conversion result is returned.
1036 s_jxhtml_start_base_tag(void *pdoc, Node *node)
1043 jxhtml = GET_JXHTML(pdoc);
1048 /*--------------------------------------------------------------------------*/
1049 /* Get Attributes */
1050 /*--------------------------------------------------------------------------*/
1051 for (attr = qs_get_attr(doc,node);
1053 attr = qs_get_next_attr(doc,attr)) {
1054 char *name = qs_get_attr_name(doc,attr);
1055 char *value = qs_get_attr_value(doc,attr);
1056 if (STRCASEEQ('h','H',"href",name)) {
1068 * It is a handler who processes the BASE tag.
1070 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1071 * destination is specified.
1072 * @param node [i] The BASE tag node is specified.
1073 * @return The conversion result is returned.
1076 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1078 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1084 * It is a handler who processes the BODY tag.
1086 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1087 * destination is specified.
1088 * @param node [i] The BODY tag node is specified.
1089 * @return The conversion result is returned.
1092 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1098 char *attr_bgcolor = NULL;
1099 char *attr_text = NULL;
1100 char *attr_link = NULL;
1101 char *attr_vlink = NULL;
1102 char *attr_style = NULL;
1103 char *attr_background = NULL;
1105 jxhtml = GET_JXHTML(pdoc);
1109 /*--------------------------------------------------------------------------*/
1110 /* Get Attributes */
1111 /*--------------------------------------------------------------------------*/
1112 for (attr = qs_get_attr(doc,node);
1114 attr = qs_get_next_attr(doc,attr)) {
1115 char *name = qs_get_attr_name(doc,attr);
1116 char *value = qs_get_attr_value(doc,attr);
1117 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1118 /*----------------------------------------------------------------------*/
1120 /*----------------------------------------------------------------------*/
1121 attr_bgcolor = value;
1123 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1124 /*----------------------------------------------------------------------*/
1126 /*----------------------------------------------------------------------*/
1129 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1130 /*----------------------------------------------------------------------*/
1132 /*----------------------------------------------------------------------*/
1135 else if (STRCASEEQ('a','A',"alink",name)) {
1136 /*----------------------------------------------------------------------*/
1138 /*----------------------------------------------------------------------*/
1141 else if (STRCASEEQ('v','V',"vlink",name)) {
1142 /*----------------------------------------------------------------------*/
1144 /*----------------------------------------------------------------------*/
1147 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1148 /*----------------------------------------------------------------------*/
1150 /*----------------------------------------------------------------------*/
1151 attr_background = value;
1153 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1158 if (IS_CSS_ON(jxhtml->entryp)) {
1159 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1161 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1162 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1163 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1164 css_property_t *cur;
1165 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1166 if (cur->value && *cur->value) {
1167 attr_text = apr_pstrdup(doc->pool, cur->value);
1170 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1171 if (cur->value && *cur->value) {
1172 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1175 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1176 if (cur->value && *cur->value) {
1177 char *tmp = apr_pstrdup(doc->pool, cur->value);
1178 char *tmps = strstr(tmp,"(");
1180 char *tmpe = strstr(tmp,")");
1181 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1183 attr_background = apr_pstrndup(doc->pool, tmps,len);
1188 if (jxhtml->style) {
1189 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1190 css_selector_t *cur_sel;
1191 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1192 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1193 css_property_t *cur;
1194 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1195 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1196 attr_link = apr_pstrdup(doc->pool, cur->value);
1200 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1201 css_property_t *cur;
1202 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1203 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1204 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1214 if (attr_bgcolor || attr_text) {
1217 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1218 W_L("background-color:");
1223 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1231 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1237 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1242 if (attr_background) {
1243 W_L(" background=\"");
1244 W_V(attr_background);
1253 * It is a handler who processes the BODY tag.
1255 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1256 * destination is specified.
1257 * @param node [i] The BODY tag node is specified.
1258 * @return The conversion result is returned.
1261 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1267 jxhtml = GET_JXHTML(pdoc);
1271 if (jxhtml->conf->use_google_analytics) {
1272 char *src = chxj_google_analytics_get_image_url(r, jxhtml->pagetitle);
1278 W_L("</div></body>");
1279 if (IS_CSS_ON(jxhtml->entryp)) {
1280 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1287 * It is a handler who processes the A tag.
1289 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1290 * destination is specified.
1291 * @param node [i] The A tag node is specified.
1292 * @return The conversion result is returned.
1295 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1301 char *attr_style = NULL;
1302 char *attr_id = NULL;
1304 jxhtml = GET_JXHTML(pdoc);
1309 /*--------------------------------------------------------------------------*/
1310 /* Get Attributes */
1311 /*--------------------------------------------------------------------------*/
1312 for (attr = qs_get_attr(doc,node);
1314 attr = qs_get_next_attr(doc,attr)) {
1315 char *name = qs_get_attr_name(doc,attr);
1316 char *value = qs_get_attr_value(doc,attr);
1317 if (STRCASEEQ('i','I',"id",name)){
1318 attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
1320 else if (STRCASEEQ('n','N',"name",name)) {
1321 attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
1323 else if (STRCASEEQ('h','H',"href",name)) {
1324 /*----------------------------------------------------------------------*/
1326 /*----------------------------------------------------------------------*/
1327 value = chxj_encoding_parameter(r, value, 1);
1328 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1329 value = chxj_add_cookie_parameter(r, value, jxhtml->cookie);
1330 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1336 else if (STRCASEEQ('a','A',"accesskey",name)) {
1337 /*----------------------------------------------------------------------*/
1339 /*----------------------------------------------------------------------*/
1340 W_L(" accesskey=\"");
1344 else if (STRCASEEQ('c','C',"cti",name)) {
1345 /*----------------------------------------------------------------------*/
1347 /*----------------------------------------------------------------------*/
1352 else if (STRCASEEQ('i','I',"ijam",name)) {
1353 /*----------------------------------------------------------------------*/
1355 /*----------------------------------------------------------------------*/
1358 else if (STRCASEEQ('u','U',"utn",name)) {
1359 /*----------------------------------------------------------------------*/
1361 /* It is special only for CHTML. */
1362 /*----------------------------------------------------------------------*/
1365 else if (STRCASEEQ('t','T',"telbook",name)) {
1366 /*----------------------------------------------------------------------*/
1368 /*----------------------------------------------------------------------*/
1371 else if (STRCASEEQ('k','K',"kana",name)) {
1372 /*----------------------------------------------------------------------*/
1374 /*----------------------------------------------------------------------*/
1377 else if (STRCASEEQ('e','E',"email",name)) {
1378 /*----------------------------------------------------------------------*/
1380 /*----------------------------------------------------------------------*/
1383 else if (STRCASEEQ('i','I',"ista",name)) {
1384 /*----------------------------------------------------------------------*/
1386 /*----------------------------------------------------------------------*/
1389 else if (STRCASEEQ('i','I',"ilet",name)) {
1390 /*----------------------------------------------------------------------*/
1392 /*----------------------------------------------------------------------*/
1395 else if (STRCASEEQ('i','I',"iswf",name)) {
1396 /*----------------------------------------------------------------------*/
1398 /*----------------------------------------------------------------------*/
1401 else if (STRCASEEQ('i','I',"irst",name)) {
1402 /*----------------------------------------------------------------------*/
1404 /*----------------------------------------------------------------------*/
1407 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1408 /*----------------------------------------------------------------------*/
1410 /*----------------------------------------------------------------------*/
1421 if (IS_CSS_ON(jxhtml->entryp)) {
1422 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1430 * It is a handler who processes the A tag.
1432 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1433 * destination is specified.
1434 * @param node [i] The A tag node is specified.
1435 * @return The conversion result is returned.
1438 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1444 jxhtml = GET_JXHTML(pdoc);
1450 if (IS_CSS_ON(jxhtml->entryp)) {
1451 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1459 * It is a handler who processes the BR tag.
1461 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1462 * destination is specified.
1463 * @param node [i] The BR tag node is specified.
1464 * @return The conversion result is returned.
1467 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1474 jxhtml = GET_JXHTML(pdoc);
1478 char *attr_style = NULL;
1479 char *attr_clear = NULL;
1481 /*--------------------------------------------------------------------------*/
1482 /* Get Attributes */
1483 /*--------------------------------------------------------------------------*/
1484 for (attr = qs_get_attr(doc,node);
1486 attr = qs_get_next_attr(doc,attr)) {
1487 char *name = qs_get_attr_name(doc,attr);
1488 char *value = qs_get_attr_value(doc,attr);
1489 if (STRCASEEQ('c','C',"clear",name)) {
1490 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1494 else if (STRCASEEQ('s','S',"style",name)) {
1495 attr_style = apr_pstrdup(doc->buf.pool, value);
1498 if (IS_CSS_ON(jxhtml->entryp)) {
1499 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1501 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1502 css_property_t *cur;
1503 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1504 if (cur->value && *cur->value) {
1505 if ( STRCASEEQ('l','L',"left", cur->value)
1506 || STRCASEEQ('r','R',"right", cur->value)) {
1507 attr_clear = apr_pstrdup(doc->pool, cur->value);
1509 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1510 attr_clear = apr_pstrdup(doc->pool, "all");
1528 * It is a handler who processes the BR tag.
1530 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1531 * destination is specified.
1532 * @param node [i] The BR tag node is specified.
1533 * @return The conversion result is returned.
1536 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1538 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1543 * It is a handler who processes the TABLE tag.
1545 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1546 * destination is specified.
1547 * @param node [i] The TR tag node is specified.
1548 * @return The conversion result is returned.
1551 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1558 char *attr_style = NULL;
1559 char *attr_align = NULL;
1560 char *attr_width = NULL;
1561 char *attr_height = NULL;
1562 char *attr_bgcolor = NULL;
1563 char *attr_border_width = NULL;
1564 char *attr_border_color = NULL;
1566 jxhtml = GET_JXHTML(pdoc);
1570 /*--------------------------------------------------------------------------*/
1571 /* Get Attributes */
1572 /*--------------------------------------------------------------------------*/
1573 for (attr = qs_get_attr(doc,node);
1575 attr = qs_get_next_attr(doc,attr)) {
1576 char *name = qs_get_attr_name(doc,attr);
1577 char *val = qs_get_attr_value(doc,attr);
1578 if (STRCASEEQ('a','A',"align",name)) {
1579 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1580 attr_align = apr_pstrdup(doc->buf.pool, val);
1583 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1584 attr_height = apr_pstrdup(doc->buf.pool, val);
1586 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1587 attr_width = apr_pstrdup(doc->buf.pool, val);
1589 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1590 attr_style = apr_pstrdup(doc->buf.pool, val);
1592 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1593 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1594 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1596 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1597 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1599 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1600 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1601 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1605 if (IS_CSS_ON(jxhtml->entryp)) {
1606 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1608 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1609 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1610 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1611 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1612 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1613 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1615 css_property_t *cur;
1616 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1617 char *tmp = apr_pstrdup(doc->pool, cur->value);
1618 char *tmpp = strstr(tmp, "px");
1620 size_t len = strlen(tmp) - strlen(tmpp);
1621 attr_width = apr_pstrndup(doc->pool, tmp,len);
1624 attr_width = apr_pstrdup(doc->pool, tmp);
1627 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1628 char *tmp = apr_pstrdup(doc->pool, cur->value);
1629 char *tmpp = strstr(tmp, "px");
1631 size_t len = strlen(tmp) - strlen(tmpp);
1632 attr_height = apr_pstrndup(doc->pool, tmp,len);
1635 attr_height = apr_pstrdup(doc->pool, tmp);
1638 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1639 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1640 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1643 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1644 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1645 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1647 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1648 char *tmp = apr_pstrdup(doc->pool, cur->value);
1649 char *tmpp = strstr(tmp, "px");
1651 size_t len = strlen(tmp) - strlen(tmpp);
1652 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1655 attr_border_width = apr_pstrdup(doc->pool, tmp);
1658 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1659 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1660 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1681 if (attr_bgcolor && *attr_bgcolor){
1686 if (attr_border_width || attr_border_color ){
1687 W_L(" style=\"border:");
1688 if (attr_border_width){
1689 W_V(attr_border_width);
1696 if (attr_border_color && *attr_border_color){
1698 W_V(attr_border_color);
1708 * It is a handler who processes the TABLE tag.
1710 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1711 * destination is specified.
1712 * @param node [i] The TR tag node is specified.
1713 * @return The conversion result is returned.
1716 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1722 jxhtml = GET_JXHTML(pdoc);
1732 * It is a handler who processes the TR tag.
1734 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1735 * destination is specified.
1736 * @param node [i] The TR tag node is specified.
1737 * @return The conversion result is returned.
1740 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1748 char *attr_style = NULL;
1749 char *attr_align = NULL;
1750 char *attr_valign = NULL;
1751 char *attr_bgcolor = NULL;
1753 jxhtml = GET_JXHTML(pdoc);
1757 /*--------------------------------------------------------------------------*/
1758 /* Get Attributes */
1759 /*--------------------------------------------------------------------------*/
1760 for (attr = qs_get_attr(doc,node);
1762 attr = qs_get_next_attr(doc,attr)) {
1763 char *name = qs_get_attr_name(doc,attr);
1764 char *val = qs_get_attr_value(doc,attr);
1765 if (STRCASEEQ('a','A',"align",name)) {
1766 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1767 attr_align = apr_pstrdup(doc->buf.pool, val);
1770 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1771 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1772 attr_valign = apr_pstrdup(doc->buf.pool, val);
1775 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1776 attr_style = apr_pstrdup(doc->buf.pool, val);
1778 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1779 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1780 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1784 if (IS_CSS_ON(jxhtml->entryp)) {
1785 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1787 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1788 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1789 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1791 css_property_t *cur;
1792 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1793 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1794 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1797 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1798 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1799 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1802 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1803 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1804 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1820 if (attr_bgcolor && *attr_bgcolor){
1831 * It is a handler who processes the TR tag.
1833 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1834 * destination is specified.
1835 * @param node [i] The TR tag node is specified.
1836 * @return The conversion result is returned.
1839 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1845 jxhtml = GET_JXHTML(pdoc);
1854 * It is a handler who processes the TD tag.
1856 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1857 * destination is specified.
1858 * @param node [i] The TR tag node is specified.
1859 * @return The conversion result is returned.
1862 s_jxhtml_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1870 char *attr_style = NULL;
1871 char *attr_align = NULL;
1872 char *attr_valign = NULL;
1873 char *attr_bgcolor = NULL;
1874 char *attr_colspan = NULL;
1875 char *attr_rowspan = NULL;
1876 char *attr_width = NULL;
1877 char *attr_height = NULL;
1879 jxhtml = GET_JXHTML(pdoc);
1883 /*--------------------------------------------------------------------------*/
1884 /* Get Attributes */
1885 /*--------------------------------------------------------------------------*/
1886 for (attr = qs_get_attr(doc,node);
1888 attr = qs_get_next_attr(doc,attr)) {
1889 char *name = qs_get_attr_name(doc,attr);
1890 char *val = qs_get_attr_value(doc,attr);
1891 if (STRCASEEQ('a','A',"align",name)) {
1892 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1893 attr_align = apr_pstrdup(doc->buf.pool, val);
1896 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1897 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1898 attr_valign = apr_pstrdup(doc->buf.pool, val);
1901 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1902 attr_style = apr_pstrdup(doc->buf.pool, val);
1904 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1905 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1906 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1908 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1909 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1911 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1912 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1914 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1915 char *tmp = strstr(val, "%");
1917 attr_width = apr_pstrdup(doc->buf.pool, val);
1920 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
1923 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1924 char *tmp = strstr(val, "%");
1926 attr_height = apr_pstrdup(doc->buf.pool, val);
1929 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
1934 if (IS_CSS_ON(jxhtml->entryp)) {
1935 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1937 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1938 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1939 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1940 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1941 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1943 css_property_t *cur;
1944 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1945 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1946 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1949 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1950 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1951 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1954 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1955 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1956 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1958 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1959 attr_width = apr_pstrdup(doc->pool, cur->value);
1961 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1962 attr_height = apr_pstrdup(doc->pool, cur->value);
1989 if (attr_bgcolor && *attr_bgcolor){
1994 if (attr_width || attr_height ){
2014 * It is a handler who processes the TD tag.
2016 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2017 * destination is specified.
2018 * @param node [i] The TR tag node is specified.
2019 * @return The conversion result is returned.
2022 s_jxhtml_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
2028 jxhtml = GET_JXHTML(pdoc);
2039 * It is a handler who processes the TD tag.
2041 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2042 * destination is specified.
2043 * @param node [i] The TD tag node is specified.
2044 * @return The conversion result is returned.
2047 s_jxhtml_start_td_tag(void *pdoc, Node *node)
2049 return s_jxhtml_start_td_or_th_tag(pdoc,node,"td");
2052 * It is a handler who processes the TD tag.
2054 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2055 * destination is specified.
2056 * @param node [i] The TD tag node is specified.
2057 * @return The conversion result is returned.
2060 s_jxhtml_end_td_tag(void *pdoc, Node *node)
2062 return s_jxhtml_end_td_or_th_tag(pdoc,node,"td");
2066 * It is a handler who processes the TD tag.
2068 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2069 * destination is specified.
2070 * @param node [i] The TD tag node is specified.
2071 * @return The conversion result is returned.
2074 s_jxhtml_start_th_tag(void *pdoc, Node *node)
2076 return s_jxhtml_start_td_or_th_tag(pdoc,node,"th");
2079 * It is a handler who processes the TD tag.
2081 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2082 * destination is specified.
2083 * @param node [i] The TD tag node is specified.
2084 * @return The conversion result is returned.
2087 s_jxhtml_end_th_tag(void *pdoc, Node *node)
2089 return s_jxhtml_end_td_or_th_tag(pdoc,node,"th");
2093 * It is a handler who processes the FONT tag.
2095 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2096 * destination is specified.
2097 * @param node [i] The FONT tag node is specified.
2098 * @return The conversion result is returned.
2101 s_jxhtml_start_font_tag(void *pdoc, Node *node)
2107 char *attr_color = NULL;
2108 char *attr_size = NULL;
2109 char *attr_style = NULL;
2111 jxhtml = GET_JXHTML(pdoc);
2115 /*--------------------------------------------------------------------------*/
2116 /* Get Attributes */
2117 /*--------------------------------------------------------------------------*/
2118 for (attr = qs_get_attr(doc,node);
2120 attr = qs_get_next_attr(doc,attr)) {
2121 char *name = qs_get_attr_name(doc,attr);
2122 char *value = qs_get_attr_value(doc,attr);
2123 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2124 attr_color = apr_pstrdup(doc->buf.pool, value);
2126 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2127 /*----------------------------------------------------------------------*/
2129 /*----------------------------------------------------------------------*/
2130 attr_size = apr_pstrdup(doc->buf.pool, value);
2132 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2133 attr_style = apr_pstrdup(doc->buf.pool, value);
2136 if (IS_CSS_ON(jxhtml->entryp)) {
2137 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2139 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2140 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2141 css_property_t *cur;
2142 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2143 if (cur->value && *cur->value) {
2144 attr_color = apr_pstrdup(doc->pool, cur->value);
2147 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2148 if (cur->value && *cur->value) {
2149 attr_size = apr_pstrdup(doc->pool, cur->value);
2150 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2151 attr_size = apr_pstrdup(doc->pool, "1");
2153 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2154 attr_size = apr_pstrdup(doc->pool, "2");
2156 else if (STRCASEEQ('s','S',"small",attr_size)) {
2157 attr_size = apr_pstrdup(doc->pool, "3");
2159 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2160 attr_size = apr_pstrdup(doc->pool, "4");
2162 else if (STRCASEEQ('l','L',"large",attr_size)) {
2163 attr_size = apr_pstrdup(doc->pool, "5");
2165 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2166 attr_size = apr_pstrdup(doc->pool, "6");
2168 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2169 attr_size = apr_pstrdup(doc->pool, "7");
2175 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2176 memset(flg, 0, sizeof(*flg));
2178 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2179 W_L("<font color=\"");
2182 flg->font_color_flag = 1;
2185 flg->font_size_flag = 1;
2186 switch(*attr_size) {
2187 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2188 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2189 case '3': W_L("<span style=\"font-size: small\">"); break;
2190 case '4': W_L("<span style=\"font-size: medium\">"); break;
2191 case '5': W_L("<span style=\"font-size: large\">"); break;
2192 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2193 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2195 if (*(attr_size + 1) == '1') {
2196 W_L("<span style=\"font-size: small\">");
2199 if (*(attr_size + 1) == '2') {
2200 W_L("<span style=\"font-size: x-small\">");
2203 if (*(attr_size + 1) == '3') {
2204 W_L("<span style=\"font-size: xx-small\">");
2207 flg->font_size_flag = 0;
2211 if (*(attr_size + 1) == '1') {
2212 W_L("<span style=\"font-size: large\">");
2215 if (*(attr_size + 1) == '2') {
2216 W_L("<span style=\"font-size: x-large\">");
2219 if (*(attr_size + 1) == '3') {
2220 W_L("<span style=\"font-size: xx-large\">");
2223 flg->font_size_flag = 0;
2227 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2228 flg->font_size_flag = 0;
2231 node->userData = flg;
2237 * It is a handler who processes the FONT tag.
2239 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2240 * destination is specified.
2241 * @param node [i] The FONT tag node is specified.
2242 * @return The conversion result is returned.
2245 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2251 jxhtml = GET_JXHTML(pdoc);
2255 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2256 if (flg && flg->font_size_flag) {
2259 if (flg && flg->font_color_flag) {
2262 if (IS_CSS_ON(jxhtml->entryp)) {
2263 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2271 * It is a handler who processes the FORM tag.
2273 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2274 * destination is specified.
2275 * @param node [i] The FORM tag node is specified.
2276 * @return The conversion result is returned.
2279 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2285 char *attr_action = NULL;
2286 char *attr_method = NULL;
2287 char *attr_style = NULL;
2288 char *attr_color = NULL;
2289 char *attr_align = NULL;
2290 char *attr_name = NULL;
2291 char *css_clear = NULL;
2292 char *new_hidden_tag = NULL;
2294 jxhtml = GET_JXHTML(pdoc);
2298 /*--------------------------------------------------------------------------*/
2299 /* Get Attributes */
2300 /*--------------------------------------------------------------------------*/
2301 for (attr = qs_get_attr(doc,node);
2303 attr = qs_get_next_attr(doc,attr)) {
2304 char *name = qs_get_attr_name(doc,attr);
2305 char *value = qs_get_attr_value(doc,attr);
2309 if (strcasecmp(name, "action") == 0) {
2310 /*--------------------------------------------------------------------*/
2312 /*--------------------------------------------------------------------*/
2313 attr_action = value;
2319 if (strcasecmp(name, "method") == 0) {
2320 /*--------------------------------------------------------------------*/
2322 /*--------------------------------------------------------------------*/
2323 attr_method = value;
2329 if (strcasecmp(name, "name") == 0) {
2330 /*--------------------------------------------------------------------*/
2332 /*--------------------------------------------------------------------*/
2339 if (strcasecmp(name, "style") == 0) {
2348 if (IS_CSS_ON(jxhtml->entryp)) {
2349 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2351 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2352 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2353 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2354 css_property_t *cur;
2355 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2356 if (STRCASEEQ('l','L',"left", cur->value)) {
2357 attr_align = apr_pstrdup(doc->pool, "left");
2359 else if (STRCASEEQ('c','C',"center",cur->value)) {
2360 attr_align = apr_pstrdup(doc->pool, "center");
2362 else if (STRCASEEQ('r','R',"right",cur->value)) {
2363 attr_align = apr_pstrdup(doc->pool, "right");
2366 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2367 attr_color = apr_pstrdup(doc->pool, cur->value);
2369 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2370 css_clear = apr_pstrdup(doc->pool, cur->value);
2375 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2379 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2380 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2382 char *old_qs = NULL;
2383 q = strchr(attr_action, '?');
2385 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);
2386 if (new_hidden_tag || old_qs) {
2416 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2417 memset(flg, 0, sizeof(*flg));
2419 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2420 W_L("<font color=\"");
2423 flg->with_font_flag = 1;
2426 W_L("<div align=\"");
2429 flg->with_div_flag = 1;
2431 node->userData = flg;
2432 if (new_hidden_tag) {
2433 W_V(new_hidden_tag);
2440 * It is a handler who processes the FORM tag.
2442 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2443 * destination is specified.
2444 * @param node [i] The FORM tag node is specified.
2445 * @return The conversion result is returned.
2448 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2450 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2451 Doc *doc = jxhtml->doc;
2453 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2454 if (flg && flg->with_div_flag) {
2457 if (flg && flg->with_font_flag) {
2461 if (IS_CSS_ON(jxhtml->entryp)) {
2462 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2469 s_jxhtml_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
2473 case '1': return apr_psprintf(p, ""*<ja:h>"");
2474 case '2': return apr_psprintf(p, ""*<ja:hk>"");
2475 case '3': return apr_psprintf(p, ""*<ja:en>"");
2476 case '4': return apr_psprintf(p, ""*<ja:n>"");
2478 return apr_pstrdup(p, "");
2482 return apr_pstrdup(p,"");
2487 * It is a handler who processes the INPUT tag.
2489 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2490 * destination is specified.
2491 * @param node [i] The INPUT tag node is specified.
2492 * @return The conversion result is returned.
2495 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2501 char *attr_accesskey = NULL;
2502 char *attr_max_length = NULL;
2503 char *attr_type = NULL;
2504 char *attr_name = NULL;
2505 char *attr_value = NULL;
2506 char *attr_istyle = NULL;
2507 char *attr_size = NULL;
2508 char *attr_checked = NULL;
2509 char *attr_style = NULL;
2511 jxhtml = GET_JXHTML(pdoc);
2515 /*--------------------------------------------------------------------------*/
2516 /* Get Attributes */
2517 /*--------------------------------------------------------------------------*/
2518 for (attr = qs_get_attr(doc,node);
2520 attr = qs_get_next_attr(doc,attr)) {
2521 char *name = qs_get_attr_name(doc,attr);
2522 char *value = qs_get_attr_value(doc,attr);
2523 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2524 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2525 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2526 STRCASEEQ('p','P',"password",tmp_type) ||
2527 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2528 STRCASEEQ('r','R',"radio", tmp_type) ||
2529 STRCASEEQ('h','H',"hidden", tmp_type) ||
2530 STRCASEEQ('s','S',"submit", tmp_type) ||
2531 STRCASEEQ('r','R',"reset", tmp_type))) {
2532 attr_type = tmp_type;
2535 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2538 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2541 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2542 attr_istyle = value;
2544 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2545 attr_max_length = value;
2547 else if (STRCASEEQ('c','C',"checked", name)) {
2548 attr_checked = value;
2550 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2551 attr_accesskey = value;
2553 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2556 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2561 if (IS_CSS_ON(jxhtml->entryp)) {
2562 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2564 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2565 css_property_t *cur;
2566 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2567 if (strcasestr(cur->value, "<ja:n>")) {
2570 else if (strcasestr(cur->value, "<ja:en>")) {
2573 else if (strcasestr(cur->value, "<ja:hk>")) {
2576 else if (strcasestr(cur->value, "<ja:h>")) {
2596 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2601 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2604 if (attr_accesskey) {
2605 W_L(" accesskey=\"");
2606 W_V(attr_accesskey);
2609 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2615 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
2617 W_L("-wap-input-format:");
2623 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2624 W_L(" istyle=\"4\"");
2627 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,"4");
2629 W_L("-wap-input-format:");
2635 /*--------------------------------------------------------------------------*/
2636 /* The figure is default for the password. */
2637 /*--------------------------------------------------------------------------*/
2638 if (attr_max_length && *attr_max_length) {
2639 if (chxj_chk_numeric(attr_max_length) == 0) {
2640 W_L(" maxlength=\"");
2641 W_V(attr_max_length);
2646 W_L(" checked=\"checked\"");
2662 jxhtml = GET_JXHTML(pdoc);
2675 /*--------------------------------------------------------------------------*/
2676 /* Get Attributes */
2677 /*--------------------------------------------------------------------------*/
2678 type = qs_get_type_attr(doc, node, doc->buf.pool);
2679 name = qs_get_name_attr(doc, node, doc->buf.pool);
2680 value = qs_get_value_attr(doc,node, doc->buf.pool);
2681 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2682 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2683 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2684 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2685 size = qs_get_size_attr(doc, node, doc->buf.pool);
2688 if (type && (STRCASEEQ('t','T',"text", type) ||
2689 STRCASEEQ('p','P',"password",type) ||
2690 STRCASEEQ('c','C',"checkbox",type) ||
2691 STRCASEEQ('r','R',"radio", type) ||
2692 STRCASEEQ('h','H',"hidden", type) ||
2693 STRCASEEQ('s','S',"submit", type) ||
2694 STRCASEEQ('r','R',"reset", type))) {
2700 if (size && *size) {
2705 if (name && *name) {
2707 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2710 if (value && *value) {
2711 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2712 apr_size_t value_len = strlen(value);
2713 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2717 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2720 if (accesskey && *accesskey) {
2721 W_L(" accesskey=\"");
2725 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2726 /*------------------------------------------------------------------------*/
2728 /*------------------------------------------------------------------------*/
2729 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2730 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2733 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2735 W_L("-wap-input-format:'*");
2741 else if (type && STRCASEEQ('p','P',"password",type)) {
2742 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2744 /*--------------------------------------------------------------------------*/
2745 /* The figure is default for the password. */
2746 /*--------------------------------------------------------------------------*/
2747 if (max_length && *max_length) {
2748 if (chxj_chk_numeric(max_length) == 0) {
2749 W_L(" maxlength=\"");
2756 W_L(" checked=\"checked\"");
2765 * It is a handler who processes the INPUT tag.
2767 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2768 * destination is specified.
2769 * @param node [i] The INPUT tag node is specified.
2770 * @return The conversion result is returned.
2773 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2775 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2781 * It is a handler who processes the CENTER tag.
2783 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2784 * destination is specified.
2785 * @param node [i] The CENTER tag node is specified.
2786 * @return The conversion result is returned.
2789 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2794 char *attr_style = NULL;
2795 char *attr_color = NULL;
2796 char *attr_size = NULL;
2798 jxhtml = GET_JXHTML(pdoc);
2801 for (attr = qs_get_attr(doc,node);
2803 attr = qs_get_next_attr(doc,attr)) {
2804 char *name = qs_get_attr_name(doc,attr);
2805 char *value = qs_get_attr_value(doc,attr);
2806 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2810 if (IS_CSS_ON(jxhtml->entryp)) {
2811 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2813 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2814 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2815 css_property_t *cur;
2816 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2817 if (cur->value && *cur->value) {
2818 attr_color = apr_pstrdup(doc->pool, cur->value);
2821 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2822 if (cur->value && *cur->value) {
2823 attr_size = apr_pstrdup(doc->pool, cur->value);
2830 if (attr_size || attr_color) {
2838 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2852 * It is a handler who processes the CENTER tag.
2854 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2855 * destination is specified.
2856 * @param node [i] The CENTER tag node is specified.
2857 * @return The conversion result is returned.
2860 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2866 jxhtml = GET_JXHTML(pdoc);
2871 if (IS_CSS_ON(jxhtml->entryp)) {
2872 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2879 * It is a handler who processes the li tag.
2881 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2882 * destination is specified.
2883 * @param node [i] The li tag node is specified.
2884 * @return The conversion result is returned.
2887 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2893 char *attr_type = NULL;
2894 char *attr_value = NULL;
2895 char *attr_style = NULL;
2897 jxhtml = GET_JXHTML(pdoc);
2901 for (attr = qs_get_attr(doc,node);
2903 attr = qs_get_next_attr(doc,attr)) {
2904 char *name = qs_get_attr_name(doc,attr);
2905 char *value = qs_get_attr_value(doc,attr);
2906 if (STRCASEEQ('t','T',"type",name)) {
2907 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2908 if (*value == '1') {
2909 attr_type = apr_pstrdup(doc->pool, "decimal");
2911 else if (*value == 'a') {
2912 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2914 else if (*value == 'A') {
2915 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2922 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2925 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2929 if (IS_CSS_ON(jxhtml->entryp)) {
2930 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2932 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2933 css_property_t *cur;
2934 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2935 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2936 attr_type = apr_pstrdup(doc->pool, "decimal");
2938 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2939 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2941 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2942 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2944 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2945 attr_type = apr_pstrdup(doc->pool, "disc");
2947 else if (STRCASEEQ('s','S',"square", cur->value)) {
2948 attr_type = apr_pstrdup(doc->pool, "square");
2950 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2951 attr_type = apr_pstrdup(doc->pool, "circle");
2961 W_L("list-style-type:");
2977 * It is a handler who processes the li tag.
2979 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2980 * destination is specified.
2981 * @param node [i] The li tag node is specified.
2982 * @return The conversion result is returned.
2985 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2991 jxhtml = GET_JXHTML(pdoc);
2995 if (IS_CSS_ON(jxhtml->entryp)) {
2996 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3004 * It is a handler who processes the OL tag.
3006 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3007 * destination is specified.
3008 * @param node [i] The OL tag node is specified.
3009 * @return The conversion result is returned.
3012 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
3018 char *attr_style = NULL;
3019 char *attr_start = NULL;
3020 char *attr_type = NULL;
3021 char *css_clear = NULL;
3023 jxhtml = GET_JXHTML(pdoc);
3027 /*--------------------------------------------------------------------------*/
3028 /* Get Attributes */
3029 /*--------------------------------------------------------------------------*/
3030 for (attr = qs_get_attr(doc,node);
3032 attr = qs_get_next_attr(doc,attr)) {
3033 char *name = qs_get_attr_name(doc,attr);
3034 char *value = qs_get_attr_value(doc,attr);
3035 if (STRCASEEQ('t','T',"type",name) && value) {
3036 if (*value == '1') {
3037 attr_type = apr_pstrdup(doc->pool, "decimal");
3039 else if (*value == 'a') {
3040 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3042 else if (*value == 'A') {
3043 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3046 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3049 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3053 if (IS_CSS_ON(jxhtml->entryp)) {
3054 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3056 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3057 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3059 css_property_t *cur;
3060 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3061 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3062 attr_type = apr_pstrdup(doc->pool, "decimal");
3064 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3065 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3067 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3068 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3071 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3072 css_clear = apr_pstrdup(doc->pool, cur->value);
3077 if (attr_type || css_clear) {
3080 W_L("list-style-type:");
3103 * It is a handler who processes the OL tag.
3105 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3106 * destination is specified.
3107 * @param node [i] The OL tag node is specified.
3108 * @return The conversion result is returned.
3111 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
3117 jxhtml = GET_JXHTML(pdoc);
3122 if (IS_CSS_ON(jxhtml->entryp)) {
3123 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3130 * It is a handler who processes the P tag.
3132 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3133 * destination is specified.
3134 * @param node [i] The P tag node is specified.
3135 * @return The conversion result is returned.
3138 s_jxhtml_start_p_tag(void *pdoc, Node *node)
3144 char *attr_align = NULL;
3145 char *attr_style = NULL;
3146 char *attr_color = NULL;
3147 char *attr_blink = NULL;
3148 char *css_clear = NULL;
3150 jxhtml = GET_JXHTML(pdoc);
3154 for (attr = qs_get_attr(doc,node);
3156 attr = qs_get_next_attr(doc,attr)) {
3157 char *nm = qs_get_attr_name(doc,attr);
3158 char *val = qs_get_attr_value(doc,attr);
3159 if (STRCASEEQ('a','A',"align", nm)) {
3160 /*----------------------------------------------------------------------*/
3161 /* CHTML 1.0 (W3C version 3.2) */
3162 /*----------------------------------------------------------------------*/
3163 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3164 attr_align = apr_pstrdup(doc->buf.pool, val);
3168 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3169 attr_style = apr_pstrdup(doc->buf.pool, val);
3172 if (IS_CSS_ON(jxhtml->entryp)) {
3173 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3175 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3176 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3177 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3178 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3179 css_property_t *cur;
3180 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3181 if (STRCASEEQ('l','L',"left",cur->value)) {
3182 attr_align = apr_pstrdup(doc->pool, "left");
3184 else if (STRCASEEQ('c','C',"center",cur->value)) {
3185 attr_align = apr_pstrdup(doc->pool, "center");
3187 else if (STRCASEEQ('r','R',"right",cur->value)) {
3188 attr_align = apr_pstrdup(doc->pool, "right");
3191 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3192 if (cur->value && *cur->value) {
3193 attr_color = apr_pstrdup(doc->pool, cur->value);
3196 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3197 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3198 attr_blink = apr_pstrdup(doc->pool, cur->value);
3201 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3202 css_clear = apr_pstrdup(doc->pool, cur->value);
3207 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3215 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3221 W_L("text-decoration:");
3238 * It is a handler who processes the P tag.
3240 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3241 * destination is specified.
3242 * @param node [i] The P tag node is specified.
3243 * @return The conversion result is returned.
3246 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3248 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3249 Doc *doc = jxhtml->doc;
3252 if (IS_CSS_ON(jxhtml->entryp)) {
3253 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3260 * It is a handler who processes the PRE tag.
3262 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3263 * destination is specified.
3264 * @param node [i] The PRE tag node is specified.
3265 * @return The conversion result is returned.
3268 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3270 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3271 Doc *doc = jxhtml->doc;
3273 char *attr_style = NULL;
3274 char *css_clear = NULL;
3276 for (attr = qs_get_attr(doc,node);
3278 attr = qs_get_next_attr(doc,attr)) {
3279 char *nm = qs_get_attr_name(doc,attr);
3280 char *val = qs_get_attr_value(doc,attr);
3281 if (val && STRCASEEQ('s','S',"style", nm)) {
3286 if (IS_CSS_ON(jxhtml->entryp)) {
3287 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3289 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3291 css_property_t *cur;
3292 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3293 css_clear = apr_pstrdup(doc->pool, cur->value);
3313 * It is a handler who processes the PRE tag.
3315 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3316 * destination is specified.
3317 * @param node [i] The PRE tag node is specified.
3318 * @return The conversion result is returned.
3321 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3323 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3324 Doc *doc = jxhtml->doc;
3328 if (IS_CSS_ON(jxhtml->entryp)) {
3329 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3337 * It is a handler who processes the UL tag.
3339 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3340 * destination is specified.
3341 * @param node [i] The UL tag node is specified.
3342 * @return The conversion result is returned.
3345 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3347 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3348 Doc *doc = jxhtml->doc;
3350 char *attr_type = NULL;
3351 char *attr_style = NULL;
3352 char *css_clear = NULL;
3354 /*--------------------------------------------------------------------------*/
3355 /* Get Attributes */
3356 /*--------------------------------------------------------------------------*/
3357 for (attr = qs_get_attr(doc,node);
3359 attr = qs_get_next_attr(doc,attr)) {
3360 char *name = qs_get_attr_name(doc,attr);
3361 char *value = qs_get_attr_value(doc,attr);
3362 if (STRCASEEQ('t','T',"type",name)) {
3363 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3367 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3371 if (IS_CSS_ON(jxhtml->entryp)) {
3372 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3374 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3375 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3377 css_property_t *cur;
3378 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3379 if (STRCASEEQ('d','D',"disc",cur->value)) {
3380 attr_type = apr_pstrdup(doc->pool, "disc");
3382 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3383 attr_type = apr_pstrdup(doc->pool, "circle");
3385 else if (STRCASEEQ('s','S',"square",cur->value)) {
3386 attr_type = apr_pstrdup(doc->pool, "square");
3389 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3390 css_clear = apr_pstrdup(doc->pool, cur->value);
3395 if (attr_type || css_clear) {
3398 W_L("list-style-type:");
3415 * It is a handler who processes the UL tag.
3417 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3418 * destination is specified.
3419 * @param node [i] The UL tag node is specified.
3420 * @return The conversion result is returned.
3423 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3425 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3426 Doc *doc = jxhtml->doc;
3429 if (IS_CSS_ON(jxhtml->entryp)) {
3430 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3437 * It is a handler who processes the HR tag.
3439 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3440 * destination is specified.
3441 * @param node [i] The HR tag node is specified.
3442 * @return The conversion result is returned.
3445 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3451 char *attr_align = NULL;
3452 char *attr_size = NULL;
3453 char *attr_width = NULL;
3454 char *attr_noshade = NULL;
3455 char *attr_style = NULL;
3456 char *attr_color = NULL;
3458 char *style_float = NULL;
3459 char *style_border_color = NULL;
3460 char *css_clear = NULL;
3462 jxhtml = GET_JXHTML(pdoc);
3466 for (attr = qs_get_attr(doc,node);
3468 attr = qs_get_next_attr(doc,attr)) {
3469 char *name = qs_get_attr_name (doc,attr);
3470 char *value = qs_get_attr_value(doc,attr);
3474 if (strcasecmp(name, "align") == 0) {
3475 /*--------------------------------------------------------------------*/
3477 /*--------------------------------------------------------------------*/
3478 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3486 if (strcasecmp(name, "size") == 0) {
3487 /*--------------------------------------------------------------------*/
3489 /*--------------------------------------------------------------------*/
3490 if (value && *value) {
3494 else if (strcasecmp(name, "style") == 0) {
3495 if (value && *value) {
3503 if (strcasecmp(name, "width") == 0) {
3504 /*--------------------------------------------------------------------*/
3506 /*--------------------------------------------------------------------*/
3507 if (value && *value) {
3515 if (strcasecmp(name, "noshade") == 0) {
3516 /*--------------------------------------------------------------------*/
3518 /*--------------------------------------------------------------------*/
3519 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3525 if (strcasecmp(name, "color") == 0 && value && *value) {
3526 /*--------------------------------------------------------------------*/
3528 /*--------------------------------------------------------------------*/
3537 if (IS_CSS_ON(jxhtml->entryp)) {
3538 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3540 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3541 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3542 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3544 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3545 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3546 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3547 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3548 css_property_t *cur;
3550 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3551 if (STRCASEEQ('s','S',"solid",cur->value)) {
3552 attr_noshade = "noshade";
3555 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3556 attr_size = apr_pstrdup(doc->pool, cur->value);
3559 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3560 char *tmp = apr_pstrdup(doc->pool,cur->value);
3561 attr_color = apr_pstrdup(doc->pool,tmp);
3564 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3565 char *tmp = apr_pstrdup(doc->pool, cur->value);
3566 char *tmpp = strstr(tmp,"none");
3568 style_float = "center";
3571 style_float = apr_pstrdup(doc->pool,tmp);
3576 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3577 char *tmp = apr_pstrdup(doc->pool, cur->value);
3578 char *tmpp = strstr(tmp, "px");
3580 attr_width = apr_pstrdup(doc->pool, tmp);
3583 tmpp = strstr(tmp, "%");
3585 attr_width = apr_pstrdup(doc->pool, tmp);
3590 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3591 char *tmp = apr_pstrdup(doc->pool, cur->value);
3593 style_border_color = apr_pstrdup(doc->pool, tmp);
3596 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3597 css_clear = apr_pstrdup(doc->pool, cur->value);
3614 if (attr_size || attr_width || attr_noshade || style_border_color || css_clear) {
3619 if (chxj_chk_numeric(attr_size) == 0) {
3627 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3633 W_L("border-style:solid;");
3635 if(style_border_color){
3636 W_L("border-color:");
3637 W_V(style_border_color);
3660 * It is a handler who processes the HR tag.
3662 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3663 * destination is specified.
3664 * @param node [i] The HR tag node is specified.
3665 * @return The conversion result is returned.
3668 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3670 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3676 * It is a handler who processes the IMG tag.
3678 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3679 * destination is specified.
3680 * @param node [i] The IMG tag node is specified.
3681 * @return The conversion result is returned.
3684 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3686 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3687 Doc *doc = jxhtml->doc;
3688 request_rec *r = doc->r;
3690 char *attr_src = NULL;
3691 char *attr_height = NULL;
3692 char *attr_width = NULL;
3693 char *attr_alt = NULL;
3694 char *attr_style = NULL;
3695 char *attr_hspace = NULL;
3696 char *attr_vspace = NULL;
3698 char *css_float = NULL;
3699 char *css_margin_left = NULL;
3700 char *css_margin_right = NULL;
3701 char *css_margin_top = NULL;
3702 char *css_margin_bottom = NULL;
3703 char *css_display = NULL;
3704 char *css_valign = NULL;
3706 #ifndef IMG_NOT_CONVERT_FILENAME
3707 device_table *spec = jxhtml->spec;
3710 /*--------------------------------------------------------------------------*/
3711 /* Get Attributes */
3712 /*--------------------------------------------------------------------------*/
3713 for (attr = qs_get_attr(doc,node);
3715 attr = qs_get_next_attr(doc,attr)) {
3716 char *name = qs_get_attr_name(doc,attr);
3717 char *value = qs_get_attr_value(doc,attr);
3718 if (STRCASEEQ('s','S',"src",name)) {
3719 /*----------------------------------------------------------------------*/
3721 /*----------------------------------------------------------------------*/
3722 #ifdef IMG_NOT_CONVERT_FILENAME
3723 value = chxj_encoding_parameter(r, value, 1);
3724 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3725 value = chxj_add_cookie_no_update_parameter(r, value, 1);
3726 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3729 value = chxj_img_conv(r, spec, value);
3730 value = chxj_encoding_parameter(r, value, 1);
3731 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3732 value = chxj_add_cookie_no_update_parameter(r, value, 1);
3733 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3737 else if (STRCASEEQ('a','A',"align",name)) {
3738 /*----------------------------------------------------------------------*/
3740 /*----------------------------------------------------------------------*/
3742 if (STRCASEEQ('t','T',"top", value) ||
3743 STRCASEEQ('m','M',"middle",value) ||
3744 STRCASEEQ('b','B',"bottom",value)){
3746 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3749 else if (STRCASEEQ('c','C',"center",value)) {
3750 css_valign = apr_pstrdup(doc->pool, "middle");
3754 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3755 /*----------------------------------------------------------------------*/
3757 /*----------------------------------------------------------------------*/
3760 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3761 /*----------------------------------------------------------------------*/
3763 /*----------------------------------------------------------------------*/
3764 attr_height = value;
3766 else if (STRCASEEQ('h','H',"hspace",name)) {
3767 /*----------------------------------------------------------------------*/
3769 /*----------------------------------------------------------------------*/
3770 attr_hspace = value;
3772 else if (STRCASEEQ('v','V',"vspace",name)) {
3773 /*----------------------------------------------------------------------*/
3775 /*----------------------------------------------------------------------*/
3776 attr_vspace = value;
3778 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3779 /*----------------------------------------------------------------------*/
3781 /*----------------------------------------------------------------------*/
3784 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3785 /*----------------------------------------------------------------------*/
3787 /*----------------------------------------------------------------------*/
3792 if (IS_CSS_ON(jxhtml->entryp)) {
3793 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3795 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3796 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3797 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3798 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3799 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3800 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3801 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3804 css_property_t *cur;
3805 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3806 attr_height = apr_pstrdup(doc->pool, cur->value);
3808 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3809 attr_width = apr_pstrdup(doc->pool, cur->value);
3812 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3813 css_valign = apr_pstrdup(doc->pool, cur->value);
3816 if (! attr_hspace) {
3817 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3818 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3820 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3821 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3824 if (! attr_vspace) {
3825 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3826 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3828 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3829 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3833 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3834 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3835 css_float = apr_pstrdup(doc->pool, cur->value);
3839 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3840 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3841 char *tmp = apr_pstrdup(doc->pool, cur->value);
3842 char *tmpp = strstr(tmp, "none");
3844 css_display = apr_pstrdup(doc->pool, tmp);
3856 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3864 W_L("vertical-align:");
3869 W_L("margin-left:");
3872 W_L("margin-right:");
3877 if(css_margin_left){
3878 W_L("margin-left:");
3879 W_V(css_margin_left);
3882 if(css_margin_right){
3883 W_L("margin-right:");
3884 W_V(css_margin_right);
3892 W_L("margin-bottom:");
3899 W_V(css_margin_top);
3902 if(css_margin_bottom){
3903 W_L("margin-bottom:");
3904 W_V(css_margin_bottom);
3909 W_L("display:none;");
3938 * It is a handler who processes the IMG tag.
3940 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3941 * destination is specified.
3942 * @param node [i] The IMG tag node is specified.
3943 * @return The conversion result is returned.
3946 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3948 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3954 * It is a handler who processes the SELECT tag.
3956 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3957 * destination is specified.
3958 * @param node [i] The SELECT tag node is specified.
3959 * @return The conversion result is returned.
3962 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3964 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3965 Doc *doc = jxhtml->doc;
3969 char *multiple = NULL;
3970 char *attr_style = NULL;
3973 for (attr = qs_get_attr(doc,node);
3975 attr = qs_get_next_attr(doc,attr)) {
3976 char *nm = qs_get_attr_name(doc,attr);
3977 char *val = qs_get_attr_value(doc,attr);
3978 if (STRCASEEQ('s','S',"size",nm)) {
3979 /*----------------------------------------------------------------------*/
3980 /* CHTML 1.0 version 2.0 */
3981 /*----------------------------------------------------------------------*/
3982 size = apr_pstrdup(doc->buf.pool, val);
3984 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3985 /*----------------------------------------------------------------------*/
3986 /* CHTML 1.0 version 2.0 */
3987 /*----------------------------------------------------------------------*/
3988 attr_style = apr_pstrdup(doc->buf.pool, val);
3990 else if (STRCASEEQ('n','N',"name",nm)) {
3991 /*----------------------------------------------------------------------*/
3992 /* CHTML 1.0 version 2.0 */
3993 /*----------------------------------------------------------------------*/
3994 name = apr_pstrdup(doc->buf.pool, val);
3996 else if (STRCASEEQ('m','M',"multiple", nm)) {
3997 /*----------------------------------------------------------------------*/
3998 /* CHTML 1.0 version 2.0 */
3999 /*----------------------------------------------------------------------*/
4000 multiple = apr_pstrdup(doc->buf.pool, val);
4003 if (size && *size) {
4008 if (name && *name) {
4018 if (IS_CSS_ON(jxhtml->entryp)) {
4019 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4027 * It is a handler who processes the SELECT tag.
4029 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4030 * destination is specified.
4031 * @param node [i] The SELECT tag node is specified.
4032 * @return The conversion result is returned.
4035 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
4037 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4038 Doc *doc = jxhtml->doc;
4041 if (IS_CSS_ON(jxhtml->entryp)) {
4042 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4049 * It is a handler who processes the OPTION tag.
4051 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4052 * destination is specified.
4053 * @param node [i] The OPTION tag node is specified.
4054 * @return The conversion result is returned.
4057 s_jxhtml_start_option_tag(void *pdoc, Node *node)
4059 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4060 Doc *doc = jxhtml->doc;
4063 char *selected = NULL;
4065 char *attr_style = NULL;
4068 for (attr = qs_get_attr(doc,node);
4070 attr = qs_get_next_attr(doc,attr)) {
4071 char *nm = qs_get_attr_name(doc,attr);
4072 char *val = qs_get_attr_value(doc,attr);
4073 if (STRCASEEQ('s','S',"selected",nm)) {
4074 /*----------------------------------------------------------------------*/
4075 /* CHTML 1.0 version 2.0 */
4076 /*----------------------------------------------------------------------*/
4077 selected = apr_pstrdup(doc->buf.pool, val);
4079 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4080 /*----------------------------------------------------------------------*/
4081 /* CHTML 1.0 version 2.0 */
4082 /*----------------------------------------------------------------------*/
4083 attr_style = apr_pstrdup(doc->buf.pool, val);
4085 else if (STRCASEEQ('v','V',"value",nm)) {
4086 /*----------------------------------------------------------------------*/
4087 /* CHTML 1.0 version 2.0 */
4088 /*----------------------------------------------------------------------*/
4089 value = apr_pstrdup(doc->buf.pool, val);
4102 if (IS_CSS_ON(jxhtml->entryp)) {
4103 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4111 * It is a handler who processes the OPTION tag.
4113 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4114 * destination is specified.
4115 * @param node [i] The OPTION tag node is specified.
4116 * @return The conversion result is returned.
4119 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
4121 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4122 Doc *doc = jxhtml->doc;
4125 if (IS_CSS_ON(jxhtml->entryp)) {
4126 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4134 * It is a handler who processes the DIV tag.
4136 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4137 * destination is specified.
4138 * @param node [i] The DIV tag node is specified.
4139 * @return The conversion result is returned.
4142 s_jxhtml_start_div_tag(void *pdoc, Node *node)
4148 char *attr_style = NULL;
4149 char *attr_align = NULL;
4150 char *attr_display = NULL;
4151 char *attr_decoration = NULL;
4152 char *attr_wap_marquee_style = NULL;
4153 char *attr_wap_marquee_dir = NULL;
4154 char *attr_wap_marquee_loop = NULL;
4155 char *attr_color = NULL;
4156 char *attr_bgcolor = NULL;
4157 char *attr_font_size = NULL;
4158 char *css_clear = NULL;
4160 jxhtml = GET_JXHTML(pdoc);
4164 for (attr = qs_get_attr(doc,node);
4166 attr = qs_get_next_attr(doc,attr)) {
4167 char *nm = qs_get_attr_name(doc,attr);
4168 char *val = qs_get_attr_value(doc,attr);
4169 if (STRCASEEQ('a','A',"align",nm)) {
4170 /*----------------------------------------------------------------------*/
4171 /* CHTML 1.0 (W3C version 3.2) */
4172 /*----------------------------------------------------------------------*/
4173 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4174 attr_align = apr_pstrdup(doc->buf.pool, val);
4177 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4178 attr_style = apr_pstrdup(doc->buf.pool, val);
4182 if (IS_CSS_ON(jxhtml->entryp)) {
4183 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4185 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4186 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4187 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4188 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4189 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4190 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4191 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4192 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4194 css_property_t *cur;
4195 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4196 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4197 attr_display = apr_pstrdup(doc->pool, cur->value);
4200 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4201 if (STRCASEEQ('b','B',"blink", cur->value)) {
4202 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4205 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4206 attr_color = apr_pstrdup(doc->pool, cur->value);
4208 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4209 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4210 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4212 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4213 char *ss = strchr(cur->value, '#');
4215 ss = strstr(cur->value, "rgb");
4218 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4219 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4222 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4223 attr_align = apr_pstrdup(doc->pool, cur->value);
4225 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4226 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4227 || STRCASEEQ('x','X',"x-small",cur->value)
4228 || STRCASEEQ('s','S',"small",cur->value)
4229 || STRCASEEQ('m','M',"medium",cur->value)
4230 || STRCASEEQ('l','L',"large",cur->value)
4231 || STRCASEEQ('x','X',"x-large",cur->value)
4232 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4233 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4237 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4238 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4239 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4240 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4241 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4242 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4245 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4246 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4247 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4249 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4250 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4253 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4254 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4255 attr_wap_marquee_loop = "infinite";
4258 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4262 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4263 css_clear = apr_pstrdup(doc->pool, cur->value);
4271 || attr_wap_marquee_style
4272 || attr_wap_marquee_dir
4273 || attr_wap_marquee_loop
4289 if (attr_decoration) {
4290 W_L("text-decoration:");
4291 W_V(attr_decoration);
4294 if (attr_wap_marquee_style) {
4295 W_L("-wap-marquee-style:");
4296 W_V(attr_wap_marquee_style);
4299 if (attr_wap_marquee_dir) {
4300 W_L("-wap-marquee-dir:");
4301 W_V(attr_wap_marquee_dir);
4304 if (attr_wap_marquee_loop) {
4305 W_L("-wap-marquee-loop:");
4306 W_V(attr_wap_marquee_loop);
4315 W_L("background-color:");
4319 if (attr_font_size) {
4321 W_V(attr_font_size);
4337 * It is a handler who processes the DIV tag.
4339 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4340 * destination is specified.
4341 * @param node [i] The DIV tag node is specified.
4342 * @return The conversion result is returned.
4345 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4351 jxhtml = GET_JXHTML(pdoc);
4356 if (IS_CSS_ON(jxhtml->entryp)) {
4357 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4364 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4371 jxhtml = GET_JXHTML(pdoc);
4375 for (child = qs_get_child_node(doc, node);
4377 child = qs_get_next_node(doc, child)) {
4379 s_jxhtml_chxjif_tag(jxhtml, child);
4386 * It is a handler who processes the TEXTARE tag.
4388 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4389 * destination is specified.
4390 * @param node [i] The TEXTAREA tag node is specified.
4391 * @return The conversion result is returned.
4394 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4400 char *attr_accesskey = NULL;
4401 char *attr_name = NULL;
4402 char *attr_rows = NULL;
4403 char *attr_cols = NULL;
4404 char *attr_istyle = NULL;
4405 char *attr_style = NULL;
4408 jxhtml = GET_JXHTML(pdoc);
4412 jxhtml->textarea_flag++;
4413 for (attr = qs_get_attr(doc,node);
4415 attr = qs_get_next_attr(doc,attr)) {
4416 char *name = qs_get_attr_name(doc,attr);
4417 char *value = qs_get_attr_value(doc,attr);
4418 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4419 attr_accesskey = value;
4421 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4422 attr_istyle = value;
4424 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4427 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4430 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4433 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4437 if (IS_CSS_ON(jxhtml->entryp)) {
4438 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4440 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4441 css_property_t *cur;
4442 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4443 if (strcasestr(cur->value, "<ja:n>")) {
4446 else if (strcasestr(cur->value, "<ja:en>")) {
4449 else if (strcasestr(cur->value, "<ja:hk>")) {
4452 else if (strcasestr(cur->value, "<ja:h>")) {
4459 if (attr_accesskey) {
4460 W_L(" accesskey=\"");
4461 W_V(attr_accesskey);
4484 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
4486 W_L("-wap-input-format:");
4498 * It is a handler who processes the TEXTAREA tag.
4500 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4501 * destination is specified.
4502 * @param node [i] The TEXTAREA tag node is specified.
4503 * @return The conversion result is returned.
4506 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4512 jxhtml = GET_JXHTML(pdoc);
4517 jxhtml->textarea_flag--;
4524 * It is a handler who processes the B tag.
4526 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4527 * destination is specified.
4528 * @param node [i] The B tag node is specified.
4529 * @return The conversion result is returned.
4532 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4538 jxhtml = GET_JXHTML(pdoc);
4548 * It is a handler who processes the B tag.
4550 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4551 * destination is specified.
4552 * @param node [i] The B tag node is specified.
4553 * @return The conversion result is returned.
4556 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4558 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4559 Doc* doc = jxhtml->doc;
4566 s_jxhtml_text_tag(void* pdoc, Node* child)
4577 apr_size_t z2h_input_len;
4579 jxhtml = GET_JXHTML(pdoc);
4583 textval = qs_get_node_value(doc,child);
4584 if (strlen(textval) == 0) {
4588 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4589 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4591 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4592 memset(one_byte, 0, sizeof(one_byte));
4595 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4597 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4599 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4604 if (is_sjis_kanji(textval[ii])) {
4605 one_byte[0] = textval[ii+0];
4606 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4607 one_byte[0] = textval[ii+1];
4608 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4612 if (jxhtml->pre_flag) {
4613 one_byte[0] = textval[ii+0];
4614 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4617 if (jxhtml->textarea_flag) {
4618 one_byte[0] = textval[ii+0];
4619 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4622 if (textval[ii] != '\r' && textval[ii] != '\n') {
4623 one_byte[0] = textval[ii+0];
4624 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4628 z2h_input_len = strlen(tdst);
4629 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4637 * It is a handler who processes the BLOCKQUOTE tag.
4639 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4640 * destination is specified.
4641 * @param node [i] The BLOCKQUOTE tag node is specified.
4642 * @return The conversion result is returned.
4645 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4650 char *attr_style = NULL;
4651 char *attr_color = NULL;
4652 char *attr_size = NULL;
4653 char *css_clear = NULL;
4655 jxhtml = GET_JXHTML(pdoc);
4657 for (attr = qs_get_attr(doc,node);
4659 attr = qs_get_next_attr(doc,attr)) {
4660 char *nm = qs_get_attr_name(doc,attr);
4661 char *val = qs_get_attr_value(doc,attr);
4662 if (val && STRCASEEQ('s','S',"style", nm)) {
4666 if (IS_CSS_ON(jxhtml->entryp)) {
4667 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4669 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4670 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4671 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4673 css_property_t *cur;
4674 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4675 if (cur->value && *cur->value) {
4676 attr_color = apr_pstrdup(doc->pool, cur->value);
4679 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4680 if (cur->value && *cur->value) {
4681 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4682 attr_size = apr_pstrdup(doc->pool, cur->value);
4684 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4685 attr_size = apr_pstrdup(doc->pool, cur->value);
4687 else if (STRCASEEQ('s','S',"small",cur->value)) {
4688 attr_size = apr_pstrdup(doc->pool, cur->value);
4690 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4691 attr_size = apr_pstrdup(doc->pool, cur->value);
4693 else if (STRCASEEQ('l','L',"large",cur->value)) {
4694 attr_size = apr_pstrdup(doc->pool, cur->value);
4696 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4697 attr_size = apr_pstrdup(doc->pool, cur->value);
4699 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4700 attr_size = apr_pstrdup(doc->pool, cur->value);
4704 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4705 css_clear = apr_pstrdup(doc->pool, cur->value);
4710 if (attr_color || attr_size || css_clear) {
4713 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4736 * It is a handler who processes the BLOCKQUOTE tag.
4738 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4739 * destination is specified.
4740 * @param node [i] The BLOCKQUOTE tag node is specified.
4741 * @return The conversion result is returned.
4744 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4746 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4747 Doc *doc = jxhtml->doc;
4748 W_L("</blockquote>");
4749 if (IS_CSS_ON(jxhtml->entryp)) {
4750 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4757 * It is a handler who processes the DIR tag.
4759 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4760 * destination is specified.
4761 * @param node [i] The DIR tag node is specified.
4762 * @return The conversion result is returned.
4765 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4767 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4768 Doc *doc = jxhtml->doc;
4770 char *attr_style = NULL;
4771 char *attr_color = NULL;
4772 char *attr_type = NULL;
4773 char *attr_size = NULL;
4774 for (attr = qs_get_attr(doc,node);
4776 attr = qs_get_next_attr(doc,attr)) {
4777 char *name = qs_get_attr_name(doc,attr);
4778 char *value = qs_get_attr_value(doc,attr);
4779 if (STRCASEEQ('t','T',"type",name)) {
4780 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4784 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4788 if (IS_CSS_ON(jxhtml->entryp)) {
4789 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4791 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4792 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4793 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4794 css_property_t *cur;
4795 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4796 if (cur->value && *cur->value) {
4797 attr_color = apr_pstrdup(doc->pool, cur->value);
4800 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4801 if (cur->value && *cur->value) {
4802 attr_type = apr_pstrdup(doc->pool, cur->value);
4805 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4806 if (cur->value && *cur->value) {
4807 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4808 attr_size = apr_pstrdup(doc->pool, cur->value);
4810 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4811 attr_size = apr_pstrdup(doc->pool, cur->value);
4813 else if (STRCASEEQ('s','S',"small",cur->value)) {
4814 attr_size = apr_pstrdup(doc->pool, cur->value);
4816 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4817 attr_size = apr_pstrdup(doc->pool, cur->value);
4819 else if (STRCASEEQ('l','L',"large",cur->value)) {
4820 attr_size = apr_pstrdup(doc->pool, cur->value);
4822 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4823 attr_size = apr_pstrdup(doc->pool, cur->value);
4825 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4826 attr_size = apr_pstrdup(doc->pool, cur->value);
4833 if (attr_type || attr_color || attr_size) {
4836 W_L("list-style-type:");
4841 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4859 * It is a handler who processes the DIR tag.
4861 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4862 * destination is specified.
4863 * @param node [i] The DIR tag node is specified.
4864 * @return The conversion result is returned.
4867 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4869 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4870 Doc *doc = jxhtml->doc;
4872 if (IS_CSS_ON(jxhtml->entryp)) {
4873 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4880 * It is a handler who processes the DL tag.
4882 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4883 * destination is specified.
4884 * @param node [i] The DL tag node is specified.
4885 * @return The conversion result is returned.
4888 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4890 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4891 Doc *doc = jxhtml->doc;
4893 char *attr_style = NULL;
4894 char *attr_color = NULL;
4895 char *attr_size = NULL;
4896 char *css_clear = NULL;
4898 for (attr = qs_get_attr(doc,node);
4900 attr = qs_get_next_attr(doc,attr)) {
4901 char *name = qs_get_attr_name(doc,attr);
4902 char *value = qs_get_attr_value(doc,attr);
4903 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4907 if (IS_CSS_ON(jxhtml->entryp)) {
4908 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4910 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4911 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4912 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4914 css_property_t *cur;
4915 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4916 if (cur->value && *cur->value) {
4917 attr_color = apr_pstrdup(doc->pool, cur->value);
4920 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4921 if (cur->value && *cur->value) {
4922 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4923 attr_size = apr_pstrdup(doc->pool, cur->value);
4925 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4926 attr_size = apr_pstrdup(doc->pool, cur->value);
4928 else if (STRCASEEQ('s','S',"small",cur->value)) {
4929 attr_size = apr_pstrdup(doc->pool, cur->value);
4931 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4932 attr_size = apr_pstrdup(doc->pool, cur->value);
4934 else if (STRCASEEQ('l','L',"large",cur->value)) {
4935 attr_size = apr_pstrdup(doc->pool, cur->value);
4937 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4938 attr_size = apr_pstrdup(doc->pool, cur->value);
4940 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4941 attr_size = apr_pstrdup(doc->pool, cur->value);
4945 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4946 css_clear = apr_pstrdup(doc->pool, cur->value);
4951 if (attr_color || attr_size || css_clear) {
4954 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4977 * It is a handler who processes the DL tag.
4979 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4980 * destination is specified.
4981 * @param node [i] The DL tag node is specified.
4982 * @return The conversion result is returned.
4985 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4987 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4988 Doc *doc = jxhtml->doc;
4990 if (IS_CSS_ON(jxhtml->entryp)) {
4991 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4998 * It is a handler who processes the DT tag.
5000 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5001 * destination is specified.
5002 * @param node [i] The DT tag node is specified.
5003 * @return The conversion result is returned.
5006 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
5008 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5009 Doc *doc = jxhtml->doc;
5011 char *attr_style = NULL;
5012 char *attr_color = NULL;
5013 char *attr_size = NULL;
5014 for (attr = qs_get_attr(doc,node);
5016 attr = qs_get_next_attr(doc,attr)) {
5017 char *name = qs_get_attr_name(doc,attr);
5018 char *value = qs_get_attr_value(doc,attr);
5019 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5023 if (IS_CSS_ON(jxhtml->entryp)) {
5024 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5026 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5027 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5028 css_property_t *cur;
5029 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5030 if (cur->value && *cur->value) {
5031 attr_color = apr_pstrdup(doc->pool, cur->value);
5034 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5035 if (cur->value && *cur->value) {
5036 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5037 attr_size = apr_pstrdup(doc->pool, cur->value);
5039 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5040 attr_size = apr_pstrdup(doc->pool, cur->value);
5042 else if (STRCASEEQ('s','S',"small",cur->value)) {
5043 attr_size = apr_pstrdup(doc->pool, cur->value);
5045 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5046 attr_size = apr_pstrdup(doc->pool, cur->value);
5048 else if (STRCASEEQ('l','L',"large",cur->value)) {
5049 attr_size = apr_pstrdup(doc->pool, cur->value);
5051 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5052 attr_size = apr_pstrdup(doc->pool, cur->value);
5054 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5055 attr_size = apr_pstrdup(doc->pool, cur->value);
5062 if (attr_color || attr_size) {
5065 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5083 * It is a handler who processes the DT tag.
5085 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5086 * destination is specified.
5087 * @param node [i] The DT tag node is specified.
5088 * @return The conversion result is returned.
5091 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
5093 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5094 Doc *doc = jxhtml->doc;
5096 if (IS_CSS_ON(jxhtml->entryp)) {
5097 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5104 * It is a handler who processes the DD tag.
5106 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5107 * destination is specified.
5108 * @param node [i] The DD tag node is specified.
5109 * @return The conversion result is returned.
5112 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
5114 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5115 Doc *doc = jxhtml->doc;
5117 char *attr_style = NULL;
5118 char *attr_color = NULL;
5119 char *attr_size = NULL;
5120 for (attr = qs_get_attr(doc,node);
5122 attr = qs_get_next_attr(doc,attr)) {
5123 char *name = qs_get_attr_name(doc,attr);
5124 char *value = qs_get_attr_value(doc,attr);
5125 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5129 if (IS_CSS_ON(jxhtml->entryp)) {
5130 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5132 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5133 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5134 css_property_t *cur;
5135 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5136 if (cur->value && *cur->value) {
5137 attr_color = apr_pstrdup(doc->pool, cur->value);
5140 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5141 if (cur->value && *cur->value) {
5142 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5143 attr_size = apr_pstrdup(doc->pool, cur->value);
5145 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5146 attr_size = apr_pstrdup(doc->pool, cur->value);
5148 else if (STRCASEEQ('s','S',"small",cur->value)) {
5149 attr_size = apr_pstrdup(doc->pool, cur->value);
5151 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5152 attr_size = apr_pstrdup(doc->pool, cur->value);
5154 else if (STRCASEEQ('l','L',"large",cur->value)) {
5155 attr_size = apr_pstrdup(doc->pool, cur->value);
5157 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5158 attr_size = apr_pstrdup(doc->pool, cur->value);
5160 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5161 attr_size = apr_pstrdup(doc->pool, cur->value);
5168 if (attr_color || attr_size) {
5171 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5189 * It is a handler who processes the DD tag.
5191 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5192 * destination is specified.
5193 * @param node [i] The DD tag node is specified.
5194 * @return The conversion result is returned.
5197 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5199 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5200 Doc *doc = jxhtml->doc;
5202 if (IS_CSS_ON(jxhtml->entryp)) {
5203 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5210 * It is a handler who processes the H1 tag.
5212 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5213 * destination is specified.
5214 * @param node [i] The H1 tag node is specified.
5215 * @return The conversion result is returned.
5218 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5224 char *attr_style = NULL;
5225 char *attr_align = NULL;
5226 char *css_clear = NULL;
5228 jxhtml = GET_JXHTML(pdoc);
5232 for (attr = qs_get_attr(doc,node);
5234 attr = qs_get_next_attr(doc,attr)) {
5235 char *name = qs_get_attr_name(doc,attr);
5236 char *value = qs_get_attr_value(doc,attr);
5237 if (STRCASEEQ('a','A',"align", name)) {
5238 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5242 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5246 if (IS_CSS_ON(jxhtml->entryp)) {
5247 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5249 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5250 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5251 css_property_t *cur;
5252 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5253 if (STRCASEEQ('l','L',"left", cur->value)) {
5254 attr_align = apr_pstrdup(doc->pool, "left");
5256 else if (STRCASEEQ('c','C',"center",cur->value)) {
5257 attr_align = apr_pstrdup(doc->pool, "center");
5259 else if (STRCASEEQ('r','R',"right",cur->value)) {
5260 attr_align = apr_pstrdup(doc->pool, "right");
5263 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5264 if (STRCASEEQ('b','B',"both", cur->value)) {
5265 css_clear = apr_pstrdup(doc->pool, "both");
5267 else if (STRCASEEQ('r','R',"right", cur->value)) {
5268 css_clear = apr_pstrdup(doc->pool, "right");
5270 else if (STRCASEEQ('l','L',"left", cur->value)) {
5271 css_clear = apr_pstrdup(doc->pool, "left");
5277 if (attr_align || css_clear ) {
5298 * It is a handler who processes the H1 tag.
5300 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5301 * destination is specified.
5302 * @param node [i] The H1 tag node is specified.
5303 * @return The conversion result is returned.
5306 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5312 jxhtml = GET_JXHTML(pdoc);
5317 if (IS_CSS_ON(jxhtml->entryp)) {
5318 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5326 * It is a handler who processes the H2 tag.
5328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5329 * destination is specified.
5330 * @param node [i] The H1 tag node is specified.
5331 * @return The conversion result is returned.
5334 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5340 char *attr_style = NULL;
5341 char *attr_align = NULL;
5342 char *css_clear = NULL;
5344 jxhtml = GET_JXHTML(pdoc);
5348 for (attr = qs_get_attr(doc,node);
5350 attr = qs_get_next_attr(doc,attr)) {
5351 char *name = qs_get_attr_name(doc,attr);
5352 char *value = qs_get_attr_value(doc,attr);
5353 if (STRCASEEQ('a','A',"align", name)) {
5354 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5358 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5362 if (IS_CSS_ON(jxhtml->entryp)) {
5363 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5365 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5366 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5367 css_property_t *cur;
5368 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5369 if (STRCASEEQ('l','L',"left", cur->value)) {
5370 attr_align = apr_pstrdup(doc->pool, "left");
5372 else if (STRCASEEQ('c','C',"center",cur->value)) {
5373 attr_align = apr_pstrdup(doc->pool, "center");
5375 else if (STRCASEEQ('r','R',"right",cur->value)) {
5376 attr_align = apr_pstrdup(doc->pool, "right");
5379 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5380 if (STRCASEEQ('b','B',"both", cur->value)) {
5381 css_clear = apr_pstrdup(doc->pool, "both");
5383 else if (STRCASEEQ('r','R',"right", cur->value)) {
5384 css_clear = apr_pstrdup(doc->pool, "right");
5386 else if (STRCASEEQ('l','L',"left", cur->value)) {
5387 css_clear = apr_pstrdup(doc->pool, "left");
5393 if (attr_align || css_clear ) {
5414 * It is a handler who processes the H2 tag.
5416 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5417 * destination is specified.
5418 * @param node [i] The H1 tag node is specified.
5419 * @return The conversion result is returned.
5422 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5428 jxhtml = GET_JXHTML(pdoc);
5433 if (IS_CSS_ON(jxhtml->entryp)) {
5434 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5441 * It is a handler who processes the H3 tag.
5443 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5444 * destination is specified.
5445 * @param node [i] The H1 tag node is specified.
5446 * @return The conversion result is returned.
5449 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5455 char *attr_style = NULL;
5456 char *attr_align = NULL;
5457 char *css_clear = NULL;
5459 jxhtml = GET_JXHTML(pdoc);
5463 for (attr = qs_get_attr(doc,node);
5465 attr = qs_get_next_attr(doc,attr)) {
5466 char *name = qs_get_attr_name(doc,attr);
5467 char *value = qs_get_attr_value(doc,attr);
5468 if (STRCASEEQ('a','A',"align", name)) {
5469 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5473 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5477 if (IS_CSS_ON(jxhtml->entryp)) {
5478 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5480 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5481 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5482 css_property_t *cur;
5483 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5484 if (STRCASEEQ('l','L',"left", cur->value)) {
5485 attr_align = apr_pstrdup(doc->pool, "left");
5487 else if (STRCASEEQ('c','C',"center",cur->value)) {
5488 attr_align = apr_pstrdup(doc->pool, "center");
5490 else if (STRCASEEQ('r','R',"right",cur->value)) {
5491 attr_align = apr_pstrdup(doc->pool, "right");
5494 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5495 if (STRCASEEQ('b','B',"both", cur->value)) {
5496 css_clear = apr_pstrdup(doc->pool, "both");
5498 else if (STRCASEEQ('r','R',"right", cur->value)) {
5499 css_clear = apr_pstrdup(doc->pool, "right");
5501 else if (STRCASEEQ('l','L',"left", cur->value)) {
5502 css_clear = apr_pstrdup(doc->pool, "left");
5508 if (attr_align || css_clear ) {
5529 * It is a handler who processes the H3 tag.
5531 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5532 * destination is specified.
5533 * @param node [i] The H1 tag node is specified.
5534 * @return The conversion result is returned.
5537 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5543 jxhtml = GET_JXHTML(pdoc);
5548 if (IS_CSS_ON(jxhtml->entryp)) {
5549 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5556 * It is a handler who processes the H4 tag.
5558 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5559 * destination is specified.
5560 * @param node [i] The H1 tag node is specified.
5561 * @return The conversion result is returned.
5564 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5570 char *attr_style = NULL;
5571 char *attr_align = NULL;
5572 char *css_clear = NULL;
5574 jxhtml = GET_JXHTML(pdoc);
5578 for (attr = qs_get_attr(doc,node);
5580 attr = qs_get_next_attr(doc,attr)) {
5581 char *name = qs_get_attr_name(doc,attr);
5582 char *value = qs_get_attr_value(doc,attr);
5583 if (STRCASEEQ('a','A',"align", name)) {
5584 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5588 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5592 if (IS_CSS_ON(jxhtml->entryp)) {
5593 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5595 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5596 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5597 css_property_t *cur;
5598 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5599 if (STRCASEEQ('l','L',"left", cur->value)) {
5600 attr_align = apr_pstrdup(doc->pool, "left");
5602 else if (STRCASEEQ('c','C',"center",cur->value)) {
5603 attr_align = apr_pstrdup(doc->pool, "center");
5605 else if (STRCASEEQ('r','R',"right",cur->value)) {
5606 attr_align = apr_pstrdup(doc->pool, "right");
5609 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5610 if (STRCASEEQ('b','B',"both", cur->value)) {
5611 css_clear = apr_pstrdup(doc->pool, "both");
5613 else if (STRCASEEQ('r','R',"right", cur->value)) {
5614 css_clear = apr_pstrdup(doc->pool, "right");
5616 else if (STRCASEEQ('l','L',"left", cur->value)) {
5617 css_clear = apr_pstrdup(doc->pool, "left");
5623 if (attr_align || css_clear ) {
5644 * It is a handler who processes the H4 tag.
5646 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5647 * destination is specified.
5648 * @param node [i] The H1 tag node is specified.
5649 * @return The conversion result is returned.
5652 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5658 jxhtml = GET_JXHTML(pdoc);
5663 if (IS_CSS_ON(jxhtml->entryp)) {
5664 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5672 * It is a handler who processes the H5 tag.
5674 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5675 * destination is specified.
5676 * @param node [i] The H1 tag node is specified.
5677 * @return The conversion result is returned.
5680 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5686 char *attr_style = NULL;
5687 char *attr_align = NULL;
5688 char *css_clear = NULL;
5690 jxhtml = GET_JXHTML(pdoc);
5694 for (attr = qs_get_attr(doc,node);
5696 attr = qs_get_next_attr(doc,attr)) {
5697 char *name = qs_get_attr_name(doc,attr);
5698 char *value = qs_get_attr_value(doc,attr);
5699 if (STRCASEEQ('a','A',"align", name)) {
5700 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5704 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5708 if (IS_CSS_ON(jxhtml->entryp)) {
5709 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5711 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5712 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5713 css_property_t *cur;
5714 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5715 if (STRCASEEQ('l','L',"left", cur->value)) {
5716 attr_align = apr_pstrdup(doc->pool, "left");
5718 else if (STRCASEEQ('c','C',"center",cur->value)) {
5719 attr_align = apr_pstrdup(doc->pool, "center");
5721 else if (STRCASEEQ('r','R',"right",cur->value)) {
5722 attr_align = apr_pstrdup(doc->pool, "right");
5725 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5726 if (STRCASEEQ('b','B',"both", cur->value)) {
5727 css_clear = apr_pstrdup(doc->pool, "both");
5729 else if (STRCASEEQ('r','R',"right", cur->value)) {
5730 css_clear = apr_pstrdup(doc->pool, "right");
5732 else if (STRCASEEQ('l','L',"left", cur->value)) {
5733 css_clear = apr_pstrdup(doc->pool, "left");
5739 if (attr_align || css_clear ) {
5760 * It is a handler who processes the H5 tag.
5762 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5763 * destination is specified.
5764 * @param node [i] The H1 tag node is specified.
5765 * @return The conversion result is returned.
5768 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5774 jxhtml = GET_JXHTML(pdoc);
5779 if (IS_CSS_ON(jxhtml->entryp)) {
5780 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5788 * It is a handler who processes the H6 tag.
5790 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5791 * destination is specified.
5792 * @param node [i] The H1 tag node is specified.
5793 * @return The conversion result is returned.
5796 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5802 char *attr_style = NULL;
5803 char *attr_align = NULL;
5804 char *css_clear = NULL;
5806 jxhtml = GET_JXHTML(pdoc);
5810 for (attr = qs_get_attr(doc,node);
5812 attr = qs_get_next_attr(doc,attr)) {
5813 char *name = qs_get_attr_name(doc,attr);
5814 char *value = qs_get_attr_value(doc,attr);
5815 if (STRCASEEQ('a','A',"align", name)) {
5816 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5820 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5824 if (IS_CSS_ON(jxhtml->entryp)) {
5825 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5827 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5828 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5829 css_property_t *cur;
5830 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5831 if (STRCASEEQ('l','L',"left", cur->value)) {
5832 attr_align = apr_pstrdup(doc->pool, "left");
5834 else if (STRCASEEQ('c','C',"center",cur->value)) {
5835 attr_align = apr_pstrdup(doc->pool, "center");
5837 else if (STRCASEEQ('r','R',"right",cur->value)) {
5838 attr_align = apr_pstrdup(doc->pool, "right");
5841 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5842 if (STRCASEEQ('b','B',"both", cur->value)) {
5843 css_clear = apr_pstrdup(doc->pool, "both");
5845 else if (STRCASEEQ('r','R',"right", cur->value)) {
5846 css_clear = apr_pstrdup(doc->pool, "right");
5848 else if (STRCASEEQ('l','L',"left", cur->value)) {
5849 css_clear = apr_pstrdup(doc->pool, "left");
5855 if (attr_align || css_clear ) {
5876 * It is a handler who processes the H6 tag.
5878 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5879 * destination is specified.
5880 * @param node [i] The H1 tag node is specified.
5881 * @return The conversion result is returned.
5884 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5890 jxhtml = GET_JXHTML(pdoc);
5895 if (IS_CSS_ON(jxhtml->entryp)) {
5896 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5904 * It is a handler who processes the MENU tag.
5906 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5907 * destination is specified.
5908 * @param node [i] The MENU tag node is specified.
5909 * @return The conversion result is returned.
5912 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5914 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5915 Doc *doc = jxhtml->doc;
5917 char *attr_style = NULL;
5918 char *attr_color = NULL;
5919 char *attr_type = NULL;
5920 char *attr_size = NULL;
5921 for (attr = qs_get_attr(doc,node);
5923 attr = qs_get_next_attr(doc,attr)) {
5924 char *name = qs_get_attr_name(doc,attr);
5925 char *value = qs_get_attr_value(doc,attr);
5926 if (STRCASEEQ('t','T',"type",name)) {
5927 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5931 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5935 if (IS_CSS_ON(jxhtml->entryp)) {
5936 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5938 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5939 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5940 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5941 css_property_t *cur;
5942 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5943 if (cur->value && *cur->value) {
5944 attr_color = apr_pstrdup(doc->pool, cur->value);
5947 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5948 if (cur->value && *cur->value) {
5949 attr_type = apr_pstrdup(doc->pool, cur->value);
5952 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5953 if (cur->value && *cur->value) {
5954 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5955 attr_size = apr_pstrdup(doc->pool, cur->value);
5957 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5958 attr_size = apr_pstrdup(doc->pool, cur->value);
5960 else if (STRCASEEQ('s','S',"small",cur->value)) {
5961 attr_size = apr_pstrdup(doc->pool, cur->value);
5963 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5964 attr_size = apr_pstrdup(doc->pool, cur->value);
5966 else if (STRCASEEQ('l','L',"large",cur->value)) {
5967 attr_size = apr_pstrdup(doc->pool, cur->value);
5969 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5970 attr_size = apr_pstrdup(doc->pool, cur->value);
5972 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5973 attr_size = apr_pstrdup(doc->pool, cur->value);
5980 if (attr_type || attr_color || attr_size) {
5983 W_L("list-style-type:");
5988 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6006 * It is a handler who processes the MENU tag.
6008 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6009 * destination is specified.
6010 * @param node [i] The MENU tag node is specified.
6011 * @return The conversion result is returned.
6014 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
6016 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6017 Doc *doc = jxhtml->doc;
6019 if (IS_CSS_ON(jxhtml->entryp)) {
6020 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6027 * It is a handler who processes the PLAINTEXT tag.
6029 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6030 * destination is specified.
6031 * @param node [i] The PLAINTEXT tag node is specified.
6032 * @return The conversion result is returned.
6035 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
6040 jxhtml = GET_JXHTML(pdoc);
6043 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
6048 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
6053 jxhtml = GET_JXHTML(pdoc);
6055 for (child = qs_get_child_node(doc, node);
6057 child = qs_get_next_node(doc, child)) {
6059 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
6066 * It is a handler who processes the PLAINTEXT tag.
6068 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6069 * destination is specified.
6070 * @param node [i] The PLAINTEXT tag node is specified.
6071 * @return The conversion result is returned.
6074 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6076 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6082 * It is a handler who processes the BLINK tag.
6084 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6085 * destination is specified.
6086 * @param node [i] The BLINK tag node is specified.
6087 * @return The conversion result is returned.
6090 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
6092 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6093 Doc *doc = jxhtml->doc;
6095 char *attr_style = NULL;
6096 char *attr_color = NULL;
6097 char *attr_size = NULL;
6098 for (attr = qs_get_attr(doc,node);
6100 attr = qs_get_next_attr(doc,attr)) {
6101 char *name = qs_get_attr_name(doc,attr);
6102 char *value = qs_get_attr_value(doc,attr);
6103 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6107 if (IS_CSS_ON(jxhtml->entryp)) {
6108 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6110 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6111 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6112 css_property_t *cur;
6113 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6114 if (cur->value && *cur->value) {
6115 attr_color = apr_pstrdup(doc->pool, cur->value);
6118 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6119 if (cur->value && *cur->value) {
6120 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6121 attr_size = apr_pstrdup(doc->pool, cur->value);
6123 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6124 attr_size = apr_pstrdup(doc->pool, cur->value);
6126 else if (STRCASEEQ('s','S',"small",cur->value)) {
6127 attr_size = apr_pstrdup(doc->pool, cur->value);
6129 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6130 attr_size = apr_pstrdup(doc->pool, cur->value);
6132 else if (STRCASEEQ('l','L',"large",cur->value)) {
6133 attr_size = apr_pstrdup(doc->pool, cur->value);
6135 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6136 attr_size = apr_pstrdup(doc->pool, cur->value);
6138 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6139 attr_size = apr_pstrdup(doc->pool, cur->value);
6146 if (attr_color || attr_size) {
6149 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6167 * It is a handler who processes the BLINK tag.
6169 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6170 * destination is specified.
6171 * @param node [i] The BLINK tag node is specified.
6172 * @return The conversion result is returned.
6175 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6177 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6178 Doc *doc = jxhtml->doc;
6180 if (IS_CSS_ON(jxhtml->entryp)) {
6181 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6188 * It is a handler who processes the MARQUEE tag.
6190 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6191 * destination is specified.
6192 * @param node [i] The MARQUEE tag node is specified.
6193 * @return The conversion result is returned.
6196 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6198 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6199 Doc *doc = jxhtml->doc;
6201 char *attr_direction = NULL;
6202 char *attr_style = NULL;
6203 char *attr_color = NULL;
6204 char *attr_size = NULL;
6205 char *attr_bgcolor = NULL;
6206 /*--------------------------------------------------------------------------*/
6207 /* Get Attributes */
6208 /*--------------------------------------------------------------------------*/
6209 for (attr = qs_get_attr(doc,node);
6211 attr = qs_get_next_attr(doc,attr)) {
6212 char *name = qs_get_attr_name(doc,attr);
6213 char *value = qs_get_attr_value(doc,attr);
6214 if (STRCASEEQ('d','D',"direction", name)) {
6216 if (STRCASEEQ('l','L',"left",value)) {
6217 attr_direction = "rtl";
6219 else if (STRCASEEQ('r','R',"right",value)) {
6220 attr_direction = "ltr";
6224 else if (STRCASEEQ('b','B',"behavior",name)) {
6227 else if (STRCASEEQ('l','L',"loop",name)) {
6230 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6231 if (value && *value) {
6232 attr_bgcolor = value;
6235 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6239 if (IS_CSS_ON(jxhtml->entryp)) {
6240 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6242 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6243 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6244 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6245 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6246 css_property_t *cur;
6247 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6248 if (cur->value && *cur->value) {
6249 attr_color = apr_pstrdup(doc->pool, cur->value);
6252 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6253 if (cur->value && *cur->value) {
6254 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6257 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6258 if (cur->value && *cur->value) {
6259 attr_direction = apr_pstrdup(doc->pool, cur->value);
6262 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6263 if (cur->value && *cur->value) {
6264 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6265 || STRCASEEQ('x','X',"x-small", cur->value)
6266 || STRCASEEQ('s','S',"small", cur->value)
6267 || STRCASEEQ('m','M',"medium", cur->value)
6268 || STRCASEEQ('l','L',"large", cur->value)
6269 || STRCASEEQ('x','X',"x-large", cur->value)
6270 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6271 attr_size = apr_pstrdup(doc->pool, cur->value);
6278 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6280 if (attr_direction) {
6281 W_L("-wap-marquee-dir:");
6282 W_V(attr_direction);
6286 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6287 W_L("background-color:");
6292 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6311 * It is a handler who processes the MARQUEE tag.
6313 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6314 * destination is specified.
6315 * @param node [i] The MARQUEE tag node is specified.
6316 * @return The conversion result is returned.
6319 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6321 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6322 Doc *doc = jxhtml->doc;
6324 if (IS_CSS_ON(jxhtml->entryp)) {
6325 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6332 * It is handler who processes the New Line Code.
6335 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6337 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6338 if (jxhtml->start_html_flag) {
6339 Doc *doc = jxhtml->doc;
6347 * It is a handler who processes the LINK tag.
6349 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6350 * destination is specified.
6351 * @param node [i] The LINK tag node is specified.
6352 * @return The conversion result is returned.
6355 s_jxhtml_link_tag(void *pdoc, Node *node)
6364 jxhtml = GET_JXHTML(pdoc);
6367 if (! IS_CSS_ON(jxhtml->entryp)) {
6371 for (attr = qs_get_attr(doc,node);
6373 attr = qs_get_next_attr(doc,attr)) {
6374 char *name = qs_get_attr_name(doc,attr);
6375 char *value = qs_get_attr_value(doc,attr);
6376 if (STRCASEEQ('r','R',"rel", name)) {
6377 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6381 else if (STRCASEEQ('h','H',"href", name)) {
6382 if (value && *value) {
6386 else if (STRCASEEQ('t','T',"type", name)) {
6387 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6393 if (rel && href && type) {
6394 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6395 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6396 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6403 static css_prop_list_t *
6404 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6406 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6407 Doc *doc = jxhtml->doc;
6408 css_prop_list_t *last_css = NULL;
6409 if (IS_CSS_ON(jxhtml->entryp)) {
6410 css_prop_list_t *dup_css;
6411 css_selector_t *selector;
6413 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6414 dup_css = chxj_dup_css_prop_list(doc, last_css);
6415 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6417 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6419 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6420 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6422 if (style_attr_value) {
6423 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));
6425 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6433 static css_prop_list_t *
6434 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6436 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6437 Doc *doc = jxhtml->doc;
6438 css_prop_list_t *last_css = NULL;
6439 if (IS_CSS_ON(jxhtml->entryp)) {
6440 css_prop_list_t *dup_css;
6441 css_selector_t *selector;
6443 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6444 dup_css = chxj_dup_css_prop_list(doc, last_css);
6445 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6447 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6451 if (style_attr_value) {
6452 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));
6454 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6463 * It is a handler who processes the SPAN tag.
6465 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6466 * destination is specified.
6467 * @param node [i] The SPAN tag node is specified.
6468 * @return The conversion result is returned.
6471 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6476 char *attr_style = NULL;
6477 char *attr_color = NULL;
6478 char *attr_size = NULL;
6479 char *attr_align = NULL;
6480 char *attr_blink = NULL;
6481 char *attr_marquee = NULL;
6482 char *attr_marquee_dir = NULL;
6483 char *attr_marquee_style = NULL;
6484 char *attr_marquee_loop = NULL;
6485 char *css_bgcolor = NULL;
6487 jxhtml = GET_JXHTML(pdoc);
6490 for (attr = qs_get_attr(doc,node);
6492 attr = qs_get_next_attr(doc,attr)) {
6493 char *nm = qs_get_attr_name(doc,attr);
6494 char *val = qs_get_attr_value(doc,attr);
6495 if (val && STRCASEEQ('s','S',"style", nm)) {
6499 if (IS_CSS_ON(jxhtml->entryp)) {
6500 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6502 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6503 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6504 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6505 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6506 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6507 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6508 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6509 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6510 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6512 css_property_t *cur;
6513 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6514 attr_color = apr_pstrdup(doc->pool, cur->value);
6516 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6517 if (cur->value && *cur->value) {
6518 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6519 || STRCASEEQ('x','X',"x-small", cur->value)
6520 || STRCASEEQ('s','S',"small", cur->value)
6521 || STRCASEEQ('m','M',"medium", cur->value)
6522 || STRCASEEQ('l','L',"large", cur->value)
6523 || STRCASEEQ('x','X',"x-large", cur->value)
6524 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6525 attr_size = apr_pstrdup(doc->pool, cur->value);
6529 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6530 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6531 attr_blink = apr_pstrdup(doc->pool, cur->value);
6534 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6535 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6536 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6539 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6540 if (cur->value && *cur->value) {
6541 if ( STRCASEEQ('l','L',"ltr",cur->value)
6542 || STRCASEEQ('r','R',"rtl",cur->value)) {
6543 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6547 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6548 if (cur->value && *cur->value) {
6549 if ( STRCASEEQ('s','S',"scroll",cur->value)
6550 || STRCASEEQ('s','S',"slide",cur->value)
6551 || STRCASEEQ('a','A',"alternate",cur->value)) {
6552 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6556 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6557 if (cur->value && *cur->value) {
6558 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6559 attr_marquee_loop = "infinite";
6562 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6566 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6567 if (STRCASEEQ('l','L',"left", cur->value)) {
6568 attr_align = apr_pstrdup(doc->pool, "left");
6570 else if (STRCASEEQ('c','C',"center",cur->value)) {
6571 attr_align = apr_pstrdup(doc->pool, "center");
6573 else if (STRCASEEQ('r','R',"right",cur->value)) {
6574 attr_align = apr_pstrdup(doc->pool, "right");
6577 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6578 if (cur->value && *cur->value) {
6579 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6586 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6589 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6605 W_L("text-decoration:");
6610 W_L("display:-wap-marquee;");
6611 if (attr_marquee_dir) {
6612 W_L("-wap-marquee-dir:");
6613 W_V(attr_marquee_dir);
6616 if (attr_marquee_style) {
6617 W_L("-wap-marquee-style:");
6618 W_V(attr_marquee_style);
6621 if (attr_marquee_loop) {
6622 W_L("-wap-marquee-loop:");
6623 W_V(attr_marquee_loop);
6628 W_L("background-color:");
6640 * It is a handler who processes the SPAN tag.
6642 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6643 * destination is specified.
6644 * @param node [i] The SPAN tag node is specified.
6645 * @return The conversion result is returned.
6648 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6650 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6651 Doc *doc = jxhtml->doc;
6654 if (IS_CSS_ON(jxhtml->entryp)) {
6655 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6662 * It is a handler who processes the STYLE tag.
6664 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6665 * destination is specified.
6666 * @param node [i] The STYLE tag node is specified.
6667 * @return The conversion result is returned.
6670 s_jxhtml_style_tag(void *pdoc, Node *node)
6680 jxhtml = GET_JXHTML(pdoc);
6683 if (! IS_CSS_ON(jxhtml->entryp)) {
6687 for (attr = qs_get_attr(doc,node);
6689 attr = qs_get_next_attr(doc,attr)) {
6690 char *name = qs_get_attr_name(doc,attr);
6691 char *value = qs_get_attr_value(doc,attr);
6692 if (STRCASEEQ('t','T',"type", name)) {
6693 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6700 for (child = qs_get_child_node(doc, node);
6702 child = qs_get_next_node(doc, child)) {
6703 char *name = qs_get_node_name(doc, child);
6704 if (STRCASEEQ('t','T',"text", name)) {
6705 char *value = qs_get_node_value(doc, child);
6706 if (value && *value) {
6707 style = apr_pstrcat(doc->r->pool, style, value, NULL);
6711 if (strlen(style) > 0) {
6712 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
6713 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, style);
6714 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
6720 * It is a handler who processes the OBJECT tag.
6722 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6723 * destination is specified.
6724 * @param node [i] The OBJECT tag node is specified.
6725 * @return The conversion result is returned.
6728 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6730 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6731 Doc *doc = jxhtml->doc;
6734 char *attr_id = NULL;
6735 char *attr_width = NULL;
6736 char *attr_height = NULL;
6737 char *attr_data = NULL;
6738 char *attr_type = NULL;
6739 char *attr_declare = NULL;
6740 char *attr_classid = NULL;
6741 char *attr_codebase = NULL;
6743 /*--------------------------------------------------------------------------*/
6744 /* Get Attributes */
6745 /*--------------------------------------------------------------------------*/
6746 for (attr = qs_get_attr(doc,node);
6748 attr = qs_get_next_attr(doc,attr)) {
6749 char *name = qs_get_attr_name(doc,attr);
6750 char *value = qs_get_attr_value(doc,attr);
6751 if (STRCASEEQ('i','I',"id",name)) {
6752 attr_id = apr_pstrdup(doc->pool, value);
6754 else if (STRCASEEQ('w','W',"width",name)) {
6755 attr_width = apr_pstrdup(doc->pool, value);
6757 else if (STRCASEEQ('h','H',"height",name)) {
6758 attr_height = apr_pstrdup(doc->pool, value);
6760 else if (STRCASEEQ('d','D',"data",name)) {
6761 attr_data = apr_pstrdup(doc->pool, value);
6763 else if (STRCASEEQ('t','T',"type",name)) {
6764 attr_type = apr_pstrdup(doc->pool, value);
6766 else if (STRCASEEQ('d','D',"declare",name)) {
6767 attr_declare = apr_pstrdup(doc->pool, value);
6769 else if (STRCASEEQ('c','C',"classid",name)) {
6770 attr_classid = apr_pstrdup(doc->pool, value);
6772 else if (STRCASEEQ('c','C',"codebase",name)) {
6773 attr_codebase = apr_pstrdup(doc->pool, value);
6805 W_L(" declare=\"declare\"");
6813 W_L(" codebase=\"");
6822 * It is a handler who processes the OBJECT tag.
6824 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6825 * destination is specified.
6826 * @param node [i] The OBJECT tag node is specified.
6827 * @return The conversion result is returned.
6830 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6832 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6833 Doc *doc = jxhtml->doc;
6839 * It is a handler who processes the OBJECT tag.
6841 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6842 * destination is specified.
6843 * @param node [i] The OBJECT tag node is specified.
6844 * @return The conversion result is returned.
6847 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6849 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6850 Doc *doc = jxhtml->doc;
6853 char *attr_name = NULL;
6854 char *attr_value = NULL;
6855 char *attr_valuetype = NULL;
6857 /*--------------------------------------------------------------------------*/
6858 /* Get Attributes */
6859 /*--------------------------------------------------------------------------*/
6860 for (attr = qs_get_attr(doc,node);
6862 attr = qs_get_next_attr(doc,attr)) {
6863 char *name = qs_get_attr_name(doc,attr);
6864 char *value = qs_get_attr_value(doc,attr);
6865 if (STRCASEEQ('n','N',"name",name)) {
6866 attr_name = apr_pstrdup(doc->pool, value);
6868 else if (STRCASEEQ('v','V',"value",name)) {
6869 attr_value = apr_pstrdup(doc->pool, value);
6871 else if (STRCASEEQ('v','V',"valuetype",name)) {
6872 attr_valuetype = apr_pstrdup(doc->pool, value);
6888 W_L(" valuetype=\"");
6889 W_V(attr_valuetype);
6896 * It is a handler who processes the CAPTION tag.
6898 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6899 * destination is specified.
6900 * @param node [i] The CAPTION tag node is specified.
6901 * @return The conversion result is returned.
6904 s_jxhtml_start_caption_tag(void *pdoc, Node *node)
6910 char *attr_style = NULL;
6911 char *attr_align = NULL;
6913 jxhtml = GET_JXHTML(pdoc);
6917 for (attr = qs_get_attr(doc,node);
6919 attr = qs_get_next_attr(doc,attr)) {
6920 char *name = qs_get_attr_name(doc,attr);
6921 char *value = qs_get_attr_value(doc,attr);
6922 if (STRCASEEQ('a','A',"align", name)) {
6924 (STRCASEEQ('l','L',"left",value)
6925 || STRCASEEQ('r','R',"right",value)
6926 || STRCASEEQ('t','T',"top",value)
6927 || STRCASEEQ('b','B',"bottom",value)
6932 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6950 * It is a handler who processes the CAPTION tag.
6952 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6953 * destination is specified.
6954 * @param node [i] The CAPTION tag node is specified.
6955 * @return The conversion result is returned.
6958 s_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child))
6960 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
6961 Doc* doc = jxhtml->doc;