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')) {
2614 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
2616 W_L("-wap-input-format:");
2621 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2622 W_L(" istyle=\"4\"");
2624 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,"4");
2626 W_L("-wap-input-format:");
2631 /*--------------------------------------------------------------------------*/
2632 /* The figure is default for the password. */
2633 /*--------------------------------------------------------------------------*/
2634 if (attr_max_length && *attr_max_length) {
2635 if (chxj_chk_numeric(attr_max_length) == 0) {
2636 W_L(" maxlength=\"");
2637 W_V(attr_max_length);
2642 W_L(" checked=\"checked\"");
2658 jxhtml = GET_JXHTML(pdoc);
2671 /*--------------------------------------------------------------------------*/
2672 /* Get Attributes */
2673 /*--------------------------------------------------------------------------*/
2674 type = qs_get_type_attr(doc, node, doc->buf.pool);
2675 name = qs_get_name_attr(doc, node, doc->buf.pool);
2676 value = qs_get_value_attr(doc,node, doc->buf.pool);
2677 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2678 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2679 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2680 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2681 size = qs_get_size_attr(doc, node, doc->buf.pool);
2684 if (type && (STRCASEEQ('t','T',"text", type) ||
2685 STRCASEEQ('p','P',"password",type) ||
2686 STRCASEEQ('c','C',"checkbox",type) ||
2687 STRCASEEQ('r','R',"radio", type) ||
2688 STRCASEEQ('h','H',"hidden", type) ||
2689 STRCASEEQ('s','S',"submit", type) ||
2690 STRCASEEQ('r','R',"reset", type))) {
2696 if (size && *size) {
2701 if (name && *name) {
2703 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2706 if (value && *value) {
2707 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2708 apr_size_t value_len = strlen(value);
2709 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2713 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2716 if (accesskey && *accesskey) {
2717 W_L(" accesskey=\"");
2721 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2722 /*------------------------------------------------------------------------*/
2724 /*------------------------------------------------------------------------*/
2725 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2726 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2729 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2731 W_L("-wap-input-format:'*");
2737 else if (type && STRCASEEQ('p','P',"password",type)) {
2738 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2740 /*--------------------------------------------------------------------------*/
2741 /* The figure is default for the password. */
2742 /*--------------------------------------------------------------------------*/
2743 if (max_length && *max_length) {
2744 if (chxj_chk_numeric(max_length) == 0) {
2745 W_L(" maxlength=\"");
2752 W_L(" checked=\"checked\"");
2761 * It is a handler who processes the INPUT tag.
2763 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2764 * destination is specified.
2765 * @param node [i] The INPUT tag node is specified.
2766 * @return The conversion result is returned.
2769 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2771 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2777 * It is a handler who processes the CENTER tag.
2779 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2780 * destination is specified.
2781 * @param node [i] The CENTER tag node is specified.
2782 * @return The conversion result is returned.
2785 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2790 char *attr_style = NULL;
2791 char *attr_color = NULL;
2792 char *attr_size = NULL;
2794 jxhtml = GET_JXHTML(pdoc);
2797 for (attr = qs_get_attr(doc,node);
2799 attr = qs_get_next_attr(doc,attr)) {
2800 char *name = qs_get_attr_name(doc,attr);
2801 char *value = qs_get_attr_value(doc,attr);
2802 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2806 if (IS_CSS_ON(jxhtml->entryp)) {
2807 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2809 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2810 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2811 css_property_t *cur;
2812 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2813 if (cur->value && *cur->value) {
2814 attr_color = apr_pstrdup(doc->pool, cur->value);
2817 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2818 if (cur->value && *cur->value) {
2819 attr_size = apr_pstrdup(doc->pool, cur->value);
2826 if (attr_size || attr_color) {
2834 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2848 * It is a handler who processes the CENTER tag.
2850 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2851 * destination is specified.
2852 * @param node [i] The CENTER tag node is specified.
2853 * @return The conversion result is returned.
2856 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2862 jxhtml = GET_JXHTML(pdoc);
2867 if (IS_CSS_ON(jxhtml->entryp)) {
2868 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2875 * It is a handler who processes the li tag.
2877 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2878 * destination is specified.
2879 * @param node [i] The li tag node is specified.
2880 * @return The conversion result is returned.
2883 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2889 char *attr_type = NULL;
2890 char *attr_value = NULL;
2891 char *attr_style = NULL;
2893 jxhtml = GET_JXHTML(pdoc);
2897 for (attr = qs_get_attr(doc,node);
2899 attr = qs_get_next_attr(doc,attr)) {
2900 char *name = qs_get_attr_name(doc,attr);
2901 char *value = qs_get_attr_value(doc,attr);
2902 if (STRCASEEQ('t','T',"type",name)) {
2903 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2904 if (*value == '1') {
2905 attr_type = apr_pstrdup(doc->pool, "decimal");
2907 else if (*value == 'a') {
2908 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2910 else if (*value == 'A') {
2911 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2918 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2921 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2925 if (IS_CSS_ON(jxhtml->entryp)) {
2926 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2928 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2929 css_property_t *cur;
2930 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2931 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2932 attr_type = apr_pstrdup(doc->pool, "decimal");
2934 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2935 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2937 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2938 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2940 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2941 attr_type = apr_pstrdup(doc->pool, "disc");
2943 else if (STRCASEEQ('s','S',"square", cur->value)) {
2944 attr_type = apr_pstrdup(doc->pool, "square");
2946 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2947 attr_type = apr_pstrdup(doc->pool, "circle");
2957 W_L("list-style-type:");
2973 * It is a handler who processes the li tag.
2975 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2976 * destination is specified.
2977 * @param node [i] The li tag node is specified.
2978 * @return The conversion result is returned.
2981 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2987 jxhtml = GET_JXHTML(pdoc);
2991 if (IS_CSS_ON(jxhtml->entryp)) {
2992 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3000 * It is a handler who processes the OL tag.
3002 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3003 * destination is specified.
3004 * @param node [i] The OL tag node is specified.
3005 * @return The conversion result is returned.
3008 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
3014 char *attr_style = NULL;
3015 char *attr_start = NULL;
3016 char *attr_type = NULL;
3017 char *css_clear = NULL;
3019 jxhtml = GET_JXHTML(pdoc);
3023 /*--------------------------------------------------------------------------*/
3024 /* Get Attributes */
3025 /*--------------------------------------------------------------------------*/
3026 for (attr = qs_get_attr(doc,node);
3028 attr = qs_get_next_attr(doc,attr)) {
3029 char *name = qs_get_attr_name(doc,attr);
3030 char *value = qs_get_attr_value(doc,attr);
3031 if (STRCASEEQ('t','T',"type",name) && value) {
3032 if (*value == '1') {
3033 attr_type = apr_pstrdup(doc->pool, "decimal");
3035 else if (*value == 'a') {
3036 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3038 else if (*value == 'A') {
3039 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3042 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3045 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3049 if (IS_CSS_ON(jxhtml->entryp)) {
3050 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3052 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3053 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3055 css_property_t *cur;
3056 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3057 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3058 attr_type = apr_pstrdup(doc->pool, "decimal");
3060 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3061 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3063 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3064 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3067 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3068 css_clear = apr_pstrdup(doc->pool, cur->value);
3073 if (attr_type || css_clear) {
3076 W_L("list-style-type:");
3099 * It is a handler who processes the OL tag.
3101 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3102 * destination is specified.
3103 * @param node [i] The OL tag node is specified.
3104 * @return The conversion result is returned.
3107 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
3113 jxhtml = GET_JXHTML(pdoc);
3118 if (IS_CSS_ON(jxhtml->entryp)) {
3119 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3126 * It is a handler who processes the P tag.
3128 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3129 * destination is specified.
3130 * @param node [i] The P tag node is specified.
3131 * @return The conversion result is returned.
3134 s_jxhtml_start_p_tag(void *pdoc, Node *node)
3140 char *attr_align = NULL;
3141 char *attr_style = NULL;
3142 char *attr_color = NULL;
3143 char *attr_blink = NULL;
3144 char *css_clear = NULL;
3146 jxhtml = GET_JXHTML(pdoc);
3150 for (attr = qs_get_attr(doc,node);
3152 attr = qs_get_next_attr(doc,attr)) {
3153 char *nm = qs_get_attr_name(doc,attr);
3154 char *val = qs_get_attr_value(doc,attr);
3155 if (STRCASEEQ('a','A',"align", nm)) {
3156 /*----------------------------------------------------------------------*/
3157 /* CHTML 1.0 (W3C version 3.2) */
3158 /*----------------------------------------------------------------------*/
3159 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3160 attr_align = apr_pstrdup(doc->buf.pool, val);
3164 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3165 attr_style = apr_pstrdup(doc->buf.pool, val);
3168 if (IS_CSS_ON(jxhtml->entryp)) {
3169 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3171 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3172 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3173 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3174 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3175 css_property_t *cur;
3176 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3177 if (STRCASEEQ('l','L',"left",cur->value)) {
3178 attr_align = apr_pstrdup(doc->pool, "left");
3180 else if (STRCASEEQ('c','C',"center",cur->value)) {
3181 attr_align = apr_pstrdup(doc->pool, "center");
3183 else if (STRCASEEQ('r','R',"right",cur->value)) {
3184 attr_align = apr_pstrdup(doc->pool, "right");
3187 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3188 if (cur->value && *cur->value) {
3189 attr_color = apr_pstrdup(doc->pool, cur->value);
3192 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3193 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3194 attr_blink = apr_pstrdup(doc->pool, cur->value);
3197 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3198 css_clear = apr_pstrdup(doc->pool, cur->value);
3203 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3211 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3217 W_L("text-decoration:");
3234 * It is a handler who processes the P tag.
3236 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3237 * destination is specified.
3238 * @param node [i] The P tag node is specified.
3239 * @return The conversion result is returned.
3242 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
3244 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3245 Doc *doc = jxhtml->doc;
3248 if (IS_CSS_ON(jxhtml->entryp)) {
3249 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3256 * It is a handler who processes the PRE tag.
3258 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3259 * destination is specified.
3260 * @param node [i] The PRE tag node is specified.
3261 * @return The conversion result is returned.
3264 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3266 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3267 Doc *doc = jxhtml->doc;
3269 char *attr_style = NULL;
3270 char *css_clear = NULL;
3272 for (attr = qs_get_attr(doc,node);
3274 attr = qs_get_next_attr(doc,attr)) {
3275 char *nm = qs_get_attr_name(doc,attr);
3276 char *val = qs_get_attr_value(doc,attr);
3277 if (val && STRCASEEQ('s','S',"style", nm)) {
3282 if (IS_CSS_ON(jxhtml->entryp)) {
3283 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3285 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3287 css_property_t *cur;
3288 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3289 css_clear = apr_pstrdup(doc->pool, cur->value);
3309 * It is a handler who processes the PRE tag.
3311 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3312 * destination is specified.
3313 * @param node [i] The PRE tag node is specified.
3314 * @return The conversion result is returned.
3317 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3319 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3320 Doc *doc = jxhtml->doc;
3324 if (IS_CSS_ON(jxhtml->entryp)) {
3325 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3333 * It is a handler who processes the UL tag.
3335 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3336 * destination is specified.
3337 * @param node [i] The UL tag node is specified.
3338 * @return The conversion result is returned.
3341 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3343 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3344 Doc *doc = jxhtml->doc;
3346 char *attr_type = NULL;
3347 char *attr_style = NULL;
3348 char *css_clear = NULL;
3350 /*--------------------------------------------------------------------------*/
3351 /* Get Attributes */
3352 /*--------------------------------------------------------------------------*/
3353 for (attr = qs_get_attr(doc,node);
3355 attr = qs_get_next_attr(doc,attr)) {
3356 char *name = qs_get_attr_name(doc,attr);
3357 char *value = qs_get_attr_value(doc,attr);
3358 if (STRCASEEQ('t','T',"type",name)) {
3359 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3363 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3367 if (IS_CSS_ON(jxhtml->entryp)) {
3368 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3370 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3371 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3373 css_property_t *cur;
3374 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3375 if (STRCASEEQ('d','D',"disc",cur->value)) {
3376 attr_type = apr_pstrdup(doc->pool, "disc");
3378 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3379 attr_type = apr_pstrdup(doc->pool, "circle");
3381 else if (STRCASEEQ('s','S',"square",cur->value)) {
3382 attr_type = apr_pstrdup(doc->pool, "square");
3385 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3386 css_clear = apr_pstrdup(doc->pool, cur->value);
3391 if (attr_type || css_clear) {
3394 W_L("list-style-type:");
3411 * It is a handler who processes the UL tag.
3413 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3414 * destination is specified.
3415 * @param node [i] The UL tag node is specified.
3416 * @return The conversion result is returned.
3419 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3421 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3422 Doc *doc = jxhtml->doc;
3425 if (IS_CSS_ON(jxhtml->entryp)) {
3426 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3433 * It is a handler who processes the HR tag.
3435 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3436 * destination is specified.
3437 * @param node [i] The HR tag node is specified.
3438 * @return The conversion result is returned.
3441 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3447 char *attr_align = NULL;
3448 char *attr_size = NULL;
3449 char *attr_width = NULL;
3450 char *attr_noshade = NULL;
3451 char *attr_style = NULL;
3452 char *attr_color = NULL;
3454 char *style_float = NULL;
3455 char *style_border_color = NULL;
3456 char *css_clear = NULL;
3458 jxhtml = GET_JXHTML(pdoc);
3462 for (attr = qs_get_attr(doc,node);
3464 attr = qs_get_next_attr(doc,attr)) {
3465 char *name = qs_get_attr_name (doc,attr);
3466 char *value = qs_get_attr_value(doc,attr);
3470 if (strcasecmp(name, "align") == 0) {
3471 /*--------------------------------------------------------------------*/
3473 /*--------------------------------------------------------------------*/
3474 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3482 if (strcasecmp(name, "size") == 0) {
3483 /*--------------------------------------------------------------------*/
3485 /*--------------------------------------------------------------------*/
3486 if (value && *value) {
3490 else if (strcasecmp(name, "style") == 0) {
3491 if (value && *value) {
3499 if (strcasecmp(name, "width") == 0) {
3500 /*--------------------------------------------------------------------*/
3502 /*--------------------------------------------------------------------*/
3503 if (value && *value) {
3511 if (strcasecmp(name, "noshade") == 0) {
3512 /*--------------------------------------------------------------------*/
3514 /*--------------------------------------------------------------------*/
3515 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3521 if (strcasecmp(name, "color") == 0 && value && *value) {
3522 /*--------------------------------------------------------------------*/
3524 /*--------------------------------------------------------------------*/
3533 if (IS_CSS_ON(jxhtml->entryp)) {
3534 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3536 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3537 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3538 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3540 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3541 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3542 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3543 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3544 css_property_t *cur;
3546 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3547 if (STRCASEEQ('s','S',"solid",cur->value)) {
3548 attr_noshade = "noshade";
3551 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3552 attr_size = apr_pstrdup(doc->pool, cur->value);
3555 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3556 char *tmp = apr_pstrdup(doc->pool,cur->value);
3557 attr_color = apr_pstrdup(doc->pool,tmp);
3560 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3561 char *tmp = apr_pstrdup(doc->pool, cur->value);
3562 char *tmpp = strstr(tmp,"none");
3564 style_float = "center";
3567 style_float = apr_pstrdup(doc->pool,tmp);
3572 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3573 char *tmp = apr_pstrdup(doc->pool, cur->value);
3574 char *tmpp = strstr(tmp, "px");
3576 attr_width = apr_pstrdup(doc->pool, tmp);
3579 tmpp = strstr(tmp, "%");
3581 attr_width = apr_pstrdup(doc->pool, tmp);
3586 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3587 char *tmp = apr_pstrdup(doc->pool, cur->value);
3589 style_border_color = apr_pstrdup(doc->pool, tmp);
3592 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3593 css_clear = apr_pstrdup(doc->pool, cur->value);
3610 if (attr_size || attr_width || attr_noshade || style_border_color || css_clear) {
3615 if (chxj_chk_numeric(attr_size) == 0) {
3623 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3629 W_L("border-style:solid;");
3631 if(style_border_color){
3632 W_L("border-color:");
3633 W_V(style_border_color);
3656 * It is a handler who processes the HR tag.
3658 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3659 * destination is specified.
3660 * @param node [i] The HR tag node is specified.
3661 * @return The conversion result is returned.
3664 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3666 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3672 * It is a handler who processes the IMG tag.
3674 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3675 * destination is specified.
3676 * @param node [i] The IMG tag node is specified.
3677 * @return The conversion result is returned.
3680 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3682 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3683 Doc *doc = jxhtml->doc;
3684 request_rec *r = doc->r;
3686 char *attr_src = NULL;
3687 char *attr_height = NULL;
3688 char *attr_width = NULL;
3689 char *attr_alt = NULL;
3690 char *attr_style = NULL;
3691 char *attr_hspace = NULL;
3692 char *attr_vspace = NULL;
3694 char *css_float = NULL;
3695 char *css_margin_left = NULL;
3696 char *css_margin_right = NULL;
3697 char *css_margin_top = NULL;
3698 char *css_margin_bottom = NULL;
3699 char *css_display = NULL;
3700 char *css_valign = NULL;
3702 #ifndef IMG_NOT_CONVERT_FILENAME
3703 device_table *spec = jxhtml->spec;
3706 /*--------------------------------------------------------------------------*/
3707 /* Get Attributes */
3708 /*--------------------------------------------------------------------------*/
3709 for (attr = qs_get_attr(doc,node);
3711 attr = qs_get_next_attr(doc,attr)) {
3712 char *name = qs_get_attr_name(doc,attr);
3713 char *value = qs_get_attr_value(doc,attr);
3714 if (STRCASEEQ('s','S',"src",name)) {
3715 /*----------------------------------------------------------------------*/
3717 /*----------------------------------------------------------------------*/
3718 #ifdef IMG_NOT_CONVERT_FILENAME
3719 value = chxj_encoding_parameter(r, value, 1);
3720 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3721 value = chxj_add_cookie_no_update_parameter(r, value, 1);
3722 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3725 value = chxj_img_conv(r, spec, value);
3726 value = chxj_encoding_parameter(r, value, 1);
3727 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3728 value = chxj_add_cookie_no_update_parameter(r, value, 1);
3729 value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
3733 else if (STRCASEEQ('a','A',"align",name)) {
3734 /*----------------------------------------------------------------------*/
3736 /*----------------------------------------------------------------------*/
3738 if (STRCASEEQ('t','T',"top", value) ||
3739 STRCASEEQ('m','M',"middle",value) ||
3740 STRCASEEQ('b','B',"bottom",value)){
3742 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3745 else if (STRCASEEQ('c','C',"center",value)) {
3746 css_valign = apr_pstrdup(doc->pool, "middle");
3750 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3751 /*----------------------------------------------------------------------*/
3753 /*----------------------------------------------------------------------*/
3756 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3757 /*----------------------------------------------------------------------*/
3759 /*----------------------------------------------------------------------*/
3760 attr_height = value;
3762 else if (STRCASEEQ('h','H',"hspace",name)) {
3763 /*----------------------------------------------------------------------*/
3765 /*----------------------------------------------------------------------*/
3766 attr_hspace = value;
3768 else if (STRCASEEQ('v','V',"vspace",name)) {
3769 /*----------------------------------------------------------------------*/
3771 /*----------------------------------------------------------------------*/
3772 attr_vspace = value;
3774 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3775 /*----------------------------------------------------------------------*/
3777 /*----------------------------------------------------------------------*/
3780 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3781 /*----------------------------------------------------------------------*/
3783 /*----------------------------------------------------------------------*/
3788 if (IS_CSS_ON(jxhtml->entryp)) {
3789 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3791 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3792 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3793 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3794 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3795 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3796 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3797 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3800 css_property_t *cur;
3801 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3802 attr_height = apr_pstrdup(doc->pool, cur->value);
3804 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3805 attr_width = apr_pstrdup(doc->pool, cur->value);
3808 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3809 css_valign = apr_pstrdup(doc->pool, cur->value);
3812 if (! attr_hspace) {
3813 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3814 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3816 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3817 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3820 if (! attr_vspace) {
3821 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3822 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3824 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3825 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3829 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3830 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3831 css_float = apr_pstrdup(doc->pool, cur->value);
3835 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3836 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3837 char *tmp = apr_pstrdup(doc->pool, cur->value);
3838 char *tmpp = strstr(tmp, "none");
3840 css_display = apr_pstrdup(doc->pool, tmp);
3852 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3860 W_L("vertical-align:");
3865 W_L("margin-left:");
3868 W_L("margin-right:");
3873 if(css_margin_left){
3874 W_L("margin-left:");
3875 W_V(css_margin_left);
3878 if(css_margin_right){
3879 W_L("margin-right:");
3880 W_V(css_margin_right);
3888 W_L("margin-bottom:");
3895 W_V(css_margin_top);
3898 if(css_margin_bottom){
3899 W_L("margin-bottom:");
3900 W_V(css_margin_bottom);
3905 W_L("display:none;");
3934 * It is a handler who processes the IMG tag.
3936 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3937 * destination is specified.
3938 * @param node [i] The IMG tag node is specified.
3939 * @return The conversion result is returned.
3942 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3944 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3950 * It is a handler who processes the SELECT tag.
3952 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3953 * destination is specified.
3954 * @param node [i] The SELECT tag node is specified.
3955 * @return The conversion result is returned.
3958 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3960 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3961 Doc *doc = jxhtml->doc;
3965 char *multiple = NULL;
3966 char *attr_style = NULL;
3969 for (attr = qs_get_attr(doc,node);
3971 attr = qs_get_next_attr(doc,attr)) {
3972 char *nm = qs_get_attr_name(doc,attr);
3973 char *val = qs_get_attr_value(doc,attr);
3974 if (STRCASEEQ('s','S',"size",nm)) {
3975 /*----------------------------------------------------------------------*/
3976 /* CHTML 1.0 version 2.0 */
3977 /*----------------------------------------------------------------------*/
3978 size = apr_pstrdup(doc->buf.pool, val);
3980 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3981 /*----------------------------------------------------------------------*/
3982 /* CHTML 1.0 version 2.0 */
3983 /*----------------------------------------------------------------------*/
3984 attr_style = apr_pstrdup(doc->buf.pool, val);
3986 else if (STRCASEEQ('n','N',"name",nm)) {
3987 /*----------------------------------------------------------------------*/
3988 /* CHTML 1.0 version 2.0 */
3989 /*----------------------------------------------------------------------*/
3990 name = apr_pstrdup(doc->buf.pool, val);
3992 else if (STRCASEEQ('m','M',"multiple", nm)) {
3993 /*----------------------------------------------------------------------*/
3994 /* CHTML 1.0 version 2.0 */
3995 /*----------------------------------------------------------------------*/
3996 multiple = apr_pstrdup(doc->buf.pool, val);
3999 if (size && *size) {
4004 if (name && *name) {
4014 if (IS_CSS_ON(jxhtml->entryp)) {
4015 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4023 * It is a handler who processes the SELECT tag.
4025 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4026 * destination is specified.
4027 * @param node [i] The SELECT tag node is specified.
4028 * @return The conversion result is returned.
4031 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
4033 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4034 Doc *doc = jxhtml->doc;
4037 if (IS_CSS_ON(jxhtml->entryp)) {
4038 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4045 * It is a handler who processes the OPTION tag.
4047 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4048 * destination is specified.
4049 * @param node [i] The OPTION tag node is specified.
4050 * @return The conversion result is returned.
4053 s_jxhtml_start_option_tag(void *pdoc, Node *node)
4055 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4056 Doc *doc = jxhtml->doc;
4059 char *selected = NULL;
4061 char *attr_style = NULL;
4064 for (attr = qs_get_attr(doc,node);
4066 attr = qs_get_next_attr(doc,attr)) {
4067 char *nm = qs_get_attr_name(doc,attr);
4068 char *val = qs_get_attr_value(doc,attr);
4069 if (STRCASEEQ('s','S',"selected",nm)) {
4070 /*----------------------------------------------------------------------*/
4071 /* CHTML 1.0 version 2.0 */
4072 /*----------------------------------------------------------------------*/
4073 selected = apr_pstrdup(doc->buf.pool, val);
4075 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4076 /*----------------------------------------------------------------------*/
4077 /* CHTML 1.0 version 2.0 */
4078 /*----------------------------------------------------------------------*/
4079 attr_style = apr_pstrdup(doc->buf.pool, val);
4081 else if (STRCASEEQ('v','V',"value",nm)) {
4082 /*----------------------------------------------------------------------*/
4083 /* CHTML 1.0 version 2.0 */
4084 /*----------------------------------------------------------------------*/
4085 value = apr_pstrdup(doc->buf.pool, val);
4098 if (IS_CSS_ON(jxhtml->entryp)) {
4099 s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4107 * It is a handler who processes the OPTION tag.
4109 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4110 * destination is specified.
4111 * @param node [i] The OPTION tag node is specified.
4112 * @return The conversion result is returned.
4115 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
4117 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4118 Doc *doc = jxhtml->doc;
4121 if (IS_CSS_ON(jxhtml->entryp)) {
4122 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4130 * It is a handler who processes the DIV tag.
4132 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4133 * destination is specified.
4134 * @param node [i] The DIV tag node is specified.
4135 * @return The conversion result is returned.
4138 s_jxhtml_start_div_tag(void *pdoc, Node *node)
4144 char *attr_style = NULL;
4145 char *attr_align = NULL;
4146 char *attr_display = NULL;
4147 char *attr_decoration = NULL;
4148 char *attr_wap_marquee_style = NULL;
4149 char *attr_wap_marquee_dir = NULL;
4150 char *attr_wap_marquee_loop = NULL;
4151 char *attr_color = NULL;
4152 char *attr_bgcolor = NULL;
4153 char *attr_font_size = NULL;
4154 char *css_clear = NULL;
4156 jxhtml = GET_JXHTML(pdoc);
4160 for (attr = qs_get_attr(doc,node);
4162 attr = qs_get_next_attr(doc,attr)) {
4163 char *nm = qs_get_attr_name(doc,attr);
4164 char *val = qs_get_attr_value(doc,attr);
4165 if (STRCASEEQ('a','A',"align",nm)) {
4166 /*----------------------------------------------------------------------*/
4167 /* CHTML 1.0 (W3C version 3.2) */
4168 /*----------------------------------------------------------------------*/
4169 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4170 attr_align = apr_pstrdup(doc->buf.pool, val);
4173 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4174 attr_style = apr_pstrdup(doc->buf.pool, val);
4178 if (IS_CSS_ON(jxhtml->entryp)) {
4179 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4181 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4182 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4183 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4184 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4185 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4186 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4187 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4188 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4190 css_property_t *cur;
4191 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4192 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4193 attr_display = apr_pstrdup(doc->pool, cur->value);
4196 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4197 if (STRCASEEQ('b','B',"blink", cur->value)) {
4198 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4201 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4202 attr_color = apr_pstrdup(doc->pool, cur->value);
4204 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4205 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4206 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4208 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4209 char *ss = strchr(cur->value, '#');
4211 ss = strstr(cur->value, "rgb");
4214 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4215 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4218 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4219 attr_align = apr_pstrdup(doc->pool, cur->value);
4221 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4222 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4223 || STRCASEEQ('x','X',"x-small",cur->value)
4224 || STRCASEEQ('s','S',"small",cur->value)
4225 || STRCASEEQ('m','M',"medium",cur->value)
4226 || STRCASEEQ('l','L',"large",cur->value)
4227 || STRCASEEQ('x','X',"x-large",cur->value)
4228 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4229 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4233 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4234 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4235 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4236 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4237 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4238 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4241 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4242 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4243 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4245 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4246 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4249 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4250 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4251 attr_wap_marquee_loop = "infinite";
4254 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4258 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4259 css_clear = apr_pstrdup(doc->pool, cur->value);
4267 || attr_wap_marquee_style
4268 || attr_wap_marquee_dir
4269 || attr_wap_marquee_loop
4285 if (attr_decoration) {
4286 W_L("text-decoration:");
4287 W_V(attr_decoration);
4290 if (attr_wap_marquee_style) {
4291 W_L("-wap-marquee-style:");
4292 W_V(attr_wap_marquee_style);
4295 if (attr_wap_marquee_dir) {
4296 W_L("-wap-marquee-dir:");
4297 W_V(attr_wap_marquee_dir);
4300 if (attr_wap_marquee_loop) {
4301 W_L("-wap-marquee-loop:");
4302 W_V(attr_wap_marquee_loop);
4311 W_L("background-color:");
4315 if (attr_font_size) {
4317 W_V(attr_font_size);
4333 * It is a handler who processes the DIV tag.
4335 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4336 * destination is specified.
4337 * @param node [i] The DIV tag node is specified.
4338 * @return The conversion result is returned.
4341 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4347 jxhtml = GET_JXHTML(pdoc);
4352 if (IS_CSS_ON(jxhtml->entryp)) {
4353 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4360 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4367 jxhtml = GET_JXHTML(pdoc);
4371 for (child = qs_get_child_node(doc, node);
4373 child = qs_get_next_node(doc, child)) {
4375 s_jxhtml_chxjif_tag(jxhtml, child);
4382 * It is a handler who processes the TEXTARE tag.
4384 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4385 * destination is specified.
4386 * @param node [i] The TEXTAREA tag node is specified.
4387 * @return The conversion result is returned.
4390 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4396 char *attr_accesskey = NULL;
4397 char *attr_name = NULL;
4398 char *attr_rows = NULL;
4399 char *attr_cols = NULL;
4400 char *attr_istyle = NULL;
4401 char *attr_style = NULL;
4404 jxhtml = GET_JXHTML(pdoc);
4408 jxhtml->textarea_flag++;
4409 for (attr = qs_get_attr(doc,node);
4411 attr = qs_get_next_attr(doc,attr)) {
4412 char *name = qs_get_attr_name(doc,attr);
4413 char *value = qs_get_attr_value(doc,attr);
4414 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4415 attr_accesskey = value;
4417 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4418 attr_istyle = value;
4420 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4423 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4426 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4429 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4433 if (IS_CSS_ON(jxhtml->entryp)) {
4434 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4436 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4437 css_property_t *cur;
4438 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4439 if (strcasestr(cur->value, "<ja:n>")) {
4442 else if (strcasestr(cur->value, "<ja:en>")) {
4445 else if (strcasestr(cur->value, "<ja:hk>")) {
4448 else if (strcasestr(cur->value, "<ja:h>")) {
4455 if (attr_accesskey) {
4456 W_L(" accesskey=\"");
4457 W_V(attr_accesskey);
4480 char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
4482 W_L("-wap-input-format:");
4494 * It is a handler who processes the TEXTAREA tag.
4496 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4497 * destination is specified.
4498 * @param node [i] The TEXTAREA tag node is specified.
4499 * @return The conversion result is returned.
4502 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4508 jxhtml = GET_JXHTML(pdoc);
4513 jxhtml->textarea_flag--;
4520 * It is a handler who processes the B tag.
4522 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4523 * destination is specified.
4524 * @param node [i] The B tag node is specified.
4525 * @return The conversion result is returned.
4528 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4534 jxhtml = GET_JXHTML(pdoc);
4544 * It is a handler who processes the B tag.
4546 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4547 * destination is specified.
4548 * @param node [i] The B tag node is specified.
4549 * @return The conversion result is returned.
4552 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4554 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4555 Doc* doc = jxhtml->doc;
4562 s_jxhtml_text_tag(void* pdoc, Node* child)
4573 apr_size_t z2h_input_len;
4575 jxhtml = GET_JXHTML(pdoc);
4579 textval = qs_get_node_value(doc,child);
4580 if (strlen(textval) == 0) {
4584 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4585 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4587 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4588 memset(one_byte, 0, sizeof(one_byte));
4591 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4593 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4595 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4600 if (is_sjis_kanji(textval[ii])) {
4601 one_byte[0] = textval[ii+0];
4602 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4603 one_byte[0] = textval[ii+1];
4604 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4608 if (jxhtml->pre_flag) {
4609 one_byte[0] = textval[ii+0];
4610 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4613 if (jxhtml->textarea_flag) {
4614 one_byte[0] = textval[ii+0];
4615 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4618 if (textval[ii] != '\r' && textval[ii] != '\n') {
4619 one_byte[0] = textval[ii+0];
4620 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4624 z2h_input_len = strlen(tdst);
4625 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4633 * It is a handler who processes the BLOCKQUOTE tag.
4635 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4636 * destination is specified.
4637 * @param node [i] The BLOCKQUOTE tag node is specified.
4638 * @return The conversion result is returned.
4641 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4646 char *attr_style = NULL;
4647 char *attr_color = NULL;
4648 char *attr_size = NULL;
4649 char *css_clear = NULL;
4651 jxhtml = GET_JXHTML(pdoc);
4653 for (attr = qs_get_attr(doc,node);
4655 attr = qs_get_next_attr(doc,attr)) {
4656 char *nm = qs_get_attr_name(doc,attr);
4657 char *val = qs_get_attr_value(doc,attr);
4658 if (val && STRCASEEQ('s','S',"style", nm)) {
4662 if (IS_CSS_ON(jxhtml->entryp)) {
4663 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4665 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4666 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4667 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4669 css_property_t *cur;
4670 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4671 if (cur->value && *cur->value) {
4672 attr_color = apr_pstrdup(doc->pool, cur->value);
4675 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4676 if (cur->value && *cur->value) {
4677 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4678 attr_size = apr_pstrdup(doc->pool, cur->value);
4680 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4681 attr_size = apr_pstrdup(doc->pool, cur->value);
4683 else if (STRCASEEQ('s','S',"small",cur->value)) {
4684 attr_size = apr_pstrdup(doc->pool, cur->value);
4686 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4687 attr_size = apr_pstrdup(doc->pool, cur->value);
4689 else if (STRCASEEQ('l','L',"large",cur->value)) {
4690 attr_size = apr_pstrdup(doc->pool, cur->value);
4692 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4693 attr_size = apr_pstrdup(doc->pool, cur->value);
4695 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4696 attr_size = apr_pstrdup(doc->pool, cur->value);
4700 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4701 css_clear = apr_pstrdup(doc->pool, cur->value);
4706 if (attr_color || attr_size || css_clear) {
4709 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4732 * It is a handler who processes the BLOCKQUOTE tag.
4734 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4735 * destination is specified.
4736 * @param node [i] The BLOCKQUOTE tag node is specified.
4737 * @return The conversion result is returned.
4740 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4742 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4743 Doc *doc = jxhtml->doc;
4744 W_L("</blockquote>");
4745 if (IS_CSS_ON(jxhtml->entryp)) {
4746 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4753 * It is a handler who processes the DIR tag.
4755 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4756 * destination is specified.
4757 * @param node [i] The DIR tag node is specified.
4758 * @return The conversion result is returned.
4761 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4763 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4764 Doc *doc = jxhtml->doc;
4766 char *attr_style = NULL;
4767 char *attr_color = NULL;
4768 char *attr_type = NULL;
4769 char *attr_size = NULL;
4770 for (attr = qs_get_attr(doc,node);
4772 attr = qs_get_next_attr(doc,attr)) {
4773 char *name = qs_get_attr_name(doc,attr);
4774 char *value = qs_get_attr_value(doc,attr);
4775 if (STRCASEEQ('t','T',"type",name)) {
4776 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4780 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4784 if (IS_CSS_ON(jxhtml->entryp)) {
4785 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4787 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4788 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4789 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4790 css_property_t *cur;
4791 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4792 if (cur->value && *cur->value) {
4793 attr_color = apr_pstrdup(doc->pool, cur->value);
4796 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4797 if (cur->value && *cur->value) {
4798 attr_type = apr_pstrdup(doc->pool, cur->value);
4801 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4802 if (cur->value && *cur->value) {
4803 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4804 attr_size = apr_pstrdup(doc->pool, cur->value);
4806 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4807 attr_size = apr_pstrdup(doc->pool, cur->value);
4809 else if (STRCASEEQ('s','S',"small",cur->value)) {
4810 attr_size = apr_pstrdup(doc->pool, cur->value);
4812 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4813 attr_size = apr_pstrdup(doc->pool, cur->value);
4815 else if (STRCASEEQ('l','L',"large",cur->value)) {
4816 attr_size = apr_pstrdup(doc->pool, cur->value);
4818 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4819 attr_size = apr_pstrdup(doc->pool, cur->value);
4821 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4822 attr_size = apr_pstrdup(doc->pool, cur->value);
4829 if (attr_type || attr_color || attr_size) {
4832 W_L("list-style-type:");
4837 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4855 * It is a handler who processes the DIR tag.
4857 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4858 * destination is specified.
4859 * @param node [i] The DIR tag node is specified.
4860 * @return The conversion result is returned.
4863 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4865 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4866 Doc *doc = jxhtml->doc;
4868 if (IS_CSS_ON(jxhtml->entryp)) {
4869 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4876 * It is a handler who processes the DL tag.
4878 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4879 * destination is specified.
4880 * @param node [i] The DL tag node is specified.
4881 * @return The conversion result is returned.
4884 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4886 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4887 Doc *doc = jxhtml->doc;
4889 char *attr_style = NULL;
4890 char *attr_color = NULL;
4891 char *attr_size = NULL;
4892 char *css_clear = NULL;
4894 for (attr = qs_get_attr(doc,node);
4896 attr = qs_get_next_attr(doc,attr)) {
4897 char *name = qs_get_attr_name(doc,attr);
4898 char *value = qs_get_attr_value(doc,attr);
4899 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4903 if (IS_CSS_ON(jxhtml->entryp)) {
4904 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4906 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4907 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4908 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4910 css_property_t *cur;
4911 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4912 if (cur->value && *cur->value) {
4913 attr_color = apr_pstrdup(doc->pool, cur->value);
4916 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4917 if (cur->value && *cur->value) {
4918 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4919 attr_size = apr_pstrdup(doc->pool, cur->value);
4921 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4922 attr_size = apr_pstrdup(doc->pool, cur->value);
4924 else if (STRCASEEQ('s','S',"small",cur->value)) {
4925 attr_size = apr_pstrdup(doc->pool, cur->value);
4927 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4928 attr_size = apr_pstrdup(doc->pool, cur->value);
4930 else if (STRCASEEQ('l','L',"large",cur->value)) {
4931 attr_size = apr_pstrdup(doc->pool, cur->value);
4933 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4934 attr_size = apr_pstrdup(doc->pool, cur->value);
4936 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4937 attr_size = apr_pstrdup(doc->pool, cur->value);
4941 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4942 css_clear = apr_pstrdup(doc->pool, cur->value);
4947 if (attr_color || attr_size || css_clear) {
4950 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4973 * It is a handler who processes the DL tag.
4975 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4976 * destination is specified.
4977 * @param node [i] The DL tag node is specified.
4978 * @return The conversion result is returned.
4981 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4983 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4984 Doc *doc = jxhtml->doc;
4986 if (IS_CSS_ON(jxhtml->entryp)) {
4987 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4994 * It is a handler who processes the DT tag.
4996 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4997 * destination is specified.
4998 * @param node [i] The DT tag node is specified.
4999 * @return The conversion result is returned.
5002 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
5004 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5005 Doc *doc = jxhtml->doc;
5007 char *attr_style = NULL;
5008 char *attr_color = NULL;
5009 char *attr_size = NULL;
5010 for (attr = qs_get_attr(doc,node);
5012 attr = qs_get_next_attr(doc,attr)) {
5013 char *name = qs_get_attr_name(doc,attr);
5014 char *value = qs_get_attr_value(doc,attr);
5015 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5019 if (IS_CSS_ON(jxhtml->entryp)) {
5020 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5022 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5023 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5024 css_property_t *cur;
5025 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5026 if (cur->value && *cur->value) {
5027 attr_color = apr_pstrdup(doc->pool, cur->value);
5030 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5031 if (cur->value && *cur->value) {
5032 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5033 attr_size = apr_pstrdup(doc->pool, cur->value);
5035 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5036 attr_size = apr_pstrdup(doc->pool, cur->value);
5038 else if (STRCASEEQ('s','S',"small",cur->value)) {
5039 attr_size = apr_pstrdup(doc->pool, cur->value);
5041 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5042 attr_size = apr_pstrdup(doc->pool, cur->value);
5044 else if (STRCASEEQ('l','L',"large",cur->value)) {
5045 attr_size = apr_pstrdup(doc->pool, cur->value);
5047 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5048 attr_size = apr_pstrdup(doc->pool, cur->value);
5050 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5051 attr_size = apr_pstrdup(doc->pool, cur->value);
5058 if (attr_color || attr_size) {
5061 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5079 * It is a handler who processes the DT tag.
5081 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5082 * destination is specified.
5083 * @param node [i] The DT tag node is specified.
5084 * @return The conversion result is returned.
5087 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
5089 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5090 Doc *doc = jxhtml->doc;
5092 if (IS_CSS_ON(jxhtml->entryp)) {
5093 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5100 * It is a handler who processes the DD tag.
5102 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5103 * destination is specified.
5104 * @param node [i] The DD tag node is specified.
5105 * @return The conversion result is returned.
5108 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
5110 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5111 Doc *doc = jxhtml->doc;
5113 char *attr_style = NULL;
5114 char *attr_color = NULL;
5115 char *attr_size = NULL;
5116 for (attr = qs_get_attr(doc,node);
5118 attr = qs_get_next_attr(doc,attr)) {
5119 char *name = qs_get_attr_name(doc,attr);
5120 char *value = qs_get_attr_value(doc,attr);
5121 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5125 if (IS_CSS_ON(jxhtml->entryp)) {
5126 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5128 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5129 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5130 css_property_t *cur;
5131 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5132 if (cur->value && *cur->value) {
5133 attr_color = apr_pstrdup(doc->pool, cur->value);
5136 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5137 if (cur->value && *cur->value) {
5138 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5139 attr_size = apr_pstrdup(doc->pool, cur->value);
5141 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5142 attr_size = apr_pstrdup(doc->pool, cur->value);
5144 else if (STRCASEEQ('s','S',"small",cur->value)) {
5145 attr_size = apr_pstrdup(doc->pool, cur->value);
5147 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5148 attr_size = apr_pstrdup(doc->pool, cur->value);
5150 else if (STRCASEEQ('l','L',"large",cur->value)) {
5151 attr_size = apr_pstrdup(doc->pool, cur->value);
5153 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5154 attr_size = apr_pstrdup(doc->pool, cur->value);
5156 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5157 attr_size = apr_pstrdup(doc->pool, cur->value);
5164 if (attr_color || attr_size) {
5167 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5185 * It is a handler who processes the DD tag.
5187 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5188 * destination is specified.
5189 * @param node [i] The DD tag node is specified.
5190 * @return The conversion result is returned.
5193 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
5195 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5196 Doc *doc = jxhtml->doc;
5198 if (IS_CSS_ON(jxhtml->entryp)) {
5199 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5206 * It is a handler who processes the H1 tag.
5208 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5209 * destination is specified.
5210 * @param node [i] The H1 tag node is specified.
5211 * @return The conversion result is returned.
5214 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
5220 char *attr_style = NULL;
5221 char *attr_align = NULL;
5222 char *css_clear = NULL;
5224 jxhtml = GET_JXHTML(pdoc);
5228 for (attr = qs_get_attr(doc,node);
5230 attr = qs_get_next_attr(doc,attr)) {
5231 char *name = qs_get_attr_name(doc,attr);
5232 char *value = qs_get_attr_value(doc,attr);
5233 if (STRCASEEQ('a','A',"align", name)) {
5234 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5238 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5242 if (IS_CSS_ON(jxhtml->entryp)) {
5243 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5245 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5246 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5247 css_property_t *cur;
5248 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5249 if (STRCASEEQ('l','L',"left", cur->value)) {
5250 attr_align = apr_pstrdup(doc->pool, "left");
5252 else if (STRCASEEQ('c','C',"center",cur->value)) {
5253 attr_align = apr_pstrdup(doc->pool, "center");
5255 else if (STRCASEEQ('r','R',"right",cur->value)) {
5256 attr_align = apr_pstrdup(doc->pool, "right");
5259 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5260 if (STRCASEEQ('b','B',"both", cur->value)) {
5261 css_clear = apr_pstrdup(doc->pool, "both");
5263 else if (STRCASEEQ('r','R',"right", cur->value)) {
5264 css_clear = apr_pstrdup(doc->pool, "right");
5266 else if (STRCASEEQ('l','L',"left", cur->value)) {
5267 css_clear = apr_pstrdup(doc->pool, "left");
5273 if (attr_align || css_clear ) {
5294 * It is a handler who processes the H1 tag.
5296 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5297 * destination is specified.
5298 * @param node [i] The H1 tag node is specified.
5299 * @return The conversion result is returned.
5302 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
5308 jxhtml = GET_JXHTML(pdoc);
5313 if (IS_CSS_ON(jxhtml->entryp)) {
5314 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5322 * It is a handler who processes the H2 tag.
5324 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5325 * destination is specified.
5326 * @param node [i] The H1 tag node is specified.
5327 * @return The conversion result is returned.
5330 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5336 char *attr_style = NULL;
5337 char *attr_align = NULL;
5338 char *css_clear = NULL;
5340 jxhtml = GET_JXHTML(pdoc);
5344 for (attr = qs_get_attr(doc,node);
5346 attr = qs_get_next_attr(doc,attr)) {
5347 char *name = qs_get_attr_name(doc,attr);
5348 char *value = qs_get_attr_value(doc,attr);
5349 if (STRCASEEQ('a','A',"align", name)) {
5350 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5354 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5358 if (IS_CSS_ON(jxhtml->entryp)) {
5359 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5361 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5362 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5363 css_property_t *cur;
5364 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5365 if (STRCASEEQ('l','L',"left", cur->value)) {
5366 attr_align = apr_pstrdup(doc->pool, "left");
5368 else if (STRCASEEQ('c','C',"center",cur->value)) {
5369 attr_align = apr_pstrdup(doc->pool, "center");
5371 else if (STRCASEEQ('r','R',"right",cur->value)) {
5372 attr_align = apr_pstrdup(doc->pool, "right");
5375 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5376 if (STRCASEEQ('b','B',"both", cur->value)) {
5377 css_clear = apr_pstrdup(doc->pool, "both");
5379 else if (STRCASEEQ('r','R',"right", cur->value)) {
5380 css_clear = apr_pstrdup(doc->pool, "right");
5382 else if (STRCASEEQ('l','L',"left", cur->value)) {
5383 css_clear = apr_pstrdup(doc->pool, "left");
5389 if (attr_align || css_clear ) {
5410 * It is a handler who processes the H2 tag.
5412 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5413 * destination is specified.
5414 * @param node [i] The H1 tag node is specified.
5415 * @return The conversion result is returned.
5418 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5424 jxhtml = GET_JXHTML(pdoc);
5429 if (IS_CSS_ON(jxhtml->entryp)) {
5430 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5437 * It is a handler who processes the H3 tag.
5439 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5440 * destination is specified.
5441 * @param node [i] The H1 tag node is specified.
5442 * @return The conversion result is returned.
5445 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5451 char *attr_style = NULL;
5452 char *attr_align = NULL;
5453 char *css_clear = NULL;
5455 jxhtml = GET_JXHTML(pdoc);
5459 for (attr = qs_get_attr(doc,node);
5461 attr = qs_get_next_attr(doc,attr)) {
5462 char *name = qs_get_attr_name(doc,attr);
5463 char *value = qs_get_attr_value(doc,attr);
5464 if (STRCASEEQ('a','A',"align", name)) {
5465 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5469 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5473 if (IS_CSS_ON(jxhtml->entryp)) {
5474 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5476 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5477 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5478 css_property_t *cur;
5479 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5480 if (STRCASEEQ('l','L',"left", cur->value)) {
5481 attr_align = apr_pstrdup(doc->pool, "left");
5483 else if (STRCASEEQ('c','C',"center",cur->value)) {
5484 attr_align = apr_pstrdup(doc->pool, "center");
5486 else if (STRCASEEQ('r','R',"right",cur->value)) {
5487 attr_align = apr_pstrdup(doc->pool, "right");
5490 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5491 if (STRCASEEQ('b','B',"both", cur->value)) {
5492 css_clear = apr_pstrdup(doc->pool, "both");
5494 else if (STRCASEEQ('r','R',"right", cur->value)) {
5495 css_clear = apr_pstrdup(doc->pool, "right");
5497 else if (STRCASEEQ('l','L',"left", cur->value)) {
5498 css_clear = apr_pstrdup(doc->pool, "left");
5504 if (attr_align || css_clear ) {
5525 * It is a handler who processes the H3 tag.
5527 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5528 * destination is specified.
5529 * @param node [i] The H1 tag node is specified.
5530 * @return The conversion result is returned.
5533 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5539 jxhtml = GET_JXHTML(pdoc);
5544 if (IS_CSS_ON(jxhtml->entryp)) {
5545 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5552 * It is a handler who processes the H4 tag.
5554 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5555 * destination is specified.
5556 * @param node [i] The H1 tag node is specified.
5557 * @return The conversion result is returned.
5560 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5566 char *attr_style = NULL;
5567 char *attr_align = NULL;
5568 char *css_clear = NULL;
5570 jxhtml = GET_JXHTML(pdoc);
5574 for (attr = qs_get_attr(doc,node);
5576 attr = qs_get_next_attr(doc,attr)) {
5577 char *name = qs_get_attr_name(doc,attr);
5578 char *value = qs_get_attr_value(doc,attr);
5579 if (STRCASEEQ('a','A',"align", name)) {
5580 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5584 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5588 if (IS_CSS_ON(jxhtml->entryp)) {
5589 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5591 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5592 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5593 css_property_t *cur;
5594 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5595 if (STRCASEEQ('l','L',"left", cur->value)) {
5596 attr_align = apr_pstrdup(doc->pool, "left");
5598 else if (STRCASEEQ('c','C',"center",cur->value)) {
5599 attr_align = apr_pstrdup(doc->pool, "center");
5601 else if (STRCASEEQ('r','R',"right",cur->value)) {
5602 attr_align = apr_pstrdup(doc->pool, "right");
5605 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5606 if (STRCASEEQ('b','B',"both", cur->value)) {
5607 css_clear = apr_pstrdup(doc->pool, "both");
5609 else if (STRCASEEQ('r','R',"right", cur->value)) {
5610 css_clear = apr_pstrdup(doc->pool, "right");
5612 else if (STRCASEEQ('l','L',"left", cur->value)) {
5613 css_clear = apr_pstrdup(doc->pool, "left");
5619 if (attr_align || css_clear ) {
5640 * It is a handler who processes the H4 tag.
5642 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5643 * destination is specified.
5644 * @param node [i] The H1 tag node is specified.
5645 * @return The conversion result is returned.
5648 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5654 jxhtml = GET_JXHTML(pdoc);
5659 if (IS_CSS_ON(jxhtml->entryp)) {
5660 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5668 * It is a handler who processes the H5 tag.
5670 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5671 * destination is specified.
5672 * @param node [i] The H1 tag node is specified.
5673 * @return The conversion result is returned.
5676 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5682 char *attr_style = NULL;
5683 char *attr_align = NULL;
5684 char *css_clear = NULL;
5686 jxhtml = GET_JXHTML(pdoc);
5690 for (attr = qs_get_attr(doc,node);
5692 attr = qs_get_next_attr(doc,attr)) {
5693 char *name = qs_get_attr_name(doc,attr);
5694 char *value = qs_get_attr_value(doc,attr);
5695 if (STRCASEEQ('a','A',"align", name)) {
5696 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5700 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5704 if (IS_CSS_ON(jxhtml->entryp)) {
5705 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5707 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5708 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5709 css_property_t *cur;
5710 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5711 if (STRCASEEQ('l','L',"left", cur->value)) {
5712 attr_align = apr_pstrdup(doc->pool, "left");
5714 else if (STRCASEEQ('c','C',"center",cur->value)) {
5715 attr_align = apr_pstrdup(doc->pool, "center");
5717 else if (STRCASEEQ('r','R',"right",cur->value)) {
5718 attr_align = apr_pstrdup(doc->pool, "right");
5721 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5722 if (STRCASEEQ('b','B',"both", cur->value)) {
5723 css_clear = apr_pstrdup(doc->pool, "both");
5725 else if (STRCASEEQ('r','R',"right", cur->value)) {
5726 css_clear = apr_pstrdup(doc->pool, "right");
5728 else if (STRCASEEQ('l','L',"left", cur->value)) {
5729 css_clear = apr_pstrdup(doc->pool, "left");
5735 if (attr_align || css_clear ) {
5756 * It is a handler who processes the H5 tag.
5758 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5759 * destination is specified.
5760 * @param node [i] The H1 tag node is specified.
5761 * @return The conversion result is returned.
5764 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5770 jxhtml = GET_JXHTML(pdoc);
5775 if (IS_CSS_ON(jxhtml->entryp)) {
5776 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5784 * It is a handler who processes the H6 tag.
5786 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5787 * destination is specified.
5788 * @param node [i] The H1 tag node is specified.
5789 * @return The conversion result is returned.
5792 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5798 char *attr_style = NULL;
5799 char *attr_align = NULL;
5800 char *css_clear = NULL;
5802 jxhtml = GET_JXHTML(pdoc);
5806 for (attr = qs_get_attr(doc,node);
5808 attr = qs_get_next_attr(doc,attr)) {
5809 char *name = qs_get_attr_name(doc,attr);
5810 char *value = qs_get_attr_value(doc,attr);
5811 if (STRCASEEQ('a','A',"align", name)) {
5812 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5816 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5820 if (IS_CSS_ON(jxhtml->entryp)) {
5821 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5823 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5824 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5825 css_property_t *cur;
5826 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5827 if (STRCASEEQ('l','L',"left", cur->value)) {
5828 attr_align = apr_pstrdup(doc->pool, "left");
5830 else if (STRCASEEQ('c','C',"center",cur->value)) {
5831 attr_align = apr_pstrdup(doc->pool, "center");
5833 else if (STRCASEEQ('r','R',"right",cur->value)) {
5834 attr_align = apr_pstrdup(doc->pool, "right");
5837 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5838 if (STRCASEEQ('b','B',"both", cur->value)) {
5839 css_clear = apr_pstrdup(doc->pool, "both");
5841 else if (STRCASEEQ('r','R',"right", cur->value)) {
5842 css_clear = apr_pstrdup(doc->pool, "right");
5844 else if (STRCASEEQ('l','L',"left", cur->value)) {
5845 css_clear = apr_pstrdup(doc->pool, "left");
5851 if (attr_align || css_clear ) {
5872 * It is a handler who processes the H6 tag.
5874 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5875 * destination is specified.
5876 * @param node [i] The H1 tag node is specified.
5877 * @return The conversion result is returned.
5880 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5886 jxhtml = GET_JXHTML(pdoc);
5891 if (IS_CSS_ON(jxhtml->entryp)) {
5892 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5900 * It is a handler who processes the MENU tag.
5902 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5903 * destination is specified.
5904 * @param node [i] The MENU tag node is specified.
5905 * @return The conversion result is returned.
5908 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5910 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5911 Doc *doc = jxhtml->doc;
5913 char *attr_style = NULL;
5914 char *attr_color = NULL;
5915 char *attr_type = NULL;
5916 char *attr_size = NULL;
5917 for (attr = qs_get_attr(doc,node);
5919 attr = qs_get_next_attr(doc,attr)) {
5920 char *name = qs_get_attr_name(doc,attr);
5921 char *value = qs_get_attr_value(doc,attr);
5922 if (STRCASEEQ('t','T',"type",name)) {
5923 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5927 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5931 if (IS_CSS_ON(jxhtml->entryp)) {
5932 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
5934 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5935 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5936 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5937 css_property_t *cur;
5938 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5939 if (cur->value && *cur->value) {
5940 attr_color = apr_pstrdup(doc->pool, cur->value);
5943 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5944 if (cur->value && *cur->value) {
5945 attr_type = apr_pstrdup(doc->pool, cur->value);
5948 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5949 if (cur->value && *cur->value) {
5950 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5951 attr_size = apr_pstrdup(doc->pool, cur->value);
5953 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5954 attr_size = apr_pstrdup(doc->pool, cur->value);
5956 else if (STRCASEEQ('s','S',"small",cur->value)) {
5957 attr_size = apr_pstrdup(doc->pool, cur->value);
5959 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5960 attr_size = apr_pstrdup(doc->pool, cur->value);
5962 else if (STRCASEEQ('l','L',"large",cur->value)) {
5963 attr_size = apr_pstrdup(doc->pool, cur->value);
5965 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5966 attr_size = apr_pstrdup(doc->pool, cur->value);
5968 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5969 attr_size = apr_pstrdup(doc->pool, cur->value);
5976 if (attr_type || attr_color || attr_size) {
5979 W_L("list-style-type:");
5984 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6002 * It is a handler who processes the MENU tag.
6004 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6005 * destination is specified.
6006 * @param node [i] The MENU tag node is specified.
6007 * @return The conversion result is returned.
6010 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
6012 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6013 Doc *doc = jxhtml->doc;
6015 if (IS_CSS_ON(jxhtml->entryp)) {
6016 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6023 * It is a handler who processes the PLAINTEXT tag.
6025 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6026 * destination is specified.
6027 * @param node [i] The PLAINTEXT tag node is specified.
6028 * @return The conversion result is returned.
6031 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
6036 jxhtml = GET_JXHTML(pdoc);
6039 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
6044 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
6049 jxhtml = GET_JXHTML(pdoc);
6051 for (child = qs_get_child_node(doc, node);
6053 child = qs_get_next_node(doc, child)) {
6055 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
6062 * It is a handler who processes the PLAINTEXT tag.
6064 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6065 * destination is specified.
6066 * @param node [i] The PLAINTEXT tag node is specified.
6067 * @return The conversion result is returned.
6070 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6072 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6078 * It is a handler who processes the BLINK tag.
6080 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6081 * destination is specified.
6082 * @param node [i] The BLINK tag node is specified.
6083 * @return The conversion result is returned.
6086 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
6088 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6089 Doc *doc = jxhtml->doc;
6091 char *attr_style = NULL;
6092 char *attr_color = NULL;
6093 char *attr_size = NULL;
6094 for (attr = qs_get_attr(doc,node);
6096 attr = qs_get_next_attr(doc,attr)) {
6097 char *name = qs_get_attr_name(doc,attr);
6098 char *value = qs_get_attr_value(doc,attr);
6099 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6103 if (IS_CSS_ON(jxhtml->entryp)) {
6104 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6106 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6107 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6108 css_property_t *cur;
6109 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6110 if (cur->value && *cur->value) {
6111 attr_color = apr_pstrdup(doc->pool, cur->value);
6114 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6115 if (cur->value && *cur->value) {
6116 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6117 attr_size = apr_pstrdup(doc->pool, cur->value);
6119 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6120 attr_size = apr_pstrdup(doc->pool, cur->value);
6122 else if (STRCASEEQ('s','S',"small",cur->value)) {
6123 attr_size = apr_pstrdup(doc->pool, cur->value);
6125 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6126 attr_size = apr_pstrdup(doc->pool, cur->value);
6128 else if (STRCASEEQ('l','L',"large",cur->value)) {
6129 attr_size = apr_pstrdup(doc->pool, cur->value);
6131 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6132 attr_size = apr_pstrdup(doc->pool, cur->value);
6134 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6135 attr_size = apr_pstrdup(doc->pool, cur->value);
6142 if (attr_color || attr_size) {
6145 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6163 * It is a handler who processes the BLINK tag.
6165 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6166 * destination is specified.
6167 * @param node [i] The BLINK tag node is specified.
6168 * @return The conversion result is returned.
6171 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
6173 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6174 Doc *doc = jxhtml->doc;
6176 if (IS_CSS_ON(jxhtml->entryp)) {
6177 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6184 * It is a handler who processes the MARQUEE tag.
6186 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6187 * destination is specified.
6188 * @param node [i] The MARQUEE tag node is specified.
6189 * @return The conversion result is returned.
6192 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
6194 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6195 Doc *doc = jxhtml->doc;
6197 char *attr_direction = NULL;
6198 char *attr_style = NULL;
6199 char *attr_color = NULL;
6200 char *attr_size = NULL;
6201 char *attr_bgcolor = NULL;
6202 /*--------------------------------------------------------------------------*/
6203 /* Get Attributes */
6204 /*--------------------------------------------------------------------------*/
6205 for (attr = qs_get_attr(doc,node);
6207 attr = qs_get_next_attr(doc,attr)) {
6208 char *name = qs_get_attr_name(doc,attr);
6209 char *value = qs_get_attr_value(doc,attr);
6210 if (STRCASEEQ('d','D',"direction", name)) {
6212 if (STRCASEEQ('l','L',"left",value)) {
6213 attr_direction = "rtl";
6215 else if (STRCASEEQ('r','R',"right",value)) {
6216 attr_direction = "ltr";
6220 else if (STRCASEEQ('b','B',"behavior",name)) {
6223 else if (STRCASEEQ('l','L',"loop",name)) {
6226 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6227 if (value && *value) {
6228 attr_bgcolor = value;
6231 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6235 if (IS_CSS_ON(jxhtml->entryp)) {
6236 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6238 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6239 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6240 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6241 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6242 css_property_t *cur;
6243 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6244 if (cur->value && *cur->value) {
6245 attr_color = apr_pstrdup(doc->pool, cur->value);
6248 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6249 if (cur->value && *cur->value) {
6250 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6253 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6254 if (cur->value && *cur->value) {
6255 attr_direction = apr_pstrdup(doc->pool, cur->value);
6258 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6259 if (cur->value && *cur->value) {
6260 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6261 || STRCASEEQ('x','X',"x-small", cur->value)
6262 || STRCASEEQ('s','S',"small", cur->value)
6263 || STRCASEEQ('m','M',"medium", cur->value)
6264 || STRCASEEQ('l','L',"large", cur->value)
6265 || STRCASEEQ('x','X',"x-large", cur->value)
6266 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6267 attr_size = apr_pstrdup(doc->pool, cur->value);
6274 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6276 if (attr_direction) {
6277 W_L("-wap-marquee-dir:");
6278 W_V(attr_direction);
6282 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6283 W_L("background-color:");
6288 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6307 * It is a handler who processes the MARQUEE tag.
6309 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6310 * destination is specified.
6311 * @param node [i] The MARQUEE tag node is specified.
6312 * @return The conversion result is returned.
6315 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6317 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6318 Doc *doc = jxhtml->doc;
6320 if (IS_CSS_ON(jxhtml->entryp)) {
6321 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6328 * It is handler who processes the New Line Code.
6331 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6333 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6334 if (jxhtml->start_html_flag) {
6335 Doc *doc = jxhtml->doc;
6343 * It is a handler who processes the LINK tag.
6345 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6346 * destination is specified.
6347 * @param node [i] The LINK tag node is specified.
6348 * @return The conversion result is returned.
6351 s_jxhtml_link_tag(void *pdoc, Node *node)
6360 jxhtml = GET_JXHTML(pdoc);
6363 if (! IS_CSS_ON(jxhtml->entryp)) {
6367 for (attr = qs_get_attr(doc,node);
6369 attr = qs_get_next_attr(doc,attr)) {
6370 char *name = qs_get_attr_name(doc,attr);
6371 char *value = qs_get_attr_value(doc,attr);
6372 if (STRCASEEQ('r','R',"rel", name)) {
6373 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6377 else if (STRCASEEQ('h','H',"href", name)) {
6378 if (value && *value) {
6382 else if (STRCASEEQ('t','T',"type", name)) {
6383 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6389 if (rel && href && type) {
6390 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6391 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6392 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6399 static css_prop_list_t *
6400 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6402 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6403 Doc *doc = jxhtml->doc;
6404 css_prop_list_t *last_css = NULL;
6405 if (IS_CSS_ON(jxhtml->entryp)) {
6406 css_prop_list_t *dup_css;
6407 css_selector_t *selector;
6409 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6410 dup_css = chxj_dup_css_prop_list(doc, last_css);
6411 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6413 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6415 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6416 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6418 if (style_attr_value) {
6419 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));
6421 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6429 static css_prop_list_t *
6430 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6432 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6433 Doc *doc = jxhtml->doc;
6434 css_prop_list_t *last_css = NULL;
6435 if (IS_CSS_ON(jxhtml->entryp)) {
6436 css_prop_list_t *dup_css;
6437 css_selector_t *selector;
6439 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6440 dup_css = chxj_dup_css_prop_list(doc, last_css);
6441 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6443 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6447 if (style_attr_value) {
6448 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));
6450 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6459 * It is a handler who processes the SPAN tag.
6461 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6462 * destination is specified.
6463 * @param node [i] The SPAN tag node is specified.
6464 * @return The conversion result is returned.
6467 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6472 char *attr_style = NULL;
6473 char *attr_color = NULL;
6474 char *attr_size = NULL;
6475 char *attr_align = NULL;
6476 char *attr_blink = NULL;
6477 char *attr_marquee = NULL;
6478 char *attr_marquee_dir = NULL;
6479 char *attr_marquee_style = NULL;
6480 char *attr_marquee_loop = NULL;
6481 char *css_bgcolor = NULL;
6483 jxhtml = GET_JXHTML(pdoc);
6486 for (attr = qs_get_attr(doc,node);
6488 attr = qs_get_next_attr(doc,attr)) {
6489 char *nm = qs_get_attr_name(doc,attr);
6490 char *val = qs_get_attr_value(doc,attr);
6491 if (val && STRCASEEQ('s','S',"style", nm)) {
6495 if (IS_CSS_ON(jxhtml->entryp)) {
6496 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
6498 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6499 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6500 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6501 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6502 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6503 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6504 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6505 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6506 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6508 css_property_t *cur;
6509 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6510 attr_color = apr_pstrdup(doc->pool, cur->value);
6512 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6513 if (cur->value && *cur->value) {
6514 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6515 || STRCASEEQ('x','X',"x-small", cur->value)
6516 || STRCASEEQ('s','S',"small", cur->value)
6517 || STRCASEEQ('m','M',"medium", cur->value)
6518 || STRCASEEQ('l','L',"large", cur->value)
6519 || STRCASEEQ('x','X',"x-large", cur->value)
6520 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6521 attr_size = apr_pstrdup(doc->pool, cur->value);
6525 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6526 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6527 attr_blink = apr_pstrdup(doc->pool, cur->value);
6530 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6531 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6532 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6535 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6536 if (cur->value && *cur->value) {
6537 if ( STRCASEEQ('l','L',"ltr",cur->value)
6538 || STRCASEEQ('r','R',"rtl",cur->value)) {
6539 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6543 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6544 if (cur->value && *cur->value) {
6545 if ( STRCASEEQ('s','S',"scroll",cur->value)
6546 || STRCASEEQ('s','S',"slide",cur->value)
6547 || STRCASEEQ('a','A',"alternate",cur->value)) {
6548 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6552 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6553 if (cur->value && *cur->value) {
6554 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6555 attr_marquee_loop = "infinite";
6558 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6562 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6563 if (STRCASEEQ('l','L',"left", cur->value)) {
6564 attr_align = apr_pstrdup(doc->pool, "left");
6566 else if (STRCASEEQ('c','C',"center",cur->value)) {
6567 attr_align = apr_pstrdup(doc->pool, "center");
6569 else if (STRCASEEQ('r','R',"right",cur->value)) {
6570 attr_align = apr_pstrdup(doc->pool, "right");
6573 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6574 if (cur->value && *cur->value) {
6575 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6582 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6585 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6601 W_L("text-decoration:");
6606 W_L("display:-wap-marquee;");
6607 if (attr_marquee_dir) {
6608 W_L("-wap-marquee-dir:");
6609 W_V(attr_marquee_dir);
6612 if (attr_marquee_style) {
6613 W_L("-wap-marquee-style:");
6614 W_V(attr_marquee_style);
6617 if (attr_marquee_loop) {
6618 W_L("-wap-marquee-loop:");
6619 W_V(attr_marquee_loop);
6624 W_L("background-color:");
6636 * It is a handler who processes the SPAN tag.
6638 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6639 * destination is specified.
6640 * @param node [i] The SPAN tag node is specified.
6641 * @return The conversion result is returned.
6644 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6646 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6647 Doc *doc = jxhtml->doc;
6650 if (IS_CSS_ON(jxhtml->entryp)) {
6651 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6658 * It is a handler who processes the STYLE tag.
6660 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6661 * destination is specified.
6662 * @param node [i] The STYLE tag node is specified.
6663 * @return The conversion result is returned.
6666 s_jxhtml_style_tag(void *pdoc, Node *node)
6676 jxhtml = GET_JXHTML(pdoc);
6679 if (! IS_CSS_ON(jxhtml->entryp)) {
6683 for (attr = qs_get_attr(doc,node);
6685 attr = qs_get_next_attr(doc,attr)) {
6686 char *name = qs_get_attr_name(doc,attr);
6687 char *value = qs_get_attr_value(doc,attr);
6688 if (STRCASEEQ('t','T',"type", name)) {
6689 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6696 for (child = qs_get_child_node(doc, node);
6698 child = qs_get_next_node(doc, child)) {
6699 char *name = qs_get_node_name(doc, child);
6700 if (STRCASEEQ('t','T',"text", name)) {
6701 char *value = qs_get_node_value(doc, child);
6702 if (value && *value) {
6703 style = apr_pstrcat(doc->r->pool, style, value, NULL);
6707 if (strlen(style) > 0) {
6708 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
6709 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, style);
6710 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
6716 * It is a handler who processes the OBJECT tag.
6718 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6719 * destination is specified.
6720 * @param node [i] The OBJECT tag node is specified.
6721 * @return The conversion result is returned.
6724 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6726 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6727 Doc *doc = jxhtml->doc;
6730 char *attr_id = NULL;
6731 char *attr_width = NULL;
6732 char *attr_height = NULL;
6733 char *attr_data = NULL;
6734 char *attr_type = NULL;
6735 char *attr_declare = NULL;
6736 char *attr_classid = NULL;
6737 char *attr_codebase = NULL;
6739 /*--------------------------------------------------------------------------*/
6740 /* Get Attributes */
6741 /*--------------------------------------------------------------------------*/
6742 for (attr = qs_get_attr(doc,node);
6744 attr = qs_get_next_attr(doc,attr)) {
6745 char *name = qs_get_attr_name(doc,attr);
6746 char *value = qs_get_attr_value(doc,attr);
6747 if (STRCASEEQ('i','I',"id",name)) {
6748 attr_id = apr_pstrdup(doc->pool, value);
6750 else if (STRCASEEQ('w','W',"width",name)) {
6751 attr_width = apr_pstrdup(doc->pool, value);
6753 else if (STRCASEEQ('h','H',"height",name)) {
6754 attr_height = apr_pstrdup(doc->pool, value);
6756 else if (STRCASEEQ('d','D',"data",name)) {
6757 attr_data = apr_pstrdup(doc->pool, value);
6759 else if (STRCASEEQ('t','T',"type",name)) {
6760 attr_type = apr_pstrdup(doc->pool, value);
6762 else if (STRCASEEQ('d','D',"declare",name)) {
6763 attr_declare = apr_pstrdup(doc->pool, value);
6765 else if (STRCASEEQ('c','C',"classid",name)) {
6766 attr_classid = apr_pstrdup(doc->pool, value);
6768 else if (STRCASEEQ('c','C',"codebase",name)) {
6769 attr_codebase = apr_pstrdup(doc->pool, value);
6801 W_L(" declare=\"declare\"");
6809 W_L(" codebase=\"");
6818 * It is a handler who processes the OBJECT tag.
6820 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6821 * destination is specified.
6822 * @param node [i] The OBJECT tag node is specified.
6823 * @return The conversion result is returned.
6826 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6828 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6829 Doc *doc = jxhtml->doc;
6835 * It is a handler who processes the OBJECT tag.
6837 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6838 * destination is specified.
6839 * @param node [i] The OBJECT tag node is specified.
6840 * @return The conversion result is returned.
6843 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6845 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6846 Doc *doc = jxhtml->doc;
6849 char *attr_name = NULL;
6850 char *attr_value = NULL;
6851 char *attr_valuetype = NULL;
6853 /*--------------------------------------------------------------------------*/
6854 /* Get Attributes */
6855 /*--------------------------------------------------------------------------*/
6856 for (attr = qs_get_attr(doc,node);
6858 attr = qs_get_next_attr(doc,attr)) {
6859 char *name = qs_get_attr_name(doc,attr);
6860 char *value = qs_get_attr_value(doc,attr);
6861 if (STRCASEEQ('n','N',"name",name)) {
6862 attr_name = apr_pstrdup(doc->pool, value);
6864 else if (STRCASEEQ('v','V',"value",name)) {
6865 attr_value = apr_pstrdup(doc->pool, value);
6867 else if (STRCASEEQ('v','V',"valuetype",name)) {
6868 attr_valuetype = apr_pstrdup(doc->pool, value);
6884 W_L(" valuetype=\"");
6885 W_V(attr_valuetype);
6892 * It is a handler who processes the CAPTION tag.
6894 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6895 * destination is specified.
6896 * @param node [i] The CAPTION tag node is specified.
6897 * @return The conversion result is returned.
6900 s_jxhtml_start_caption_tag(void *pdoc, Node *node)
6906 char *attr_style = NULL;
6907 char *attr_align = NULL;
6909 jxhtml = GET_JXHTML(pdoc);
6913 for (attr = qs_get_attr(doc,node);
6915 attr = qs_get_next_attr(doc,attr)) {
6916 char *name = qs_get_attr_name(doc,attr);
6917 char *value = qs_get_attr_value(doc,attr);
6918 if (STRCASEEQ('a','A',"align", name)) {
6920 (STRCASEEQ('l','L',"left",value)
6921 || STRCASEEQ('r','R',"right",value)
6922 || STRCASEEQ('t','T',"top",value)
6923 || STRCASEEQ('b','B',"bottom",value)
6928 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6946 * It is a handler who processes the CAPTION tag.
6948 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6949 * destination is specified.
6950 * @param node [i] The CAPTION tag node is specified.
6951 * @return The conversion result is returned.
6954 s_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child))
6956 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
6957 Doc* doc = jxhtml->doc;