2 * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_chtml30.h"
19 #include "chxj_hdml.h"
20 #include "chxj_str_util.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_conv_z2h.h"
27 #include "chxj_google.h"
29 #define GET_CHTML30(X) ((chtml30_t *)(X))
32 #define W_L(X) do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml30->conf); W_V(nlcode); } while (0)
40 #define CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR(tagname) \
45 char *attr_style = NULL; \
46 char *attr_color = NULL; \
48 chtml30 = GET_CHTML30(pdoc); \
50 for (attr = qs_get_attr(doc,node); \
52 attr = qs_get_next_attr(doc,attr)) { \
53 char *nm = qs_get_attr_name(doc,attr); \
54 char *val = qs_get_attr_value(doc,attr); \
55 if (val && STRCASEEQ('s','S',"style", nm)) { \
59 if (IS_CSS_ON(chtml30->entryp)) { \
60 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style); \
62 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color"); \
63 css_property_t *cur; \
64 for (cur = color_prop->next; cur != color_prop; cur = cur->next) { \
65 if (cur->value && *cur->value) { \
66 attr_color = apr_pstrdup(doc->pool, cur->value); \
72 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t)); \
73 memset(flg, 0, sizeof(*flg)); \
75 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color); \
76 W_L("<font color=\""); \
79 flg->with_font_flag = 1; \
81 node->userData = (void *)flg; \
82 return chtml30->out; \
85 #define CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG() \
87 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
88 Doc *doc = chtml30->doc; \
89 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
90 if (flg && flg->with_font_flag) { \
93 if (IS_CSS_ON(chtml30->entryp)) { \
94 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
96 return chtml30->out; \
99 #define CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG(tagname) \
101 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
102 Doc *doc = chtml30->doc; \
103 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
104 if (flg && flg->with_font_flag) { \
108 if (IS_CSS_ON(chtml30->entryp)) { \
109 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
111 return chtml30->out; \
115 static char *s_chtml30_start_html_tag (void *pdoc, Node *node);
116 static char *s_chtml30_end_html_tag (void *pdoc, Node *node);
117 static char *s_chtml30_start_meta_tag (void *pdoc, Node *node);
118 static char *s_chtml30_end_meta_tag (void *pdoc, Node *node);
119 static char *s_chtml30_start_textarea_tag (void *pdoc, Node *node);
120 static char *s_chtml30_end_textarea_tag (void *pdoc, Node *node);
121 static char *s_chtml30_start_p_tag (void *pdoc, Node *node);
122 static char *s_chtml30_end_p_tag (void *pdoc, Node *node);
123 static char *s_chtml30_start_pre_tag (void *pdoc, Node *node);
124 static char *s_chtml30_end_pre_tag (void *pdoc, Node *node);
125 static char *s_chtml30_start_h1_tag (void *pdoc, Node *node);
126 static char *s_chtml30_end_h1_tag (void *pdoc, Node *node);
127 static char *s_chtml30_start_h2_tag (void *pdoc, Node *node);
128 static char *s_chtml30_end_h2_tag (void *pdoc, Node *node);
129 static char *s_chtml30_start_h3_tag (void *pdoc, Node *node);
130 static char *s_chtml30_end_h3_tag (void *pdoc, Node *node);
131 static char *s_chtml30_start_h4_tag (void *pdoc, Node *node);
132 static char *s_chtml30_end_h4_tag (void *pdoc, Node *node);
133 static char *s_chtml30_start_h5_tag (void *pdoc, Node *node);
134 static char *s_chtml30_end_h5_tag (void *pdoc, Node *node);
135 static char *s_chtml30_start_h6_tag (void *pdoc, Node *node);
136 static char *s_chtml30_end_h6_tag (void *pdoc, Node *node);
137 static char *s_chtml30_start_ul_tag (void *pdoc, Node *node);
138 static char *s_chtml30_end_ul_tag (void *pdoc, Node *node);
139 static char *s_chtml30_start_ol_tag (void *pdoc, Node *node);
140 static char *s_chtml30_end_ol_tag (void *pdoc, Node *node);
141 static char *s_chtml30_start_li_tag (void *pdoc, Node *node);
142 static char *s_chtml30_end_li_tag (void *pdoc, Node *node);
143 static char *s_chtml30_start_head_tag (void *pdoc, Node *node);
144 static char *s_chtml30_end_head_tag (void *pdoc, Node *node);
145 static char *s_chtml30_start_title_tag (void *pdoc, Node *node);
146 static char *s_chtml30_end_title_tag (void *pdoc, Node *node);
147 static char *s_chtml30_start_base_tag (void *pdoc, Node *node);
148 static char *s_chtml30_end_base_tag (void *pdoc, Node *node);
149 static char *s_chtml30_start_body_tag (void *pdoc, Node *node);
150 static char *s_chtml30_end_body_tag (void *pdoc, Node *node);
151 static char *s_chtml30_start_a_tag (void *pdoc, Node *node);
152 static char *s_chtml30_end_a_tag (void *pdoc, Node *node);
153 static char *s_chtml30_start_br_tag (void *pdoc, Node *node);
154 static char *s_chtml30_end_br_tag (void *pdoc, Node *node);
155 static char *s_chtml30_start_tr_tag (void *pdoc, Node *node);
156 static char *s_chtml30_end_tr_tag (void *pdoc, Node *node);
157 static char *s_chtml30_start_font_tag (void *pdoc, Node *node);
158 static char *s_chtml30_end_font_tag (void *pdoc, Node *node);
159 static char *s_chtml30_start_form_tag (void *pdoc, Node *node);
160 static char *s_chtml30_end_form_tag (void *pdoc, Node *node);
161 static char *s_chtml30_start_input_tag (void *pdoc, Node *node);
162 static char *s_chtml30_end_input_tag (void *pdoc, Node *node);
163 static char *s_chtml30_start_center_tag (void *pdoc, Node *node);
164 static char *s_chtml30_end_center_tag (void *pdoc, Node *node);
165 static char *s_chtml30_start_hr_tag (void *pdoc, Node *node);
166 static char *s_chtml30_end_hr_tag (void *pdoc, Node *node);
167 static char *s_chtml30_start_img_tag (void *pdoc, Node *node);
168 static char *s_chtml30_end_img_tag (void *pdoc, Node *node);
169 static char *s_chtml30_start_select_tag (void *pdoc, Node *node);
170 static char *s_chtml30_end_select_tag (void *pdoc, Node *node);
171 static char *s_chtml30_start_option_tag (void *pdoc, Node *node);
172 static char *s_chtml30_end_option_tag (void *pdoc, Node *node);
173 static char *s_chtml30_start_div_tag (void *pdoc, Node *node);
174 static char *s_chtml30_end_div_tag (void *pdoc, Node *node);
175 static char *s_chtml30_chxjif_tag (void *pdoc, Node *node);
176 static char *s_chtml30_text_tag (void *pdoc, Node *node);
177 static char *s_chtml30_start_blockquote_tag (void *pdoc, Node *node);
178 static char *s_chtml30_end_blockquote_tag (void *pdoc, Node *node);
179 static char *s_chtml30_start_dir_tag (void *pdoc, Node *node);
180 static char *s_chtml30_end_dir_tag (void *pdoc, Node *node);
181 static char *s_chtml30_start_dl_tag (void *pdoc, Node *node);
182 static char *s_chtml30_end_dl_tag (void *pdoc, Node *node);
183 static char *s_chtml30_start_dt_tag (void *pdoc, Node *node);
184 static char *s_chtml30_end_dt_tag (void *pdoc, Node *node);
185 static char *s_chtml30_start_dd_tag (void *pdoc, Node *node);
186 static char *s_chtml30_end_dd_tag (void *pdoc, Node *node);
187 static char *s_chtml30_start_marquee_tag (void *pdoc, Node *node);
188 static char *s_chtml30_end_marquee_tag (void *pdoc, Node *node);
189 static char *s_chtml30_start_blink_tag (void *pdoc, Node *node);
190 static char *s_chtml30_end_blink_tag (void *pdoc, Node *node);
191 static char *s_chtml30_start_menu_tag (void *pdoc, Node *node);
192 static char *s_chtml30_end_menu_tag (void *pdoc, Node *node);
193 static char *s_chtml30_start_plaintext_tag (void *pdoc, Node *node);
194 static char *s_chtml30_start_plaintext_tag_inner (void *pdoc, Node *node);
195 static char *s_chtml30_end_plaintext_tag (void *pdoc, Node *node);
196 static char *s_chtml30_style_tag (void *pdoc, Node *node);
197 static char *s_chtml30_newline_mark (void *pdoc, Node *node);
198 static char *s_chtml30_link_tag (void *pdoc, Node *node);
199 static char *s_chtml30_start_span_tag (void *pdoc, Node *node);
200 static char *s_chtml30_end_span_tag (void *pdoc, Node *node);
202 static void s_init_chtml30(chtml30_t *chtml, Doc *doc, request_rec *r, device_table *spec);
204 static int s_chtml30_search_emoji(chtml30_t *chtml, char *txt, char **rslt, Node *node);
205 static css_prop_list_t *s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
206 static css_prop_list_t *s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
209 tag_handler chtml30_handler[] = {
212 s_chtml30_start_html_tag,
213 s_chtml30_end_html_tag,
217 s_chtml30_start_meta_tag,
218 s_chtml30_end_meta_tag,
222 s_chtml30_start_textarea_tag,
223 s_chtml30_end_textarea_tag,
227 s_chtml30_start_p_tag,
232 s_chtml30_start_pre_tag,
233 s_chtml30_end_pre_tag,
237 s_chtml30_start_ul_tag,
238 s_chtml30_end_ul_tag,
242 s_chtml30_start_li_tag,
243 s_chtml30_end_li_tag,
247 s_chtml30_start_ol_tag,
248 s_chtml30_end_ol_tag,
252 s_chtml30_start_h1_tag,
253 s_chtml30_end_h1_tag,
257 s_chtml30_start_h2_tag,
258 s_chtml30_end_h2_tag,
262 s_chtml30_start_h3_tag,
263 s_chtml30_end_h3_tag,
267 s_chtml30_start_h4_tag,
268 s_chtml30_end_h4_tag,
272 s_chtml30_start_h5_tag,
273 s_chtml30_end_h5_tag,
277 s_chtml30_start_h6_tag,
278 s_chtml30_end_h6_tag,
282 s_chtml30_start_head_tag,
283 s_chtml30_end_head_tag,
287 s_chtml30_start_title_tag,
288 s_chtml30_end_title_tag,
292 s_chtml30_start_base_tag,
293 s_chtml30_end_base_tag,
297 s_chtml30_start_body_tag,
298 s_chtml30_end_body_tag,
302 s_chtml30_start_a_tag,
307 s_chtml30_start_br_tag,
308 s_chtml30_end_br_tag,
317 s_chtml30_start_tr_tag,
318 s_chtml30_end_tr_tag,
332 s_chtml30_start_font_tag,
333 s_chtml30_end_font_tag,
337 s_chtml30_start_form_tag,
338 s_chtml30_end_form_tag,
342 s_chtml30_start_input_tag,
343 s_chtml30_end_input_tag,
347 s_chtml30_start_center_tag,
348 s_chtml30_end_center_tag,
352 s_chtml30_start_hr_tag,
353 s_chtml30_end_hr_tag,
357 s_chtml30_start_img_tag,
358 s_chtml30_end_img_tag,
362 s_chtml30_start_select_tag,
363 s_chtml30_end_select_tag,
367 s_chtml30_start_option_tag,
368 s_chtml30_end_option_tag,
372 s_chtml30_start_div_tag,
373 s_chtml30_end_div_tag,
377 s_chtml30_chxjif_tag,
382 s_chtml30_chxjif_tag,
402 s_chtml30_start_span_tag,
403 s_chtml30_end_span_tag,
427 s_chtml30_start_dt_tag,
428 s_chtml30_end_dt_tag,
442 s_chtml30_start_blockquote_tag,
443 s_chtml30_end_blockquote_tag,
447 s_chtml30_start_dir_tag,
448 s_chtml30_end_dir_tag,
452 s_chtml30_start_dl_tag,
453 s_chtml30_end_dl_tag,
457 s_chtml30_start_dd_tag,
458 s_chtml30_end_dd_tag,
462 s_chtml30_start_menu_tag,
463 s_chtml30_end_menu_tag,
467 s_chtml30_start_plaintext_tag,
468 s_chtml30_end_plaintext_tag,
472 s_chtml30_start_blink_tag,
473 s_chtml30_end_blink_tag,
477 s_chtml30_start_marquee_tag,
478 s_chtml30_end_marquee_tag,
487 s_chtml30_newline_mark,
509 * converts from CHTML5.0 to CHTML3.0.
511 * @param r [i] Requet_rec is appointed.
512 * @param spec [i] The result of the device specification processing which
513 * was done in advance is appointed.
514 * @param src [i] The character string before the converting is appointed.
515 * @return The character string after the converting is returned.
518 chxj_convert_chtml30(
524 chxjconvrule_entry *entryp,
533 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
535 /*--------------------------------------------------------------------------*/
537 /*--------------------------------------------------------------------------*/
539 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
541 DBG(r,"REQ[%X] found qrcode xml",TO_ADDR(r));
542 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
545 DBG(r,"not found qrcode xml");
547 /*--------------------------------------------------------------------------*/
548 /* The CHTML structure is initialized. */
549 /*--------------------------------------------------------------------------*/
550 s_init_chtml30(&chtml30, &doc, r, spec);
552 chtml30.entryp = entryp;
553 chtml30.cookie = cookie;
555 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
557 /*--------------------------------------------------------------------------*/
558 /* The character string of the input is analyzed. */
559 /*--------------------------------------------------------------------------*/
560 qs_init_malloc(&doc);
561 qs_init_root_node(&doc);
563 ss = apr_pcalloc(r->pool, srclen + 1);
564 memset(ss, 0, srclen + 1);
565 memcpy(ss, src, srclen);
568 chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
570 if (IS_CSS_ON(chtml30.entryp)) {
571 /* current property list */
572 chtml30.css_prop_stack = chxj_new_prop_list_stack(&doc);
575 chxj_buffered_write_init(r->pool, &doc.buf);
577 qs_parse_string(&doc,ss, strlen(ss));
579 /*--------------------------------------------------------------------------*/
580 /* It converts it from CHTML to CHTML. */
581 /*--------------------------------------------------------------------------*/
582 chxj_node_convert(spec,r,(void*)&chtml30, &doc, qs_get_root(&doc), 0);
583 chtml30.out = chxj_buffered_write_flush(chtml30.out, &doc.buf);
584 dst = apr_pstrdup(r->pool, chtml30.out);
585 chxj_buffered_write_terminate(&doc.buf);
587 qs_all_free(&doc,QX_LOGMARK);
590 dst = apr_pstrdup(r->pool,ss);
592 if (strlen(dst) == 0) {
593 dst = apr_psprintf(r->pool, "\n");
596 *dstlen = strlen(dst);
599 chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
602 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
608 * The CHTML structure is initialized.
610 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
611 * initialized is specified.
612 * @param doc [i] The Doc structure that should be set to the initialized
613 * HDML structure is specified.
614 * @param r [i] To use POOL, the pointer to request_rec is specified.
615 * @param spec [i] The pointer to the device_table
618 s_init_chtml30(chtml30_t *chtml30, Doc *doc, request_rec *r, device_table *spec)
620 memset(doc, 0, sizeof(Doc));
621 memset(chtml30, 0, sizeof(chtml30_t));
625 chtml30->spec = spec;
626 chtml30->out = qs_alloc_zero_byte_string(r->pool);
627 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
628 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
633 * Corresponding EMOJI to a current character-code is retrieved.
634 * The substitution character string is stored in the rslt pointer if agreeing.
636 * @param chtml30 [i] The pointer to the CHTML structure is specified.
637 * @param txt [i] The character string to want to examine whether it is
638 * EMOJI is specified.
639 * @param rslt [o] The pointer to the pointer that stores the result is
641 * @param node [i] The current node to check whether tag is span/font for CHXJ_IMODE_EMOJI_COLOR_AUTO
642 * @return When corresponding EMOJI exists, it returns it excluding 0.
645 s_chtml30_search_emoji(chtml30_t *chtml30, char *txt, char **rslt, Node *node)
652 spec = chtml30->spec;
658 DBG(r,"REQ[%X] spec is NULL", TO_ADDR(r));
661 for (ee = chtml30->conf->emoji;
664 if (ee->imode == NULL) {
665 DBG(r, "REQ[%X] emoji->imode is NULL", TO_ADDR(r));
669 if (ee->imode->string != NULL
670 && strlen(ee->imode->string) > 0
671 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
673 if (spec == NULL || spec->emoji_type == NULL) {
674 *rslt = apr_palloc(r->pool, 3);
675 (*rslt)[0] = ee->imode->hex1byte & 0xff;
676 (*rslt)[1] = ee->imode->hex2byte & 0xff;
679 if(chtml30->conf->imode_emoji_color >= CHXJ_IMODE_EMOJI_COLOR_AUTO ){
680 if(ee->imode->color != NULL){
681 if(chtml30->conf->imode_emoji_color == CHXJ_IMODE_EMOJI_COLOR_AUTO && node != NULL ){
682 if(strcasecmp(node->parent->name, "span") == 0 ||
683 strcasecmp(node->parent->name, "font") == 0 ){
684 return strlen(ee->imode->string);
687 char *tmp = apr_pstrdup(r->pool,*rslt);
688 *rslt = apr_psprintf(r->pool,
689 "<font color=\"%s\">%s</font>",ee->imode->color,tmp);
692 return strlen(ee->imode->string);
694 return strlen(ee->imode->string);
706 chxj_chtml30_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
717 chtml30 = &__chtml30;
720 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
721 memset(doc, 0, sizeof(Doc));
722 memset(chtml30, 0, sizeof(chtml30_t));
726 chtml30->spec = spec;
727 chtml30->out = qs_alloc_zero_byte_string(r->pool);
728 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
729 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
731 apr_pool_create(&pool, r->pool);
733 chxj_buffered_write_init(pool, &doc->buf);
735 for (ii=0; ii<len; ii++) {
739 rtn = s_chtml30_search_emoji(chtml30, (char *)&src[ii], &out, NULL);
746 if (is_sjis_kanji(src[ii])) {
747 two_byte[0] = src[ii+0];
748 two_byte[1] = src[ii+1];
754 one_byte[0] = src[ii+0];
759 chtml30->out = chxj_buffered_write_flush(chtml30->out, &doc->buf);
761 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
767 * It is a handler who processes the HTML tag.
769 * @param pdoc [i/o] The pointer to the CHTML structure at the output
770 * destination is specified.
771 * @param node [i] The HTML tag node is specified.
772 * @return The conversion result is returned.
775 s_chtml30_start_html_tag(void *pdoc, Node *UNUSED(node))
777 chtml30_t *chtml30 = GET_CHTML30(pdoc);
778 Doc *doc = chtml30->doc;
780 /*--------------------------------------------------------------------------*/
782 /*--------------------------------------------------------------------------*/
790 * It is a handler who processes the HTML tag.
792 * @param pdoc [i/o] The pointer to the CHTML structure at the output
793 * destination is specified.
794 * @param node [i] The HTML tag node is specified.
795 * @return The conversion result is returned.
798 s_chtml30_end_html_tag(void *pdoc, Node *UNUSED(child))
800 chtml30_t *chtml30 = GET_CHTML30(pdoc);
801 Doc *doc = chtml30->doc;
810 * It is a handler who processes the META tag.
812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
813 * destination is specified.
814 * @param node [i] The META tag node is specified.
815 * @return The conversion result is returned.
818 s_chtml30_start_meta_tag(void *pdoc, Node *node)
824 int content_type_flag;
827 chtml30 = GET_CHTML30(pdoc);
831 content_type_flag = 0;
835 /*--------------------------------------------------------------------------*/
837 /*--------------------------------------------------------------------------*/
838 for (attr = qs_get_attr(doc,node);
840 attr = qs_get_next_attr(doc,attr)) {
841 char *name = qs_get_attr_name(doc,attr);
842 char *value = qs_get_attr_value(doc,attr);
846 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
847 /*----------------------------------------------------------------------*/
849 /*----------------------------------------------------------------------*/
850 W_L(" http-equiv=\"");
853 if (STRCASEEQ('c','C',"content-type", value))
854 content_type_flag = 1;
856 if (STRCASEEQ('r','R',"refresh", value))
863 if (strcasecmp(name, "content") == 0 && value && *value) {
864 if (content_type_flag) {
868 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
876 buf = apr_pstrdup(r->pool, value);
877 url = strchr(buf, ';');
879 sec = apr_pstrdup(r->pool, buf);
882 url = chxj_encoding_parameter(r, url, 0);
883 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
913 * It is a handler who processes the META tag.
915 * @param pdoc [i/o] The pointer to the CHTML structure at the output
916 * destination is specified.
917 * @param node [i] The META tag node is specified.
918 * @return The conversion result is returned.
921 s_chtml30_end_meta_tag(void* pdoc, Node* UNUSED(child))
923 chtml30_t *chtml30 = GET_CHTML30(pdoc);
930 * It is a handler who processes the HEAD tag.
932 * @param pdoc [i/o] The pointer to the CHTML structure at the output
933 * destination is specified.
934 * @param node [i] The HEAD tag node is specified.
935 * @return The conversion result is returned.
938 s_chtml30_start_head_tag(void* pdoc, Node* UNUSED(node))
940 chtml30_t *chtml30 = GET_CHTML30(pdoc);
941 Doc *doc = chtml30->doc;
950 * It is a handler who processes the HEAD tag.
952 * @param pdoc [i/o] The pointer to the CHTML structure at the output
953 * destination is specified.
954 * @param node [i] The HEAD tag node is specified.
955 * @return The conversion result is returned.
958 s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node))
960 chtml30_t *chtml30 = GET_CHTML30(pdoc);
961 Doc *doc = chtml30->doc;
970 * It is a handler who processes the TITLE tag.
972 * @param pdoc [i/o] The pointer to the CHTML structure at the output
973 * destination is specified.
974 * @param node [i] The TITLE tag node is specified.
975 * @return The conversion result is returned.
978 s_chtml30_start_title_tag(void *pdoc, Node *node)
980 chtml30_t *chtml30 = GET_CHTML30(pdoc);
981 Doc *doc = chtml30->doc;
985 if (chtml30->conf->use_google_analytics) {
986 chtml30->pagetitle = "";
988 for (child = qs_get_child_node(doc,node);
990 child = qs_get_next_node(doc,child)) {
991 char *textval = qs_get_node_value(doc,child);
992 chtml30->pagetitle = apr_pstrcat(doc->r->pool, chtml30->pagetitle, textval, NULL);
1001 * It is a handler who processes the TITLE tag.
1003 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1004 * destination is specified.
1005 * @param node [i] The TITLE tag node is specified.
1006 * @return The conversion result is returned.
1009 s_chtml30_end_title_tag(void *pdoc, Node *UNUSED(child))
1011 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1012 Doc *doc = chtml30->doc;
1016 return chtml30->out;
1021 * It is a handler who processes the BASE tag.
1023 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1024 * destination is specified.
1025 * @param node [i] The BASE tag node is specified.
1026 * @return The conversion result is returned.
1029 s_chtml30_start_base_tag(void *pdoc, Node *node)
1036 chtml30 = GET_CHTML30(pdoc);
1041 /*--------------------------------------------------------------------------*/
1042 /* Get Attributes */
1043 /*--------------------------------------------------------------------------*/
1044 for (attr = qs_get_attr(doc,node);
1046 attr = qs_get_next_attr(doc,attr)) {
1047 char *name = qs_get_attr_name(doc,attr);
1048 char *value = qs_get_attr_value(doc,attr);
1049 if (STRCASEEQ('h','H',"href", name)) {
1056 return chtml30->out;
1061 * It is a handler who processes the BASE tag.
1063 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1064 * destination is specified.
1065 * @param node [i] The BASE tag node is specified.
1066 * @return The conversion result is returned.
1069 s_chtml30_end_base_tag(void *pdoc, Node *UNUSED(child))
1071 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1073 return chtml30->out;
1078 * It is a handler who processes the BODY tag.
1080 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1081 * destination is specified.
1082 * @param node [i] The BODY tag node is specified.
1083 * @return The conversion result is returned.
1086 s_chtml30_start_body_tag(void *pdoc, Node *node)
1092 char *attr_bgcolor = NULL;
1093 char *attr_text = NULL;
1094 char *attr_link = NULL;
1095 char *attr_style = NULL;
1097 chtml30 = GET_CHTML30(pdoc);
1101 /*--------------------------------------------------------------------------*/
1102 /* Get Attributes */
1103 /*--------------------------------------------------------------------------*/
1104 for (attr = qs_get_attr(doc,node);
1106 attr = qs_get_next_attr(doc,attr)) {
1107 char *name = qs_get_attr_name(doc,attr);
1108 char *value = qs_get_attr_value(doc,attr);
1112 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
1113 /*----------------------------------------------------------------------*/
1115 /*----------------------------------------------------------------------*/
1116 attr_bgcolor = value;
1122 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
1123 /*----------------------------------------------------------------------*/
1125 /*----------------------------------------------------------------------*/
1132 if (strcasecmp(name, "style") == 0 && value && *value != 0) {
1139 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
1140 /*----------------------------------------------------------------------*/
1142 /*----------------------------------------------------------------------*/
1149 if (strcasecmp(name, "alink") == 0) {
1150 /*----------------------------------------------------------------------*/
1152 /*----------------------------------------------------------------------*/
1159 if (strcasecmp(name, "vlink") == 0) {
1160 /*----------------------------------------------------------------------*/
1162 /*----------------------------------------------------------------------*/
1171 if (IS_CSS_ON(chtml30->entryp)) {
1172 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1174 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1175 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1176 css_property_t *cur;
1177 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1178 if (cur->value && *cur->value) {
1179 attr_text = apr_pstrdup(doc->pool, cur->value);
1182 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1183 if (cur->value && *cur->value) {
1184 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1188 if (chtml30->style) {
1189 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml30->style);
1190 css_selector_t *cur_sel;
1191 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1192 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1193 css_property_t *cur;
1194 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1195 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1196 attr_link = apr_pstrdup(doc->pool, cur->value);
1205 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1211 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1217 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1224 return chtml30->out;
1229 * It is a handler who processes the BODY tag.
1231 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1232 * destination is specified.
1233 * @param node [i] The BODY tag node is specified.
1234 * @return The conversion result is returned.
1237 s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child))
1242 chtml30 = GET_CHTML30(pdoc);
1245 if (chtml30->conf->use_google_analytics) {
1246 char *src = chxj_google_analytics_get_image_url(doc->r, chtml30->pagetitle);
1253 if (IS_CSS_ON(chtml30->entryp)) {
1254 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1257 return chtml30->out;
1262 * It is a handler who processes the A tag.
1264 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1265 * destination is specified.
1266 * @param node [i] The A tag node is specified.
1267 * @return The conversion result is returned.
1270 s_chtml30_start_a_tag(void *pdoc, Node *node)
1276 char *attr_style = NULL;
1278 chtml30 = GET_CHTML30(pdoc);
1283 /*--------------------------------------------------------------------------*/
1284 /* Get Attributes */
1285 /*--------------------------------------------------------------------------*/
1286 for (attr = qs_get_attr(doc,node);
1288 attr = qs_get_next_attr(doc,attr)) {
1289 char *name = qs_get_attr_name(doc,attr);
1290 char *value = qs_get_attr_value(doc,attr);
1291 if (STRCASEEQ('n','N',"name", name)) {
1292 /*----------------------------------------------------------------------*/
1294 /*----------------------------------------------------------------------*/
1299 else if (STRCASEEQ('h','H',"href", name)) {
1300 /*----------------------------------------------------------------------*/
1302 /*----------------------------------------------------------------------*/
1303 value = chxj_encoding_parameter(r, value, 0);
1304 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1305 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1311 else if (STRCASEEQ('a','A',"accesskey", name)) {
1312 /*----------------------------------------------------------------------*/
1314 /*----------------------------------------------------------------------*/
1315 W_L(" accesskey=\"");
1319 else if (STRCASEEQ('c','C',"cti", name)) {
1320 /*----------------------------------------------------------------------*/
1322 /*----------------------------------------------------------------------*/
1327 else if (STRCASEEQ('i','I',"ijam", name)) {
1328 /*----------------------------------------------------------------------*/
1330 /*----------------------------------------------------------------------*/
1333 else if (STRCASEEQ('u','U',"utn", name)) {
1334 /*----------------------------------------------------------------------*/
1336 /* It is special only for CHTML. */
1337 /*----------------------------------------------------------------------*/
1340 else if (STRCASEEQ('t','T',"telbook", name)) {
1341 /*----------------------------------------------------------------------*/
1343 /*----------------------------------------------------------------------*/
1346 else if (STRCASEEQ('k','K',"kana", name)) {
1347 /*----------------------------------------------------------------------*/
1349 /*----------------------------------------------------------------------*/
1352 else if (STRCASEEQ('e','E',"email", name)) {
1353 /*----------------------------------------------------------------------*/
1355 /*----------------------------------------------------------------------*/
1358 else if (STRCASEEQ('i','I',"ista", name)) {
1359 /*----------------------------------------------------------------------*/
1361 /*----------------------------------------------------------------------*/
1364 else if (STRCASEEQ('i','I',"ilet", name)) {
1365 /*----------------------------------------------------------------------*/
1367 /*----------------------------------------------------------------------*/
1370 else if (STRCASEEQ('i','I',"iswf", name)) {
1371 /*----------------------------------------------------------------------*/
1373 /*----------------------------------------------------------------------*/
1376 else if (STRCASEEQ('i','I',"irst", name)) {
1377 /*----------------------------------------------------------------------*/
1379 /*----------------------------------------------------------------------*/
1382 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1388 if (IS_CSS_ON(chtml30->entryp)) {
1389 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1392 return chtml30->out;
1397 * It is a handler who processes the A tag.
1399 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1400 * destination is specified.
1401 * @param node [i] The A tag node is specified.
1402 * @return The conversion result is returned.
1405 s_chtml30_end_a_tag(void *pdoc, Node *UNUSED(child))
1410 chtml30 = GET_CHTML30(pdoc);
1414 if (IS_CSS_ON(chtml30->entryp)) {
1415 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1418 return chtml30->out;
1423 * It is a handler who processes the BR tag.
1425 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1426 * destination is specified.
1427 * @param node [i] The BR tag node is specified.
1428 * @return The conversion result is returned.
1431 s_chtml30_start_br_tag(void *pdoc, Node *node)
1438 chtml30 = GET_CHTML30(pdoc);
1442 /*--------------------------------------------------------------------------*/
1443 /* Get Attributes */
1444 /*--------------------------------------------------------------------------*/
1445 for (attr = qs_get_attr(doc,node);
1447 attr = qs_get_next_attr(doc,attr)) {
1448 char *name = qs_get_attr_name(doc,attr);
1449 char *value = qs_get_attr_value(doc,attr);
1450 if (STRCASEEQ('c','C',"clear",name)) {
1451 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1459 return chtml30->out;
1464 * It is a handler who processes the BR tag.
1466 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1467 * destination is specified.
1468 * @param node [i] The BR tag node is specified.
1469 * @return The conversion result is returned.
1472 s_chtml30_end_br_tag(void *pdoc, Node *UNUSED(child))
1474 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1476 return chtml30->out;
1481 * It is a handler who processes the TR tag.
1483 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1484 * destination is specified.
1485 * @param node [i] The TR tag node is specified.
1486 * @return The conversion result is returned.
1489 s_chtml30_start_tr_tag(void *pdoc, Node *UNUSED(node))
1491 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1493 return chtml30->out;
1498 * It is a handler who processes the TR tag.
1500 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1501 * destination is specified.
1502 * @param node [i] The TR tag node is specified.
1503 * @return The conversion result is returned.
1506 s_chtml30_end_tr_tag(void *pdoc, Node *UNUSED(child))
1512 chtml30 = GET_CHTML30(pdoc);
1518 return chtml30->out;
1523 * It is a handler who processes the FONT tag.
1525 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1526 * destination is specified.
1527 * @param node [i] The FONT tag node is specified.
1528 * @return The conversion result is returned.
1531 s_chtml30_start_font_tag(void *pdoc, Node *node)
1537 char *attr_color = NULL;
1538 char *attr_style = NULL;
1540 chtml30 = GET_CHTML30(pdoc);
1544 /*--------------------------------------------------------------------------*/
1545 /* Get Attributes */
1546 /*--------------------------------------------------------------------------*/
1547 for (attr = qs_get_attr(doc,node);
1549 attr = qs_get_next_attr(doc,attr)) {
1550 char *name = qs_get_attr_name(doc,attr);
1551 char *value = qs_get_attr_value(doc,attr);
1552 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1553 attr_color = apr_pstrdup(doc->buf.pool, value);
1555 else if (STRCASEEQ('s','S',"size", name)) {
1556 /*----------------------------------------------------------------------*/
1558 /*----------------------------------------------------------------------*/
1561 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1565 if (IS_CSS_ON(chtml30->entryp)) {
1566 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1568 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1569 css_property_t *cur;
1570 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1571 if (cur->value && *cur->value) {
1572 attr_color = apr_pstrdup(doc->pool, cur->value);
1578 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1579 W_L("<font color=\"");
1583 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1584 flg->with_font_flag = 1;
1585 node->userData = flg;
1588 node->userData = NULL;
1590 return chtml30->out;
1595 * It is a handler who processes the FONT tag.
1597 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1598 * destination is specified.
1599 * @param node [i] The FONT tag node is specified.
1600 * @return The conversion result is returned.
1603 s_chtml30_end_font_tag(void *pdoc, Node *node)
1609 chtml30 = GET_CHTML30(pdoc);
1613 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1614 if (flg && flg->with_font_flag) {
1617 if (IS_CSS_ON(chtml30->entryp)) {
1618 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1621 return chtml30->out;
1626 * It is a handler who processes the FORM tag.
1628 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1629 * destination is specified.
1630 * @param node [i] The FORM tag node is specified.
1631 * @return The conversion result is returned.
1634 s_chtml30_start_form_tag(void *pdoc, Node *node)
1640 char *attr_style = NULL;
1641 char *attr_color = NULL;
1642 char *attr_align = NULL;
1643 char *new_hidden_tag = NULL;
1644 char *attr_method = NULL;
1645 char *attr_action = NULL;
1646 char *attr_utn = NULL;
1648 chtml30 = GET_CHTML30(pdoc);
1652 /*--------------------------------------------------------------------------*/
1653 /* Get Attributes */
1654 /*--------------------------------------------------------------------------*/
1655 for (attr = qs_get_attr(doc,node);
1657 attr = qs_get_next_attr(doc,attr)) {
1658 char *name = qs_get_attr_name(doc,attr);
1659 char *value = qs_get_attr_value(doc,attr);
1663 if (strcasecmp(name, "action") == 0) {
1664 /*--------------------------------------------------------------------*/
1666 /*--------------------------------------------------------------------*/
1667 attr_action = value;
1673 if (strcasecmp(name, "method") == 0) {
1674 /*--------------------------------------------------------------------*/
1676 /*--------------------------------------------------------------------*/
1677 attr_method = value;
1683 if (strcasecmp(name, "utn") == 0) {
1684 /*--------------------------------------------------------------------*/
1686 /*--------------------------------------------------------------------*/
1693 if (strcasecmp(name, "style") == 0) {
1702 if (IS_CSS_ON(chtml30->entryp)) {
1703 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1705 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1706 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1707 css_property_t *cur;
1708 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1709 if (STRCASEEQ('l','L',"left", cur->value)) {
1710 attr_align = apr_pstrdup(doc->pool, "left");
1712 else if (STRCASEEQ('c','C',"center",cur->value)) {
1713 attr_align = apr_pstrdup(doc->pool, "center");
1715 else if (STRCASEEQ('r','R',"right",cur->value)) {
1716 attr_align = apr_pstrdup(doc->pool, "right");
1719 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1720 attr_color = apr_pstrdup(doc->pool, cur->value);
1725 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1729 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1730 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml30->cookie);
1732 char *new_query_string = NULL;
1733 q = strchr(attr_action, '?');
1735 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml30->entryp);
1736 if (new_hidden_tag || new_query_string) {
1742 if (new_query_string) {
1744 W_V(new_query_string);
1758 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1759 memset(flg, 0, sizeof(*flg));
1761 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1762 W_L("<font color=\"");
1765 flg->with_font_flag = 1;
1768 W_L("<div align=\"");
1771 flg->with_div_flag = 1;
1773 node->userData = flg;
1775 if (new_hidden_tag) {
1776 W_V(new_hidden_tag);
1778 return chtml30->out;
1783 * It is a handler who processes the FORM tag.
1785 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1786 * destination is specified.
1787 * @param node [i] The FORM tag node is specified.
1788 * @return The conversion result is returned.
1791 s_chtml30_end_form_tag(void *pdoc, Node *node)
1796 chtml30 = GET_CHTML30(pdoc);
1799 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1800 if (flg && flg->with_div_flag) {
1803 if (flg && flg->with_font_flag) {
1807 if (IS_CSS_ON(chtml30->entryp)) {
1808 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1811 return chtml30->out;
1816 * It is a handler who processes the INPUT tag.
1818 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1819 * destination is specified.
1820 * @param node [i] The INPUT tag node is specified.
1821 * @return The conversion result is returned.
1824 s_chtml30_start_input_tag(void *pdoc, Node *node)
1830 char *attr_accesskey = NULL;
1831 char *attr_max_length = NULL;
1832 char *attr_type = NULL;
1833 char *attr_name = NULL;
1834 char *attr_value = NULL;
1835 char *attr_istyle = NULL;
1836 char *attr_size = NULL;
1837 char *attr_checked = NULL;
1838 char *attr_style = NULL;
1840 chtml30 = GET_CHTML30(pdoc);
1844 /*--------------------------------------------------------------------------*/
1845 /* Get Attributes */
1846 /*--------------------------------------------------------------------------*/
1847 for (attr = qs_get_attr(doc,node);
1849 attr = qs_get_next_attr(doc,attr)) {
1850 char *name = qs_get_attr_name(doc,attr);
1851 char *value = qs_get_attr_value(doc,attr);
1852 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1853 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1854 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1855 STRCASEEQ('p','P',"password",tmp_type) ||
1856 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1857 STRCASEEQ('r','R',"radio", tmp_type) ||
1858 STRCASEEQ('h','H',"hidden", tmp_type) ||
1859 STRCASEEQ('s','S',"submit", tmp_type) ||
1860 STRCASEEQ('r','R',"reset", tmp_type))) {
1861 attr_type = tmp_type;
1864 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1867 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1870 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1871 attr_istyle = value;
1873 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1874 attr_max_length = value;
1876 else if (STRCASEEQ('c','C',"checked", name)) {
1877 attr_checked = value;
1879 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1880 attr_accesskey = value;
1882 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1885 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1890 if (IS_CSS_ON(chtml30->entryp)) {
1891 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
1893 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1894 css_property_t *cur;
1895 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1896 if (strcasestr(cur->value, "<ja:n>")) {
1899 else if (strcasestr(cur->value, "<ja:en>")) {
1902 else if (strcasestr(cur->value, "<ja:hk>")) {
1905 else if (strcasestr(cur->value, "<ja:h>")) {
1929 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1930 apr_size_t value_len = strlen(attr_value);
1931 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml30->entryp);
1935 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1938 if (attr_accesskey) {
1939 W_L(" accesskey=\"");
1940 W_V(attr_accesskey);
1944 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1950 /*--------------------------------------------------------------------------*/
1951 /* The figure is default for the password. */
1952 /*--------------------------------------------------------------------------*/
1953 if (attr_max_length) {
1954 if (chxj_chk_numeric(attr_max_length) != 0) {
1955 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1957 if (attr_istyle && *attr_istyle == '1') {
1958 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1962 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1971 return chtml30->out;
1976 * It is a handler who processes the INPUT tag.
1978 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1979 * destination is specified.
1980 * @param node [i] The INPUT tag node is specified.
1981 * @return The conversion result is returned.
1984 s_chtml30_end_input_tag(void *pdoc, Node *UNUSED(node))
1990 chtml30 = GET_CHTML30(pdoc);
1994 return chtml30->out;
1999 * It is a handler who processes the CENTER tag.
2001 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2002 * destination is specified.
2003 * @param node [i] The CENTER tag node is specified.
2004 * @return The conversion result is returned.
2007 s_chtml30_start_center_tag(void *pdoc, Node *node)
2012 char *attr_style = NULL;
2013 char *attr_color = NULL;
2015 chtml30 = GET_CHTML30(pdoc);
2018 for (attr = qs_get_attr(doc,node);
2020 attr = qs_get_next_attr(doc,attr)) {
2021 char *name = qs_get_attr_name(doc,attr);
2022 char *value = qs_get_attr_value(doc,attr);
2023 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2028 if (IS_CSS_ON(chtml30->entryp)) {
2029 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2031 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2032 css_property_t *cur;
2033 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2034 if (cur->value && *cur->value) {
2035 attr_color = apr_pstrdup(doc->pool, cur->value);
2042 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2043 memset(flg, 0, sizeof(*flg));
2045 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2046 W_L("<font color=\"");
2049 flg->with_font_flag = 1;
2051 node->userData = flg;
2053 return chtml30->out;
2058 * It is a handler who processes the CENTER tag.
2060 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2061 * destination is specified.
2062 * @param node [i] The CENTER tag node is specified.
2063 * @return The conversion result is returned.
2066 s_chtml30_end_center_tag(void *pdoc, Node *node)
2071 chtml30 = GET_CHTML30(pdoc);
2074 if (IS_CSS_ON(chtml30->entryp)) {
2075 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2077 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
2078 if (flg && flg->with_font_flag) {
2083 return chtml30->out;
2088 * It is a handler who processes the HR tag.
2090 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2091 * destination is specified.
2092 * @param node [i] The HR tag node is specified.
2093 * @return The conversion result is returned.
2096 s_chtml30_start_hr_tag(void *pdoc, Node *node)
2102 char *attr_align = NULL;
2103 char *attr_size = NULL;
2104 char *attr_width = NULL;
2105 char *attr_noshade = NULL;
2106 char *attr_style = NULL;
2108 chtml30 = GET_CHTML30(pdoc);
2112 for (attr = qs_get_attr(doc,node);
2114 attr = qs_get_next_attr(doc,attr)) {
2115 char *name = qs_get_attr_name (doc,attr);
2116 char *value = qs_get_attr_value(doc,attr);
2120 if (strcasecmp(name, "align") == 0) {
2121 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2124 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2132 if (strcasecmp(name, "size") == 0) {
2133 /*--------------------------------------------------------------------*/
2135 /*--------------------------------------------------------------------*/
2136 if (value && *value) {
2140 else if (strcasecmp(name, "style") == 0) {
2141 if (value && *value) {
2149 if (strcasecmp(name, "width") == 0) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2153 if (value && *value) {
2161 if (strcasecmp(name, "noshade") == 0) {
2162 /*--------------------------------------------------------------------*/
2164 /*--------------------------------------------------------------------*/
2165 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2171 if (strcasecmp(name, "color") == 0) {
2172 /*--------------------------------------------------------------------*/
2174 /*--------------------------------------------------------------------*/
2183 if (IS_CSS_ON(chtml30->entryp)) {
2184 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2186 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2187 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2188 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2189 css_property_t *cur;
2190 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2191 if (STRCASEEQ('s','S',"solid",cur->value)) {
2192 attr_noshade = "noshade";
2195 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2196 char *tmp = apr_pstrdup(doc->pool, cur->value);
2197 char *tmpp = strstr(tmp, "px");
2200 attr_size = apr_pstrdup(doc->pool, tmp);
2203 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2204 char *tmp = apr_pstrdup(doc->pool, cur->value);
2205 char *tmpp = strstr(tmp, "px");
2208 attr_width = apr_pstrdup(doc->pool, tmp);
2211 tmpp = strstr(tmp, "%");
2213 attr_width = apr_pstrdup(doc->pool, tmp);
2239 return chtml30->out;
2244 * It is a handler who processes the HR tag.
2246 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2247 * destination is specified.
2248 * @param node [i] The HR tag node is specified.
2249 * @return The conversion result is returned.
2252 s_chtml30_end_hr_tag(void *pdoc, Node *UNUSED(child))
2254 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2255 return chtml30->out;
2260 * It is a handler who processes the IMG tag.
2262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2263 * destination is specified.
2264 * @param node [i] The IMG tag node is specified.
2265 * @return The conversion result is returned.
2268 s_chtml30_start_img_tag(void *pdoc, Node *node)
2274 char *attr_src = NULL;
2275 char *attr_align = NULL;
2276 char *attr_style = NULL;
2277 char *attr_alt = NULL;
2278 char *attr_width = NULL;
2279 char *attr_height = NULL;
2280 char *attr_hspace = NULL;
2281 char *attr_vspace = NULL;
2282 #ifndef IMG_NOT_CONVERT_FILENAME
2286 chtml30 = GET_CHTML30(pdoc);
2287 #ifndef IMG_NOT_CONVERT_FILENAME
2288 spec = chtml30->spec;
2293 /*--------------------------------------------------------------------------*/
2294 /* Get Attributes */
2295 /*--------------------------------------------------------------------------*/
2296 for (attr = qs_get_attr(doc,node);
2298 attr = qs_get_next_attr(doc,attr)) {
2299 char *name = qs_get_attr_name (doc,attr);
2300 char *value = qs_get_attr_value(doc,attr);
2304 if (strcasecmp(name, "src") == 0) {
2305 /*--------------------------------------------------------------------*/
2307 /*--------------------------------------------------------------------*/
2308 #ifdef IMG_NOT_CONVERT_FILENAME
2309 value = chxj_encoding_parameter(r, value, 0);
2310 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2311 value = chxj_add_cookie_no_update_parameter(r, value, 0);
2312 value = chxj_img_rewrite_parameter(r,chtml30->conf,value);
2315 value = chxj_img_conv(r,spec,value);
2316 value = chxj_encoding_parameter(r, value, 0);
2317 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2318 value = chxj_add_cookie_no_update_parameter(r, value, 0);
2319 value = chxj_img_rewrite_parameter(r,chtml30->conf,value);
2323 else if (strcasecmp(name,"style") == 0 && value && *value) {
2330 if (strcasecmp(name, "align" ) == 0) {
2331 /*--------------------------------------------------------------------*/
2333 /*--------------------------------------------------------------------*/
2334 /*--------------------------------------------------------------------*/
2336 /*--------------------------------------------------------------------*/
2338 if (STRCASEEQ('t','T',"top", value) ||
2339 STRCASEEQ('m','M',"middle",value) ||
2340 STRCASEEQ('b','B',"bottom",value) ||
2341 STRCASEEQ('l','L',"left", value) ||
2342 STRCASEEQ('r','R',"right", value)) {
2345 else if (STRCASEEQ('c','C',"center", value)) {
2346 attr_align = apr_pstrdup(doc->pool, "middle");
2350 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2351 /*--------------------------------------------------------------------*/
2353 /*--------------------------------------------------------------------*/
2360 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2361 /*--------------------------------------------------------------------*/
2363 /*--------------------------------------------------------------------*/
2370 if (strcasecmp(name, "height") == 0 && value && *value) {
2371 /*--------------------------------------------------------------------*/
2373 /*--------------------------------------------------------------------*/
2374 attr_height = value;
2377 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2378 /*--------------------------------------------------------------------*/
2380 /*--------------------------------------------------------------------*/
2381 attr_hspace = value;
2387 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2388 /*--------------------------------------------------------------------*/
2390 /*--------------------------------------------------------------------*/
2391 attr_vspace = value;
2400 if (IS_CSS_ON(chtml30->entryp)) {
2401 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2403 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2404 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2405 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2406 css_property_t *cur;
2407 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2408 attr_height = apr_pstrdup(doc->pool, cur->value);
2410 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2411 attr_width = apr_pstrdup(doc->pool, cur->value);
2413 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2414 attr_align = apr_pstrdup(doc->pool, cur->value);
2456 return chtml30->out;
2461 * It is a handler who processes the IMG tag.
2463 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2464 * destination is specified.
2465 * @param node [i] The IMG tag node is specified.
2466 * @return The conversion result is returned.
2469 s_chtml30_end_img_tag(void *pdoc, Node *UNUSED(child))
2471 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2473 return chtml30->out;
2478 * It is a handler who processes the SELECT tag.
2480 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2481 * destination is specified.
2482 * @param node [i] The SELECT tag node is specified.
2483 * @return The conversion result is returned.
2486 s_chtml30_start_select_tag(void *pdoc, Node *node)
2488 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2489 Doc *doc = chtml30->doc;
2492 char *multiple = NULL;
2494 char *attr_style = NULL;
2497 for (attr = qs_get_attr(doc,node);
2499 attr = qs_get_next_attr(doc,attr)) {
2500 char *nm = qs_get_attr_name(doc,attr);
2501 char *val = qs_get_attr_value(doc,attr);
2502 if (STRCASEEQ('s','S',"size", nm)) {
2503 /*----------------------------------------------------------------------*/
2504 /* CHTML 1.0 version 2.0 */
2505 /*----------------------------------------------------------------------*/
2506 size = apr_pstrdup(doc->buf.pool, val);
2508 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2509 /*----------------------------------------------------------------------*/
2510 /* CHTML 1.0 version 2.0 */
2511 /*----------------------------------------------------------------------*/
2512 attr_style = apr_pstrdup(doc->buf.pool, val);
2514 else if (STRCASEEQ('n','N',"name", nm)) {
2515 /*----------------------------------------------------------------------*/
2516 /* CHTML 1.0 version 2.0 */
2517 /*----------------------------------------------------------------------*/
2518 name = apr_pstrdup(doc->buf.pool, val);
2520 else if (STRCASEEQ('m','M',"multiple", nm)) {
2521 /*----------------------------------------------------------------------*/
2522 /* CHTML 1.0 version 2.0 */
2523 /*----------------------------------------------------------------------*/
2524 multiple = apr_pstrdup(doc->buf.pool, val);
2527 if (size && *size) {
2532 if (name && *name) {
2541 if (IS_CSS_ON(chtml30->entryp)) {
2542 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2544 return chtml30->out;
2549 * It is a handler who processes the SELECT tag.
2551 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2552 * destination is specified.
2553 * @param node [i] The SELECT tag node is specified.
2554 * @return The conversion result is returned.
2557 s_chtml30_end_select_tag(void *pdoc, Node *UNUSED(child))
2559 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2560 Doc *doc = chtml30->doc;
2563 if (IS_CSS_ON(chtml30->entryp)) {
2564 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2567 return chtml30->out;
2572 * It is a handler who processes the OPTION tag.
2574 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2575 * destination is specified.
2576 * @param node [i] The OPTION tag node is specified.
2577 * @return The conversion result is returned.
2580 s_chtml30_start_option_tag(void *pdoc, Node *node)
2588 char *attr_style = NULL;
2590 chtml30 = GET_CHTML30(pdoc);
2597 for (attr = qs_get_attr(doc,node);
2599 attr = qs_get_next_attr(doc,attr)) {
2600 char *nm = qs_get_attr_name(doc,attr);
2601 char *val = qs_get_attr_value(doc,attr);
2602 if (STRCASEEQ('s','S',"selected", nm)) {
2603 /*----------------------------------------------------------------------*/
2604 /* CHTML 1.0 version 2.0 */
2605 /*----------------------------------------------------------------------*/
2606 selected = apr_pstrdup(doc->buf.pool, val);
2608 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2609 /*----------------------------------------------------------------------*/
2610 /* CHTML 1.0 version 2.0 */
2611 /*----------------------------------------------------------------------*/
2612 attr_style = apr_pstrdup(doc->buf.pool, val);
2614 else if (STRCASEEQ('v','V',"value", nm)) {
2615 /*----------------------------------------------------------------------*/
2616 /* CHTML 1.0 version 2.0 */
2617 /*----------------------------------------------------------------------*/
2618 value = apr_pstrdup(doc->buf.pool, val);
2630 if (IS_CSS_ON(chtml30->entryp)) {
2631 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2633 return chtml30->out;
2638 * It is a handler who processes the OPTION tag.
2640 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2641 * destination is specified.
2642 * @param node [i] The OPTION tag node is specified.
2643 * @return The conversion result is returned.
2646 s_chtml30_end_option_tag(void *pdoc, Node *UNUSED(child))
2648 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2651 if (IS_CSS_ON(chtml30->entryp)) {
2652 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2655 return chtml30->out;
2660 * It is a handler who processes the DIV tag.
2662 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2663 * destination is specified.
2664 * @param node [i] The DIV tag node is specified.
2665 * @return The conversion result is returned.
2668 s_chtml30_start_div_tag(void *pdoc, Node *node)
2674 char *attr_style = NULL;
2675 char *attr_align = NULL;
2676 char *attr_display = NULL;
2677 char *attr_decoration = NULL;
2678 char *attr_wap_marquee_style = NULL;
2679 char *attr_wap_marquee_dir = NULL;
2680 char *attr_wap_marquee_loop = NULL;
2681 char *attr_color = NULL;
2682 char *attr_bgcolor = NULL;
2684 chtml30 = GET_CHTML30(pdoc);
2688 for (attr = qs_get_attr(doc,node);
2690 attr = qs_get_next_attr(doc,attr)) {
2691 char *nm = qs_get_attr_name(doc,attr);
2692 char *val = qs_get_attr_value(doc,attr);
2693 if (STRCASEEQ('a','A', "align", nm)) {
2694 /*----------------------------------------------------------------------*/
2695 /* CHTML 1.0 (W3C version 3.2) */
2696 /*----------------------------------------------------------------------*/
2697 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2698 attr_align = apr_pstrdup(doc->buf.pool, val);
2701 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2702 attr_style = apr_pstrdup(doc->buf.pool, val);
2706 if (IS_CSS_ON(chtml30->entryp)) {
2707 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2709 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2710 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2711 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2712 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2713 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2714 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2716 css_property_t *cur;
2717 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2718 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2719 attr_display = apr_pstrdup(doc->pool, cur->value);
2722 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2723 if (STRCASEEQ('b','B',"blink", cur->value)) {
2724 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2727 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2728 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2729 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2731 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2732 char *ss = strchr(cur->value, '#');
2734 ss = strstr(cur->value, "rgb");
2737 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2738 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2741 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2742 attr_color = apr_pstrdup(doc->pool, cur->value);
2743 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2745 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2746 attr_align = apr_pstrdup(doc->pool, cur->value);
2749 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2750 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2751 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2752 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2753 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2754 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2757 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2758 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2759 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2761 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2762 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2765 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2766 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2767 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2770 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2776 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2777 memset(flg, 0, sizeof(*flg));
2784 flg->with_div_flag = 1;
2788 flg->with_div_flag = 1;
2791 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2795 W_L("<font color=\"");
2798 flg->with_font_flag = 1;
2801 if (attr_decoration) {
2803 flg->with_blink_flag = 1;
2807 if (attr_wap_marquee_style) {
2808 W_L(" behavior=\"");
2809 W_V(attr_wap_marquee_style);
2812 if (attr_wap_marquee_dir) {
2813 W_L(" direction=\"");
2814 W_V(attr_wap_marquee_dir);
2817 if (attr_wap_marquee_loop) {
2819 W_V(attr_wap_marquee_loop);
2823 flg->with_marquee_flag = 1;
2825 node->userData = flg;
2827 return chtml30->out;
2832 * It is a handler who processes the DIV tag.
2834 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2835 * destination is specified.
2836 * @param node [i] The DIV tag node is specified.
2837 * @return The conversion result is returned.
2840 s_chtml30_end_div_tag(void *pdoc, Node *node)
2842 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2843 Doc *doc = chtml30->doc;
2845 chtml30_flags_t *flg = node->userData;
2846 if (flg && flg->with_marquee_flag) {
2849 if (flg && flg->with_blink_flag) {
2852 if (flg && flg->with_font_flag) {
2855 if (flg && flg->with_div_flag) {
2858 if (IS_CSS_ON(chtml30->entryp)) {
2859 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2861 node->userData = NULL;
2863 return chtml30->out;
2868 * It is a handler who processes the UL tag.
2870 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2871 * destination is specified.
2872 * @param node [i] The UL tag node is specified.
2873 * @return The conversion result is returned.
2876 s_chtml30_start_ul_tag(void *pdoc, Node *node)
2878 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2879 Doc *doc = chtml30->doc;
2881 char *attr_style = NULL;
2883 for (attr = qs_get_attr(doc,node);
2885 attr = qs_get_next_attr(doc,attr)) {
2886 char *nm = qs_get_attr_name(doc,attr);
2887 char *val = qs_get_attr_value(doc,attr);
2888 if (val && STRCASEEQ('s','S',"style", nm)) {
2893 if (IS_CSS_ON(chtml30->entryp)) {
2894 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2899 return chtml30->out;
2904 * It is a handler who processes the UL tag.
2906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2907 * destination is specified.
2908 * @param node [i] The UL tag node is specified.
2909 * @return The conversion result is returned.
2912 s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
2914 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2915 Doc *doc = chtml30->doc;
2917 if (IS_CSS_ON(chtml30->entryp)) {
2918 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2922 return chtml30->out;
2927 * It is a handler who processes the PRE tag.
2929 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2930 * destination is specified.
2931 * @param node [i] The PRE tag node is specified.
2932 * @return The conversion result is returned.
2935 s_chtml30_start_pre_tag(void *pdoc, Node *node)
2937 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2938 Doc *doc = chtml30->doc;
2940 char *attr_style = NULL;
2942 for (attr = qs_get_attr(doc,node);
2944 attr = qs_get_next_attr(doc,attr)) {
2945 char *nm = qs_get_attr_name(doc,attr);
2946 char *val = qs_get_attr_value(doc,attr);
2947 if (val && STRCASEEQ('s','S',"style", nm)) {
2952 if (IS_CSS_ON(chtml30->entryp)) {
2953 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2956 chtml30->pre_flag++;
2959 return chtml30->out;
2964 * It is a handler who processes the PRE tag.
2966 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2967 * destination is specified.
2968 * @param node [i] The PRE tag node is specified.
2969 * @return The conversion result is returned.
2972 s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
2974 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2975 Doc *doc = chtml30->doc;
2978 chtml30->pre_flag--;
2979 if (IS_CSS_ON(chtml30->entryp)) {
2980 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2983 return chtml30->out;
2988 * It is a handler who processes the P tag.
2990 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2991 * destination is specified.
2992 * @param node [i] The P tag node is specified.
2993 * @return The conversion result is returned.
2996 s_chtml30_start_p_tag(void *pdoc, Node *node)
3002 char *attr_align = NULL;
3003 char *attr_style = NULL;
3004 char *attr_color = NULL;
3005 char *attr_blink = NULL;
3007 chtml30 = GET_CHTML30(pdoc);
3011 for (attr = qs_get_attr(doc,node);
3013 attr = qs_get_next_attr(doc,attr)) {
3014 char *nm = qs_get_attr_name(doc,attr);
3015 char *val = qs_get_attr_value(doc,attr);
3016 if (STRCASEEQ('a','A',"align", nm)) {
3017 /*----------------------------------------------------------------------*/
3018 /* CHTML 1.0 (W3C version 3.2) */
3019 /*----------------------------------------------------------------------*/
3020 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3021 attr_align = apr_pstrdup(doc->buf.pool, val);
3025 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3026 attr_style = apr_pstrdup(doc->buf.pool, val);
3029 if (IS_CSS_ON(chtml30->entryp)) {
3030 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3032 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3033 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3034 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3035 css_property_t *cur;
3036 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3037 if (STRCASEEQ('l','L',"left",cur->value)) {
3038 attr_align = apr_pstrdup(doc->pool, "left");
3040 else if (STRCASEEQ('c','C',"center",cur->value)) {
3041 attr_align = apr_pstrdup(doc->pool, "center");
3043 else if (STRCASEEQ('r','R',"right",cur->value)) {
3044 attr_align = apr_pstrdup(doc->pool, "right");
3047 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3048 if (cur->value && *cur->value) {
3049 attr_color = apr_pstrdup(doc->pool, cur->value);
3052 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3053 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3054 attr_blink = apr_pstrdup(doc->pool, cur->value);
3067 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
3068 memset(flg, 0, sizeof(*flg));
3070 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3071 W_L("<font color=\"");
3074 flg->with_font_flag = 1;
3078 flg->with_blink_flag = 1;
3080 node->userData = (void *)flg;
3082 return chtml30->out;
3087 * It is a handler who processes the P tag.
3089 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3090 * destination is specified.
3091 * @param node [i] The P tag node is specified.
3092 * @return The conversion result is returned.
3095 s_chtml30_end_p_tag(void *pdoc, Node *node)
3100 chtml30 = GET_CHTML30(pdoc);
3103 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
3104 if (flg->with_font_flag) {
3107 if (flg->with_blink_flag) {
3111 if (IS_CSS_ON(chtml30->entryp)) {
3112 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3115 return chtml30->out;
3120 * It is a handler who processes the OL tag.
3122 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3123 * destination is specified.
3124 * @param node [i] The OL tag node is specified.
3125 * @return The conversion result is returned.
3128 s_chtml30_start_ol_tag(void *pdoc, Node *node)
3134 char *attr_style = NULL;
3135 char *attr_start = NULL;
3136 char *attr_type = NULL;
3138 chtml30 = GET_CHTML30(pdoc);
3142 /*--------------------------------------------------------------------------*/
3143 /* Get Attributes */
3144 /*--------------------------------------------------------------------------*/
3145 for (attr = qs_get_attr(doc,node);
3147 attr = qs_get_next_attr(doc,attr)) {
3148 char *name = qs_get_attr_name(doc,attr);
3149 char *value = qs_get_attr_value(doc,attr);
3150 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3153 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3156 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3160 if (IS_CSS_ON(chtml30->entryp)) {
3161 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3163 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3164 css_property_t *cur;
3165 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3166 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3167 attr_type = apr_pstrdup(doc->pool, "1");
3169 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3170 attr_type = apr_pstrdup(doc->pool, "A");
3172 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3173 attr_type = apr_pstrdup(doc->pool, "a");
3191 return chtml30->out;
3196 * It is a handler who processes the OL tag.
3198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3199 * destination is specified.
3200 * @param node [i] The OL tag node is specified.
3201 * @return The conversion result is returned.
3204 s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
3206 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3207 Doc *doc = chtml30->doc;
3210 if (IS_CSS_ON(chtml30->entryp)) {
3211 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3214 return chtml30->out;
3219 * It is a handler who processes the LI tag.
3221 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3222 * destination is specified.
3223 * @param node [i] The LI tag node is specified.
3224 * @return The conversion result is returned.
3227 s_chtml30_start_li_tag(void *pdoc, Node *node)
3229 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3230 Doc *doc = chtml30->doc;
3232 char *attr_type = NULL;
3233 char *attr_value = NULL;
3234 char *attr_style = NULL;
3235 /*--------------------------------------------------------------------------*/
3236 /* Get Attributes */
3237 /*--------------------------------------------------------------------------*/
3238 for (attr = qs_get_attr(doc,node);
3240 attr = qs_get_next_attr(doc,attr)) {
3241 char *name = qs_get_attr_name(doc,attr);
3242 char *value = qs_get_attr_value(doc,attr);
3243 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3246 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3249 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3253 if (IS_CSS_ON(chtml30->entryp)) {
3254 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3256 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3257 css_property_t *cur;
3258 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3259 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3260 attr_type = apr_pstrdup(doc->pool, "1");
3262 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3263 attr_type = apr_pstrdup(doc->pool, "A");
3265 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3266 attr_type = apr_pstrdup(doc->pool, "a");
3284 return chtml30->out;
3289 * It is a handler who processes the LI tag.
3291 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3292 * destination is specified.
3293 * @param node [i] The LI tag node is specified.
3294 * @return The conversion result is returned.
3297 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
3299 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3301 if (IS_CSS_ON(chtml30->entryp)) {
3302 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3304 return chtml30->out;
3309 * It is a handler who processes the H1 tag.
3311 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3312 * destination is specified.
3313 * @param node [i] The H1 tag node is specified.
3314 * @return The conversion result is returned.
3317 s_chtml30_start_h1_tag(void *pdoc, Node *node)
3323 char *attr_style = NULL;
3324 char *attr_align = NULL;
3327 chtml30 = GET_CHTML30(pdoc);
3331 for (attr = qs_get_attr(doc,node);
3333 attr = qs_get_next_attr(doc,attr)) {
3334 char *name = qs_get_attr_name(doc,attr);
3335 char *value = qs_get_attr_value(doc,attr);
3336 if (STRCASEEQ('a','A',"align", name)) {
3337 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3341 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3345 if (IS_CSS_ON(chtml30->entryp)) {
3346 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3348 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3349 css_property_t *cur;
3350 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3351 if (STRCASEEQ('l','L',"left", cur->value)) {
3352 attr_align = apr_pstrdup(doc->pool, "left");
3354 else if (STRCASEEQ('c','C',"center",cur->value)) {
3355 attr_align = apr_pstrdup(doc->pool, "center");
3357 else if (STRCASEEQ('r','R',"right",cur->value)) {
3358 attr_align = apr_pstrdup(doc->pool, "right");
3371 return chtml30->out;
3376 * It is a handler who processes the H1 tag.
3378 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3379 * destination is specified.
3380 * @param node [i] The H1 tag node is specified.
3381 * @return The conversion result is returned.
3384 s_chtml30_end_h1_tag(void *pdoc, Node *UNUSED(child))
3389 chtml30 = GET_CHTML30(pdoc);
3393 if (IS_CSS_ON(chtml30->entryp)) {
3394 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3397 return chtml30->out;
3402 * It is a handler who processes the H2 tag.
3404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3405 * destination is specified.
3406 * @param node [i] The H2 tag node is specified.
3407 * @return The conversion result is returned.
3410 s_chtml30_start_h2_tag(void *pdoc, Node *node)
3416 char *attr_style = NULL;
3417 char *attr_align = NULL;
3419 chtml30 = GET_CHTML30(pdoc);
3423 for (attr = qs_get_attr(doc,node);
3425 attr = qs_get_next_attr(doc,attr)) {
3426 char *name = qs_get_attr_name(doc,attr);
3427 char *value = qs_get_attr_value(doc,attr);
3428 if (STRCASEEQ('a','A',"align", name)) {
3429 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3433 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3437 if (IS_CSS_ON(chtml30->entryp)) {
3438 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3440 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3441 css_property_t *cur;
3442 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3443 if (STRCASEEQ('l','L',"left", cur->value)) {
3444 attr_align = apr_pstrdup(doc->pool, "left");
3446 else if (STRCASEEQ('c','C',"center",cur->value)) {
3447 attr_align = apr_pstrdup(doc->pool, "center");
3449 else if (STRCASEEQ('r','R',"right",cur->value)) {
3450 attr_align = apr_pstrdup(doc->pool, "right");
3463 return chtml30->out;
3468 * It is a handler who processes the H2 tag.
3470 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3471 * destination is specified.
3472 * @param node [i] The H2 tag node is specified.
3473 * @return The conversion result is returned.
3476 s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child))
3478 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3479 Doc *doc = chtml30->doc;
3482 if (IS_CSS_ON(chtml30->entryp)) {
3483 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3486 return chtml30->out;
3491 * It is a handler who processes the H3 tag.
3493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3494 * destination is specified.
3495 * @param node [i] The H3 tag node is specified.
3496 * @return The conversion result is returned.
3499 s_chtml30_start_h3_tag(void *pdoc, Node *node)
3505 char *attr_style = NULL;
3506 char *attr_align = NULL;
3508 chtml30 = GET_CHTML30(pdoc);
3512 for (attr = qs_get_attr(doc,node);
3514 attr = qs_get_next_attr(doc,attr)) {
3515 char *name = qs_get_attr_name(doc,attr);
3516 char *value = qs_get_attr_value(doc,attr);
3517 if (STRCASEEQ('a','A',"align", name)) {
3518 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3522 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3526 if (IS_CSS_ON(chtml30->entryp)) {
3527 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3529 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3530 css_property_t *cur;
3531 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3532 if (STRCASEEQ('l','L',"left", cur->value)) {
3533 attr_align = apr_pstrdup(doc->pool, "left");
3535 else if (STRCASEEQ('c','C',"center",cur->value)) {
3536 attr_align = apr_pstrdup(doc->pool, "center");
3538 else if (STRCASEEQ('r','R',"right",cur->value)) {
3539 attr_align = apr_pstrdup(doc->pool, "right");
3552 return chtml30->out;
3557 * It is a handler who processes the H3 tag.
3559 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3560 * destination is specified.
3561 * @param node [i] The H3 tag node is specified.
3562 * @return The conversion result is returned.
3565 s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
3567 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3568 Doc *doc = chtml30->doc;
3571 if (IS_CSS_ON(chtml30->entryp)) {
3572 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3575 return chtml30->out;
3580 * It is a handler who processes the H4 tag.
3582 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3583 * destination is specified.
3584 * @param node [i] The H4 tag node is specified.
3585 * @return The conversion result is returned.
3588 s_chtml30_start_h4_tag(void *pdoc, Node *node)
3594 char *attr_style = NULL;
3595 char *attr_align = NULL;
3597 chtml30 = GET_CHTML30(pdoc);
3601 for (attr = qs_get_attr(doc,node);
3603 attr = qs_get_next_attr(doc,attr)) {
3604 char *name = qs_get_attr_name(doc,attr);
3605 char *value = qs_get_attr_value(doc,attr);
3606 if (STRCASEEQ('a','A',"align", name)) {
3607 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3611 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3615 if (IS_CSS_ON(chtml30->entryp)) {
3616 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3618 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3619 css_property_t *cur;
3620 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3621 if (STRCASEEQ('l','L',"left", cur->value)) {
3622 attr_align = apr_pstrdup(doc->pool, "left");
3624 else if (STRCASEEQ('c','C',"center",cur->value)) {
3625 attr_align = apr_pstrdup(doc->pool, "center");
3627 else if (STRCASEEQ('r','R',"right",cur->value)) {
3628 attr_align = apr_pstrdup(doc->pool, "right");
3641 return chtml30->out;
3646 * It is a handler who processes the H4 tag.
3648 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3649 * destination is specified.
3650 * @param node [i] The H4 tag node is specified.
3651 * @return The conversion result is returned.
3654 s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child))
3656 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3657 Doc *doc = chtml30->doc;
3660 if (IS_CSS_ON(chtml30->entryp)) {
3661 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3664 return chtml30->out;
3669 * It is a handler who processes the H5 tag.
3671 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3672 * destination is specified.
3673 * @param node [i] The H5 tag node is specified.
3674 * @return The conversion result is returned.
3677 s_chtml30_start_h5_tag(void *pdoc, Node *node)
3683 char *attr_style = NULL;
3684 char *attr_align = NULL;
3686 chtml30 = GET_CHTML30(pdoc);
3690 for (attr = qs_get_attr(doc,node);
3692 attr = qs_get_next_attr(doc,attr)) {
3693 char *name = qs_get_attr_name(doc,attr);
3694 char *value = qs_get_attr_value(doc,attr);
3695 if (STRCASEEQ('a','A',"align", name)) {
3696 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3700 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3704 if (IS_CSS_ON(chtml30->entryp)) {
3705 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3707 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3708 css_property_t *cur;
3709 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3710 if (STRCASEEQ('l','L',"left", cur->value)) {
3711 attr_align = apr_pstrdup(doc->pool, "left");
3713 else if (STRCASEEQ('c','C',"center",cur->value)) {
3714 attr_align = apr_pstrdup(doc->pool, "center");
3716 else if (STRCASEEQ('r','R',"right",cur->value)) {
3717 attr_align = apr_pstrdup(doc->pool, "right");
3730 return chtml30->out;
3735 * It is a handler who processes the H5 tag.
3737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3738 * destination is specified.
3739 * @param node [i] The H5 tag node is specified.
3740 * @return The conversion result is returned.
3743 s_chtml30_end_h5_tag(void *pdoc, Node *UNUSED(child))
3745 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3746 Doc *doc = chtml30->doc;
3749 if (IS_CSS_ON(chtml30->entryp)) {
3750 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3753 return chtml30->out;
3758 * It is a handler who processes the H6 tag.
3760 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3761 * destination is specified.
3762 * @param node [i] The H6 tag node is specified.
3763 * @return The conversion result is returned.
3766 s_chtml30_start_h6_tag(void *pdoc, Node *node)
3772 char *attr_style = NULL;
3773 char *attr_align = NULL;
3775 chtml30 = GET_CHTML30(pdoc);
3779 for (attr = qs_get_attr(doc,node);
3781 attr = qs_get_next_attr(doc,attr)) {
3782 char *name = qs_get_attr_name(doc,attr);
3783 char *value = qs_get_attr_value(doc,attr);
3784 if (STRCASEEQ('a','A',"align", name)) {
3785 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3789 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3793 if (IS_CSS_ON(chtml30->entryp)) {
3794 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3796 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3797 css_property_t *cur;
3798 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3799 if (STRCASEEQ('l','L',"left", cur->value)) {
3800 attr_align = apr_pstrdup(doc->pool, "left");
3802 else if (STRCASEEQ('c','C',"center",cur->value)) {
3803 attr_align = apr_pstrdup(doc->pool, "center");
3805 else if (STRCASEEQ('r','R',"right",cur->value)) {
3806 attr_align = apr_pstrdup(doc->pool, "right");
3819 return chtml30->out;
3824 * It is a handler who processes the H6 tag.
3826 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3827 * destination is specified.
3828 * @param node [i] The H6 tag node is specified.
3829 * @return The conversion result is returned.
3832 s_chtml30_end_h6_tag(void *pdoc, Node *UNUSED(child))
3834 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3835 Doc *doc = chtml30->doc;
3838 if (IS_CSS_ON(chtml30->entryp)) {
3839 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3842 return chtml30->out;
3847 * It is a handler who processes the TEXTARE tag.
3849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3850 * destination is specified.
3851 * @param node [i] The TEXTAREA tag node is specified.
3852 * @return The conversion result is returned.
3855 s_chtml30_start_textarea_tag(void *pdoc, Node *node)
3861 char *attr_accesskey = NULL;
3862 char *attr_name = NULL;
3863 char *attr_rows = NULL;
3864 char *attr_cols = NULL;
3865 char *attr_istyle = NULL;
3866 char *attr_style = NULL;
3868 chtml30 = GET_CHTML30(pdoc);
3872 chtml30->textarea_flag++;
3874 for (attr = qs_get_attr(doc,node);
3876 attr = qs_get_next_attr(doc,attr)) {
3877 char *name = qs_get_attr_name(doc,attr);
3878 char *value = qs_get_attr_value(doc,attr);
3879 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3880 attr_accesskey = value;
3882 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3883 attr_istyle = value;
3885 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3888 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3891 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3894 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3899 if (IS_CSS_ON(chtml30->entryp)) {
3900 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
3902 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3903 css_property_t *cur;
3904 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3905 if (strcasestr(cur->value, "<ja:n>")) {
3908 else if (strcasestr(cur->value, "<ja:en>")) {
3911 else if (strcasestr(cur->value, "<ja:hk>")) {
3914 else if (strcasestr(cur->value, "<ja:h>")) {
3922 if (attr_accesskey) {
3923 W_L(" accesskey=\"");
3924 W_V(attr_accesskey);
3948 return chtml30->out;
3953 * It is a handler who processes the TEXTAREA tag.
3955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3956 * destination is specified.
3957 * @param node [i] The TEXTAREA tag node is specified.
3958 * @return The conversion result is returned.
3961 s_chtml30_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3963 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3964 Doc *doc = chtml30->doc;
3967 chtml30->textarea_flag--;
3969 return chtml30->out;
3974 s_chtml30_chxjif_tag(void *pdoc, Node *node)
3981 chtml30 = GET_CHTML30(pdoc);
3985 for (child = qs_get_child_node(doc, node);
3987 child = qs_get_next_node(doc, child)) {
3989 s_chtml30_chxjif_tag(chtml30, child);
3997 s_chtml30_text_tag(void *pdoc, Node *child)
4009 apr_size_t z2h_input_len;
4011 chtml30 = GET_CHTML30(pdoc);
4015 textval = qs_get_node_value(doc,child);
4016 if (strlen(textval) == 0) {
4017 return chtml30->out;
4020 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4021 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4023 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4024 memset(one_byte, 0, sizeof(one_byte));
4027 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4029 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out, child);
4031 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4036 if (is_sjis_kanji(textval[ii])) {
4037 one_byte[0] = textval[ii+0];
4038 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4039 one_byte[0] = textval[ii+1];
4040 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4043 else if (chtml30->pre_flag) {
4044 one_byte[0] = textval[ii+0];
4045 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4047 else if (chtml30->textarea_flag) {
4048 one_byte[0] = textval[ii+0];
4049 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4051 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4052 one_byte[0] = textval[ii+0];
4053 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4056 z2h_input_len = strlen(tdst);
4057 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml30->entryp);
4060 return chtml30->out;
4065 * It is a handler who processes the BLOCKQUOTE tag.
4067 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4068 * destination is specified.
4069 * @param node [i] The BLOCKQUOTE tag node is specified.
4070 * @return The conversion result is returned.
4073 s_chtml30_start_blockquote_tag(void *pdoc, Node *node)
4078 char *attr_style = NULL;
4079 char *attr_color = NULL;
4081 chtml30 = GET_CHTML30(pdoc);
4083 for (attr = qs_get_attr(doc,node);
4085 attr = qs_get_next_attr(doc,attr)) {
4086 char *nm = qs_get_attr_name(doc,attr);
4087 char *val = qs_get_attr_value(doc,attr);
4088 if (val && STRCASEEQ('s','S',"style", nm)) {
4092 if (IS_CSS_ON(chtml30->entryp)) {
4093 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4095 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4096 css_property_t *cur;
4097 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4098 if (cur->value && *cur->value) {
4099 attr_color = apr_pstrdup(doc->pool, cur->value);
4104 W_L("<blockquote>");
4105 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4106 memset(flg, 0, sizeof(*flg));
4108 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4109 W_L("<font color=\"");
4112 flg->with_font_flag = 1;
4114 node->userData = (void *)flg;
4115 return chtml30->out;
4120 * It is a handler who processes the BLOCKQUOTE tag.
4122 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4123 * destination is specified.
4124 * @param node [i] The BLOCKQUOTE tag node is specified.
4125 * @return The conversion result is returned.
4128 s_chtml30_end_blockquote_tag(void *pdoc, Node *node)
4130 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4131 Doc *doc = chtml30->doc;
4132 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4133 if (flg && flg->with_font_flag) {
4136 W_L("</blockquote>");
4137 if (IS_CSS_ON(chtml30->entryp)) {
4138 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4140 return chtml30->out;
4145 * It is a handler who processes the DIR tag.
4147 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4148 * destination is specified.
4149 * @param node [i] The DIR tag node is specified.
4150 * @return The conversion result is returned.
4153 s_chtml30_start_dir_tag(void *pdoc, Node *node)
4158 char *attr_style = NULL;
4159 char *attr_color = NULL;
4161 chtml30 = GET_CHTML30(pdoc);
4163 for (attr = qs_get_attr(doc,node);
4165 attr = qs_get_next_attr(doc,attr)) {
4166 char *nm = qs_get_attr_name(doc,attr);
4167 char *val = qs_get_attr_value(doc,attr);
4168 if (val && STRCASEEQ('s','S',"style", nm)) {
4172 if (IS_CSS_ON(chtml30->entryp)) {
4173 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4175 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4176 css_property_t *cur;
4177 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4178 if (cur->value && *cur->value) {
4179 attr_color = apr_pstrdup(doc->pool, cur->value);
4185 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4186 memset(flg, 0, sizeof(*flg));
4188 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4189 W_L("<font color=\"");
4192 flg->with_font_flag = 1;
4194 node->userData = (void *)flg;
4195 return chtml30->out;
4200 * It is a handler who processes the DIR tag.
4202 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4203 * destination is specified.
4204 * @param node [i] The DIR tag node is specified.
4205 * @return The conversion result is returned.
4208 s_chtml30_end_dir_tag(void *pdoc, Node *node)
4210 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dir>");
4215 * It is a handler who processes the DL tag.
4217 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4218 * destination is specified.
4219 * @param node [i] The DL tag node is specified.
4220 * @return The conversion result is returned.
4223 s_chtml30_start_dl_tag(void *pdoc, Node *node)
4225 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dl>");
4230 * It is a handler who processes the DL tag.
4232 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4233 * destination is specified.
4234 * @param node [i] The DL tag node is specified.
4235 * @return The conversion result is returned.
4238 s_chtml30_end_dl_tag(void *pdoc, Node *node)
4240 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dl>");
4245 * It is a handler who processes the DT tag.
4247 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4248 * destination is specified.
4249 * @param node [i] The DT tag node is specified.
4250 * @return The conversion result is returned.
4253 s_chtml30_start_dt_tag(void *pdoc, Node *node)
4255 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dt>");
4260 * It is a handler who processes the DT tag.
4262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4263 * destination is specified.
4264 * @param node [i] The DT tag node is specified.
4265 * @return The conversion result is returned.
4268 s_chtml30_end_dt_tag(void *pdoc, Node *node)
4270 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4275 * It is a handler who processes the DD tag.
4277 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4278 * destination is specified.
4279 * @param node [i] The DD tag node is specified.
4280 * @return The conversion result is returned.
4283 s_chtml30_start_dd_tag(void *pdoc, Node *node)
4285 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dd>");
4290 * It is a handler who processes the DD tag.
4292 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4293 * destination is specified.
4294 * @param node [i] The DD tag node is specified.
4295 * @return The conversion result is returned.
4298 s_chtml30_end_dd_tag(void *pdoc, Node *node)
4300 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4305 * It is a handler who processes the MARQUEE tag.
4307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4308 * destination is specified.
4309 * @param node [i] The MARQUEE tag node is specified.
4310 * @return The conversion result is returned.
4313 s_chtml30_start_marquee_tag(void *pdoc, Node *node)
4315 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4316 Doc *doc = chtml30->doc;
4318 char *attr_direction = NULL;
4319 char *attr_behavior = NULL;
4320 char *attr_loop = NULL;
4321 char *attr_style = NULL;
4322 char *attr_color = NULL;
4323 /*--------------------------------------------------------------------------*/
4324 /* Get Attributes */
4325 /*--------------------------------------------------------------------------*/
4326 for (attr = qs_get_attr(doc,node);
4328 attr = qs_get_next_attr(doc,attr)) {
4329 char *name = qs_get_attr_name(doc,attr);
4330 char *value = qs_get_attr_value(doc,attr);
4331 if (STRCASEEQ('d','D',"direction", name)) {
4332 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4333 attr_direction = value;
4336 else if (STRCASEEQ('b','B',"behavior",name)) {
4337 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4338 attr_behavior = value;
4341 else if (STRCASEEQ('l','L',"loop",name)) {
4342 if (value && *value) {
4346 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4350 if (IS_CSS_ON(chtml30->entryp)) {
4351 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4353 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4354 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4355 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4356 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4357 css_property_t *cur;
4358 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4359 if (cur->value && *cur->value) {
4360 attr_color = apr_pstrdup(doc->pool, cur->value);
4363 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4364 if (cur->value && *cur->value) {
4365 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4368 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4369 if (cur->value && *cur->value) {
4370 attr_loop = apr_pstrdup(doc->pool, cur->value);
4371 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4376 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4377 if (cur->value && *cur->value) {
4378 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4379 attr_direction = "right";
4381 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4382 attr_direction = "left";
4389 if (attr_direction) {
4390 W_L(" direction=\"");
4391 W_V(attr_direction);
4394 if (attr_behavior) {
4395 W_L(" behavior=\"");
4406 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4407 memset(flg, 0, sizeof(*flg));
4409 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4410 W_L("<font color=\"");
4413 flg->with_font_flag = 1;
4415 node->userData = (void *)flg;
4416 return chtml30->out;
4421 * It is a handler who processes the MARQUEE tag.
4423 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4424 * destination is specified.
4425 * @param node [i] The MARQUEE tag node is specified.
4426 * @return The conversion result is returned.
4429 s_chtml30_end_marquee_tag(void *pdoc, Node *node)
4431 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4432 Doc *doc = chtml30->doc;
4433 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4434 if (flg && flg->with_font_flag) {
4438 if (IS_CSS_ON(chtml30->entryp)) {
4439 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4441 return chtml30->out;
4446 * It is a handler who processes the BLINK tag.
4448 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4449 * destination is specified.
4450 * @param node [i] The BLINK tag node is specified.
4451 * @return The conversion result is returned.
4454 s_chtml30_start_blink_tag(void *pdoc, Node *node)
4456 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<blink>");
4461 * It is a handler who processes the BLINK tag.
4463 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4464 * destination is specified.
4465 * @param node [i] The BLINK tag node is specified.
4466 * @return The conversion result is returned.
4469 s_chtml30_end_blink_tag(void *pdoc, Node *node)
4471 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</blink>");
4476 * It is a handler who processes the MENU tag.
4478 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4479 * destination is specified.
4480 * @param node [i] The MENU tag node is specified.
4481 * @return The conversion result is returned.
4484 s_chtml30_start_menu_tag(void *pdoc, Node *node)
4486 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<menu>");
4491 * It is a handler who processes the MENU tag.
4493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4494 * destination is specified.
4495 * @param node [i] The MENU tag node is specified.
4496 * @return The conversion result is returned.
4499 s_chtml30_end_menu_tag(void *pdoc, Node *node)
4501 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</menu>");
4506 * It is a handler who processes the PLAINTEXT tag.
4508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4509 * destination is specified.
4510 * @param node [i] The PLAINTEXT tag node is specified.
4511 * @return The conversion result is returned.
4514 s_chtml30_start_plaintext_tag(void *pdoc, Node *node)
4516 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4517 Doc *doc = chtml30->doc;
4519 s_chtml30_start_plaintext_tag_inner(pdoc,node);
4520 return chtml30->out;
4524 s_chtml30_start_plaintext_tag_inner(void *pdoc, Node *node)
4526 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4527 Doc *doc = chtml30->doc;
4529 for (child = qs_get_child_node(doc, node);
4531 child = qs_get_next_node(doc, child)) {
4533 s_chtml30_start_plaintext_tag_inner(pdoc, child);
4535 return chtml30->out;
4540 * It is a handler who processes the PLAINTEXT tag.
4542 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4543 * destination is specified.
4544 * @param node [i] The PLAINTEXT tag node is specified.
4545 * @return The conversion result is returned.
4548 s_chtml30_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4550 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4551 return chtml30->out;
4556 * * It is handler who processes the New Line Code.
4559 s_chtml30_newline_mark(void *pdoc, Node *UNUSED(node))
4561 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4562 Doc *doc = chtml30->doc;
4564 return chtml30->out;
4569 * It is a handler who processes the LINK tag.
4571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4572 * destination is specified.
4573 * @param node [i] The LINK tag node is specified.
4574 * @return The conversion result is returned.
4577 s_chtml30_link_tag(void *pdoc, Node *node)
4586 chtml30 = GET_CHTML30(pdoc);
4589 if (! IS_CSS_ON(chtml30->entryp)) {
4590 return chtml30->out;
4593 for (attr = qs_get_attr(doc,node);
4595 attr = qs_get_next_attr(doc,attr)) {
4596 char *name = qs_get_attr_name(doc,attr);
4597 char *value = qs_get_attr_value(doc,attr);
4598 if (STRCASEEQ('r','R',"rel", name)) {
4599 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4603 else if (STRCASEEQ('h','H',"href", name)) {
4604 if (value && *value) {
4608 else if (STRCASEEQ('t','T',"type", name)) {
4609 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4615 if (rel && href && type) {
4616 DBG(doc->r, "REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
4617 chtml30->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml30->style, href);
4618 DBG(doc->r, "REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
4621 return chtml30->out;
4625 static css_prop_list_t *
4626 s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4628 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4629 Doc *doc = chtml30->doc;
4630 css_prop_list_t *last_css = NULL;
4631 if (IS_CSS_ON(chtml30->entryp)) {
4632 css_prop_list_t *dup_css;
4633 css_selector_t *selector;
4635 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4636 dup_css = chxj_dup_css_prop_list(doc, last_css);
4637 selector = chxj_css_find_selector(doc, chtml30->style, node);
4639 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4641 chxj_css_push_prop_list(chtml30->css_prop_stack, dup_css);
4642 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4644 if (style_attr_value) {
4645 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));
4647 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4655 static css_prop_list_t *
4656 s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4658 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4659 Doc *doc = chtml30->doc;
4660 css_prop_list_t *last_css = NULL;
4661 if (IS_CSS_ON(chtml30->entryp)) {
4662 css_prop_list_t *dup_css;
4663 css_selector_t *selector;
4665 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4666 dup_css = chxj_dup_css_prop_list(doc, last_css);
4667 selector = chxj_css_find_selector(doc, chtml30->style, node);
4669 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4673 if (style_attr_value) {
4674 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));
4676 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4686 * It is a handler who processes the SPAN tag.
4688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4689 * destination is specified.
4690 * @param node [i] The SPAN tag node is specified.
4691 * @return The conversion result is returned.
4694 s_chtml30_start_span_tag(void *pdoc, Node *node)
4699 char *attr_style = NULL;
4700 char *attr_color = NULL;
4701 char *attr_align = NULL;
4702 char *attr_blink = NULL;
4703 char *attr_marquee = NULL;
4704 char *attr_marquee_dir = NULL;
4705 char *attr_marquee_style = NULL;
4706 char *attr_marquee_loop = NULL;
4708 chtml30 = GET_CHTML30(pdoc);
4711 for (attr = qs_get_attr(doc,node);
4713 attr = qs_get_next_attr(doc,attr)) {
4714 char *nm = qs_get_attr_name(doc,attr);
4715 char *val = qs_get_attr_value(doc,attr);
4716 if (val && STRCASEEQ('s','S',"style", nm)) {
4720 if (IS_CSS_ON(chtml30->entryp)) {
4721 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4723 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4724 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4725 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4726 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4727 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4728 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4729 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4730 css_property_t *cur;
4731 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4732 attr_color = apr_pstrdup(doc->pool, cur->value);
4734 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4735 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4736 attr_blink = apr_pstrdup(doc->pool, cur->value);
4739 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4740 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4741 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4744 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4745 if (cur->value && *cur->value) {
4746 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4747 attr_marquee_dir = "right";
4749 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4750 attr_marquee_dir = "left";
4754 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4755 if (cur->value && *cur->value) {
4756 if ( STRCASEEQ('s','S',"scroll",cur->value)
4757 || STRCASEEQ('s','S',"slide",cur->value)
4758 || STRCASEEQ('a','A',"alternate",cur->value)) {
4759 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4763 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4764 if (cur->value && *cur->value) {
4765 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4766 attr_marquee_loop = "16";
4769 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4773 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4774 if (STRCASEEQ('l','L',"left", cur->value)) {
4775 attr_align = apr_pstrdup(doc->pool, "left");
4777 else if (STRCASEEQ('c','C',"center",cur->value)) {
4778 attr_align = apr_pstrdup(doc->pool, "center");
4780 else if (STRCASEEQ('r','R',"right",cur->value)) {
4781 attr_align = apr_pstrdup(doc->pool, "right");
4786 if (attr_color || attr_align || attr_blink || attr_marquee) {
4787 chtml30_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4788 memset(flg, 0, sizeof(*flg));
4791 flg->with_blink_flag = 1;
4795 if (attr_marquee_dir) {
4796 W_L(" direction=\"");
4797 W_V(attr_marquee_dir);
4800 if (attr_marquee_style) {
4801 W_L(" behavior=\"");
4802 W_V(attr_marquee_style);
4805 if (attr_marquee_loop) {
4807 W_V(attr_marquee_loop);
4811 flg->with_marquee_flag = 1;
4814 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4815 W_L("<font color=\"");
4818 flg->with_font_flag = 1;
4821 W_L("<div align=\"");
4824 flg->with_div_flag = 1;
4826 node->userData = flg;
4829 node->userData = NULL;
4831 return chtml30->out;
4836 * It is a handler who processes the SPAN tag.
4838 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4839 * destination is specified.
4840 * @param node [i] The SPAN tag node is specified.
4841 * @return The conversion result is returned.
4844 s_chtml30_end_span_tag(void *pdoc, Node *node)
4846 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4847 Doc *doc = chtml30->doc;
4849 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4850 if (flg && flg->with_div_flag) {
4853 if (flg && flg->with_font_flag) {
4856 if (flg && flg->with_marquee_flag) {
4859 if (flg && flg->with_blink_flag) {
4862 if (IS_CSS_ON(chtml30->entryp)) {
4863 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4865 return chtml30->out;
4871 * It is a handler who processes the STYLE tag.
4873 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4874 * destination is specified.
4875 * @param node [i] The STYLE tag node is specified.
4876 * @return The conversion result is returned.
4879 s_chtml30_style_tag(void *pdoc, Node *node)
4886 chtml30 = GET_CHTML30(pdoc);
4889 if (! IS_CSS_ON(chtml30->entryp)) {
4890 return chtml30->out;
4893 for (attr = qs_get_attr(doc,node);
4895 attr = qs_get_next_attr(doc,attr)) {
4896 char *name = qs_get_attr_name(doc,attr);
4897 char *value = qs_get_attr_value(doc,attr);
4898 if (STRCASEEQ('t','T',"type", name)) {
4899 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4905 Node *child = qs_get_child_node(doc, node);
4906 if (type && child) {
4907 char *name = qs_get_node_name(doc, child);
4908 if (STRCASEEQ('t','T',"text", name)) {
4909 char *value = qs_get_node_value(doc, child);
4910 DBG(doc->r, "REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),value);
4911 chtml30->style = chxj_css_parse_style_value(doc, chtml30->style, value);
4912 DBG(doc->r, "REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),value);
4915 return chtml30->out;