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"
28 #include "chxj_conv_z2h.h"
31 #define GET_JHTML(X) ((jhtml_t *)(X))
34 #define W_L(X) do { jhtml->out = BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, (X)); } while(0)
35 #define W_V(X) do { jhtml->out = (X) ? BUFFERED_WRITE_VALUE(jhtml->out, &doc->buf, (X)) \
36 : BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, ""); } while(0)
38 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jhtml->conf); W_V(nlcode); } while (0)
40 static char *s_jhtml_start_html_tag (void *pdoc, Node *node);
41 static char *s_jhtml_end_html_tag (void *pdoc, Node *node);
42 static char *s_jhtml_start_meta_tag (void *pdoc, Node *node);
43 static char *s_jhtml_end_meta_tag (void *pdoc, Node *node);
44 static char *s_jhtml_start_head_tag (void *pdoc, Node *node);
45 static char *s_jhtml_end_head_tag (void *pdoc, Node *node);
46 static char *s_jhtml_start_title_tag (void *pdoc, Node *node);
47 static char *s_jhtml_end_title_tag (void *pdoc, Node *node);
48 static char *s_jhtml_start_base_tag (void *pdoc, Node *node);
49 static char *s_jhtml_end_base_tag (void *pdoc, Node *node);
50 static char *s_jhtml_start_body_tag (void *pdoc, Node *node);
51 static char *s_jhtml_end_body_tag (void *pdoc, Node *node);
52 static char *s_jhtml_start_a_tag (void *pdoc, Node *node);
53 static char *s_jhtml_end_a_tag (void *pdoc, Node *node);
54 static char *s_jhtml_start_pre_tag (void *pdoc, Node *node);
55 static char *s_jhtml_end_pre_tag (void *pdoc, Node *node);
56 static char *s_jhtml_start_p_tag (void *pdoc, Node *node);
57 static char *s_jhtml_end_p_tag (void *pdoc, Node *node);
58 static char *s_jhtml_start_ul_tag (void *pdoc, Node *node);
59 static char *s_jhtml_end_ul_tag (void *pdoc, Node *node);
60 static char *s_jhtml_start_ol_tag (void *pdoc, Node *node);
61 static char *s_jhtml_end_ol_tag (void *pdoc, Node *node);
62 static char *s_jhtml_start_li_tag (void *pdoc, Node *node);
63 static char *s_jhtml_end_li_tag (void *pdoc, Node *node);
64 static char *s_jhtml_start_br_tag (void *pdoc, Node *node);
65 static char *s_jhtml_end_br_tag (void *pdoc, Node *node);
66 static char *s_jhtml_start_tr_tag (void *pdoc, Node *node);
67 static char *s_jhtml_end_tr_tag (void *pdoc, Node *node);
68 static char *s_jhtml_start_font_tag (void *pdoc, Node *node);
69 static char *s_jhtml_end_font_tag (void *pdoc, Node *node);
70 static char *s_jhtml_start_form_tag (void *pdoc, Node *node);
71 static char *s_jhtml_end_form_tag (void *pdoc, Node *node);
72 static char *s_jhtml_start_input_tag (void *pdoc, Node *node);
73 static char *s_jhtml_end_input_tag (void *pdoc, Node *node);
74 static char *s_jhtml_start_center_tag (void *pdoc, Node *node);
75 static char *s_jhtml_end_center_tag (void *pdoc, Node *node);
76 static char *s_jhtml_start_hr_tag (void *pdoc, Node *node);
77 static char *s_jhtml_end_hr_tag (void *pdoc, Node *node);
78 static char *s_jhtml_start_img_tag (void *pdoc, Node *node);
79 static char *s_jhtml_end_img_tag (void *pdoc, Node *node);
80 static char *s_jhtml_start_select_tag (void *pdoc, Node *node);
81 static char *s_jhtml_end_select_tag (void *pdoc, Node *node);
82 static char *s_jhtml_start_option_tag (void *pdoc, Node *node);
83 static char *s_jhtml_end_option_tag (void *pdoc, Node *node);
84 static char *s_jhtml_start_div_tag (void *pdoc, Node *node);
85 static char *s_jhtml_end_div_tag (void *pdoc, Node *node);
86 static char *s_jhtml_start_textarea_tag (void *pdoc, Node *node);
87 static char *s_jhtml_end_textarea_tag (void *pdoc, Node *node);
88 static char *s_jhtml_start_b_tag (void *pdoc, Node *node);
89 static char *s_jhtml_end_b_tag (void *pdoc, Node *node);
90 static char *s_jhtml_chxjif_tag (void *pdoc, Node *node);
91 static char *s_jhtml_text_tag (void *pdoc, Node *node);
92 static char *s_jhtml_start_blockquote_tag (void *pdoc, Node *node);
93 static char *s_jhtml_end_blockquote_tag (void *pdoc, Node *node);
94 static char *s_jhtml_start_dir_tag (void *pdoc, Node *node);
95 static char *s_jhtml_end_dir_tag (void *pdoc, Node *node);
96 static char *s_jhtml_start_dl_tag (void *pdoc, Node *node);
97 static char *s_jhtml_end_dl_tag (void *pdoc, Node *node);
98 static char *s_jhtml_start_dt_tag (void *pdoc, Node *node);
99 static char *s_jhtml_end_dt_tag (void *pdoc, Node *node);
100 static char *s_jhtml_start_dd_tag (void *pdoc, Node *node);
101 static char *s_jhtml_end_dd_tag (void *pdoc, Node *node);
102 static char *s_jhtml_start_h1_tag (void *pdoc, Node *node);
103 static char *s_jhtml_end_h1_tag (void *pdoc, Node *node);
104 static char *s_jhtml_start_h2_tag (void *pdoc, Node *node);
105 static char *s_jhtml_end_h2_tag (void *pdoc, Node *node);
106 static char *s_jhtml_start_h3_tag (void *pdoc, Node *node);
107 static char *s_jhtml_end_h3_tag (void *pdoc, Node *node);
108 static char *s_jhtml_start_h4_tag (void *pdoc, Node *node);
109 static char *s_jhtml_end_h4_tag (void *pdoc, Node *node);
110 static char *s_jhtml_start_h5_tag (void *pdoc, Node *node);
111 static char *s_jhtml_end_h5_tag (void *pdoc, Node *node);
112 static char *s_jhtml_start_h6_tag (void *pdoc, Node *node);
113 static char *s_jhtml_end_h6_tag (void *pdoc, Node *node);
114 static char *s_jhtml_start_menu_tag (void *pdoc, Node *node);
115 static char *s_jhtml_end_menu_tag (void *pdoc, Node *node);
116 static char *s_jhtml_start_plaintext_tag (void *pdoc, Node *node);
117 static char *s_jhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
118 static char *s_jhtml_end_plaintext_tag (void *pdoc, Node *node);
119 static char *s_jhtml_start_blink_tag (void *pdoc, Node *node);
120 static char *s_jhtml_end_blink_tag (void *pdoc, Node *node);
121 static char *s_jhtml_start_marquee_tag (void *pdoc, Node *node);
122 static char *s_jhtml_end_marquee_tag (void *pdoc, Node *node);
123 static char *s_jhtml_newline_mark (void *pdoc, Node *node);
124 static char *s_jhtml_link_tag (void *pdoc, Node *node);
125 static char *s_jhtml_start_span_tag (void *pdoc, Node *node);
126 static char *s_jhtml_end_span_tag (void *pdoc, Node *node);
127 static char *s_jhtml_style_tag (void *pdoc, Node *node);
129 static void s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec);
131 static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
133 static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
134 static css_prop_list_t *s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
135 static css_prop_list_t *s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
137 static char *s_add_copyright_parameter(request_rec *r, char *value);
140 tag_handler jhtml_handler[] = {
143 s_jhtml_start_html_tag,
144 s_jhtml_end_html_tag,
148 s_jhtml_start_meta_tag,
149 s_jhtml_end_meta_tag,
153 s_jhtml_start_textarea_tag,
154 s_jhtml_end_textarea_tag,
163 s_jhtml_start_pre_tag,
168 s_jhtml_start_ul_tag,
173 s_jhtml_start_li_tag,
178 s_jhtml_start_ol_tag,
183 s_jhtml_start_h1_tag,
188 s_jhtml_start_h2_tag,
193 s_jhtml_start_h3_tag,
198 s_jhtml_start_h4_tag,
203 s_jhtml_start_h5_tag,
208 s_jhtml_start_h6_tag,
213 s_jhtml_start_head_tag,
214 s_jhtml_end_head_tag,
218 s_jhtml_start_title_tag,
219 s_jhtml_end_title_tag,
223 s_jhtml_start_base_tag,
224 s_jhtml_end_base_tag,
228 s_jhtml_start_body_tag,
229 s_jhtml_end_body_tag,
238 s_jhtml_start_br_tag,
248 s_jhtml_start_tr_tag,
263 s_jhtml_start_font_tag,
264 s_jhtml_end_font_tag,
268 s_jhtml_start_form_tag,
269 s_jhtml_end_form_tag,
273 s_jhtml_start_input_tag,
274 s_jhtml_end_input_tag,
278 s_jhtml_start_center_tag,
279 s_jhtml_end_center_tag,
283 s_jhtml_start_hr_tag,
288 s_jhtml_start_img_tag,
293 s_jhtml_start_select_tag,
294 s_jhtml_end_select_tag,
298 s_jhtml_start_option_tag,
299 s_jhtml_end_option_tag,
303 s_jhtml_start_div_tag,
333 s_jhtml_start_span_tag,
334 s_jhtml_end_span_tag,
358 s_jhtml_start_dt_tag,
373 s_jhtml_start_blockquote_tag,
374 s_jhtml_end_blockquote_tag,
378 s_jhtml_start_dir_tag,
383 s_jhtml_start_dl_tag,
388 s_jhtml_start_dd_tag,
393 s_jhtml_start_menu_tag,
394 s_jhtml_end_menu_tag,
398 s_jhtml_start_plaintext_tag,
399 s_jhtml_end_plaintext_tag,
403 s_jhtml_start_blink_tag,
404 s_jhtml_end_blink_tag,
408 s_jhtml_start_marquee_tag,
409 s_jhtml_end_marquee_tag,
418 s_jhtml_newline_mark,
440 * converts from CHTML5.0 to JHTML.
442 * @param r [i] Requet_rec is appointed.
443 * @param spec [i] The result of the device specification processing which
444 * was done in advance is appointed.
445 * @param src [i] The character string before the converting is appointed.
446 * @return The character string after the converting is returned.
455 chxjconvrule_entry *entryp,
467 /*--------------------------------------------------------------------------*/
469 /*--------------------------------------------------------------------------*/
471 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
473 DBG(r,"I found qrcode xml");
476 DBG(r,"not found qrcode xml");
478 /*--------------------------------------------------------------------------*/
479 /* The CHTML structure is initialized. */
480 /*--------------------------------------------------------------------------*/
481 s_init_jhtml(&jhtml, &doc, r, spec);
483 jhtml.entryp = entryp;
484 jhtml.cookie = cookie;
486 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
488 /*--------------------------------------------------------------------------*/
489 /* The character string of the input is analyzed. */
490 /*--------------------------------------------------------------------------*/
491 qs_init_malloc(&doc);
492 qs_init_root_node(&doc);
494 apr_pool_create(&pool, r->pool);
495 ss = apr_pcalloc(pool, srclen + 1);
497 memset(ss, 0, srclen + 1);
498 memcpy(ss, src, srclen);
501 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
503 if (IS_CSS_ON(jhtml.entryp)) {
504 /* current property list */
505 jhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
508 qs_parse_string(&doc,ss,strlen(ss));
510 chxj_buffered_write_init(r->pool, &doc.buf);
511 /*--------------------------------------------------------------------------*/
512 /* It converts it from CHTML to JHTML. */
513 /*--------------------------------------------------------------------------*/
514 chxj_node_convert(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
515 jhtml.out = chxj_buffered_write_flush(jhtml.out, &doc.buf);
516 dst = apr_pstrdup(pool, jhtml.out);
517 chxj_buffered_write_terminate(&doc.buf);
520 qs_all_free(&doc,QX_LOGMARK);
523 return apr_pstrdup(pool,ss);
526 dst = apr_psprintf(pool, "\n");
528 *dstlen = strlen(dst);
531 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
539 * The CHTML structure is initialized.
541 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
542 * initialized is specified.
543 * @param doc [i] The Doc structure that should be set to the initialized
544 * JHTML structure is specified.
545 * @param r [i] To use POOL, the pointer to request_rec is specified.
546 * @param spec [i] The pointer to the device_table
549 s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec)
551 memset(doc, 0, sizeof(Doc));
552 memset(jhtml, 0, sizeof(jhtml_t));
557 jhtml->out = qs_alloc_zero_byte_string(r->pool);
558 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
559 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
564 * Corresponding EMOJI to a current character-code is retrieved.
565 * The substitution character string is stored in the rslt pointer if agreeing.
567 * @param jhtml [i] The pointer to the CHTML structure is specified.
568 * @param txt [i] The character string to want to examine whether it is
569 * EMOJI is specified.
570 * @param rslt [o] The pointer to the pointer that stores the result is
572 * @return When corresponding EMOJI exists, it returns it excluding 0.
575 s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt)
587 if (! spec) DBG(r,"spec is NULL");
589 for (ee = jhtml->conf->emoji;
593 unsigned char hex1byte;
594 unsigned char hex2byte;
597 DBG(r,"emoji->imode is NULL");
601 hex1byte = ee->imode->hex1byte & 0xff;
602 hex2byte = ee->imode->hex2byte & 0xff;
604 if (ee->imode->string
605 && strlen(ee->imode->string) > 0
606 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
607 if (spec == NULL || spec->emoji_type == NULL) {
608 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
609 return strlen(ee->imode->string);
616 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
617 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
618 if (spec == NULL || spec->emoji_type == NULL) {
619 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
632 chxj_jhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
646 DBG(r, "REQ[%X] start chxj_jhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
647 memset(doc, 0, sizeof(Doc));
648 memset(jhtml, 0, sizeof(jhtml_t));
653 jhtml->out = qs_alloc_zero_byte_string(r->pool);
654 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
655 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
657 apr_pool_create(&pool, r->pool);
659 chxj_buffered_write_init(pool, &doc->buf);
661 for (ii=0; ii<len; ii++) {
665 rtn = s_jhtml_search_emoji(jhtml, (char *)&src[ii], &out);
672 if (is_sjis_kanji(src[ii])) {
673 two_byte[0] = src[ii+0];
674 two_byte[1] = src[ii+1];
680 one_byte[0] = src[ii+0];
685 jhtml->out = chxj_buffered_write_flush(jhtml->out, &doc->buf);
687 DBG(r, "REQ[%X] end chxj_jhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
693 * It is a handler who processes the HTML tag.
695 * @param pdoc [i/o] The pointer to the CHTML structure at the output
696 * destination is specified.
697 * @param node [i] The HTML tag node is specified.
698 * @return The conversion result is returned.
701 s_jhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
708 jhtml = GET_JHTML(pdoc);
711 DBG(r, "start s_jhtml_start_html_tag()");
713 /*--------------------------------------------------------------------------*/
715 /*--------------------------------------------------------------------------*/
718 DBG(r, "end s_jhtml_start_html_tag()");
725 * It is a handler who processes the HTML tag.
727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
728 * destination is specified.
729 * @param node [i] The HTML tag node is specified.
730 * @return The conversion result is returned.
733 s_jhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
735 jhtml_t *jhtml = GET_JHTML(pdoc);
736 Doc *doc = jhtml->doc;
745 * It is a handler who processes the META tag.
747 * @param pdoc [i/o] The pointer to the CHTML structure at the output
748 * destination is specified.
749 * @param node [i] The META tag node is specified.
750 * @return The conversion result is returned.
753 s_jhtml_start_meta_tag(void *pdoc, Node *node)
759 int content_type_flag;
762 jhtml = GET_JHTML(pdoc);
766 content_type_flag = 0;
769 /*--------------------------------------------------------------------------*/
771 /*--------------------------------------------------------------------------*/
772 for (attr = qs_get_attr(doc,node);
774 attr = qs_get_next_attr(doc,attr)) {
775 char *name = qs_get_attr_name(doc,attr);
776 char *value = qs_get_attr_value(doc,attr);
780 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
781 /*----------------------------------------------------------------------*/
783 /*----------------------------------------------------------------------*/
784 W_L(" http-equiv=\"");
787 if (STRCASEEQ('c','C',"content-type",value)) {
788 content_type_flag = 1;
790 if (STRCASEEQ('r','R',"refresh",value)) {
798 if (strcasecmp(name, "content") == 0 && value && *value) {
799 /*----------------------------------------------------------------------*/
801 /*----------------------------------------------------------------------*/
802 if (content_type_flag) {
806 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
815 buf = apr_pstrdup(r->pool, value);
817 url = strchr(buf, ';');
819 sec = apr_pstrdup(r->pool, buf);
822 url = chxj_encoding_parameter(r, url, 0);
823 url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
853 * It is a handler who processes the META tag.
855 * @param pdoc [i/o] The pointer to the CHTML structure at the output
856 * destination is specified.
857 * @param node [i] The META tag node is specified.
858 * @return The conversion result is returned.
861 s_jhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
863 jhtml_t *jhtml = GET_JHTML(pdoc);
870 * It is a handler who processes the HEAD tag.
872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
873 * destination is specified.
874 * @param node [i] The HEAD tag node is specified.
875 * @return The conversion result is returned.
878 s_jhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
884 jhtml = GET_JHTML(pdoc);
894 * It is a handler who processes the HEAD tag.
896 * @param pdoc [i/o] The pointer to the CHTML structure at the output
897 * destination is specified.
898 * @param node [i] The HEAD tag node is specified.
899 * @return The conversion result is returned.
902 s_jhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
908 jhtml = GET_JHTML(pdoc);
918 * It is a handler who processes the TITLE tag.
920 * @param pdoc [i/o] The pointer to the CHTML structure at the output
921 * destination is specified.
922 * @param node [i] The TITLE tag node is specified.
923 * @return The conversion result is returned.
926 s_jhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
932 jhtml = GET_JHTML(pdoc);
942 * It is a handler who processes the TITLE tag.
944 * @param pdoc [i/o] The pointer to the CHTML structure at the output
945 * destination is specified.
946 * @param node [i] The TITLE tag node is specified.
947 * @return The conversion result is returned.
950 s_jhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
956 jhtml = GET_JHTML(pdoc);
966 * It is a handler who processes the BASE tag.
968 * @param pdoc [i/o] The pointer to the CHTML structure at the output
969 * destination is specified.
970 * @param node [i] The BASE tag node is specified.
971 * @return The conversion result is returned.
974 s_jhtml_start_base_tag(void *pdoc, Node *node)
981 jhtml = GET_JHTML(pdoc);
986 /*--------------------------------------------------------------------------*/
988 /*--------------------------------------------------------------------------*/
989 for (attr = qs_get_attr(doc,node);
991 attr = qs_get_next_attr(doc,attr)) {
992 char *name = qs_get_attr_name(doc,attr);
993 char *value = qs_get_attr_value(doc,attr);
994 if (STRCASEEQ('h','H',"href",name)) {
1006 * It is a handler who processes the BASE tag.
1008 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1009 * destination is specified.
1010 * @param node [i] The BASE tag node is specified.
1011 * @return The conversion result is returned.
1014 s_jhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
1016 jhtml_t *jhtml = GET_JHTML(pdoc);
1022 * It is a handler who processes the BODY tag.
1024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1025 * destination is specified.
1026 * @param node [i] The BODY tag node is specified.
1027 * @return The conversion result is returned.
1030 s_jhtml_start_body_tag(void *pdoc, Node *node)
1036 char *attr_bgcolor = NULL;
1037 char *attr_text = NULL;
1038 char *attr_link = NULL;
1039 char *attr_style = NULL;
1040 char *attr_vlink = NULL;
1042 jhtml = GET_JHTML(pdoc);
1046 /*--------------------------------------------------------------------------*/
1047 /* Get Attributes */
1048 /*--------------------------------------------------------------------------*/
1049 for (attr = qs_get_attr(doc,node);
1051 attr = qs_get_next_attr(doc,attr)) {
1052 char *name = qs_get_attr_name(doc,attr);
1053 char *value = qs_get_attr_value(doc,attr);
1054 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1055 /*----------------------------------------------------------------------*/
1057 /*----------------------------------------------------------------------*/
1058 attr_bgcolor = value;
1060 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1061 /*----------------------------------------------------------------------*/
1063 /*----------------------------------------------------------------------*/
1066 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1067 /*----------------------------------------------------------------------*/
1069 /*----------------------------------------------------------------------*/
1072 else if (STRCASEEQ('a','A',"alink",name)) {
1073 /*----------------------------------------------------------------------*/
1075 /*----------------------------------------------------------------------*/
1078 else if (STRCASEEQ('v','V',"vlink",name) && value && *value) {
1079 /*----------------------------------------------------------------------*/
1081 /*----------------------------------------------------------------------*/
1084 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1085 /*----------------------------------------------------------------------*/
1087 /*----------------------------------------------------------------------*/
1092 if (IS_CSS_ON(jhtml->entryp)) {
1093 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1095 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1096 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1097 css_property_t *cur;
1098 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1099 if (cur->value && *cur->value) {
1100 attr_text = apr_pstrdup(doc->pool, cur->value);
1103 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1104 if (cur->value && *cur->value) {
1105 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1110 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jhtml->style);
1111 css_selector_t *cur_sel;
1112 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1113 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1114 css_property_t *cur;
1115 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1116 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1117 attr_link = apr_pstrdup(doc->pool, cur->value);
1121 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1122 css_property_t *cur;
1123 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1124 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1125 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1135 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1141 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1147 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1153 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1165 * It is a handler who processes the BODY tag.
1167 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1168 * destination is specified.
1169 * @param node [i] The BODY tag node is specified.
1170 * @return The conversion result is returned.
1173 s_jhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1179 jhtml = GET_JHTML(pdoc);
1184 if (IS_CSS_ON(jhtml->entryp)) {
1185 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1193 * It is a handler who processes the A tag.
1195 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1196 * destination is specified.
1197 * @param node [i] The A tag node is specified.
1198 * @return The conversion result is returned.
1201 s_jhtml_start_a_tag(void *pdoc, Node *node)
1207 char *attr_style = NULL;
1209 jhtml = GET_JHTML(pdoc);
1214 /*--------------------------------------------------------------------------*/
1215 /* Get Attributes */
1216 /*--------------------------------------------------------------------------*/
1217 for (attr = qs_get_attr(doc,node);
1219 attr = qs_get_next_attr(doc,attr)) {
1220 char *name = qs_get_attr_name(doc,attr);
1221 char *value = qs_get_attr_value(doc,attr);
1222 if (STRCASEEQ('n','N',"name",name)) {
1223 /*----------------------------------------------------------------------*/
1225 /*----------------------------------------------------------------------*/
1230 else if (STRCASEEQ('h','H',"href",name)) {
1231 /*----------------------------------------------------------------------*/
1233 /*----------------------------------------------------------------------*/
1234 value = chxj_encoding_parameter(r, value, 0);
1235 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1236 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1237 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
1243 else if (STRCASEEQ('a','A',"accesskey",name)) {
1244 /*----------------------------------------------------------------------*/
1246 /*----------------------------------------------------------------------*/
1247 W_L(" accesskey=\"");
1251 else if (STRCASEEQ('c','C',"cti",name)) {
1252 /*----------------------------------------------------------------------*/
1254 /*----------------------------------------------------------------------*/
1259 else if (STRCASEEQ('i','I',"ijam",name)) {
1260 /*----------------------------------------------------------------------*/
1262 /*----------------------------------------------------------------------*/
1265 else if (STRCASEEQ('u','U',"utn",name)) {
1266 /*----------------------------------------------------------------------*/
1268 /* It is special only for CHTML. */
1269 /*----------------------------------------------------------------------*/
1271 else if (STRCASEEQ('t','T',"telbook",name)) {
1272 /*----------------------------------------------------------------------*/
1274 /*----------------------------------------------------------------------*/
1277 else if (STRCASEEQ('k','K',"kana",name)) {
1278 /*----------------------------------------------------------------------*/
1280 /*----------------------------------------------------------------------*/
1283 else if (STRCASEEQ('e','E',"email",name)) {
1284 /*----------------------------------------------------------------------*/
1286 /*----------------------------------------------------------------------*/
1289 else if (STRCASEEQ('i','I',"ista",name)) {
1290 /*----------------------------------------------------------------------*/
1292 /*----------------------------------------------------------------------*/
1295 else if (STRCASEEQ('i','I',"ilet",name)) {
1296 /*----------------------------------------------------------------------*/
1298 /*----------------------------------------------------------------------*/
1301 else if (STRCASEEQ('i','I',"iswf",name)) {
1302 /*----------------------------------------------------------------------*/
1304 /*----------------------------------------------------------------------*/
1307 else if (STRCASEEQ('i','I',"irst",name)) {
1308 /*----------------------------------------------------------------------*/
1310 /*----------------------------------------------------------------------*/
1313 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1319 if (IS_CSS_ON(jhtml->entryp)) {
1320 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1328 * It is a handler who processes the A tag.
1330 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1331 * destination is specified.
1332 * @param node [i] The A tag node is specified.
1333 * @return The conversion result is returned.
1336 s_jhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1342 jhtml = GET_JHTML(pdoc);
1348 if (IS_CSS_ON(jhtml->entryp)) {
1349 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1357 * It is a handler who processes the BR tag.
1359 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1360 * destination is specified.
1361 * @param node [i] The BR tag node is specified.
1362 * @return The conversion result is returned.
1365 s_jhtml_start_br_tag(void *pdoc, Node *node)
1372 jhtml = GET_JHTML(pdoc);
1377 /*--------------------------------------------------------------------------*/
1378 /* Get Attributes */
1379 /*--------------------------------------------------------------------------*/
1380 for (attr = qs_get_attr(doc,node);
1382 attr = qs_get_next_attr(doc,attr)) {
1383 char *name = qs_get_attr_name(doc,attr);
1384 char *value = qs_get_attr_value(doc,attr);
1385 if (STRCASEEQ('c','C',"clear",name)) {
1386 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1399 * It is a handler who processes the BR tag.
1401 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1402 * destination is specified.
1403 * @param node [i] The BR tag node is specified.
1404 * @return The conversion result is returned.
1407 s_jhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1409 jhtml_t *jhtml = GET_JHTML(pdoc);
1415 * It is a handler who processes the TR tag.
1417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1418 * destination is specified.
1419 * @param node [i] The TR tag node is specified.
1420 * @return The conversion result is returned.
1423 s_jhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1429 jhtml = GET_JHTML(pdoc);
1439 * It is a handler who processes the TR tag.
1441 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1442 * destination is specified.
1443 * @param node [i] The TR tag node is specified.
1444 * @return The conversion result is returned.
1447 s_jhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1449 jhtml_t *jhtml = GET_JHTML(pdoc);
1455 * It is a handler who processes the FONT tag.
1457 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1458 * destination is specified.
1459 * @param node [i] The FONT tag node is specified.
1460 * @return The conversion result is returned.
1463 s_jhtml_start_font_tag(void *pdoc, Node *node)
1469 char *attr_color = NULL;
1470 char *attr_style = NULL;
1472 jhtml = GET_JHTML(pdoc);
1476 /*--------------------------------------------------------------------------*/
1477 /* Get Attributes */
1478 /*--------------------------------------------------------------------------*/
1479 for (attr = qs_get_attr(doc,node);
1481 attr = qs_get_next_attr(doc,attr)) {
1482 char *name = qs_get_attr_name(doc,attr);
1483 char *value = qs_get_attr_value(doc,attr);
1484 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1485 attr_color = apr_pstrdup(doc->buf.pool, value);
1488 else if (STRCASEEQ('s','S',"size",name)) {
1489 /*----------------------------------------------------------------------*/
1491 /*----------------------------------------------------------------------*/
1494 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1495 attr_style = apr_pstrdup(doc->buf.pool, value);
1498 if (IS_CSS_ON(jhtml->entryp)) {
1499 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1501 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1502 css_property_t *cur;
1503 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1504 if (cur->value && *cur->value) {
1505 attr_color = apr_pstrdup(doc->pool, cur->value);
1511 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1512 W_L("<font color=\"");
1516 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1517 flg->with_font_flag = 1;
1518 node->userData = flg;
1521 node->userData = NULL;
1529 * It is a handler who processes the FONT tag.
1531 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1532 * destination is specified.
1533 * @param node [i] The FONT tag node is specified.
1534 * @return The conversion result is returned.
1537 s_jhtml_end_font_tag(void *pdoc, Node *node)
1543 jhtml = GET_JHTML(pdoc);
1547 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1548 if (flg && flg->with_font_flag) {
1551 if (IS_CSS_ON(jhtml->entryp)) {
1552 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1560 * It is a handler who processes the FORM tag.
1562 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1563 * destination is specified.
1564 * @param node [i] The FORM tag node is specified.
1565 * @return The conversion result is returned.
1568 s_jhtml_start_form_tag(void *pdoc, Node *node)
1574 char *attr_action = NULL;
1575 char *attr_method = NULL;
1576 char *attr_style = NULL;
1577 char *attr_color = NULL;
1578 char *attr_align = NULL;
1579 char *new_hidden_tag = NULL;
1581 jhtml = GET_JHTML(pdoc);
1585 /*--------------------------------------------------------------------------*/
1586 /* Get Attributes */
1587 /*--------------------------------------------------------------------------*/
1588 for (attr = qs_get_attr(doc,node);
1590 attr = qs_get_next_attr(doc,attr)) {
1591 char *name = qs_get_attr_name(doc,attr);
1592 char *value = qs_get_attr_value(doc,attr);
1596 if (strcasecmp(name, "action") == 0) {
1597 /*--------------------------------------------------------------------*/
1599 /*--------------------------------------------------------------------*/
1600 attr_action = value;
1606 if (strcasecmp(name, "method") == 0) {
1607 /*--------------------------------------------------------------------*/
1609 /*--------------------------------------------------------------------*/
1610 attr_method = value;
1616 if (strcasecmp(name, "style") == 0) {
1625 if (IS_CSS_ON(jhtml->entryp)) {
1626 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1628 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1629 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1630 css_property_t *cur;
1631 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1632 if (STRCASEEQ('l','L',"left", cur->value)) {
1633 attr_align = apr_pstrdup(doc->pool, "left");
1635 else if (STRCASEEQ('c','C',"center",cur->value)) {
1636 attr_align = apr_pstrdup(doc->pool, "center");
1638 else if (STRCASEEQ('r','R',"right",cur->value)) {
1639 attr_align = apr_pstrdup(doc->pool, "right");
1642 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1643 attr_color = apr_pstrdup(doc->pool, cur->value);
1648 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1652 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1653 attr_action = chxj_add_cookie_parameter(r, attr_action, jhtml->cookie);
1655 char *old_qs = NULL;
1656 q = strchr(attr_action, '?');
1658 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);
1659 if (new_hidden_tag || old_qs) {
1678 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
1679 memset(flg, 0, sizeof(*flg));
1681 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1682 W_L("<font color=\"");
1685 flg->with_font_flag = 1;
1688 W_L("<div align=\"");
1691 flg->with_div_flag = 1;
1693 node->userData = flg;
1694 /*-------------------------------------------------------------------------*/
1695 /* Add cookie parameter */
1696 /*-------------------------------------------------------------------------*/
1697 if (new_hidden_tag) {
1698 W_V(new_hidden_tag);
1705 * It is a handler who processes the FORM tag.
1707 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1708 * destination is specified.
1709 * @param node [i] The FORM tag node is specified.
1710 * @return The conversion result is returned.
1713 s_jhtml_end_form_tag(void *pdoc, Node *node)
1715 jhtml_t *jhtml = GET_JHTML(pdoc);
1716 Doc *doc = jhtml->doc;
1718 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1719 if (flg && flg->with_div_flag) {
1722 if (flg && flg->with_font_flag) {
1726 if (IS_CSS_ON(jhtml->entryp)) {
1727 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1735 * It is a handler who processes the INPUT tag.
1737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1738 * destination is specified.
1739 * @param node [i] The INPUT tag node is specified.
1740 * @return The conversion result is returned.
1743 s_jhtml_start_input_tag(void *pdoc, Node *node)
1749 char *attr_accesskey = NULL;
1750 char *attr_max_length = NULL;
1751 char *attr_type = NULL;
1752 char *attr_name = NULL;
1753 char *attr_value = NULL;
1754 char *attr_istyle = NULL;
1755 char *attr_size = NULL;
1756 char *attr_checked = NULL;
1757 char *attr_style = NULL;
1759 jhtml = GET_JHTML(pdoc);
1763 /*--------------------------------------------------------------------------*/
1764 /* Get Attributes */
1765 /*--------------------------------------------------------------------------*/
1766 for (attr = qs_get_attr(doc,node);
1768 attr = qs_get_next_attr(doc,attr)) {
1769 char *name = qs_get_attr_name(doc,attr);
1770 char *value = qs_get_attr_value(doc,attr);
1771 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1772 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1773 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1774 STRCASEEQ('p','P',"password",tmp_type) ||
1775 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1776 STRCASEEQ('r','R',"radio", tmp_type) ||
1777 STRCASEEQ('h','H',"hidden", tmp_type) ||
1778 STRCASEEQ('s','S',"submit", tmp_type) ||
1779 STRCASEEQ('r','R',"reset", tmp_type))) {
1780 attr_type = tmp_type;
1783 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1786 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1789 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1790 attr_istyle = value;
1792 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1793 attr_max_length = value;
1795 else if (STRCASEEQ('c','C',"checked", name)) {
1796 attr_checked = value;
1798 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1799 attr_accesskey = value;
1801 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1804 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1809 if (IS_CSS_ON(jhtml->entryp)) {
1810 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1812 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1813 css_property_t *cur;
1814 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1815 if (strcasestr(cur->value, "<ja:n>")) {
1818 else if (strcasestr(cur->value, "<ja:en>")) {
1821 else if (strcasestr(cur->value, "<ja:hk>")) {
1824 else if (strcasestr(cur->value, "<ja:h>")) {
1844 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jhtml->entryp));
1848 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1849 apr_size_t value_len = strlen(attr_value);
1850 attr_value = chxj_conv_z2h(r, attr_value, &value_len, jhtml->entryp);
1854 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1857 if (attr_accesskey) {
1858 W_L(" accesskey=\"");
1859 W_V(attr_accesskey);
1862 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1863 /*------------------------------------------------------------------------*/
1865 /*------------------------------------------------------------------------*/
1866 if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jhtml->entryp->pc_flag ) {
1872 char *vv = chxj_istyle_to_mode(doc->buf.pool,attr_istyle);
1878 else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1883 /*--------------------------------------------------------------------------*/
1884 /* The figure is default for the password. */
1885 /*--------------------------------------------------------------------------*/
1886 if (attr_max_length && *attr_max_length) {
1887 if (chxj_chk_numeric(attr_max_length) == 0) {
1888 W_L(" maxlength=\"");
1889 W_V(attr_max_length);
1903 * It is a handler who processes the INPUT tag.
1905 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1906 * destination is specified.
1907 * @param node [i] The INPUT tag node is specified.
1908 * @return The conversion result is returned.
1911 s_jhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
1913 jhtml_t *jhtml = GET_JHTML(pdoc);
1919 * It is a handler who processes the CENTER tag.
1921 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1922 * destination is specified.
1923 * @param node [i] The CENTER tag node is specified.
1924 * @return The conversion result is returned.
1927 s_jhtml_start_center_tag(void *pdoc, Node *node)
1932 char *attr_style = NULL;
1933 char *attr_color = NULL;
1934 char *attr_size = NULL;
1936 jhtml = GET_JHTML(pdoc);
1939 for (attr = qs_get_attr(doc,node);
1941 attr = qs_get_next_attr(doc,attr)) {
1942 char *name = qs_get_attr_name(doc,attr);
1943 char *value = qs_get_attr_value(doc,attr);
1944 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1948 if (IS_CSS_ON(jhtml->entryp)) {
1949 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1951 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1952 css_property_t *cur;
1953 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1954 if (cur->value && *cur->value) {
1955 attr_color = apr_pstrdup(doc->pool, cur->value);
1962 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
1963 memset(flg, 0, sizeof(*flg));
1964 if (attr_color || attr_size) {
1967 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1977 flg->with_font_flag = 1;
1980 node->userData = flg;
1984 jhtml_t *jhtml = GET_JHTML(pdoc);
1985 Doc *doc = jhtml->doc;
1993 * It is a handler who processes the CENTER tag.
1995 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1996 * destination is specified.
1997 * @param node [i] The CENTER tag node is specified.
1998 * @return The conversion result is returned.
2001 s_jhtml_end_center_tag(void *pdoc, Node *node)
2007 jhtml = GET_JHTML(pdoc);
2011 if (IS_CSS_ON(jhtml->entryp)) {
2012 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2014 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
2015 if (flg && flg->with_font_flag) {
2024 * It is a handler who processes the li tag.
2026 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2027 * destination is specified.
2028 * @param node [i] The li tag node is specified.
2029 * @return The conversion result is returned.
2032 s_jhtml_start_li_tag(void *pdoc, Node *node)
2038 char *attr_type = NULL;
2039 char *attr_value = NULL;
2040 char *attr_style = NULL;
2042 jhtml = GET_JHTML(pdoc);
2046 for (attr = qs_get_attr(doc,node);
2048 attr = qs_get_next_attr(doc,attr)) {
2049 char *name = qs_get_attr_name(doc,attr);
2050 char *value = qs_get_attr_value(doc,attr);
2051 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2054 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2057 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2061 if (IS_CSS_ON(jhtml->entryp)) {
2062 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2064 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2065 css_property_t *cur;
2066 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2067 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2068 attr_type = apr_pstrdup(doc->pool, "1");
2070 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2071 attr_type = apr_pstrdup(doc->pool, "A");
2073 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2074 attr_type = apr_pstrdup(doc->pool, "a");
2097 * It is a handler who processes the li tag.
2099 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2100 * destination is specified.
2101 * @param node [i] The li tag node is specified.
2102 * @return The conversion result is returned.
2105 s_jhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2111 jhtml = GET_JHTML(pdoc);
2116 if (IS_CSS_ON(jhtml->entryp)) {
2117 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2124 * It is a handler who processes the OL tag.
2126 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2127 * destination is specified.
2128 * @param node [i] The OL tag node is specified.
2129 * @return The conversion result is returned.
2132 s_jhtml_start_ol_tag(void *pdoc, Node *node)
2138 char *attr_style = NULL;
2139 char *attr_start = NULL;
2140 char *attr_type = NULL;
2142 jhtml = GET_JHTML(pdoc);
2146 /*--------------------------------------------------------------------------*/
2147 /* Get Attributes */
2148 /*--------------------------------------------------------------------------*/
2149 for (attr = qs_get_attr(doc,node);
2151 attr = qs_get_next_attr(doc,attr)) {
2152 char *name = qs_get_attr_name(doc,attr);
2153 char *value = qs_get_attr_value(doc,attr);
2154 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2157 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2160 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2164 if (IS_CSS_ON(jhtml->entryp)) {
2165 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2167 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2168 css_property_t *cur;
2169 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2170 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2171 attr_type = apr_pstrdup(doc->pool, "1");
2173 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2174 attr_type = apr_pstrdup(doc->pool, "A");
2176 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2177 attr_type = apr_pstrdup(doc->pool, "a");
2200 * It is a handler who processes the OL tag.
2202 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2203 * destination is specified.
2204 * @param node [i] The OL tag node is specified.
2205 * @return The conversion result is returned.
2208 s_jhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2214 jhtml = GET_JHTML(pdoc);
2219 if (IS_CSS_ON(jhtml->entryp)) {
2220 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2227 * It is a handler who processes the P tag.
2229 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2230 * destination is specified.
2231 * @param node [i] The P tag node is specified.
2232 * @return The conversion result is returned.
2235 s_jhtml_start_p_tag(void *pdoc, Node *node)
2241 char *attr_align = NULL;
2242 char *attr_style = NULL;
2243 char *attr_color = NULL;
2244 char *attr_blink = NULL;
2247 jhtml = GET_JHTML(pdoc);
2251 for (attr = qs_get_attr(doc,node);
2253 attr = qs_get_next_attr(doc,attr)) {
2254 char *nm = qs_get_attr_name(doc,attr);
2255 char *val = qs_get_attr_value(doc,attr);
2256 if (STRCASEEQ('a','A',"align", nm)) {
2257 /*----------------------------------------------------------------------*/
2258 /* CHTML 1.0 (W3C version 3.2) */
2259 /*----------------------------------------------------------------------*/
2260 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2261 attr_align = apr_pstrdup(doc->buf.pool, val);
2265 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2266 attr_style = apr_pstrdup(doc->buf.pool, val);
2269 if (IS_CSS_ON(jhtml->entryp)) {
2270 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2272 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2273 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2274 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2275 css_property_t *cur;
2276 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2277 if (STRCASEEQ('l','L',"left",cur->value)) {
2278 attr_align = apr_pstrdup(doc->pool, "left");
2280 else if (STRCASEEQ('c','C',"center",cur->value)) {
2281 attr_align = apr_pstrdup(doc->pool, "center");
2283 else if (STRCASEEQ('r','R',"right",cur->value)) {
2284 attr_align = apr_pstrdup(doc->pool, "right");
2287 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2288 if (cur->value && *cur->value) {
2289 attr_color = apr_pstrdup(doc->pool, cur->value);
2292 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2293 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2294 attr_blink = apr_pstrdup(doc->pool, cur->value);
2307 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
2308 memset(flg, 0, sizeof(*flg));
2310 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2311 W_L("<font color=\"");
2314 flg->with_font_flag = 1;
2318 flg->with_blink_flag = 1;
2320 node->userData = (void *)flg;
2327 * It is a handler who processes the P tag.
2329 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2330 * destination is specified.
2331 * @param node [i] The P tag node is specified.
2332 * @return The conversion result is returned.
2335 s_jhtml_end_p_tag(void *pdoc, Node *node)
2337 jhtml_t *jhtml = GET_JHTML(pdoc);
2338 Doc *doc = jhtml->doc;
2340 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
2341 if (flg->with_font_flag) {
2344 if (flg->with_blink_flag) {
2349 if (IS_CSS_ON(jhtml->entryp)) {
2350 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2358 * It is a handler who processes the PRE tag.
2360 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2361 * destination is specified.
2362 * @param node [i] The PRE tag node is specified.
2363 * @return The conversion result is returned.
2366 s_jhtml_start_pre_tag(void *pdoc, Node *node)
2368 jhtml_t *jhtml = GET_JHTML(pdoc);
2369 Doc *doc = jhtml->doc;
2371 char *attr_style = NULL;
2373 for (attr = qs_get_attr(doc,node);
2375 attr = qs_get_next_attr(doc,attr)) {
2376 char *nm = qs_get_attr_name(doc,attr);
2377 char *val = qs_get_attr_value(doc,attr);
2378 if (val && STRCASEEQ('s','S',"style", nm)) {
2383 if (IS_CSS_ON(jhtml->entryp)) {
2384 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2394 * It is a handler who processes the PRE tag.
2396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2397 * destination is specified.
2398 * @param node [i] The PRE tag node is specified.
2399 * @return The conversion result is returned.
2402 s_jhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2404 jhtml_t *jhtml = GET_JHTML(pdoc);
2405 Doc *doc = jhtml->doc;
2409 if (IS_CSS_ON(jhtml->entryp)) {
2410 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2418 * It is a handler who processes the UL tag.
2420 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2421 * destination is specified.
2422 * @param node [i] The UL tag node is specified.
2423 * @return The conversion result is returned.
2426 s_jhtml_start_ul_tag(void *pdoc, Node *node)
2428 jhtml_t *jhtml = GET_JHTML(pdoc);
2429 Doc *doc = jhtml->doc;
2431 char *attr_style = NULL;
2433 for (attr = qs_get_attr(doc,node);
2435 attr = qs_get_next_attr(doc,attr)) {
2436 char *nm = qs_get_attr_name(doc,attr);
2437 char *val = qs_get_attr_value(doc,attr);
2438 if (val && STRCASEEQ('s','S',"style", nm)) {
2443 if (IS_CSS_ON(jhtml->entryp)) {
2444 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2453 * It is a handler who processes the UL tag.
2455 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2456 * destination is specified.
2457 * @param node [i] The UL tag node is specified.
2458 * @return The conversion result is returned.
2461 s_jhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2463 jhtml_t *jhtml = GET_JHTML(pdoc);
2464 Doc *doc = jhtml->doc;
2467 if (IS_CSS_ON(jhtml->entryp)) {
2468 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2475 * It is a handler who processes the HR tag.
2477 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2478 * destination is specified.
2479 * @param node [i] The HR tag node is specified.
2480 * @return The conversion result is returned.
2483 s_jhtml_start_hr_tag(void *pdoc, Node *node)
2489 char *attr_align = NULL;
2490 char *attr_size = NULL;
2491 char *attr_width = NULL;
2492 char *attr_noshade = NULL;
2493 char *attr_style = NULL;
2494 char *attr_color = NULL;
2496 jhtml = GET_JHTML(pdoc);
2500 for (attr = qs_get_attr(doc,node);
2502 attr = qs_get_next_attr(doc,attr)) {
2503 char *name = qs_get_attr_name (doc,attr);
2504 char *value = qs_get_attr_value(doc,attr);
2508 if (strcasecmp(name, "align") == 0) {
2509 /*--------------------------------------------------------------------*/
2511 /*--------------------------------------------------------------------*/
2512 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2520 if (strcasecmp(name, "size") == 0) {
2521 /*--------------------------------------------------------------------*/
2523 /*--------------------------------------------------------------------*/
2524 if (value && *value) {
2528 else if (strcasecmp(name, "style") == 0) {
2529 if (value && *value) {
2537 if (strcasecmp(name, "width") == 0) {
2538 /*--------------------------------------------------------------------*/
2540 /*--------------------------------------------------------------------*/
2541 if (value && *value) {
2549 if (strcasecmp(name, "noshade") == 0) {
2550 /*--------------------------------------------------------------------*/
2552 /*--------------------------------------------------------------------*/
2553 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2559 if (strcasecmp(name, "color") == 0 && value && *value) {
2560 /*--------------------------------------------------------------------*/
2562 /*--------------------------------------------------------------------*/
2571 if (IS_CSS_ON(jhtml->entryp)) {
2572 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2574 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2575 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2576 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2577 css_property_t *cur;
2578 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2579 if (STRCASEEQ('s','S',"solid",cur->value)) {
2580 attr_noshade = "noshade";
2583 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2584 char *tmp = apr_pstrdup(doc->pool, cur->value);
2585 char *tmpp = strstr(tmp, "px");
2588 attr_size = apr_pstrdup(doc->pool, tmp);
2591 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2592 char *tmp = apr_pstrdup(doc->pool, cur->value);
2593 char *tmpp = strstr(tmp, "px");
2596 attr_width = apr_pstrdup(doc->pool, tmp);
2599 tmpp = strstr(tmp, "%");
2601 attr_width = apr_pstrdup(doc->pool, tmp);
2637 * It is a handler who processes the HR tag.
2639 * @param jhtml [i/o] The pointer to the CHTML structure at the output
2640 * destination is specified.
2641 * @param node [i] The HR tag node is specified.
2642 * @return The conversion result is returned.
2645 s_jhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2647 jhtml_t *jhtml = GET_JHTML(pdoc);
2653 * It is a handler who processes the IMG tag.
2655 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2656 * destination is specified.
2657 * @param node [i] The IMG tag node is specified.
2658 * @return The conversion result is returned.
2661 s_jhtml_start_img_tag(void *pdoc, Node *node)
2667 char *attr_src = NULL;
2668 char *attr_align = NULL;
2669 char *attr_style = NULL;
2670 char *attr_alt = NULL;
2671 char *attr_width = NULL;
2672 char *attr_height = NULL;
2673 #ifndef IMG_NOT_CONVERT_FILENAME
2677 jhtml = GET_JHTML(pdoc);
2678 #ifndef IMG_NOT_CONVERT_FILENAME
2684 /*--------------------------------------------------------------------------*/
2685 /* Get Attributes */
2686 /*--------------------------------------------------------------------------*/
2687 for (attr = qs_get_attr(doc,node);
2689 attr = qs_get_next_attr(doc,attr)) {
2690 char *name = qs_get_attr_name (doc,attr);
2691 char *value = qs_get_attr_value(doc,attr);
2695 if (strcasecmp(name, "src") == 0) {
2696 /*--------------------------------------------------------------------*/
2698 /*--------------------------------------------------------------------*/
2699 #ifdef IMG_NOT_CONVERT_FILENAME
2700 value = chxj_encoding_parameter(r, value, 0);
2701 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
2702 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2703 value = chxj_add_cookie_no_update_parameter(r, value);
2704 value = chxj_img_rewrite_parameter(r,jhtml->conf,value);
2705 value = s_add_copyright_parameter(r, value);
2708 value = chxj_img_conv(r, spec, value);
2709 value = chxj_encoding_parameter(r, value, 0);
2710 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
2711 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2712 value = chxj_add_cookie_no_update_parameter(r, value);
2713 value = chxj_img_rewrite_parameter(r,jhtml->conf,value);
2714 value = s_add_copyright_parameter(r, value);
2718 else if (strcasecmp(name,"style") == 0 && value && *value) {
2725 if (strcasecmp(name, "align" ) == 0) {
2726 /*--------------------------------------------------------------------*/
2728 /*--------------------------------------------------------------------*/
2729 /*--------------------------------------------------------------------*/
2731 /*--------------------------------------------------------------------*/
2733 if (STRCASEEQ('t','T',"top", value) ||
2734 STRCASEEQ('m','M',"middle",value) ||
2735 STRCASEEQ('b','B',"bottom",value) ||
2736 STRCASEEQ('l','L',"left", value) ||
2737 STRCASEEQ('r','R',"right", value)) {
2740 else if (STRCASEEQ('c','C',"center", value)) {
2741 attr_align = apr_pstrdup(doc->pool, "middle");
2745 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2746 /*--------------------------------------------------------------------*/
2748 /*--------------------------------------------------------------------*/
2755 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2756 /*--------------------------------------------------------------------*/
2758 /*--------------------------------------------------------------------*/
2765 if (strcasecmp(name, "height") == 0 && value && *value) {
2766 /*--------------------------------------------------------------------*/
2768 /*--------------------------------------------------------------------*/
2769 attr_height = value;
2772 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2773 /*--------------------------------------------------------------------*/
2775 /*--------------------------------------------------------------------*/
2781 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2782 /*--------------------------------------------------------------------*/
2784 /*--------------------------------------------------------------------*/
2793 if (IS_CSS_ON(jhtml->entryp)) {
2794 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2796 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2797 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2798 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2799 css_property_t *cur;
2800 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2801 attr_height = apr_pstrdup(doc->pool, cur->value);
2803 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2804 attr_width = apr_pstrdup(doc->pool, cur->value);
2806 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2807 attr_align = apr_pstrdup(doc->pool, cur->value);
2844 * It is a handler who processes the IMG tag.
2846 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2847 * destination is specified.
2848 * @param node [i] The IMG tag node is specified.
2849 * @return The conversion result is returned.
2852 s_jhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
2854 jhtml_t *jhtml = GET_JHTML(pdoc);
2860 * It is a handler who processes the SELECT tag.
2862 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2863 * destination is specified.
2864 * @param node [i] The SELECT tag node is specified.
2865 * @return The conversion result is returned.
2868 s_jhtml_start_select_tag(void *pdoc, Node *node)
2870 jhtml_t *jhtml = GET_JHTML(pdoc);
2871 Doc *doc = jhtml->doc;
2875 char *multiple = NULL;
2876 char *attr_style = NULL;
2879 for (attr = qs_get_attr(doc,node);
2881 attr = qs_get_next_attr(doc,attr)) {
2882 char *nm = qs_get_attr_name(doc,attr);
2883 char *val = qs_get_attr_value(doc,attr);
2884 if (STRCASEEQ('s','S',"size",nm)) {
2885 /*----------------------------------------------------------------------*/
2886 /* CHTML 1.0 version 2.0 */
2887 /*----------------------------------------------------------------------*/
2888 size = apr_pstrdup(doc->buf.pool, val);
2890 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2891 /*----------------------------------------------------------------------*/
2892 /* CHTML 1.0 version 2.0 */
2893 /*----------------------------------------------------------------------*/
2894 attr_style = apr_pstrdup(doc->buf.pool, val);
2896 else if (STRCASEEQ('n','N',"name",nm)) {
2897 /*----------------------------------------------------------------------*/
2898 /* CHTML 1.0 version 2.0 */
2899 /*----------------------------------------------------------------------*/
2900 name = apr_pstrdup(doc->buf.pool, val);
2902 else if (STRCASEEQ('m','M',"multiple", nm)) {
2903 /*----------------------------------------------------------------------*/
2904 /* CHTML 1.0 version 2.0 */
2905 /*----------------------------------------------------------------------*/
2906 multiple = apr_pstrdup(doc->buf.pool, val);
2909 if (size && *size) {
2914 if (name && *name) {
2923 if (IS_CSS_ON(jhtml->entryp)) {
2924 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2931 * It is a handler who processes the SELECT tag.
2933 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2934 * destination is specified.
2935 * @param node [i] The SELECT tag node is specified.
2936 * @return The conversion result is returned.
2939 s_jhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
2941 jhtml_t *jhtml = GET_JHTML(pdoc);
2942 Doc *doc = jhtml->doc;
2945 if (IS_CSS_ON(jhtml->entryp)) {
2946 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2952 * It is a handler who processes the OPTION tag.
2954 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2955 * destination is specified.
2956 * @param node [i] The OPTION tag node is specified.
2957 * @return The conversion result is returned.
2960 s_jhtml_start_option_tag(void *pdoc, Node *node)
2962 jhtml_t *jhtml = GET_JHTML(pdoc);
2963 Doc *doc = jhtml->doc;
2966 char *selected = NULL;
2968 char *attr_style = NULL;
2971 for (attr = qs_get_attr(doc,node);
2973 attr = qs_get_next_attr(doc,attr)) {
2974 char *nm = qs_get_attr_name(doc,attr);
2975 char *val = qs_get_attr_value(doc,attr);
2976 if (STRCASEEQ('s','S',"selected",nm)) {
2977 /*----------------------------------------------------------------------*/
2978 /* CHTML 1.0 version 2.0 */
2979 /*----------------------------------------------------------------------*/
2980 selected = apr_pstrdup(doc->buf.pool, val);
2982 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2983 /*----------------------------------------------------------------------*/
2984 /* CHTML 1.0 version 2.0 */
2985 /*----------------------------------------------------------------------*/
2986 attr_style = apr_pstrdup(doc->buf.pool, val);
2988 else if (STRCASEEQ('v','V',"value",nm)) {
2989 /*----------------------------------------------------------------------*/
2990 /* CHTML 1.0 version 2.0 */
2991 /*----------------------------------------------------------------------*/
2992 value = apr_pstrdup(doc->buf.pool, val);
3005 if (IS_CSS_ON(jhtml->entryp)) {
3006 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3014 * It is a handler who processes the OPTION tag.
3016 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3017 * destination is specified.
3018 * @param node [i] The OPTION tag node is specified.
3019 * @return The conversion result is returned.
3022 s_jhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
3024 jhtml_t *jhtml = GET_JHTML(pdoc);
3026 if (IS_CSS_ON(jhtml->entryp)) {
3027 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3034 * It is a handler who processes the DIV tag.
3036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3037 * destination is specified.
3038 * @param node [i] The DIV tag node is specified.
3039 * @return The conversion result is returned.
3042 s_jhtml_start_div_tag(void *pdoc, Node *node)
3048 char *attr_style = NULL;
3049 char *attr_align = NULL;
3050 char *attr_display = NULL;
3051 char *attr_decoration = NULL;
3052 char *attr_wap_marquee_style = NULL;
3053 char *attr_wap_marquee_dir = NULL;
3054 char *attr_wap_marquee_loop = NULL;
3055 char *attr_color = NULL;
3056 char *attr_bgcolor = NULL;
3057 char *attr_font_size = NULL;
3059 jhtml = GET_JHTML(pdoc);
3063 for (attr = qs_get_attr(doc,node);
3065 attr = qs_get_next_attr(doc,attr)) {
3066 char *nm = qs_get_attr_name(doc,attr);
3067 char *val = qs_get_attr_value(doc,attr);
3068 if (STRCASEEQ('a','A', "align", nm)) {
3069 /*----------------------------------------------------------------------*/
3070 /* CHTML 1.0 (W3C version 3.2) */
3071 /*----------------------------------------------------------------------*/
3072 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3073 attr_align = apr_pstrdup(doc->buf.pool, val);
3076 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3077 attr_style = apr_pstrdup(doc->buf.pool, val);
3081 if (IS_CSS_ON(jhtml->entryp)) {
3082 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3084 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3085 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3086 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3087 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3088 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3089 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3090 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3092 css_property_t *cur;
3093 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3094 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3095 attr_display = apr_pstrdup(doc->pool, cur->value);
3098 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3099 if (STRCASEEQ('b','B',"blink", cur->value)) {
3100 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3103 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3104 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3105 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3107 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3108 char *ss = strchr(cur->value, '#');
3110 ss = strstr(cur->value, "rgb");
3113 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3114 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3117 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3118 attr_color = apr_pstrdup(doc->pool, cur->value);
3120 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3121 attr_align = apr_pstrdup(doc->pool, cur->value);
3123 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3124 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3125 if (STRCASEEQ('x','X',"xx-small",attr_font_size)) {
3126 attr_font_size = apr_pstrdup(doc->pool, "1");
3128 else if (STRCASEEQ('x','X',"x-small",attr_font_size)) {
3129 attr_font_size = apr_pstrdup(doc->pool, "2");
3131 else if (STRCASEEQ('s','S',"small",attr_font_size)) {
3132 attr_font_size = apr_pstrdup(doc->pool, "3");
3134 else if (STRCASEEQ('m','M',"medium",attr_font_size)) {
3135 attr_font_size = apr_pstrdup(doc->pool, "4");
3137 else if (STRCASEEQ('l','L',"large",attr_font_size)) {
3138 attr_font_size = apr_pstrdup(doc->pool, "5");
3140 else if (STRCASEEQ('x','X',"x-large",attr_font_size)) {
3141 attr_font_size = apr_pstrdup(doc->pool, "6");
3143 else if (STRCASEEQ('x','X',"xx-large",attr_font_size)) {
3144 attr_font_size = apr_pstrdup(doc->pool, "7");
3148 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3149 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3150 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3151 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3152 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3153 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3156 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3157 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3158 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
3160 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3161 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
3164 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3165 if (STRCASEEQ('i','I',"infinite",cur->value)) {
3166 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
3169 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3175 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3176 memset(flg, 0, sizeof(*flg));
3183 flg->with_div_flag = 1;
3186 && ! ((STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color)) && attr_bgcolor))
3187 || attr_font_size) {
3194 if (attr_font_size) {
3196 W_V(attr_font_size);
3200 flg->with_font_flag = 1;
3202 if (attr_decoration) {
3204 flg->with_blink_flag = 1;
3208 if (attr_wap_marquee_style) {
3209 W_L(" behavior=\"");
3210 W_V(attr_wap_marquee_style);
3213 if (attr_wap_marquee_dir) {
3214 W_L(" direction=\"");
3215 W_V(attr_wap_marquee_dir);
3218 if (attr_wap_marquee_loop) {
3220 W_V(attr_wap_marquee_loop);
3224 flg->with_marquee_flag = 1;
3226 if (!attr_align && !attr_color && !attr_decoration && !attr_display && !attr_font_size) {
3228 flg->with_div_flag = 1;
3230 node->userData = flg;
3237 * It is a handler who processes the DIV tag.
3239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3240 * destination is specified.
3241 * @param node [i] The DIV tag node is specified.
3242 * @return The conversion result is returned.
3245 s_jhtml_end_div_tag(void *pdoc, Node *node)
3247 jhtml_t *jhtml = GET_JHTML(pdoc);
3248 Doc *doc = jhtml->doc;
3250 jhtml_flags_t *flg = node->userData;
3251 if (flg && flg->with_marquee_flag) {
3254 if (flg && flg->with_blink_flag) {
3257 if (flg && flg->with_font_flag) {
3260 if (flg && flg->with_div_flag) {
3263 if (IS_CSS_ON(jhtml->entryp)) {
3264 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3266 node->userData = NULL;
3273 chxj_istyle_to_mode(apr_pool_t *p, const char *s)
3279 case '1': return apr_psprintf(p, "hiragana");
3280 case '2': return apr_psprintf(p, "hankakukana");
3281 case '3': return apr_psprintf(p, "alphabet");
3282 case '4': return apr_psprintf(p, "numeric");
3284 tmp = apr_palloc(p, 1);
3286 return apr_pstrdup(p, tmp);
3290 tmp = apr_palloc(p, 1);
3292 return apr_pstrdup(p,tmp);
3297 s_jhtml_chxjif_tag(void *pdoc, Node *node)
3304 jhtml = GET_JHTML(pdoc);
3308 for (child = qs_get_child_node(doc, node);
3310 child = qs_get_next_node(doc, child)) {
3312 s_jhtml_chxjif_tag(jhtml, child);
3319 * It is a handler who processes the TEXTARE tag.
3321 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3322 * destination is specified.
3323 * @param node [i] The TEXTAREA tag node is specified.
3324 * @return The conversion result is returned.
3327 s_jhtml_start_textarea_tag(void *pdoc, Node *node)
3333 char *attr_accesskey = NULL;
3334 char *attr_name = NULL;
3335 char *attr_rows = NULL;
3336 char *attr_cols = NULL;
3337 char *attr_istyle = NULL;
3338 char *attr_style = NULL;
3340 jhtml = GET_JHTML(pdoc);
3344 jhtml->textarea_flag++;
3345 for (attr = qs_get_attr(doc,node);
3347 attr = qs_get_next_attr(doc,attr)) {
3348 char *name = qs_get_attr_name(doc,attr);
3349 char *value = qs_get_attr_value(doc,attr);
3350 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3351 attr_accesskey = value;
3353 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3354 attr_istyle = value;
3356 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3359 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3362 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3365 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3369 if (IS_CSS_ON(jhtml->entryp)) {
3370 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3372 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3373 css_property_t *cur;
3374 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3375 if (strcasestr(cur->value, "<ja:n>")) {
3378 else if (strcasestr(cur->value, "<ja:en>")) {
3381 else if (strcasestr(cur->value, "<ja:hk>")) {
3384 else if (strcasestr(cur->value, "<ja:h>")) {
3391 if (attr_accesskey) {
3392 W_L(" accesskey=\"");
3393 W_V(attr_accesskey);
3412 char *vv = chxj_istyle_to_mode(doc->buf.pool,attr_istyle);
3423 * It is a handler who processes the TEXTAREA tag.
3425 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3426 * destination is specified.
3427 * @param node [i] The TEXTAREA tag node is specified.
3428 * @return The conversion result is returned.
3431 s_jhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3437 jhtml = GET_JHTML(pdoc);
3442 jhtml->textarea_flag--;
3449 * It is a handler who processes the B tag.
3451 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3452 * destination is specified.
3453 * @param node [i] The B tag node is specified.
3454 * @return The conversion result is returned.
3457 s_jhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3463 jhtml = GET_JHTML(pdoc);
3473 * It is a handler who processes the B tag.
3475 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3476 * destination is specified.
3477 * @param node [i] The B tag node is specified.
3478 * @return The conversion result is returned.
3481 s_jhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3483 jhtml_t* jhtml = GET_JHTML(pdoc);
3484 Doc* doc = jhtml->doc;
3491 s_jhtml_text_tag(void *pdoc, Node *child)
3502 apr_size_t z2h_input_len;
3504 jhtml = GET_JHTML(pdoc);
3507 DBG(r, "start s_jhtml_text_tag()");
3509 textval = qs_get_node_value(doc,child);
3510 if (strlen(textval) == 0) {
3514 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3515 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3517 tdst = qs_alloc_zero_byte_string(r->pool);
3518 memset(one_byte, 0, sizeof(one_byte));
3521 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3523 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
3525 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3530 if (is_sjis_kanji(textval[ii])) {
3531 one_byte[0] = textval[ii+0];
3532 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3533 one_byte[0] = textval[ii+1];
3534 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3538 if (jhtml->pre_flag) {
3539 one_byte[0] = textval[ii+0];
3540 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3543 if (jhtml->textarea_flag) {
3544 one_byte[0] = textval[ii+0];
3545 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3548 if (textval[ii] != '\r' && textval[ii] != '\n') {
3549 one_byte[0] = textval[ii+0];
3550 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3554 z2h_input_len = strlen(tdst);
3555 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jhtml->entryp);
3558 DBG(r, "end s_jhtml_text_tag()");
3564 * It is a handler who processes the BLOCKQUOTE tag.
3566 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3567 * destination is specified.
3568 * @param node [i] The BLOCKQUOTE tag node is specified.
3569 * @return The conversion result is returned.
3572 s_jhtml_start_blockquote_tag(void *pdoc, Node *node)
3577 char *attr_style = NULL;
3578 char *attr_color = NULL;
3579 char *attr_size = NULL;
3581 jhtml = GET_JHTML(pdoc);
3583 for (attr = qs_get_attr(doc,node);
3585 attr = qs_get_next_attr(doc,attr)) {
3586 char *nm = qs_get_attr_name(doc,attr);
3587 char *val = qs_get_attr_value(doc,attr);
3588 if (val && STRCASEEQ('s','S',"style", nm)) {
3592 if (IS_CSS_ON(jhtml->entryp)) {
3593 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3595 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3596 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3597 css_property_t *cur;
3598 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3599 if (cur->value && *cur->value) {
3600 attr_color = apr_pstrdup(doc->pool, cur->value);
3603 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3604 if (cur->value && *cur->value) {
3605 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3606 attr_size = apr_pstrdup(doc->pool, "1");
3608 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3609 attr_size = apr_pstrdup(doc->pool, "2");
3611 else if (STRCASEEQ('s','S',"small",cur->value)) {
3612 attr_size = apr_pstrdup(doc->pool, "3");
3614 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3615 attr_size = apr_pstrdup(doc->pool, "4");
3617 else if (STRCASEEQ('l','L',"large",cur->value)) {
3618 attr_size = apr_pstrdup(doc->pool, "5");
3620 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3621 attr_size = apr_pstrdup(doc->pool, "6");
3623 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3624 attr_size = apr_pstrdup(doc->pool, "7");
3630 W_L("<blockquote>");
3631 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3632 memset(flg, 0, sizeof(*flg));
3633 if (attr_color || attr_size) {
3636 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3647 flg->with_font_flag = 1;
3649 node->userData = (void *)flg;
3655 * It is a handler who processes the BLOCKQUOTE tag.
3657 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3658 * destination is specified.
3659 * @param node [i] The BLOCKQUOTE tag node is specified.
3660 * @return The conversion result is returned.
3663 s_jhtml_end_blockquote_tag(void *pdoc, Node *node)
3665 jhtml_t *jhtml = GET_JHTML(pdoc);
3666 Doc *doc = jhtml->doc;
3667 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3668 if (flg && flg->with_font_flag) {
3671 W_L("</blockquote>");
3672 if (IS_CSS_ON(jhtml->entryp)) {
3673 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3680 * It is a handler who processes the DIR tag.
3682 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3683 * destination is specified.
3684 * @param node [i] The DIR tag node is specified.
3685 * @return The conversion result is returned.
3688 s_jhtml_start_dir_tag(void *pdoc, Node *node)
3690 jhtml_t *jhtml = GET_JHTML(pdoc);
3691 Doc *doc = jhtml->doc;
3693 char *attr_style = NULL;
3694 char *attr_color = NULL;
3695 char *attr_size = NULL;
3696 for (attr = qs_get_attr(doc,node);
3698 attr = qs_get_next_attr(doc,attr)) {
3699 char *name = qs_get_attr_name(doc,attr);
3700 char *value = qs_get_attr_value(doc,attr);
3701 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3705 if (IS_CSS_ON(jhtml->entryp)) {
3706 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3708 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3709 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3710 css_property_t *cur;
3711 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3712 if (cur->value && *cur->value) {
3713 attr_color = apr_pstrdup(doc->pool, cur->value);
3716 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3717 if (cur->value && *cur->value) {
3718 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3719 attr_size = apr_pstrdup(doc->pool, "1");
3721 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3722 attr_size = apr_pstrdup(doc->pool, "2");
3724 else if (STRCASEEQ('s','S',"small",cur->value)) {
3725 attr_size = apr_pstrdup(doc->pool, "3");
3727 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3728 attr_size = apr_pstrdup(doc->pool, "4");
3730 else if (STRCASEEQ('l','L',"large",cur->value)) {
3731 attr_size = apr_pstrdup(doc->pool, "5");
3733 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3734 attr_size = apr_pstrdup(doc->pool, "6");
3736 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3737 attr_size = apr_pstrdup(doc->pool, "7");
3744 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3745 memset(flg, 0, sizeof(*flg));
3746 if (attr_color || attr_size) {
3749 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3760 flg->with_font_flag = 1;
3762 node->userData = (void *)flg;
3768 * It is a handler who processes the DIR tag.
3770 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3771 * destination is specified.
3772 * @param node [i] The DIR tag node is specified.
3773 * @return The conversion result is returned.
3776 s_jhtml_end_dir_tag(void *pdoc, Node *node)
3778 jhtml_t *jhtml = GET_JHTML(pdoc);
3779 Doc *doc = jhtml->doc;
3780 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3781 if (flg && flg->with_font_flag) {
3785 if (IS_CSS_ON(jhtml->entryp)) {
3786 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3793 * It is a handler who processes the DL tag.
3795 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3796 * destination is specified.
3797 * @param node [i] The DL tag node is specified.
3798 * @return The conversion result is returned.
3801 s_jhtml_start_dl_tag(void *pdoc, Node *node)
3803 jhtml_t *jhtml = GET_JHTML(pdoc);
3804 Doc *doc = jhtml->doc;
3806 char *attr_style = NULL;
3807 char *attr_color = NULL;
3808 char *attr_size = NULL;
3809 for (attr = qs_get_attr(doc,node);
3811 attr = qs_get_next_attr(doc,attr)) {
3812 char *name = qs_get_attr_name(doc,attr);
3813 char *value = qs_get_attr_value(doc,attr);
3814 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3818 if (IS_CSS_ON(jhtml->entryp)) {
3819 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3821 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3822 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3823 css_property_t *cur;
3824 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3825 if (cur->value && *cur->value) {
3826 attr_color = apr_pstrdup(doc->pool, cur->value);
3829 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3830 if (cur->value && *cur->value) {
3831 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3832 attr_size = apr_pstrdup(doc->pool, "1");
3834 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3835 attr_size = apr_pstrdup(doc->pool, "2");
3837 else if (STRCASEEQ('s','S',"small",cur->value)) {
3838 attr_size = apr_pstrdup(doc->pool, "3");
3840 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3841 attr_size = apr_pstrdup(doc->pool, "4");
3843 else if (STRCASEEQ('l','L',"large",cur->value)) {
3844 attr_size = apr_pstrdup(doc->pool, "5");
3846 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3847 attr_size = apr_pstrdup(doc->pool, "6");
3849 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3850 attr_size = apr_pstrdup(doc->pool, "7");
3857 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3858 memset(flg, 0, sizeof(*flg));
3859 if (attr_color || attr_size) {
3862 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3873 flg->with_font_flag = 1;
3875 node->userData = (void *)flg;
3881 * It is a handler who processes the DL tag.
3883 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3884 * destination is specified.
3885 * @param node [i] The DL tag node is specified.
3886 * @return The conversion result is returned.
3889 s_jhtml_end_dl_tag(void *pdoc, Node *node)
3891 jhtml_t *jhtml = GET_JHTML(pdoc);
3892 Doc *doc = jhtml->doc;
3893 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3894 if (flg && flg->with_font_flag) {
3898 if (IS_CSS_ON(jhtml->entryp)) {
3899 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3906 * It is a handler who processes the DT tag.
3908 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3909 * destination is specified.
3910 * @param node [i] The DT tag node is specified.
3911 * @return The conversion result is returned.
3914 s_jhtml_start_dt_tag(void *pdoc, Node *node)
3916 jhtml_t *jhtml = GET_JHTML(pdoc);
3917 Doc *doc = jhtml->doc;
3919 char *attr_style = NULL;
3920 char *attr_color = NULL;
3921 char *attr_size = NULL;
3922 for (attr = qs_get_attr(doc,node);
3924 attr = qs_get_next_attr(doc,attr)) {
3925 char *name = qs_get_attr_name(doc,attr);
3926 char *value = qs_get_attr_value(doc,attr);
3927 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3931 if (IS_CSS_ON(jhtml->entryp)) {
3932 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3934 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3935 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3936 css_property_t *cur;
3937 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3938 if (cur->value && *cur->value) {
3939 attr_color = apr_pstrdup(doc->pool, cur->value);
3942 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3943 if (cur->value && *cur->value) {
3944 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3945 attr_size = apr_pstrdup(doc->pool, "1");
3947 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3948 attr_size = apr_pstrdup(doc->pool, "2");
3950 else if (STRCASEEQ('s','S',"small",cur->value)) {
3951 attr_size = apr_pstrdup(doc->pool, "3");
3953 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3954 attr_size = apr_pstrdup(doc->pool, "4");
3956 else if (STRCASEEQ('l','L',"large",cur->value)) {
3957 attr_size = apr_pstrdup(doc->pool, "5");
3959 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3960 attr_size = apr_pstrdup(doc->pool, "6");
3962 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3963 attr_size = apr_pstrdup(doc->pool, "7");
3970 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3971 memset(flg, 0, sizeof(*flg));
3972 if (attr_color || attr_size) {
3975 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3986 flg->with_font_flag = 1;
3988 node->userData = (void *)flg;
3994 * It is a handler who processes the DT tag.
3996 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3997 * destination is specified.
3998 * @param node [i] The DT tag node is specified.
3999 * @return The conversion result is returned.
4002 s_jhtml_end_dt_tag(void *pdoc, Node *node)
4004 jhtml_t *jhtml = GET_JHTML(pdoc);
4005 Doc *doc = jhtml->doc;
4006 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4007 if (flg && flg->with_font_flag) {
4010 if (IS_CSS_ON(jhtml->entryp)) {
4011 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4018 * It is a handler who processes the DD tag.
4020 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4021 * destination is specified.
4022 * @param node [i] The DD tag node is specified.
4023 * @return The conversion result is returned.
4026 s_jhtml_start_dd_tag(void *pdoc, Node *node)
4028 jhtml_t *jhtml = GET_JHTML(pdoc);
4029 Doc *doc = jhtml->doc;
4031 char *attr_style = NULL;
4032 char *attr_color = NULL;
4033 char *attr_size = NULL;
4034 for (attr = qs_get_attr(doc,node);
4036 attr = qs_get_next_attr(doc,attr)) {
4037 char *name = qs_get_attr_name(doc,attr);
4038 char *value = qs_get_attr_value(doc,attr);
4039 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4043 if (IS_CSS_ON(jhtml->entryp)) {
4044 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4046 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4047 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4048 css_property_t *cur;
4049 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4050 if (cur->value && *cur->value) {
4051 attr_color = apr_pstrdup(doc->pool, cur->value);
4054 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4055 if (cur->value && *cur->value) {
4056 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4057 attr_size = apr_pstrdup(doc->pool, "1");
4059 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4060 attr_size = apr_pstrdup(doc->pool, "2");
4062 else if (STRCASEEQ('s','S',"small",cur->value)) {
4063 attr_size = apr_pstrdup(doc->pool, "3");
4065 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4066 attr_size = apr_pstrdup(doc->pool, "4");
4068 else if (STRCASEEQ('l','L',"large",cur->value)) {
4069 attr_size = apr_pstrdup(doc->pool, "5");
4071 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4072 attr_size = apr_pstrdup(doc->pool, "6");
4074 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4075 attr_size = apr_pstrdup(doc->pool, "7");
4082 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4083 memset(flg, 0, sizeof(*flg));
4084 if (attr_color || attr_size) {
4087 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4098 flg->with_font_flag = 1;
4100 node->userData = (void *)flg;
4106 * It is a handler who processes the DD tag.
4108 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4109 * destination is specified.
4110 * @param node [i] The DD tag node is specified.
4111 * @return The conversion result is returned.
4114 s_jhtml_end_dd_tag(void *pdoc, Node *node)
4116 jhtml_t *jhtml = GET_JHTML(pdoc);
4117 Doc *doc = jhtml->doc;
4118 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4119 if (flg && flg->with_font_flag) {
4122 if (IS_CSS_ON(jhtml->entryp)) {
4123 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4130 * It is a handler who processes the H1 tag.
4132 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4133 * destination is specified.
4134 * @param node [i] The H1 tag node is specified.
4135 * @return The conversion result is returned.
4138 s_jhtml_start_h1_tag(void *pdoc, Node *node)
4144 char *attr_style = NULL;
4145 char *attr_align = NULL;
4147 jhtml = GET_JHTML(pdoc);
4151 for (attr = qs_get_attr(doc,node);
4153 attr = qs_get_next_attr(doc,attr)) {
4154 char *name = qs_get_attr_name(doc,attr);
4155 char *value = qs_get_attr_value(doc,attr);
4156 if (STRCASEEQ('a','A',"align", name)) {
4157 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4161 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4165 if (IS_CSS_ON(jhtml->entryp)) {
4166 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4168 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4169 css_property_t *cur;
4170 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4171 if (STRCASEEQ('l','L',"left", cur->value)) {
4172 attr_align = apr_pstrdup(doc->pool, "left");
4174 else if (STRCASEEQ('c','C',"center",cur->value)) {
4175 attr_align = apr_pstrdup(doc->pool, "center");
4177 else if (STRCASEEQ('r','R',"right",cur->value)) {
4178 attr_align = apr_pstrdup(doc->pool, "right");
4184 W_L("<div align=\"");
4187 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4188 memset(flg, 0, sizeof(*flg));
4189 flg->with_div_align_flag = 1;
4190 node->userData = (void *)flg;
4193 node->userData = NULL;
4202 * It is a handler who processes the H1 tag.
4204 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4205 * destination is specified.
4206 * @param node [i] The H1 tag node is specified.
4207 * @return The conversion result is returned.
4210 s_jhtml_end_h1_tag(void *pdoc, Node *node)
4216 jhtml = GET_JHTML(pdoc);
4220 jhtml_flags_t *flg = node->userData;
4222 if (flg && flg->with_div_align_flag) {
4224 node->userData = NULL;
4226 if (IS_CSS_ON(jhtml->entryp)) {
4227 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4234 * It is a handler who processes the H2 tag.
4236 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4237 * destination is specified.
4238 * @param node [i] The H1 tag node is specified.
4239 * @return The conversion result is returned.
4242 s_jhtml_start_h2_tag(void *pdoc, Node *node)
4248 char *attr_style = NULL;
4249 char *attr_align = NULL;
4251 jhtml = GET_JHTML(pdoc);
4255 for (attr = qs_get_attr(doc,node);
4257 attr = qs_get_next_attr(doc,attr)) {
4258 char *name = qs_get_attr_name(doc,attr);
4259 char *value = qs_get_attr_value(doc,attr);
4260 if (STRCASEEQ('a','A',"align", name)) {
4261 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4265 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4269 if (IS_CSS_ON(jhtml->entryp)) {
4270 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4272 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4273 css_property_t *cur;
4274 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4275 if (STRCASEEQ('l','L',"left", cur->value)) {
4276 attr_align = apr_pstrdup(doc->pool, "left");
4278 else if (STRCASEEQ('c','C',"center",cur->value)) {
4279 attr_align = apr_pstrdup(doc->pool, "center");
4281 else if (STRCASEEQ('r','R',"right",cur->value)) {
4282 attr_align = apr_pstrdup(doc->pool, "right");
4288 W_L("<div align=\"");
4291 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4292 memset(flg, 0, sizeof(*flg));
4293 flg->with_div_align_flag = 1;
4294 node->userData = (void *)flg;
4297 node->userData = NULL;
4306 * It is a handler who processes the H2 tag.
4308 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4309 * destination is specified.
4310 * @param node [i] The H1 tag node is specified.
4311 * @return The conversion result is returned.
4314 s_jhtml_end_h2_tag(void *pdoc, Node *node)
4320 jhtml = GET_JHTML(pdoc);
4324 jhtml_flags_t *flg = node->userData;
4326 if (flg && flg->with_div_align_flag) {
4328 node->userData = NULL;
4330 if (IS_CSS_ON(jhtml->entryp)) {
4331 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4338 * It is a handler who processes the H3 tag.
4340 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4341 * destination is specified.
4342 * @param node [i] The H1 tag node is specified.
4343 * @return The conversion result is returned.
4346 s_jhtml_start_h3_tag(void *pdoc, Node *node)
4352 char *attr_style = NULL;
4353 char *attr_align = NULL;
4355 jhtml = GET_JHTML(pdoc);
4359 for (attr = qs_get_attr(doc,node);
4361 attr = qs_get_next_attr(doc,attr)) {
4362 char *name = qs_get_attr_name(doc,attr);
4363 char *value = qs_get_attr_value(doc,attr);
4364 if (STRCASEEQ('a','A',"align", name)) {
4365 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4369 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4373 if (IS_CSS_ON(jhtml->entryp)) {
4374 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4376 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4377 css_property_t *cur;
4378 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4379 if (STRCASEEQ('l','L',"left", cur->value)) {
4380 attr_align = apr_pstrdup(doc->pool, "left");
4382 else if (STRCASEEQ('c','C',"center",cur->value)) {
4383 attr_align = apr_pstrdup(doc->pool, "center");
4385 else if (STRCASEEQ('r','R',"right",cur->value)) {
4386 attr_align = apr_pstrdup(doc->pool, "right");
4392 W_L("<div align=\"");
4395 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4396 memset(flg, 0, sizeof(*flg));
4397 flg->with_div_align_flag = 1;
4398 node->userData = (void *)flg;
4401 node->userData = NULL;
4410 * It is a handler who processes the H3 tag.
4412 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4413 * destination is specified.
4414 * @param node [i] The H1 tag node is specified.
4415 * @return The conversion result is returned.
4418 s_jhtml_end_h3_tag(void *pdoc, Node *node)
4424 jhtml = GET_JHTML(pdoc);
4428 jhtml_flags_t *flg = node->userData;
4430 if (flg && flg->with_div_align_flag) {
4432 node->userData = NULL;
4434 if (IS_CSS_ON(jhtml->entryp)) {
4435 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4443 * It is a handler who processes the H4 tag.
4445 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4446 * destination is specified.
4447 * @param node [i] The H1 tag node is specified.
4448 * @return The conversion result is returned.
4451 s_jhtml_start_h4_tag(void *pdoc, Node *node)
4457 char *attr_style = NULL;
4458 char *attr_align = NULL;
4460 jhtml = GET_JHTML(pdoc);
4464 for (attr = qs_get_attr(doc,node);
4466 attr = qs_get_next_attr(doc,attr)) {
4467 char *name = qs_get_attr_name(doc,attr);
4468 char *value = qs_get_attr_value(doc,attr);
4469 if (STRCASEEQ('a','A',"align", name)) {
4470 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4474 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4478 if (IS_CSS_ON(jhtml->entryp)) {
4479 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4481 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4482 css_property_t *cur;
4483 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4484 if (STRCASEEQ('l','L',"left", cur->value)) {
4485 attr_align = apr_pstrdup(doc->pool, "left");
4487 else if (STRCASEEQ('c','C',"center",cur->value)) {
4488 attr_align = apr_pstrdup(doc->pool, "center");
4490 else if (STRCASEEQ('r','R',"right",cur->value)) {
4491 attr_align = apr_pstrdup(doc->pool, "right");
4497 W_L("<div align=\"");
4500 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4501 memset(flg, 0, sizeof(*flg));
4502 flg->with_div_align_flag = 1;
4503 node->userData = (void *)flg;
4506 node->userData = NULL;
4514 * It is a handler who processes the H4 tag.
4516 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4517 * destination is specified.
4518 * @param node [i] The H1 tag node is specified.
4519 * @return The conversion result is returned.
4522 s_jhtml_end_h4_tag(void *pdoc, Node *node)
4528 jhtml = GET_JHTML(pdoc);
4532 jhtml_flags_t *flg = node->userData;
4534 if (flg && flg->with_div_align_flag) {
4536 node->userData = NULL;
4538 if (IS_CSS_ON(jhtml->entryp)) {
4539 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4546 * It is a handler who processes the H5 tag.
4548 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4549 * destination is specified.
4550 * @param node [i] The H1 tag node is specified.
4551 * @return The conversion result is returned.
4554 s_jhtml_start_h5_tag(void *pdoc, Node *node)
4560 char *attr_style = NULL;
4561 char *attr_align = NULL;
4563 jhtml = GET_JHTML(pdoc);
4567 for (attr = qs_get_attr(doc,node);
4569 attr = qs_get_next_attr(doc,attr)) {
4570 char *name = qs_get_attr_name(doc,attr);
4571 char *value = qs_get_attr_value(doc,attr);
4572 if (STRCASEEQ('a','A',"align", name)) {
4573 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4577 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4581 if (IS_CSS_ON(jhtml->entryp)) {
4582 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4584 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4585 css_property_t *cur;
4586 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4587 if (STRCASEEQ('l','L',"left", cur->value)) {
4588 attr_align = apr_pstrdup(doc->pool, "left");
4590 else if (STRCASEEQ('c','C',"center",cur->value)) {
4591 attr_align = apr_pstrdup(doc->pool, "center");
4593 else if (STRCASEEQ('r','R',"right",cur->value)) {
4594 attr_align = apr_pstrdup(doc->pool, "right");
4600 W_L("<div align=\"");
4603 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4604 memset(flg, 0, sizeof(*flg));
4605 flg->with_div_align_flag = 1;
4606 node->userData = (void *)flg;
4609 node->userData = NULL;
4617 * It is a handler who processes the H5 tag.
4619 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4620 * destination is specified.
4621 * @param node [i] The H1 tag node is specified.
4622 * @return The conversion result is returned.
4625 s_jhtml_end_h5_tag(void *pdoc, Node *node)
4631 jhtml = GET_JHTML(pdoc);
4635 jhtml_flags_t *flg = node->userData;
4637 if (flg && flg->with_div_align_flag) {
4639 node->userData = NULL;
4641 if (IS_CSS_ON(jhtml->entryp)) {
4642 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4650 * It is a handler who processes the H6 tag.
4652 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4653 * destination is specified.
4654 * @param node [i] The H1 tag node is specified.
4655 * @return The conversion result is returned.
4658 s_jhtml_start_h6_tag(void *pdoc, Node *node)
4664 char *attr_style = NULL;
4665 char *attr_align = NULL;
4667 jhtml = GET_JHTML(pdoc);
4671 for (attr = qs_get_attr(doc,node);
4673 attr = qs_get_next_attr(doc,attr)) {
4674 char *name = qs_get_attr_name(doc,attr);
4675 char *value = qs_get_attr_value(doc,attr);
4676 if (STRCASEEQ('a','A',"align", name)) {
4677 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4681 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4685 if (IS_CSS_ON(jhtml->entryp)) {
4686 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4688 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4689 css_property_t *cur;
4690 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4691 if (STRCASEEQ('l','L',"left", cur->value)) {
4692 attr_align = apr_pstrdup(doc->pool, "left");
4694 else if (STRCASEEQ('c','C',"center",cur->value)) {
4695 attr_align = apr_pstrdup(doc->pool, "center");
4697 else if (STRCASEEQ('r','R',"right",cur->value)) {
4698 attr_align = apr_pstrdup(doc->pool, "right");
4704 W_L("<div align=\"");
4707 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4708 memset(flg, 0, sizeof(*flg));
4709 flg->with_div_align_flag = 1;
4710 node->userData = (void *)flg;
4713 node->userData = NULL;
4722 * It is a handler who processes the H6 tag.
4724 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4725 * destination is specified.
4726 * @param node [i] The H1 tag node is specified.
4727 * @return The conversion result is returned.
4730 s_jhtml_end_h6_tag(void *pdoc, Node *node)
4736 jhtml = GET_JHTML(pdoc);
4740 jhtml_flags_t *flg = node->userData;
4742 if (flg && flg->with_div_align_flag) {
4744 node->userData = NULL;
4746 if (IS_CSS_ON(jhtml->entryp)) {
4747 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4755 * It is a handler who processes the MENU tag.
4757 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4758 * destination is specified.
4759 * @param node [i] The MENU tag node is specified.
4760 * @return The conversion result is returned.
4763 s_jhtml_start_menu_tag(void *pdoc, Node *node)
4765 jhtml_t *jhtml = GET_JHTML(pdoc);
4766 Doc *doc = jhtml->doc;
4768 char *attr_style = NULL;
4769 char *attr_color = NULL;
4770 char *attr_size = NULL;
4771 for (attr = qs_get_attr(doc,node);
4773 attr = qs_get_next_attr(doc,attr)) {
4774 char *name = qs_get_attr_name(doc,attr);
4775 char *value = qs_get_attr_value(doc,attr);
4776 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4780 if (IS_CSS_ON(jhtml->entryp)) {
4781 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4783 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4784 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4785 css_property_t *cur;
4786 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4787 if (cur->value && *cur->value) {
4788 attr_color = apr_pstrdup(doc->pool, cur->value);
4791 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4792 if (cur->value && *cur->value) {
4793 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4794 attr_size = apr_pstrdup(doc->pool, "1");
4796 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4797 attr_size = apr_pstrdup(doc->pool, "2");
4799 else if (STRCASEEQ('s','S',"small",cur->value)) {
4800 attr_size = apr_pstrdup(doc->pool, "3");
4802 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4803 attr_size = apr_pstrdup(doc->pool, "4");
4805 else if (STRCASEEQ('l','L',"large",cur->value)) {
4806 attr_size = apr_pstrdup(doc->pool, "5");
4808 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4809 attr_size = apr_pstrdup(doc->pool, "6");
4811 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4812 attr_size = apr_pstrdup(doc->pool, "7");
4819 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4820 memset(flg, 0, sizeof(*flg));
4821 if (attr_color || attr_size) {
4824 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4835 flg->with_font_flag = 1;
4837 node->userData = (void *)flg;
4843 * It is a handler who processes the MENU tag.
4845 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4846 * destination is specified.
4847 * @param node [i] The MENU tag node is specified.
4848 * @return The conversion result is returned.
4851 s_jhtml_end_menu_tag(void *pdoc, Node *node)
4853 jhtml_t *jhtml = GET_JHTML(pdoc);
4854 Doc *doc = jhtml->doc;
4855 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4856 if (flg && flg->with_font_flag) {
4860 if (IS_CSS_ON(jhtml->entryp)) {
4861 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4868 * It is a handler who processes the PLAINTEXT tag.
4870 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4871 * destination is specified.
4872 * @param node [i] The PLAINTEXT tag node is specified.
4873 * @return The conversion result is returned.
4876 s_jhtml_start_plaintext_tag(void *pdoc, Node *node)
4881 jhtml = GET_JHTML(pdoc);
4884 s_jhtml_start_plaintext_tag_inner(pdoc,node);
4889 s_jhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
4894 jhtml = GET_JHTML(pdoc);
4896 for (child = qs_get_child_node(doc, node);
4898 child = qs_get_next_node(doc, child)) {
4900 s_jhtml_start_plaintext_tag_inner(pdoc, child);
4907 * It is a handler who processes the PLAINTEXT tag.
4909 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4910 * destination is specified.
4911 * @param node [i] The PLAINTEXT tag node is specified.
4912 * @return The conversion result is returned.
4915 s_jhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4917 jhtml_t *jhtml = GET_JHTML(pdoc);
4923 * It is a handler who processes the BLINK tag.
4925 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4926 * destination is specified.
4927 * @param node [i] The BLINK tag node is specified.
4928 * @return The conversion result is returned.
4931 s_jhtml_start_blink_tag(void *pdoc, Node *node)
4933 jhtml_t *jhtml = GET_JHTML(pdoc);
4934 Doc *doc = jhtml->doc;
4936 char *attr_style = NULL;
4937 char *attr_color = NULL;
4938 char *attr_size = NULL;
4939 for (attr = qs_get_attr(doc,node);
4941 attr = qs_get_next_attr(doc,attr)) {
4942 char *name = qs_get_attr_name(doc,attr);
4943 char *value = qs_get_attr_value(doc,attr);
4944 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4948 if (IS_CSS_ON(jhtml->entryp)) {
4949 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4951 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4952 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4953 css_property_t *cur;
4954 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4955 if (cur->value && *cur->value) {
4956 attr_color = apr_pstrdup(doc->pool, cur->value);
4959 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4960 if (cur->value && *cur->value) {
4961 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4962 attr_size = apr_pstrdup(doc->pool, "1");
4964 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4965 attr_size = apr_pstrdup(doc->pool, "2");
4967 else if (STRCASEEQ('s','S',"small",cur->value)) {
4968 attr_size = apr_pstrdup(doc->pool, "3");
4970 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4971 attr_size = apr_pstrdup(doc->pool, "4");
4973 else if (STRCASEEQ('l','L',"large",cur->value)) {
4974 attr_size = apr_pstrdup(doc->pool, "5");
4976 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4977 attr_size = apr_pstrdup(doc->pool, "6");
4979 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4980 attr_size = apr_pstrdup(doc->pool, "7");
4987 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4988 memset(flg, 0, sizeof(*flg));
4989 if (attr_color || attr_size) {
4992 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5003 flg->with_font_flag = 1;
5005 node->userData = (void *)flg;
5011 * It is a handler who processes the BLINK tag.
5013 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5014 * destination is specified.
5015 * @param node [i] The BLINK tag node is specified.
5016 * @return The conversion result is returned.
5019 s_jhtml_end_blink_tag(void *pdoc, Node *node)
5021 jhtml_t *jhtml = GET_JHTML(pdoc);
5022 Doc *doc = jhtml->doc;
5023 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5024 if (flg && flg->with_font_flag) {
5028 if (IS_CSS_ON(jhtml->entryp)) {
5029 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5036 * It is a handler who processes the MARQUEE tag.
5038 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5039 * destination is specified.
5040 * @param node [i] The MARQUEE tag node is specified.
5041 * @return The conversion result is returned.
5044 s_jhtml_start_marquee_tag(void *pdoc, Node *node)
5046 jhtml_t *jhtml = GET_JHTML(pdoc);
5047 Doc *doc = jhtml->doc;
5049 char *attr_direction = NULL;
5050 char *attr_style = NULL;
5051 char *attr_color = NULL;
5052 char *attr_size = NULL;
5053 /*--------------------------------------------------------------------------*/
5054 /* Get Attributes */
5055 /*--------------------------------------------------------------------------*/
5056 for (attr = qs_get_attr(doc,node);
5058 attr = qs_get_next_attr(doc,attr)) {
5059 char *name = qs_get_attr_name(doc,attr);
5060 char *value = qs_get_attr_value(doc,attr);
5061 if (STRCASEEQ('d','D',"direction", name)) {
5062 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
5063 attr_direction = value;
5066 else if (STRCASEEQ('b','B',"behavior",name)) {
5069 else if (STRCASEEQ('l','L',"loop",name)) {
5072 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5076 if (IS_CSS_ON(jhtml->entryp)) {
5077 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
5079 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5080 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5081 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5082 css_property_t *cur;
5083 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5084 if (cur->value && *cur->value) {
5085 attr_color = apr_pstrdup(doc->pool, cur->value);
5088 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5089 if (cur->value && *cur->value) {
5090 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5091 attr_size = apr_pstrdup(doc->pool, "1");
5093 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5094 attr_size = apr_pstrdup(doc->pool, "2");
5096 else if (STRCASEEQ('s','S',"small",cur->value)) {
5097 attr_size = apr_pstrdup(doc->pool, "3");
5099 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5100 attr_size = apr_pstrdup(doc->pool, "4");
5102 else if (STRCASEEQ('l','L',"large",cur->value)) {
5103 attr_size = apr_pstrdup(doc->pool, "5");
5105 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5106 attr_size = apr_pstrdup(doc->pool, "6");
5108 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5109 attr_size = apr_pstrdup(doc->pool, "7");
5113 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5114 if (cur->value && *cur->value) {
5115 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5116 attr_direction = "right";
5118 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5119 attr_direction = "left";
5126 if (attr_direction) {
5127 W_L(" direction=\"");
5128 W_V(attr_direction);
5133 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
5134 memset(flg, 0, sizeof(*flg));
5135 if (attr_color || attr_size) {
5138 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5149 flg->with_font_flag = 1;
5151 node->userData = (void *)flg;
5157 * It is a handler who processes the MARQUEE tag.
5159 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5160 * destination is specified.
5161 * @param node [i] The MARQUEE tag node is specified.
5162 * @return The conversion result is returned.
5165 s_jhtml_end_marquee_tag(void *pdoc, Node *node)
5167 jhtml_t *jhtml = GET_JHTML(pdoc);
5168 Doc *doc = jhtml->doc;
5170 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5171 if (flg && flg->with_font_flag) {
5175 if (IS_CSS_ON(jhtml->entryp)) {
5176 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5183 * It is handler who processes the New Line Code.
5186 s_jhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5188 jhtml_t *jhtml = GET_JHTML(pdoc);
5189 Doc *doc = jhtml->doc;
5196 * It is a handler who processes the LINK tag.
5198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5199 * destination is specified.
5200 * @param node [i] The LINK tag node is specified.
5201 * @return The conversion result is returned.
5204 s_jhtml_link_tag(void *pdoc, Node *node)
5213 jhtml = GET_JHTML(pdoc);
5216 if (! IS_CSS_ON(jhtml->entryp)) {
5220 for (attr = qs_get_attr(doc,node);
5222 attr = qs_get_next_attr(doc,attr)) {
5223 char *name = qs_get_attr_name(doc,attr);
5224 char *value = qs_get_attr_value(doc,attr);
5225 if (STRCASEEQ('r','R',"rel", name)) {
5226 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5230 else if (STRCASEEQ('h','H',"href", name)) {
5231 if (value && *value) {
5235 else if (STRCASEEQ('t','T',"type", name)) {
5236 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5242 if (rel && href && type) {
5243 DBG(doc->r, "start load CSS. url:[%s]", href);
5244 jhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jhtml->style, href);
5245 DBG(doc->r, "end load CSS. url:[%s]", href);
5252 static css_prop_list_t *
5253 s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5255 jhtml_t *jhtml = GET_JHTML(pdoc);
5256 Doc *doc = jhtml->doc;
5257 css_prop_list_t *last_css = NULL;
5258 if (IS_CSS_ON(jhtml->entryp)) {
5259 css_prop_list_t *dup_css;
5260 css_selector_t *selector;
5262 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5263 dup_css = chxj_dup_css_prop_list(doc, last_css);
5264 selector = chxj_css_find_selector(doc, jhtml->style, node);
5266 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5268 chxj_css_push_prop_list(jhtml->css_prop_stack, dup_css);
5269 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5271 if (style_attr_value) {
5272 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));
5274 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5282 static css_prop_list_t *
5283 s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5285 jhtml_t *jhtml = GET_JHTML(pdoc);
5286 Doc *doc = jhtml->doc;
5287 css_prop_list_t *last_css = NULL;
5288 if (IS_CSS_ON(jhtml->entryp)) {
5289 css_prop_list_t *dup_css;
5290 css_selector_t *selector;
5292 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5293 dup_css = chxj_dup_css_prop_list(doc, last_css);
5294 selector = chxj_css_find_selector(doc, jhtml->style, node);
5296 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5300 if (style_attr_value) {
5301 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));
5303 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5312 * It is a handler who processes the SPAN tag.
5314 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5315 * destination is specified.
5316 * @param node [i] The SPAN tag node is specified.
5317 * @return The conversion result is returned.
5320 s_jhtml_start_span_tag(void *pdoc, Node *node)
5325 char *attr_style = NULL;
5326 char *attr_color = NULL;
5327 char *attr_size = NULL;
5328 char *attr_align = NULL;
5329 char *attr_blink = NULL;
5330 char *attr_marquee = NULL;
5331 char *attr_marquee_dir = NULL;
5332 char *attr_marquee_style = NULL;
5333 char *attr_marquee_loop = NULL;
5335 jhtml = GET_JHTML(pdoc);
5338 for (attr = qs_get_attr(doc,node);
5340 attr = qs_get_next_attr(doc,attr)) {
5341 char *nm = qs_get_attr_name(doc,attr);
5342 char *val = qs_get_attr_value(doc,attr);
5343 if (val && STRCASEEQ('s','S',"style", nm)) {
5347 if (IS_CSS_ON(jhtml->entryp)) {
5348 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
5350 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5351 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5352 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5353 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5354 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5355 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5356 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5357 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5358 css_property_t *cur;
5359 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5360 attr_color = apr_pstrdup(doc->pool, cur->value);
5362 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5363 if (cur->value && *cur->value) {
5364 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5365 attr_size = apr_pstrdup(doc->pool, "1");
5367 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5368 attr_size = apr_pstrdup(doc->pool, "2");
5370 else if (STRCASEEQ('s','S',"small",cur->value)) {
5371 attr_size = apr_pstrdup(doc->pool, "3");
5373 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5374 attr_size = apr_pstrdup(doc->pool, "4");
5376 else if (STRCASEEQ('l','L',"large",cur->value)) {
5377 attr_size = apr_pstrdup(doc->pool, "5");
5379 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5380 attr_size = apr_pstrdup(doc->pool, "6");
5382 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5383 attr_size = apr_pstrdup(doc->pool, "7");
5387 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5388 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5389 attr_blink = apr_pstrdup(doc->pool, cur->value);
5392 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5393 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5394 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5397 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5398 if (cur->value && *cur->value) {
5399 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5400 attr_marquee_dir = "right";
5402 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5403 attr_marquee_dir = "left";
5407 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5408 if (cur->value && *cur->value) {
5409 if ( STRCASEEQ('s','S',"scroll",cur->value)
5410 || STRCASEEQ('s','S',"slide",cur->value)
5411 || STRCASEEQ('a','A',"alternate",cur->value)) {
5412 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5416 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5417 if (cur->value && *cur->value) {
5418 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5419 attr_marquee_loop = "16";
5422 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5426 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5427 if (STRCASEEQ('l','L',"left", cur->value)) {
5428 attr_align = apr_pstrdup(doc->pool, "left");
5430 else if (STRCASEEQ('c','C',"center",cur->value)) {
5431 attr_align = apr_pstrdup(doc->pool, "center");
5433 else if (STRCASEEQ('r','R',"right",cur->value)) {
5434 attr_align = apr_pstrdup(doc->pool, "right");
5439 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5440 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5441 memset(flg, 0, sizeof(*flg));
5444 flg->with_blink_flag = 1;
5448 if (attr_marquee_dir) {
5449 W_L(" direction=\"");
5450 W_V(attr_marquee_dir);
5453 if (attr_marquee_style) {
5454 W_L(" behavior=\"");
5455 W_V(attr_marquee_style);
5458 if (attr_marquee_loop) {
5460 W_V(attr_marquee_loop);
5464 flg->with_marquee_flag = 1;
5466 if (attr_color||attr_size) {
5469 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5480 flg->with_font_flag = 1;
5483 W_L("<div align=\"");
5486 flg->with_div_flag = 1;
5488 node->userData = flg;
5491 node->userData = NULL;
5498 * It is a handler who processes the SPAN tag.
5500 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5501 * destination is specified.
5502 * @param node [i] The SPAN tag node is specified.
5503 * @return The conversion result is returned.
5506 s_jhtml_end_span_tag(void *pdoc, Node *node)
5508 jhtml_t *jhtml = GET_JHTML(pdoc);
5509 Doc *doc = jhtml->doc;
5511 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5512 if (flg && flg->with_div_flag) {
5515 if (flg && flg->with_font_flag) {
5518 if (flg && flg->with_marquee_flag) {
5521 if (flg && flg->with_blink_flag) {
5524 if (IS_CSS_ON(jhtml->entryp)) {
5525 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5532 * It is a handler who processes the STYLE tag.
5534 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5535 * destination is specified.
5536 * @param node [i] The STYLE tag node is specified.
5537 * @return The conversion result is returned.
5540 s_jhtml_style_tag(void *pdoc, Node *node)
5547 jhtml = GET_JHTML(pdoc);
5550 if (! IS_CSS_ON(jhtml->entryp)) {
5554 for (attr = qs_get_attr(doc,node);
5556 attr = qs_get_next_attr(doc,attr)) {
5557 char *name = qs_get_attr_name(doc,attr);
5558 char *value = qs_get_attr_value(doc,attr);
5559 if (STRCASEEQ('t','T',"type", name)) {
5560 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5566 Node *child = qs_get_child_node(doc, node);
5567 if (type && child) {
5568 char *name = qs_get_node_name(doc, child);
5569 if (STRCASEEQ('t','T',"text", name)) {
5570 char *value = qs_get_node_value(doc, child);
5571 DBG(doc->r, "start load CSS. buf:[%s]", value);
5572 jhtml->style = chxj_css_parse_style_value(doc, jhtml->style, value);
5573 DBG(doc->r, "end load CSS. value:[%s]", value);
5581 s_add_copyright_parameter(request_rec *r, char *value)
5583 request_rec *sub_req = NULL;
5586 char *content_type = NULL;
5587 apr_table_t *headers_out = NULL;
5589 DBG(r, "REQ[%X] start s_add_copyright_parameter", TO_ADDR(r));
5590 apr_pool_create(&pool, r->pool);
5592 if (chxj_starts_with(value, "http:") || chxj_starts_with(value, "https:")) {
5593 apr_table_t *response;
5594 int response_code = 0;
5595 response = chxj_serf_head(r, pool, value, &response_code);
5596 if (response_code != HTTP_OK) {
5597 DBG(r, "REQ[%X] end s_add_copyright_parameter (serf_req->status:[%d])", TO_ADDR(r), response_code);
5600 content_type = (char *)apr_table_get(response, "Content-Type");
5601 headers_out = response;
5604 // sub_req = ap_sub_req_method_uri("GET", value, r, r->output_filters);
5605 sub_req = ap_sub_req_lookup_uri(value, r, r->output_filters);
5606 if (sub_req->status != HTTP_OK) {
5607 DBG(r, "REQ[%X] end s_add_copyright_parameter (sub_req->status:[%d])", TO_ADDR(r), sub_req->status);
5608 ap_destroy_sub_req(sub_req);
5611 sub_req->header_only = 1;
5612 sub_req->main = NULL;
5613 rr_status = ap_run_sub_req(sub_req);
5614 DBG(r, "REQ[%X] sub_req4:ContentType:[%s]", TO_ADDR(r), sub_req->content_type);
5615 DBG(r, "REQ[%X] rr_status:[%d]", TO_ADDR(r), rr_status);
5616 content_type = apr_pstrdup(pool, sub_req->content_type);
5617 headers_out = sub_req->headers_out;
5619 if (headers_out && apr_table_get(headers_out, "x-jphone-copyright")) {
5620 if (content_type && strncasecmp("image/jpeg", content_type, 10) == 0) {
5621 if (strchr(value, '?')) {
5622 value = apr_psprintf(pool, "%s&_chxj_copy=.jpz", value);
5625 value = apr_psprintf(pool, "%s?_chxj_copy=.jpz", value);
5628 else if (content_type && strncasecmp("image/png", content_type, 9) == 0) {
5629 if (strchr(value, '?')) {
5630 value = apr_psprintf(pool, "%s&_chxj_copy=.pnz", value);
5633 value = apr_psprintf(pool, "%s?_chxj_copy=.pnz", value);
5638 ap_destroy_sub_req(sub_req);
5640 DBG(r, "REQ[%X] end s_add_copyright_parameter(result:[%s]", TO_ADDR(r), value);