2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
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"
28 #define GET_CHTML30(X) ((chtml30_t *)(X))
31 #define W_L(X) do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
35 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml30->conf); W_V(nlcode); } while (0)
39 #define CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR(tagname) \
44 char *attr_style = NULL; \
45 char *attr_color = NULL; \
47 chtml30 = GET_CHTML30(pdoc); \
49 for (attr = qs_get_attr(doc,node); \
51 attr = qs_get_next_attr(doc,attr)) { \
52 char *nm = qs_get_attr_name(doc,attr); \
53 char *val = qs_get_attr_value(doc,attr); \
54 if (val && STRCASEEQ('s','S',"style", nm)) { \
58 if (IS_CSS_ON(chtml30->entryp)) { \
59 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style); \
61 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color"); \
62 css_property_t *cur; \
63 for (cur = color_prop->next; cur != color_prop; cur = cur->next) { \
64 if (cur->value && *cur->value) { \
65 attr_color = apr_pstrdup(doc->pool, cur->value); \
71 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t)); \
72 memset(flg, 0, sizeof(*flg)); \
74 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color); \
75 W_L("<font color=\""); \
78 flg->with_font_flag = 1; \
80 node->userData = (void *)flg; \
81 return chtml30->out; \
84 #define CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG() \
86 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
87 Doc *doc = chtml30->doc; \
88 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
89 if (flg && flg->with_font_flag) { \
92 if (IS_CSS_ON(chtml30->entryp)) { \
93 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
95 return chtml30->out; \
98 #define CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG(tagname) \
100 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
101 Doc *doc = chtml30->doc; \
102 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
103 if (flg && flg->with_font_flag) { \
107 if (IS_CSS_ON(chtml30->entryp)) { \
108 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
110 return chtml30->out; \
114 static char *s_chtml30_start_html_tag (void *pdoc, Node *node);
115 static char *s_chtml30_end_html_tag (void *pdoc, Node *node);
116 static char *s_chtml30_start_meta_tag (void *pdoc, Node *node);
117 static char *s_chtml30_end_meta_tag (void *pdoc, Node *node);
118 static char *s_chtml30_start_textarea_tag (void *pdoc, Node *node);
119 static char *s_chtml30_end_textarea_tag (void *pdoc, Node *node);
120 static char *s_chtml30_start_p_tag (void *pdoc, Node *node);
121 static char *s_chtml30_end_p_tag (void *pdoc, Node *node);
122 static char *s_chtml30_start_pre_tag (void *pdoc, Node *node);
123 static char *s_chtml30_end_pre_tag (void *pdoc, Node *node);
124 static char *s_chtml30_start_h1_tag (void *pdoc, Node *node);
125 static char *s_chtml30_end_h1_tag (void *pdoc, Node *node);
126 static char *s_chtml30_start_h2_tag (void *pdoc, Node *node);
127 static char *s_chtml30_end_h2_tag (void *pdoc, Node *node);
128 static char *s_chtml30_start_h3_tag (void *pdoc, Node *node);
129 static char *s_chtml30_end_h3_tag (void *pdoc, Node *node);
130 static char *s_chtml30_start_h4_tag (void *pdoc, Node *node);
131 static char *s_chtml30_end_h4_tag (void *pdoc, Node *node);
132 static char *s_chtml30_start_h5_tag (void *pdoc, Node *node);
133 static char *s_chtml30_end_h5_tag (void *pdoc, Node *node);
134 static char *s_chtml30_start_h6_tag (void *pdoc, Node *node);
135 static char *s_chtml30_end_h6_tag (void *pdoc, Node *node);
136 static char *s_chtml30_start_ul_tag (void *pdoc, Node *node);
137 static char *s_chtml30_end_ul_tag (void *pdoc, Node *node);
138 static char *s_chtml30_start_ol_tag (void *pdoc, Node *node);
139 static char *s_chtml30_end_ol_tag (void *pdoc, Node *node);
140 static char *s_chtml30_start_li_tag (void *pdoc, Node *node);
141 static char *s_chtml30_end_li_tag (void *pdoc, Node *node);
142 static char *s_chtml30_start_head_tag (void *pdoc, Node *node);
143 static char *s_chtml30_end_head_tag (void *pdoc, Node *node);
144 static char *s_chtml30_start_title_tag (void *pdoc, Node *node);
145 static char *s_chtml30_end_title_tag (void *pdoc, Node *node);
146 static char *s_chtml30_start_base_tag (void *pdoc, Node *node);
147 static char *s_chtml30_end_base_tag (void *pdoc, Node *node);
148 static char *s_chtml30_start_body_tag (void *pdoc, Node *node);
149 static char *s_chtml30_end_body_tag (void *pdoc, Node *node);
150 static char *s_chtml30_start_a_tag (void *pdoc, Node *node);
151 static char *s_chtml30_end_a_tag (void *pdoc, Node *node);
152 static char *s_chtml30_start_br_tag (void *pdoc, Node *node);
153 static char *s_chtml30_end_br_tag (void *pdoc, Node *node);
154 static char *s_chtml30_start_tr_tag (void *pdoc, Node *node);
155 static char *s_chtml30_end_tr_tag (void *pdoc, Node *node);
156 static char *s_chtml30_start_font_tag (void *pdoc, Node *node);
157 static char *s_chtml30_end_font_tag (void *pdoc, Node *node);
158 static char *s_chtml30_start_form_tag (void *pdoc, Node *node);
159 static char *s_chtml30_end_form_tag (void *pdoc, Node *node);
160 static char *s_chtml30_start_input_tag (void *pdoc, Node *node);
161 static char *s_chtml30_end_input_tag (void *pdoc, Node *node);
162 static char *s_chtml30_start_center_tag (void *pdoc, Node *node);
163 static char *s_chtml30_end_center_tag (void *pdoc, Node *node);
164 static char *s_chtml30_start_hr_tag (void *pdoc, Node *node);
165 static char *s_chtml30_end_hr_tag (void *pdoc, Node *node);
166 static char *s_chtml30_start_img_tag (void *pdoc, Node *node);
167 static char *s_chtml30_end_img_tag (void *pdoc, Node *node);
168 static char *s_chtml30_start_select_tag (void *pdoc, Node *node);
169 static char *s_chtml30_end_select_tag (void *pdoc, Node *node);
170 static char *s_chtml30_start_option_tag (void *pdoc, Node *node);
171 static char *s_chtml30_end_option_tag (void *pdoc, Node *node);
172 static char *s_chtml30_start_div_tag (void *pdoc, Node *node);
173 static char *s_chtml30_end_div_tag (void *pdoc, Node *node);
174 static char *s_chtml30_chxjif_tag (void *pdoc, Node *node);
175 static char *s_chtml30_text_tag (void *pdoc, Node *node);
176 static char *s_chtml30_start_blockquote_tag (void *pdoc, Node *node);
177 static char *s_chtml30_end_blockquote_tag (void *pdoc, Node *node);
178 static char *s_chtml30_start_dir_tag (void *pdoc, Node *node);
179 static char *s_chtml30_end_dir_tag (void *pdoc, Node *node);
180 static char *s_chtml30_start_dl_tag (void *pdoc, Node *node);
181 static char *s_chtml30_end_dl_tag (void *pdoc, Node *node);
182 static char *s_chtml30_start_dt_tag (void *pdoc, Node *node);
183 static char *s_chtml30_end_dt_tag (void *pdoc, Node *node);
184 static char *s_chtml30_start_dd_tag (void *pdoc, Node *node);
185 static char *s_chtml30_end_dd_tag (void *pdoc, Node *node);
186 static char *s_chtml30_start_marquee_tag (void *pdoc, Node *node);
187 static char *s_chtml30_end_marquee_tag (void *pdoc, Node *node);
188 static char *s_chtml30_start_blink_tag (void *pdoc, Node *node);
189 static char *s_chtml30_end_blink_tag (void *pdoc, Node *node);
190 static char *s_chtml30_start_menu_tag (void *pdoc, Node *node);
191 static char *s_chtml30_end_menu_tag (void *pdoc, Node *node);
192 static char *s_chtml30_start_plaintext_tag (void *pdoc, Node *node);
193 static char *s_chtml30_start_plaintext_tag_inner (void *pdoc, Node *node);
194 static char *s_chtml30_end_plaintext_tag (void *pdoc, Node *node);
195 static char *s_chtml30_style_tag (void *pdoc, Node *node);
196 static char *s_chtml30_newline_mark (void *pdoc, Node *node);
197 static char *s_chtml30_link_tag (void *pdoc, Node *node);
198 static char *s_chtml30_start_span_tag (void *pdoc, Node *node);
199 static char *s_chtml30_end_span_tag (void *pdoc, Node *node);
201 static void s_init_chtml30(chtml30_t *chtml, Doc *doc, request_rec *r, device_table *spec);
203 static int s_chtml30_search_emoji(chtml30_t *chtml, char *txt, char **rslt);
204 static css_prop_list_t *s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
205 static css_prop_list_t *s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
208 tag_handler chtml30_handler[] = {
211 s_chtml30_start_html_tag,
212 s_chtml30_end_html_tag,
216 s_chtml30_start_meta_tag,
217 s_chtml30_end_meta_tag,
221 s_chtml30_start_textarea_tag,
222 s_chtml30_end_textarea_tag,
226 s_chtml30_start_p_tag,
231 s_chtml30_start_pre_tag,
232 s_chtml30_end_pre_tag,
236 s_chtml30_start_ul_tag,
237 s_chtml30_end_ul_tag,
241 s_chtml30_start_li_tag,
242 s_chtml30_end_li_tag,
246 s_chtml30_start_ol_tag,
247 s_chtml30_end_ol_tag,
251 s_chtml30_start_h1_tag,
252 s_chtml30_end_h1_tag,
256 s_chtml30_start_h2_tag,
257 s_chtml30_end_h2_tag,
261 s_chtml30_start_h3_tag,
262 s_chtml30_end_h3_tag,
266 s_chtml30_start_h4_tag,
267 s_chtml30_end_h4_tag,
271 s_chtml30_start_h5_tag,
272 s_chtml30_end_h5_tag,
276 s_chtml30_start_h6_tag,
277 s_chtml30_end_h6_tag,
281 s_chtml30_start_head_tag,
282 s_chtml30_end_head_tag,
286 s_chtml30_start_title_tag,
287 s_chtml30_end_title_tag,
291 s_chtml30_start_base_tag,
292 s_chtml30_end_base_tag,
296 s_chtml30_start_body_tag,
297 s_chtml30_end_body_tag,
301 s_chtml30_start_a_tag,
306 s_chtml30_start_br_tag,
307 s_chtml30_end_br_tag,
316 s_chtml30_start_tr_tag,
317 s_chtml30_end_tr_tag,
331 s_chtml30_start_font_tag,
332 s_chtml30_end_font_tag,
336 s_chtml30_start_form_tag,
337 s_chtml30_end_form_tag,
341 s_chtml30_start_input_tag,
342 s_chtml30_end_input_tag,
346 s_chtml30_start_center_tag,
347 s_chtml30_end_center_tag,
351 s_chtml30_start_hr_tag,
352 s_chtml30_end_hr_tag,
356 s_chtml30_start_img_tag,
357 s_chtml30_end_img_tag,
361 s_chtml30_start_select_tag,
362 s_chtml30_end_select_tag,
366 s_chtml30_start_option_tag,
367 s_chtml30_end_option_tag,
371 s_chtml30_start_div_tag,
372 s_chtml30_end_div_tag,
376 s_chtml30_chxjif_tag,
381 s_chtml30_chxjif_tag,
401 s_chtml30_start_span_tag,
402 s_chtml30_end_span_tag,
426 s_chtml30_start_dt_tag,
427 s_chtml30_end_dt_tag,
441 s_chtml30_start_blockquote_tag,
442 s_chtml30_end_blockquote_tag,
446 s_chtml30_start_dir_tag,
447 s_chtml30_end_dir_tag,
451 s_chtml30_start_dl_tag,
452 s_chtml30_end_dl_tag,
456 s_chtml30_start_dd_tag,
457 s_chtml30_end_dd_tag,
461 s_chtml30_start_menu_tag,
462 s_chtml30_end_menu_tag,
466 s_chtml30_start_plaintext_tag,
467 s_chtml30_end_plaintext_tag,
471 s_chtml30_start_blink_tag,
472 s_chtml30_end_blink_tag,
476 s_chtml30_start_marquee_tag,
477 s_chtml30_end_marquee_tag,
486 s_chtml30_newline_mark,
503 * converts from CHTML5.0 to CHTML3.0.
505 * @param r [i] Requet_rec is appointed.
506 * @param spec [i] The result of the device specification processing which
507 * was done in advance is appointed.
508 * @param src [i] The character string before the converting is appointed.
509 * @return The character string after the converting is returned.
512 chxj_convert_chtml30(
518 chxjconvrule_entry *entryp,
527 DBG(r, "start chxj_convert_chtml30()");
529 /*--------------------------------------------------------------------------*/
531 /*--------------------------------------------------------------------------*/
533 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
535 DBG(r,"i found qrcode xml");
536 DBG(r, "end chxj_convert_chtml30()");
539 DBG(r,"not found qrcode xml");
541 /*--------------------------------------------------------------------------*/
542 /* The CHTML structure is initialized. */
543 /*--------------------------------------------------------------------------*/
544 s_init_chtml30(&chtml30, &doc, r, spec);
546 chtml30.entryp = entryp;
547 chtml30.cookie = cookie;
549 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
551 /*--------------------------------------------------------------------------*/
552 /* The character string of the input is analyzed. */
553 /*--------------------------------------------------------------------------*/
554 qs_init_malloc(&doc);
555 qs_init_root_node(&doc);
557 ss = apr_pcalloc(r->pool, srclen + 1);
558 memset(ss, 0, srclen + 1);
559 memcpy(ss, src, srclen);
562 chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
564 if (IS_CSS_ON(chtml30.entryp)) {
565 /* current property list */
566 chtml30.css_prop_stack = chxj_new_prop_list_stack(&doc);
569 chxj_buffered_write_init(r->pool, &doc.buf);
571 qs_parse_string(&doc,ss, strlen(ss));
573 /*--------------------------------------------------------------------------*/
574 /* It converts it from CHTML to CHTML. */
575 /*--------------------------------------------------------------------------*/
576 chxj_node_convert(spec,r,(void*)&chtml30, &doc, qs_get_root(&doc), 0);
577 chtml30.out = chxj_buffered_write_flush(chtml30.out, &doc.buf);
578 dst = apr_pstrdup(r->pool, chtml30.out);
579 chxj_buffered_write_terminate(&doc.buf);
581 qs_all_free(&doc,QX_LOGMARK);
584 dst = apr_pstrdup(r->pool,ss);
586 if (strlen(dst) == 0) {
587 dst = apr_psprintf(r->pool, "\n");
590 *dstlen = strlen(dst);
593 chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
596 DBG(r, "end chxj_convert_chtml30()");
602 * The CHTML structure is initialized.
604 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
605 * initialized is specified.
606 * @param doc [i] The Doc structure that should be set to the initialized
607 * HDML structure is specified.
608 * @param r [i] To use POOL, the pointer to request_rec is specified.
609 * @param spec [i] The pointer to the device_table
612 s_init_chtml30(chtml30_t *chtml30, Doc *doc, request_rec *r, device_table *spec)
614 memset(doc, 0, sizeof(Doc));
615 memset(chtml30, 0, sizeof(chtml30_t));
619 chtml30->spec = spec;
620 chtml30->out = qs_alloc_zero_byte_string(r->pool);
621 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
622 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
627 * Corresponding EMOJI to a current character-code is retrieved.
628 * The substitution character string is stored in the rslt pointer if agreeing.
630 * @param chtml30 [i] The pointer to the CHTML structure is specified.
631 * @param txt [i] The character string to want to examine whether it is
632 * EMOJI is specified.
633 * @param rslt [o] The pointer to the pointer that stores the result is
635 * @return When corresponding EMOJI exists, it returns it excluding 0.
638 s_chtml30_search_emoji(chtml30_t *chtml30, char *txt, char **rslt)
645 spec = chtml30->spec;
651 DBG(r,"spec is NULL");
654 for (ee = chtml30->conf->emoji;
657 if (ee->imode == NULL) {
658 DBG(r, "emoji->imode is NULL");
662 if (ee->imode->string != NULL
663 && strlen(ee->imode->string) > 0
664 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
666 if (spec == NULL || spec->emoji_type == NULL) {
667 *rslt = apr_palloc(r->pool, 3);
668 (*rslt)[0] = ee->imode->hex1byte & 0xff;
669 (*rslt)[1] = ee->imode->hex2byte & 0xff;
671 return strlen(ee->imode->string);
683 chxj_chtml30_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
694 chtml30 = &__chtml30;
697 DBG(r, "REQ[%X] start chxj_chtml30_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
698 memset(doc, 0, sizeof(Doc));
699 memset(chtml30, 0, sizeof(chtml30_t));
703 chtml30->spec = spec;
704 chtml30->out = qs_alloc_zero_byte_string(r->pool);
705 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
706 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
708 apr_pool_create(&pool, r->pool);
710 chxj_buffered_write_init(pool, &doc->buf);
712 for (ii=0; ii<len; ii++) {
716 rtn = s_chtml30_search_emoji(chtml30, (char *)&src[ii], &out);
723 if (is_sjis_kanji(src[ii])) {
724 two_byte[0] = src[ii+0];
725 two_byte[1] = src[ii+1];
731 one_byte[0] = src[ii+0];
736 chtml30->out = chxj_buffered_write_flush(chtml30->out, &doc->buf);
738 DBG(r, "REQ[%X] end chxj_chtml30_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
744 * It is a handler who processes the HTML tag.
746 * @param pdoc [i/o] The pointer to the CHTML structure at the output
747 * destination is specified.
748 * @param node [i] The HTML tag node is specified.
749 * @return The conversion result is returned.
752 s_chtml30_start_html_tag(void *pdoc, Node *UNUSED(node))
754 chtml30_t *chtml30 = GET_CHTML30(pdoc);
755 Doc *doc = chtml30->doc;
757 /*--------------------------------------------------------------------------*/
759 /*--------------------------------------------------------------------------*/
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_end_html_tag(void *pdoc, Node *UNUSED(child))
777 chtml30_t *chtml30 = GET_CHTML30(pdoc);
778 Doc *doc = chtml30->doc;
787 * It is a handler who processes the META tag.
789 * @param pdoc [i/o] The pointer to the CHTML structure at the output
790 * destination is specified.
791 * @param node [i] The META tag node is specified.
792 * @return The conversion result is returned.
795 s_chtml30_start_meta_tag(void *pdoc, Node *node)
801 int content_type_flag;
804 chtml30 = GET_CHTML30(pdoc);
808 content_type_flag = 0;
812 /*--------------------------------------------------------------------------*/
814 /*--------------------------------------------------------------------------*/
815 for (attr = qs_get_attr(doc,node);
817 attr = qs_get_next_attr(doc,attr)) {
818 char *name = qs_get_attr_name(doc,attr);
819 char *value = qs_get_attr_value(doc,attr);
823 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
824 /*----------------------------------------------------------------------*/
826 /*----------------------------------------------------------------------*/
827 W_L(" http-equiv=\"");
830 if (STRCASEEQ('c','C',"content-type", value))
831 content_type_flag = 1;
833 if (STRCASEEQ('r','R',"refresh", value))
840 if (strcasecmp(name, "content") == 0 && value && *value) {
841 if (content_type_flag) {
845 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
853 buf = apr_pstrdup(r->pool, value);
854 url = strchr(buf, ';');
856 sec = apr_pstrdup(r->pool, buf);
859 url = chxj_encoding_parameter(r, url, 0);
860 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
890 * It is a handler who processes the META tag.
892 * @param pdoc [i/o] The pointer to the CHTML structure at the output
893 * destination is specified.
894 * @param node [i] The META tag node is specified.
895 * @return The conversion result is returned.
898 s_chtml30_end_meta_tag(void* pdoc, Node* UNUSED(child))
900 chtml30_t *chtml30 = GET_CHTML30(pdoc);
907 * It is a handler who processes the HEAD tag.
909 * @param pdoc [i/o] The pointer to the CHTML structure at the output
910 * destination is specified.
911 * @param node [i] The HEAD tag node is specified.
912 * @return The conversion result is returned.
915 s_chtml30_start_head_tag(void* pdoc, Node* UNUSED(node))
917 chtml30_t *chtml30 = GET_CHTML30(pdoc);
918 Doc *doc = chtml30->doc;
927 * It is a handler who processes the HEAD tag.
929 * @param pdoc [i/o] The pointer to the CHTML structure at the output
930 * destination is specified.
931 * @param node [i] The HEAD tag node is specified.
932 * @return The conversion result is returned.
935 s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node))
937 chtml30_t *chtml30 = GET_CHTML30(pdoc);
938 Doc *doc = chtml30->doc;
947 * It is a handler who processes the TITLE tag.
949 * @param pdoc [i/o] The pointer to the CHTML structure at the output
950 * destination is specified.
951 * @param node [i] The TITLE tag node is specified.
952 * @return The conversion result is returned.
955 s_chtml30_start_title_tag(void *pdoc, Node *UNUSED(node))
957 chtml30_t *chtml30 = GET_CHTML30(pdoc);
958 Doc *doc = chtml30->doc;
967 * It is a handler who processes the TITLE tag.
969 * @param pdoc [i/o] The pointer to the CHTML structure at the output
970 * destination is specified.
971 * @param node [i] The TITLE tag node is specified.
972 * @return The conversion result is returned.
975 s_chtml30_end_title_tag(void *pdoc, Node *UNUSED(child))
977 chtml30_t *chtml30 = GET_CHTML30(pdoc);
978 Doc *doc = chtml30->doc;
987 * It is a handler who processes the BASE tag.
989 * @param pdoc [i/o] The pointer to the CHTML structure at the output
990 * destination is specified.
991 * @param node [i] The BASE tag node is specified.
992 * @return The conversion result is returned.
995 s_chtml30_start_base_tag(void *pdoc, Node *node)
1002 chtml30 = GET_CHTML30(pdoc);
1007 /*--------------------------------------------------------------------------*/
1008 /* Get Attributes */
1009 /*--------------------------------------------------------------------------*/
1010 for (attr = qs_get_attr(doc,node);
1012 attr = qs_get_next_attr(doc,attr)) {
1013 char *name = qs_get_attr_name(doc,attr);
1014 char *value = qs_get_attr_value(doc,attr);
1015 if (STRCASEEQ('h','H',"href", name)) {
1022 return chtml30->out;
1027 * It is a handler who processes the BASE tag.
1029 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1030 * destination is specified.
1031 * @param node [i] The BASE tag node is specified.
1032 * @return The conversion result is returned.
1035 s_chtml30_end_base_tag(void *pdoc, Node *UNUSED(child))
1037 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1039 return chtml30->out;
1044 * It is a handler who processes the BODY tag.
1046 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1047 * destination is specified.
1048 * @param node [i] The BODY tag node is specified.
1049 * @return The conversion result is returned.
1052 s_chtml30_start_body_tag(void *pdoc, Node *node)
1058 char *attr_bgcolor = NULL;
1059 char *attr_text = NULL;
1060 char *attr_link = NULL;
1061 char *attr_style = NULL;
1063 chtml30 = GET_CHTML30(pdoc);
1067 /*--------------------------------------------------------------------------*/
1068 /* Get Attributes */
1069 /*--------------------------------------------------------------------------*/
1070 for (attr = qs_get_attr(doc,node);
1072 attr = qs_get_next_attr(doc,attr)) {
1073 char *name = qs_get_attr_name(doc,attr);
1074 char *value = qs_get_attr_value(doc,attr);
1078 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
1079 /*----------------------------------------------------------------------*/
1081 /*----------------------------------------------------------------------*/
1082 attr_bgcolor = value;
1088 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
1089 /*----------------------------------------------------------------------*/
1091 /*----------------------------------------------------------------------*/
1098 if (strcasecmp(name, "style") == 0 && value && *value != 0) {
1105 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
1106 /*----------------------------------------------------------------------*/
1108 /*----------------------------------------------------------------------*/
1115 if (strcasecmp(name, "alink") == 0) {
1116 /*----------------------------------------------------------------------*/
1118 /*----------------------------------------------------------------------*/
1125 if (strcasecmp(name, "vlink") == 0) {
1126 /*----------------------------------------------------------------------*/
1128 /*----------------------------------------------------------------------*/
1137 if (IS_CSS_ON(chtml30->entryp)) {
1138 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1140 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1141 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1142 css_property_t *cur;
1143 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1144 if (cur->value && *cur->value) {
1145 attr_text = apr_pstrdup(doc->pool, cur->value);
1148 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1149 if (cur->value && *cur->value) {
1150 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1154 if (chtml30->style) {
1155 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml30->style);
1156 css_selector_t *cur_sel;
1157 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1158 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1159 css_property_t *cur;
1160 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1161 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1162 attr_link = apr_pstrdup(doc->pool, cur->value);
1171 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1177 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1183 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1190 return chtml30->out;
1195 * It is a handler who processes the BODY tag.
1197 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1198 * destination is specified.
1199 * @param node [i] The BODY tag node is specified.
1200 * @return The conversion result is returned.
1203 s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child))
1208 chtml30 = GET_CHTML30(pdoc);
1212 if (IS_CSS_ON(chtml30->entryp)) {
1213 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1216 return chtml30->out;
1221 * It is a handler who processes the A tag.
1223 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1224 * destination is specified.
1225 * @param node [i] The A tag node is specified.
1226 * @return The conversion result is returned.
1229 s_chtml30_start_a_tag(void *pdoc, Node *node)
1235 char *attr_style = NULL;
1237 chtml30 = GET_CHTML30(pdoc);
1242 /*--------------------------------------------------------------------------*/
1243 /* Get Attributes */
1244 /*--------------------------------------------------------------------------*/
1245 for (attr = qs_get_attr(doc,node);
1247 attr = qs_get_next_attr(doc,attr)) {
1248 char *name = qs_get_attr_name(doc,attr);
1249 char *value = qs_get_attr_value(doc,attr);
1250 if (STRCASEEQ('n','N',"name", name)) {
1251 /*----------------------------------------------------------------------*/
1253 /*----------------------------------------------------------------------*/
1258 else if (STRCASEEQ('h','H',"href", name)) {
1259 /*----------------------------------------------------------------------*/
1261 /*----------------------------------------------------------------------*/
1262 value = chxj_encoding_parameter(r, value, 0);
1263 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1264 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1270 else if (STRCASEEQ('a','A',"accesskey", name)) {
1271 /*----------------------------------------------------------------------*/
1273 /*----------------------------------------------------------------------*/
1274 W_L(" accesskey=\"");
1278 else if (STRCASEEQ('c','C',"cti", name)) {
1279 /*----------------------------------------------------------------------*/
1281 /*----------------------------------------------------------------------*/
1286 else if (STRCASEEQ('i','I',"ijam", name)) {
1287 /*----------------------------------------------------------------------*/
1289 /*----------------------------------------------------------------------*/
1292 else if (STRCASEEQ('u','U',"utn", name)) {
1293 /*----------------------------------------------------------------------*/
1295 /* It is special only for CHTML. */
1296 /*----------------------------------------------------------------------*/
1299 else if (STRCASEEQ('t','T',"telbook", name)) {
1300 /*----------------------------------------------------------------------*/
1302 /*----------------------------------------------------------------------*/
1305 else if (STRCASEEQ('k','K',"kana", name)) {
1306 /*----------------------------------------------------------------------*/
1308 /*----------------------------------------------------------------------*/
1311 else if (STRCASEEQ('e','E',"email", name)) {
1312 /*----------------------------------------------------------------------*/
1314 /*----------------------------------------------------------------------*/
1317 else if (STRCASEEQ('i','I',"ista", name)) {
1318 /*----------------------------------------------------------------------*/
1320 /*----------------------------------------------------------------------*/
1323 else if (STRCASEEQ('i','I',"ilet", name)) {
1324 /*----------------------------------------------------------------------*/
1326 /*----------------------------------------------------------------------*/
1329 else if (STRCASEEQ('i','I',"iswf", name)) {
1330 /*----------------------------------------------------------------------*/
1332 /*----------------------------------------------------------------------*/
1335 else if (STRCASEEQ('i','I',"irst", name)) {
1336 /*----------------------------------------------------------------------*/
1338 /*----------------------------------------------------------------------*/
1341 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1347 if (IS_CSS_ON(chtml30->entryp)) {
1348 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1351 return chtml30->out;
1356 * It is a handler who processes the A tag.
1358 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1359 * destination is specified.
1360 * @param node [i] The A tag node is specified.
1361 * @return The conversion result is returned.
1364 s_chtml30_end_a_tag(void *pdoc, Node *UNUSED(child))
1369 chtml30 = GET_CHTML30(pdoc);
1373 if (IS_CSS_ON(chtml30->entryp)) {
1374 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1377 return chtml30->out;
1382 * It is a handler who processes the BR tag.
1384 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1385 * destination is specified.
1386 * @param node [i] The BR tag node is specified.
1387 * @return The conversion result is returned.
1390 s_chtml30_start_br_tag(void *pdoc, Node *node)
1397 chtml30 = GET_CHTML30(pdoc);
1401 /*--------------------------------------------------------------------------*/
1402 /* Get Attributes */
1403 /*--------------------------------------------------------------------------*/
1404 for (attr = qs_get_attr(doc,node);
1406 attr = qs_get_next_attr(doc,attr)) {
1407 char *name = qs_get_attr_name(doc,attr);
1408 char *value = qs_get_attr_value(doc,attr);
1409 if (STRCASEEQ('c','C',"clear",name)) {
1410 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
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_end_br_tag(void *pdoc, Node *UNUSED(child))
1433 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1435 return chtml30->out;
1440 * It is a handler who processes the TR tag.
1442 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1443 * destination is specified.
1444 * @param node [i] The TR tag node is specified.
1445 * @return The conversion result is returned.
1448 s_chtml30_start_tr_tag(void *pdoc, Node *UNUSED(node))
1450 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1452 return chtml30->out;
1457 * It is a handler who processes the TR tag.
1459 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1460 * destination is specified.
1461 * @param node [i] The TR tag node is specified.
1462 * @return The conversion result is returned.
1465 s_chtml30_end_tr_tag(void *pdoc, Node *UNUSED(child))
1471 chtml30 = GET_CHTML30(pdoc);
1477 return chtml30->out;
1482 * It is a handler who processes the FONT tag.
1484 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1485 * destination is specified.
1486 * @param node [i] The FONT tag node is specified.
1487 * @return The conversion result is returned.
1490 s_chtml30_start_font_tag(void *pdoc, Node *node)
1496 char *attr_color = NULL;
1497 char *attr_style = NULL;
1499 chtml30 = GET_CHTML30(pdoc);
1503 /*--------------------------------------------------------------------------*/
1504 /* Get Attributes */
1505 /*--------------------------------------------------------------------------*/
1506 for (attr = qs_get_attr(doc,node);
1508 attr = qs_get_next_attr(doc,attr)) {
1509 char *name = qs_get_attr_name(doc,attr);
1510 char *value = qs_get_attr_value(doc,attr);
1511 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1512 attr_color = apr_pstrdup(doc->buf.pool, value);
1514 else if (STRCASEEQ('s','S',"size", name)) {
1515 /*----------------------------------------------------------------------*/
1517 /*----------------------------------------------------------------------*/
1520 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1524 if (IS_CSS_ON(chtml30->entryp)) {
1525 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1527 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1528 css_property_t *cur;
1529 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1530 if (cur->value && *cur->value) {
1531 attr_color = apr_pstrdup(doc->pool, cur->value);
1537 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1538 W_L("<font color=\"");
1542 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1543 flg->with_font_flag = 1;
1544 node->userData = flg;
1547 node->userData = NULL;
1549 return chtml30->out;
1554 * It is a handler who processes the FONT tag.
1556 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1557 * destination is specified.
1558 * @param node [i] The FONT tag node is specified.
1559 * @return The conversion result is returned.
1562 s_chtml30_end_font_tag(void *pdoc, Node *node)
1568 chtml30 = GET_CHTML30(pdoc);
1572 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1573 if (flg && flg->with_font_flag) {
1576 if (IS_CSS_ON(chtml30->entryp)) {
1577 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1580 return chtml30->out;
1585 * It is a handler who processes the FORM tag.
1587 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1588 * destination is specified.
1589 * @param node [i] The FORM tag node is specified.
1590 * @return The conversion result is returned.
1593 s_chtml30_start_form_tag(void *pdoc, Node *node)
1599 char *attr_style = NULL;
1600 char *attr_color = NULL;
1601 char *attr_align = NULL;
1602 char *new_hidden_tag = NULL;
1603 char *attr_method = NULL;
1604 char *attr_action = NULL;
1605 char *attr_utn = NULL;
1607 chtml30 = GET_CHTML30(pdoc);
1611 /*--------------------------------------------------------------------------*/
1612 /* Get Attributes */
1613 /*--------------------------------------------------------------------------*/
1614 for (attr = qs_get_attr(doc,node);
1616 attr = qs_get_next_attr(doc,attr)) {
1617 char *name = qs_get_attr_name(doc,attr);
1618 char *value = qs_get_attr_value(doc,attr);
1622 if (strcasecmp(name, "action") == 0) {
1623 /*--------------------------------------------------------------------*/
1625 /*--------------------------------------------------------------------*/
1626 attr_action = value;
1632 if (strcasecmp(name, "method") == 0) {
1633 /*--------------------------------------------------------------------*/
1635 /*--------------------------------------------------------------------*/
1636 attr_method = value;
1642 if (strcasecmp(name, "utn") == 0) {
1643 /*--------------------------------------------------------------------*/
1645 /*--------------------------------------------------------------------*/
1652 if (strcasecmp(name, "style") == 0) {
1661 if (IS_CSS_ON(chtml30->entryp)) {
1662 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1664 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1665 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1666 css_property_t *cur;
1667 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1668 if (STRCASEEQ('l','L',"left", cur->value)) {
1669 attr_align = apr_pstrdup(doc->pool, "left");
1671 else if (STRCASEEQ('c','C',"center",cur->value)) {
1672 attr_align = apr_pstrdup(doc->pool, "center");
1674 else if (STRCASEEQ('r','R',"right",cur->value)) {
1675 attr_align = apr_pstrdup(doc->pool, "right");
1678 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1679 attr_color = apr_pstrdup(doc->pool, cur->value);
1684 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1688 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1689 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml30->cookie);
1691 char *new_query_string = NULL;
1692 q = strchr(attr_action, '?');
1694 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);
1695 if (new_hidden_tag || new_query_string) {
1701 if (new_query_string) {
1703 W_V(new_query_string);
1717 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1718 memset(flg, 0, sizeof(*flg));
1720 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1721 W_L("<font color=\"");
1724 flg->with_font_flag = 1;
1727 W_L("<div align=\"");
1730 flg->with_div_flag = 1;
1732 node->userData = flg;
1734 if (new_hidden_tag) {
1735 W_V(new_hidden_tag);
1737 return chtml30->out;
1742 * It is a handler who processes the FORM tag.
1744 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1745 * destination is specified.
1746 * @param node [i] The FORM tag node is specified.
1747 * @return The conversion result is returned.
1750 s_chtml30_end_form_tag(void *pdoc, Node *node)
1755 chtml30 = GET_CHTML30(pdoc);
1758 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1759 if (flg && flg->with_div_flag) {
1762 if (flg && flg->with_font_flag) {
1766 if (IS_CSS_ON(chtml30->entryp)) {
1767 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1770 return chtml30->out;
1775 * It is a handler who processes the INPUT tag.
1777 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1778 * destination is specified.
1779 * @param node [i] The INPUT tag node is specified.
1780 * @return The conversion result is returned.
1783 s_chtml30_start_input_tag(void *pdoc, Node *node)
1789 char *attr_accesskey = NULL;
1790 char *attr_max_length = NULL;
1791 char *attr_type = NULL;
1792 char *attr_name = NULL;
1793 char *attr_value = NULL;
1794 char *attr_istyle = NULL;
1795 char *attr_size = NULL;
1796 char *attr_checked = NULL;
1797 char *attr_style = NULL;
1799 chtml30 = GET_CHTML30(pdoc);
1803 /*--------------------------------------------------------------------------*/
1804 /* Get Attributes */
1805 /*--------------------------------------------------------------------------*/
1806 for (attr = qs_get_attr(doc,node);
1808 attr = qs_get_next_attr(doc,attr)) {
1809 char *name = qs_get_attr_name(doc,attr);
1810 char *value = qs_get_attr_value(doc,attr);
1811 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1812 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1813 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1814 STRCASEEQ('p','P',"password",tmp_type) ||
1815 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1816 STRCASEEQ('r','R',"radio", tmp_type) ||
1817 STRCASEEQ('h','H',"hidden", tmp_type) ||
1818 STRCASEEQ('s','S',"submit", tmp_type) ||
1819 STRCASEEQ('r','R',"reset", tmp_type))) {
1820 attr_type = tmp_type;
1823 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1826 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1829 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1830 attr_istyle = value;
1832 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1833 attr_max_length = value;
1835 else if (STRCASEEQ('c','C',"checked", name)) {
1836 attr_checked = value;
1838 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1839 attr_accesskey = value;
1841 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1844 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1849 if (IS_CSS_ON(chtml30->entryp)) {
1850 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
1852 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1853 css_property_t *cur;
1854 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1855 if (strcasestr(cur->value, "<ja:n>")) {
1858 else if (strcasestr(cur->value, "<ja:en>")) {
1861 else if (strcasestr(cur->value, "<ja:hk>")) {
1864 else if (strcasestr(cur->value, "<ja:h>")) {
1888 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1889 apr_size_t value_len = strlen(attr_value);
1890 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml30->entryp);
1894 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1897 if (attr_accesskey) {
1898 W_L(" accesskey=\"");
1899 W_V(attr_accesskey);
1903 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1909 /*--------------------------------------------------------------------------*/
1910 /* The figure is default for the password. */
1911 /*--------------------------------------------------------------------------*/
1912 if (attr_max_length) {
1913 if (chxj_chk_numeric(attr_max_length) != 0) {
1914 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1916 if (attr_istyle && *attr_istyle == '1') {
1917 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1921 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1930 return chtml30->out;
1935 * It is a handler who processes the INPUT tag.
1937 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1938 * destination is specified.
1939 * @param node [i] The INPUT tag node is specified.
1940 * @return The conversion result is returned.
1943 s_chtml30_end_input_tag(void *pdoc, Node *UNUSED(node))
1949 chtml30 = GET_CHTML30(pdoc);
1953 return chtml30->out;
1958 * It is a handler who processes the CENTER tag.
1960 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1961 * destination is specified.
1962 * @param node [i] The CENTER tag node is specified.
1963 * @return The conversion result is returned.
1966 s_chtml30_start_center_tag(void *pdoc, Node *node)
1971 char *attr_style = NULL;
1972 char *attr_color = NULL;
1974 chtml30 = GET_CHTML30(pdoc);
1977 for (attr = qs_get_attr(doc,node);
1979 attr = qs_get_next_attr(doc,attr)) {
1980 char *name = qs_get_attr_name(doc,attr);
1981 char *value = qs_get_attr_value(doc,attr);
1982 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1987 if (IS_CSS_ON(chtml30->entryp)) {
1988 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1990 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1991 css_property_t *cur;
1992 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1993 if (cur->value && *cur->value) {
1994 attr_color = apr_pstrdup(doc->pool, cur->value);
2001 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2002 memset(flg, 0, sizeof(*flg));
2004 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2005 W_L("<font color=\"");
2008 flg->with_font_flag = 1;
2010 node->userData = flg;
2012 return chtml30->out;
2017 * It is a handler who processes the CENTER tag.
2019 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2020 * destination is specified.
2021 * @param node [i] The CENTER tag node is specified.
2022 * @return The conversion result is returned.
2025 s_chtml30_end_center_tag(void *pdoc, Node *node)
2030 chtml30 = GET_CHTML30(pdoc);
2033 if (IS_CSS_ON(chtml30->entryp)) {
2034 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2036 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
2037 if (flg && flg->with_font_flag) {
2042 return chtml30->out;
2047 * It is a handler who processes the HR tag.
2049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2050 * destination is specified.
2051 * @param node [i] The HR tag node is specified.
2052 * @return The conversion result is returned.
2055 s_chtml30_start_hr_tag(void *pdoc, Node *node)
2061 char *attr_align = NULL;
2062 char *attr_size = NULL;
2063 char *attr_width = NULL;
2064 char *attr_noshade = NULL;
2065 char *attr_style = NULL;
2067 chtml30 = GET_CHTML30(pdoc);
2071 for (attr = qs_get_attr(doc,node);
2073 attr = qs_get_next_attr(doc,attr)) {
2074 char *name = qs_get_attr_name (doc,attr);
2075 char *value = qs_get_attr_value(doc,attr);
2079 if (strcasecmp(name, "align") == 0) {
2080 /*--------------------------------------------------------------------*/
2082 /*--------------------------------------------------------------------*/
2083 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2091 if (strcasecmp(name, "size") == 0) {
2092 /*--------------------------------------------------------------------*/
2094 /*--------------------------------------------------------------------*/
2095 if (value && *value) {
2099 else if (strcasecmp(name, "style") == 0) {
2100 if (value && *value) {
2108 if (strcasecmp(name, "width") == 0) {
2109 /*--------------------------------------------------------------------*/
2111 /*--------------------------------------------------------------------*/
2112 if (value && *value) {
2120 if (strcasecmp(name, "noshade") == 0) {
2121 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2124 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2130 if (strcasecmp(name, "color") == 0) {
2131 /*--------------------------------------------------------------------*/
2133 /*--------------------------------------------------------------------*/
2142 if (IS_CSS_ON(chtml30->entryp)) {
2143 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2145 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2146 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2147 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2148 css_property_t *cur;
2149 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2150 if (STRCASEEQ('s','S',"solid",cur->value)) {
2151 attr_noshade = "noshade";
2154 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2155 char *tmp = apr_pstrdup(doc->pool, cur->value);
2156 char *tmpp = strstr(tmp, "px");
2159 attr_size = apr_pstrdup(doc->pool, tmp);
2162 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2163 char *tmp = apr_pstrdup(doc->pool, cur->value);
2164 char *tmpp = strstr(tmp, "px");
2167 attr_width = apr_pstrdup(doc->pool, tmp);
2170 tmpp = strstr(tmp, "%");
2172 attr_width = apr_pstrdup(doc->pool, tmp);
2198 return chtml30->out;
2203 * It is a handler who processes the HR tag.
2205 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2206 * destination is specified.
2207 * @param node [i] The HR tag node is specified.
2208 * @return The conversion result is returned.
2211 s_chtml30_end_hr_tag(void *pdoc, Node *UNUSED(child))
2213 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2214 return chtml30->out;
2219 * It is a handler who processes the IMG tag.
2221 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2222 * destination is specified.
2223 * @param node [i] The IMG tag node is specified.
2224 * @return The conversion result is returned.
2227 s_chtml30_start_img_tag(void *pdoc, Node *node)
2233 char *attr_src = NULL;
2234 char *attr_align = NULL;
2235 char *attr_style = NULL;
2236 char *attr_alt = NULL;
2237 char *attr_width = NULL;
2238 char *attr_height = NULL;
2239 char *attr_hspace = NULL;
2240 char *attr_vspace = NULL;
2241 #ifndef IMG_NOT_CONVERT_FILENAME
2245 chtml30 = GET_CHTML30(pdoc);
2246 #ifndef IMG_NOT_CONVERT_FILENAME
2247 spec = chtml30->spec;
2252 /*--------------------------------------------------------------------------*/
2253 /* Get Attributes */
2254 /*--------------------------------------------------------------------------*/
2255 for (attr = qs_get_attr(doc,node);
2257 attr = qs_get_next_attr(doc,attr)) {
2258 char *name = qs_get_attr_name (doc,attr);
2259 char *value = qs_get_attr_value(doc,attr);
2263 if (strcasecmp(name, "src") == 0) {
2264 /*--------------------------------------------------------------------*/
2266 /*--------------------------------------------------------------------*/
2267 #ifdef IMG_NOT_CONVERT_FILENAME
2268 value = chxj_encoding_parameter(r, value, 0);
2269 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2270 value = chxj_add_cookie_no_update_parameter(r, value);
2273 value = chxj_img_conv(r,spec,value);
2274 value = chxj_encoding_parameter(r, value, 0);
2275 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2276 value = chxj_add_cookie_no_update_parameter(r, value);
2280 else if (strcasecmp(name,"style") == 0 && value && *value) {
2287 if (strcasecmp(name, "align" ) == 0) {
2288 /*--------------------------------------------------------------------*/
2290 /*--------------------------------------------------------------------*/
2291 /*--------------------------------------------------------------------*/
2293 /*--------------------------------------------------------------------*/
2295 if (STRCASEEQ('t','T',"top", value) ||
2296 STRCASEEQ('m','M',"middle",value) ||
2297 STRCASEEQ('b','B',"bottom",value) ||
2298 STRCASEEQ('l','L',"left", value) ||
2299 STRCASEEQ('r','R',"right", value)) {
2302 else if (STRCASEEQ('c','C',"center", value)) {
2303 attr_align = apr_pstrdup(doc->pool, "middle");
2307 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2308 /*--------------------------------------------------------------------*/
2310 /*--------------------------------------------------------------------*/
2317 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2318 /*--------------------------------------------------------------------*/
2320 /*--------------------------------------------------------------------*/
2327 if (strcasecmp(name, "height") == 0 && value && *value) {
2328 /*--------------------------------------------------------------------*/
2330 /*--------------------------------------------------------------------*/
2331 attr_height = value;
2334 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2335 /*--------------------------------------------------------------------*/
2337 /*--------------------------------------------------------------------*/
2338 attr_hspace = value;
2344 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2345 /*--------------------------------------------------------------------*/
2347 /*--------------------------------------------------------------------*/
2348 attr_vspace = value;
2357 if (IS_CSS_ON(chtml30->entryp)) {
2358 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2360 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2361 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2362 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2363 css_property_t *cur;
2364 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2365 attr_height = apr_pstrdup(doc->pool, cur->value);
2367 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2368 attr_width = apr_pstrdup(doc->pool, cur->value);
2370 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2371 attr_align = apr_pstrdup(doc->pool, cur->value);
2413 return chtml30->out;
2418 * It is a handler who processes the IMG tag.
2420 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2421 * destination is specified.
2422 * @param node [i] The IMG tag node is specified.
2423 * @return The conversion result is returned.
2426 s_chtml30_end_img_tag(void *pdoc, Node *UNUSED(child))
2428 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2430 return chtml30->out;
2435 * It is a handler who processes the SELECT tag.
2437 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2438 * destination is specified.
2439 * @param node [i] The SELECT tag node is specified.
2440 * @return The conversion result is returned.
2443 s_chtml30_start_select_tag(void *pdoc, Node *node)
2445 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2446 Doc *doc = chtml30->doc;
2449 char *multiple = NULL;
2451 char *attr_style = NULL;
2454 for (attr = qs_get_attr(doc,node);
2456 attr = qs_get_next_attr(doc,attr)) {
2457 char *nm = qs_get_attr_name(doc,attr);
2458 char *val = qs_get_attr_value(doc,attr);
2459 if (STRCASEEQ('s','S',"size", nm)) {
2460 /*----------------------------------------------------------------------*/
2461 /* CHTML 1.0 version 2.0 */
2462 /*----------------------------------------------------------------------*/
2463 size = apr_pstrdup(doc->buf.pool, val);
2465 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2466 /*----------------------------------------------------------------------*/
2467 /* CHTML 1.0 version 2.0 */
2468 /*----------------------------------------------------------------------*/
2469 attr_style = apr_pstrdup(doc->buf.pool, val);
2471 else if (STRCASEEQ('n','N',"name", nm)) {
2472 /*----------------------------------------------------------------------*/
2473 /* CHTML 1.0 version 2.0 */
2474 /*----------------------------------------------------------------------*/
2475 name = apr_pstrdup(doc->buf.pool, val);
2477 else if (STRCASEEQ('m','M',"multiple", nm)) {
2478 /*----------------------------------------------------------------------*/
2479 /* CHTML 1.0 version 2.0 */
2480 /*----------------------------------------------------------------------*/
2481 multiple = apr_pstrdup(doc->buf.pool, val);
2484 if (size && *size) {
2489 if (name && *name) {
2498 if (IS_CSS_ON(chtml30->entryp)) {
2499 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2501 return chtml30->out;
2506 * It is a handler who processes the SELECT tag.
2508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2509 * destination is specified.
2510 * @param node [i] The SELECT tag node is specified.
2511 * @return The conversion result is returned.
2514 s_chtml30_end_select_tag(void *pdoc, Node *UNUSED(child))
2516 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2517 Doc *doc = chtml30->doc;
2520 if (IS_CSS_ON(chtml30->entryp)) {
2521 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2524 return chtml30->out;
2529 * It is a handler who processes the OPTION tag.
2531 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2532 * destination is specified.
2533 * @param node [i] The OPTION tag node is specified.
2534 * @return The conversion result is returned.
2537 s_chtml30_start_option_tag(void *pdoc, Node *node)
2545 char *attr_style = NULL;
2547 chtml30 = GET_CHTML30(pdoc);
2554 for (attr = qs_get_attr(doc,node);
2556 attr = qs_get_next_attr(doc,attr)) {
2557 char *nm = qs_get_attr_name(doc,attr);
2558 char *val = qs_get_attr_value(doc,attr);
2559 if (STRCASEEQ('s','S',"selected", nm)) {
2560 /*----------------------------------------------------------------------*/
2561 /* CHTML 1.0 version 2.0 */
2562 /*----------------------------------------------------------------------*/
2563 selected = apr_pstrdup(doc->buf.pool, val);
2565 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2566 /*----------------------------------------------------------------------*/
2567 /* CHTML 1.0 version 2.0 */
2568 /*----------------------------------------------------------------------*/
2569 attr_style = apr_pstrdup(doc->buf.pool, val);
2571 else if (STRCASEEQ('v','V',"value", nm)) {
2572 /*----------------------------------------------------------------------*/
2573 /* CHTML 1.0 version 2.0 */
2574 /*----------------------------------------------------------------------*/
2575 value = apr_pstrdup(doc->buf.pool, val);
2587 if (IS_CSS_ON(chtml30->entryp)) {
2588 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2590 return chtml30->out;
2595 * It is a handler who processes the OPTION tag.
2597 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2598 * destination is specified.
2599 * @param node [i] The OPTION tag node is specified.
2600 * @return The conversion result is returned.
2603 s_chtml30_end_option_tag(void *pdoc, Node *UNUSED(child))
2605 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2608 if (IS_CSS_ON(chtml30->entryp)) {
2609 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2612 return chtml30->out;
2617 * It is a handler who processes the DIV tag.
2619 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2620 * destination is specified.
2621 * @param node [i] The DIV tag node is specified.
2622 * @return The conversion result is returned.
2625 s_chtml30_start_div_tag(void *pdoc, Node *node)
2631 char *attr_style = NULL;
2632 char *attr_align = NULL;
2633 char *attr_display = NULL;
2634 char *attr_decoration = NULL;
2635 char *attr_wap_marquee_style = NULL;
2636 char *attr_wap_marquee_dir = NULL;
2637 char *attr_wap_marquee_loop = NULL;
2638 char *attr_color = NULL;
2639 char *attr_bgcolor = NULL;
2641 chtml30 = GET_CHTML30(pdoc);
2645 for (attr = qs_get_attr(doc,node);
2647 attr = qs_get_next_attr(doc,attr)) {
2648 char *nm = qs_get_attr_name(doc,attr);
2649 char *val = qs_get_attr_value(doc,attr);
2650 if (STRCASEEQ('a','A', "align", nm)) {
2651 /*----------------------------------------------------------------------*/
2652 /* CHTML 1.0 (W3C version 3.2) */
2653 /*----------------------------------------------------------------------*/
2654 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2655 attr_align = apr_pstrdup(doc->buf.pool, val);
2658 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2659 attr_style = apr_pstrdup(doc->buf.pool, val);
2663 if (IS_CSS_ON(chtml30->entryp)) {
2664 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2666 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2667 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2668 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2669 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2670 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2671 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2673 css_property_t *cur;
2674 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2675 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2676 attr_display = apr_pstrdup(doc->pool, cur->value);
2679 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2680 if (STRCASEEQ('b','B',"blink", cur->value)) {
2681 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2684 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2685 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2686 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2688 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2689 char *ss = strchr(cur->value, '#');
2691 ss = strstr(cur->value, "rgb");
2694 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2695 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2698 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2699 attr_color = apr_pstrdup(doc->pool, cur->value);
2700 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2702 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2703 attr_align = apr_pstrdup(doc->pool, cur->value);
2706 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2707 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2708 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2709 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2710 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2711 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2714 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2715 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2716 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2718 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2719 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2722 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2723 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2724 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2727 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2733 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2734 memset(flg, 0, sizeof(*flg));
2741 flg->with_div_flag = 1;
2745 flg->with_div_flag = 1;
2748 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2752 W_L("<font color=\"");
2755 flg->with_font_flag = 1;
2758 if (attr_decoration) {
2760 flg->with_blink_flag = 1;
2764 if (attr_wap_marquee_style) {
2765 W_L(" behavior=\"");
2766 W_V(attr_wap_marquee_style);
2769 if (attr_wap_marquee_dir) {
2770 W_L(" direction=\"");
2771 W_V(attr_wap_marquee_dir);
2774 if (attr_wap_marquee_loop) {
2776 W_V(attr_wap_marquee_loop);
2780 flg->with_marquee_flag = 1;
2782 node->userData = flg;
2784 return chtml30->out;
2789 * It is a handler who processes the DIV tag.
2791 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2792 * destination is specified.
2793 * @param node [i] The DIV tag node is specified.
2794 * @return The conversion result is returned.
2797 s_chtml30_end_div_tag(void *pdoc, Node *node)
2799 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2800 Doc *doc = chtml30->doc;
2802 chtml30_flags_t *flg = node->userData;
2803 if (flg && flg->with_marquee_flag) {
2806 if (flg && flg->with_blink_flag) {
2809 if (flg && flg->with_font_flag) {
2812 if (flg && flg->with_div_flag) {
2815 if (IS_CSS_ON(chtml30->entryp)) {
2816 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2818 node->userData = NULL;
2820 return chtml30->out;
2825 * It is a handler who processes the UL tag.
2827 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2828 * destination is specified.
2829 * @param node [i] The UL tag node is specified.
2830 * @return The conversion result is returned.
2833 s_chtml30_start_ul_tag(void *pdoc, Node *node)
2835 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2836 Doc *doc = chtml30->doc;
2838 char *attr_style = NULL;
2840 for (attr = qs_get_attr(doc,node);
2842 attr = qs_get_next_attr(doc,attr)) {
2843 char *nm = qs_get_attr_name(doc,attr);
2844 char *val = qs_get_attr_value(doc,attr);
2845 if (val && STRCASEEQ('s','S',"style", nm)) {
2850 if (IS_CSS_ON(chtml30->entryp)) {
2851 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2856 return chtml30->out;
2861 * It is a handler who processes the UL tag.
2863 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2864 * destination is specified.
2865 * @param node [i] The UL tag node is specified.
2866 * @return The conversion result is returned.
2869 s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
2871 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2872 Doc *doc = chtml30->doc;
2874 if (IS_CSS_ON(chtml30->entryp)) {
2875 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2879 return chtml30->out;
2884 * It is a handler who processes the PRE tag.
2886 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2887 * destination is specified.
2888 * @param node [i] The PRE tag node is specified.
2889 * @return The conversion result is returned.
2892 s_chtml30_start_pre_tag(void *pdoc, Node *node)
2894 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2895 Doc *doc = chtml30->doc;
2897 char *attr_style = NULL;
2899 for (attr = qs_get_attr(doc,node);
2901 attr = qs_get_next_attr(doc,attr)) {
2902 char *nm = qs_get_attr_name(doc,attr);
2903 char *val = qs_get_attr_value(doc,attr);
2904 if (val && STRCASEEQ('s','S',"style", nm)) {
2909 if (IS_CSS_ON(chtml30->entryp)) {
2910 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2913 chtml30->pre_flag++;
2916 return chtml30->out;
2921 * It is a handler who processes the PRE tag.
2923 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2924 * destination is specified.
2925 * @param node [i] The PRE tag node is specified.
2926 * @return The conversion result is returned.
2929 s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
2931 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2932 Doc *doc = chtml30->doc;
2935 chtml30->pre_flag--;
2936 if (IS_CSS_ON(chtml30->entryp)) {
2937 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2940 return chtml30->out;
2945 * It is a handler who processes the P tag.
2947 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2948 * destination is specified.
2949 * @param node [i] The P tag node is specified.
2950 * @return The conversion result is returned.
2953 s_chtml30_start_p_tag(void *pdoc, Node *node)
2959 char *attr_align = NULL;
2960 char *attr_style = NULL;
2961 char *attr_color = NULL;
2962 char *attr_blink = NULL;
2964 chtml30 = GET_CHTML30(pdoc);
2968 for (attr = qs_get_attr(doc,node);
2970 attr = qs_get_next_attr(doc,attr)) {
2971 char *nm = qs_get_attr_name(doc,attr);
2972 char *val = qs_get_attr_value(doc,attr);
2973 if (STRCASEEQ('a','A',"align", nm)) {
2974 /*----------------------------------------------------------------------*/
2975 /* CHTML 1.0 (W3C version 3.2) */
2976 /*----------------------------------------------------------------------*/
2977 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2978 attr_align = apr_pstrdup(doc->buf.pool, val);
2982 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2983 attr_style = apr_pstrdup(doc->buf.pool, val);
2986 if (IS_CSS_ON(chtml30->entryp)) {
2987 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2989 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2990 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2991 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2992 css_property_t *cur;
2993 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2994 if (STRCASEEQ('l','L',"left",cur->value)) {
2995 attr_align = apr_pstrdup(doc->pool, "left");
2997 else if (STRCASEEQ('c','C',"center",cur->value)) {
2998 attr_align = apr_pstrdup(doc->pool, "center");
3000 else if (STRCASEEQ('r','R',"right",cur->value)) {
3001 attr_align = apr_pstrdup(doc->pool, "right");
3004 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3005 if (cur->value && *cur->value) {
3006 attr_color = apr_pstrdup(doc->pool, cur->value);
3009 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3010 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3011 attr_blink = apr_pstrdup(doc->pool, cur->value);
3024 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
3025 memset(flg, 0, sizeof(*flg));
3027 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3028 W_L("<font color=\"");
3031 flg->with_font_flag = 1;
3035 flg->with_blink_flag = 1;
3037 node->userData = (void *)flg;
3039 return chtml30->out;
3044 * It is a handler who processes the P tag.
3046 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3047 * destination is specified.
3048 * @param node [i] The P tag node is specified.
3049 * @return The conversion result is returned.
3052 s_chtml30_end_p_tag(void *pdoc, Node *node)
3057 chtml30 = GET_CHTML30(pdoc);
3060 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
3061 if (flg->with_font_flag) {
3064 if (flg->with_blink_flag) {
3068 if (IS_CSS_ON(chtml30->entryp)) {
3069 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3072 return chtml30->out;
3077 * It is a handler who processes the OL tag.
3079 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3080 * destination is specified.
3081 * @param node [i] The OL tag node is specified.
3082 * @return The conversion result is returned.
3085 s_chtml30_start_ol_tag(void *pdoc, Node *node)
3091 char *attr_style = NULL;
3092 char *attr_start = NULL;
3093 char *attr_type = NULL;
3095 chtml30 = GET_CHTML30(pdoc);
3099 /*--------------------------------------------------------------------------*/
3100 /* Get Attributes */
3101 /*--------------------------------------------------------------------------*/
3102 for (attr = qs_get_attr(doc,node);
3104 attr = qs_get_next_attr(doc,attr)) {
3105 char *name = qs_get_attr_name(doc,attr);
3106 char *value = qs_get_attr_value(doc,attr);
3107 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3110 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3113 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3117 if (IS_CSS_ON(chtml30->entryp)) {
3118 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3120 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3121 css_property_t *cur;
3122 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3123 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3124 attr_type = apr_pstrdup(doc->pool, "1");
3126 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3127 attr_type = apr_pstrdup(doc->pool, "A");
3129 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3130 attr_type = apr_pstrdup(doc->pool, "a");
3148 return chtml30->out;
3153 * It is a handler who processes the OL tag.
3155 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3156 * destination is specified.
3157 * @param node [i] The OL tag node is specified.
3158 * @return The conversion result is returned.
3161 s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
3163 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3164 Doc *doc = chtml30->doc;
3167 if (IS_CSS_ON(chtml30->entryp)) {
3168 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3171 return chtml30->out;
3176 * It is a handler who processes the LI tag.
3178 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3179 * destination is specified.
3180 * @param node [i] The LI tag node is specified.
3181 * @return The conversion result is returned.
3184 s_chtml30_start_li_tag(void *pdoc, Node *node)
3186 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3187 Doc *doc = chtml30->doc;
3189 char *attr_type = NULL;
3190 char *attr_value = NULL;
3191 char *attr_style = NULL;
3192 /*--------------------------------------------------------------------------*/
3193 /* Get Attributes */
3194 /*--------------------------------------------------------------------------*/
3195 for (attr = qs_get_attr(doc,node);
3197 attr = qs_get_next_attr(doc,attr)) {
3198 char *name = qs_get_attr_name(doc,attr);
3199 char *value = qs_get_attr_value(doc,attr);
3200 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3203 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3206 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3210 if (IS_CSS_ON(chtml30->entryp)) {
3211 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3213 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3214 css_property_t *cur;
3215 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3216 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3217 attr_type = apr_pstrdup(doc->pool, "1");
3219 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3220 attr_type = apr_pstrdup(doc->pool, "A");
3222 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3223 attr_type = apr_pstrdup(doc->pool, "a");
3241 return chtml30->out;
3246 * It is a handler who processes the LI tag.
3248 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3249 * destination is specified.
3250 * @param node [i] The LI tag node is specified.
3251 * @return The conversion result is returned.
3254 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
3256 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3258 if (IS_CSS_ON(chtml30->entryp)) {
3259 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3261 return chtml30->out;
3266 * It is a handler who processes the H1 tag.
3268 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3269 * destination is specified.
3270 * @param node [i] The H1 tag node is specified.
3271 * @return The conversion result is returned.
3274 s_chtml30_start_h1_tag(void *pdoc, Node *node)
3280 char *attr_style = NULL;
3281 char *attr_align = NULL;
3284 chtml30 = GET_CHTML30(pdoc);
3288 for (attr = qs_get_attr(doc,node);
3290 attr = qs_get_next_attr(doc,attr)) {
3291 char *name = qs_get_attr_name(doc,attr);
3292 char *value = qs_get_attr_value(doc,attr);
3293 if (STRCASEEQ('a','A',"align", name)) {
3294 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3298 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3302 if (IS_CSS_ON(chtml30->entryp)) {
3303 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3305 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3306 css_property_t *cur;
3307 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3308 if (STRCASEEQ('l','L',"left", cur->value)) {
3309 attr_align = apr_pstrdup(doc->pool, "left");
3311 else if (STRCASEEQ('c','C',"center",cur->value)) {
3312 attr_align = apr_pstrdup(doc->pool, "center");
3314 else if (STRCASEEQ('r','R',"right",cur->value)) {
3315 attr_align = apr_pstrdup(doc->pool, "right");
3328 return chtml30->out;
3333 * It is a handler who processes the H1 tag.
3335 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3336 * destination is specified.
3337 * @param node [i] The H1 tag node is specified.
3338 * @return The conversion result is returned.
3341 s_chtml30_end_h1_tag(void *pdoc, Node *UNUSED(child))
3346 chtml30 = GET_CHTML30(pdoc);
3350 if (IS_CSS_ON(chtml30->entryp)) {
3351 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3354 return chtml30->out;
3359 * It is a handler who processes the H2 tag.
3361 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3362 * destination is specified.
3363 * @param node [i] The H2 tag node is specified.
3364 * @return The conversion result is returned.
3367 s_chtml30_start_h2_tag(void *pdoc, Node *node)
3373 char *attr_style = NULL;
3374 char *attr_align = NULL;
3376 chtml30 = GET_CHTML30(pdoc);
3380 for (attr = qs_get_attr(doc,node);
3382 attr = qs_get_next_attr(doc,attr)) {
3383 char *name = qs_get_attr_name(doc,attr);
3384 char *value = qs_get_attr_value(doc,attr);
3385 if (STRCASEEQ('a','A',"align", name)) {
3386 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3390 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3394 if (IS_CSS_ON(chtml30->entryp)) {
3395 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3397 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3398 css_property_t *cur;
3399 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3400 if (STRCASEEQ('l','L',"left", cur->value)) {
3401 attr_align = apr_pstrdup(doc->pool, "left");
3403 else if (STRCASEEQ('c','C',"center",cur->value)) {
3404 attr_align = apr_pstrdup(doc->pool, "center");
3406 else if (STRCASEEQ('r','R',"right",cur->value)) {
3407 attr_align = apr_pstrdup(doc->pool, "right");
3420 return chtml30->out;
3425 * It is a handler who processes the H2 tag.
3427 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3428 * destination is specified.
3429 * @param node [i] The H2 tag node is specified.
3430 * @return The conversion result is returned.
3433 s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child))
3435 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3436 Doc *doc = chtml30->doc;
3439 if (IS_CSS_ON(chtml30->entryp)) {
3440 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3443 return chtml30->out;
3448 * It is a handler who processes the H3 tag.
3450 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3451 * destination is specified.
3452 * @param node [i] The H3 tag node is specified.
3453 * @return The conversion result is returned.
3456 s_chtml30_start_h3_tag(void *pdoc, Node *node)
3462 char *attr_style = NULL;
3463 char *attr_align = NULL;
3465 chtml30 = GET_CHTML30(pdoc);
3469 for (attr = qs_get_attr(doc,node);
3471 attr = qs_get_next_attr(doc,attr)) {
3472 char *name = qs_get_attr_name(doc,attr);
3473 char *value = qs_get_attr_value(doc,attr);
3474 if (STRCASEEQ('a','A',"align", name)) {
3475 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3479 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3483 if (IS_CSS_ON(chtml30->entryp)) {
3484 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3486 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3487 css_property_t *cur;
3488 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3489 if (STRCASEEQ('l','L',"left", cur->value)) {
3490 attr_align = apr_pstrdup(doc->pool, "left");
3492 else if (STRCASEEQ('c','C',"center",cur->value)) {
3493 attr_align = apr_pstrdup(doc->pool, "center");
3495 else if (STRCASEEQ('r','R',"right",cur->value)) {
3496 attr_align = apr_pstrdup(doc->pool, "right");
3509 return chtml30->out;
3514 * It is a handler who processes the H3 tag.
3516 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3517 * destination is specified.
3518 * @param node [i] The H3 tag node is specified.
3519 * @return The conversion result is returned.
3522 s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
3524 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3525 Doc *doc = chtml30->doc;
3528 if (IS_CSS_ON(chtml30->entryp)) {
3529 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3532 return chtml30->out;
3537 * It is a handler who processes the H4 tag.
3539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3540 * destination is specified.
3541 * @param node [i] The H4 tag node is specified.
3542 * @return The conversion result is returned.
3545 s_chtml30_start_h4_tag(void *pdoc, Node *node)
3551 char *attr_style = NULL;
3552 char *attr_align = NULL;
3554 chtml30 = GET_CHTML30(pdoc);
3558 for (attr = qs_get_attr(doc,node);
3560 attr = qs_get_next_attr(doc,attr)) {
3561 char *name = qs_get_attr_name(doc,attr);
3562 char *value = qs_get_attr_value(doc,attr);
3563 if (STRCASEEQ('a','A',"align", name)) {
3564 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3568 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3572 if (IS_CSS_ON(chtml30->entryp)) {
3573 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3575 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3576 css_property_t *cur;
3577 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3578 if (STRCASEEQ('l','L',"left", cur->value)) {
3579 attr_align = apr_pstrdup(doc->pool, "left");
3581 else if (STRCASEEQ('c','C',"center",cur->value)) {
3582 attr_align = apr_pstrdup(doc->pool, "center");
3584 else if (STRCASEEQ('r','R',"right",cur->value)) {
3585 attr_align = apr_pstrdup(doc->pool, "right");
3598 return chtml30->out;
3603 * It is a handler who processes the H4 tag.
3605 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3606 * destination is specified.
3607 * @param node [i] The H4 tag node is specified.
3608 * @return The conversion result is returned.
3611 s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child))
3613 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3614 Doc *doc = chtml30->doc;
3617 if (IS_CSS_ON(chtml30->entryp)) {
3618 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3621 return chtml30->out;
3626 * It is a handler who processes the H5 tag.
3628 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3629 * destination is specified.
3630 * @param node [i] The H5 tag node is specified.
3631 * @return The conversion result is returned.
3634 s_chtml30_start_h5_tag(void *pdoc, Node *node)
3640 char *attr_style = NULL;
3641 char *attr_align = NULL;
3643 chtml30 = GET_CHTML30(pdoc);
3647 for (attr = qs_get_attr(doc,node);
3649 attr = qs_get_next_attr(doc,attr)) {
3650 char *name = qs_get_attr_name(doc,attr);
3651 char *value = qs_get_attr_value(doc,attr);
3652 if (STRCASEEQ('a','A',"align", name)) {
3653 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3657 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3661 if (IS_CSS_ON(chtml30->entryp)) {
3662 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3664 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3665 css_property_t *cur;
3666 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3667 if (STRCASEEQ('l','L',"left", cur->value)) {
3668 attr_align = apr_pstrdup(doc->pool, "left");
3670 else if (STRCASEEQ('c','C',"center",cur->value)) {
3671 attr_align = apr_pstrdup(doc->pool, "center");
3673 else if (STRCASEEQ('r','R',"right",cur->value)) {
3674 attr_align = apr_pstrdup(doc->pool, "right");
3687 return chtml30->out;
3692 * It is a handler who processes the H5 tag.
3694 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3695 * destination is specified.
3696 * @param node [i] The H5 tag node is specified.
3697 * @return The conversion result is returned.
3700 s_chtml30_end_h5_tag(void *pdoc, Node *UNUSED(child))
3702 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3703 Doc *doc = chtml30->doc;
3706 if (IS_CSS_ON(chtml30->entryp)) {
3707 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3710 return chtml30->out;
3715 * It is a handler who processes the H6 tag.
3717 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3718 * destination is specified.
3719 * @param node [i] The H6 tag node is specified.
3720 * @return The conversion result is returned.
3723 s_chtml30_start_h6_tag(void *pdoc, Node *node)
3729 char *attr_style = NULL;
3730 char *attr_align = NULL;
3732 chtml30 = GET_CHTML30(pdoc);
3736 for (attr = qs_get_attr(doc,node);
3738 attr = qs_get_next_attr(doc,attr)) {
3739 char *name = qs_get_attr_name(doc,attr);
3740 char *value = qs_get_attr_value(doc,attr);
3741 if (STRCASEEQ('a','A',"align", name)) {
3742 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3746 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3750 if (IS_CSS_ON(chtml30->entryp)) {
3751 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3753 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3754 css_property_t *cur;
3755 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3756 if (STRCASEEQ('l','L',"left", cur->value)) {
3757 attr_align = apr_pstrdup(doc->pool, "left");
3759 else if (STRCASEEQ('c','C',"center",cur->value)) {
3760 attr_align = apr_pstrdup(doc->pool, "center");
3762 else if (STRCASEEQ('r','R',"right",cur->value)) {
3763 attr_align = apr_pstrdup(doc->pool, "right");
3776 return chtml30->out;
3781 * It is a handler who processes the H6 tag.
3783 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3784 * destination is specified.
3785 * @param node [i] The H6 tag node is specified.
3786 * @return The conversion result is returned.
3789 s_chtml30_end_h6_tag(void *pdoc, Node *UNUSED(child))
3791 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3792 Doc *doc = chtml30->doc;
3795 if (IS_CSS_ON(chtml30->entryp)) {
3796 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3799 return chtml30->out;
3804 * It is a handler who processes the TEXTARE tag.
3806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3807 * destination is specified.
3808 * @param node [i] The TEXTAREA tag node is specified.
3809 * @return The conversion result is returned.
3812 s_chtml30_start_textarea_tag(void *pdoc, Node *node)
3818 char *attr_accesskey = NULL;
3819 char *attr_name = NULL;
3820 char *attr_rows = NULL;
3821 char *attr_cols = NULL;
3822 char *attr_istyle = NULL;
3823 char *attr_style = NULL;
3825 chtml30 = GET_CHTML30(pdoc);
3829 chtml30->textarea_flag++;
3831 for (attr = qs_get_attr(doc,node);
3833 attr = qs_get_next_attr(doc,attr)) {
3834 char *name = qs_get_attr_name(doc,attr);
3835 char *value = qs_get_attr_value(doc,attr);
3836 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3837 attr_accesskey = value;
3839 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3840 attr_istyle = value;
3842 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3845 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3848 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3851 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3856 if (IS_CSS_ON(chtml30->entryp)) {
3857 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
3859 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3860 css_property_t *cur;
3861 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3862 if (strcasestr(cur->value, "<ja:n>")) {
3865 else if (strcasestr(cur->value, "<ja:en>")) {
3868 else if (strcasestr(cur->value, "<ja:hk>")) {
3871 else if (strcasestr(cur->value, "<ja:h>")) {
3879 if (attr_accesskey) {
3880 W_L(" accesskey=\"");
3881 W_V(attr_accesskey);
3905 return chtml30->out;
3910 * It is a handler who processes the TEXTAREA tag.
3912 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3913 * destination is specified.
3914 * @param node [i] The TEXTAREA tag node is specified.
3915 * @return The conversion result is returned.
3918 s_chtml30_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3920 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3921 Doc *doc = chtml30->doc;
3924 chtml30->textarea_flag--;
3926 return chtml30->out;
3931 s_chtml30_chxjif_tag(void *pdoc, Node *node)
3938 chtml30 = GET_CHTML30(pdoc);
3942 for (child = qs_get_child_node(doc, node);
3944 child = qs_get_next_node(doc, child)) {
3946 s_chtml30_chxjif_tag(chtml30, child);
3954 s_chtml30_text_tag(void *pdoc, Node *child)
3966 apr_size_t z2h_input_len;
3968 chtml30 = GET_CHTML30(pdoc);
3972 textval = qs_get_node_value(doc,child);
3973 if (strlen(textval) == 0) {
3974 return chtml30->out;
3977 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3978 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3980 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3981 memset(one_byte, 0, sizeof(one_byte));
3984 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3986 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
3988 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3993 if (is_sjis_kanji(textval[ii])) {
3994 one_byte[0] = textval[ii+0];
3995 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3996 one_byte[0] = textval[ii+1];
3997 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4000 else if (chtml30->pre_flag) {
4001 one_byte[0] = textval[ii+0];
4002 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4004 else if (chtml30->textarea_flag) {
4005 one_byte[0] = textval[ii+0];
4006 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4008 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4009 one_byte[0] = textval[ii+0];
4010 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4013 z2h_input_len = strlen(tdst);
4014 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml30->entryp);
4017 return chtml30->out;
4022 * It is a handler who processes the BLOCKQUOTE tag.
4024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4025 * destination is specified.
4026 * @param node [i] The BLOCKQUOTE tag node is specified.
4027 * @return The conversion result is returned.
4030 s_chtml30_start_blockquote_tag(void *pdoc, Node *node)
4035 char *attr_style = NULL;
4036 char *attr_color = NULL;
4038 chtml30 = GET_CHTML30(pdoc);
4040 for (attr = qs_get_attr(doc,node);
4042 attr = qs_get_next_attr(doc,attr)) {
4043 char *nm = qs_get_attr_name(doc,attr);
4044 char *val = qs_get_attr_value(doc,attr);
4045 if (val && STRCASEEQ('s','S',"style", nm)) {
4049 if (IS_CSS_ON(chtml30->entryp)) {
4050 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4052 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4053 css_property_t *cur;
4054 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4055 if (cur->value && *cur->value) {
4056 attr_color = apr_pstrdup(doc->pool, cur->value);
4061 W_L("<blockquote>");
4062 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4063 memset(flg, 0, sizeof(*flg));
4065 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4066 W_L("<font color=\"");
4069 flg->with_font_flag = 1;
4071 node->userData = (void *)flg;
4072 return chtml30->out;
4077 * It is a handler who processes the BLOCKQUOTE tag.
4079 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4080 * destination is specified.
4081 * @param node [i] The BLOCKQUOTE tag node is specified.
4082 * @return The conversion result is returned.
4085 s_chtml30_end_blockquote_tag(void *pdoc, Node *node)
4087 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4088 Doc *doc = chtml30->doc;
4089 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4090 if (flg && flg->with_font_flag) {
4093 W_L("</blockquote>");
4094 if (IS_CSS_ON(chtml30->entryp)) {
4095 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4097 return chtml30->out;
4102 * It is a handler who processes the DIR tag.
4104 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4105 * destination is specified.
4106 * @param node [i] The DIR tag node is specified.
4107 * @return The conversion result is returned.
4110 s_chtml30_start_dir_tag(void *pdoc, Node *node)
4115 char *attr_style = NULL;
4116 char *attr_color = NULL;
4118 chtml30 = GET_CHTML30(pdoc);
4120 for (attr = qs_get_attr(doc,node);
4122 attr = qs_get_next_attr(doc,attr)) {
4123 char *nm = qs_get_attr_name(doc,attr);
4124 char *val = qs_get_attr_value(doc,attr);
4125 if (val && STRCASEEQ('s','S',"style", nm)) {
4129 if (IS_CSS_ON(chtml30->entryp)) {
4130 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4132 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4133 css_property_t *cur;
4134 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4135 if (cur->value && *cur->value) {
4136 attr_color = apr_pstrdup(doc->pool, cur->value);
4142 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4143 memset(flg, 0, sizeof(*flg));
4145 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4146 W_L("<font color=\"");
4149 flg->with_font_flag = 1;
4151 node->userData = (void *)flg;
4152 return chtml30->out;
4157 * It is a handler who processes the DIR tag.
4159 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4160 * destination is specified.
4161 * @param node [i] The DIR tag node is specified.
4162 * @return The conversion result is returned.
4165 s_chtml30_end_dir_tag(void *pdoc, Node *node)
4167 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dir>");
4172 * It is a handler who processes the DL tag.
4174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4175 * destination is specified.
4176 * @param node [i] The DL tag node is specified.
4177 * @return The conversion result is returned.
4180 s_chtml30_start_dl_tag(void *pdoc, Node *node)
4182 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dl>");
4187 * It is a handler who processes the DL tag.
4189 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4190 * destination is specified.
4191 * @param node [i] The DL tag node is specified.
4192 * @return The conversion result is returned.
4195 s_chtml30_end_dl_tag(void *pdoc, Node *node)
4197 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dl>");
4202 * It is a handler who processes the DT tag.
4204 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4205 * destination is specified.
4206 * @param node [i] The DT tag node is specified.
4207 * @return The conversion result is returned.
4210 s_chtml30_start_dt_tag(void *pdoc, Node *node)
4212 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dt>");
4217 * It is a handler who processes the DT tag.
4219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4220 * destination is specified.
4221 * @param node [i] The DT tag node is specified.
4222 * @return The conversion result is returned.
4225 s_chtml30_end_dt_tag(void *pdoc, Node *node)
4227 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4232 * It is a handler who processes the DD tag.
4234 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4235 * destination is specified.
4236 * @param node [i] The DD tag node is specified.
4237 * @return The conversion result is returned.
4240 s_chtml30_start_dd_tag(void *pdoc, Node *node)
4242 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dd>");
4247 * It is a handler who processes the DD tag.
4249 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4250 * destination is specified.
4251 * @param node [i] The DD tag node is specified.
4252 * @return The conversion result is returned.
4255 s_chtml30_end_dd_tag(void *pdoc, Node *node)
4257 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4262 * It is a handler who processes the MARQUEE tag.
4264 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4265 * destination is specified.
4266 * @param node [i] The MARQUEE tag node is specified.
4267 * @return The conversion result is returned.
4270 s_chtml30_start_marquee_tag(void *pdoc, Node *node)
4272 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4273 Doc *doc = chtml30->doc;
4275 char *attr_direction = NULL;
4276 char *attr_behavior = NULL;
4277 char *attr_loop = NULL;
4278 char *attr_style = NULL;
4279 char *attr_color = NULL;
4280 /*--------------------------------------------------------------------------*/
4281 /* Get Attributes */
4282 /*--------------------------------------------------------------------------*/
4283 for (attr = qs_get_attr(doc,node);
4285 attr = qs_get_next_attr(doc,attr)) {
4286 char *name = qs_get_attr_name(doc,attr);
4287 char *value = qs_get_attr_value(doc,attr);
4288 if (STRCASEEQ('d','D',"direction", name)) {
4289 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4290 attr_direction = value;
4293 else if (STRCASEEQ('b','B',"behavior",name)) {
4294 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4295 attr_behavior = value;
4298 else if (STRCASEEQ('l','L',"loop",name)) {
4299 if (value && *value) {
4303 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4307 if (IS_CSS_ON(chtml30->entryp)) {
4308 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4310 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4311 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4312 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4313 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4314 css_property_t *cur;
4315 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4316 if (cur->value && *cur->value) {
4317 attr_color = apr_pstrdup(doc->pool, cur->value);
4320 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4321 if (cur->value && *cur->value) {
4322 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4325 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4326 if (cur->value && *cur->value) {
4327 attr_loop = apr_pstrdup(doc->pool, cur->value);
4328 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4333 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4334 if (cur->value && *cur->value) {
4335 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4336 attr_direction = "right";
4338 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4339 attr_direction = "left";
4346 if (attr_direction) {
4347 W_L(" direction=\"");
4348 W_V(attr_direction);
4351 if (attr_behavior) {
4352 W_L(" behavior=\"");
4363 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4364 memset(flg, 0, sizeof(*flg));
4366 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4367 W_L("<font color=\"");
4370 flg->with_font_flag = 1;
4372 node->userData = (void *)flg;
4373 return chtml30->out;
4378 * It is a handler who processes the MARQUEE tag.
4380 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4381 * destination is specified.
4382 * @param node [i] The MARQUEE tag node is specified.
4383 * @return The conversion result is returned.
4386 s_chtml30_end_marquee_tag(void *pdoc, Node *node)
4388 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4389 Doc *doc = chtml30->doc;
4390 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4391 if (flg && flg->with_font_flag) {
4395 if (IS_CSS_ON(chtml30->entryp)) {
4396 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4398 return chtml30->out;
4403 * It is a handler who processes the BLINK tag.
4405 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4406 * destination is specified.
4407 * @param node [i] The BLINK tag node is specified.
4408 * @return The conversion result is returned.
4411 s_chtml30_start_blink_tag(void *pdoc, Node *node)
4413 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<blink>");
4418 * It is a handler who processes the BLINK tag.
4420 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4421 * destination is specified.
4422 * @param node [i] The BLINK tag node is specified.
4423 * @return The conversion result is returned.
4426 s_chtml30_end_blink_tag(void *pdoc, Node *node)
4428 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</blink>");
4433 * It is a handler who processes the MENU tag.
4435 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4436 * destination is specified.
4437 * @param node [i] The MENU tag node is specified.
4438 * @return The conversion result is returned.
4441 s_chtml30_start_menu_tag(void *pdoc, Node *node)
4443 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<menu>");
4448 * It is a handler who processes the MENU tag.
4450 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4451 * destination is specified.
4452 * @param node [i] The MENU tag node is specified.
4453 * @return The conversion result is returned.
4456 s_chtml30_end_menu_tag(void *pdoc, Node *node)
4458 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</menu>");
4463 * It is a handler who processes the PLAINTEXT tag.
4465 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4466 * destination is specified.
4467 * @param node [i] The PLAINTEXT tag node is specified.
4468 * @return The conversion result is returned.
4471 s_chtml30_start_plaintext_tag(void *pdoc, Node *node)
4473 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4474 Doc *doc = chtml30->doc;
4476 s_chtml30_start_plaintext_tag_inner(pdoc,node);
4477 return chtml30->out;
4481 s_chtml30_start_plaintext_tag_inner(void *pdoc, Node *node)
4483 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4484 Doc *doc = chtml30->doc;
4486 for (child = qs_get_child_node(doc, node);
4488 child = qs_get_next_node(doc, child)) {
4490 s_chtml30_start_plaintext_tag_inner(pdoc, child);
4492 return chtml30->out;
4497 * It is a handler who processes the PLAINTEXT tag.
4499 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4500 * destination is specified.
4501 * @param node [i] The PLAINTEXT tag node is specified.
4502 * @return The conversion result is returned.
4505 s_chtml30_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4507 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4508 return chtml30->out;
4513 * * It is handler who processes the New Line Code.
4516 s_chtml30_newline_mark(void *pdoc, Node *UNUSED(node))
4518 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4519 Doc *doc = chtml30->doc;
4521 return chtml30->out;
4526 * It is a handler who processes the LINK tag.
4528 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4529 * destination is specified.
4530 * @param node [i] The LINK tag node is specified.
4531 * @return The conversion result is returned.
4534 s_chtml30_link_tag(void *pdoc, Node *node)
4543 chtml30 = GET_CHTML30(pdoc);
4546 if (! IS_CSS_ON(chtml30->entryp)) {
4547 return chtml30->out;
4550 for (attr = qs_get_attr(doc,node);
4552 attr = qs_get_next_attr(doc,attr)) {
4553 char *name = qs_get_attr_name(doc,attr);
4554 char *value = qs_get_attr_value(doc,attr);
4555 if (STRCASEEQ('r','R',"rel", name)) {
4556 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4560 else if (STRCASEEQ('h','H',"href", name)) {
4561 if (value && *value) {
4565 else if (STRCASEEQ('t','T',"type", name)) {
4566 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4572 if (rel && href && type) {
4573 DBG(doc->r, "start load CSS. url:[%s]", href);
4574 chtml30->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml30->style, href);
4575 DBG(doc->r, "end load CSS. url:[%s]", href);
4578 return chtml30->out;
4582 static css_prop_list_t *
4583 s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4585 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4586 Doc *doc = chtml30->doc;
4587 css_prop_list_t *last_css = NULL;
4588 if (IS_CSS_ON(chtml30->entryp)) {
4589 css_prop_list_t *dup_css;
4590 css_selector_t *selector;
4592 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4593 dup_css = chxj_dup_css_prop_list(doc, last_css);
4594 selector = chxj_css_find_selector(doc, chtml30->style, node);
4596 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4598 chxj_css_push_prop_list(chtml30->css_prop_stack, dup_css);
4599 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4601 if (style_attr_value) {
4602 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));
4604 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4612 static css_prop_list_t *
4613 s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4615 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4616 Doc *doc = chtml30->doc;
4617 css_prop_list_t *last_css = NULL;
4618 if (IS_CSS_ON(chtml30->entryp)) {
4619 css_prop_list_t *dup_css;
4620 css_selector_t *selector;
4622 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4623 dup_css = chxj_dup_css_prop_list(doc, last_css);
4624 selector = chxj_css_find_selector(doc, chtml30->style, node);
4626 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4630 if (style_attr_value) {
4631 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));
4633 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4643 * It is a handler who processes the SPAN tag.
4645 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4646 * destination is specified.
4647 * @param node [i] The SPAN tag node is specified.
4648 * @return The conversion result is returned.
4651 s_chtml30_start_span_tag(void *pdoc, Node *node)
4656 char *attr_style = NULL;
4657 char *attr_color = NULL;
4658 char *attr_align = NULL;
4659 char *attr_blink = NULL;
4660 char *attr_marquee = NULL;
4661 char *attr_marquee_dir = NULL;
4662 char *attr_marquee_style = NULL;
4663 char *attr_marquee_loop = NULL;
4665 chtml30 = GET_CHTML30(pdoc);
4668 for (attr = qs_get_attr(doc,node);
4670 attr = qs_get_next_attr(doc,attr)) {
4671 char *nm = qs_get_attr_name(doc,attr);
4672 char *val = qs_get_attr_value(doc,attr);
4673 if (val && STRCASEEQ('s','S',"style", nm)) {
4677 if (IS_CSS_ON(chtml30->entryp)) {
4678 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4680 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4681 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4682 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4683 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4684 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4685 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4686 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4687 css_property_t *cur;
4688 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4689 attr_color = apr_pstrdup(doc->pool, cur->value);
4691 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4692 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4693 attr_blink = apr_pstrdup(doc->pool, cur->value);
4696 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4697 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4698 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4701 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4702 if (cur->value && *cur->value) {
4703 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4704 attr_marquee_dir = "right";
4706 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4707 attr_marquee_dir = "left";
4711 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4712 if (cur->value && *cur->value) {
4713 if ( STRCASEEQ('s','S',"scroll",cur->value)
4714 || STRCASEEQ('s','S',"slide",cur->value)
4715 || STRCASEEQ('a','A',"alternate",cur->value)) {
4716 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4720 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4721 if (cur->value && *cur->value) {
4722 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4723 attr_marquee_loop = "16";
4726 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4730 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4731 if (STRCASEEQ('l','L',"left", cur->value)) {
4732 attr_align = apr_pstrdup(doc->pool, "left");
4734 else if (STRCASEEQ('c','C',"center",cur->value)) {
4735 attr_align = apr_pstrdup(doc->pool, "center");
4737 else if (STRCASEEQ('r','R',"right",cur->value)) {
4738 attr_align = apr_pstrdup(doc->pool, "right");
4743 if (attr_color || attr_align || attr_blink || attr_marquee) {
4744 chtml30_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4745 memset(flg, 0, sizeof(*flg));
4748 flg->with_blink_flag = 1;
4752 if (attr_marquee_dir) {
4753 W_L(" direction=\"");
4754 W_V(attr_marquee_dir);
4757 if (attr_marquee_style) {
4758 W_L(" behavior=\"");
4759 W_V(attr_marquee_style);
4762 if (attr_marquee_loop) {
4764 W_V(attr_marquee_loop);
4768 flg->with_marquee_flag = 1;
4771 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4772 W_L("<font color=\"");
4775 flg->with_font_flag = 1;
4778 W_L("<div align=\"");
4781 flg->with_div_flag = 1;
4783 node->userData = flg;
4786 node->userData = NULL;
4788 return chtml30->out;
4793 * It is a handler who processes the SPAN tag.
4795 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4796 * destination is specified.
4797 * @param node [i] The SPAN tag node is specified.
4798 * @return The conversion result is returned.
4801 s_chtml30_end_span_tag(void *pdoc, Node *node)
4803 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4804 Doc *doc = chtml30->doc;
4806 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4807 if (flg && flg->with_div_flag) {
4810 if (flg && flg->with_font_flag) {
4813 if (flg && flg->with_marquee_flag) {
4816 if (flg && flg->with_blink_flag) {
4819 if (IS_CSS_ON(chtml30->entryp)) {
4820 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4822 return chtml30->out;
4828 * It is a handler who processes the STYLE tag.
4830 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4831 * destination is specified.
4832 * @param node [i] The STYLE tag node is specified.
4833 * @return The conversion result is returned.
4836 s_chtml30_style_tag(void *pdoc, Node *node)
4843 chtml30 = GET_CHTML30(pdoc);
4846 if (! IS_CSS_ON(chtml30->entryp)) {
4847 return chtml30->out;
4850 for (attr = qs_get_attr(doc,node);
4852 attr = qs_get_next_attr(doc,attr)) {
4853 char *name = qs_get_attr_name(doc,attr);
4854 char *value = qs_get_attr_value(doc,attr);
4855 if (STRCASEEQ('t','T',"type", name)) {
4856 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4862 Node *child = qs_get_child_node(doc, node);
4863 if (type && child) {
4864 char *name = qs_get_node_name(doc, child);
4865 if (STRCASEEQ('t','T',"text", name)) {
4866 char *value = qs_get_node_value(doc, child);
4867 DBG(doc->r, "start load CSS. buf:[%s]", value);
4868 chtml30->style = chxj_css_parse_style_value(doc, chtml30->style, value);
4869 DBG(doc->r, "end load CSS. value:[%s]", value);
4872 return chtml30->out;