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_jhtml.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_serf.h"
30 #define GET_JHTML(X) ((jhtml_t *)(X))
33 #define W_L(X) do { jhtml->out = BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, (X)); } while(0)
34 #define W_V(X) do { jhtml->out = (X) ? BUFFERED_WRITE_VALUE(jhtml->out, &doc->buf, (X)) \
35 : BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jhtml->conf); W_V(nlcode); } while (0)
39 static char *s_jhtml_start_html_tag (void *pdoc, Node *node);
40 static char *s_jhtml_end_html_tag (void *pdoc, Node *node);
41 static char *s_jhtml_start_meta_tag (void *pdoc, Node *node);
42 static char *s_jhtml_end_meta_tag (void *pdoc, Node *node);
43 static char *s_jhtml_start_head_tag (void *pdoc, Node *node);
44 static char *s_jhtml_end_head_tag (void *pdoc, Node *node);
45 static char *s_jhtml_start_title_tag (void *pdoc, Node *node);
46 static char *s_jhtml_end_title_tag (void *pdoc, Node *node);
47 static char *s_jhtml_start_base_tag (void *pdoc, Node *node);
48 static char *s_jhtml_end_base_tag (void *pdoc, Node *node);
49 static char *s_jhtml_start_body_tag (void *pdoc, Node *node);
50 static char *s_jhtml_end_body_tag (void *pdoc, Node *node);
51 static char *s_jhtml_start_a_tag (void *pdoc, Node *node);
52 static char *s_jhtml_end_a_tag (void *pdoc, Node *node);
53 static char *s_jhtml_start_pre_tag (void *pdoc, Node *node);
54 static char *s_jhtml_end_pre_tag (void *pdoc, Node *node);
55 static char *s_jhtml_start_p_tag (void *pdoc, Node *node);
56 static char *s_jhtml_end_p_tag (void *pdoc, Node *node);
57 static char *s_jhtml_start_ul_tag (void *pdoc, Node *node);
58 static char *s_jhtml_end_ul_tag (void *pdoc, Node *node);
59 static char *s_jhtml_start_ol_tag (void *pdoc, Node *node);
60 static char *s_jhtml_end_ol_tag (void *pdoc, Node *node);
61 static char *s_jhtml_start_li_tag (void *pdoc, Node *node);
62 static char *s_jhtml_end_li_tag (void *pdoc, Node *node);
63 static char *s_jhtml_start_br_tag (void *pdoc, Node *node);
64 static char *s_jhtml_end_br_tag (void *pdoc, Node *node);
65 static char *s_jhtml_start_tr_tag (void *pdoc, Node *node);
66 static char *s_jhtml_end_tr_tag (void *pdoc, Node *node);
67 static char *s_jhtml_start_font_tag (void *pdoc, Node *node);
68 static char *s_jhtml_end_font_tag (void *pdoc, Node *node);
69 static char *s_jhtml_start_form_tag (void *pdoc, Node *node);
70 static char *s_jhtml_end_form_tag (void *pdoc, Node *node);
71 static char *s_jhtml_start_input_tag (void *pdoc, Node *node);
72 static char *s_jhtml_end_input_tag (void *pdoc, Node *node);
73 static char *s_jhtml_start_center_tag (void *pdoc, Node *node);
74 static char *s_jhtml_end_center_tag (void *pdoc, Node *node);
75 static char *s_jhtml_start_hr_tag (void *pdoc, Node *node);
76 static char *s_jhtml_end_hr_tag (void *pdoc, Node *node);
77 static char *s_jhtml_start_img_tag (void *pdoc, Node *node);
78 static char *s_jhtml_end_img_tag (void *pdoc, Node *node);
79 static char *s_jhtml_start_select_tag (void *pdoc, Node *node);
80 static char *s_jhtml_end_select_tag (void *pdoc, Node *node);
81 static char *s_jhtml_start_option_tag (void *pdoc, Node *node);
82 static char *s_jhtml_end_option_tag (void *pdoc, Node *node);
83 static char *s_jhtml_start_div_tag (void *pdoc, Node *node);
84 static char *s_jhtml_end_div_tag (void *pdoc, Node *node);
85 static char *s_jhtml_start_textarea_tag (void *pdoc, Node *node);
86 static char *s_jhtml_end_textarea_tag (void *pdoc, Node *node);
87 static char *s_jhtml_start_b_tag (void *pdoc, Node *node);
88 static char *s_jhtml_end_b_tag (void *pdoc, Node *node);
89 static char *s_jhtml_chxjif_tag (void *pdoc, Node *node);
90 static char *s_jhtml_text_tag (void *pdoc, Node *node);
91 static char *s_jhtml_start_blockquote_tag (void *pdoc, Node *node);
92 static char *s_jhtml_end_blockquote_tag (void *pdoc, Node *node);
93 static char *s_jhtml_start_dir_tag (void *pdoc, Node *node);
94 static char *s_jhtml_end_dir_tag (void *pdoc, Node *node);
95 static char *s_jhtml_start_dl_tag (void *pdoc, Node *node);
96 static char *s_jhtml_end_dl_tag (void *pdoc, Node *node);
97 static char *s_jhtml_start_dt_tag (void *pdoc, Node *node);
98 static char *s_jhtml_end_dt_tag (void *pdoc, Node *node);
99 static char *s_jhtml_start_dd_tag (void *pdoc, Node *node);
100 static char *s_jhtml_end_dd_tag (void *pdoc, Node *node);
101 static char *s_jhtml_start_h1_tag (void *pdoc, Node *node);
102 static char *s_jhtml_end_h1_tag (void *pdoc, Node *node);
103 static char *s_jhtml_start_h2_tag (void *pdoc, Node *node);
104 static char *s_jhtml_end_h2_tag (void *pdoc, Node *node);
105 static char *s_jhtml_start_h3_tag (void *pdoc, Node *node);
106 static char *s_jhtml_end_h3_tag (void *pdoc, Node *node);
107 static char *s_jhtml_start_h4_tag (void *pdoc, Node *node);
108 static char *s_jhtml_end_h4_tag (void *pdoc, Node *node);
109 static char *s_jhtml_start_h5_tag (void *pdoc, Node *node);
110 static char *s_jhtml_end_h5_tag (void *pdoc, Node *node);
111 static char *s_jhtml_start_h6_tag (void *pdoc, Node *node);
112 static char *s_jhtml_end_h6_tag (void *pdoc, Node *node);
113 static char *s_jhtml_start_menu_tag (void *pdoc, Node *node);
114 static char *s_jhtml_end_menu_tag (void *pdoc, Node *node);
115 static char *s_jhtml_start_plaintext_tag (void *pdoc, Node *node);
116 static char *s_jhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
117 static char *s_jhtml_end_plaintext_tag (void *pdoc, Node *node);
118 static char *s_jhtml_start_blink_tag (void *pdoc, Node *node);
119 static char *s_jhtml_end_blink_tag (void *pdoc, Node *node);
120 static char *s_jhtml_start_marquee_tag (void *pdoc, Node *node);
121 static char *s_jhtml_end_marquee_tag (void *pdoc, Node *node);
122 static char *s_jhtml_newline_mark (void *pdoc, Node *node);
123 static char *s_jhtml_link_tag (void *pdoc, Node *node);
124 static char *s_jhtml_start_span_tag (void *pdoc, Node *node);
125 static char *s_jhtml_end_span_tag (void *pdoc, Node *node);
126 static char *s_jhtml_style_tag (void *pdoc, Node *node);
128 static void s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec);
130 static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
132 static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
133 static css_prop_list_t *s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
134 static css_prop_list_t *s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
136 static char *s_add_copyright_parameter(request_rec *r, char *value);
139 tag_handler jhtml_handler[] = {
142 s_jhtml_start_html_tag,
143 s_jhtml_end_html_tag,
147 s_jhtml_start_meta_tag,
148 s_jhtml_end_meta_tag,
152 s_jhtml_start_textarea_tag,
153 s_jhtml_end_textarea_tag,
162 s_jhtml_start_pre_tag,
167 s_jhtml_start_ul_tag,
172 s_jhtml_start_li_tag,
177 s_jhtml_start_ol_tag,
182 s_jhtml_start_h1_tag,
187 s_jhtml_start_h2_tag,
192 s_jhtml_start_h3_tag,
197 s_jhtml_start_h4_tag,
202 s_jhtml_start_h5_tag,
207 s_jhtml_start_h6_tag,
212 s_jhtml_start_head_tag,
213 s_jhtml_end_head_tag,
217 s_jhtml_start_title_tag,
218 s_jhtml_end_title_tag,
222 s_jhtml_start_base_tag,
223 s_jhtml_end_base_tag,
227 s_jhtml_start_body_tag,
228 s_jhtml_end_body_tag,
237 s_jhtml_start_br_tag,
247 s_jhtml_start_tr_tag,
262 s_jhtml_start_font_tag,
263 s_jhtml_end_font_tag,
267 s_jhtml_start_form_tag,
268 s_jhtml_end_form_tag,
272 s_jhtml_start_input_tag,
273 s_jhtml_end_input_tag,
277 s_jhtml_start_center_tag,
278 s_jhtml_end_center_tag,
282 s_jhtml_start_hr_tag,
287 s_jhtml_start_img_tag,
292 s_jhtml_start_select_tag,
293 s_jhtml_end_select_tag,
297 s_jhtml_start_option_tag,
298 s_jhtml_end_option_tag,
302 s_jhtml_start_div_tag,
327 s_jhtml_start_span_tag,
328 s_jhtml_end_span_tag,
352 s_jhtml_start_dt_tag,
367 s_jhtml_start_blockquote_tag,
368 s_jhtml_end_blockquote_tag,
372 s_jhtml_start_dir_tag,
377 s_jhtml_start_dl_tag,
382 s_jhtml_start_dd_tag,
387 s_jhtml_start_menu_tag,
388 s_jhtml_end_menu_tag,
392 s_jhtml_start_plaintext_tag,
393 s_jhtml_end_plaintext_tag,
397 s_jhtml_start_blink_tag,
398 s_jhtml_end_blink_tag,
402 s_jhtml_start_marquee_tag,
403 s_jhtml_end_marquee_tag,
412 s_jhtml_newline_mark,
419 * converts from CHTML5.0 to JHTML.
421 * @param r [i] Requet_rec is appointed.
422 * @param spec [i] The result of the device specification processing which
423 * was done in advance is appointed.
424 * @param src [i] The character string before the converting is appointed.
425 * @return The character string after the converting is returned.
434 chxjconvrule_entry *entryp,
446 /*--------------------------------------------------------------------------*/
448 /*--------------------------------------------------------------------------*/
450 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
452 DBG(r,"I found qrcode xml");
455 DBG(r,"not found qrcode xml");
457 /*--------------------------------------------------------------------------*/
458 /* The CHTML structure is initialized. */
459 /*--------------------------------------------------------------------------*/
460 s_init_jhtml(&jhtml, &doc, r, spec);
462 jhtml.entryp = entryp;
463 jhtml.cookie = cookie;
465 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
467 /*--------------------------------------------------------------------------*/
468 /* The character string of the input is analyzed. */
469 /*--------------------------------------------------------------------------*/
470 qs_init_malloc(&doc);
471 qs_init_root_node(&doc);
473 apr_pool_create(&pool, r->pool);
474 ss = apr_pcalloc(pool, srclen + 1);
476 memset(ss, 0, srclen + 1);
477 memcpy(ss, src, srclen);
480 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
482 if (IS_CSS_ON(jhtml.entryp)) {
483 /* current property list */
484 jhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
487 qs_parse_string(&doc,ss,strlen(ss));
489 chxj_buffered_write_init(r->pool, &doc.buf);
490 /*--------------------------------------------------------------------------*/
491 /* It converts it from CHTML to JHTML. */
492 /*--------------------------------------------------------------------------*/
493 chxj_node_convert(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
494 jhtml.out = chxj_buffered_write_flush(jhtml.out, &doc.buf);
495 dst = apr_pstrdup(pool, jhtml.out);
496 chxj_buffered_write_terminate(&doc.buf);
499 qs_all_free(&doc,QX_LOGMARK);
502 return apr_pstrdup(pool,ss);
505 dst = apr_psprintf(pool, "\n");
507 *dstlen = strlen(dst);
510 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
518 * The CHTML structure is initialized.
520 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
521 * initialized is specified.
522 * @param doc [i] The Doc structure that should be set to the initialized
523 * JHTML structure is specified.
524 * @param r [i] To use POOL, the pointer to request_rec is specified.
525 * @param spec [i] The pointer to the device_table
528 s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec)
530 memset(doc, 0, sizeof(Doc));
531 memset(jhtml, 0, sizeof(jhtml_t));
536 jhtml->out = qs_alloc_zero_byte_string(r->pool);
537 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
538 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
543 * Corresponding EMOJI to a current character-code is retrieved.
544 * The substitution character string is stored in the rslt pointer if agreeing.
546 * @param jhtml [i] The pointer to the CHTML structure is specified.
547 * @param txt [i] The character string to want to examine whether it is
548 * EMOJI is specified.
549 * @param rslt [o] The pointer to the pointer that stores the result is
551 * @return When corresponding EMOJI exists, it returns it excluding 0.
554 s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt)
566 if (! spec) DBG(r,"spec is NULL");
568 for (ee = jhtml->conf->emoji;
572 unsigned char hex1byte;
573 unsigned char hex2byte;
576 DBG(r,"emoji->imode is NULL");
580 hex1byte = ee->imode->hex1byte & 0xff;
581 hex2byte = ee->imode->hex2byte & 0xff;
583 if (ee->imode->string
584 && strlen(ee->imode->string) > 0
585 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
586 if (spec == NULL || spec->emoji_type == NULL) {
587 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
588 return strlen(ee->imode->string);
595 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
596 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
597 if (spec == NULL || spec->emoji_type == NULL) {
598 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
611 chxj_jhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
625 DBG(r, "REQ[%X] start chxj_jhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
626 memset(doc, 0, sizeof(Doc));
627 memset(jhtml, 0, sizeof(jhtml_t));
632 jhtml->out = qs_alloc_zero_byte_string(r->pool);
633 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
634 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
636 apr_pool_create(&pool, r->pool);
638 chxj_buffered_write_init(pool, &doc->buf);
640 for (ii=0; ii<len; ii++) {
644 rtn = s_jhtml_search_emoji(jhtml, (char *)&src[ii], &out);
651 if (is_sjis_kanji(src[ii])) {
652 two_byte[0] = src[ii+0];
653 two_byte[1] = src[ii+1];
659 one_byte[0] = src[ii+0];
664 jhtml->out = chxj_buffered_write_flush(jhtml->out, &doc->buf);
666 DBG(r, "REQ[%X] end chxj_jhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
672 * It is a handler who processes the HTML tag.
674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
675 * destination is specified.
676 * @param node [i] The HTML tag node is specified.
677 * @return The conversion result is returned.
680 s_jhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
687 jhtml = GET_JHTML(pdoc);
690 DBG(r, "start s_jhtml_start_html_tag()");
692 /*--------------------------------------------------------------------------*/
694 /*--------------------------------------------------------------------------*/
697 DBG(r, "end s_jhtml_start_html_tag()");
704 * It is a handler who processes the HTML tag.
706 * @param pdoc [i/o] The pointer to the CHTML structure at the output
707 * destination is specified.
708 * @param node [i] The HTML tag node is specified.
709 * @return The conversion result is returned.
712 s_jhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
714 jhtml_t *jhtml = GET_JHTML(pdoc);
715 Doc *doc = jhtml->doc;
724 * It is a handler who processes the META tag.
726 * @param pdoc [i/o] The pointer to the CHTML structure at the output
727 * destination is specified.
728 * @param node [i] The META tag node is specified.
729 * @return The conversion result is returned.
732 s_jhtml_start_meta_tag(void *pdoc, Node *node)
738 int content_type_flag;
741 jhtml = GET_JHTML(pdoc);
745 content_type_flag = 0;
748 /*--------------------------------------------------------------------------*/
750 /*--------------------------------------------------------------------------*/
751 for (attr = qs_get_attr(doc,node);
753 attr = qs_get_next_attr(doc,attr)) {
754 char *name = qs_get_attr_name(doc,attr);
755 char *value = qs_get_attr_value(doc,attr);
759 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
760 /*----------------------------------------------------------------------*/
762 /*----------------------------------------------------------------------*/
763 W_L(" http-equiv=\"");
766 if (STRCASEEQ('c','C',"content-type",value)) {
767 content_type_flag = 1;
769 if (STRCASEEQ('r','R',"refresh",value)) {
777 if (strcasecmp(name, "content") == 0 && value && *value) {
778 /*----------------------------------------------------------------------*/
780 /*----------------------------------------------------------------------*/
781 if (content_type_flag) {
785 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
794 buf = apr_pstrdup(r->pool, value);
796 url = strchr(buf, ';');
798 sec = apr_pstrdup(r->pool, buf);
801 url = chxj_encoding_parameter(r, url, 0);
802 url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
832 * It is a handler who processes the META tag.
834 * @param pdoc [i/o] The pointer to the CHTML structure at the output
835 * destination is specified.
836 * @param node [i] The META tag node is specified.
837 * @return The conversion result is returned.
840 s_jhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
842 jhtml_t *jhtml = GET_JHTML(pdoc);
849 * It is a handler who processes the HEAD tag.
851 * @param pdoc [i/o] The pointer to the CHTML structure at the output
852 * destination is specified.
853 * @param node [i] The HEAD tag node is specified.
854 * @return The conversion result is returned.
857 s_jhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
863 jhtml = GET_JHTML(pdoc);
873 * It is a handler who processes the HEAD tag.
875 * @param pdoc [i/o] The pointer to the CHTML structure at the output
876 * destination is specified.
877 * @param node [i] The HEAD tag node is specified.
878 * @return The conversion result is returned.
881 s_jhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
887 jhtml = GET_JHTML(pdoc);
897 * It is a handler who processes the TITLE tag.
899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
900 * destination is specified.
901 * @param node [i] The TITLE tag node is specified.
902 * @return The conversion result is returned.
905 s_jhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
911 jhtml = GET_JHTML(pdoc);
921 * It is a handler who processes the TITLE tag.
923 * @param pdoc [i/o] The pointer to the CHTML structure at the output
924 * destination is specified.
925 * @param node [i] The TITLE tag node is specified.
926 * @return The conversion result is returned.
929 s_jhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
935 jhtml = GET_JHTML(pdoc);
945 * It is a handler who processes the BASE tag.
947 * @param pdoc [i/o] The pointer to the CHTML structure at the output
948 * destination is specified.
949 * @param node [i] The BASE tag node is specified.
950 * @return The conversion result is returned.
953 s_jhtml_start_base_tag(void *pdoc, Node *node)
960 jhtml = GET_JHTML(pdoc);
965 /*--------------------------------------------------------------------------*/
967 /*--------------------------------------------------------------------------*/
968 for (attr = qs_get_attr(doc,node);
970 attr = qs_get_next_attr(doc,attr)) {
971 char *name = qs_get_attr_name(doc,attr);
972 char *value = qs_get_attr_value(doc,attr);
973 if (STRCASEEQ('h','H',"href",name)) {
985 * It is a handler who processes the BASE tag.
987 * @param pdoc [i/o] The pointer to the CHTML structure at the output
988 * destination is specified.
989 * @param node [i] The BASE tag node is specified.
990 * @return The conversion result is returned.
993 s_jhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
995 jhtml_t *jhtml = GET_JHTML(pdoc);
1001 * It is a handler who processes the BODY tag.
1003 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1004 * destination is specified.
1005 * @param node [i] The BODY tag node is specified.
1006 * @return The conversion result is returned.
1009 s_jhtml_start_body_tag(void *pdoc, Node *node)
1015 char *attr_bgcolor = NULL;
1016 char *attr_text = NULL;
1017 char *attr_link = NULL;
1018 char *attr_style = NULL;
1019 char *attr_vlink = NULL;
1021 jhtml = GET_JHTML(pdoc);
1025 /*--------------------------------------------------------------------------*/
1026 /* Get Attributes */
1027 /*--------------------------------------------------------------------------*/
1028 for (attr = qs_get_attr(doc,node);
1030 attr = qs_get_next_attr(doc,attr)) {
1031 char *name = qs_get_attr_name(doc,attr);
1032 char *value = qs_get_attr_value(doc,attr);
1033 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1034 /*----------------------------------------------------------------------*/
1036 /*----------------------------------------------------------------------*/
1037 attr_bgcolor = value;
1039 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1040 /*----------------------------------------------------------------------*/
1042 /*----------------------------------------------------------------------*/
1045 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1051 else if (STRCASEEQ('a','A',"alink",name)) {
1052 /*----------------------------------------------------------------------*/
1054 /*----------------------------------------------------------------------*/
1057 else if (STRCASEEQ('v','V',"vlink",name) && value && *value) {
1058 /*----------------------------------------------------------------------*/
1060 /*----------------------------------------------------------------------*/
1063 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1064 /*----------------------------------------------------------------------*/
1066 /*----------------------------------------------------------------------*/
1071 if (IS_CSS_ON(jhtml->entryp)) {
1072 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1074 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1075 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1076 css_property_t *cur;
1077 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1078 if (cur->value && *cur->value) {
1079 attr_text = apr_pstrdup(doc->pool, cur->value);
1082 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1083 if (cur->value && *cur->value) {
1084 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1089 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jhtml->style);
1090 css_selector_t *cur_sel;
1091 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1092 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1093 css_property_t *cur;
1094 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1095 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1096 attr_link = apr_pstrdup(doc->pool, cur->value);
1100 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1101 css_property_t *cur;
1102 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1103 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1104 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1114 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1120 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1126 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1132 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1144 * It is a handler who processes the BODY tag.
1146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1147 * destination is specified.
1148 * @param node [i] The BODY tag node is specified.
1149 * @return The conversion result is returned.
1152 s_jhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1158 jhtml = GET_JHTML(pdoc);
1163 if (IS_CSS_ON(jhtml->entryp)) {
1164 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1172 * It is a handler who processes the A tag.
1174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1175 * destination is specified.
1176 * @param node [i] The A tag node is specified.
1177 * @return The conversion result is returned.
1180 s_jhtml_start_a_tag(void *pdoc, Node *node)
1186 char *attr_style = NULL;
1188 jhtml = GET_JHTML(pdoc);
1193 /*--------------------------------------------------------------------------*/
1194 /* Get Attributes */
1195 /*--------------------------------------------------------------------------*/
1196 for (attr = qs_get_attr(doc,node);
1198 attr = qs_get_next_attr(doc,attr)) {
1199 char *name = qs_get_attr_name(doc,attr);
1200 char *value = qs_get_attr_value(doc,attr);
1201 if (STRCASEEQ('n','N',"name",name)) {
1202 /*----------------------------------------------------------------------*/
1204 /*----------------------------------------------------------------------*/
1209 else if (STRCASEEQ('h','H',"href",name)) {
1210 /*----------------------------------------------------------------------*/
1212 /*----------------------------------------------------------------------*/
1213 value = chxj_encoding_parameter(r, value, 0);
1214 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1215 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1216 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
1222 else if (STRCASEEQ('a','A',"accesskey",name)) {
1223 /*----------------------------------------------------------------------*/
1225 /*----------------------------------------------------------------------*/
1226 W_L(" accesskey=\"");
1230 else if (STRCASEEQ('c','C',"cti",name)) {
1231 /*----------------------------------------------------------------------*/
1233 /*----------------------------------------------------------------------*/
1238 else if (STRCASEEQ('i','I',"ijam",name)) {
1239 /*----------------------------------------------------------------------*/
1241 /*----------------------------------------------------------------------*/
1244 else if (STRCASEEQ('u','U',"utn",name)) {
1245 /*----------------------------------------------------------------------*/
1247 /* It is special only for CHTML. */
1248 /*----------------------------------------------------------------------*/
1250 else if (STRCASEEQ('t','T',"telbook",name)) {
1251 /*----------------------------------------------------------------------*/
1253 /*----------------------------------------------------------------------*/
1256 else if (STRCASEEQ('k','K',"kana",name)) {
1257 /*----------------------------------------------------------------------*/
1259 /*----------------------------------------------------------------------*/
1262 else if (STRCASEEQ('e','E',"email",name)) {
1263 /*----------------------------------------------------------------------*/
1265 /*----------------------------------------------------------------------*/
1268 else if (STRCASEEQ('i','I',"ista",name)) {
1269 /*----------------------------------------------------------------------*/
1271 /*----------------------------------------------------------------------*/
1274 else if (STRCASEEQ('i','I',"ilet",name)) {
1275 /*----------------------------------------------------------------------*/
1277 /*----------------------------------------------------------------------*/
1280 else if (STRCASEEQ('i','I',"iswf",name)) {
1281 /*----------------------------------------------------------------------*/
1283 /*----------------------------------------------------------------------*/
1286 else if (STRCASEEQ('i','I',"irst",name)) {
1287 /*----------------------------------------------------------------------*/
1289 /*----------------------------------------------------------------------*/
1292 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1298 if (IS_CSS_ON(jhtml->entryp)) {
1299 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1307 * It is a handler who processes the A tag.
1309 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1310 * destination is specified.
1311 * @param node [i] The A tag node is specified.
1312 * @return The conversion result is returned.
1315 s_jhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1321 jhtml = GET_JHTML(pdoc);
1327 if (IS_CSS_ON(jhtml->entryp)) {
1328 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1336 * It is a handler who processes the BR tag.
1338 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1339 * destination is specified.
1340 * @param node [i] The BR tag node is specified.
1341 * @return The conversion result is returned.
1344 s_jhtml_start_br_tag(void *pdoc, Node *node)
1351 jhtml = GET_JHTML(pdoc);
1356 /*--------------------------------------------------------------------------*/
1357 /* Get Attributes */
1358 /*--------------------------------------------------------------------------*/
1359 for (attr = qs_get_attr(doc,node);
1361 attr = qs_get_next_attr(doc,attr)) {
1362 char *name = qs_get_attr_name(doc,attr);
1363 char *value = qs_get_attr_value(doc,attr);
1364 if (STRCASEEQ('c','C',"clear",name)) {
1365 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1378 * It is a handler who processes the BR tag.
1380 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1381 * destination is specified.
1382 * @param node [i] The BR tag node is specified.
1383 * @return The conversion result is returned.
1386 s_jhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1388 jhtml_t *jhtml = GET_JHTML(pdoc);
1394 * It is a handler who processes the TR tag.
1396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1397 * destination is specified.
1398 * @param node [i] The TR tag node is specified.
1399 * @return The conversion result is returned.
1402 s_jhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1408 jhtml = GET_JHTML(pdoc);
1418 * It is a handler who processes the TR tag.
1420 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1421 * destination is specified.
1422 * @param node [i] The TR tag node is specified.
1423 * @return The conversion result is returned.
1426 s_jhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1428 jhtml_t *jhtml = GET_JHTML(pdoc);
1434 * It is a handler who processes the FONT tag.
1436 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1437 * destination is specified.
1438 * @param node [i] The FONT tag node is specified.
1439 * @return The conversion result is returned.
1442 s_jhtml_start_font_tag(void *pdoc, Node *node)
1448 char *attr_color = NULL;
1449 char *attr_style = NULL;
1451 jhtml = GET_JHTML(pdoc);
1455 /*--------------------------------------------------------------------------*/
1456 /* Get Attributes */
1457 /*--------------------------------------------------------------------------*/
1458 for (attr = qs_get_attr(doc,node);
1460 attr = qs_get_next_attr(doc,attr)) {
1461 char *name = qs_get_attr_name(doc,attr);
1462 char *value = qs_get_attr_value(doc,attr);
1463 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1464 attr_color = apr_pstrdup(doc->buf.pool, value);
1467 else if (STRCASEEQ('s','S',"size",name)) {
1468 /*----------------------------------------------------------------------*/
1470 /*----------------------------------------------------------------------*/
1473 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1474 attr_style = apr_pstrdup(doc->buf.pool, value);
1477 if (IS_CSS_ON(jhtml->entryp)) {
1478 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1480 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1481 css_property_t *cur;
1482 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1483 if (cur->value && *cur->value) {
1484 attr_color = apr_pstrdup(doc->pool, cur->value);
1490 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1491 W_L("<font color=\"");
1495 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1496 flg->with_font_flag = 1;
1497 node->userData = flg;
1500 node->userData = NULL;
1508 * It is a handler who processes the FONT tag.
1510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1511 * destination is specified.
1512 * @param node [i] The FONT tag node is specified.
1513 * @return The conversion result is returned.
1516 s_jhtml_end_font_tag(void *pdoc, Node *node)
1522 jhtml = GET_JHTML(pdoc);
1526 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1527 if (flg && flg->with_font_flag) {
1530 if (IS_CSS_ON(jhtml->entryp)) {
1531 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1539 * It is a handler who processes the FORM tag.
1541 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1542 * destination is specified.
1543 * @param node [i] The FORM tag node is specified.
1544 * @return The conversion result is returned.
1547 s_jhtml_start_form_tag(void *pdoc, Node *node)
1553 char *attr_action = NULL;
1554 char *attr_method = NULL;
1555 char *attr_style = NULL;
1556 char *attr_color = NULL;
1557 char *attr_align = NULL;
1558 char *new_hidden_tag = NULL;
1560 jhtml = GET_JHTML(pdoc);
1564 /*--------------------------------------------------------------------------*/
1565 /* Get Attributes */
1566 /*--------------------------------------------------------------------------*/
1567 for (attr = qs_get_attr(doc,node);
1569 attr = qs_get_next_attr(doc,attr)) {
1570 char *name = qs_get_attr_name(doc,attr);
1571 char *value = qs_get_attr_value(doc,attr);
1575 if (strcasecmp(name, "action") == 0) {
1576 /*--------------------------------------------------------------------*/
1578 /*--------------------------------------------------------------------*/
1579 attr_action = value;
1585 if (strcasecmp(name, "method") == 0) {
1586 /*--------------------------------------------------------------------*/
1588 /*--------------------------------------------------------------------*/
1589 attr_method = value;
1595 if (strcasecmp(name, "style") == 0) {
1604 if (IS_CSS_ON(jhtml->entryp)) {
1605 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1607 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1608 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1609 css_property_t *cur;
1610 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1611 if (STRCASEEQ('l','L',"left", cur->value)) {
1612 attr_align = apr_pstrdup(doc->pool, "left");
1614 else if (STRCASEEQ('c','C',"center",cur->value)) {
1615 attr_align = apr_pstrdup(doc->pool, "center");
1617 else if (STRCASEEQ('r','R',"right",cur->value)) {
1618 attr_align = apr_pstrdup(doc->pool, "right");
1621 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1622 attr_color = apr_pstrdup(doc->pool, cur->value);
1627 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1631 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1632 attr_action = chxj_add_cookie_parameter(r, attr_action, jhtml->cookie);
1634 char *old_qs = NULL;
1635 q = strchr(attr_action, '?');
1637 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, jhtml->entryp);
1638 if (new_hidden_tag || old_qs) {
1657 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
1658 memset(flg, 0, sizeof(*flg));
1660 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1661 W_L("<font color=\"");
1664 flg->with_font_flag = 1;
1667 W_L("<div align=\"");
1670 flg->with_div_flag = 1;
1672 node->userData = flg;
1673 /*-------------------------------------------------------------------------*/
1674 /* Add cookie parameter */
1675 /*-------------------------------------------------------------------------*/
1676 if (new_hidden_tag) {
1677 W_V(new_hidden_tag);
1684 * It is a handler who processes the FORM tag.
1686 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1687 * destination is specified.
1688 * @param node [i] The FORM tag node is specified.
1689 * @return The conversion result is returned.
1692 s_jhtml_end_form_tag(void *pdoc, Node *node)
1694 jhtml_t *jhtml = GET_JHTML(pdoc);
1695 Doc *doc = jhtml->doc;
1697 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1698 if (flg && flg->with_div_flag) {
1701 if (flg && flg->with_font_flag) {
1705 if (IS_CSS_ON(jhtml->entryp)) {
1706 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1714 * It is a handler who processes the INPUT tag.
1716 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1717 * destination is specified.
1718 * @param node [i] The INPUT tag node is specified.
1719 * @return The conversion result is returned.
1722 s_jhtml_start_input_tag(void *pdoc, Node *node)
1728 char *attr_accesskey = NULL;
1729 char *attr_max_length = NULL;
1730 char *attr_type = NULL;
1731 char *attr_name = NULL;
1732 char *attr_value = NULL;
1733 char *attr_istyle = NULL;
1734 char *attr_size = NULL;
1735 char *attr_checked = NULL;
1736 char *attr_style = NULL;
1738 jhtml = GET_JHTML(pdoc);
1742 /*--------------------------------------------------------------------------*/
1743 /* Get Attributes */
1744 /*--------------------------------------------------------------------------*/
1745 for (attr = qs_get_attr(doc,node);
1747 attr = qs_get_next_attr(doc,attr)) {
1748 char *name = qs_get_attr_name(doc,attr);
1749 char *value = qs_get_attr_value(doc,attr);
1750 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1751 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1752 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1753 STRCASEEQ('p','P',"password",tmp_type) ||
1754 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1755 STRCASEEQ('r','R',"radio", tmp_type) ||
1756 STRCASEEQ('h','H',"hidden", tmp_type) ||
1757 STRCASEEQ('s','S',"submit", tmp_type) ||
1758 STRCASEEQ('r','R',"reset", tmp_type))) {
1759 attr_type = tmp_type;
1762 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1765 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1768 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1769 attr_istyle = value;
1771 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1772 attr_max_length = value;
1774 else if (STRCASEEQ('c','C',"checked", name)) {
1775 attr_checked = value;
1777 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1778 attr_accesskey = value;
1780 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1783 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1788 if (IS_CSS_ON(jhtml->entryp)) {
1789 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1791 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1792 css_property_t *cur;
1793 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1794 if (strcasestr(cur->value, "<ja:n>")) {
1797 else if (strcasestr(cur->value, "<ja:en>")) {
1800 else if (strcasestr(cur->value, "<ja:hk>")) {
1803 else if (strcasestr(cur->value, "<ja:h>")) {
1823 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jhtml->entryp));
1828 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1831 if (attr_accesskey) {
1832 W_L(" accesskey=\"");
1833 W_V(attr_accesskey);
1836 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1837 /*------------------------------------------------------------------------*/
1839 /*------------------------------------------------------------------------*/
1840 if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jhtml->entryp->pc_flag ) {
1846 char *vv = chxj_istyle_to_mode(doc->buf.pool,attr_istyle);
1852 else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1857 /*--------------------------------------------------------------------------*/
1858 /* The figure is default for the password. */
1859 /*--------------------------------------------------------------------------*/
1860 if (attr_max_length && *attr_max_length) {
1861 if (chxj_chk_numeric(attr_max_length) == 0) {
1862 W_L(" maxlength=\"");
1863 W_V(attr_max_length);
1877 * It is a handler who processes the INPUT tag.
1879 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1880 * destination is specified.
1881 * @param node [i] The INPUT tag node is specified.
1882 * @return The conversion result is returned.
1885 s_jhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
1887 jhtml_t *jhtml = GET_JHTML(pdoc);
1893 * It is a handler who processes the CENTER tag.
1895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1896 * destination is specified.
1897 * @param node [i] The CENTER tag node is specified.
1898 * @return The conversion result is returned.
1901 s_jhtml_start_center_tag(void *pdoc, Node *node)
1906 char *attr_style = NULL;
1907 char *attr_color = NULL;
1908 char *attr_size = NULL;
1910 jhtml = GET_JHTML(pdoc);
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('s','S',"style",name) && value && *value) {
1922 if (IS_CSS_ON(jhtml->entryp)) {
1923 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1925 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1926 css_property_t *cur;
1927 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1928 if (cur->value && *cur->value) {
1929 attr_color = apr_pstrdup(doc->pool, cur->value);
1936 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
1937 memset(flg, 0, sizeof(*flg));
1938 if (attr_color || attr_size) {
1941 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1951 flg->with_font_flag = 1;
1954 node->userData = flg;
1958 jhtml_t *jhtml = GET_JHTML(pdoc);
1959 Doc *doc = jhtml->doc;
1967 * It is a handler who processes the CENTER tag.
1969 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1970 * destination is specified.
1971 * @param node [i] The CENTER tag node is specified.
1972 * @return The conversion result is returned.
1975 s_jhtml_end_center_tag(void *pdoc, Node *node)
1981 jhtml = GET_JHTML(pdoc);
1985 if (IS_CSS_ON(jhtml->entryp)) {
1986 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1988 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1989 if (flg && flg->with_font_flag) {
1998 * It is a handler who processes the li tag.
2000 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2001 * destination is specified.
2002 * @param node [i] The li tag node is specified.
2003 * @return The conversion result is returned.
2006 s_jhtml_start_li_tag(void *pdoc, Node *node)
2012 char *attr_type = NULL;
2013 char *attr_value = NULL;
2014 char *attr_style = NULL;
2016 jhtml = GET_JHTML(pdoc);
2020 for (attr = qs_get_attr(doc,node);
2022 attr = qs_get_next_attr(doc,attr)) {
2023 char *name = qs_get_attr_name(doc,attr);
2024 char *value = qs_get_attr_value(doc,attr);
2025 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2028 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2031 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2035 if (IS_CSS_ON(jhtml->entryp)) {
2036 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2038 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2039 css_property_t *cur;
2040 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2041 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2042 attr_type = apr_pstrdup(doc->pool, "1");
2044 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2045 attr_type = apr_pstrdup(doc->pool, "A");
2047 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2048 attr_type = apr_pstrdup(doc->pool, "a");
2071 * It is a handler who processes the li tag.
2073 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2074 * destination is specified.
2075 * @param node [i] The li tag node is specified.
2076 * @return The conversion result is returned.
2079 s_jhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2085 jhtml = GET_JHTML(pdoc);
2090 if (IS_CSS_ON(jhtml->entryp)) {
2091 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2098 * It is a handler who processes the OL tag.
2100 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2101 * destination is specified.
2102 * @param node [i] The OL tag node is specified.
2103 * @return The conversion result is returned.
2106 s_jhtml_start_ol_tag(void *pdoc, Node *node)
2112 char *attr_style = NULL;
2113 char *attr_start = NULL;
2114 char *attr_type = NULL;
2116 jhtml = GET_JHTML(pdoc);
2120 /*--------------------------------------------------------------------------*/
2121 /* Get Attributes */
2122 /*--------------------------------------------------------------------------*/
2123 for (attr = qs_get_attr(doc,node);
2125 attr = qs_get_next_attr(doc,attr)) {
2126 char *name = qs_get_attr_name(doc,attr);
2127 char *value = qs_get_attr_value(doc,attr);
2128 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2131 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2134 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2138 if (IS_CSS_ON(jhtml->entryp)) {
2139 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2141 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2142 css_property_t *cur;
2143 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2144 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2145 attr_type = apr_pstrdup(doc->pool, "1");
2147 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2148 attr_type = apr_pstrdup(doc->pool, "A");
2150 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2151 attr_type = apr_pstrdup(doc->pool, "a");
2174 * It is a handler who processes the OL tag.
2176 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2177 * destination is specified.
2178 * @param node [i] The OL tag node is specified.
2179 * @return The conversion result is returned.
2182 s_jhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2188 jhtml = GET_JHTML(pdoc);
2193 if (IS_CSS_ON(jhtml->entryp)) {
2194 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2201 * It is a handler who processes the P tag.
2203 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2204 * destination is specified.
2205 * @param node [i] The P tag node is specified.
2206 * @return The conversion result is returned.
2209 s_jhtml_start_p_tag(void *pdoc, Node *node)
2215 char *attr_align = NULL;
2216 char *attr_style = NULL;
2217 char *attr_color = NULL;
2218 char *attr_blink = NULL;
2221 jhtml = GET_JHTML(pdoc);
2225 for (attr = qs_get_attr(doc,node);
2227 attr = qs_get_next_attr(doc,attr)) {
2228 char *nm = qs_get_attr_name(doc,attr);
2229 char *val = qs_get_attr_value(doc,attr);
2230 if (STRCASEEQ('a','A',"align", nm)) {
2231 /*----------------------------------------------------------------------*/
2232 /* CHTML 1.0 (W3C version 3.2) */
2233 /*----------------------------------------------------------------------*/
2234 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2235 attr_align = apr_pstrdup(doc->buf.pool, val);
2239 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2240 attr_style = apr_pstrdup(doc->buf.pool, val);
2243 if (IS_CSS_ON(jhtml->entryp)) {
2244 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2246 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2247 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2248 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2249 css_property_t *cur;
2250 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2251 if (STRCASEEQ('l','L',"left",cur->value)) {
2252 attr_align = apr_pstrdup(doc->pool, "left");
2254 else if (STRCASEEQ('c','C',"center",cur->value)) {
2255 attr_align = apr_pstrdup(doc->pool, "center");
2257 else if (STRCASEEQ('r','R',"right",cur->value)) {
2258 attr_align = apr_pstrdup(doc->pool, "right");
2261 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2262 if (cur->value && *cur->value) {
2263 attr_color = apr_pstrdup(doc->pool, cur->value);
2266 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2267 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2268 attr_blink = apr_pstrdup(doc->pool, cur->value);
2281 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
2282 memset(flg, 0, sizeof(*flg));
2284 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2285 W_L("<font color=\"");
2288 flg->with_font_flag = 1;
2292 flg->with_blink_flag = 1;
2294 node->userData = (void *)flg;
2301 * It is a handler who processes the P tag.
2303 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2304 * destination is specified.
2305 * @param node [i] The P tag node is specified.
2306 * @return The conversion result is returned.
2309 s_jhtml_end_p_tag(void *pdoc, Node *node)
2311 jhtml_t *jhtml = GET_JHTML(pdoc);
2312 Doc *doc = jhtml->doc;
2314 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
2315 if (flg->with_font_flag) {
2318 if (flg->with_blink_flag) {
2323 if (IS_CSS_ON(jhtml->entryp)) {
2324 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2332 * It is a handler who processes the PRE tag.
2334 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2335 * destination is specified.
2336 * @param node [i] The PRE tag node is specified.
2337 * @return The conversion result is returned.
2340 s_jhtml_start_pre_tag(void *pdoc, Node *node)
2342 jhtml_t *jhtml = GET_JHTML(pdoc);
2343 Doc *doc = jhtml->doc;
2345 char *attr_style = NULL;
2347 for (attr = qs_get_attr(doc,node);
2349 attr = qs_get_next_attr(doc,attr)) {
2350 char *nm = qs_get_attr_name(doc,attr);
2351 char *val = qs_get_attr_value(doc,attr);
2352 if (val && STRCASEEQ('s','S',"style", nm)) {
2357 if (IS_CSS_ON(jhtml->entryp)) {
2358 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2368 * It is a handler who processes the PRE tag.
2370 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2371 * destination is specified.
2372 * @param node [i] The PRE tag node is specified.
2373 * @return The conversion result is returned.
2376 s_jhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2378 jhtml_t *jhtml = GET_JHTML(pdoc);
2379 Doc *doc = jhtml->doc;
2383 if (IS_CSS_ON(jhtml->entryp)) {
2384 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2392 * It is a handler who processes the UL tag.
2394 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2395 * destination is specified.
2396 * @param node [i] The UL tag node is specified.
2397 * @return The conversion result is returned.
2400 s_jhtml_start_ul_tag(void *pdoc, Node *node)
2402 jhtml_t *jhtml = GET_JHTML(pdoc);
2403 Doc *doc = jhtml->doc;
2405 char *attr_style = NULL;
2407 for (attr = qs_get_attr(doc,node);
2409 attr = qs_get_next_attr(doc,attr)) {
2410 char *nm = qs_get_attr_name(doc,attr);
2411 char *val = qs_get_attr_value(doc,attr);
2412 if (val && STRCASEEQ('s','S',"style", nm)) {
2417 if (IS_CSS_ON(jhtml->entryp)) {
2418 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2427 * It is a handler who processes the UL tag.
2429 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2430 * destination is specified.
2431 * @param node [i] The UL tag node is specified.
2432 * @return The conversion result is returned.
2435 s_jhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2437 jhtml_t *jhtml = GET_JHTML(pdoc);
2438 Doc *doc = jhtml->doc;
2441 if (IS_CSS_ON(jhtml->entryp)) {
2442 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2449 * It is a handler who processes the HR tag.
2451 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2452 * destination is specified.
2453 * @param node [i] The HR tag node is specified.
2454 * @return The conversion result is returned.
2457 s_jhtml_start_hr_tag(void *pdoc, Node *node)
2463 char *attr_align = NULL;
2464 char *attr_size = NULL;
2465 char *attr_width = NULL;
2466 char *attr_noshade = NULL;
2467 char *attr_style = NULL;
2468 char *attr_color = NULL;
2470 jhtml = GET_JHTML(pdoc);
2474 for (attr = qs_get_attr(doc,node);
2476 attr = qs_get_next_attr(doc,attr)) {
2477 char *name = qs_get_attr_name (doc,attr);
2478 char *value = qs_get_attr_value(doc,attr);
2482 if (strcasecmp(name, "align") == 0) {
2483 /*--------------------------------------------------------------------*/
2485 /*--------------------------------------------------------------------*/
2486 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2494 if (strcasecmp(name, "size") == 0) {
2495 /*--------------------------------------------------------------------*/
2497 /*--------------------------------------------------------------------*/
2498 if (value && *value) {
2502 else if (strcasecmp(name, "style") == 0) {
2503 if (value && *value) {
2511 if (strcasecmp(name, "width") == 0) {
2512 /*--------------------------------------------------------------------*/
2514 /*--------------------------------------------------------------------*/
2515 if (value && *value) {
2523 if (strcasecmp(name, "noshade") == 0) {
2524 /*--------------------------------------------------------------------*/
2526 /*--------------------------------------------------------------------*/
2527 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2533 if (strcasecmp(name, "color") == 0 && value && *value) {
2534 /*--------------------------------------------------------------------*/
2536 /*--------------------------------------------------------------------*/
2545 if (IS_CSS_ON(jhtml->entryp)) {
2546 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2548 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2549 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2550 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2551 css_property_t *cur;
2552 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2553 if (STRCASEEQ('s','S',"solid",cur->value)) {
2554 attr_noshade = "noshade";
2557 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2558 char *tmp = apr_pstrdup(doc->pool, cur->value);
2559 char *tmpp = strstr(tmp, "px");
2562 attr_size = apr_pstrdup(doc->pool, tmp);
2565 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2566 char *tmp = apr_pstrdup(doc->pool, cur->value);
2567 char *tmpp = strstr(tmp, "px");
2570 attr_width = apr_pstrdup(doc->pool, tmp);
2573 tmpp = strstr(tmp, "%");
2575 attr_width = apr_pstrdup(doc->pool, tmp);
2611 * It is a handler who processes the HR tag.
2613 * @param jhtml [i/o] The pointer to the CHTML structure at the output
2614 * destination is specified.
2615 * @param node [i] The HR tag node is specified.
2616 * @return The conversion result is returned.
2619 s_jhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2621 jhtml_t *jhtml = GET_JHTML(pdoc);
2627 * It is a handler who processes the IMG tag.
2629 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2630 * destination is specified.
2631 * @param node [i] The IMG tag node is specified.
2632 * @return The conversion result is returned.
2635 s_jhtml_start_img_tag(void *pdoc, Node *node)
2641 char *attr_src = NULL;
2642 char *attr_align = NULL;
2643 char *attr_style = NULL;
2644 char *attr_alt = NULL;
2645 char *attr_width = NULL;
2646 char *attr_height = NULL;
2647 #ifndef IMG_NOT_CONVERT_FILENAME
2651 jhtml = GET_JHTML(pdoc);
2652 #ifndef IMG_NOT_CONVERT_FILENAME
2658 /*--------------------------------------------------------------------------*/
2659 /* Get Attributes */
2660 /*--------------------------------------------------------------------------*/
2661 for (attr = qs_get_attr(doc,node);
2663 attr = qs_get_next_attr(doc,attr)) {
2664 char *name = qs_get_attr_name (doc,attr);
2665 char *value = qs_get_attr_value(doc,attr);
2669 if (strcasecmp(name, "src") == 0) {
2670 /*--------------------------------------------------------------------*/
2672 /*--------------------------------------------------------------------*/
2673 #ifdef IMG_NOT_CONVERT_FILENAME
2674 value = chxj_encoding_parameter(r, value, 0);
2675 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
2676 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2677 value = chxj_add_cookie_no_update_parameter(r, value);
2678 value = s_add_copyright_parameter(r, value);
2681 value = chxj_img_conv(r, spec, value);
2682 value = chxj_encoding_parameter(r, value, 0);
2683 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
2684 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2685 value = chxj_add_cookie_no_update_parameter(r, value);
2686 value = s_add_copyright_parameter(r, value);
2690 else if (strcasecmp(name,"style") == 0 && value && *value) {
2697 if (strcasecmp(name, "align" ) == 0) {
2698 /*--------------------------------------------------------------------*/
2700 /*--------------------------------------------------------------------*/
2701 /*--------------------------------------------------------------------*/
2703 /*--------------------------------------------------------------------*/
2705 if (STRCASEEQ('t','T',"top", value) ||
2706 STRCASEEQ('m','M',"middle",value) ||
2707 STRCASEEQ('b','B',"bottom",value) ||
2708 STRCASEEQ('l','L',"left", value) ||
2709 STRCASEEQ('r','R',"right", value)) {
2712 else if (STRCASEEQ('c','C',"center", value)) {
2713 attr_align = apr_pstrdup(doc->pool, "middle");
2717 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2718 /*--------------------------------------------------------------------*/
2720 /*--------------------------------------------------------------------*/
2727 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2728 /*--------------------------------------------------------------------*/
2730 /*--------------------------------------------------------------------*/
2737 if (strcasecmp(name, "height") == 0 && value && *value) {
2738 /*--------------------------------------------------------------------*/
2740 /*--------------------------------------------------------------------*/
2741 attr_height = value;
2744 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2745 /*--------------------------------------------------------------------*/
2747 /*--------------------------------------------------------------------*/
2753 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2754 /*--------------------------------------------------------------------*/
2756 /*--------------------------------------------------------------------*/
2765 if (IS_CSS_ON(jhtml->entryp)) {
2766 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2768 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2769 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2770 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2771 css_property_t *cur;
2772 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2773 attr_height = apr_pstrdup(doc->pool, cur->value);
2775 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2776 attr_width = apr_pstrdup(doc->pool, cur->value);
2778 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2779 attr_align = apr_pstrdup(doc->pool, cur->value);
2816 * It is a handler who processes the IMG tag.
2818 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2819 * destination is specified.
2820 * @param node [i] The IMG tag node is specified.
2821 * @return The conversion result is returned.
2824 s_jhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
2826 jhtml_t *jhtml = GET_JHTML(pdoc);
2832 * It is a handler who processes the SELECT tag.
2834 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2835 * destination is specified.
2836 * @param node [i] The SELECT tag node is specified.
2837 * @return The conversion result is returned.
2840 s_jhtml_start_select_tag(void *pdoc, Node *node)
2842 jhtml_t *jhtml = GET_JHTML(pdoc);
2843 Doc *doc = jhtml->doc;
2847 char *multiple = NULL;
2848 char *attr_style = NULL;
2851 for (attr = qs_get_attr(doc,node);
2853 attr = qs_get_next_attr(doc,attr)) {
2854 char *nm = qs_get_attr_name(doc,attr);
2855 char *val = qs_get_attr_value(doc,attr);
2856 if (STRCASEEQ('s','S',"size",nm)) {
2857 /*----------------------------------------------------------------------*/
2858 /* CHTML 1.0 version 2.0 */
2859 /*----------------------------------------------------------------------*/
2860 size = apr_pstrdup(doc->buf.pool, val);
2862 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2863 /*----------------------------------------------------------------------*/
2864 /* CHTML 1.0 version 2.0 */
2865 /*----------------------------------------------------------------------*/
2866 attr_style = apr_pstrdup(doc->buf.pool, val);
2868 else if (STRCASEEQ('n','N',"name",nm)) {
2869 /*----------------------------------------------------------------------*/
2870 /* CHTML 1.0 version 2.0 */
2871 /*----------------------------------------------------------------------*/
2872 name = apr_pstrdup(doc->buf.pool, val);
2874 else if (STRCASEEQ('m','M',"multiple", nm)) {
2875 /*----------------------------------------------------------------------*/
2876 /* CHTML 1.0 version 2.0 */
2877 /*----------------------------------------------------------------------*/
2878 multiple = apr_pstrdup(doc->buf.pool, val);
2881 if (size && *size) {
2886 if (name && *name) {
2895 if (IS_CSS_ON(jhtml->entryp)) {
2896 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2903 * It is a handler who processes the SELECT tag.
2905 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2906 * destination is specified.
2907 * @param node [i] The SELECT tag node is specified.
2908 * @return The conversion result is returned.
2911 s_jhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
2913 jhtml_t *jhtml = GET_JHTML(pdoc);
2914 Doc *doc = jhtml->doc;
2917 if (IS_CSS_ON(jhtml->entryp)) {
2918 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2924 * It is a handler who processes the OPTION tag.
2926 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2927 * destination is specified.
2928 * @param node [i] The OPTION tag node is specified.
2929 * @return The conversion result is returned.
2932 s_jhtml_start_option_tag(void *pdoc, Node *node)
2934 jhtml_t *jhtml = GET_JHTML(pdoc);
2935 Doc *doc = jhtml->doc;
2938 char *selected = NULL;
2940 char *attr_style = NULL;
2943 for (attr = qs_get_attr(doc,node);
2945 attr = qs_get_next_attr(doc,attr)) {
2946 char *nm = qs_get_attr_name(doc,attr);
2947 char *val = qs_get_attr_value(doc,attr);
2948 if (STRCASEEQ('s','S',"selected",nm)) {
2949 /*----------------------------------------------------------------------*/
2950 /* CHTML 1.0 version 2.0 */
2951 /*----------------------------------------------------------------------*/
2952 selected = apr_pstrdup(doc->buf.pool, val);
2954 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2955 /*----------------------------------------------------------------------*/
2956 /* CHTML 1.0 version 2.0 */
2957 /*----------------------------------------------------------------------*/
2958 attr_style = apr_pstrdup(doc->buf.pool, val);
2960 else if (STRCASEEQ('v','V',"value",nm)) {
2961 /*----------------------------------------------------------------------*/
2962 /* CHTML 1.0 version 2.0 */
2963 /*----------------------------------------------------------------------*/
2964 value = apr_pstrdup(doc->buf.pool, val);
2977 if (IS_CSS_ON(jhtml->entryp)) {
2978 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2986 * It is a handler who processes the OPTION tag.
2988 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2989 * destination is specified.
2990 * @param node [i] The OPTION tag node is specified.
2991 * @return The conversion result is returned.
2994 s_jhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
2996 jhtml_t *jhtml = GET_JHTML(pdoc);
2998 if (IS_CSS_ON(jhtml->entryp)) {
2999 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3006 * It is a handler who processes the DIV tag.
3008 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3009 * destination is specified.
3010 * @param node [i] The DIV tag node is specified.
3011 * @return The conversion result is returned.
3014 s_jhtml_start_div_tag(void *pdoc, Node *node)
3020 char *attr_style = NULL;
3021 char *attr_align = NULL;
3022 char *attr_display = NULL;
3023 char *attr_decoration = NULL;
3024 char *attr_wap_marquee_style = NULL;
3025 char *attr_wap_marquee_dir = NULL;
3026 char *attr_wap_marquee_loop = NULL;
3027 char *attr_color = NULL;
3028 char *attr_bgcolor = NULL;
3029 char *attr_font_size = NULL;
3031 jhtml = GET_JHTML(pdoc);
3035 for (attr = qs_get_attr(doc,node);
3037 attr = qs_get_next_attr(doc,attr)) {
3038 char *nm = qs_get_attr_name(doc,attr);
3039 char *val = qs_get_attr_value(doc,attr);
3040 if (STRCASEEQ('a','A', "align", nm)) {
3041 /*----------------------------------------------------------------------*/
3042 /* CHTML 1.0 (W3C version 3.2) */
3043 /*----------------------------------------------------------------------*/
3044 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3045 attr_align = apr_pstrdup(doc->buf.pool, val);
3048 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3049 attr_style = apr_pstrdup(doc->buf.pool, val);
3053 if (IS_CSS_ON(jhtml->entryp)) {
3054 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3056 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3057 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3058 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3059 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3060 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3061 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3062 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3064 css_property_t *cur;
3065 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3066 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3067 attr_display = apr_pstrdup(doc->pool, cur->value);
3070 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3071 if (STRCASEEQ('b','B',"blink", cur->value)) {
3072 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3075 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3076 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3077 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3079 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3080 char *ss = strchr(cur->value, '#');
3082 ss = strstr(cur->value, "rgb");
3085 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3086 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3089 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3090 attr_color = apr_pstrdup(doc->pool, cur->value);
3092 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3093 attr_align = apr_pstrdup(doc->pool, cur->value);
3095 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3096 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3097 if (STRCASEEQ('x','X',"xx-small",attr_font_size)) {
3098 attr_font_size = apr_pstrdup(doc->pool, "1");
3100 else if (STRCASEEQ('x','X',"x-small",attr_font_size)) {
3101 attr_font_size = apr_pstrdup(doc->pool, "2");
3103 else if (STRCASEEQ('s','S',"small",attr_font_size)) {
3104 attr_font_size = apr_pstrdup(doc->pool, "3");
3106 else if (STRCASEEQ('m','M',"medium",attr_font_size)) {
3107 attr_font_size = apr_pstrdup(doc->pool, "4");
3109 else if (STRCASEEQ('l','L',"large",attr_font_size)) {
3110 attr_font_size = apr_pstrdup(doc->pool, "5");
3112 else if (STRCASEEQ('x','X',"x-large",attr_font_size)) {
3113 attr_font_size = apr_pstrdup(doc->pool, "6");
3115 else if (STRCASEEQ('x','X',"xx-large",attr_font_size)) {
3116 attr_font_size = apr_pstrdup(doc->pool, "7");
3120 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3121 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3122 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3123 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3124 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3125 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3128 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3129 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3130 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
3132 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3133 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
3136 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3137 if (STRCASEEQ('i','I',"infinite",cur->value)) {
3138 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
3141 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3147 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3148 memset(flg, 0, sizeof(*flg));
3155 flg->with_div_flag = 1;
3158 && ! ((STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color)) && attr_bgcolor))
3159 || attr_font_size) {
3166 if (attr_font_size) {
3168 W_V(attr_font_size);
3172 flg->with_font_flag = 1;
3174 if (attr_decoration) {
3176 flg->with_blink_flag = 1;
3180 if (attr_wap_marquee_style) {
3181 W_L(" behavior=\"");
3182 W_V(attr_wap_marquee_style);
3185 if (attr_wap_marquee_dir) {
3186 W_L(" direction=\"");
3187 W_V(attr_wap_marquee_dir);
3190 if (attr_wap_marquee_loop) {
3192 W_V(attr_wap_marquee_loop);
3196 flg->with_marquee_flag = 1;
3198 if (!attr_align && !attr_color && !attr_decoration && !attr_display && !attr_font_size) {
3200 flg->with_div_flag = 1;
3202 node->userData = flg;
3209 * It is a handler who processes the DIV tag.
3211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3212 * destination is specified.
3213 * @param node [i] The DIV tag node is specified.
3214 * @return The conversion result is returned.
3217 s_jhtml_end_div_tag(void *pdoc, Node *node)
3219 jhtml_t *jhtml = GET_JHTML(pdoc);
3220 Doc *doc = jhtml->doc;
3222 jhtml_flags_t *flg = node->userData;
3223 if (flg && flg->with_marquee_flag) {
3226 if (flg && flg->with_blink_flag) {
3229 if (flg && flg->with_font_flag) {
3232 if (flg && flg->with_div_flag) {
3235 if (IS_CSS_ON(jhtml->entryp)) {
3236 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3238 node->userData = NULL;
3245 chxj_istyle_to_mode(apr_pool_t *p, const char *s)
3251 case '1': return apr_psprintf(p, "hiragana");
3252 case '2': return apr_psprintf(p, "hankakukana");
3253 case '3': return apr_psprintf(p, "alphabet");
3254 case '4': return apr_psprintf(p, "numeric");
3256 tmp = apr_palloc(p, 1);
3258 return apr_pstrdup(p, tmp);
3262 tmp = apr_palloc(p, 1);
3264 return apr_pstrdup(p,tmp);
3269 s_jhtml_chxjif_tag(void *pdoc, Node *node)
3276 jhtml = GET_JHTML(pdoc);
3280 for (child = qs_get_child_node(doc, node);
3282 child = qs_get_next_node(doc, child)) {
3284 s_jhtml_chxjif_tag(jhtml, child);
3291 * It is a handler who processes the TEXTARE tag.
3293 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3294 * destination is specified.
3295 * @param node [i] The TEXTAREA tag node is specified.
3296 * @return The conversion result is returned.
3299 s_jhtml_start_textarea_tag(void *pdoc, Node *node)
3305 char *attr_accesskey = NULL;
3306 char *attr_name = NULL;
3307 char *attr_rows = NULL;
3308 char *attr_cols = NULL;
3309 char *attr_istyle = NULL;
3310 char *attr_style = NULL;
3312 jhtml = GET_JHTML(pdoc);
3316 jhtml->textarea_flag++;
3317 for (attr = qs_get_attr(doc,node);
3319 attr = qs_get_next_attr(doc,attr)) {
3320 char *name = qs_get_attr_name(doc,attr);
3321 char *value = qs_get_attr_value(doc,attr);
3322 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3323 attr_accesskey = value;
3325 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3326 attr_istyle = value;
3328 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3331 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3334 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3337 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3341 if (IS_CSS_ON(jhtml->entryp)) {
3342 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3344 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3345 css_property_t *cur;
3346 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3347 if (strcasestr(cur->value, "<ja:n>")) {
3350 else if (strcasestr(cur->value, "<ja:en>")) {
3353 else if (strcasestr(cur->value, "<ja:hk>")) {
3356 else if (strcasestr(cur->value, "<ja:h>")) {
3363 if (attr_accesskey) {
3364 W_L(" accesskey=\"");
3365 W_V(attr_accesskey);
3384 char *vv = chxj_istyle_to_mode(doc->buf.pool,attr_istyle);
3395 * It is a handler who processes the TEXTAREA tag.
3397 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3398 * destination is specified.
3399 * @param node [i] The TEXTAREA tag node is specified.
3400 * @return The conversion result is returned.
3403 s_jhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3409 jhtml = GET_JHTML(pdoc);
3414 jhtml->textarea_flag--;
3421 * It is a handler who processes the B tag.
3423 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3424 * destination is specified.
3425 * @param node [i] The B tag node is specified.
3426 * @return The conversion result is returned.
3429 s_jhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3435 jhtml = GET_JHTML(pdoc);
3445 * It is a handler who processes the B tag.
3447 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3448 * destination is specified.
3449 * @param node [i] The B tag node is specified.
3450 * @return The conversion result is returned.
3453 s_jhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3455 jhtml_t* jhtml = GET_JHTML(pdoc);
3456 Doc* doc = jhtml->doc;
3463 s_jhtml_text_tag(void* pdoc, Node* child)
3475 jhtml = GET_JHTML(pdoc);
3478 DBG(r, "start s_jhtml_text_tag()");
3480 textval = qs_get_node_value(doc,child);
3481 if (strlen(textval) == 0) {
3485 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3486 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3488 tdst = qs_alloc_zero_byte_string(r->pool);
3489 memset(one_byte, 0, sizeof(one_byte));
3492 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3494 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
3496 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3501 if (is_sjis_kanji(textval[ii])) {
3502 one_byte[0] = textval[ii+0];
3503 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3504 one_byte[0] = textval[ii+1];
3505 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3509 if (jhtml->pre_flag) {
3510 one_byte[0] = textval[ii+0];
3511 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3514 if (jhtml->textarea_flag) {
3515 one_byte[0] = textval[ii+0];
3516 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3519 if (textval[ii] != '\r' && textval[ii] != '\n') {
3520 one_byte[0] = textval[ii+0];
3521 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3526 DBG(r, "end s_jhtml_text_tag()");
3532 * It is a handler who processes the BLOCKQUOTE tag.
3534 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3535 * destination is specified.
3536 * @param node [i] The BLOCKQUOTE tag node is specified.
3537 * @return The conversion result is returned.
3540 s_jhtml_start_blockquote_tag(void *pdoc, Node *node)
3545 char *attr_style = NULL;
3546 char *attr_color = NULL;
3547 char *attr_size = NULL;
3549 jhtml = GET_JHTML(pdoc);
3551 for (attr = qs_get_attr(doc,node);
3553 attr = qs_get_next_attr(doc,attr)) {
3554 char *nm = qs_get_attr_name(doc,attr);
3555 char *val = qs_get_attr_value(doc,attr);
3556 if (val && STRCASEEQ('s','S',"style", nm)) {
3560 if (IS_CSS_ON(jhtml->entryp)) {
3561 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3563 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3564 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3565 css_property_t *cur;
3566 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3567 if (cur->value && *cur->value) {
3568 attr_color = apr_pstrdup(doc->pool, cur->value);
3571 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3572 if (cur->value && *cur->value) {
3573 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3574 attr_size = apr_pstrdup(doc->pool, "1");
3576 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3577 attr_size = apr_pstrdup(doc->pool, "2");
3579 else if (STRCASEEQ('s','S',"small",cur->value)) {
3580 attr_size = apr_pstrdup(doc->pool, "3");
3582 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3583 attr_size = apr_pstrdup(doc->pool, "4");
3585 else if (STRCASEEQ('l','L',"large",cur->value)) {
3586 attr_size = apr_pstrdup(doc->pool, "5");
3588 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3589 attr_size = apr_pstrdup(doc->pool, "6");
3591 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3592 attr_size = apr_pstrdup(doc->pool, "7");
3598 W_L("<blockquote>");
3599 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3600 memset(flg, 0, sizeof(*flg));
3601 if (attr_color || attr_size) {
3604 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3615 flg->with_font_flag = 1;
3617 node->userData = (void *)flg;
3623 * It is a handler who processes the BLOCKQUOTE tag.
3625 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3626 * destination is specified.
3627 * @param node [i] The BLOCKQUOTE tag node is specified.
3628 * @return The conversion result is returned.
3631 s_jhtml_end_blockquote_tag(void *pdoc, Node *node)
3633 jhtml_t *jhtml = GET_JHTML(pdoc);
3634 Doc *doc = jhtml->doc;
3635 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3636 if (flg && flg->with_font_flag) {
3639 W_L("</blockquote>");
3640 if (IS_CSS_ON(jhtml->entryp)) {
3641 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3648 * It is a handler who processes the DIR tag.
3650 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3651 * destination is specified.
3652 * @param node [i] The DIR tag node is specified.
3653 * @return The conversion result is returned.
3656 s_jhtml_start_dir_tag(void *pdoc, Node *node)
3658 jhtml_t *jhtml = GET_JHTML(pdoc);
3659 Doc *doc = jhtml->doc;
3661 char *attr_style = NULL;
3662 char *attr_color = NULL;
3663 char *attr_size = NULL;
3664 for (attr = qs_get_attr(doc,node);
3666 attr = qs_get_next_attr(doc,attr)) {
3667 char *name = qs_get_attr_name(doc,attr);
3668 char *value = qs_get_attr_value(doc,attr);
3669 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3673 if (IS_CSS_ON(jhtml->entryp)) {
3674 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3676 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3677 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3678 css_property_t *cur;
3679 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3680 if (cur->value && *cur->value) {
3681 attr_color = apr_pstrdup(doc->pool, cur->value);
3684 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3685 if (cur->value && *cur->value) {
3686 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3687 attr_size = apr_pstrdup(doc->pool, "1");
3689 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3690 attr_size = apr_pstrdup(doc->pool, "2");
3692 else if (STRCASEEQ('s','S',"small",cur->value)) {
3693 attr_size = apr_pstrdup(doc->pool, "3");
3695 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3696 attr_size = apr_pstrdup(doc->pool, "4");
3698 else if (STRCASEEQ('l','L',"large",cur->value)) {
3699 attr_size = apr_pstrdup(doc->pool, "5");
3701 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3702 attr_size = apr_pstrdup(doc->pool, "6");
3704 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3705 attr_size = apr_pstrdup(doc->pool, "7");
3712 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3713 memset(flg, 0, sizeof(*flg));
3714 if (attr_color || attr_size) {
3717 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3728 flg->with_font_flag = 1;
3730 node->userData = (void *)flg;
3736 * It is a handler who processes the DIR tag.
3738 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3739 * destination is specified.
3740 * @param node [i] The DIR tag node is specified.
3741 * @return The conversion result is returned.
3744 s_jhtml_end_dir_tag(void *pdoc, Node *node)
3746 jhtml_t *jhtml = GET_JHTML(pdoc);
3747 Doc *doc = jhtml->doc;
3748 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3749 if (flg && flg->with_font_flag) {
3753 if (IS_CSS_ON(jhtml->entryp)) {
3754 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3761 * It is a handler who processes the DL tag.
3763 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3764 * destination is specified.
3765 * @param node [i] The DL tag node is specified.
3766 * @return The conversion result is returned.
3769 s_jhtml_start_dl_tag(void *pdoc, Node *node)
3771 jhtml_t *jhtml = GET_JHTML(pdoc);
3772 Doc *doc = jhtml->doc;
3774 char *attr_style = NULL;
3775 char *attr_color = NULL;
3776 char *attr_size = NULL;
3777 for (attr = qs_get_attr(doc,node);
3779 attr = qs_get_next_attr(doc,attr)) {
3780 char *name = qs_get_attr_name(doc,attr);
3781 char *value = qs_get_attr_value(doc,attr);
3782 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3786 if (IS_CSS_ON(jhtml->entryp)) {
3787 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3789 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3790 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3791 css_property_t *cur;
3792 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3793 if (cur->value && *cur->value) {
3794 attr_color = apr_pstrdup(doc->pool, cur->value);
3797 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3798 if (cur->value && *cur->value) {
3799 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3800 attr_size = apr_pstrdup(doc->pool, "1");
3802 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3803 attr_size = apr_pstrdup(doc->pool, "2");
3805 else if (STRCASEEQ('s','S',"small",cur->value)) {
3806 attr_size = apr_pstrdup(doc->pool, "3");
3808 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3809 attr_size = apr_pstrdup(doc->pool, "4");
3811 else if (STRCASEEQ('l','L',"large",cur->value)) {
3812 attr_size = apr_pstrdup(doc->pool, "5");
3814 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3815 attr_size = apr_pstrdup(doc->pool, "6");
3817 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3818 attr_size = apr_pstrdup(doc->pool, "7");
3825 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3826 memset(flg, 0, sizeof(*flg));
3827 if (attr_color || attr_size) {
3830 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3841 flg->with_font_flag = 1;
3843 node->userData = (void *)flg;
3849 * It is a handler who processes the DL tag.
3851 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3852 * destination is specified.
3853 * @param node [i] The DL tag node is specified.
3854 * @return The conversion result is returned.
3857 s_jhtml_end_dl_tag(void *pdoc, Node *node)
3859 jhtml_t *jhtml = GET_JHTML(pdoc);
3860 Doc *doc = jhtml->doc;
3861 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3862 if (flg && flg->with_font_flag) {
3866 if (IS_CSS_ON(jhtml->entryp)) {
3867 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3874 * It is a handler who processes the DT tag.
3876 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3877 * destination is specified.
3878 * @param node [i] The DT tag node is specified.
3879 * @return The conversion result is returned.
3882 s_jhtml_start_dt_tag(void *pdoc, Node *node)
3884 jhtml_t *jhtml = GET_JHTML(pdoc);
3885 Doc *doc = jhtml->doc;
3887 char *attr_style = NULL;
3888 char *attr_color = NULL;
3889 char *attr_size = NULL;
3890 for (attr = qs_get_attr(doc,node);
3892 attr = qs_get_next_attr(doc,attr)) {
3893 char *name = qs_get_attr_name(doc,attr);
3894 char *value = qs_get_attr_value(doc,attr);
3895 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3899 if (IS_CSS_ON(jhtml->entryp)) {
3900 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3902 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3903 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3904 css_property_t *cur;
3905 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3906 if (cur->value && *cur->value) {
3907 attr_color = apr_pstrdup(doc->pool, cur->value);
3910 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3911 if (cur->value && *cur->value) {
3912 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3913 attr_size = apr_pstrdup(doc->pool, "1");
3915 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3916 attr_size = apr_pstrdup(doc->pool, "2");
3918 else if (STRCASEEQ('s','S',"small",cur->value)) {
3919 attr_size = apr_pstrdup(doc->pool, "3");
3921 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3922 attr_size = apr_pstrdup(doc->pool, "4");
3924 else if (STRCASEEQ('l','L',"large",cur->value)) {
3925 attr_size = apr_pstrdup(doc->pool, "5");
3927 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3928 attr_size = apr_pstrdup(doc->pool, "6");
3930 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3931 attr_size = apr_pstrdup(doc->pool, "7");
3938 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3939 memset(flg, 0, sizeof(*flg));
3940 if (attr_color || attr_size) {
3943 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3954 flg->with_font_flag = 1;
3956 node->userData = (void *)flg;
3962 * It is a handler who processes the DT tag.
3964 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3965 * destination is specified.
3966 * @param node [i] The DT tag node is specified.
3967 * @return The conversion result is returned.
3970 s_jhtml_end_dt_tag(void *pdoc, Node *node)
3972 jhtml_t *jhtml = GET_JHTML(pdoc);
3973 Doc *doc = jhtml->doc;
3974 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3975 if (flg && flg->with_font_flag) {
3978 if (IS_CSS_ON(jhtml->entryp)) {
3979 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3986 * It is a handler who processes the DD tag.
3988 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3989 * destination is specified.
3990 * @param node [i] The DD tag node is specified.
3991 * @return The conversion result is returned.
3994 s_jhtml_start_dd_tag(void *pdoc, Node *node)
3996 jhtml_t *jhtml = GET_JHTML(pdoc);
3997 Doc *doc = jhtml->doc;
3999 char *attr_style = NULL;
4000 char *attr_color = NULL;
4001 char *attr_size = NULL;
4002 for (attr = qs_get_attr(doc,node);
4004 attr = qs_get_next_attr(doc,attr)) {
4005 char *name = qs_get_attr_name(doc,attr);
4006 char *value = qs_get_attr_value(doc,attr);
4007 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4011 if (IS_CSS_ON(jhtml->entryp)) {
4012 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4014 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4015 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4016 css_property_t *cur;
4017 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4018 if (cur->value && *cur->value) {
4019 attr_color = apr_pstrdup(doc->pool, cur->value);
4022 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4023 if (cur->value && *cur->value) {
4024 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4025 attr_size = apr_pstrdup(doc->pool, "1");
4027 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4028 attr_size = apr_pstrdup(doc->pool, "2");
4030 else if (STRCASEEQ('s','S',"small",cur->value)) {
4031 attr_size = apr_pstrdup(doc->pool, "3");
4033 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4034 attr_size = apr_pstrdup(doc->pool, "4");
4036 else if (STRCASEEQ('l','L',"large",cur->value)) {
4037 attr_size = apr_pstrdup(doc->pool, "5");
4039 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4040 attr_size = apr_pstrdup(doc->pool, "6");
4042 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4043 attr_size = apr_pstrdup(doc->pool, "7");
4050 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4051 memset(flg, 0, sizeof(*flg));
4052 if (attr_color || attr_size) {
4055 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4066 flg->with_font_flag = 1;
4068 node->userData = (void *)flg;
4074 * It is a handler who processes the DD tag.
4076 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4077 * destination is specified.
4078 * @param node [i] The DD tag node is specified.
4079 * @return The conversion result is returned.
4082 s_jhtml_end_dd_tag(void *pdoc, Node *node)
4084 jhtml_t *jhtml = GET_JHTML(pdoc);
4085 Doc *doc = jhtml->doc;
4086 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4087 if (flg && flg->with_font_flag) {
4090 if (IS_CSS_ON(jhtml->entryp)) {
4091 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4098 * It is a handler who processes the H1 tag.
4100 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4101 * destination is specified.
4102 * @param node [i] The H1 tag node is specified.
4103 * @return The conversion result is returned.
4106 s_jhtml_start_h1_tag(void *pdoc, Node *node)
4112 char *attr_style = NULL;
4113 char *attr_align = NULL;
4115 jhtml = GET_JHTML(pdoc);
4119 for (attr = qs_get_attr(doc,node);
4121 attr = qs_get_next_attr(doc,attr)) {
4122 char *name = qs_get_attr_name(doc,attr);
4123 char *value = qs_get_attr_value(doc,attr);
4124 if (STRCASEEQ('a','A',"align", name)) {
4125 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4129 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4133 if (IS_CSS_ON(jhtml->entryp)) {
4134 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4136 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4137 css_property_t *cur;
4138 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4139 if (STRCASEEQ('l','L',"left", cur->value)) {
4140 attr_align = apr_pstrdup(doc->pool, "left");
4142 else if (STRCASEEQ('c','C',"center",cur->value)) {
4143 attr_align = apr_pstrdup(doc->pool, "center");
4145 else if (STRCASEEQ('r','R',"right",cur->value)) {
4146 attr_align = apr_pstrdup(doc->pool, "right");
4152 W_L("<div align=\"");
4155 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4156 memset(flg, 0, sizeof(*flg));
4157 flg->with_div_align_flag = 1;
4158 node->userData = (void *)flg;
4161 node->userData = NULL;
4169 * It is a handler who processes the H1 tag.
4171 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4172 * destination is specified.
4173 * @param node [i] The H1 tag node is specified.
4174 * @return The conversion result is returned.
4177 s_jhtml_end_h1_tag(void *pdoc, Node *node)
4183 jhtml = GET_JHTML(pdoc);
4187 jhtml_flags_t *flg = node->userData;
4188 if (flg && flg->with_div_align_flag) {
4190 node->userData = NULL;
4192 if (IS_CSS_ON(jhtml->entryp)) {
4193 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4200 * It is a handler who processes the H2 tag.
4202 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4203 * destination is specified.
4204 * @param node [i] The H1 tag node is specified.
4205 * @return The conversion result is returned.
4208 s_jhtml_start_h2_tag(void *pdoc, Node *node)
4214 char *attr_style = NULL;
4215 char *attr_align = NULL;
4217 jhtml = GET_JHTML(pdoc);
4221 for (attr = qs_get_attr(doc,node);
4223 attr = qs_get_next_attr(doc,attr)) {
4224 char *name = qs_get_attr_name(doc,attr);
4225 char *value = qs_get_attr_value(doc,attr);
4226 if (STRCASEEQ('a','A',"align", name)) {
4227 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4231 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4235 if (IS_CSS_ON(jhtml->entryp)) {
4236 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4238 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4239 css_property_t *cur;
4240 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4241 if (STRCASEEQ('l','L',"left", cur->value)) {
4242 attr_align = apr_pstrdup(doc->pool, "left");
4244 else if (STRCASEEQ('c','C',"center",cur->value)) {
4245 attr_align = apr_pstrdup(doc->pool, "center");
4247 else if (STRCASEEQ('r','R',"right",cur->value)) {
4248 attr_align = apr_pstrdup(doc->pool, "right");
4254 W_L("<div align=\"");
4257 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4258 memset(flg, 0, sizeof(*flg));
4259 flg->with_div_align_flag = 1;
4260 node->userData = (void *)flg;
4263 node->userData = NULL;
4271 * It is a handler who processes the H2 tag.
4273 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4274 * destination is specified.
4275 * @param node [i] The H1 tag node is specified.
4276 * @return The conversion result is returned.
4279 s_jhtml_end_h2_tag(void *pdoc, Node *node)
4285 jhtml = GET_JHTML(pdoc);
4289 jhtml_flags_t *flg = node->userData;
4290 if (flg && flg->with_div_align_flag) {
4292 node->userData = NULL;
4294 if (IS_CSS_ON(jhtml->entryp)) {
4295 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4302 * It is a handler who processes the H3 tag.
4304 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4305 * destination is specified.
4306 * @param node [i] The H1 tag node is specified.
4307 * @return The conversion result is returned.
4310 s_jhtml_start_h3_tag(void *pdoc, Node *node)
4316 char *attr_style = NULL;
4317 char *attr_align = NULL;
4319 jhtml = GET_JHTML(pdoc);
4323 for (attr = qs_get_attr(doc,node);
4325 attr = qs_get_next_attr(doc,attr)) {
4326 char *name = qs_get_attr_name(doc,attr);
4327 char *value = qs_get_attr_value(doc,attr);
4328 if (STRCASEEQ('a','A',"align", name)) {
4329 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4333 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4337 if (IS_CSS_ON(jhtml->entryp)) {
4338 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4340 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4341 css_property_t *cur;
4342 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4343 if (STRCASEEQ('l','L',"left", cur->value)) {
4344 attr_align = apr_pstrdup(doc->pool, "left");
4346 else if (STRCASEEQ('c','C',"center",cur->value)) {
4347 attr_align = apr_pstrdup(doc->pool, "center");
4349 else if (STRCASEEQ('r','R',"right",cur->value)) {
4350 attr_align = apr_pstrdup(doc->pool, "right");
4356 W_L("<div align=\"");
4359 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4360 memset(flg, 0, sizeof(*flg));
4361 flg->with_div_align_flag = 1;
4362 node->userData = (void *)flg;
4365 node->userData = NULL;
4373 * It is a handler who processes the H3 tag.
4375 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4376 * destination is specified.
4377 * @param node [i] The H1 tag node is specified.
4378 * @return The conversion result is returned.
4381 s_jhtml_end_h3_tag(void *pdoc, Node *node)
4387 jhtml = GET_JHTML(pdoc);
4391 jhtml_flags_t *flg = node->userData;
4392 if (flg && flg->with_div_align_flag) {
4394 node->userData = NULL;
4396 if (IS_CSS_ON(jhtml->entryp)) {
4397 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4405 * It is a handler who processes the H4 tag.
4407 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4408 * destination is specified.
4409 * @param node [i] The H1 tag node is specified.
4410 * @return The conversion result is returned.
4413 s_jhtml_start_h4_tag(void *pdoc, Node *node)
4419 char *attr_style = NULL;
4420 char *attr_align = NULL;
4422 jhtml = GET_JHTML(pdoc);
4426 for (attr = qs_get_attr(doc,node);
4428 attr = qs_get_next_attr(doc,attr)) {
4429 char *name = qs_get_attr_name(doc,attr);
4430 char *value = qs_get_attr_value(doc,attr);
4431 if (STRCASEEQ('a','A',"align", name)) {
4432 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4436 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4440 if (IS_CSS_ON(jhtml->entryp)) {
4441 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4443 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4444 css_property_t *cur;
4445 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4446 if (STRCASEEQ('l','L',"left", cur->value)) {
4447 attr_align = apr_pstrdup(doc->pool, "left");
4449 else if (STRCASEEQ('c','C',"center",cur->value)) {
4450 attr_align = apr_pstrdup(doc->pool, "center");
4452 else if (STRCASEEQ('r','R',"right",cur->value)) {
4453 attr_align = apr_pstrdup(doc->pool, "right");
4459 W_L("<div align=\"");
4462 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4463 memset(flg, 0, sizeof(*flg));
4464 flg->with_div_align_flag = 1;
4465 node->userData = (void *)flg;
4468 node->userData = NULL;
4475 * It is a handler who processes the H4 tag.
4477 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4478 * destination is specified.
4479 * @param node [i] The H1 tag node is specified.
4480 * @return The conversion result is returned.
4483 s_jhtml_end_h4_tag(void *pdoc, Node *node)
4489 jhtml = GET_JHTML(pdoc);
4493 jhtml_flags_t *flg = node->userData;
4494 if (flg && flg->with_div_align_flag) {
4496 node->userData = NULL;
4498 if (IS_CSS_ON(jhtml->entryp)) {
4499 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4506 * It is a handler who processes the H5 tag.
4508 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4509 * destination is specified.
4510 * @param node [i] The H1 tag node is specified.
4511 * @return The conversion result is returned.
4514 s_jhtml_start_h5_tag(void *pdoc, Node *node)
4520 char *attr_style = NULL;
4521 char *attr_align = NULL;
4523 jhtml = GET_JHTML(pdoc);
4527 for (attr = qs_get_attr(doc,node);
4529 attr = qs_get_next_attr(doc,attr)) {
4530 char *name = qs_get_attr_name(doc,attr);
4531 char *value = qs_get_attr_value(doc,attr);
4532 if (STRCASEEQ('a','A',"align", name)) {
4533 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4537 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4541 if (IS_CSS_ON(jhtml->entryp)) {
4542 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4544 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4545 css_property_t *cur;
4546 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4547 if (STRCASEEQ('l','L',"left", cur->value)) {
4548 attr_align = apr_pstrdup(doc->pool, "left");
4550 else if (STRCASEEQ('c','C',"center",cur->value)) {
4551 attr_align = apr_pstrdup(doc->pool, "center");
4553 else if (STRCASEEQ('r','R',"right",cur->value)) {
4554 attr_align = apr_pstrdup(doc->pool, "right");
4560 W_L("<div align=\"");
4563 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4564 memset(flg, 0, sizeof(*flg));
4565 flg->with_div_align_flag = 1;
4566 node->userData = (void *)flg;
4569 node->userData = NULL;
4576 * It is a handler who processes the H5 tag.
4578 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4579 * destination is specified.
4580 * @param node [i] The H1 tag node is specified.
4581 * @return The conversion result is returned.
4584 s_jhtml_end_h5_tag(void *pdoc, Node *node)
4590 jhtml = GET_JHTML(pdoc);
4594 jhtml_flags_t *flg = node->userData;
4595 if (flg && flg->with_div_align_flag) {
4597 node->userData = NULL;
4599 if (IS_CSS_ON(jhtml->entryp)) {
4600 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4608 * It is a handler who processes the H6 tag.
4610 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4611 * destination is specified.
4612 * @param node [i] The H1 tag node is specified.
4613 * @return The conversion result is returned.
4616 s_jhtml_start_h6_tag(void *pdoc, Node *node)
4622 char *attr_style = NULL;
4623 char *attr_align = NULL;
4625 jhtml = GET_JHTML(pdoc);
4629 for (attr = qs_get_attr(doc,node);
4631 attr = qs_get_next_attr(doc,attr)) {
4632 char *name = qs_get_attr_name(doc,attr);
4633 char *value = qs_get_attr_value(doc,attr);
4634 if (STRCASEEQ('a','A',"align", name)) {
4635 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4639 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4643 if (IS_CSS_ON(jhtml->entryp)) {
4644 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4646 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4647 css_property_t *cur;
4648 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4649 if (STRCASEEQ('l','L',"left", cur->value)) {
4650 attr_align = apr_pstrdup(doc->pool, "left");
4652 else if (STRCASEEQ('c','C',"center",cur->value)) {
4653 attr_align = apr_pstrdup(doc->pool, "center");
4655 else if (STRCASEEQ('r','R',"right",cur->value)) {
4656 attr_align = apr_pstrdup(doc->pool, "right");
4662 W_L("<div align=\"");
4665 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4666 memset(flg, 0, sizeof(*flg));
4667 flg->with_div_align_flag = 1;
4668 node->userData = (void *)flg;
4671 node->userData = NULL;
4679 * It is a handler who processes the H6 tag.
4681 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4682 * destination is specified.
4683 * @param node [i] The H1 tag node is specified.
4684 * @return The conversion result is returned.
4687 s_jhtml_end_h6_tag(void *pdoc, Node *node)
4693 jhtml = GET_JHTML(pdoc);
4697 jhtml_flags_t *flg = node->userData;
4698 if (flg && flg->with_div_align_flag) {
4700 node->userData = NULL;
4702 if (IS_CSS_ON(jhtml->entryp)) {
4703 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4711 * It is a handler who processes the MENU tag.
4713 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4714 * destination is specified.
4715 * @param node [i] The MENU tag node is specified.
4716 * @return The conversion result is returned.
4719 s_jhtml_start_menu_tag(void *pdoc, Node *node)
4721 jhtml_t *jhtml = GET_JHTML(pdoc);
4722 Doc *doc = jhtml->doc;
4724 char *attr_style = NULL;
4725 char *attr_color = NULL;
4726 char *attr_size = NULL;
4727 for (attr = qs_get_attr(doc,node);
4729 attr = qs_get_next_attr(doc,attr)) {
4730 char *name = qs_get_attr_name(doc,attr);
4731 char *value = qs_get_attr_value(doc,attr);
4732 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4736 if (IS_CSS_ON(jhtml->entryp)) {
4737 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4739 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4740 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4741 css_property_t *cur;
4742 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4743 if (cur->value && *cur->value) {
4744 attr_color = apr_pstrdup(doc->pool, cur->value);
4747 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4748 if (cur->value && *cur->value) {
4749 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4750 attr_size = apr_pstrdup(doc->pool, "1");
4752 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4753 attr_size = apr_pstrdup(doc->pool, "2");
4755 else if (STRCASEEQ('s','S',"small",cur->value)) {
4756 attr_size = apr_pstrdup(doc->pool, "3");
4758 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4759 attr_size = apr_pstrdup(doc->pool, "4");
4761 else if (STRCASEEQ('l','L',"large",cur->value)) {
4762 attr_size = apr_pstrdup(doc->pool, "5");
4764 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4765 attr_size = apr_pstrdup(doc->pool, "6");
4767 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4768 attr_size = apr_pstrdup(doc->pool, "7");
4775 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4776 memset(flg, 0, sizeof(*flg));
4777 if (attr_color || attr_size) {
4780 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4791 flg->with_font_flag = 1;
4793 node->userData = (void *)flg;
4799 * It is a handler who processes the MENU tag.
4801 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4802 * destination is specified.
4803 * @param node [i] The MENU tag node is specified.
4804 * @return The conversion result is returned.
4807 s_jhtml_end_menu_tag(void *pdoc, Node *node)
4809 jhtml_t *jhtml = GET_JHTML(pdoc);
4810 Doc *doc = jhtml->doc;
4811 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4812 if (flg && flg->with_font_flag) {
4816 if (IS_CSS_ON(jhtml->entryp)) {
4817 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4824 * It is a handler who processes the PLAINTEXT tag.
4826 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4827 * destination is specified.
4828 * @param node [i] The PLAINTEXT tag node is specified.
4829 * @return The conversion result is returned.
4832 s_jhtml_start_plaintext_tag(void *pdoc, Node *node)
4837 jhtml = GET_JHTML(pdoc);
4840 s_jhtml_start_plaintext_tag_inner(pdoc,node);
4845 s_jhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
4850 jhtml = GET_JHTML(pdoc);
4852 for (child = qs_get_child_node(doc, node);
4854 child = qs_get_next_node(doc, child)) {
4856 s_jhtml_start_plaintext_tag_inner(pdoc, child);
4863 * It is a handler who processes the PLAINTEXT tag.
4865 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4866 * destination is specified.
4867 * @param node [i] The PLAINTEXT tag node is specified.
4868 * @return The conversion result is returned.
4871 s_jhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4873 jhtml_t *jhtml = GET_JHTML(pdoc);
4879 * It is a handler who processes the BLINK tag.
4881 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4882 * destination is specified.
4883 * @param node [i] The BLINK tag node is specified.
4884 * @return The conversion result is returned.
4887 s_jhtml_start_blink_tag(void *pdoc, Node *node)
4889 jhtml_t *jhtml = GET_JHTML(pdoc);
4890 Doc *doc = jhtml->doc;
4892 char *attr_style = NULL;
4893 char *attr_color = NULL;
4894 char *attr_size = NULL;
4895 for (attr = qs_get_attr(doc,node);
4897 attr = qs_get_next_attr(doc,attr)) {
4898 char *name = qs_get_attr_name(doc,attr);
4899 char *value = qs_get_attr_value(doc,attr);
4900 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4904 if (IS_CSS_ON(jhtml->entryp)) {
4905 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4907 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4908 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4909 css_property_t *cur;
4910 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4911 if (cur->value && *cur->value) {
4912 attr_color = apr_pstrdup(doc->pool, cur->value);
4915 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4916 if (cur->value && *cur->value) {
4917 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4918 attr_size = apr_pstrdup(doc->pool, "1");
4920 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4921 attr_size = apr_pstrdup(doc->pool, "2");
4923 else if (STRCASEEQ('s','S',"small",cur->value)) {
4924 attr_size = apr_pstrdup(doc->pool, "3");
4926 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4927 attr_size = apr_pstrdup(doc->pool, "4");
4929 else if (STRCASEEQ('l','L',"large",cur->value)) {
4930 attr_size = apr_pstrdup(doc->pool, "5");
4932 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4933 attr_size = apr_pstrdup(doc->pool, "6");
4935 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4936 attr_size = apr_pstrdup(doc->pool, "7");
4943 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4944 memset(flg, 0, sizeof(*flg));
4945 if (attr_color || attr_size) {
4948 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4959 flg->with_font_flag = 1;
4961 node->userData = (void *)flg;
4967 * It is a handler who processes the BLINK tag.
4969 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4970 * destination is specified.
4971 * @param node [i] The BLINK tag node is specified.
4972 * @return The conversion result is returned.
4975 s_jhtml_end_blink_tag(void *pdoc, Node *node)
4977 jhtml_t *jhtml = GET_JHTML(pdoc);
4978 Doc *doc = jhtml->doc;
4979 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4980 if (flg && flg->with_font_flag) {
4984 if (IS_CSS_ON(jhtml->entryp)) {
4985 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4992 * It is a handler who processes the MARQUEE tag.
4994 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4995 * destination is specified.
4996 * @param node [i] The MARQUEE tag node is specified.
4997 * @return The conversion result is returned.
5000 s_jhtml_start_marquee_tag(void *pdoc, Node *node)
5002 jhtml_t *jhtml = GET_JHTML(pdoc);
5003 Doc *doc = jhtml->doc;
5005 char *attr_direction = NULL;
5006 char *attr_style = NULL;
5007 char *attr_color = NULL;
5008 char *attr_size = NULL;
5009 /*--------------------------------------------------------------------------*/
5010 /* Get Attributes */
5011 /*--------------------------------------------------------------------------*/
5012 for (attr = qs_get_attr(doc,node);
5014 attr = qs_get_next_attr(doc,attr)) {
5015 char *name = qs_get_attr_name(doc,attr);
5016 char *value = qs_get_attr_value(doc,attr);
5017 if (STRCASEEQ('d','D',"direction", name)) {
5018 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
5019 attr_direction = value;
5022 else if (STRCASEEQ('b','B',"behavior",name)) {
5025 else if (STRCASEEQ('l','L',"loop",name)) {
5028 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5032 if (IS_CSS_ON(jhtml->entryp)) {
5033 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
5035 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5036 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5037 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5038 css_property_t *cur;
5039 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5040 if (cur->value && *cur->value) {
5041 attr_color = apr_pstrdup(doc->pool, cur->value);
5044 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5045 if (cur->value && *cur->value) {
5046 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5047 attr_size = apr_pstrdup(doc->pool, "1");
5049 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5050 attr_size = apr_pstrdup(doc->pool, "2");
5052 else if (STRCASEEQ('s','S',"small",cur->value)) {
5053 attr_size = apr_pstrdup(doc->pool, "3");
5055 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5056 attr_size = apr_pstrdup(doc->pool, "4");
5058 else if (STRCASEEQ('l','L',"large",cur->value)) {
5059 attr_size = apr_pstrdup(doc->pool, "5");
5061 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5062 attr_size = apr_pstrdup(doc->pool, "6");
5064 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5065 attr_size = apr_pstrdup(doc->pool, "7");
5069 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5070 if (cur->value && *cur->value) {
5071 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5072 attr_direction = "right";
5074 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5075 attr_direction = "left";
5082 if (attr_direction) {
5083 W_L(" direction=\"");
5084 W_V(attr_direction);
5089 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
5090 memset(flg, 0, sizeof(*flg));
5091 if (attr_color || attr_size) {
5094 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5105 flg->with_font_flag = 1;
5107 node->userData = (void *)flg;
5113 * It is a handler who processes the MARQUEE tag.
5115 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5116 * destination is specified.
5117 * @param node [i] The MARQUEE tag node is specified.
5118 * @return The conversion result is returned.
5121 s_jhtml_end_marquee_tag(void *pdoc, Node *node)
5123 jhtml_t *jhtml = GET_JHTML(pdoc);
5124 Doc *doc = jhtml->doc;
5126 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5127 if (flg && flg->with_font_flag) {
5131 if (IS_CSS_ON(jhtml->entryp)) {
5132 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5139 * It is handler who processes the New Line Code.
5142 s_jhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5144 jhtml_t *jhtml = GET_JHTML(pdoc);
5145 Doc *doc = jhtml->doc;
5152 * It is a handler who processes the LINK tag.
5154 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5155 * destination is specified.
5156 * @param node [i] The LINK tag node is specified.
5157 * @return The conversion result is returned.
5160 s_jhtml_link_tag(void *pdoc, Node *node)
5169 jhtml = GET_JHTML(pdoc);
5172 if (! IS_CSS_ON(jhtml->entryp)) {
5176 for (attr = qs_get_attr(doc,node);
5178 attr = qs_get_next_attr(doc,attr)) {
5179 char *name = qs_get_attr_name(doc,attr);
5180 char *value = qs_get_attr_value(doc,attr);
5181 if (STRCASEEQ('r','R',"rel", name)) {
5182 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5186 else if (STRCASEEQ('h','H',"href", name)) {
5187 if (value && *value) {
5191 else if (STRCASEEQ('t','T',"type", name)) {
5192 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5198 if (rel && href && type) {
5199 DBG(doc->r, "start load CSS. url:[%s]", href);
5200 jhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jhtml->style, href);
5201 DBG(doc->r, "end load CSS. url:[%s]", href);
5208 static css_prop_list_t *
5209 s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5211 jhtml_t *jhtml = GET_JHTML(pdoc);
5212 Doc *doc = jhtml->doc;
5213 css_prop_list_t *last_css = NULL;
5214 if (IS_CSS_ON(jhtml->entryp)) {
5215 css_prop_list_t *dup_css;
5216 css_selector_t *selector;
5218 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5219 dup_css = chxj_dup_css_prop_list(doc, last_css);
5220 selector = chxj_css_find_selector(doc, jhtml->style, node);
5222 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5224 chxj_css_push_prop_list(jhtml->css_prop_stack, dup_css);
5225 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5227 if (style_attr_value) {
5228 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));
5230 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5238 static css_prop_list_t *
5239 s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5241 jhtml_t *jhtml = GET_JHTML(pdoc);
5242 Doc *doc = jhtml->doc;
5243 css_prop_list_t *last_css = NULL;
5244 if (IS_CSS_ON(jhtml->entryp)) {
5245 css_prop_list_t *dup_css;
5246 css_selector_t *selector;
5248 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5249 dup_css = chxj_dup_css_prop_list(doc, last_css);
5250 selector = chxj_css_find_selector(doc, jhtml->style, node);
5252 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5256 if (style_attr_value) {
5257 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));
5259 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5268 * It is a handler who processes the SPAN tag.
5270 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5271 * destination is specified.
5272 * @param node [i] The SPAN tag node is specified.
5273 * @return The conversion result is returned.
5276 s_jhtml_start_span_tag(void *pdoc, Node *node)
5281 char *attr_style = NULL;
5282 char *attr_color = NULL;
5283 char *attr_size = NULL;
5284 char *attr_align = NULL;
5285 char *attr_blink = NULL;
5286 char *attr_marquee = NULL;
5287 char *attr_marquee_dir = NULL;
5288 char *attr_marquee_style = NULL;
5289 char *attr_marquee_loop = NULL;
5291 jhtml = GET_JHTML(pdoc);
5294 for (attr = qs_get_attr(doc,node);
5296 attr = qs_get_next_attr(doc,attr)) {
5297 char *nm = qs_get_attr_name(doc,attr);
5298 char *val = qs_get_attr_value(doc,attr);
5299 if (val && STRCASEEQ('s','S',"style", nm)) {
5303 if (IS_CSS_ON(jhtml->entryp)) {
5304 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
5306 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5307 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5308 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5309 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5310 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5311 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5312 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5313 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5314 css_property_t *cur;
5315 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5316 attr_color = apr_pstrdup(doc->pool, cur->value);
5318 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5319 if (cur->value && *cur->value) {
5320 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5321 attr_size = apr_pstrdup(doc->pool, "1");
5323 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5324 attr_size = apr_pstrdup(doc->pool, "2");
5326 else if (STRCASEEQ('s','S',"small",cur->value)) {
5327 attr_size = apr_pstrdup(doc->pool, "3");
5329 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5330 attr_size = apr_pstrdup(doc->pool, "4");
5332 else if (STRCASEEQ('l','L',"large",cur->value)) {
5333 attr_size = apr_pstrdup(doc->pool, "5");
5335 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5336 attr_size = apr_pstrdup(doc->pool, "6");
5338 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5339 attr_size = apr_pstrdup(doc->pool, "7");
5343 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5344 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5345 attr_blink = apr_pstrdup(doc->pool, cur->value);
5348 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5349 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5350 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5353 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5354 if (cur->value && *cur->value) {
5355 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5356 attr_marquee_dir = "right";
5358 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5359 attr_marquee_dir = "left";
5363 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5364 if (cur->value && *cur->value) {
5365 if ( STRCASEEQ('s','S',"scroll",cur->value)
5366 || STRCASEEQ('s','S',"slide",cur->value)
5367 || STRCASEEQ('a','A',"alternate",cur->value)) {
5368 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5372 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5373 if (cur->value && *cur->value) {
5374 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5375 attr_marquee_loop = "16";
5378 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5382 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5383 if (STRCASEEQ('l','L',"left", cur->value)) {
5384 attr_align = apr_pstrdup(doc->pool, "left");
5386 else if (STRCASEEQ('c','C',"center",cur->value)) {
5387 attr_align = apr_pstrdup(doc->pool, "center");
5389 else if (STRCASEEQ('r','R',"right",cur->value)) {
5390 attr_align = apr_pstrdup(doc->pool, "right");
5395 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5396 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5397 memset(flg, 0, sizeof(*flg));
5400 flg->with_blink_flag = 1;
5404 if (attr_marquee_dir) {
5405 W_L(" direction=\"");
5406 W_V(attr_marquee_dir);
5409 if (attr_marquee_style) {
5410 W_L(" behavior=\"");
5411 W_V(attr_marquee_style);
5414 if (attr_marquee_loop) {
5416 W_V(attr_marquee_loop);
5420 flg->with_marquee_flag = 1;
5422 if (attr_color||attr_size) {
5425 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5436 flg->with_font_flag = 1;
5439 W_L("<div align=\"");
5442 flg->with_div_flag = 1;
5444 node->userData = flg;
5447 node->userData = NULL;
5454 * It is a handler who processes the SPAN tag.
5456 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5457 * destination is specified.
5458 * @param node [i] The SPAN tag node is specified.
5459 * @return The conversion result is returned.
5462 s_jhtml_end_span_tag(void *pdoc, Node *node)
5464 jhtml_t *jhtml = GET_JHTML(pdoc);
5465 Doc *doc = jhtml->doc;
5467 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5468 if (flg && flg->with_div_flag) {
5471 if (flg && flg->with_font_flag) {
5474 if (flg && flg->with_marquee_flag) {
5477 if (flg && flg->with_blink_flag) {
5480 if (IS_CSS_ON(jhtml->entryp)) {
5481 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5488 * It is a handler who processes the STYLE tag.
5490 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5491 * destination is specified.
5492 * @param node [i] The STYLE tag node is specified.
5493 * @return The conversion result is returned.
5496 s_jhtml_style_tag(void *pdoc, Node *node)
5503 jhtml = GET_JHTML(pdoc);
5506 if (! IS_CSS_ON(jhtml->entryp)) {
5510 for (attr = qs_get_attr(doc,node);
5512 attr = qs_get_next_attr(doc,attr)) {
5513 char *name = qs_get_attr_name(doc,attr);
5514 char *value = qs_get_attr_value(doc,attr);
5515 if (STRCASEEQ('t','T',"type", name)) {
5516 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5522 Node *child = qs_get_child_node(doc, node);
5523 if (type && child) {
5524 char *name = qs_get_node_name(doc, child);
5525 if (STRCASEEQ('t','T',"text", name)) {
5526 char *value = qs_get_node_value(doc, child);
5527 DBG(doc->r, "start load CSS. buf:[%s]", value);
5528 jhtml->style = chxj_css_parse_style_value(doc, jhtml->style, value);
5529 DBG(doc->r, "end load CSS. value:[%s]", value);
5536 s_add_copyright_parameter(request_rec *r, char *value)
5538 request_rec *sub_req = NULL;
5541 char *content_type = NULL;
5542 apr_table_t *headers_out = NULL;
5544 DBG(r, "REQ[%X] start s_add_copyright_parameter", TO_ADDR(r));
5545 apr_pool_create(&pool, r->pool);
5547 if (chxj_starts_with(value, "http:") || chxj_starts_with(value, "https:")) {
5548 apr_table_t *response;
5549 int response_code = 0;
5550 response = chxj_serf_head(r, pool, value, &response_code);
5551 if (response_code != HTTP_OK) {
5552 DBG(r, "REQ[%X] end s_add_copyright_parameter (serf_req->status:[%d])", TO_ADDR(r), response_code);
5555 content_type = (char *)apr_table_get(response, "Content-Type");
5556 headers_out = response;
5559 // sub_req = ap_sub_req_method_uri("GET", value, r, r->output_filters);
5560 sub_req = ap_sub_req_lookup_uri(value, r, r->output_filters);
5561 if (sub_req->status != HTTP_OK) {
5562 DBG(r, "REQ[%X] end s_add_copyright_parameter (sub_req->status:[%d])", TO_ADDR(r), sub_req->status);
5563 ap_destroy_sub_req(sub_req);
5566 sub_req->header_only = 1;
5567 sub_req->main = NULL;
5568 rr_status = ap_run_sub_req(sub_req);
5569 DBG(r, "REQ[%X] sub_req4:ContentType:[%s]", TO_ADDR(r), sub_req->content_type);
5570 DBG(r, "REQ[%X] rr_status:[%d]", TO_ADDR(r), rr_status);
5571 content_type = apr_pstrdup(pool, sub_req->content_type);
5572 headers_out = sub_req->headers_out;
5574 if (headers_out && apr_table_get(headers_out, "x-jphone-copyright")) {
5575 if (content_type && strncasecmp("image/jpeg", content_type, 10) == 0) {
5576 if (strchr(value, '?')) {
5577 value = apr_psprintf(pool, "%s&_chxj_copy=.jpz", value);
5580 value = apr_psprintf(pool, "%s?_chxj_copy=.jpz", value);
5583 else if (content_type && strncasecmp("image/png", content_type, 9) == 0) {
5584 if (strchr(value, '?')) {
5585 value = apr_psprintf(pool, "%s&_chxj_copy=.pnz", value);
5588 value = apr_psprintf(pool, "%s?_chxj_copy=.pnz", value);
5593 ap_destroy_sub_req(sub_req);
5595 DBG(r, "REQ[%X] end s_add_copyright_parameter(result:[%s]", TO_ADDR(r), value);