2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_jxhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_conv_z2h.h"
30 #define GET_JXHTML(X) ((jxhtml_t *)(X))
33 #define W_L(X) do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
34 #define W_V(X) do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X)) \
35 : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
39 static char *s_jxhtml_start_html_tag (void *pdoc, Node *node);
40 static char *s_jxhtml_end_html_tag (void *pdoc, Node *node);
41 static char *s_jxhtml_start_meta_tag (void *pdoc, Node *node);
42 static char *s_jxhtml_end_meta_tag (void *pdoc, Node *node);
43 static char *s_jxhtml_start_head_tag (void *pdoc, Node *node);
44 static char *s_jxhtml_end_head_tag (void *pdoc, Node *node);
45 static char *s_jxhtml_start_title_tag (void *pdoc, Node *node);
46 static char *s_jxhtml_end_title_tag (void *pdoc, Node *node);
47 static char *s_jxhtml_start_base_tag (void *pdoc, Node *node);
48 static char *s_jxhtml_end_base_tag (void *pdoc, Node *node);
49 static char *s_jxhtml_start_body_tag (void *pdoc, Node *node);
50 static char *s_jxhtml_end_body_tag (void *pdoc, Node *node);
51 static char *s_jxhtml_start_a_tag (void *pdoc, Node *node);
52 static char *s_jxhtml_end_a_tag (void *pdoc, Node *node);
53 static char *s_jxhtml_start_pre_tag (void *pdoc, Node *node);
54 static char *s_jxhtml_end_pre_tag (void *pdoc, Node *node);
55 static char *s_jxhtml_start_p_tag (void *pdoc, Node *node);
56 static char *s_jxhtml_end_p_tag (void *pdoc, Node *node);
57 static char *s_jxhtml_start_ul_tag (void *pdoc, Node *node);
58 static char *s_jxhtml_end_ul_tag (void *pdoc, Node *node);
59 static char *s_jxhtml_start_ol_tag (void *pdoc, Node *node);
60 static char *s_jxhtml_end_ol_tag (void *pdoc, Node *node);
61 static char *s_jxhtml_start_li_tag (void *pdoc, Node *node);
62 static char *s_jxhtml_end_li_tag (void *pdoc, Node *node);
63 static char *s_jxhtml_start_br_tag (void *pdoc, Node *node);
64 static char *s_jxhtml_end_br_tag (void *pdoc, Node *node);
65 static char *s_jxhtml_start_table_tag (void *pdoc, Node *node);
66 static char *s_jxhtml_end_table_tag (void *pdoc, Node *node);
67 static char *s_jxhtml_start_tr_tag (void *pdoc, Node *node);
68 static char *s_jxhtml_end_tr_tag (void *pdoc, Node *node);
69 static char *s_jxhtml_start_td_tag (void *pdoc, Node *node);
70 static char *s_jxhtml_end_td_tag (void *pdoc, Node *node);
71 static char *s_jxhtml_start_font_tag (void *pdoc, Node *node);
72 static char *s_jxhtml_end_font_tag (void *pdoc, Node *node);
73 static char *s_jxhtml_start_form_tag (void *pdoc, Node *node);
74 static char *s_jxhtml_end_form_tag (void *pdoc, Node *node);
75 static char *s_jxhtml_start_input_tag (void *pdoc, Node *node);
76 static char *s_jxhtml_end_input_tag (void *pdoc, Node *node);
77 static char *s_jxhtml_start_center_tag (void *pdoc, Node *node);
78 static char *s_jxhtml_end_center_tag (void *pdoc, Node *node);
79 static char *s_jxhtml_start_hr_tag (void *pdoc, Node *node);
80 static char *s_jxhtml_end_hr_tag (void *pdoc, Node *node);
81 static char *s_jxhtml_start_img_tag (void *pdoc, Node *node);
82 static char *s_jxhtml_end_img_tag (void *pdoc, Node *node);
83 static char *s_jxhtml_start_select_tag (void *pdoc, Node *node);
84 static char *s_jxhtml_end_select_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_start_option_tag (void *pdoc, Node *node);
86 static char *s_jxhtml_end_option_tag (void *pdoc, Node *node);
87 static char *s_jxhtml_start_div_tag (void *pdoc, Node *node);
88 static char *s_jxhtml_end_div_tag (void *pdoc, Node *node);
89 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
90 static char *s_jxhtml_end_textarea_tag (void *pdoc, Node *node);
91 static char *s_jxhtml_start_b_tag (void *pdoc, Node *node);
92 static char *s_jxhtml_end_b_tag (void *pdoc, Node *node);
93 static char *s_jxhtml_chxjif_tag (void *pdoc, Node *node);
94 static char *s_jxhtml_text_tag (void *pdoc, Node *node);
95 static char *s_jxhtml_start_blockquote_tag (void *pdoc, Node *node);
96 static char *s_jxhtml_end_blockquote_tag (void *pdoc, Node *node);
97 static char *s_jxhtml_start_dir_tag (void *pdoc, Node *node);
98 static char *s_jxhtml_end_dir_tag (void *pdoc, Node *node);
99 static char *s_jxhtml_start_dl_tag (void *pdoc, Node *node);
100 static char *s_jxhtml_end_dl_tag (void *pdoc, Node *node);
101 static char *s_jxhtml_start_dt_tag (void *pdoc, Node *node);
102 static char *s_jxhtml_end_dt_tag (void *pdoc, Node *node);
103 static char *s_jxhtml_start_dd_tag (void *pdoc, Node *node);
104 static char *s_jxhtml_end_dd_tag (void *pdoc, Node *node);
105 static char *s_jxhtml_start_h1_tag (void *pdoc, Node *node);
106 static char *s_jxhtml_end_h1_tag (void *pdoc, Node *node);
107 static char *s_jxhtml_start_h2_tag (void *pdoc, Node *node);
108 static char *s_jxhtml_end_h2_tag (void *pdoc, Node *node);
109 static char *s_jxhtml_start_h3_tag (void *pdoc, Node *node);
110 static char *s_jxhtml_end_h3_tag (void *pdoc, Node *node);
111 static char *s_jxhtml_start_h4_tag (void *pdoc, Node *node);
112 static char *s_jxhtml_end_h4_tag (void *pdoc, Node *node);
113 static char *s_jxhtml_start_h5_tag (void *pdoc, Node *node);
114 static char *s_jxhtml_end_h5_tag (void *pdoc, Node *node);
115 static char *s_jxhtml_start_h6_tag (void *pdoc, Node *node);
116 static char *s_jxhtml_end_h6_tag (void *pdoc, Node *node);
117 static char *s_jxhtml_start_menu_tag (void *pdoc, Node *node);
118 static char *s_jxhtml_end_menu_tag (void *pdoc, Node *node);
119 static char *s_jxhtml_start_plaintext_tag (void *pdoc, Node *node);
120 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
121 static char *s_jxhtml_end_plaintext_tag (void *pdoc, Node *node);
122 static char *s_jxhtml_start_blink_tag (void *pdoc, Node *node);
123 static char *s_jxhtml_end_blink_tag (void *pdoc, Node *node);
124 static char *s_jxhtml_start_marquee_tag (void *pdoc, Node *node);
125 static char *s_jxhtml_end_marquee_tag (void *pdoc, Node *node);
126 static char *s_jxhtml_newline_mark (void *pdoc, Node *node);
127 static char *s_jxhtml_link_tag (void *pdoc, Node *node);
128 static char *s_jxhtml_start_span_tag (void *pdoc, Node *node);
129 static char *s_jxhtml_end_span_tag (void *pdoc, Node *node);
130 static char *s_jxhtml_style_tag (void *pdoc, Node *node);
131 static char *s_jxhtml_start_object_tag (void *pdoc, Node *node);
132 static char *s_jxhtml_end_object_tag (void *pdoc, Node *node);
133 static char *s_jxhtml_start_param_tag (void *pdoc, Node *node);
135 static void s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
137 static int s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
139 static css_prop_list_t *s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
140 static css_prop_list_t *s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
144 tag_handler jxhtml_handler[] = {
147 s_jxhtml_start_html_tag,
148 s_jxhtml_end_html_tag,
152 s_jxhtml_start_meta_tag,
153 s_jxhtml_end_meta_tag,
157 s_jxhtml_start_textarea_tag,
158 s_jxhtml_end_textarea_tag,
162 s_jxhtml_start_p_tag,
167 s_jxhtml_start_pre_tag,
168 s_jxhtml_end_pre_tag,
172 s_jxhtml_start_ul_tag,
177 s_jxhtml_start_li_tag,
182 s_jxhtml_start_ol_tag,
187 s_jxhtml_start_h1_tag,
192 s_jxhtml_start_h2_tag,
197 s_jxhtml_start_h3_tag,
202 s_jxhtml_start_h4_tag,
207 s_jxhtml_start_h5_tag,
212 s_jxhtml_start_h6_tag,
217 s_jxhtml_start_head_tag,
218 s_jxhtml_end_head_tag,
222 s_jxhtml_start_title_tag,
223 s_jxhtml_end_title_tag,
227 s_jxhtml_start_base_tag,
228 s_jxhtml_end_base_tag,
232 s_jxhtml_start_body_tag,
233 s_jxhtml_end_body_tag,
237 s_jxhtml_start_a_tag,
242 s_jxhtml_start_br_tag,
247 s_jxhtml_start_table_tag,
248 s_jxhtml_end_table_tag,
252 s_jxhtml_start_tr_tag,
257 s_jxhtml_start_td_tag,
267 s_jxhtml_start_font_tag,
268 s_jxhtml_end_font_tag,
272 s_jxhtml_start_form_tag,
273 s_jxhtml_end_form_tag,
277 s_jxhtml_start_input_tag,
278 s_jxhtml_end_input_tag,
282 s_jxhtml_start_center_tag,
283 s_jxhtml_end_center_tag,
287 s_jxhtml_start_hr_tag,
292 s_jxhtml_start_img_tag,
293 s_jxhtml_end_img_tag,
297 s_jxhtml_start_select_tag,
298 s_jxhtml_end_select_tag,
302 s_jxhtml_start_option_tag,
303 s_jxhtml_end_option_tag,
307 s_jxhtml_start_div_tag,
308 s_jxhtml_end_div_tag,
337 s_jxhtml_start_span_tag,
338 s_jxhtml_end_span_tag,
352 s_jxhtml_start_b_tag,
362 s_jxhtml_start_dt_tag,
377 s_jxhtml_start_blockquote_tag,
378 s_jxhtml_end_blockquote_tag,
382 s_jxhtml_start_dir_tag,
383 s_jxhtml_end_dir_tag,
387 s_jxhtml_start_dl_tag,
392 s_jxhtml_start_dd_tag,
397 s_jxhtml_start_menu_tag,
398 s_jxhtml_end_menu_tag,
402 s_jxhtml_start_plaintext_tag,
403 s_jxhtml_end_plaintext_tag,
407 s_jxhtml_start_blink_tag,
408 s_jxhtml_end_blink_tag,
412 s_jxhtml_start_marquee_tag,
413 s_jxhtml_end_marquee_tag,
422 s_jxhtml_newline_mark,
427 s_jxhtml_start_object_tag,
428 s_jxhtml_end_object_tag,
432 s_jxhtml_start_param_tag,
439 * converts from CHTML5.0 to JXHTML.
441 * @param r [i] Requet_rec is appointed.
442 * @param spec [i] The result of the device specification processing which
443 * was done in advance is appointed.
444 * @param src [i] The character string before the converting is appointed.
445 * @return The character string after the converting is returned.
454 chxjconvrule_entry *entryp,
465 /*--------------------------------------------------------------------------*/
467 /*--------------------------------------------------------------------------*/
469 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
471 DBG(r,"I found qrcode xml");
474 DBG(r,"not found qrcode xml");
476 /*--------------------------------------------------------------------------*/
477 /* The CHTML structure is initialized. */
478 /*--------------------------------------------------------------------------*/
479 s_init_jxhtml(&jxhtml, &doc, r, spec);
481 jxhtml.entryp = entryp;
482 jxhtml.cookie = cookie;
484 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
486 /*--------------------------------------------------------------------------*/
487 /* The character string of the input is analyzed. */
488 /*--------------------------------------------------------------------------*/
489 qs_init_malloc(&doc);
490 qs_init_root_node(&doc);
492 ss = apr_pcalloc(r->pool, srclen + 1);
494 memset(ss, 0, srclen + 1);
495 memcpy(ss, src, srclen);
497 if (IS_CSS_ON(jxhtml.entryp)) {
498 /* current property list */
499 jxhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
502 chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
505 qs_parse_string(&doc,ss,strlen(ss));
507 chxj_buffered_write_init(r->pool, &doc.buf);
508 /*--------------------------------------------------------------------------*/
509 /* It converts it from CHTML to JXHTML. */
510 /*--------------------------------------------------------------------------*/
511 chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
512 jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
513 dst = apr_pstrdup(r->pool, jxhtml.out);
514 chxj_buffered_write_terminate(&doc.buf);
517 qs_all_free(&doc,QX_LOGMARK);
520 return apr_pstrdup(r->pool,ss);
523 dst = apr_psprintf(r->pool, "\n");
525 *dstlen = strlen(dst);
528 chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
536 * The JXHTML structure is initialized.
538 * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
539 * initialized is specified.
540 * @param doc [i] The Doc structure that should be set to the initialized
541 * JXHTML structure is specified.
542 * @param r [i] To use POOL, the pointer to request_rec is specified.
543 * @param spec [i] The pointer to the device_table
546 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
548 memset(doc, 0, sizeof(Doc));
549 memset(jxhtml, 0, sizeof(jxhtml_t));
554 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
555 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
556 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
561 * Corresponding EMOJI to a current character-code is retrieved.
562 * The substitution character string is stored in the rslt pointer if agreeing.
564 * @param jxhtml [i] The pointer to the JXHTML structure is specified.
565 * @param txt [i] The character string to want to examine whether it is
566 * EMOJI is specified.
567 * @param rslt [o] The pointer to the pointer that stores the result is
569 * @return When corresponding EMOJI exists, it returns it excluding 0.
572 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
584 if (! spec) DBG(r,"spec is NULL");
586 for (ee = jxhtml->conf->emoji;
590 unsigned char hex1byte;
591 unsigned char hex2byte;
594 DBG(r,"emoji->imode is NULL");
598 hex1byte = ee->imode->hex1byte & 0xff;
599 hex2byte = ee->imode->hex2byte & 0xff;
601 if (ee->imode->string
602 && strlen(ee->imode->string) > 0
603 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
604 if (spec == NULL || spec->emoji_type == NULL) {
605 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
606 return strlen(ee->imode->string);
613 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
614 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
615 if (spec == NULL || spec->emoji_type == NULL) {
616 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
629 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
643 DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
644 memset(doc, 0, sizeof(Doc));
645 memset(jxhtml, 0, sizeof(jxhtml_t));
650 jxhtml->out = qs_alloc_zero_byte_string(r->pool);
651 jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
652 jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
654 apr_pool_create(&pool, r->pool);
656 chxj_buffered_write_init(pool, &doc->buf);
658 for (ii=0; ii<len; ii++) {
662 rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
669 if (is_sjis_kanji(src[ii])) {
670 two_byte[0] = src[ii+0];
671 two_byte[1] = src[ii+1];
677 one_byte[0] = src[ii+0];
682 jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
684 DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
690 * It is a handler who processes the HTML tag.
692 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
693 * destination is specified.
694 * @param node [i] The HTML tag node is specified.
695 * @return The conversion result is returned.
698 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
705 jxhtml = GET_JXHTML(pdoc);
708 DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
710 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
712 W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
715 /*--------------------------------------------------------------------------*/
717 /*--------------------------------------------------------------------------*/
718 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
720 jxhtml->start_html_flag = 1;
722 DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
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_end_html_tag(void *pdoc, Node *UNUSED(child))
739 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
740 Doc *doc = jxhtml->doc;
749 * It is a handler who processes the META tag.
751 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
752 * destination is specified.
753 * @param node [i] The META tag node is specified.
754 * @return The conversion result is returned.
757 s_jxhtml_start_meta_tag(void *pdoc, Node *node)
763 int content_type_flag;
766 jxhtml = GET_JXHTML(pdoc);
770 content_type_flag = 0;
773 /*--------------------------------------------------------------------------*/
775 /*--------------------------------------------------------------------------*/
776 for (attr = qs_get_attr(doc,node);
778 attr = qs_get_next_attr(doc,attr)) {
779 char *name = qs_get_attr_name(doc,attr);
780 char *value = qs_get_attr_value(doc,attr);
784 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
785 /*----------------------------------------------------------------------*/
787 /*----------------------------------------------------------------------*/
788 W_L(" http-equiv=\"");
791 if (STRCASEEQ('c','C',"content-type",value)) {
792 content_type_flag = 1;
794 if (STRCASEEQ('r','R',"refresh",value)) {
802 if (strcasecmp(name, "content") == 0 && value && *value) {
803 /*----------------------------------------------------------------------*/
805 /*----------------------------------------------------------------------*/
806 if (content_type_flag) {
810 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
819 buf = apr_pstrdup(r->pool, value);
821 url = strchr(buf, ';');
823 sec = apr_pstrdup(r->pool, buf);
826 url = chxj_encoding_parameter(r, url, 1);
847 if (strcasecmp(name, "name") == 0 && value && *value) {
863 * It is a handler who processes the META tag.
865 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
866 * destination is specified.
867 * @param node [i] The META tag node is specified.
868 * @return The conversion result is returned.
871 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
873 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
880 * It is a handler who processes the HEAD tag.
882 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
883 * destination is specified.
884 * @param node [i] The HEAD tag node is specified.
885 * @return The conversion result is returned.
888 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
894 jxhtml = GET_JXHTML(pdoc);
904 * It is a handler who processes the HEAD tag.
906 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
907 * destination is specified.
908 * @param node [i] The HEAD tag node is specified.
909 * @return The conversion result is returned.
912 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
918 jxhtml = GET_JXHTML(pdoc);
928 * It is a handler who processes the TITLE tag.
930 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
931 * destination is specified.
932 * @param node [i] The TITLE tag node is specified.
933 * @return The conversion result is returned.
936 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
942 jxhtml = GET_JXHTML(pdoc);
952 * It is a handler who processes the TITLE tag.
954 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
955 * destination is specified.
956 * @param node [i] The TITLE tag node is specified.
957 * @return The conversion result is returned.
960 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
966 jxhtml = GET_JXHTML(pdoc);
976 * It is a handler who processes the BASE tag.
978 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
979 * destination is specified.
980 * @param node [i] The BASE tag node is specified.
981 * @return The conversion result is returned.
984 s_jxhtml_start_base_tag(void *pdoc, Node *node)
991 jxhtml = GET_JXHTML(pdoc);
996 /*--------------------------------------------------------------------------*/
998 /*--------------------------------------------------------------------------*/
999 for (attr = qs_get_attr(doc,node);
1001 attr = qs_get_next_attr(doc,attr)) {
1002 char *name = qs_get_attr_name(doc,attr);
1003 char *value = qs_get_attr_value(doc,attr);
1004 if (STRCASEEQ('h','H',"href",name)) {
1016 * It is a handler who processes the BASE tag.
1018 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1019 * destination is specified.
1020 * @param node [i] The BASE tag node is specified.
1021 * @return The conversion result is returned.
1024 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1026 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1032 * It is a handler who processes the BODY tag.
1034 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1035 * destination is specified.
1036 * @param node [i] The BODY tag node is specified.
1037 * @return The conversion result is returned.
1040 s_jxhtml_start_body_tag(void *pdoc, Node *node)
1046 char *attr_bgcolor = NULL;
1047 char *attr_text = NULL;
1048 char *attr_link = NULL;
1049 char *attr_style = NULL;
1051 jxhtml = GET_JXHTML(pdoc);
1055 /*--------------------------------------------------------------------------*/
1056 /* Get Attributes */
1057 /*--------------------------------------------------------------------------*/
1058 for (attr = qs_get_attr(doc,node);
1060 attr = qs_get_next_attr(doc,attr)) {
1061 char *name = qs_get_attr_name(doc,attr);
1062 char *value = qs_get_attr_value(doc,attr);
1063 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1064 /*----------------------------------------------------------------------*/
1066 /*----------------------------------------------------------------------*/
1067 attr_bgcolor = value;
1069 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1070 /*----------------------------------------------------------------------*/
1072 /*----------------------------------------------------------------------*/
1075 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1076 /*----------------------------------------------------------------------*/
1078 /*----------------------------------------------------------------------*/
1081 else if (STRCASEEQ('a','A',"alink",name)) {
1082 /*----------------------------------------------------------------------*/
1084 /*----------------------------------------------------------------------*/
1087 else if (STRCASEEQ('v','V',"vlink",name)) {
1088 /*----------------------------------------------------------------------*/
1090 /*----------------------------------------------------------------------*/
1093 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1098 if (IS_CSS_ON(jxhtml->entryp)) {
1099 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1101 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1102 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1103 css_property_t *cur;
1104 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1105 if (cur->value && *cur->value) {
1106 attr_text = apr_pstrdup(doc->pool, cur->value);
1109 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1110 if (cur->value && *cur->value) {
1111 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1115 if (jxhtml->style) {
1116 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
1117 css_selector_t *cur_sel;
1118 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1119 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1120 css_property_t *cur;
1121 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1122 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1123 attr_link = apr_pstrdup(doc->pool, cur->value);
1133 if (attr_bgcolor || attr_text) {
1136 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1137 W_L("background-color:");
1142 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1150 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1161 * It is a handler who processes the BODY tag.
1163 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1164 * destination is specified.
1165 * @param node [i] The BODY tag node is specified.
1166 * @return The conversion result is returned.
1169 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1175 jxhtml = GET_JXHTML(pdoc);
1179 W_L("</div></body>");
1180 if (IS_CSS_ON(jxhtml->entryp)) {
1181 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1188 * It is a handler who processes the A tag.
1190 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1191 * destination is specified.
1192 * @param node [i] The A tag node is specified.
1193 * @return The conversion result is returned.
1196 s_jxhtml_start_a_tag(void *pdoc, Node *node)
1202 char *attr_style = NULL;
1204 jxhtml = GET_JXHTML(pdoc);
1209 /*--------------------------------------------------------------------------*/
1210 /* Get Attributes */
1211 /*--------------------------------------------------------------------------*/
1212 for (attr = qs_get_attr(doc,node);
1214 attr = qs_get_next_attr(doc,attr)) {
1215 char *name = qs_get_attr_name(doc,attr);
1216 char *value = qs_get_attr_value(doc,attr);
1217 if (STRCASEEQ('n','N',"name",name)) {
1218 /*----------------------------------------------------------------------*/
1220 /*----------------------------------------------------------------------*/
1222 W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1225 else if (STRCASEEQ('h','H',"href",name)) {
1226 /*----------------------------------------------------------------------*/
1228 /*----------------------------------------------------------------------*/
1229 value = chxj_encoding_parameter(r, value, 1);
1230 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1231 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
1237 else if (STRCASEEQ('a','A',"accesskey",name)) {
1238 /*----------------------------------------------------------------------*/
1240 /*----------------------------------------------------------------------*/
1241 W_L(" accesskey=\"");
1245 else if (STRCASEEQ('c','C',"cti",name)) {
1246 /*----------------------------------------------------------------------*/
1248 /*----------------------------------------------------------------------*/
1253 else if (STRCASEEQ('i','I',"ijam",name)) {
1254 /*----------------------------------------------------------------------*/
1256 /*----------------------------------------------------------------------*/
1259 else if (STRCASEEQ('u','U',"utn",name)) {
1260 /*----------------------------------------------------------------------*/
1262 /* It is special only for CHTML. */
1263 /*----------------------------------------------------------------------*/
1266 else if (STRCASEEQ('t','T',"telbook",name)) {
1267 /*----------------------------------------------------------------------*/
1269 /*----------------------------------------------------------------------*/
1272 else if (STRCASEEQ('k','K',"kana",name)) {
1273 /*----------------------------------------------------------------------*/
1275 /*----------------------------------------------------------------------*/
1278 else if (STRCASEEQ('e','E',"email",name)) {
1279 /*----------------------------------------------------------------------*/
1281 /*----------------------------------------------------------------------*/
1284 else if (STRCASEEQ('i','I',"ista",name)) {
1285 /*----------------------------------------------------------------------*/
1287 /*----------------------------------------------------------------------*/
1290 else if (STRCASEEQ('i','I',"ilet",name)) {
1291 /*----------------------------------------------------------------------*/
1293 /*----------------------------------------------------------------------*/
1296 else if (STRCASEEQ('i','I',"iswf",name)) {
1297 /*----------------------------------------------------------------------*/
1299 /*----------------------------------------------------------------------*/
1302 else if (STRCASEEQ('i','I',"irst",name)) {
1303 /*----------------------------------------------------------------------*/
1305 /*----------------------------------------------------------------------*/
1308 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1309 /*----------------------------------------------------------------------*/
1311 /*----------------------------------------------------------------------*/
1317 if (IS_CSS_ON(jxhtml->entryp)) {
1318 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1326 * It is a handler who processes the A tag.
1328 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1329 * destination is specified.
1330 * @param node [i] The A tag node is specified.
1331 * @return The conversion result is returned.
1334 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1340 jxhtml = GET_JXHTML(pdoc);
1346 if (IS_CSS_ON(jxhtml->entryp)) {
1347 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
1355 * It is a handler who processes the BR tag.
1357 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1358 * destination is specified.
1359 * @param node [i] The BR tag node is specified.
1360 * @return The conversion result is returned.
1363 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1370 jxhtml = GET_JXHTML(pdoc);
1374 char *attr_style = NULL;
1375 char *attr_clear = NULL;
1377 /*--------------------------------------------------------------------------*/
1378 /* Get Attributes */
1379 /*--------------------------------------------------------------------------*/
1380 for (attr = qs_get_attr(doc,node);
1382 attr = qs_get_next_attr(doc,attr)) {
1383 char *name = qs_get_attr_name(doc,attr);
1384 char *value = qs_get_attr_value(doc,attr);
1385 if (STRCASEEQ('c','C',"clear",name)) {
1386 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1390 else if (STRCASEEQ('s','S',"style",name)) {
1391 attr_style = apr_pstrdup(doc->buf.pool, value);
1394 if (IS_CSS_ON(jxhtml->entryp)) {
1395 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1397 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1398 css_property_t *cur;
1399 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1400 if (cur->value && *cur->value) {
1401 if ( STRCASEEQ('l','L',"left", cur->value)
1402 || STRCASEEQ('r','R',"right", cur->value)
1403 || STRCASEEQ('b','B',"both" ,cur->value)) {
1404 attr_clear = apr_pstrdup(doc->pool, cur->value);
1422 * It is a handler who processes the BR tag.
1424 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1425 * destination is specified.
1426 * @param node [i] The BR tag node is specified.
1427 * @return The conversion result is returned.
1430 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1432 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1437 * It is a handler who processes the TABLE tag.
1439 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1440 * destination is specified.
1441 * @param node [i] The TR tag node is specified.
1442 * @return The conversion result is returned.
1445 s_jxhtml_start_table_tag(void *pdoc, Node *node)
1452 char *attr_style = NULL;
1453 char *attr_align = NULL;
1454 char *attr_width = NULL;
1455 char *attr_height = NULL;
1456 char *attr_bgcolor = NULL;
1457 char *attr_border_width = NULL;
1458 char *attr_border_color = NULL;
1460 jxhtml = GET_JXHTML(pdoc);
1464 /*--------------------------------------------------------------------------*/
1465 /* Get Attributes */
1466 /*--------------------------------------------------------------------------*/
1467 for (attr = qs_get_attr(doc,node);
1469 attr = qs_get_next_attr(doc,attr)) {
1470 char *name = qs_get_attr_name(doc,attr);
1471 char *val = qs_get_attr_value(doc,attr);
1472 if (STRCASEEQ('a','A',"align",name)) {
1473 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1474 attr_align = apr_pstrdup(doc->buf.pool, val);
1477 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1478 attr_height = apr_pstrdup(doc->buf.pool, val);
1480 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1481 attr_width = apr_pstrdup(doc->buf.pool, val);
1483 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1484 attr_style = apr_pstrdup(doc->buf.pool, val);
1486 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1487 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1488 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1490 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1491 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1493 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1494 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1495 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1499 if (IS_CSS_ON(jxhtml->entryp)) {
1500 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1502 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1503 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1504 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1505 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1506 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1507 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1509 css_property_t *cur;
1510 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1511 char *tmp = apr_pstrdup(doc->pool, cur->value);
1512 char *tmpp = strstr(tmp, "px");
1514 size_t len = strlen(tmp) - strlen(tmpp);
1515 attr_width = apr_pstrndup(doc->pool, tmp,len);
1518 attr_width = apr_pstrdup(doc->pool, tmp);
1521 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1522 char *tmp = apr_pstrdup(doc->pool, cur->value);
1523 char *tmpp = strstr(tmp, "px");
1525 size_t len = strlen(tmp) - strlen(tmpp);
1526 attr_height = apr_pstrndup(doc->pool, tmp,len);
1529 attr_height = apr_pstrdup(doc->pool, tmp);
1532 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1533 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1534 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1537 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1538 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1539 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1541 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1542 char *tmp = apr_pstrdup(doc->pool, cur->value);
1543 char *tmpp = strstr(tmp, "px");
1545 size_t len = strlen(tmp) - strlen(tmpp);
1546 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1549 attr_border_width = apr_pstrdup(doc->pool, tmp);
1552 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1553 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1554 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1575 if (attr_bgcolor && *attr_bgcolor){
1580 if (attr_border_width || attr_border_color ){
1581 W_L(" style=\"border:");
1582 if (attr_border_width){
1583 W_V(attr_border_width);
1590 if (attr_border_color && *attr_border_color){
1592 W_V(attr_border_color);
1602 * It is a handler who processes the TABLE tag.
1604 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1605 * destination is specified.
1606 * @param node [i] The TR tag node is specified.
1607 * @return The conversion result is returned.
1610 s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node))
1616 jxhtml = GET_JXHTML(pdoc);
1626 * It is a handler who processes the TR tag.
1628 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1629 * destination is specified.
1630 * @param node [i] The TR tag node is specified.
1631 * @return The conversion result is returned.
1634 s_jxhtml_start_tr_tag(void *pdoc, Node *node)
1642 char *attr_style = NULL;
1643 char *attr_align = NULL;
1644 char *attr_valign = NULL;
1645 char *attr_bgcolor = NULL;
1647 jxhtml = GET_JXHTML(pdoc);
1651 /*--------------------------------------------------------------------------*/
1652 /* Get Attributes */
1653 /*--------------------------------------------------------------------------*/
1654 for (attr = qs_get_attr(doc,node);
1656 attr = qs_get_next_attr(doc,attr)) {
1657 char *name = qs_get_attr_name(doc,attr);
1658 char *val = qs_get_attr_value(doc,attr);
1659 if (STRCASEEQ('a','A',"align",name)) {
1660 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1661 attr_align = apr_pstrdup(doc->buf.pool, val);
1664 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1665 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1666 attr_valign = apr_pstrdup(doc->buf.pool, val);
1669 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1670 attr_style = apr_pstrdup(doc->buf.pool, val);
1672 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1673 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1674 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1678 if (IS_CSS_ON(jxhtml->entryp)) {
1679 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1681 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1682 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1683 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1685 css_property_t *cur;
1686 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1687 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1688 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1691 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1692 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1693 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1696 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1697 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1698 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1714 if (attr_bgcolor && *attr_bgcolor){
1725 * It is a handler who processes the TR tag.
1727 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1728 * destination is specified.
1729 * @param node [i] The TR tag node is specified.
1730 * @return The conversion result is returned.
1733 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1739 jxhtml = GET_JXHTML(pdoc);
1748 * It is a handler who processes the TD tag.
1750 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1751 * destination is specified.
1752 * @param node [i] The TR tag node is specified.
1753 * @return The conversion result is returned.
1756 s_jxhtml_start_td_tag(void *pdoc, Node *node)
1764 char *attr_style = NULL;
1765 char *attr_align = NULL;
1766 char *attr_valign = NULL;
1767 char *attr_bgcolor = NULL;
1768 char *attr_colspan = NULL;
1769 char *attr_rowspan = NULL;
1771 jxhtml = GET_JXHTML(pdoc);
1775 /*--------------------------------------------------------------------------*/
1776 /* Get Attributes */
1777 /*--------------------------------------------------------------------------*/
1778 for (attr = qs_get_attr(doc,node);
1780 attr = qs_get_next_attr(doc,attr)) {
1781 char *name = qs_get_attr_name(doc,attr);
1782 char *val = qs_get_attr_value(doc,attr);
1783 if (STRCASEEQ('a','A',"align",name)) {
1784 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1785 attr_align = apr_pstrdup(doc->buf.pool, val);
1788 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1789 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1790 attr_valign = apr_pstrdup(doc->buf.pool, val);
1793 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1794 attr_style = apr_pstrdup(doc->buf.pool, val);
1796 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1797 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1798 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1800 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1801 attr_colspan = apr_pstrdup(doc->buf.pool, val);
1803 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1804 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1808 if (IS_CSS_ON(jxhtml->entryp)) {
1809 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1811 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1812 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1813 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1815 css_property_t *cur;
1816 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1817 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1818 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1821 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1822 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1823 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1826 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1827 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1828 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1854 if (attr_bgcolor && *attr_bgcolor){
1865 * It is a handler who processes the TD tag.
1867 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1868 * destination is specified.
1869 * @param node [i] The TR tag node is specified.
1870 * @return The conversion result is returned.
1873 s_jxhtml_end_td_tag(void *pdoc, Node *UNUSED(child))
1879 jxhtml = GET_JXHTML(pdoc);
1888 * It is a handler who processes the FONT tag.
1890 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
1891 * destination is specified.
1892 * @param node [i] The FONT tag node is specified.
1893 * @return The conversion result is returned.
1896 s_jxhtml_start_font_tag(void *pdoc, Node *node)
1902 char *attr_color = NULL;
1903 char *attr_size = NULL;
1904 char *attr_style = NULL;
1906 jxhtml = GET_JXHTML(pdoc);
1910 /*--------------------------------------------------------------------------*/
1911 /* Get Attributes */
1912 /*--------------------------------------------------------------------------*/
1913 for (attr = qs_get_attr(doc,node);
1915 attr = qs_get_next_attr(doc,attr)) {
1916 char *name = qs_get_attr_name(doc,attr);
1917 char *value = qs_get_attr_value(doc,attr);
1918 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1919 attr_color = apr_pstrdup(doc->buf.pool, value);
1921 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1922 /*----------------------------------------------------------------------*/
1924 /*----------------------------------------------------------------------*/
1925 attr_size = apr_pstrdup(doc->buf.pool, value);
1927 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1928 attr_style = apr_pstrdup(doc->buf.pool, value);
1931 if (IS_CSS_ON(jxhtml->entryp)) {
1932 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
1934 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1935 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1936 css_property_t *cur;
1937 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1938 if (cur->value && *cur->value) {
1939 attr_color = apr_pstrdup(doc->pool, cur->value);
1942 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1943 if (cur->value && *cur->value) {
1944 attr_size = apr_pstrdup(doc->pool, cur->value);
1945 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1946 attr_size = apr_pstrdup(doc->pool, "1");
1948 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1949 attr_size = apr_pstrdup(doc->pool, "2");
1951 else if (STRCASEEQ('s','S',"small",attr_size)) {
1952 attr_size = apr_pstrdup(doc->pool, "3");
1954 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1955 attr_size = apr_pstrdup(doc->pool, "4");
1957 else if (STRCASEEQ('l','L',"large",attr_size)) {
1958 attr_size = apr_pstrdup(doc->pool, "5");
1960 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1961 attr_size = apr_pstrdup(doc->pool, "6");
1963 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1964 attr_size = apr_pstrdup(doc->pool, "7");
1970 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1971 memset(flg, 0, sizeof(*flg));
1973 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1974 W_L("<font color=\"");
1977 flg->font_color_flag = 1;
1980 flg->font_size_flag = 1;
1981 switch(*attr_size) {
1982 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1983 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1984 case '3': W_L("<span style=\"font-size: small\">"); break;
1985 case '4': W_L("<span style=\"font-size: medium\">"); break;
1986 case '5': W_L("<span style=\"font-size: large\">"); break;
1987 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1988 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1990 if (*(attr_size + 1) == '1') {
1991 W_L("<span style=\"font-size: small\">");
1994 if (*(attr_size + 1) == '2') {
1995 W_L("<span style=\"font-size: x-small\">");
1998 if (*(attr_size + 1) == '3') {
1999 W_L("<span style=\"font-size: xx-small\">");
2002 flg->font_size_flag = 0;
2006 if (*(attr_size + 1) == '1') {
2007 W_L("<span style=\"font-size: large\">");
2010 if (*(attr_size + 1) == '2') {
2011 W_L("<span style=\"font-size: x-large\">");
2014 if (*(attr_size + 1) == '3') {
2015 W_L("<span style=\"font-size: xx-large\">");
2018 flg->font_size_flag = 0;
2022 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2023 flg->font_size_flag = 0;
2026 node->userData = flg;
2032 * It is a handler who processes the FONT tag.
2034 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2035 * destination is specified.
2036 * @param node [i] The FONT tag node is specified.
2037 * @return The conversion result is returned.
2040 s_jxhtml_end_font_tag(void *pdoc, Node *node)
2046 jxhtml = GET_JXHTML(pdoc);
2050 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2051 if (flg && flg->font_size_flag) {
2054 if (flg && flg->font_color_flag) {
2057 if (IS_CSS_ON(jxhtml->entryp)) {
2058 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2066 * It is a handler who processes the FORM tag.
2068 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2069 * destination is specified.
2070 * @param node [i] The FORM tag node is specified.
2071 * @return The conversion result is returned.
2074 s_jxhtml_start_form_tag(void *pdoc, Node *node)
2080 char *attr_action = NULL;
2081 char *attr_method = NULL;
2082 char *attr_style = NULL;
2083 char *attr_color = NULL;
2084 char *attr_align = NULL;
2085 char *attr_name = NULL;
2086 char *new_hidden_tag = NULL;
2088 jxhtml = GET_JXHTML(pdoc);
2092 /*--------------------------------------------------------------------------*/
2093 /* Get Attributes */
2094 /*--------------------------------------------------------------------------*/
2095 for (attr = qs_get_attr(doc,node);
2097 attr = qs_get_next_attr(doc,attr)) {
2098 char *name = qs_get_attr_name(doc,attr);
2099 char *value = qs_get_attr_value(doc,attr);
2103 if (strcasecmp(name, "action") == 0) {
2104 /*--------------------------------------------------------------------*/
2106 /*--------------------------------------------------------------------*/
2107 attr_action = value;
2113 if (strcasecmp(name, "method") == 0) {
2114 /*--------------------------------------------------------------------*/
2116 /*--------------------------------------------------------------------*/
2117 attr_method = value;
2123 if (strcasecmp(name, "name") == 0) {
2124 /*--------------------------------------------------------------------*/
2126 /*--------------------------------------------------------------------*/
2133 if (strcasecmp(name, "style") == 0) {
2142 if (IS_CSS_ON(jxhtml->entryp)) {
2143 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2145 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2146 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2147 css_property_t *cur;
2148 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2149 if (STRCASEEQ('l','L',"left", cur->value)) {
2150 attr_align = apr_pstrdup(doc->pool, "left");
2152 else if (STRCASEEQ('c','C',"center",cur->value)) {
2153 attr_align = apr_pstrdup(doc->pool, "center");
2155 else if (STRCASEEQ('r','R',"right",cur->value)) {
2156 attr_align = apr_pstrdup(doc->pool, "right");
2159 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2160 attr_color = apr_pstrdup(doc->pool, cur->value);
2165 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2169 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2170 attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
2172 char *old_qs = NULL;
2173 q = strchr(attr_action, '?');
2175 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);
2176 if (new_hidden_tag || old_qs) {
2200 jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
2201 memset(flg, 0, sizeof(*flg));
2203 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2204 W_L("<font color=\"");
2207 flg->with_font_flag = 1;
2210 W_L("<div align=\"");
2213 flg->with_div_flag = 1;
2215 node->userData = flg;
2216 if (new_hidden_tag) {
2217 W_V(new_hidden_tag);
2224 * It is a handler who processes the FORM tag.
2226 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2227 * destination is specified.
2228 * @param node [i] The FORM tag node is specified.
2229 * @return The conversion result is returned.
2232 s_jxhtml_end_form_tag(void *pdoc, Node *node)
2234 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2235 Doc *doc = jxhtml->doc;
2237 jxhtml_flags_t *flg = (jxhtml_flags_t *)node->userData;
2238 if (flg && flg->with_div_flag) {
2241 if (flg && flg->with_font_flag) {
2245 if (IS_CSS_ON(jxhtml->entryp)) {
2246 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2254 * It is a handler who processes the INPUT tag.
2256 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2257 * destination is specified.
2258 * @param node [i] The INPUT tag node is specified.
2259 * @return The conversion result is returned.
2262 s_jxhtml_start_input_tag(void *pdoc, Node *node)
2268 char *attr_accesskey = NULL;
2269 char *attr_max_length = NULL;
2270 char *attr_type = NULL;
2271 char *attr_name = NULL;
2272 char *attr_value = NULL;
2273 char *attr_istyle = NULL;
2274 char *attr_size = NULL;
2275 char *attr_checked = NULL;
2276 char *attr_style = NULL;
2278 jxhtml = GET_JXHTML(pdoc);
2282 /*--------------------------------------------------------------------------*/
2283 /* Get Attributes */
2284 /*--------------------------------------------------------------------------*/
2285 for (attr = qs_get_attr(doc,node);
2287 attr = qs_get_next_attr(doc,attr)) {
2288 char *name = qs_get_attr_name(doc,attr);
2289 char *value = qs_get_attr_value(doc,attr);
2290 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2291 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2292 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2293 STRCASEEQ('p','P',"password",tmp_type) ||
2294 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2295 STRCASEEQ('r','R',"radio", tmp_type) ||
2296 STRCASEEQ('h','H',"hidden", tmp_type) ||
2297 STRCASEEQ('s','S',"submit", tmp_type) ||
2298 STRCASEEQ('r','R',"reset", tmp_type))) {
2299 attr_type = tmp_type;
2302 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2305 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2308 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2309 attr_istyle = value;
2311 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2312 attr_max_length = value;
2314 else if (STRCASEEQ('c','C',"checked", name)) {
2315 attr_checked = value;
2317 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2318 attr_accesskey = value;
2320 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2323 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2328 if (IS_CSS_ON(jxhtml->entryp)) {
2329 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2331 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2332 css_property_t *cur;
2333 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2334 if (strcasestr(cur->value, "<ja:n>")) {
2337 else if (strcasestr(cur->value, "<ja:en>")) {
2340 else if (strcasestr(cur->value, "<ja:hk>")) {
2343 else if (strcasestr(cur->value, "<ja:h>")) {
2363 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jxhtml->entryp));
2368 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2371 if (attr_accesskey) {
2372 W_L(" accesskey=\"");
2373 W_V(attr_accesskey);
2376 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2381 else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2382 W_L(" istyle=\"4\"");
2384 /*--------------------------------------------------------------------------*/
2385 /* The figure is default for the password. */
2386 /*--------------------------------------------------------------------------*/
2387 if (attr_max_length && *attr_max_length) {
2388 if (chxj_chk_numeric(attr_max_length) == 0) {
2389 W_L(" maxlength=\"");
2390 W_V(attr_max_length);
2395 W_L(" checked=\"checked\"");
2411 jxhtml = GET_JXHTML(pdoc);
2424 /*--------------------------------------------------------------------------*/
2425 /* Get Attributes */
2426 /*--------------------------------------------------------------------------*/
2427 type = qs_get_type_attr(doc, node, doc->buf.pool);
2428 name = qs_get_name_attr(doc, node, doc->buf.pool);
2429 value = qs_get_value_attr(doc,node, doc->buf.pool);
2430 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
2431 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2432 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
2433 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2434 size = qs_get_size_attr(doc, node, doc->buf.pool);
2437 if (type && (STRCASEEQ('t','T',"text", type) ||
2438 STRCASEEQ('p','P',"password",type) ||
2439 STRCASEEQ('c','C',"checkbox",type) ||
2440 STRCASEEQ('r','R',"radio", type) ||
2441 STRCASEEQ('h','H',"hidden", type) ||
2442 STRCASEEQ('s','S',"submit", type) ||
2443 STRCASEEQ('r','R',"reset", type))) {
2449 if (size && *size) {
2454 if (name && *name) {
2456 W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
2459 if (value && *value) {
2460 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
2461 apr_size_t value_len = strlen(value);
2462 value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
2466 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2469 if (accesskey && *accesskey) {
2470 W_L(" accesskey=\"");
2474 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2475 /*------------------------------------------------------------------------*/
2477 /*------------------------------------------------------------------------*/
2478 if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
2479 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2482 char *vv = qs_conv_istyle_to_format(doc->buf.pool, istyle);
2484 W_L("-wap-input-format:'*");
2490 else if (type && STRCASEEQ('p','P',"password",type)) {
2491 W_L(" style=\"-wap-input-format: "*<ja:n>";\"");
2493 /*--------------------------------------------------------------------------*/
2494 /* The figure is default for the password. */
2495 /*--------------------------------------------------------------------------*/
2496 if (max_length && *max_length) {
2497 if (chxj_chk_numeric(max_length) == 0) {
2498 W_L(" maxlength=\"");
2505 W_L(" checked=\"checked\"");
2514 * It is a handler who processes the INPUT tag.
2516 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2517 * destination is specified.
2518 * @param node [i] The INPUT tag node is specified.
2519 * @return The conversion result is returned.
2522 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
2524 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2530 * It is a handler who processes the CENTER tag.
2532 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2533 * destination is specified.
2534 * @param node [i] The CENTER tag node is specified.
2535 * @return The conversion result is returned.
2538 s_jxhtml_start_center_tag(void *pdoc, Node *node)
2543 char *attr_style = NULL;
2544 char *attr_color = NULL;
2545 char *attr_size = NULL;
2547 jxhtml = GET_JXHTML(pdoc);
2550 for (attr = qs_get_attr(doc,node);
2552 attr = qs_get_next_attr(doc,attr)) {
2553 char *name = qs_get_attr_name(doc,attr);
2554 char *value = qs_get_attr_value(doc,attr);
2555 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2559 if (IS_CSS_ON(jxhtml->entryp)) {
2560 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2562 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2563 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2564 css_property_t *cur;
2565 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2566 if (cur->value && *cur->value) {
2567 attr_color = apr_pstrdup(doc->pool, cur->value);
2570 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2571 if (cur->value && *cur->value) {
2572 attr_size = apr_pstrdup(doc->pool, cur->value);
2579 if (attr_size || attr_color) {
2587 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2601 * It is a handler who processes the CENTER tag.
2603 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2604 * destination is specified.
2605 * @param node [i] The CENTER tag node is specified.
2606 * @return The conversion result is returned.
2609 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(node))
2615 jxhtml = GET_JXHTML(pdoc);
2620 if (IS_CSS_ON(jxhtml->entryp)) {
2621 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2628 * It is a handler who processes the li tag.
2630 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2631 * destination is specified.
2632 * @param node [i] The li tag node is specified.
2633 * @return The conversion result is returned.
2636 s_jxhtml_start_li_tag(void *pdoc, Node *node)
2642 char *attr_type = NULL;
2643 char *attr_value = NULL;
2644 char *attr_style = NULL;
2646 jxhtml = GET_JXHTML(pdoc);
2650 for (attr = qs_get_attr(doc,node);
2652 attr = qs_get_next_attr(doc,attr)) {
2653 char *name = qs_get_attr_name(doc,attr);
2654 char *value = qs_get_attr_value(doc,attr);
2655 if (STRCASEEQ('t','T',"type",name)) {
2656 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2657 if (*value == '1') {
2658 attr_type = apr_pstrdup(doc->pool, "decimal");
2660 else if (*value == 'a') {
2661 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2663 else if (*value == 'A') {
2664 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2671 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2674 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2678 if (IS_CSS_ON(jxhtml->entryp)) {
2679 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2681 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2682 css_property_t *cur;
2683 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2684 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2685 attr_type = apr_pstrdup(doc->pool, "decimal");
2687 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2688 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2690 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2691 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2693 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2694 attr_type = apr_pstrdup(doc->pool, "disc");
2696 else if (STRCASEEQ('s','S',"square", cur->value)) {
2697 attr_type = apr_pstrdup(doc->pool, "square");
2699 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2700 attr_type = apr_pstrdup(doc->pool, "circle");
2710 W_L("list-style-type:");
2726 * It is a handler who processes the li tag.
2728 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2729 * destination is specified.
2730 * @param node [i] The li tag node is specified.
2731 * @return The conversion result is returned.
2734 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2740 jxhtml = GET_JXHTML(pdoc);
2744 if (IS_CSS_ON(jxhtml->entryp)) {
2745 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2753 * It is a handler who processes the OL tag.
2755 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2756 * destination is specified.
2757 * @param node [i] The OL tag node is specified.
2758 * @return The conversion result is returned.
2761 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
2767 char *attr_style = NULL;
2768 char *attr_start = NULL;
2769 char *attr_type = NULL;
2771 jxhtml = GET_JXHTML(pdoc);
2775 /*--------------------------------------------------------------------------*/
2776 /* Get Attributes */
2777 /*--------------------------------------------------------------------------*/
2778 for (attr = qs_get_attr(doc,node);
2780 attr = qs_get_next_attr(doc,attr)) {
2781 char *name = qs_get_attr_name(doc,attr);
2782 char *value = qs_get_attr_value(doc,attr);
2783 if (STRCASEEQ('t','T',"type",name) && value) {
2784 if (*value == '1') {
2785 attr_type = apr_pstrdup(doc->pool, "decimal");
2787 else if (*value == 'a') {
2788 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2790 else if (*value == 'A') {
2791 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2794 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2797 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2801 if (IS_CSS_ON(jxhtml->entryp)) {
2802 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2804 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2805 css_property_t *cur;
2806 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2807 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2808 attr_type = apr_pstrdup(doc->pool, "decimal");
2810 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2811 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2813 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2814 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2822 W_L("list-style-type:");
2839 * It is a handler who processes the OL tag.
2841 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2842 * destination is specified.
2843 * @param node [i] The OL tag node is specified.
2844 * @return The conversion result is returned.
2847 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2853 jxhtml = GET_JXHTML(pdoc);
2858 if (IS_CSS_ON(jxhtml->entryp)) {
2859 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2866 * It is a handler who processes the P tag.
2868 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2869 * destination is specified.
2870 * @param node [i] The P tag node is specified.
2871 * @return The conversion result is returned.
2874 s_jxhtml_start_p_tag(void *pdoc, Node *node)
2880 char *attr_align = NULL;
2881 char *attr_style = NULL;
2882 char *attr_color = NULL;
2883 char *attr_blink = NULL;
2884 char *css_clear = NULL;
2886 jxhtml = GET_JXHTML(pdoc);
2890 for (attr = qs_get_attr(doc,node);
2892 attr = qs_get_next_attr(doc,attr)) {
2893 char *nm = qs_get_attr_name(doc,attr);
2894 char *val = qs_get_attr_value(doc,attr);
2895 if (STRCASEEQ('a','A',"align", nm)) {
2896 /*----------------------------------------------------------------------*/
2897 /* CHTML 1.0 (W3C version 3.2) */
2898 /*----------------------------------------------------------------------*/
2899 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2900 attr_align = apr_pstrdup(doc->buf.pool, val);
2904 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2905 attr_style = apr_pstrdup(doc->buf.pool, val);
2908 if (IS_CSS_ON(jxhtml->entryp)) {
2909 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
2911 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2912 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2913 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2914 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2915 css_property_t *cur;
2916 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2917 if (STRCASEEQ('l','L',"left",cur->value)) {
2918 attr_align = apr_pstrdup(doc->pool, "left");
2920 else if (STRCASEEQ('c','C',"center",cur->value)) {
2921 attr_align = apr_pstrdup(doc->pool, "center");
2923 else if (STRCASEEQ('r','R',"right",cur->value)) {
2924 attr_align = apr_pstrdup(doc->pool, "right");
2927 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2928 if (cur->value && *cur->value) {
2929 attr_color = apr_pstrdup(doc->pool, cur->value);
2932 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2933 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2934 attr_blink = apr_pstrdup(doc->pool, cur->value);
2937 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2938 css_clear = apr_pstrdup(doc->pool, cur->value);
2943 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2951 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2957 W_L("text-decoration:");
2974 * It is a handler who processes the P tag.
2976 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2977 * destination is specified.
2978 * @param node [i] The P tag node is specified.
2979 * @return The conversion result is returned.
2982 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
2984 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2985 Doc *doc = jxhtml->doc;
2988 if (IS_CSS_ON(jxhtml->entryp)) {
2989 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
2996 * It is a handler who processes the PRE tag.
2998 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
2999 * destination is specified.
3000 * @param node [i] The PRE tag node is specified.
3001 * @return The conversion result is returned.
3004 s_jxhtml_start_pre_tag(void *pdoc, Node *node)
3006 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3007 Doc *doc = jxhtml->doc;
3009 char *attr_style = NULL;
3011 for (attr = qs_get_attr(doc,node);
3013 attr = qs_get_next_attr(doc,attr)) {
3014 char *nm = qs_get_attr_name(doc,attr);
3015 char *val = qs_get_attr_value(doc,attr);
3016 if (val && STRCASEEQ('s','S',"style", nm)) {
3021 if (IS_CSS_ON(jxhtml->entryp)) {
3022 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3032 * It is a handler who processes the PRE tag.
3034 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3035 * destination is specified.
3036 * @param node [i] The PRE tag node is specified.
3037 * @return The conversion result is returned.
3040 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
3042 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3043 Doc *doc = jxhtml->doc;
3047 if (IS_CSS_ON(jxhtml->entryp)) {
3048 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3056 * It is a handler who processes the UL tag.
3058 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3059 * destination is specified.
3060 * @param node [i] The UL tag node is specified.
3061 * @return The conversion result is returned.
3064 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
3066 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3067 Doc *doc = jxhtml->doc;
3069 char *attr_type = NULL;
3070 char *attr_style = NULL;
3071 /*--------------------------------------------------------------------------*/
3072 /* Get Attributes */
3073 /*--------------------------------------------------------------------------*/
3074 for (attr = qs_get_attr(doc,node);
3076 attr = qs_get_next_attr(doc,attr)) {
3077 char *name = qs_get_attr_name(doc,attr);
3078 char *value = qs_get_attr_value(doc,attr);
3079 if (STRCASEEQ('t','T',"type",name)) {
3080 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3084 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3088 if (IS_CSS_ON(jxhtml->entryp)) {
3089 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3091 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3092 css_property_t *cur;
3093 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3094 if (STRCASEEQ('d','D',"disc",cur->value)) {
3095 attr_type = apr_pstrdup(doc->pool, "disc");
3097 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3098 attr_type = apr_pstrdup(doc->pool, "circle");
3100 else if (STRCASEEQ('s','S',"square",cur->value)) {
3101 attr_type = apr_pstrdup(doc->pool, "square");
3109 W_L("list-style-type:");
3120 * It is a handler who processes the UL tag.
3122 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3123 * destination is specified.
3124 * @param node [i] The UL tag node is specified.
3125 * @return The conversion result is returned.
3128 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
3130 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3131 Doc *doc = jxhtml->doc;
3134 if (IS_CSS_ON(jxhtml->entryp)) {
3135 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3142 * It is a handler who processes the HR tag.
3144 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3145 * destination is specified.
3146 * @param node [i] The HR tag node is specified.
3147 * @return The conversion result is returned.
3150 s_jxhtml_start_hr_tag(void *pdoc, Node *node)
3156 char *attr_align = NULL;
3157 char *attr_size = NULL;
3158 char *attr_width = NULL;
3159 char *attr_noshade = NULL;
3160 char *attr_style = NULL;
3161 char *attr_color = NULL;
3163 char *style_float = NULL;
3164 char *style_border_color = NULL;
3166 jxhtml = GET_JXHTML(pdoc);
3170 for (attr = qs_get_attr(doc,node);
3172 attr = qs_get_next_attr(doc,attr)) {
3173 char *name = qs_get_attr_name (doc,attr);
3174 char *value = qs_get_attr_value(doc,attr);
3178 if (strcasecmp(name, "align") == 0) {
3179 /*--------------------------------------------------------------------*/
3181 /*--------------------------------------------------------------------*/
3182 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3190 if (strcasecmp(name, "size") == 0) {
3191 /*--------------------------------------------------------------------*/
3193 /*--------------------------------------------------------------------*/
3194 if (value && *value) {
3198 else if (strcasecmp(name, "style") == 0) {
3199 if (value && *value) {
3207 if (strcasecmp(name, "width") == 0) {
3208 /*--------------------------------------------------------------------*/
3210 /*--------------------------------------------------------------------*/
3211 if (value && *value) {
3219 if (strcasecmp(name, "noshade") == 0) {
3220 /*--------------------------------------------------------------------*/
3222 /*--------------------------------------------------------------------*/
3223 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3229 if (strcasecmp(name, "color") == 0 && value && *value) {
3230 /*--------------------------------------------------------------------*/
3232 /*--------------------------------------------------------------------*/
3241 if (IS_CSS_ON(jxhtml->entryp)) {
3242 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3244 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3245 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3246 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3248 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3249 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3250 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3251 css_property_t *cur;
3253 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3254 if (STRCASEEQ('s','S',"solid",cur->value)) {
3255 attr_noshade = "noshade";
3258 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3259 char *tmp = apr_pstrdup(doc->pool, cur->value);
3260 char *tmpp = strstr(tmp, "px");
3262 attr_size = apr_pstrdup(doc->pool, tmp);
3266 for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
3267 char *tmp = apr_pstrdup(doc->pool,cur->value);
3268 attr_color = apr_pstrdup(doc->pool,tmp);
3271 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3272 char *tmp = apr_pstrdup(doc->pool, cur->value);
3273 char *tmpp = strstr(tmp,"none");
3275 style_float = "center";
3278 style_float = apr_pstrdup(doc->pool,tmp);
3283 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3284 char *tmp = apr_pstrdup(doc->pool, cur->value);
3285 char *tmpp = strstr(tmp, "px");
3287 attr_width = apr_pstrdup(doc->pool, tmp);
3290 tmpp = strstr(tmp, "%");
3292 attr_width = apr_pstrdup(doc->pool, tmp);
3297 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3298 char *tmp = apr_pstrdup(doc->pool, cur->value);
3300 style_border_color = apr_pstrdup(doc->pool, tmp);
3318 if (attr_size || attr_width || attr_noshade || style_border_color) {
3323 if (!strstr(attr_size, "px")) {
3331 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3337 W_L("border-style:solid;");
3339 if(style_border_color){
3340 W_L("border-color:");
3341 W_V(style_border_color);
3359 * It is a handler who processes the HR tag.
3361 * @param jxhtml [i/o] The pointer to the JXHTML structure at the output
3362 * destination is specified.
3363 * @param node [i] The HR tag node is specified.
3364 * @return The conversion result is returned.
3367 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
3369 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3375 * It is a handler who processes the IMG tag.
3377 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3378 * destination is specified.
3379 * @param node [i] The IMG tag node is specified.
3380 * @return The conversion result is returned.
3383 s_jxhtml_start_img_tag(void *pdoc, Node *node)
3385 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3386 Doc *doc = jxhtml->doc;
3387 request_rec *r = doc->r;
3389 char *attr_src = NULL;
3390 char *attr_height = NULL;
3391 char *attr_width = NULL;
3392 char *attr_align = NULL;
3393 char *attr_alt = NULL;
3394 char *attr_style = NULL;
3395 char *attr_hspace = NULL;
3396 char *attr_vspace = NULL;
3398 char *css_float = NULL;
3399 char *css_margin_left = NULL;
3400 char *css_margin_right = NULL;
3401 char *css_margin_top = NULL;
3402 char *css_margin_bottom = NULL;
3403 char *css_display = NULL;
3404 char *css_valign = NULL;
3406 #ifndef IMG_NOT_CONVERT_FILENAME
3407 device_table *spec = jxhtml->spec;
3410 /*--------------------------------------------------------------------------*/
3411 /* Get Attributes */
3412 /*--------------------------------------------------------------------------*/
3413 for (attr = qs_get_attr(doc,node);
3415 attr = qs_get_next_attr(doc,attr)) {
3416 char *name = qs_get_attr_name(doc,attr);
3417 char *value = qs_get_attr_value(doc,attr);
3418 if (STRCASEEQ('s','S',"src",name)) {
3419 /*----------------------------------------------------------------------*/
3421 /*----------------------------------------------------------------------*/
3422 #ifdef IMG_NOT_CONVERT_FILENAME
3423 value = chxj_encoding_parameter(r, value, 1);
3424 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3425 value = chxj_add_cookie_no_update_parameter(r, value);
3428 value = chxj_img_conv(r, spec, value);
3429 value = chxj_encoding_parameter(r, value, 1);
3430 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
3431 value = chxj_add_cookie_no_update_parameter(r, value);
3435 else if (STRCASEEQ('a','A',"align",name)) {
3436 /*----------------------------------------------------------------------*/
3438 /*----------------------------------------------------------------------*/
3440 if (STRCASEEQ('t','T',"top", value) ||
3441 STRCASEEQ('m','M',"middle",value) ||
3442 STRCASEEQ('b','B',"bottom",value)){
3444 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3447 else if (STRCASEEQ('c','C',"center",value)) {
3448 css_valign = apr_pstrdup(doc->pool, "middle");
3452 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3453 /*----------------------------------------------------------------------*/
3455 /*----------------------------------------------------------------------*/
3458 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3459 /*----------------------------------------------------------------------*/
3461 /*----------------------------------------------------------------------*/
3462 attr_height = value;
3464 else if (STRCASEEQ('h','H',"hspace",name)) {
3465 /*----------------------------------------------------------------------*/
3467 /*----------------------------------------------------------------------*/
3468 attr_hspace = value;
3470 else if (STRCASEEQ('v','V',"vspace",name)) {
3471 /*----------------------------------------------------------------------*/
3473 /*----------------------------------------------------------------------*/
3474 attr_vspace = value;
3476 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3477 /*----------------------------------------------------------------------*/
3479 /*----------------------------------------------------------------------*/
3482 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3483 /*----------------------------------------------------------------------*/
3485 /*----------------------------------------------------------------------*/
3490 if (IS_CSS_ON(jxhtml->entryp)) {
3491 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3493 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3494 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3495 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3496 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3497 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3498 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3499 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3502 css_property_t *cur;
3503 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3504 attr_height = apr_pstrdup(doc->pool, cur->value);
3506 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3507 attr_width = apr_pstrdup(doc->pool, cur->value);
3510 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3511 css_valign = apr_pstrdup(doc->pool, cur->value);
3514 if (! attr_hspace) {
3515 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3516 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3518 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3519 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3522 if (! attr_vspace) {
3523 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3524 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3526 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3527 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3531 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3532 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3533 css_float = apr_pstrdup(doc->pool, cur->value);
3537 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3538 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3539 char *tmp = apr_pstrdup(doc->pool, cur->value);
3540 char *tmpp = strstr(tmp, "none");
3542 css_display = apr_pstrdup(doc->pool, tmp);
3554 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3562 W_L("vertical-align:");
3567 W_L("margin-left:");
3570 W_L("margin-right:");
3575 if(css_margin_left){
3576 W_L("margin-left:");
3577 W_V(css_margin_left);
3580 if(css_margin_right){
3581 W_L("margin-right:");
3582 W_V(css_margin_right);
3590 W_L("margin-bottom:");
3597 W_V(css_margin_top);
3600 if(css_margin_bottom){
3601 W_L("margin-bottom:");
3602 W_V(css_margin_bottom);
3607 W_L("display:none;");
3636 * It is a handler who processes the IMG tag.
3638 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3639 * destination is specified.
3640 * @param node [i] The IMG tag node is specified.
3641 * @return The conversion result is returned.
3644 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
3646 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3652 * It is a handler who processes the SELECT tag.
3654 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3655 * destination is specified.
3656 * @param node [i] The SELECT tag node is specified.
3657 * @return The conversion result is returned.
3660 s_jxhtml_start_select_tag(void *pdoc, Node *node)
3662 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3663 Doc *doc = jxhtml->doc;
3667 char *multiple = NULL;
3668 char *attr_style = NULL;
3671 for (attr = qs_get_attr(doc,node);
3673 attr = qs_get_next_attr(doc,attr)) {
3674 char *nm = qs_get_attr_name(doc,attr);
3675 char *val = qs_get_attr_value(doc,attr);
3676 if (STRCASEEQ('s','S',"size",nm)) {
3677 /*----------------------------------------------------------------------*/
3678 /* CHTML 1.0 version 2.0 */
3679 /*----------------------------------------------------------------------*/
3680 size = apr_pstrdup(doc->buf.pool, val);
3682 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3683 /*----------------------------------------------------------------------*/
3684 /* CHTML 1.0 version 2.0 */
3685 /*----------------------------------------------------------------------*/
3686 attr_style = apr_pstrdup(doc->buf.pool, val);
3688 else if (STRCASEEQ('n','N',"name",nm)) {
3689 /*----------------------------------------------------------------------*/
3690 /* CHTML 1.0 version 2.0 */
3691 /*----------------------------------------------------------------------*/
3692 name = apr_pstrdup(doc->buf.pool, val);
3694 else if (STRCASEEQ('m','M',"multiple", nm)) {
3695 /*----------------------------------------------------------------------*/
3696 /* CHTML 1.0 version 2.0 */
3697 /*----------------------------------------------------------------------*/
3698 multiple = apr_pstrdup(doc->buf.pool, val);
3701 if (size && *size) {
3706 if (name && *name) {
3716 if (IS_CSS_ON(jxhtml->entryp)) {
3717 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3725 * It is a handler who processes the SELECT tag.
3727 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3728 * destination is specified.
3729 * @param node [i] The SELECT tag node is specified.
3730 * @return The conversion result is returned.
3733 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
3735 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3736 Doc *doc = jxhtml->doc;
3739 if (IS_CSS_ON(jxhtml->entryp)) {
3740 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3747 * It is a handler who processes the OPTION tag.
3749 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3750 * destination is specified.
3751 * @param node [i] The OPTION tag node is specified.
3752 * @return The conversion result is returned.
3755 s_jxhtml_start_option_tag(void *pdoc, Node *node)
3757 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3758 Doc *doc = jxhtml->doc;
3761 char *selected = NULL;
3763 char *attr_style = NULL;
3766 for (attr = qs_get_attr(doc,node);
3768 attr = qs_get_next_attr(doc,attr)) {
3769 char *nm = qs_get_attr_name(doc,attr);
3770 char *val = qs_get_attr_value(doc,attr);
3771 if (STRCASEEQ('s','S',"selected",nm)) {
3772 /*----------------------------------------------------------------------*/
3773 /* CHTML 1.0 version 2.0 */
3774 /*----------------------------------------------------------------------*/
3775 selected = apr_pstrdup(doc->buf.pool, val);
3777 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3778 /*----------------------------------------------------------------------*/
3779 /* CHTML 1.0 version 2.0 */
3780 /*----------------------------------------------------------------------*/
3781 attr_style = apr_pstrdup(doc->buf.pool, val);
3783 else if (STRCASEEQ('v','V',"value",nm)) {
3784 /*----------------------------------------------------------------------*/
3785 /* CHTML 1.0 version 2.0 */
3786 /*----------------------------------------------------------------------*/
3787 value = apr_pstrdup(doc->buf.pool, val);
3800 if (IS_CSS_ON(jxhtml->entryp)) {
3801 s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
3809 * It is a handler who processes the OPTION tag.
3811 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3812 * destination is specified.
3813 * @param node [i] The OPTION tag node is specified.
3814 * @return The conversion result is returned.
3817 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3819 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3820 Doc *doc = jxhtml->doc;
3823 if (IS_CSS_ON(jxhtml->entryp)) {
3824 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
3832 * It is a handler who processes the DIV tag.
3834 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
3835 * destination is specified.
3836 * @param node [i] The DIV tag node is specified.
3837 * @return The conversion result is returned.
3840 s_jxhtml_start_div_tag(void *pdoc, Node *node)
3846 char *attr_style = NULL;
3847 char *attr_align = NULL;
3848 char *attr_display = NULL;
3849 char *attr_decoration = NULL;
3850 char *attr_wap_marquee_style = NULL;
3851 char *attr_wap_marquee_dir = NULL;
3852 char *attr_wap_marquee_loop = NULL;
3853 char *attr_color = NULL;
3854 char *attr_bgcolor = NULL;
3855 char *attr_font_size = NULL;
3856 char *css_clear = NULL;
3858 jxhtml = GET_JXHTML(pdoc);
3862 for (attr = qs_get_attr(doc,node);
3864 attr = qs_get_next_attr(doc,attr)) {
3865 char *nm = qs_get_attr_name(doc,attr);
3866 char *val = qs_get_attr_value(doc,attr);
3867 if (STRCASEEQ('a','A',"align",nm)) {
3868 /*----------------------------------------------------------------------*/
3869 /* CHTML 1.0 (W3C version 3.2) */
3870 /*----------------------------------------------------------------------*/
3871 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3872 attr_align = apr_pstrdup(doc->buf.pool, val);
3875 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3876 attr_style = apr_pstrdup(doc->buf.pool, val);
3880 if (IS_CSS_ON(jxhtml->entryp)) {
3881 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3883 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3884 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3885 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3886 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3887 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3888 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3889 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3890 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3892 css_property_t *cur;
3893 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3894 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3895 attr_display = apr_pstrdup(doc->pool, cur->value);
3898 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3899 if (STRCASEEQ('b','B',"blink", cur->value)) {
3900 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3903 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3904 attr_color = apr_pstrdup(doc->pool, cur->value);
3906 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3907 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3908 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3910 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3911 char *ss = strchr(cur->value, '#');
3913 ss = strstr(cur->value, "rgb");
3916 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3917 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3920 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3921 attr_align = apr_pstrdup(doc->pool, cur->value);
3923 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3924 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3925 || STRCASEEQ('x','X',"x-small",cur->value)
3926 || STRCASEEQ('s','S',"small",cur->value)
3927 || STRCASEEQ('m','M',"medium",cur->value)
3928 || STRCASEEQ('l','L',"large",cur->value)
3929 || STRCASEEQ('x','X',"x-large",cur->value)
3930 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3931 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3935 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3936 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3937 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3938 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3939 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3940 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3943 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3944 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3945 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3947 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3948 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3951 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3952 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
3953 attr_wap_marquee_loop = "infinite";
3956 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3960 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3961 css_clear = apr_pstrdup(doc->pool, cur->value);
3969 || attr_wap_marquee_style
3970 || attr_wap_marquee_dir
3971 || attr_wap_marquee_loop
3987 if (attr_decoration) {
3988 W_L("text-decoration:");
3989 W_V(attr_decoration);
3992 if (attr_wap_marquee_style) {
3993 W_L("-wap-marquee-style:");
3994 W_V(attr_wap_marquee_style);
3997 if (attr_wap_marquee_dir) {
3998 W_L("-wap-marquee-dir:");
3999 W_V(attr_wap_marquee_dir);
4002 if (attr_wap_marquee_loop) {
4003 W_L("-wap-marquee-loop:");
4004 W_V(attr_wap_marquee_loop);
4013 W_L("background-color:");
4017 if (attr_font_size) {
4019 W_V(attr_font_size);
4035 * It is a handler who processes the DIV tag.
4037 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4038 * destination is specified.
4039 * @param node [i] The DIV tag node is specified.
4040 * @return The conversion result is returned.
4043 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
4049 jxhtml = GET_JXHTML(pdoc);
4054 if (IS_CSS_ON(jxhtml->entryp)) {
4055 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4062 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
4069 jxhtml = GET_JXHTML(pdoc);
4073 for (child = qs_get_child_node(doc, node);
4075 child = qs_get_next_node(doc, child)) {
4077 s_jxhtml_chxjif_tag(jxhtml, child);
4084 * It is a handler who processes the TEXTARE tag.
4086 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4087 * destination is specified.
4088 * @param node [i] The TEXTAREA tag node is specified.
4089 * @return The conversion result is returned.
4092 s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
4098 char *attr_accesskey = NULL;
4099 char *attr_name = NULL;
4100 char *attr_rows = NULL;
4101 char *attr_cols = NULL;
4102 char *attr_istyle = NULL;
4103 char *attr_style = NULL;
4106 jxhtml = GET_JXHTML(pdoc);
4110 jxhtml->textarea_flag++;
4111 for (attr = qs_get_attr(doc,node);
4113 attr = qs_get_next_attr(doc,attr)) {
4114 char *name = qs_get_attr_name(doc,attr);
4115 char *value = qs_get_attr_value(doc,attr);
4116 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4117 attr_accesskey = value;
4119 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4120 attr_istyle = value;
4122 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4125 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4128 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4131 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4135 if (IS_CSS_ON(jxhtml->entryp)) {
4136 css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
4138 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4139 css_property_t *cur;
4140 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4141 if (strcasestr(cur->value, "<ja:n>")) {
4144 else if (strcasestr(cur->value, "<ja:en>")) {
4147 else if (strcasestr(cur->value, "<ja:hk>")) {
4150 else if (strcasestr(cur->value, "<ja:h>")) {
4157 if (attr_accesskey) {
4158 W_L(" accesskey=\"");
4159 W_V(attr_accesskey);
4188 * It is a handler who processes the TEXTAREA tag.
4190 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4191 * destination is specified.
4192 * @param node [i] The TEXTAREA tag node is specified.
4193 * @return The conversion result is returned.
4196 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4202 jxhtml = GET_JXHTML(pdoc);
4207 jxhtml->textarea_flag--;
4214 * It is a handler who processes the B tag.
4216 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4217 * destination is specified.
4218 * @param node [i] The B tag node is specified.
4219 * @return The conversion result is returned.
4222 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
4228 jxhtml = GET_JXHTML(pdoc);
4238 * It is a handler who processes the B tag.
4240 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4241 * destination is specified.
4242 * @param node [i] The B tag node is specified.
4243 * @return The conversion result is returned.
4246 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
4248 jxhtml_t* jxhtml = GET_JXHTML(pdoc);
4249 Doc* doc = jxhtml->doc;
4256 s_jxhtml_text_tag(void* pdoc, Node* child)
4267 apr_size_t z2h_input_len;
4269 jxhtml = GET_JXHTML(pdoc);
4273 textval = qs_get_node_value(doc,child);
4274 if (strlen(textval) == 0) {
4278 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4279 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4281 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4282 memset(one_byte, 0, sizeof(one_byte));
4285 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4287 int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
4289 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4294 if (is_sjis_kanji(textval[ii])) {
4295 one_byte[0] = textval[ii+0];
4296 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4297 one_byte[0] = textval[ii+1];
4298 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4302 if (jxhtml->pre_flag) {
4303 one_byte[0] = textval[ii+0];
4304 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4307 if (jxhtml->textarea_flag) {
4308 one_byte[0] = textval[ii+0];
4309 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4312 if (textval[ii] != '\r' && textval[ii] != '\n') {
4313 one_byte[0] = textval[ii+0];
4314 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4318 z2h_input_len = strlen(tdst);
4319 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
4327 * It is a handler who processes the BLOCKQUOTE tag.
4329 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4330 * destination is specified.
4331 * @param node [i] The BLOCKQUOTE tag node is specified.
4332 * @return The conversion result is returned.
4335 s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
4340 char *attr_style = NULL;
4341 char *attr_color = NULL;
4342 char *attr_size = NULL;
4344 jxhtml = GET_JXHTML(pdoc);
4346 for (attr = qs_get_attr(doc,node);
4348 attr = qs_get_next_attr(doc,attr)) {
4349 char *nm = qs_get_attr_name(doc,attr);
4350 char *val = qs_get_attr_value(doc,attr);
4351 if (val && STRCASEEQ('s','S',"style", nm)) {
4355 if (IS_CSS_ON(jxhtml->entryp)) {
4356 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4358 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4359 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4360 css_property_t *cur;
4361 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4362 if (cur->value && *cur->value) {
4363 attr_color = apr_pstrdup(doc->pool, cur->value);
4366 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4367 if (cur->value && *cur->value) {
4368 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4369 attr_size = apr_pstrdup(doc->pool, cur->value);
4371 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4372 attr_size = apr_pstrdup(doc->pool, cur->value);
4374 else if (STRCASEEQ('s','S',"small",cur->value)) {
4375 attr_size = apr_pstrdup(doc->pool, cur->value);
4377 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4378 attr_size = apr_pstrdup(doc->pool, cur->value);
4380 else if (STRCASEEQ('l','L',"large",cur->value)) {
4381 attr_size = apr_pstrdup(doc->pool, cur->value);
4383 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4384 attr_size = apr_pstrdup(doc->pool, cur->value);
4386 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4387 attr_size = apr_pstrdup(doc->pool, cur->value);
4394 if (attr_color || attr_size) {
4397 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4415 * It is a handler who processes the BLOCKQUOTE tag.
4417 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4418 * destination is specified.
4419 * @param node [i] The BLOCKQUOTE tag node is specified.
4420 * @return The conversion result is returned.
4423 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4425 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4426 Doc *doc = jxhtml->doc;
4427 W_L("</blockquote>");
4428 if (IS_CSS_ON(jxhtml->entryp)) {
4429 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4436 * It is a handler who processes the DIR tag.
4438 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4439 * destination is specified.
4440 * @param node [i] The DIR tag node is specified.
4441 * @return The conversion result is returned.
4444 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
4446 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4447 Doc *doc = jxhtml->doc;
4449 char *attr_style = NULL;
4450 char *attr_color = NULL;
4451 char *attr_type = NULL;
4452 char *attr_size = NULL;
4453 for (attr = qs_get_attr(doc,node);
4455 attr = qs_get_next_attr(doc,attr)) {
4456 char *name = qs_get_attr_name(doc,attr);
4457 char *value = qs_get_attr_value(doc,attr);
4458 if (STRCASEEQ('t','T',"type",name)) {
4459 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4463 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4467 if (IS_CSS_ON(jxhtml->entryp)) {
4468 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4470 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4471 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4472 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4473 css_property_t *cur;
4474 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4475 if (cur->value && *cur->value) {
4476 attr_color = apr_pstrdup(doc->pool, cur->value);
4479 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4480 if (cur->value && *cur->value) {
4481 attr_type = apr_pstrdup(doc->pool, cur->value);
4484 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4485 if (cur->value && *cur->value) {
4486 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4487 attr_size = apr_pstrdup(doc->pool, cur->value);
4489 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4490 attr_size = apr_pstrdup(doc->pool, cur->value);
4492 else if (STRCASEEQ('s','S',"small",cur->value)) {
4493 attr_size = apr_pstrdup(doc->pool, cur->value);
4495 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4496 attr_size = apr_pstrdup(doc->pool, cur->value);
4498 else if (STRCASEEQ('l','L',"large",cur->value)) {
4499 attr_size = apr_pstrdup(doc->pool, cur->value);
4501 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4502 attr_size = apr_pstrdup(doc->pool, cur->value);
4504 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4505 attr_size = apr_pstrdup(doc->pool, cur->value);
4512 if (attr_type || attr_color || attr_size) {
4515 W_L("list-style-type:");
4520 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4538 * It is a handler who processes the DIR tag.
4540 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4541 * destination is specified.
4542 * @param node [i] The DIR tag node is specified.
4543 * @return The conversion result is returned.
4546 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
4548 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4549 Doc *doc = jxhtml->doc;
4551 if (IS_CSS_ON(jxhtml->entryp)) {
4552 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4559 * It is a handler who processes the DL tag.
4561 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4562 * destination is specified.
4563 * @param node [i] The DL tag node is specified.
4564 * @return The conversion result is returned.
4567 s_jxhtml_start_dl_tag(void *pdoc, Node *node)
4569 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4570 Doc *doc = jxhtml->doc;
4572 char *attr_style = NULL;
4573 char *attr_color = NULL;
4574 char *attr_size = NULL;
4575 for (attr = qs_get_attr(doc,node);
4577 attr = qs_get_next_attr(doc,attr)) {
4578 char *name = qs_get_attr_name(doc,attr);
4579 char *value = qs_get_attr_value(doc,attr);
4580 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4584 if (IS_CSS_ON(jxhtml->entryp)) {
4585 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4587 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4588 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4589 css_property_t *cur;
4590 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4591 if (cur->value && *cur->value) {
4592 attr_color = apr_pstrdup(doc->pool, cur->value);
4595 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4596 if (cur->value && *cur->value) {
4597 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4598 attr_size = apr_pstrdup(doc->pool, cur->value);
4600 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4601 attr_size = apr_pstrdup(doc->pool, cur->value);
4603 else if (STRCASEEQ('s','S',"small",cur->value)) {
4604 attr_size = apr_pstrdup(doc->pool, cur->value);
4606 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4607 attr_size = apr_pstrdup(doc->pool, cur->value);
4609 else if (STRCASEEQ('l','L',"large",cur->value)) {
4610 attr_size = apr_pstrdup(doc->pool, cur->value);
4612 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4613 attr_size = apr_pstrdup(doc->pool, cur->value);
4615 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4616 attr_size = apr_pstrdup(doc->pool, cur->value);
4623 if (attr_color || attr_size) {
4626 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4644 * It is a handler who processes the DL tag.
4646 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4647 * destination is specified.
4648 * @param node [i] The DL tag node is specified.
4649 * @return The conversion result is returned.
4652 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
4654 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4655 Doc *doc = jxhtml->doc;
4657 if (IS_CSS_ON(jxhtml->entryp)) {
4658 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4665 * It is a handler who processes the DT tag.
4667 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4668 * destination is specified.
4669 * @param node [i] The DT tag node is specified.
4670 * @return The conversion result is returned.
4673 s_jxhtml_start_dt_tag(void *pdoc, Node *node)
4675 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4676 Doc *doc = jxhtml->doc;
4678 char *attr_style = NULL;
4679 char *attr_color = NULL;
4680 char *attr_size = NULL;
4681 for (attr = qs_get_attr(doc,node);
4683 attr = qs_get_next_attr(doc,attr)) {
4684 char *name = qs_get_attr_name(doc,attr);
4685 char *value = qs_get_attr_value(doc,attr);
4686 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4690 if (IS_CSS_ON(jxhtml->entryp)) {
4691 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4693 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4694 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4695 css_property_t *cur;
4696 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4697 if (cur->value && *cur->value) {
4698 attr_color = apr_pstrdup(doc->pool, cur->value);
4701 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4702 if (cur->value && *cur->value) {
4703 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4704 attr_size = apr_pstrdup(doc->pool, cur->value);
4706 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4707 attr_size = apr_pstrdup(doc->pool, cur->value);
4709 else if (STRCASEEQ('s','S',"small",cur->value)) {
4710 attr_size = apr_pstrdup(doc->pool, cur->value);
4712 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4713 attr_size = apr_pstrdup(doc->pool, cur->value);
4715 else if (STRCASEEQ('l','L',"large",cur->value)) {
4716 attr_size = apr_pstrdup(doc->pool, cur->value);
4718 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4719 attr_size = apr_pstrdup(doc->pool, cur->value);
4721 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4722 attr_size = apr_pstrdup(doc->pool, cur->value);
4729 if (attr_color || attr_size) {
4732 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4750 * It is a handler who processes the DT tag.
4752 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4753 * destination is specified.
4754 * @param node [i] The DT tag node is specified.
4755 * @return The conversion result is returned.
4758 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
4760 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4761 Doc *doc = jxhtml->doc;
4763 if (IS_CSS_ON(jxhtml->entryp)) {
4764 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4771 * It is a handler who processes the DD tag.
4773 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4774 * destination is specified.
4775 * @param node [i] The DD tag node is specified.
4776 * @return The conversion result is returned.
4779 s_jxhtml_start_dd_tag(void *pdoc, Node *node)
4781 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4782 Doc *doc = jxhtml->doc;
4784 char *attr_style = NULL;
4785 char *attr_color = NULL;
4786 char *attr_size = NULL;
4787 for (attr = qs_get_attr(doc,node);
4789 attr = qs_get_next_attr(doc,attr)) {
4790 char *name = qs_get_attr_name(doc,attr);
4791 char *value = qs_get_attr_value(doc,attr);
4792 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4796 if (IS_CSS_ON(jxhtml->entryp)) {
4797 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4799 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4800 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4801 css_property_t *cur;
4802 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4803 if (cur->value && *cur->value) {
4804 attr_color = apr_pstrdup(doc->pool, cur->value);
4807 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4808 if (cur->value && *cur->value) {
4809 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4810 attr_size = apr_pstrdup(doc->pool, cur->value);
4812 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4813 attr_size = apr_pstrdup(doc->pool, cur->value);
4815 else if (STRCASEEQ('s','S',"small",cur->value)) {
4816 attr_size = apr_pstrdup(doc->pool, cur->value);
4818 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4819 attr_size = apr_pstrdup(doc->pool, cur->value);
4821 else if (STRCASEEQ('l','L',"large",cur->value)) {
4822 attr_size = apr_pstrdup(doc->pool, cur->value);
4824 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4825 attr_size = apr_pstrdup(doc->pool, cur->value);
4827 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4828 attr_size = apr_pstrdup(doc->pool, cur->value);
4835 if (attr_color || attr_size) {
4838 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4856 * It is a handler who processes the DD tag.
4858 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4859 * destination is specified.
4860 * @param node [i] The DD tag node is specified.
4861 * @return The conversion result is returned.
4864 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
4866 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
4867 Doc *doc = jxhtml->doc;
4869 if (IS_CSS_ON(jxhtml->entryp)) {
4870 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4877 * It is a handler who processes the H1 tag.
4879 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4880 * destination is specified.
4881 * @param node [i] The H1 tag node is specified.
4882 * @return The conversion result is returned.
4885 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
4891 char *attr_style = NULL;
4892 char *attr_align = NULL;
4893 char *css_clear = NULL;
4895 jxhtml = GET_JXHTML(pdoc);
4899 for (attr = qs_get_attr(doc,node);
4901 attr = qs_get_next_attr(doc,attr)) {
4902 char *name = qs_get_attr_name(doc,attr);
4903 char *value = qs_get_attr_value(doc,attr);
4904 if (STRCASEEQ('a','A',"align", name)) {
4905 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4909 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4913 if (IS_CSS_ON(jxhtml->entryp)) {
4914 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
4916 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4917 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4918 css_property_t *cur;
4919 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4920 if (STRCASEEQ('l','L',"left", cur->value)) {
4921 attr_align = apr_pstrdup(doc->pool, "left");
4923 else if (STRCASEEQ('c','C',"center",cur->value)) {
4924 attr_align = apr_pstrdup(doc->pool, "center");
4926 else if (STRCASEEQ('r','R',"right",cur->value)) {
4927 attr_align = apr_pstrdup(doc->pool, "right");
4930 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4931 if (STRCASEEQ('b','B',"both", cur->value)) {
4932 css_clear = apr_pstrdup(doc->pool, "both");
4934 else if (STRCASEEQ('r','R',"right", cur->value)) {
4935 css_clear = apr_pstrdup(doc->pool, "right");
4937 else if (STRCASEEQ('l','L',"left", cur->value)) {
4938 css_clear = apr_pstrdup(doc->pool, "left");
4944 if (attr_align || css_clear ) {
4965 * It is a handler who processes the H1 tag.
4967 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4968 * destination is specified.
4969 * @param node [i] The H1 tag node is specified.
4970 * @return The conversion result is returned.
4973 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
4979 jxhtml = GET_JXHTML(pdoc);
4984 if (IS_CSS_ON(jxhtml->entryp)) {
4985 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
4993 * It is a handler who processes the H2 tag.
4995 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
4996 * destination is specified.
4997 * @param node [i] The H1 tag node is specified.
4998 * @return The conversion result is returned.
5001 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
5007 char *attr_style = NULL;
5008 char *attr_align = NULL;
5009 char *css_clear = NULL;
5011 jxhtml = GET_JXHTML(pdoc);
5015 for (attr = qs_get_attr(doc,node);
5017 attr = qs_get_next_attr(doc,attr)) {
5018 char *name = qs_get_attr_name(doc,attr);
5019 char *value = qs_get_attr_value(doc,attr);
5020 if (STRCASEEQ('a','A',"align", name)) {
5021 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5025 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5029 if (IS_CSS_ON(jxhtml->entryp)) {
5030 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5032 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5033 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5034 css_property_t *cur;
5035 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5036 if (STRCASEEQ('l','L',"left", cur->value)) {
5037 attr_align = apr_pstrdup(doc->pool, "left");
5039 else if (STRCASEEQ('c','C',"center",cur->value)) {
5040 attr_align = apr_pstrdup(doc->pool, "center");
5042 else if (STRCASEEQ('r','R',"right",cur->value)) {
5043 attr_align = apr_pstrdup(doc->pool, "right");
5046 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5047 if (STRCASEEQ('b','B',"both", cur->value)) {
5048 css_clear = apr_pstrdup(doc->pool, "both");
5050 else if (STRCASEEQ('r','R',"right", cur->value)) {
5051 css_clear = apr_pstrdup(doc->pool, "right");
5053 else if (STRCASEEQ('l','L',"left", cur->value)) {
5054 css_clear = apr_pstrdup(doc->pool, "left");
5060 if (attr_align || css_clear ) {
5081 * It is a handler who processes the H2 tag.
5083 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5084 * destination is specified.
5085 * @param node [i] The H1 tag node is specified.
5086 * @return The conversion result is returned.
5089 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
5095 jxhtml = GET_JXHTML(pdoc);
5100 if (IS_CSS_ON(jxhtml->entryp)) {
5101 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5108 * It is a handler who processes the H3 tag.
5110 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5111 * destination is specified.
5112 * @param node [i] The H1 tag node is specified.
5113 * @return The conversion result is returned.
5116 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
5122 char *attr_style = NULL;
5123 char *attr_align = NULL;
5124 char *css_clear = NULL;
5126 jxhtml = GET_JXHTML(pdoc);
5130 for (attr = qs_get_attr(doc,node);
5132 attr = qs_get_next_attr(doc,attr)) {
5133 char *name = qs_get_attr_name(doc,attr);
5134 char *value = qs_get_attr_value(doc,attr);
5135 if (STRCASEEQ('a','A',"align", name)) {
5136 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5140 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5144 if (IS_CSS_ON(jxhtml->entryp)) {
5145 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5147 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5148 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5149 css_property_t *cur;
5150 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5151 if (STRCASEEQ('l','L',"left", cur->value)) {
5152 attr_align = apr_pstrdup(doc->pool, "left");
5154 else if (STRCASEEQ('c','C',"center",cur->value)) {
5155 attr_align = apr_pstrdup(doc->pool, "center");
5157 else if (STRCASEEQ('r','R',"right",cur->value)) {
5158 attr_align = apr_pstrdup(doc->pool, "right");
5161 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5162 if (STRCASEEQ('b','B',"both", cur->value)) {
5163 css_clear = apr_pstrdup(doc->pool, "both");
5165 else if (STRCASEEQ('r','R',"right", cur->value)) {
5166 css_clear = apr_pstrdup(doc->pool, "right");
5168 else if (STRCASEEQ('l','L',"left", cur->value)) {
5169 css_clear = apr_pstrdup(doc->pool, "left");
5175 if (attr_align || css_clear ) {
5196 * It is a handler who processes the H3 tag.
5198 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5199 * destination is specified.
5200 * @param node [i] The H1 tag node is specified.
5201 * @return The conversion result is returned.
5204 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
5210 jxhtml = GET_JXHTML(pdoc);
5215 if (IS_CSS_ON(jxhtml->entryp)) {
5216 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5223 * It is a handler who processes the H4 tag.
5225 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5226 * destination is specified.
5227 * @param node [i] The H1 tag node is specified.
5228 * @return The conversion result is returned.
5231 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
5237 char *attr_style = NULL;
5238 char *attr_align = NULL;
5239 char *css_clear = NULL;
5241 jxhtml = GET_JXHTML(pdoc);
5245 for (attr = qs_get_attr(doc,node);
5247 attr = qs_get_next_attr(doc,attr)) {
5248 char *name = qs_get_attr_name(doc,attr);
5249 char *value = qs_get_attr_value(doc,attr);
5250 if (STRCASEEQ('a','A',"align", name)) {
5251 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5255 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5259 if (IS_CSS_ON(jxhtml->entryp)) {
5260 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5262 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5263 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5264 css_property_t *cur;
5265 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5266 if (STRCASEEQ('l','L',"left", cur->value)) {
5267 attr_align = apr_pstrdup(doc->pool, "left");
5269 else if (STRCASEEQ('c','C',"center",cur->value)) {
5270 attr_align = apr_pstrdup(doc->pool, "center");
5272 else if (STRCASEEQ('r','R',"right",cur->value)) {
5273 attr_align = apr_pstrdup(doc->pool, "right");
5276 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5277 if (STRCASEEQ('b','B',"both", cur->value)) {
5278 css_clear = apr_pstrdup(doc->pool, "both");
5280 else if (STRCASEEQ('r','R',"right", cur->value)) {
5281 css_clear = apr_pstrdup(doc->pool, "right");
5283 else if (STRCASEEQ('l','L',"left", cur->value)) {
5284 css_clear = apr_pstrdup(doc->pool, "left");
5290 if (attr_align || css_clear ) {
5311 * It is a handler who processes the H4 tag.
5313 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5314 * destination is specified.
5315 * @param node [i] The H1 tag node is specified.
5316 * @return The conversion result is returned.
5319 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
5325 jxhtml = GET_JXHTML(pdoc);
5330 if (IS_CSS_ON(jxhtml->entryp)) {
5331 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5339 * It is a handler who processes the H5 tag.
5341 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5342 * destination is specified.
5343 * @param node [i] The H1 tag node is specified.
5344 * @return The conversion result is returned.
5347 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
5353 char *attr_style = NULL;
5354 char *attr_align = NULL;
5355 char *css_clear = NULL;
5357 jxhtml = GET_JXHTML(pdoc);
5361 for (attr = qs_get_attr(doc,node);
5363 attr = qs_get_next_attr(doc,attr)) {
5364 char *name = qs_get_attr_name(doc,attr);
5365 char *value = qs_get_attr_value(doc,attr);
5366 if (STRCASEEQ('a','A',"align", name)) {
5367 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5371 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5375 if (IS_CSS_ON(jxhtml->entryp)) {
5376 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5378 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5379 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5380 css_property_t *cur;
5381 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5382 if (STRCASEEQ('l','L',"left", cur->value)) {
5383 attr_align = apr_pstrdup(doc->pool, "left");
5385 else if (STRCASEEQ('c','C',"center",cur->value)) {
5386 attr_align = apr_pstrdup(doc->pool, "center");
5388 else if (STRCASEEQ('r','R',"right",cur->value)) {
5389 attr_align = apr_pstrdup(doc->pool, "right");
5392 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5393 if (STRCASEEQ('b','B',"both", cur->value)) {
5394 css_clear = apr_pstrdup(doc->pool, "both");
5396 else if (STRCASEEQ('r','R',"right", cur->value)) {
5397 css_clear = apr_pstrdup(doc->pool, "right");
5399 else if (STRCASEEQ('l','L',"left", cur->value)) {
5400 css_clear = apr_pstrdup(doc->pool, "left");
5406 if (attr_align || css_clear ) {
5427 * It is a handler who processes the H5 tag.
5429 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5430 * destination is specified.
5431 * @param node [i] The H1 tag node is specified.
5432 * @return The conversion result is returned.
5435 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
5441 jxhtml = GET_JXHTML(pdoc);
5446 if (IS_CSS_ON(jxhtml->entryp)) {
5447 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5455 * It is a handler who processes the H6 tag.
5457 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5458 * destination is specified.
5459 * @param node [i] The H1 tag node is specified.
5460 * @return The conversion result is returned.
5463 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
5469 char *attr_style = NULL;
5470 char *attr_align = NULL;
5471 char *css_clear = NULL;
5473 jxhtml = GET_JXHTML(pdoc);
5477 for (attr = qs_get_attr(doc,node);
5479 attr = qs_get_next_attr(doc,attr)) {
5480 char *name = qs_get_attr_name(doc,attr);
5481 char *value = qs_get_attr_value(doc,attr);
5482 if (STRCASEEQ('a','A',"align", name)) {
5483 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5487 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5491 if (IS_CSS_ON(jxhtml->entryp)) {
5492 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5494 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5495 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5496 css_property_t *cur;
5497 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5498 if (STRCASEEQ('l','L',"left", cur->value)) {
5499 attr_align = apr_pstrdup(doc->pool, "left");
5501 else if (STRCASEEQ('c','C',"center",cur->value)) {
5502 attr_align = apr_pstrdup(doc->pool, "center");
5504 else if (STRCASEEQ('r','R',"right",cur->value)) {
5505 attr_align = apr_pstrdup(doc->pool, "right");
5508 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5509 if (STRCASEEQ('b','B',"both", cur->value)) {
5510 css_clear = apr_pstrdup(doc->pool, "both");
5512 else if (STRCASEEQ('r','R',"right", cur->value)) {
5513 css_clear = apr_pstrdup(doc->pool, "right");
5515 else if (STRCASEEQ('l','L',"left", cur->value)) {
5516 css_clear = apr_pstrdup(doc->pool, "left");
5522 if (attr_align || css_clear ) {
5543 * It is a handler who processes the H6 tag.
5545 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5546 * destination is specified.
5547 * @param node [i] The H1 tag node is specified.
5548 * @return The conversion result is returned.
5551 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
5557 jxhtml = GET_JXHTML(pdoc);
5562 if (IS_CSS_ON(jxhtml->entryp)) {
5563 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5571 * It is a handler who processes the MENU tag.
5573 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5574 * destination is specified.
5575 * @param node [i] The MENU tag node is specified.
5576 * @return The conversion result is returned.
5579 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
5581 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5582 Doc *doc = jxhtml->doc;
5584 char *attr_style = NULL;
5585 char *attr_color = NULL;
5586 char *attr_type = NULL;
5587 char *attr_size = NULL;
5588 for (attr = qs_get_attr(doc,node);
5590 attr = qs_get_next_attr(doc,attr)) {
5591 char *name = qs_get_attr_name(doc,attr);
5592 char *value = qs_get_attr_value(doc,attr);
5593 if (STRCASEEQ('t','T',"type",name)) {
5594 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5598 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5602 if (IS_CSS_ON(jxhtml->entryp)) {
5603 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5605 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5606 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5607 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5608 css_property_t *cur;
5609 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5610 if (cur->value && *cur->value) {
5611 attr_color = apr_pstrdup(doc->pool, cur->value);
5614 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5615 if (cur->value && *cur->value) {
5616 attr_type = apr_pstrdup(doc->pool, cur->value);
5619 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5620 if (cur->value && *cur->value) {
5621 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5622 attr_size = apr_pstrdup(doc->pool, cur->value);
5624 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5625 attr_size = apr_pstrdup(doc->pool, cur->value);
5627 else if (STRCASEEQ('s','S',"small",cur->value)) {
5628 attr_size = apr_pstrdup(doc->pool, cur->value);
5630 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5631 attr_size = apr_pstrdup(doc->pool, cur->value);
5633 else if (STRCASEEQ('l','L',"large",cur->value)) {
5634 attr_size = apr_pstrdup(doc->pool, cur->value);
5636 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5637 attr_size = apr_pstrdup(doc->pool, cur->value);
5639 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5640 attr_size = apr_pstrdup(doc->pool, cur->value);
5647 if (attr_type || attr_color || attr_size) {
5650 W_L("list-style-type:");
5655 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5673 * It is a handler who processes the MENU tag.
5675 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5676 * destination is specified.
5677 * @param node [i] The MENU tag node is specified.
5678 * @return The conversion result is returned.
5681 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
5683 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5684 Doc *doc = jxhtml->doc;
5686 if (IS_CSS_ON(jxhtml->entryp)) {
5687 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5694 * It is a handler who processes the PLAINTEXT tag.
5696 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5697 * destination is specified.
5698 * @param node [i] The PLAINTEXT tag node is specified.
5699 * @return The conversion result is returned.
5702 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
5707 jxhtml = GET_JXHTML(pdoc);
5710 s_jxhtml_start_plaintext_tag_inner(pdoc,node);
5715 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
5720 jxhtml = GET_JXHTML(pdoc);
5722 for (child = qs_get_child_node(doc, node);
5724 child = qs_get_next_node(doc, child)) {
5726 s_jxhtml_start_plaintext_tag_inner(pdoc, child);
5733 * It is a handler who processes the PLAINTEXT tag.
5735 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5736 * destination is specified.
5737 * @param node [i] The PLAINTEXT tag node is specified.
5738 * @return The conversion result is returned.
5741 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5743 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5749 * It is a handler who processes the BLINK tag.
5751 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5752 * destination is specified.
5753 * @param node [i] The BLINK tag node is specified.
5754 * @return The conversion result is returned.
5757 s_jxhtml_start_blink_tag(void *pdoc, Node *node)
5759 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5760 Doc *doc = jxhtml->doc;
5762 char *attr_style = NULL;
5763 char *attr_color = NULL;
5764 char *attr_size = NULL;
5765 for (attr = qs_get_attr(doc,node);
5767 attr = qs_get_next_attr(doc,attr)) {
5768 char *name = qs_get_attr_name(doc,attr);
5769 char *value = qs_get_attr_value(doc,attr);
5770 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5774 if (IS_CSS_ON(jxhtml->entryp)) {
5775 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5777 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5778 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5779 css_property_t *cur;
5780 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5781 if (cur->value && *cur->value) {
5782 attr_color = apr_pstrdup(doc->pool, cur->value);
5785 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5786 if (cur->value && *cur->value) {
5787 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5788 attr_size = apr_pstrdup(doc->pool, cur->value);
5790 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5791 attr_size = apr_pstrdup(doc->pool, cur->value);
5793 else if (STRCASEEQ('s','S',"small",cur->value)) {
5794 attr_size = apr_pstrdup(doc->pool, cur->value);
5796 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5797 attr_size = apr_pstrdup(doc->pool, cur->value);
5799 else if (STRCASEEQ('l','L',"large",cur->value)) {
5800 attr_size = apr_pstrdup(doc->pool, cur->value);
5802 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5803 attr_size = apr_pstrdup(doc->pool, cur->value);
5805 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5806 attr_size = apr_pstrdup(doc->pool, cur->value);
5813 if (attr_color || attr_size) {
5816 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5834 * It is a handler who processes the BLINK tag.
5836 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5837 * destination is specified.
5838 * @param node [i] The BLINK tag node is specified.
5839 * @return The conversion result is returned.
5842 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
5844 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5845 Doc *doc = jxhtml->doc;
5847 if (IS_CSS_ON(jxhtml->entryp)) {
5848 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5855 * It is a handler who processes the MARQUEE tag.
5857 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5858 * destination is specified.
5859 * @param node [i] The MARQUEE tag node is specified.
5860 * @return The conversion result is returned.
5863 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
5865 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5866 Doc *doc = jxhtml->doc;
5868 char *attr_direction = NULL;
5869 char *attr_style = NULL;
5870 char *attr_color = NULL;
5871 char *attr_size = NULL;
5872 char *attr_bgcolor = NULL;
5873 /*--------------------------------------------------------------------------*/
5874 /* Get Attributes */
5875 /*--------------------------------------------------------------------------*/
5876 for (attr = qs_get_attr(doc,node);
5878 attr = qs_get_next_attr(doc,attr)) {
5879 char *name = qs_get_attr_name(doc,attr);
5880 char *value = qs_get_attr_value(doc,attr);
5881 if (STRCASEEQ('d','D',"direction", name)) {
5883 if (STRCASEEQ('l','L',"left",value)) {
5884 attr_direction = "rtl";
5886 else if (STRCASEEQ('r','R',"right",value)) {
5887 attr_direction = "ltr";
5891 else if (STRCASEEQ('b','B',"behavior",name)) {
5894 else if (STRCASEEQ('l','L',"loop",name)) {
5897 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5898 if (value && *value) {
5899 attr_bgcolor = value;
5902 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5906 if (IS_CSS_ON(jxhtml->entryp)) {
5907 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
5909 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5910 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5911 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5912 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5913 css_property_t *cur;
5914 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5915 if (cur->value && *cur->value) {
5916 attr_color = apr_pstrdup(doc->pool, cur->value);
5919 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5920 if (cur->value && *cur->value) {
5921 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5924 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5925 if (cur->value && *cur->value) {
5926 attr_direction = apr_pstrdup(doc->pool, cur->value);
5929 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5930 if (cur->value && *cur->value) {
5931 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5932 || STRCASEEQ('x','X',"x-small", cur->value)
5933 || STRCASEEQ('s','S',"small", cur->value)
5934 || STRCASEEQ('m','M',"medium", cur->value)
5935 || STRCASEEQ('l','L',"large", cur->value)
5936 || STRCASEEQ('x','X',"x-large", cur->value)
5937 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5938 attr_size = apr_pstrdup(doc->pool, cur->value);
5945 if (attr_color || attr_size || attr_direction || attr_bgcolor) {
5947 if (attr_direction) {
5948 W_L("-wap-marquee-dir:");
5949 W_V(attr_direction);
5953 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5954 W_L("background-color:");
5959 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5978 * It is a handler who processes the MARQUEE tag.
5980 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
5981 * destination is specified.
5982 * @param node [i] The MARQUEE tag node is specified.
5983 * @return The conversion result is returned.
5986 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(node))
5988 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
5989 Doc *doc = jxhtml->doc;
5991 if (IS_CSS_ON(jxhtml->entryp)) {
5992 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
5999 * It is handler who processes the New Line Code.
6002 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
6004 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6005 if (jxhtml->start_html_flag) {
6006 Doc *doc = jxhtml->doc;
6014 * It is a handler who processes the LINK tag.
6016 * @param pdoc [i/o] The pointer to the JXHTML structure at the output
6017 * destination is specified.
6018 * @param node [i] The LINK tag node is specified.
6019 * @return The conversion result is returned.
6022 s_jxhtml_link_tag(void *pdoc, Node *node)
6031 jxhtml = GET_JXHTML(pdoc);
6034 if (! IS_CSS_ON(jxhtml->entryp)) {
6038 for (attr = qs_get_attr(doc,node);
6040 attr = qs_get_next_attr(doc,attr)) {
6041 char *name = qs_get_attr_name(doc,attr);
6042 char *value = qs_get_attr_value(doc,attr);
6043 if (STRCASEEQ('r','R',"rel", name)) {
6044 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6048 else if (STRCASEEQ('h','H',"href", name)) {
6049 if (value && *value) {
6053 else if (STRCASEEQ('t','T',"type", name)) {
6054 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6060 if (rel && href && type) {
6061 DBG(doc->r, "start load CSS. url:[%s]", href);
6062 jxhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jxhtml->style, href);
6063 DBG(doc->r, "end load CSS. url:[%s]", href);
6070 static css_prop_list_t *
6071 s_jxhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6073 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6074 Doc *doc = jxhtml->doc;
6075 css_prop_list_t *last_css = NULL;
6076 if (IS_CSS_ON(jxhtml->entryp)) {
6077 css_prop_list_t *dup_css;
6078 css_selector_t *selector;
6080 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6081 dup_css = chxj_dup_css_prop_list(doc, last_css);
6082 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6084 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6086 chxj_css_push_prop_list(jxhtml->css_prop_stack, dup_css);
6087 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6089 if (style_attr_value) {
6090 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));
6092 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6100 static css_prop_list_t *
6101 s_jxhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6103 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6104 Doc *doc = jxhtml->doc;
6105 css_prop_list_t *last_css = NULL;
6106 if (IS_CSS_ON(jxhtml->entryp)) {
6107 css_prop_list_t *dup_css;
6108 css_selector_t *selector;
6110 last_css = chxj_css_get_last_prop_list(jxhtml->css_prop_stack);
6111 dup_css = chxj_dup_css_prop_list(doc, last_css);
6112 selector = chxj_css_find_selector(doc, jxhtml->style, node);
6114 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6118 if (style_attr_value) {
6119 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));
6121 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6130 * It is a handler who processes the SPAN tag.
6132 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6133 * destination is specified.
6134 * @param node [i] The SPAN tag node is specified.
6135 * @return The conversion result is returned.
6138 s_jxhtml_start_span_tag(void *pdoc, Node *node)
6143 char *attr_style = NULL;
6144 char *attr_color = NULL;
6145 char *attr_size = NULL;
6146 char *attr_align = NULL;
6147 char *attr_blink = NULL;
6148 char *attr_marquee = NULL;
6149 char *attr_marquee_dir = NULL;
6150 char *attr_marquee_style = NULL;
6151 char *attr_marquee_loop = NULL;
6152 char *css_bgcolor = NULL;
6154 jxhtml = GET_JXHTML(pdoc);
6157 for (attr = qs_get_attr(doc,node);
6159 attr = qs_get_next_attr(doc,attr)) {
6160 char *nm = qs_get_attr_name(doc,attr);
6161 char *val = qs_get_attr_value(doc,attr);
6162 if (val && STRCASEEQ('s','S',"style", nm)) {
6166 if (IS_CSS_ON(jxhtml->entryp)) {
6167 css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
6169 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6170 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6171 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6172 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6173 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6174 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6175 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6176 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6177 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6179 css_property_t *cur;
6180 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6181 attr_color = apr_pstrdup(doc->pool, cur->value);
6183 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6184 if (cur->value && *cur->value) {
6185 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6186 || STRCASEEQ('x','X',"x-small", cur->value)
6187 || STRCASEEQ('s','S',"small", cur->value)
6188 || STRCASEEQ('m','M',"medium", cur->value)
6189 || STRCASEEQ('l','L',"large", cur->value)
6190 || STRCASEEQ('x','X',"x-large", cur->value)
6191 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6192 attr_size = apr_pstrdup(doc->pool, cur->value);
6196 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6197 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6198 attr_blink = apr_pstrdup(doc->pool, cur->value);
6201 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6202 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6203 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6206 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6207 if (cur->value && *cur->value) {
6208 if ( STRCASEEQ('l','L',"ltr",cur->value)
6209 || STRCASEEQ('r','R',"rtl",cur->value)) {
6210 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6214 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6215 if (cur->value && *cur->value) {
6216 if ( STRCASEEQ('s','S',"scroll",cur->value)
6217 || STRCASEEQ('s','S',"slide",cur->value)
6218 || STRCASEEQ('a','A',"alternate",cur->value)) {
6219 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6223 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6224 if (cur->value && *cur->value) {
6225 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6226 attr_marquee_loop = "infinite";
6229 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6233 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6234 if (STRCASEEQ('l','L',"left", cur->value)) {
6235 attr_align = apr_pstrdup(doc->pool, "left");
6237 else if (STRCASEEQ('c','C',"center",cur->value)) {
6238 attr_align = apr_pstrdup(doc->pool, "center");
6240 else if (STRCASEEQ('r','R',"right",cur->value)) {
6241 attr_align = apr_pstrdup(doc->pool, "right");
6244 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6245 if (cur->value && *cur->value) {
6246 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6253 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6256 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6272 W_L("text-decoration:");
6277 W_L("display:-wap-marquee;");
6278 if (attr_marquee_dir) {
6279 W_L("-wap-marquee-dir:");
6280 W_V(attr_marquee_dir);
6283 if (attr_marquee_style) {
6284 W_L("-wap-marquee-style:");
6285 W_V(attr_marquee_style);
6288 if (attr_marquee_loop) {
6289 W_L("-wap-marquee-loop:");
6290 W_V(attr_marquee_loop);
6295 W_L("background-color:");
6307 * It is a handler who processes the SPAN tag.
6309 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6310 * destination is specified.
6311 * @param node [i] The SPAN tag node is specified.
6312 * @return The conversion result is returned.
6315 s_jxhtml_end_span_tag(void *pdoc, Node *UNUSED(node))
6317 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6318 Doc *doc = jxhtml->doc;
6321 if (IS_CSS_ON(jxhtml->entryp)) {
6322 chxj_css_pop_prop_list(jxhtml->css_prop_stack);
6329 * It is a handler who processes the STYLE tag.
6331 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6332 * destination is specified.
6333 * @param node [i] The STYLE tag node is specified.
6334 * @return The conversion result is returned.
6337 s_jxhtml_style_tag(void *pdoc, Node *node)
6344 jxhtml = GET_JXHTML(pdoc);
6347 if (! IS_CSS_ON(jxhtml->entryp)) {
6351 for (attr = qs_get_attr(doc,node);
6353 attr = qs_get_next_attr(doc,attr)) {
6354 char *name = qs_get_attr_name(doc,attr);
6355 char *value = qs_get_attr_value(doc,attr);
6356 if (STRCASEEQ('t','T',"type", name)) {
6357 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6363 Node *child = qs_get_child_node(doc, node);
6364 if (type && child) {
6365 char *name = qs_get_node_name(doc, child);
6366 if (STRCASEEQ('t','T',"text", name)) {
6367 char *value = qs_get_node_value(doc, child);
6368 DBG(doc->r, "start load CSS. buf:[%s]", value);
6369 jxhtml->style = chxj_css_parse_style_value(doc, jxhtml->style, value);
6370 DBG(doc->r, "end load CSS. value:[%s]", value);
6376 * It is a handler who processes the OBJECT tag.
6378 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6379 * destination is specified.
6380 * @param node [i] The OBJECT tag node is specified.
6381 * @return The conversion result is returned.
6384 s_jxhtml_start_object_tag(void *pdoc, Node *node)
6386 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6387 Doc *doc = jxhtml->doc;
6390 char *attr_id = NULL;
6391 char *attr_width = NULL;
6392 char *attr_height = NULL;
6393 char *attr_data = NULL;
6394 char *attr_type = NULL;
6395 char *attr_declare = NULL;
6396 char *attr_classid = NULL;
6397 char *attr_codebase = NULL;
6399 /*--------------------------------------------------------------------------*/
6400 /* Get Attributes */
6401 /*--------------------------------------------------------------------------*/
6402 for (attr = qs_get_attr(doc,node);
6404 attr = qs_get_next_attr(doc,attr)) {
6405 char *name = qs_get_attr_name(doc,attr);
6406 char *value = qs_get_attr_value(doc,attr);
6407 if (STRCASEEQ('i','I',"id",name)) {
6408 attr_id = apr_pstrdup(doc->pool, value);
6410 else if (STRCASEEQ('w','W',"width",name)) {
6411 attr_width = apr_pstrdup(doc->pool, value);
6413 else if (STRCASEEQ('h','H',"height",name)) {
6414 attr_height = apr_pstrdup(doc->pool, value);
6416 else if (STRCASEEQ('d','D',"data",name)) {
6417 attr_data = apr_pstrdup(doc->pool, value);
6419 else if (STRCASEEQ('t','T',"type",name)) {
6420 attr_type = apr_pstrdup(doc->pool, value);
6422 else if (STRCASEEQ('d','D',"declare",name)) {
6423 attr_declare = apr_pstrdup(doc->pool, value);
6425 else if (STRCASEEQ('c','C',"classid",name)) {
6426 attr_classid = apr_pstrdup(doc->pool, value);
6428 else if (STRCASEEQ('c','C',"codebase",name)) {
6429 attr_codebase = apr_pstrdup(doc->pool, value);
6461 W_L(" declare=\"declare\"");
6469 W_L(" codebase=\"");
6478 * It is a handler who processes the OBJECT tag.
6480 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6481 * destination is specified.
6482 * @param node [i] The OBJECT tag node is specified.
6483 * @return The conversion result is returned.
6486 s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
6488 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6489 Doc *doc = jxhtml->doc;
6495 * It is a handler who processes the OBJECT tag.
6497 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6498 * destination is specified.
6499 * @param node [i] The OBJECT tag node is specified.
6500 * @return The conversion result is returned.
6503 s_jxhtml_start_param_tag(void *pdoc, Node *node)
6505 jxhtml_t *jxhtml = GET_JXHTML(pdoc);
6506 Doc *doc = jxhtml->doc;
6509 char *attr_style = NULL;
6510 char *attr_name = NULL;
6511 char *attr_value = NULL;
6513 /*--------------------------------------------------------------------------*/
6514 /* Get Attributes */
6515 /*--------------------------------------------------------------------------*/
6516 for (attr = qs_get_attr(doc,node);
6518 attr = qs_get_next_attr(doc,attr)) {
6519 char *name = qs_get_attr_name(doc,attr);
6520 char *value = qs_get_attr_value(doc,attr);
6521 if (STRCASEEQ('n','N',"name",name)) {
6522 attr_name = apr_pstrdup(doc->pool, value);
6524 else if (STRCASEEQ('v','V',"value",name)) {
6525 attr_value = apr_pstrdup(doc->pool, value);