2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_chtml20.h"
18 #include "chxj_hdml.h"
19 #include "chxj_str_util.h"
20 #include "chxj_dump.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_qr_code.h"
23 #include "chxj_encoding.h"
24 #include "chxj_buffered_write.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_conv_z2h.h"
30 #define GET_CHTML20(X) ((chtml20_t*)(X))
33 #define W_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
34 #define W_V(X) do { chtml20->out = (X) ? BUFFERED_WRITE_VALUE(chtml20->out, &doc->buf, (X)) \
35 : BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, ""); } while(0)
37 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml20->conf); W_V(nlcode); } while (0)
39 #define CHTML20_START_OF_TAG_WITH_CSS_FONT_COLOR(tagname) \
44 char *attr_style = NULL; \
45 char *attr_color = NULL; \
47 chtml20 = GET_CHTML20(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(chtml20->entryp)) { \
59 css_prop_list_t *style = s_chtml20_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 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_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 chtml20->out; \
84 #define CHTML20_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG() \
86 chtml20_t *chtml20 = GET_CHTML20(pdoc); \
87 Doc *doc = chtml20->doc; \
88 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData; \
89 if (flg && flg->with_font_flag) { \
92 if (IS_CSS_ON(chtml20->entryp)) { \
93 chxj_css_pop_prop_list(chtml20->css_prop_stack); \
95 return chtml20->out; \
98 #define CHTML20_END_OF_CLOSE_TAG_WITH_FONT_TAG(tagname) \
100 chtml20_t *chtml20 = GET_CHTML20(pdoc); \
101 Doc *doc = chtml20->doc; \
102 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData; \
103 if (flg && flg->with_font_flag) { \
107 if (IS_CSS_ON(chtml20->entryp)) { \
108 chxj_css_pop_prop_list(chtml20->css_prop_stack); \
110 return chtml20->out; \
113 static char *s_chtml20_start_html_tag (void *pdoc, Node *node);
114 static char *s_chtml20_end_html_tag (void *pdoc, Node *node);
115 static char *s_chtml20_start_meta_tag (void *pdoc, Node *node);
116 static char *s_chtml20_end_meta_tag (void *pdoc, Node *node);
117 static char *s_chtml20_start_textarea_tag(void *pdoc, Node *node);
118 static char *s_chtml20_end_textarea_tag (void *pdoc, Node *node);
119 static char *s_chtml20_start_p_tag (void *pdoc, Node *node);
120 static char *s_chtml20_end_p_tag (void *pdoc, Node *node);
121 static char *s_chtml20_start_pre_tag (void *pdoc, Node *node);
122 static char *s_chtml20_end_pre_tag (void *pdoc, Node *node);
123 static char *s_chtml20_start_h1_tag (void *pdoc, Node *node);
124 static char *s_chtml20_end_h1_tag (void *pdoc, Node *node);
125 static char *s_chtml20_start_h2_tag (void *pdoc, Node *node);
126 static char *s_chtml20_end_h2_tag (void *pdoc, Node *node);
127 static char *s_chtml20_start_h3_tag (void *pdoc, Node *node);
128 static char *s_chtml20_end_h3_tag (void *pdoc, Node *node);
129 static char *s_chtml20_start_h4_tag (void *pdoc, Node *node);
130 static char *s_chtml20_end_h4_tag (void *pdoc, Node *node);
131 static char *s_chtml20_start_h5_tag (void *pdoc, Node *node);
132 static char *s_chtml20_end_h5_tag (void *pdoc, Node *node);
133 static char *s_chtml20_start_h6_tag (void *pdoc, Node *node);
134 static char *s_chtml20_end_h6_tag (void *pdoc, Node *node);
135 static char *s_chtml20_start_ul_tag (void *pdoc, Node *node);
136 static char *s_chtml20_end_ul_tag (void *pdoc, Node *node);
137 static char *s_chtml20_start_ol_tag (void *pdoc, Node *node);
138 static char *s_chtml20_end_ol_tag (void *pdoc, Node *node);
139 static char *s_chtml20_start_li_tag (void *pdoc, Node *node);
140 static char *s_chtml20_end_li_tag (void *pdoc, Node *node);
141 static char *s_chtml20_start_head_tag (void *pdoc, Node *node);
142 static char *s_chtml20_end_head_tag (void *pdoc, Node *node);
143 static char *s_chtml20_start_title_tag (void *pdoc, Node *node);
144 static char *s_chtml20_end_title_tag (void *pdoc, Node *node);
145 static char *s_chtml20_start_base_tag (void *pdoc, Node *node);
146 static char *s_chtml20_end_base_tag (void *pdoc, Node *node);
147 static char *s_chtml20_start_body_tag (void *pdoc, Node *node);
148 static char *s_chtml20_end_body_tag (void *pdoc, Node *node);
149 static char *s_chtml20_start_a_tag (void *pdoc, Node *node);
150 static char *s_chtml20_end_a_tag (void *pdoc, Node *node);
151 static char *s_chtml20_start_br_tag (void *pdoc, Node *node);
152 static char *s_chtml20_end_br_tag (void *pdoc, Node *node);
153 static char *s_chtml20_start_tr_tag (void *pdoc, Node *node);
154 static char *s_chtml20_end_tr_tag (void *pdoc, Node *node);
155 static char *s_chtml20_start_font_tag (void *pdoc, Node *node);
156 static char *s_chtml20_end_font_tag (void *pdoc, Node *node);
157 static char *s_chtml20_start_form_tag (void *pdoc, Node *node);
158 static char *s_chtml20_end_form_tag (void *pdoc, Node *node);
159 static char *s_chtml20_start_input_tag (void *pdoc, Node *node);
160 static char *s_chtml20_end_input_tag (void *pdoc, Node *node);
161 static char *s_chtml20_start_center_tag (void *pdoc, Node *node);
162 static char *s_chtml20_end_center_tag (void *pdoc, Node *node);
163 static char *s_chtml20_start_hr_tag (void *pdoc, Node *node);
164 static char *s_chtml20_end_hr_tag (void *pdoc, Node *node);
165 static char *s_chtml20_start_img_tag (void *pdoc, Node *node);
166 static char *s_chtml20_end_img_tag (void *pdoc, Node *node);
167 static char *s_chtml20_start_select_tag (void *pdoc, Node *node);
168 static char *s_chtml20_end_select_tag (void *pdoc, Node *node);
169 static char *s_chtml20_start_option_tag (void *pdoc, Node *node);
170 static char *s_chtml20_end_option_tag (void *pdoc, Node *node);
171 static char *s_chtml20_start_div_tag (void *pdoc, Node *node);
172 static char *s_chtml20_end_div_tag (void *pdoc, Node *node);
173 static char *s_chtml20_start_blockquote_tag(void *pdoc, Node *node);
174 static char *s_chtml20_end_blockquote_tag (void *pdoc, Node *node);
175 static char *s_chtml20_start_dir_tag (void *pdoc, Node *node);
176 static char *s_chtml20_end_dir_tag (void *pdoc, Node *node);
177 static char *s_chtml20_start_dl_tag (void *pdoc, Node *node);
178 static char *s_chtml20_end_dl_tag (void *pdoc, Node *node);
179 static char *s_chtml20_start_dt_tag (void *pdoc, Node *node);
180 static char *s_chtml20_end_dt_tag (void *pdoc, Node *node);
181 static char *s_chtml20_start_dd_tag (void *pdoc, Node *node);
182 static char *s_chtml20_end_dd_tag (void *pdoc, Node *node);
183 static char *s_chtml20_start_menu_tag (void *pdoc, Node *node);
184 static char *s_chtml20_end_menu_tag (void *pdoc, Node *node);
185 static char *s_chtml20_start_plaintext_tag (void *pdoc, Node *node);
186 static char *s_chtml20_start_plaintext_tag_inner (void *pdoc, Node *node);
187 static char *s_chtml20_end_plaintext_tag (void *pdoc, Node *node);
188 static char *s_chtml20_start_blink_tag (void *pdoc, Node *node);
189 static char *s_chtml20_end_blink_tag (void *pdoc, Node *node);
190 static char *s_chtml20_start_marquee_tag (void *pdoc, Node *node);
191 static char *s_chtml20_end_marquee_tag (void *pdoc, Node *node);
192 static char *s_chtml20_newline_mark (void *pdoc, Node *node);
193 static char *s_chtml20_style_tag (void *pdoc, Node *node);
194 static char *s_chtml20_link_tag (void *pdoc, Node *node);
195 static char *s_chtml20_start_span_tag (void *pdoc, Node *node);
196 static char *s_chtml20_end_span_tag (void *pdoc, Node *node);
198 static void s_init_chtml20(chtml20_t *chtml, Doc *doc, request_rec *r, device_table *spec);
200 static int s_chtml20_search_emoji(chtml20_t *chtml, char *txt, char **rslt);
202 static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
203 static char *s_chtml20_text_tag(void *pdoc, Node *node);
204 static css_prop_list_t *s_chtml20_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
205 static css_prop_list_t *s_chtml20_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
209 tag_handler chtml20_handler[] = {
212 s_chtml20_start_html_tag,
213 s_chtml20_end_html_tag,
217 s_chtml20_start_meta_tag,
218 s_chtml20_end_meta_tag,
222 s_chtml20_start_textarea_tag,
223 s_chtml20_end_textarea_tag,
227 s_chtml20_start_p_tag,
232 s_chtml20_start_pre_tag,
233 s_chtml20_end_pre_tag,
237 s_chtml20_start_ul_tag,
238 s_chtml20_end_ul_tag,
242 s_chtml20_start_li_tag,
243 s_chtml20_end_li_tag,
247 s_chtml20_start_ol_tag,
248 s_chtml20_end_ol_tag,
252 s_chtml20_start_h1_tag,
253 s_chtml20_end_h1_tag,
257 s_chtml20_start_h2_tag,
258 s_chtml20_end_h2_tag,
262 s_chtml20_start_h3_tag,
263 s_chtml20_end_h3_tag,
267 s_chtml20_start_h4_tag,
268 s_chtml20_end_h4_tag,
272 s_chtml20_start_h5_tag,
273 s_chtml20_end_h5_tag,
277 s_chtml20_start_h6_tag,
278 s_chtml20_end_h6_tag,
282 s_chtml20_start_head_tag,
283 s_chtml20_end_head_tag,
287 s_chtml20_start_title_tag,
288 s_chtml20_end_title_tag,
292 s_chtml20_start_base_tag,
293 s_chtml20_end_base_tag,
297 s_chtml20_start_body_tag,
298 s_chtml20_end_body_tag,
302 s_chtml20_start_a_tag,
307 s_chtml20_start_br_tag,
308 s_chtml20_end_br_tag,
317 s_chtml20_start_tr_tag,
318 s_chtml20_end_tr_tag,
332 s_chtml20_start_font_tag,
333 s_chtml20_end_font_tag,
337 s_chtml20_start_form_tag,
338 s_chtml20_end_form_tag,
342 s_chtml20_start_input_tag,
343 s_chtml20_end_input_tag,
347 s_chtml20_start_center_tag,
348 s_chtml20_end_center_tag,
352 s_chtml20_start_hr_tag,
353 s_chtml20_end_hr_tag,
357 s_chtml20_start_img_tag,
358 s_chtml20_end_img_tag,
362 s_chtml20_start_select_tag,
363 s_chtml20_end_select_tag,
367 s_chtml20_start_option_tag,
368 s_chtml20_end_option_tag,
372 s_chtml20_start_div_tag,
373 s_chtml20_end_div_tag,
377 s_chtml20_chxjif_tag,
382 s_chtml20_chxjif_tag,
402 s_chtml20_start_span_tag,
403 s_chtml20_end_span_tag,
427 s_chtml20_start_dt_tag,
428 s_chtml20_end_dt_tag,
442 s_chtml20_start_blockquote_tag,
443 s_chtml20_end_blockquote_tag,
447 s_chtml20_start_dir_tag,
448 s_chtml20_end_dir_tag,
452 s_chtml20_start_dl_tag,
453 s_chtml20_end_dl_tag,
457 s_chtml20_start_dd_tag,
458 s_chtml20_end_dd_tag,
462 s_chtml20_start_menu_tag,
463 s_chtml20_end_menu_tag,
467 s_chtml20_start_plaintext_tag,
468 s_chtml20_end_plaintext_tag,
472 s_chtml20_start_blink_tag,
473 s_chtml20_end_blink_tag,
477 s_chtml20_start_marquee_tag,
478 s_chtml20_end_marquee_tag,
487 s_chtml20_newline_mark,
493 * converts from CHTML5.0 to CHTML2.0.
495 * @param r [i] Requet_rec is appointed.
496 * @param spec [i] The result of the device specification processing which
497 * was done in advance is appointed.
498 * @param src [i] The character string before the converting is appointed.
499 * @return The character string after the converting is returned.
502 chxj_convert_chtml20(
508 chxjconvrule_entry *entryp,
517 /*--------------------------------------------------------------------------*/
519 /*--------------------------------------------------------------------------*/
521 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
523 DBG(r,"i found qrcode xml");
526 DBG(r,"not found qrcode xml");
528 /*--------------------------------------------------------------------------*/
529 /* The CHTML structure is initialized. */
530 /*--------------------------------------------------------------------------*/
531 s_init_chtml20(&chtml20, &doc, r, spec);
534 chtml20.entryp = entryp;
535 chtml20.cookie = cookie;
537 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
539 /*--------------------------------------------------------------------------*/
540 /* The character string of the input is analyzed. */
541 /*--------------------------------------------------------------------------*/
542 qs_init_malloc(&doc);
543 qs_init_root_node(&doc);
545 ss = apr_pcalloc(r->pool, srclen + 1);
546 memset(ss, 0, srclen + 1);
547 memcpy(ss, src, srclen);
550 chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
553 if (IS_CSS_ON(chtml20.entryp)) {
554 /* current property list */
555 chtml20.css_prop_stack = chxj_new_prop_list_stack(&doc);
558 qs_parse_string(&doc,ss, strlen(ss));
560 chxj_buffered_write_init(r->pool, &doc.buf);
561 /*--------------------------------------------------------------------------*/
562 /* It converts it from CHTML to CHTML. */
563 /*--------------------------------------------------------------------------*/
564 chxj_node_convert(spec,r,(void *)&chtml20, &doc, qs_get_root(&doc), 0);
565 chtml20.out = chxj_buffered_write_flush(chtml20.out, &doc.buf);
566 dst = apr_pstrdup(r->pool, chtml20.out);
567 chxj_buffered_write_terminate(&doc.buf);
569 qs_all_free(&doc,QX_LOGMARK);
572 return apr_pstrdup(r->pool,ss);
575 if (strlen(dst) == 0) {
576 dst = apr_psprintf(r->pool, "\n");
579 *dstlen = strlen(dst);
582 chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
589 * The CHTML structure is initialized.
591 * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
592 * initialized is specified.
593 * @param doc [i] The Doc structure that should be set to the initialized
594 * HDML structure is specified.
595 * @param r [i] To use POOL, the pointer to request_rec is specified.
596 * @param spec [i] The pointer to the device_table
599 s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
601 memset(doc, 0, sizeof(Doc));
602 memset(chtml20, 0, sizeof(chtml20_t));
606 chtml20->spec = spec;
607 chtml20->out = qs_alloc_zero_byte_string(r->pool);
608 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
610 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
615 * Corresponding EMOJI to a current character-code is retrieved.
616 * The substitution character string is stored in the rslt pointer if agreeing.
618 * @param chtml20 [i] The pointer to the CHTML structure is specified.
619 * @param txt [i] The character string to want to examine whether it is
620 * EMOJI is specified.
621 * @param rslt [o] The pointer to the pointer that stores the result is
623 * @return When corresponding EMOJI exists, it returns it excluding 0.
626 s_chtml20_search_emoji(chtml20_t *chtml20, char *txt, char **rslt)
633 spec = chtml20->spec;
639 DBG(r,"spec is NULL");
641 for (ee = chtml20->conf->emoji;
645 if (ee->imode == NULL) {
646 DBG(r,"emoji->imode is NULL");
650 if (ee->imode->string != NULL
651 && strlen(ee->imode->string) > 0
652 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
653 if (spec == NULL || spec->emoji_type == NULL) {
654 *rslt = apr_palloc(r->pool, 3);
655 (*rslt)[0] = ee->imode->hex1byte & 0xff;
656 (*rslt)[1] = ee->imode->hex2byte & 0xff;
658 return strlen(ee->imode->string);
669 chxj_chtml20_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
680 chtml20 = &__chtml20;
683 DBG(r, "REQ[%X] start chxj_chtml20_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
684 memset(doc, 0, sizeof(Doc));
685 memset(chtml20, 0, sizeof(chtml20_t));
689 chtml20->spec = spec;
690 chtml20->out = qs_alloc_zero_byte_string(r->pool);
691 chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
692 chtml20->doc->parse_mode = PARSE_MODE_CHTML;
694 apr_pool_create(&pool, r->pool);
696 chxj_buffered_write_init(pool, &doc->buf);
698 for (ii=0; ii<len; ii++) {
702 rtn = s_chtml20_search_emoji(chtml20, (char *)&src[ii], &out);
709 if (is_sjis_kanji(src[ii])) {
710 two_byte[0] = src[ii+0];
711 two_byte[1] = src[ii+1];
717 one_byte[0] = src[ii+0];
722 chtml20->out = chxj_buffered_write_flush(chtml20->out, &doc->buf);
724 DBG(r, "REQ[%X] end chxj_chtml20_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
730 * It is a handler who processes the HTML tag.
732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
733 * destination is specified.
734 * @param node [i] The HTML tag node is specified.
735 * @return The conversion result is returned.
738 s_chtml20_start_html_tag(void *pdoc, Node *UNUSED(node))
744 chtml20 = GET_CHTML20(pdoc);
748 /*--------------------------------------------------------------------------*/
750 /*--------------------------------------------------------------------------*/
757 * It is a handler who processes the HTML tag.
759 * @param pdoc [i/o] The pointer to the CHTML structure at the output
760 * destination is specified.
761 * @param node [i] The HTML tag node is specified.
762 * @return The conversion result is returned.
765 s_chtml20_end_html_tag(void *pdoc, Node *UNUSED(child))
771 chtml20 = GET_CHTML20(pdoc);
781 * It is a handler who processes the META tag.
783 * @param pdoc [i/o] The pointer to the CHTML structure at the output
784 * destination is specified.
785 * @param node [i] The META tag node is specified.
786 * @return The conversion result is returned.
789 s_chtml20_start_meta_tag(void *pdoc, Node *node)
795 int content_type_flag;
798 chtml20 = GET_CHTML20(pdoc);
802 content_type_flag = 0;
806 /*--------------------------------------------------------------------------*/
808 /*--------------------------------------------------------------------------*/
809 for (attr = qs_get_attr(doc,node);
811 attr = qs_get_next_attr(doc,attr)) {
812 char *name = qs_get_attr_name(doc,attr);
813 char *value = qs_get_attr_value(doc,attr);
817 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
818 /*----------------------------------------------------------------------*/
820 /*----------------------------------------------------------------------*/
821 W_L(" http-equiv=\"");
824 if (STRCASEEQ('c','C',"content-type", value)) {
825 content_type_flag = 1;
827 if (STRCASEEQ('r','R',"refresh", value)) {
835 if (strcasecmp(name, "content") == 0 && value && *value) {
836 if (content_type_flag) {
840 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
843 else if (refresh_flag) {
844 char *buf = apr_pstrdup(r->pool, value);
848 url = strchr(buf, ';');
850 sec = apr_pstrdup(r->pool, buf);
853 url = chxj_encoding_parameter(r, url, 0);
854 url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
885 * It is a handler who processes the META tag.
887 * @param pdoc [i/o] The pointer to the CHTML structure at the output
888 * destination is specified.
889 * @param node [i] The META tag node is specified.
890 * @return The conversion result is returned.
893 s_chtml20_end_meta_tag(void *pdoc, Node *UNUSED(child))
895 chtml20_t *chtml20 = GET_CHTML20(pdoc);
902 * It is a handler who processes the HEAD tag.
904 * @param pdoc [i/o] The pointer to the CHTML structure at the output
905 * destination is specified.
906 * @param node [i] The HEAD tag node is specified.
907 * @return The conversion result is returned.
910 s_chtml20_start_head_tag(void *pdoc, Node *UNUSED(node))
915 chtml20 = GET_CHTML20(pdoc);
925 * It is a handler who processes the HEAD tag.
927 * @param pdoc [i/o] The pointer to the CHTML structure at the output
928 * destination is specified.
929 * @param node [i] The HEAD tag node is specified.
930 * @return The conversion result is returned.
933 s_chtml20_end_head_tag(void *pdoc, Node *UNUSED(child))
939 chtml20 = GET_CHTML20(pdoc);
950 * It is a handler who processes the TITLE tag.
952 * @param pdoc [i/o] The pointer to the CHTML structure at the output
953 * destination is specified.
954 * @param node [i] The TITLE tag node is specified.
955 * @return The conversion result is returned.
958 s_chtml20_start_title_tag(void *pdoc, Node *UNUSED(node))
964 chtml20 = GET_CHTML20(pdoc);
975 * It is a handler who processes the TITLE tag.
977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
978 * destination is specified.
979 * @param node [i] The TITLE tag node is specified.
980 * @return The conversion result is returned.
983 s_chtml20_end_title_tag(void *pdoc, Node *UNUSED(child))
989 chtml20 = GET_CHTML20(pdoc);
1000 * It is a handler who processes the BASE tag.
1002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The BASE tag node is specified.
1005 * @return The conversion result is returned.
1008 s_chtml20_start_base_tag(void *pdoc, Node *node)
1015 chtml20 = GET_CHTML20(pdoc);
1020 /*--------------------------------------------------------------------------*/
1021 /* Get Attributes */
1022 /*--------------------------------------------------------------------------*/
1023 for (attr = qs_get_attr(doc,node);
1025 attr = qs_get_next_attr(doc,attr)) {
1026 char *name = qs_get_attr_name(doc,attr);
1027 char *value = qs_get_attr_value(doc,attr);
1028 if (STRCASEEQ('h','H',"href", name)) {
1036 return chtml20->out;
1041 * It is a handler who processes the BASE tag.
1043 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1044 * destination is specified.
1045 * @param node [i] The BASE tag node is specified.
1046 * @return The conversion result is returned.
1049 s_chtml20_end_base_tag(void *pdoc, Node *UNUSED(child))
1055 chtml20 = GET_CHTML20(pdoc);
1059 return chtml20->out;
1064 * It is a handler who processes the BODY tag.
1066 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1067 * destination is specified.
1068 * @param node [i] The BODY tag node is specified.
1069 * @return The conversion result is returned.
1072 s_chtml20_start_body_tag(void *pdoc, Node *node)
1078 char *attr_bgcolor = NULL;
1079 char *attr_text = NULL;
1080 char *attr_link = NULL;
1081 char *attr_style = NULL;
1083 chtml20 = GET_CHTML20(pdoc);
1087 /*--------------------------------------------------------------------------*/
1088 /* Get Attributes */
1089 /*--------------------------------------------------------------------------*/
1090 for (attr = qs_get_attr(doc,node);
1092 attr = qs_get_next_attr(doc,attr)) {
1093 char *name = qs_get_attr_name(doc,attr);
1094 char *value = qs_get_attr_value(doc,attr);
1098 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
1099 /*----------------------------------------------------------------------*/
1101 /*----------------------------------------------------------------------*/
1102 attr_bgcolor = value;
1108 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
1109 /*----------------------------------------------------------------------*/
1111 /*----------------------------------------------------------------------*/
1118 if (strcasecmp(name, "style") == 0 && value && *value != 0) {
1125 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
1126 /*----------------------------------------------------------------------*/
1128 /*----------------------------------------------------------------------*/
1135 if (strcasecmp(name, "alink") == 0) {
1136 /*----------------------------------------------------------------------*/
1138 /*----------------------------------------------------------------------*/
1145 if (strcasecmp(name, "vlink") == 0) {
1146 /*----------------------------------------------------------------------*/
1148 /*----------------------------------------------------------------------*/
1157 if (IS_CSS_ON(chtml20->entryp)) {
1158 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
1160 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1161 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1162 css_property_t *cur;
1163 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1164 if (cur->value && *cur->value) {
1165 attr_text = apr_pstrdup(doc->pool, cur->value);
1168 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1169 if (cur->value && *cur->value) {
1170 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1174 if (chtml20->style) {
1175 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml20->style);
1176 css_selector_t *cur_sel;
1177 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1178 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1179 css_property_t *cur;
1180 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1181 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1182 attr_link = apr_pstrdup(doc->pool, cur->value);
1191 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1197 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1203 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1210 return chtml20->out;
1215 * It is a handler who processes the BODY tag.
1217 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1218 * destination is specified.
1219 * @param node [i] The BODY tag node is specified.
1220 * @return The conversion result is returned.
1223 s_chtml20_end_body_tag(void *pdoc, Node *UNUSED(child))
1229 chtml20 = GET_CHTML20(pdoc);
1234 if (IS_CSS_ON(chtml20->entryp)) {
1235 chxj_css_pop_prop_list(chtml20->css_prop_stack);
1238 return chtml20->out;
1243 * It is a handler who processes the A tag.
1245 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1246 * destination is specified.
1247 * @param node [i] The A tag node is specified.
1248 * @return The conversion result is returned.
1251 s_chtml20_start_a_tag(void *pdoc, Node *node)
1257 char *attr_style = NULL;
1259 chtml20 = GET_CHTML20(pdoc);
1264 /*--------------------------------------------------------------------------*/
1265 /* Get Attributes */
1266 /*--------------------------------------------------------------------------*/
1267 for (attr = qs_get_attr(doc,node);
1269 attr = qs_get_next_attr(doc,attr)) {
1270 char *name = qs_get_attr_name(doc,attr);
1271 char *value = qs_get_attr_value(doc,attr);
1275 if (strcasecmp(name, "name") == 0) {
1276 /*--------------------------------------------------------------------*/
1278 /*--------------------------------------------------------------------*/
1287 if (strcasecmp(name, "href") == 0) {
1288 /*--------------------------------------------------------------------*/
1290 /*--------------------------------------------------------------------*/
1291 value = chxj_encoding_parameter(r, value, 0);
1292 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1293 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
1303 if (strcasecmp(name, "accesskey") == 0) {
1304 /*--------------------------------------------------------------------*/
1306 /*--------------------------------------------------------------------*/
1307 W_L(" accesskey=\"");
1315 if (strcasecmp(name, "cti") == 0) {
1316 /*--------------------------------------------------------------------*/
1318 /*--------------------------------------------------------------------*/
1327 if (strcasecmp(name, "ijam") == 0) {
1328 /*--------------------------------------------------------------------*/
1330 /*--------------------------------------------------------------------*/
1334 if (strcasecmp(name, "ista") == 0) {
1335 /*--------------------------------------------------------------------*/
1337 /*--------------------------------------------------------------------*/
1341 if (strcasecmp(name, "ilet") == 0) {
1342 /*--------------------------------------------------------------------*/
1344 /*--------------------------------------------------------------------*/
1348 if (strcasecmp(name, "iswf") == 0) {
1349 /*--------------------------------------------------------------------*/
1351 /*--------------------------------------------------------------------*/
1355 if (strcasecmp(name, "irst") == 0) {
1356 /*--------------------------------------------------------------------*/
1358 /*--------------------------------------------------------------------*/
1365 if (strcasecmp(name, "utn") == 0) {
1366 /*--------------------------------------------------------------------*/
1368 /*--------------------------------------------------------------------*/
1375 if (strcasecmp(name, "telbook") == 0) {
1376 /*--------------------------------------------------------------------*/
1378 /*--------------------------------------------------------------------*/
1385 if (strcasecmp(name, "kana") == 0) {
1386 /*--------------------------------------------------------------------*/
1388 /*--------------------------------------------------------------------*/
1395 if (strcasecmp(name, "email") == 0) {
1396 /*--------------------------------------------------------------------*/
1398 /*--------------------------------------------------------------------*/
1405 if (strcasecmp(name, "style") == 0 && value && *value) {
1416 if (IS_CSS_ON(chtml20->entryp)) {
1417 s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
1420 return chtml20->out;
1425 * It is a handler who processes the A tag.
1427 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1428 * destination is specified.
1429 * @param node [i] The A tag node is specified.
1430 * @return The conversion result is returned.
1433 s_chtml20_end_a_tag(void *pdoc, Node *UNUSED(child))
1439 chtml20 = GET_CHTML20(pdoc);
1444 if (IS_CSS_ON(chtml20->entryp)) {
1445 chxj_css_pop_prop_list(chtml20->css_prop_stack);
1448 return chtml20->out;
1453 * It is a handler who processes the BR tag.
1455 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1456 * destination is specified.
1457 * @param node [i] The BR tag node is specified.
1458 * @return The conversion result is returned.
1461 s_chtml20_start_br_tag(void *pdoc, Node *node)
1468 chtml20 = GET_CHTML20(pdoc);
1473 /*--------------------------------------------------------------------------*/
1474 /* Get Attributes */
1475 /*--------------------------------------------------------------------------*/
1476 for (attr = qs_get_attr(doc,node);
1478 attr = qs_get_next_attr(doc,attr)) {
1479 char *name = qs_get_attr_name(doc,attr);
1480 char *value = qs_get_attr_value(doc,attr);
1481 if (STRCASEEQ('c','C',"clear",name)) {
1482 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1491 return chtml20->out;
1496 * It is a handler who processes the BR tag.
1498 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1499 * destination is specified.
1500 * @param node [i] The BR tag node is specified.
1501 * @return The conversion result is returned.
1504 s_chtml20_end_br_tag(void *pdoc, Node *UNUSED(child))
1510 chtml20 = GET_CHTML20(pdoc);
1514 return chtml20->out;
1519 * It is a handler who processes the TR tag.
1521 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1522 * destination is specified.
1523 * @param node [i] The TR tag node is specified.
1524 * @return The conversion result is returned.
1527 s_chtml20_start_tr_tag(void *pdoc, Node *UNUSED(node))
1533 chtml20 = GET_CHTML20(pdoc);
1537 return chtml20->out;
1542 * It is a handler who processes the TR tag.
1544 * @param chtml20 [i/o] The pointer to the CHTML structure at the output
1545 * destination is specified.
1546 * @param node [i] The TR tag node is specified.
1547 * @return The conversion result is returned.
1550 s_chtml20_end_tr_tag(void *pdoc, Node *UNUSED(child))
1556 chtml20 = GET_CHTML20(pdoc);
1562 return chtml20->out;
1567 * It is a handler who processes the FONT tag.
1569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1570 * destination is specified.
1571 * @param node [i] The FONT tag node is specified.
1572 * @return The conversion result is returned.
1575 s_chtml20_start_font_tag(void *pdoc, Node *node)
1581 char *attr_color = NULL;
1582 char *attr_style = NULL;
1584 chtml20 = GET_CHTML20(pdoc);
1589 /*--------------------------------------------------------------------------*/
1590 /* Get Attributes */
1591 /*--------------------------------------------------------------------------*/
1592 for (attr = qs_get_attr(doc,node);
1594 attr = qs_get_next_attr(doc,attr)) {
1595 char *name = qs_get_attr_name(doc,attr);
1596 char *value = qs_get_attr_value(doc,attr);
1600 if (strcasecmp(name, "color") == 0 && value && *value) {
1601 attr_color = apr_pstrdup(doc->buf.pool, value);
1607 if (strcasecmp(name, "size") == 0) {
1608 /*--------------------------------------------------------------------*/
1610 /*--------------------------------------------------------------------*/
1613 else if (strcasecmp(name, "style") == 0 && value && *value) {
1622 if (IS_CSS_ON(chtml20->entryp)) {
1623 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
1625 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1626 css_property_t *cur;
1627 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1628 if (cur->value && *cur->value) {
1629 attr_color = apr_pstrdup(doc->pool, cur->value);
1635 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1636 W_L("<font color=\"");
1639 chtml20_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
1640 memset(flg, 0, sizeof(*flg));
1641 flg->with_font_flag = 1;
1642 node->userData = flg;
1645 node->userData = NULL;
1647 return chtml20->out;
1652 * It is a handler who processes the FONT tag.
1654 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1655 * destination is specified.
1656 * @param node [i] The FONT tag node is specified.
1657 * @return The conversion result is returned.
1660 s_chtml20_end_font_tag(void *pdoc, Node *node)
1666 chtml20 = GET_CHTML20(pdoc);
1670 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
1671 if (flg && flg->with_font_flag) {
1674 if (IS_CSS_ON(chtml20->entryp)) {
1675 chxj_css_pop_prop_list(chtml20->css_prop_stack);
1677 return chtml20->out;
1682 * It is a handler who processes the FORM tag.
1684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1685 * destination is specified.
1686 * @param node [i] The FORM tag node is specified.
1687 * @return The conversion result is returned.
1690 s_chtml20_start_form_tag(void *pdoc, Node *node)
1696 char *attr_action = NULL;
1697 char *attr_method = NULL;
1698 char *attr_style = NULL;
1699 char *attr_color = NULL;
1700 char *attr_align = NULL;
1701 char *new_hidden_tag = NULL;
1703 chtml20 = GET_CHTML20(pdoc);
1707 /*--------------------------------------------------------------------------*/
1708 /* Get Attributes */
1709 /*--------------------------------------------------------------------------*/
1710 for (attr = qs_get_attr(doc,node);
1712 attr = qs_get_next_attr(doc,attr)) {
1715 name = qs_get_attr_name(doc,attr);
1716 value = qs_get_attr_value(doc,attr);
1721 if (strcasecmp(name, "action") == 0) {
1722 /*--------------------------------------------------------------------*/
1724 /*--------------------------------------------------------------------*/
1725 attr_action = value;
1731 if (strcasecmp(name, "method") == 0) {
1732 /*--------------------------------------------------------------------*/
1734 /*--------------------------------------------------------------------*/
1735 attr_method = value;
1741 if (strcasecmp(name, "utn") == 0) {
1742 /*--------------------------------------------------------------------*/
1744 /*--------------------------------------------------------------------*/
1751 if (strcasecmp(name, "style") == 0) {
1760 if (IS_CSS_ON(chtml20->entryp)) {
1761 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
1763 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1764 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1765 css_property_t *cur;
1766 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1767 if (STRCASEEQ('l','L',"left", cur->value)) {
1768 attr_align = apr_pstrdup(doc->pool, "left");
1770 else if (STRCASEEQ('c','C',"center",cur->value)) {
1771 attr_align = apr_pstrdup(doc->pool, "center");
1773 else if (STRCASEEQ('r','R',"right",cur->value)) {
1774 attr_align = apr_pstrdup(doc->pool, "right");
1777 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1778 attr_color = apr_pstrdup(doc->pool, cur->value);
1783 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1787 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1788 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml20->cookie);
1790 char *new_query_string = NULL;
1791 q = strchr(attr_action, '?');
1793 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml20->entryp);
1794 if (new_hidden_tag || new_query_string) {
1800 if (new_query_string) {
1802 W_V(new_query_string);
1812 if (new_hidden_tag) {
1813 W_V(new_hidden_tag);
1816 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
1817 memset(flg, 0, sizeof(*flg));
1819 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1820 W_L("<font color=\"");
1823 flg->with_font_flag = 1;
1826 W_L("<div align=\"");
1829 flg->with_div_flag = 1;
1831 node->userData = flg;
1833 return chtml20->out;
1838 * It is a handler who processes the FORM tag.
1840 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1841 * destination is specified.
1842 * @param node [i] The FORM tag node is specified.
1843 * @return The conversion result is returned.
1846 s_chtml20_end_form_tag(void *pdoc, Node *node)
1852 chtml20 = GET_CHTML20(pdoc);
1856 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
1857 if (flg && flg->with_div_flag) {
1860 if (flg && flg->with_font_flag) {
1864 if (IS_CSS_ON(chtml20->entryp)) {
1865 chxj_css_pop_prop_list(chtml20->css_prop_stack);
1868 return chtml20->out;
1873 * It is a handler who processes the INPUT tag.
1875 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1876 * destination is specified.
1877 * @param node [i] The INPUT tag node is specified.
1878 * @return The conversion result is returned.
1881 s_chtml20_start_input_tag(void *pdoc, Node *node)
1887 char *attr_accesskey = NULL;
1888 char *attr_max_length = NULL;
1889 char *attr_type = NULL;
1890 char *attr_name = NULL;
1891 char *attr_value = NULL;
1892 char *attr_istyle = NULL;
1893 char *attr_size = NULL;
1894 char *attr_checked = NULL;
1895 char *attr_style = NULL;
1897 chtml20 = GET_CHTML20(pdoc);
1901 /*--------------------------------------------------------------------------*/
1902 /* Get Attributes */
1903 /*--------------------------------------------------------------------------*/
1904 for (attr = qs_get_attr(doc,node);
1906 attr = qs_get_next_attr(doc,attr)) {
1907 char *name = qs_get_attr_name(doc,attr);
1908 char *value = qs_get_attr_value(doc,attr);
1909 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1910 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1911 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1912 STRCASEEQ('p','P',"password",tmp_type) ||
1913 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1914 STRCASEEQ('r','R',"radio", tmp_type) ||
1915 STRCASEEQ('h','H',"hidden", tmp_type) ||
1916 STRCASEEQ('s','S',"submit", tmp_type) ||
1917 STRCASEEQ('r','R',"reset", tmp_type))) {
1918 attr_type = tmp_type;
1921 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1924 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1927 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1928 attr_istyle = value;
1930 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1931 attr_max_length = value;
1933 else if (STRCASEEQ('c','C',"checked", name)) {
1934 attr_checked = value;
1936 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1937 attr_accesskey = value;
1939 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1942 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1947 if (IS_CSS_ON(chtml20->entryp)) {
1948 css_prop_list_t *style = s_chtml20_nopush_and_get_now_style(pdoc, node, attr_style);
1950 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1951 css_property_t *cur;
1952 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1953 if (strcasestr(cur->value, "<ja:n>")) {
1956 else if (strcasestr(cur->value, "<ja:en>")) {
1959 else if (strcasestr(cur->value, "<ja:hk>")) {
1962 else if (strcasestr(cur->value, "<ja:h>")) {
1986 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1987 apr_size_t value_len = strlen(attr_value);
1988 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml20->entryp);
1992 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1995 if (attr_accesskey) {
1996 W_L(" accesskey=\"");
1997 W_V(attr_accesskey);
2001 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
2007 /*--------------------------------------------------------------------------*/
2008 /* The figure is default for the password. */
2009 /*--------------------------------------------------------------------------*/
2010 if (attr_max_length) {
2011 if (chxj_chk_numeric(attr_max_length) != 0) {
2012 attr_max_length = apr_psprintf(doc->buf.pool, "0");
2014 if (attr_istyle && *attr_istyle == '1') {
2015 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
2019 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
2028 return chtml20->out;
2033 * It is a handler who processes the INPUT tag.
2035 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2036 * destination is specified.
2037 * @param node [i] The INPUT tag node is specified.
2038 * @return The conversion result is returned.
2041 s_chtml20_end_input_tag(void *pdoc, Node *UNUSED(node))
2047 chtml20 = GET_CHTML20(pdoc);
2051 return chtml20->out;
2056 * It is a handler who processes the CENTER tag.
2058 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2059 * destination is specified.
2060 * @param node [i] The CENTER tag node is specified.
2061 * @return The conversion result is returned.
2064 s_chtml20_start_center_tag(void *pdoc, Node *node)
2070 char *attr_style = NULL;
2071 char *attr_color = NULL;
2073 chtml20 = GET_CHTML20(pdoc);
2077 for (attr = qs_get_attr(doc,node);
2079 attr = qs_get_next_attr(doc,attr)) {
2080 char *name = qs_get_attr_name(doc,attr);
2081 char *value = qs_get_attr_value(doc,attr);
2082 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2087 if (IS_CSS_ON(chtml20->entryp)) {
2088 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
2090 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2091 css_property_t *cur;
2092 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2093 if (cur->value && *cur->value) {
2094 attr_color = apr_pstrdup(doc->pool, cur->value);
2101 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
2102 memset(flg, 0, sizeof(*flg));
2104 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2105 W_L("<font color=\"");
2108 flg->with_font_flag = 1;
2110 node->userData = flg;
2112 return chtml20->out;
2117 * It is a handler who processes the CENTER tag.
2119 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2120 * destination is specified.
2121 * @param node [i] The CENTER tag node is specified.
2122 * @return The conversion result is returned.
2125 s_chtml20_end_center_tag(void *pdoc, Node *node)
2131 chtml20 = GET_CHTML20(pdoc);
2135 if (IS_CSS_ON(chtml20->entryp)) {
2136 chxj_css_pop_prop_list(chtml20->css_prop_stack);
2138 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
2139 if (flg && flg->with_font_flag) {
2144 return chtml20->out;
2149 * It is a handler who processes the UL tag.
2151 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2152 * destination is specified.
2153 * @param node [i] The UL tag node is specified.
2154 * @return The conversion result is returned.
2157 s_chtml20_start_ul_tag(void *pdoc, Node *node)
2163 char *attr_style = NULL;
2165 chtml20 = GET_CHTML20(pdoc);
2169 for (attr = qs_get_attr(doc,node);
2171 attr = qs_get_next_attr(doc,attr)) {
2172 char *nm = qs_get_attr_name(doc,attr);
2173 char *val = qs_get_attr_value(doc,attr);
2174 if (val && STRCASEEQ('s','S',"style", nm)) {
2179 if (IS_CSS_ON(chtml20->entryp)) {
2180 s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
2185 return chtml20->out;
2190 * It is a handler who processes the UL tag.
2192 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2193 * destination is specified.
2194 * @param node [i] The UL tag node is specified.
2195 * @return The conversion result is returned.
2198 s_chtml20_end_ul_tag(void *pdoc, Node *UNUSED(child))
2204 chtml20 = GET_CHTML20(pdoc);
2208 if (IS_CSS_ON(chtml20->entryp)) {
2209 chxj_css_pop_prop_list(chtml20->css_prop_stack);
2213 return chtml20->out;
2218 * It is a handler who processes the OL tag.
2220 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2221 * destination is specified.
2222 * @param node [i] The OL tag node is specified.
2223 * @return The conversion result is returned.
2226 s_chtml20_start_ol_tag(void *pdoc, Node *node)
2232 char *attr_style = NULL;
2233 char *attr_start = NULL;
2234 char *attr_type = NULL;
2236 chtml20 = GET_CHTML20(pdoc);
2241 /*--------------------------------------------------------------------------*/
2242 /* Get Attributes */
2243 /*--------------------------------------------------------------------------*/
2244 for (attr = qs_get_attr(doc,node);
2246 attr = qs_get_next_attr(doc,attr)) {
2247 char *name = qs_get_attr_name(doc,attr);
2248 char *value = qs_get_attr_value(doc,attr);
2249 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2252 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2255 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2259 if (IS_CSS_ON(chtml20->entryp)) {
2260 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
2262 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2263 css_property_t *cur;
2264 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2265 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2266 attr_type = apr_pstrdup(doc->pool, "1");
2268 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2269 attr_type = apr_pstrdup(doc->pool, "A");
2271 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2272 attr_type = apr_pstrdup(doc->pool, "a");
2290 return chtml20->out;
2295 * It is a handler who processes the OL tag.
2297 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2298 * destination is specified.
2299 * @param node [i] The OL tag node is specified.
2300 * @return The conversion result is returned.
2303 s_chtml20_end_ol_tag(void *pdoc, Node *UNUSED(child))
2309 chtml20 = GET_CHTML20(pdoc);
2314 if (IS_CSS_ON(chtml20->entryp)) {
2315 chxj_css_pop_prop_list(chtml20->css_prop_stack);
2318 return chtml20->out;
2323 * It is a handler who processes the LI tag.
2325 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2326 * destination is specified.
2327 * @param node [i] The LI tag node is specified.
2328 * @return The conversion result is returned.
2331 s_chtml20_start_li_tag(void *pdoc, Node *node)
2337 char *attr_type = NULL;
2338 char *attr_value = NULL;
2339 char *attr_style = NULL;
2341 chtml20 = GET_CHTML20(pdoc);
2345 /*--------------------------------------------------------------------------*/
2346 /* Get Attributes */
2347 /*--------------------------------------------------------------------------*/
2348 for (attr = qs_get_attr(doc,node);
2350 attr = qs_get_next_attr(doc,attr)) {
2351 char *name = qs_get_attr_name(doc,attr);
2352 char *value = qs_get_attr_value(doc,attr);
2353 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2356 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2359 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2363 if (IS_CSS_ON(chtml20->entryp)) {
2364 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
2366 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2367 css_property_t *cur;
2368 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2369 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2370 attr_type = apr_pstrdup(doc->pool, "1");
2372 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2373 attr_type = apr_pstrdup(doc->pool, "A");
2375 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2376 attr_type = apr_pstrdup(doc->pool, "a");
2393 return chtml20->out;
2398 * It is a handler who processes the LI tag.
2400 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2401 * destination is specified.
2402 * @param node [i] The LI tag node is specified.
2403 * @return The conversion result is returned.
2406 s_chtml20_end_li_tag(void *pdoc, Node *UNUSED(child))
2408 chtml20_t *chtml20 = GET_CHTML20(pdoc);
2409 if (IS_CSS_ON(chtml20->entryp)) {
2410 chxj_css_pop_prop_list(chtml20->css_prop_stack);
2412 return chtml20->out;
2417 * It is a handler who processes the HR tag.
2419 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2420 * destination is specified.
2421 * @param node [i] The HR tag node is specified.
2422 * @return The conversion result is returned.
2425 s_chtml20_start_hr_tag(void *pdoc, Node *node)
2431 char *attr_align = NULL;
2432 char *attr_size = NULL;
2433 char *attr_width = NULL;
2434 char *attr_noshade = NULL;
2435 char *attr_style = NULL;
2437 chtml20 = GET_CHTML20(pdoc);
2441 for (attr = qs_get_attr(doc,node);
2443 attr = qs_get_next_attr(doc,attr)) {
2444 char *name = qs_get_attr_name (doc,attr);
2445 char *value = qs_get_attr_value(doc,attr);
2449 if (strcasecmp(name, "align") == 0) {
2450 /*--------------------------------------------------------------------*/
2452 /*--------------------------------------------------------------------*/
2453 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2461 if (strcasecmp(name, "size") == 0) {
2462 /*--------------------------------------------------------------------*/
2464 /*--------------------------------------------------------------------*/
2465 if (value && *value) {
2469 else if (strcasecmp(name, "style") == 0) {
2470 if (value && *value) {
2478 if (strcasecmp(name, "width") == 0) {
2479 /*--------------------------------------------------------------------*/
2481 /*--------------------------------------------------------------------*/
2482 if (value && *value) {
2490 if (strcasecmp(name, "noshade") == 0) {
2491 /*--------------------------------------------------------------------*/
2493 /*--------------------------------------------------------------------*/
2494 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2500 if (strcasecmp(name, "color") == 0) {
2501 /*--------------------------------------------------------------------*/
2503 /*--------------------------------------------------------------------*/
2512 if (IS_CSS_ON(chtml20->entryp)) {
2513 css_prop_list_t *style = s_chtml20_nopush_and_get_now_style(pdoc, node, attr_style);
2515 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2516 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2517 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2518 css_property_t *cur;
2519 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2520 if (STRCASEEQ('s','S',"solid",cur->value)) {
2521 attr_noshade = "noshade";
2524 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2525 char *tmp = apr_pstrdup(doc->pool, cur->value);
2526 char *tmpp = strstr(tmp, "px");
2529 attr_size = apr_pstrdup(doc->pool, tmp);
2532 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2533 char *tmp = apr_pstrdup(doc->pool, cur->value);
2534 char *tmpp = strstr(tmp, "px");
2537 attr_width = apr_pstrdup(doc->pool, tmp);
2540 tmpp = strstr(tmp, "%");
2542 attr_width = apr_pstrdup(doc->pool, tmp);
2568 return chtml20->out;
2573 * It is a handler who processes the HR tag.
2575 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2576 * destination is specified.
2577 * @param node [i] The HR tag node is specified.
2578 * @return The conversion result is returned.
2581 s_chtml20_end_hr_tag(void *pdoc, Node *UNUSED(child))
2583 chtml20_t *chtml20 = GET_CHTML20(pdoc);
2584 return chtml20->out;
2589 * It is a handler who processes the IMG tag.
2591 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2592 * destination is specified.
2593 * @param node [i] The IMG tag node is specified.
2594 * @return The conversion result is returned.
2597 s_chtml20_start_img_tag(void *pdoc, Node *node)
2603 char *attr_src = NULL;
2604 char *attr_align = NULL;
2605 char *attr_style = NULL;
2606 char *attr_alt = NULL;
2607 char *attr_width = NULL;
2608 char *attr_height = NULL;
2609 char *attr_hspace = NULL;
2610 char *attr_vspace = NULL;
2611 #ifndef IMG_NOT_CONVERT_FILENAME
2615 chtml20 = GET_CHTML20(pdoc);
2616 #ifndef IMG_NOT_CONVERT_FILENAME
2617 spec = chtml20->spec;
2622 /*--------------------------------------------------------------------------*/
2623 /* Get Attributes */
2624 /*--------------------------------------------------------------------------*/
2625 for (attr = qs_get_attr(doc,node);
2627 attr = qs_get_next_attr(doc,attr)) {
2628 char *name = qs_get_attr_name (doc,attr);
2629 char *value = qs_get_attr_value(doc,attr);
2633 if (strcasecmp(name, "src") == 0) {
2634 /*--------------------------------------------------------------------*/
2636 /*--------------------------------------------------------------------*/
2637 #ifdef IMG_NOT_CONVERT_FILENAME
2638 value = chxj_encoding_parameter(r, value, 0);
2639 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2640 value = chxj_add_cookie_no_update_parameter(r, value);
2643 value = chxj_img_conv(r, spec, value);
2644 value = chxj_encoding_parameter(r, value, 0);
2645 value = chxj_add_cookie_parameter(r, value, chtml20->cookie);
2646 value = chxj_add_cookie_no_update_parameter(r, value);
2650 else if (strcasecmp(name,"style") == 0 && value && *value) {
2657 if (strcasecmp(name, "align" ) == 0) {
2658 /*--------------------------------------------------------------------*/
2660 /*--------------------------------------------------------------------*/
2661 /*--------------------------------------------------------------------*/
2663 /*--------------------------------------------------------------------*/
2665 if (STRCASEEQ('t','T',"top", value) ||
2666 STRCASEEQ('m','M',"middle",value) ||
2667 STRCASEEQ('b','B',"bottom",value) ||
2668 STRCASEEQ('l','L',"left", value) ||
2669 STRCASEEQ('r','R',"right", value)) {
2672 else if (STRCASEEQ('c','C',"center", value)) {
2673 attr_align = apr_pstrdup(doc->pool, "middle");
2677 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2678 /*--------------------------------------------------------------------*/
2680 /*--------------------------------------------------------------------*/
2687 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2688 /*--------------------------------------------------------------------*/
2690 /*--------------------------------------------------------------------*/
2697 if (strcasecmp(name, "height") == 0 && value && *value) {
2698 /*--------------------------------------------------------------------*/
2700 /*--------------------------------------------------------------------*/
2701 attr_height = value;
2704 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2705 /*--------------------------------------------------------------------*/
2707 /*--------------------------------------------------------------------*/
2708 attr_hspace = value;
2714 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2715 /*--------------------------------------------------------------------*/
2717 /*--------------------------------------------------------------------*/
2718 attr_vspace = value;
2727 if (IS_CSS_ON(chtml20->entryp)) {
2728 css_prop_list_t *style = s_chtml20_nopush_and_get_now_style(pdoc, node, attr_style);
2730 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2731 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2732 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2733 css_property_t *cur;
2734 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2735 attr_height = apr_pstrdup(doc->pool, cur->value);
2737 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2738 attr_width = apr_pstrdup(doc->pool, cur->value);
2740 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2741 attr_align = apr_pstrdup(doc->pool, cur->value);
2783 return chtml20->out;
2788 * It is a handler who processes the IMG tag.
2790 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2791 * destination is specified.
2792 * @param node [i] The IMG tag node is specified.
2793 * @return The conversion result is returned.
2796 s_chtml20_end_img_tag(void *pdoc, Node *UNUSED(child))
2798 chtml20_t *chtml20 = GET_CHTML20(pdoc);
2800 return chtml20->out;
2805 * It is a handler who processes the SELECT tag.
2807 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2808 * destination is specified.
2809 * @param node [i] The SELECT tag node is specified.
2810 * @return The conversion result is returned.
2813 s_chtml20_start_select_tag(void *pdoc, Node *node)
2819 char *attr_style = NULL;
2821 chtml20 = GET_CHTML20(pdoc);
2827 char *multiple = NULL;
2830 for (attr = qs_get_attr(doc,node);
2832 attr = qs_get_next_attr(doc,attr)) {
2833 char *nm = qs_get_attr_name(doc,attr);
2834 char *val = qs_get_attr_value(doc,attr);
2838 if (strcasecmp(nm, "size") == 0) {
2839 /*--------------------------------------------------------------------*/
2840 /* CHTML 1.0 version 2.0 */
2841 /*--------------------------------------------------------------------*/
2842 size = apr_pstrdup(doc->buf.pool, val);
2844 else if (strcasecmp(nm, "style") == 0 && val && *val) {
2845 /*--------------------------------------------------------------------*/
2846 /* CHTML 1.0 version 2.0 */
2847 /*--------------------------------------------------------------------*/
2848 attr_style = apr_pstrdup(doc->buf.pool, val);
2854 if (strcasecmp(nm, "name") == 0) {
2855 /*--------------------------------------------------------------------*/
2856 /* CHTML 1.0 version 2.0 */
2857 /*--------------------------------------------------------------------*/
2858 name = apr_pstrdup(doc->buf.pool, val);
2864 if (strcasecmp(nm, "multiple") == 0) {
2865 /*--------------------------------------------------------------------*/
2866 /* CHTML 1.0 version 2.0 */
2867 /*--------------------------------------------------------------------*/
2868 multiple = apr_pstrdup(doc->buf.pool, val);
2876 if (size && *size) {
2881 if (name && *name) {
2890 if (IS_CSS_ON(chtml20->entryp)) {
2891 s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
2893 return chtml20->out;
2898 * It is a handler who processes the SELECT tag.
2900 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2901 * destination is specified.
2902 * @param node [i] The SELECT tag node is specified.
2903 * @return The conversion result is returned.
2906 s_chtml20_end_select_tag(void *pdoc, Node *UNUSED(child))
2911 chtml20 = GET_CHTML20(pdoc);
2915 if (IS_CSS_ON(chtml20->entryp)) {
2916 chxj_css_pop_prop_list(chtml20->css_prop_stack);
2918 return chtml20->out;
2923 * It is a handler who processes the OPTION tag.
2925 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2926 * destination is specified.
2927 * @param node [i] The OPTION tag node is specified.
2928 * @return The conversion result is returned.
2931 s_chtml20_start_option_tag(void *pdoc, Node *node)
2937 char *attr_style = NULL;
2939 chtml20 = GET_CHTML20(pdoc);
2943 char *selected = NULL;
2947 for (attr = qs_get_attr(doc,node);
2949 attr = qs_get_next_attr(doc,attr)) {
2950 char *nm = qs_get_attr_name(doc,attr);
2951 char *val = qs_get_attr_value(doc,attr);
2955 if (strcasecmp(nm, "selected") == 0) {
2956 /*--------------------------------------------------------------------*/
2957 /* CHTML 1.0 version 2.0 */
2958 /*--------------------------------------------------------------------*/
2959 selected = apr_pstrdup(doc->buf.pool, val);
2961 else if (strcasecmp(nm, "style") == 0 && val && *val) {
2962 /*--------------------------------------------------------------------*/
2963 /* CHTML 1.0 version 2.0 */
2964 /*--------------------------------------------------------------------*/
2965 attr_style = apr_pstrdup(doc->buf.pool, val);
2971 if (strcasecmp(nm, "value") == 0) {
2972 /*--------------------------------------------------------------------*/
2973 /* CHTML 1.0 version 2.0 */
2974 /*--------------------------------------------------------------------*/
2975 value = apr_pstrdup(doc->buf.pool, val);
2994 if (IS_CSS_ON(chtml20->entryp)) {
2995 s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
2997 return chtml20->out;
3002 * It is a handler who processes the OPTION tag.
3004 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3005 * destination is specified.
3006 * @param node [i] The OPTION tag node is specified.
3007 * @return The conversion result is returned.
3010 s_chtml20_end_option_tag(void *pdoc, Node *UNUSED(child))
3012 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3015 if (IS_CSS_ON(chtml20->entryp)) {
3016 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3019 return chtml20->out;
3024 * It is a handler who processes the DIV tag.
3026 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3027 * destination is specified.
3028 * @param node [i] The DIV tag node is specified.
3029 * @return The conversion result is returned.
3032 s_chtml20_start_div_tag(void *pdoc, Node *node)
3038 char *attr_style = NULL;
3039 char *attr_align = NULL;
3040 char *attr_display = NULL;
3041 char *attr_decoration = NULL;
3042 char *attr_wap_marquee_style = NULL;
3043 char *attr_wap_marquee_dir = NULL;
3044 char *attr_wap_marquee_loop = NULL;
3045 char *attr_color = NULL;
3046 char *attr_bgcolor = NULL;
3048 chtml20 = GET_CHTML20(pdoc);
3052 for (attr = qs_get_attr(doc,node);
3054 attr = qs_get_next_attr(doc,attr)) {
3055 char *nm = qs_get_attr_name(doc,attr);
3056 char *val = qs_get_attr_value(doc,attr);
3057 if (STRCASEEQ('a','A', "align", nm)) {
3058 /*----------------------------------------------------------------------*/
3059 /* CHTML 1.0 (W3C version 3.2) */
3060 /*----------------------------------------------------------------------*/
3061 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3062 attr_align = apr_pstrdup(doc->buf.pool, val);
3065 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3066 attr_style = apr_pstrdup(doc->buf.pool, val);
3070 if (IS_CSS_ON(chtml20->entryp)) {
3071 css_prop_list_t *style = s_chtml20_nopush_and_get_now_style(pdoc, node, attr_style);
3073 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3074 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3075 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3076 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3077 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3078 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3080 css_property_t *cur;
3081 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3082 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3083 attr_display = apr_pstrdup(doc->pool, cur->value);
3086 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3087 if (STRCASEEQ('b','B',"blink", cur->value)) {
3088 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3091 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3092 attr_color = apr_pstrdup(doc->pool, cur->value);
3094 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3095 attr_align = apr_pstrdup(doc->pool, cur->value);
3097 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3098 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3099 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3101 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3102 char *ss = strchr(cur->value, '#');
3104 ss = strstr(cur->value, "rgb");
3107 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3108 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3112 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3113 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3114 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3115 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3116 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3117 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3120 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3121 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3122 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
3124 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3125 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
3128 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3129 if (STRCASEEQ('i','I',"infinite",cur->value)) {
3130 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
3133 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3139 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
3140 memset(flg, 0, sizeof(*flg));
3147 flg->with_div_flag = 1;
3151 flg->with_div_flag = 1;
3154 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
3158 W_L("<font color=\"");
3161 flg->with_font_flag = 1;
3164 if (attr_decoration) {
3166 flg->with_blink_flag = 1;
3170 if (attr_wap_marquee_style) {
3171 W_L(" behavior=\"");
3172 W_V(attr_wap_marquee_style);
3175 if (attr_wap_marquee_dir) {
3176 W_L(" direction=\"");
3177 W_V(attr_wap_marquee_dir);
3180 if (attr_wap_marquee_loop) {
3182 W_V(attr_wap_marquee_loop);
3186 flg->with_marquee_flag = 1;
3188 node->userData = flg;
3190 return chtml20->out;
3195 * It is a handler who processes the DIV tag.
3197 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3198 * destination is specified.
3199 * @param node [i] The DIV tag node is specified.
3200 * @return The conversion result is returned.
3203 s_chtml20_end_div_tag(void *pdoc, Node *node)
3205 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3206 Doc *doc = chtml20->doc;
3208 chtml20_flags_t *flg = node->userData;
3209 if (flg && flg->with_marquee_flag) {
3212 if (flg && flg->with_blink_flag) {
3215 if (flg && flg->with_font_flag) {
3218 if (flg && flg->with_div_flag) {
3221 if (IS_CSS_ON(chtml20->entryp)) {
3222 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3224 node->userData = NULL;
3226 return chtml20->out;
3231 * It is a handler who processes the H1 tag.
3233 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3234 * destination is specified.
3235 * @param node [i] The H1 tag node is specified.
3236 * @return The conversion result is returned.
3239 s_chtml20_start_h1_tag(void *pdoc, Node *node)
3245 char *attr_style = NULL;
3246 char *attr_align = NULL;
3249 chtml20 = GET_CHTML20(pdoc);
3253 for (attr = qs_get_attr(doc,node);
3255 attr = qs_get_next_attr(doc,attr)) {
3256 char *name = qs_get_attr_name(doc,attr);
3257 char *value = qs_get_attr_value(doc,attr);
3258 if (STRCASEEQ('a','A',"align", name)) {
3259 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3263 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3267 if (IS_CSS_ON(chtml20->entryp)) {
3268 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3270 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3271 css_property_t *cur;
3272 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3273 if (STRCASEEQ('l','L',"left", cur->value)) {
3274 attr_align = apr_pstrdup(doc->pool, "left");
3276 else if (STRCASEEQ('c','C',"center",cur->value)) {
3277 attr_align = apr_pstrdup(doc->pool, "center");
3279 else if (STRCASEEQ('r','R',"right",cur->value)) {
3280 attr_align = apr_pstrdup(doc->pool, "right");
3293 return chtml20->out;
3298 * It is a handler who processes the H1 tag.
3300 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3301 * destination is specified.
3302 * @param node [i] The H1 tag node is specified.
3303 * @return The conversion result is returned.
3306 s_chtml20_end_h1_tag(void *pdoc, Node *UNUSED(child))
3311 chtml20 = GET_CHTML20(pdoc);
3315 if (IS_CSS_ON(chtml20->entryp)) {
3316 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3319 return chtml20->out;
3324 * It is a handler who processes the H2 tag.
3326 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3327 * destination is specified.
3328 * @param node [i] The H2 tag node is specified.
3329 * @return The conversion result is returned.
3332 s_chtml20_start_h2_tag(void *pdoc, Node *node)
3338 char *attr_style = NULL;
3339 char *attr_align = NULL;
3341 chtml20 = GET_CHTML20(pdoc);
3345 for (attr = qs_get_attr(doc,node);
3347 attr = qs_get_next_attr(doc,attr)) {
3348 char *name = qs_get_attr_name(doc,attr);
3349 char *value = qs_get_attr_value(doc,attr);
3350 if (STRCASEEQ('a','A',"align", name)) {
3351 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3355 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3359 if (IS_CSS_ON(chtml20->entryp)) {
3360 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3362 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3363 css_property_t *cur;
3364 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3365 if (STRCASEEQ('l','L',"left", cur->value)) {
3366 attr_align = apr_pstrdup(doc->pool, "left");
3368 else if (STRCASEEQ('c','C',"center",cur->value)) {
3369 attr_align = apr_pstrdup(doc->pool, "center");
3371 else if (STRCASEEQ('r','R',"right",cur->value)) {
3372 attr_align = apr_pstrdup(doc->pool, "right");
3385 return chtml20->out;
3390 * It is a handler who processes the H2 tag.
3392 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3393 * destination is specified.
3394 * @param node [i] The H2 tag node is specified.
3395 * @return The conversion result is returned.
3398 s_chtml20_end_h2_tag(void *pdoc, Node *UNUSED(child))
3400 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3401 Doc *doc = chtml20->doc;
3404 if (IS_CSS_ON(chtml20->entryp)) {
3405 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3408 return chtml20->out;
3413 * It is a handler who processes the H3 tag.
3415 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3416 * destination is specified.
3417 * @param node [i] The H3 tag node is specified.
3418 * @return The conversion result is returned.
3421 s_chtml20_start_h3_tag(void *pdoc, Node *node)
3427 char *attr_style = NULL;
3428 char *attr_align = NULL;
3430 chtml20 = GET_CHTML20(pdoc);
3434 for (attr = qs_get_attr(doc,node);
3436 attr = qs_get_next_attr(doc,attr)) {
3437 char *name = qs_get_attr_name(doc,attr);
3438 char *value = qs_get_attr_value(doc,attr);
3439 if (STRCASEEQ('a','A',"align", name)) {
3440 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3444 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3448 if (IS_CSS_ON(chtml20->entryp)) {
3449 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3451 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3452 css_property_t *cur;
3453 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3454 if (STRCASEEQ('l','L',"left", cur->value)) {
3455 attr_align = apr_pstrdup(doc->pool, "left");
3457 else if (STRCASEEQ('c','C',"center",cur->value)) {
3458 attr_align = apr_pstrdup(doc->pool, "center");
3460 else if (STRCASEEQ('r','R',"right",cur->value)) {
3461 attr_align = apr_pstrdup(doc->pool, "right");
3480 return chtml20->out;
3485 * It is a handler who processes the H3 tag.
3487 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3488 * destination is specified.
3489 * @param node [i] The H3 tag node is specified.
3490 * @return The conversion result is returned.
3493 s_chtml20_end_h3_tag(void *pdoc, Node *UNUSED(child))
3495 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3496 Doc *doc = chtml20->doc;
3499 if (IS_CSS_ON(chtml20->entryp)) {
3500 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3503 return chtml20->out;
3508 * It is a handler who processes the H4 tag.
3510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3511 * destination is specified.
3512 * @param node [i] The H4 tag node is specified.
3513 * @return The conversion result is returned.
3516 s_chtml20_start_h4_tag(void *pdoc, Node *node)
3522 char *attr_style = NULL;
3523 char *attr_align = NULL;
3525 chtml20 = GET_CHTML20(pdoc);
3529 for (attr = qs_get_attr(doc,node);
3531 attr = qs_get_next_attr(doc,attr)) {
3532 char *name = qs_get_attr_name(doc,attr);
3533 char *value = qs_get_attr_value(doc,attr);
3534 if (STRCASEEQ('a','A',"align", name)) {
3535 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3539 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3543 if (IS_CSS_ON(chtml20->entryp)) {
3544 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3546 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3547 css_property_t *cur;
3548 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3549 if (STRCASEEQ('l','L',"left", cur->value)) {
3550 attr_align = apr_pstrdup(doc->pool, "left");
3552 else if (STRCASEEQ('c','C',"center",cur->value)) {
3553 attr_align = apr_pstrdup(doc->pool, "center");
3555 else if (STRCASEEQ('r','R',"right",cur->value)) {
3556 attr_align = apr_pstrdup(doc->pool, "right");
3569 return chtml20->out;
3574 * It is a handler who processes the H4 tag.
3576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3577 * destination is specified.
3578 * @param node [i] The H4 tag node is specified.
3579 * @return The conversion result is returned.
3582 s_chtml20_end_h4_tag(void *pdoc, Node *UNUSED(child))
3584 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3585 Doc *doc = chtml20->doc;
3588 if (IS_CSS_ON(chtml20->entryp)) {
3589 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3592 return chtml20->out;
3597 * It is a handler who processes the H5 tag.
3599 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3600 * destination is specified.
3601 * @param node [i] The H5 tag node is specified.
3602 * @return The conversion result is returned.
3605 s_chtml20_start_h5_tag(void *pdoc, Node *node)
3611 char *attr_style = NULL;
3612 char *attr_align = NULL;
3614 chtml20 = GET_CHTML20(pdoc);
3618 for (attr = qs_get_attr(doc,node);
3620 attr = qs_get_next_attr(doc,attr)) {
3621 char *name = qs_get_attr_name(doc,attr);
3622 char *value = qs_get_attr_value(doc,attr);
3623 if (STRCASEEQ('a','A',"align", name)) {
3624 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3628 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3632 if (IS_CSS_ON(chtml20->entryp)) {
3633 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3635 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3636 css_property_t *cur;
3637 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3638 if (STRCASEEQ('l','L',"left", cur->value)) {
3639 attr_align = apr_pstrdup(doc->pool, "left");
3641 else if (STRCASEEQ('c','C',"center",cur->value)) {
3642 attr_align = apr_pstrdup(doc->pool, "center");
3644 else if (STRCASEEQ('r','R',"right",cur->value)) {
3645 attr_align = apr_pstrdup(doc->pool, "right");
3658 return chtml20->out;
3663 * It is a handler who processes the H5 tag.
3665 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3666 * destination is specified.
3667 * @param node [i] The H5 tag node is specified.
3668 * @return The conversion result is returned.
3671 s_chtml20_end_h5_tag(void *pdoc, Node *UNUSED(child))
3673 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3674 Doc *doc = chtml20->doc;
3677 if (IS_CSS_ON(chtml20->entryp)) {
3678 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3681 return chtml20->out;
3686 * It is a handler who processes the H6 tag.
3688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3689 * destination is specified.
3690 * @param node [i] The H6 tag node is specified.
3691 * @return The conversion result is returned.
3694 s_chtml20_start_h6_tag(void *pdoc, Node *node)
3700 char *attr_style = NULL;
3701 char *attr_align = NULL;
3703 chtml20 = GET_CHTML20(pdoc);
3707 for (attr = qs_get_attr(doc,node);
3709 attr = qs_get_next_attr(doc,attr)) {
3710 char *name = qs_get_attr_name(doc,attr);
3711 char *value = qs_get_attr_value(doc,attr);
3712 if (STRCASEEQ('a','A',"align", name)) {
3713 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3717 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3721 if (IS_CSS_ON(chtml20->entryp)) {
3722 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3724 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3725 css_property_t *cur;
3726 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3727 if (STRCASEEQ('l','L',"left", cur->value)) {
3728 attr_align = apr_pstrdup(doc->pool, "left");
3730 else if (STRCASEEQ('c','C',"center",cur->value)) {
3731 attr_align = apr_pstrdup(doc->pool, "center");
3733 else if (STRCASEEQ('r','R',"right",cur->value)) {
3734 attr_align = apr_pstrdup(doc->pool, "right");
3747 return chtml20->out;
3752 * It is a handler who processes the H6 tag.
3754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3755 * destination is specified.
3756 * @param node [i] The H6 tag node is specified.
3757 * @return The conversion result is returned.
3760 s_chtml20_end_h6_tag(void *pdoc, Node *UNUSED(child))
3762 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3763 Doc *doc = chtml20->doc;
3766 if (IS_CSS_ON(chtml20->entryp)) {
3767 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3770 return chtml20->out;
3775 * It is a handler who processes the PRE tag.
3777 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3778 * destination is specified.
3779 * @param node [i] The PRE tag node is specified.
3780 * @return The conversion result is returned.
3783 s_chtml20_start_pre_tag(void *pdoc, Node *node)
3785 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3786 Doc *doc = chtml20->doc;
3788 char *attr_style = NULL;
3790 for (attr = qs_get_attr(doc,node);
3792 attr = qs_get_next_attr(doc,attr)) {
3793 char *nm = qs_get_attr_name(doc,attr);
3794 char *val = qs_get_attr_value(doc,attr);
3795 if (val && STRCASEEQ('s','S',"style", nm)) {
3800 if (IS_CSS_ON(chtml20->entryp)) {
3801 s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3803 chtml20->pre_flag++;
3805 return chtml20->out;
3810 * It is a handler who processes the PRE tag.
3812 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3813 * destination is specified.
3814 * @param node [i] The PRE tag node is specified.
3815 * @return The conversion result is returned.
3818 s_chtml20_end_pre_tag(void *pdoc, Node *UNUSED(child))
3820 chtml20_t *chtml20 = GET_CHTML20(pdoc);
3821 Doc *doc = chtml20->doc;
3824 chtml20->pre_flag--;
3825 if (IS_CSS_ON(chtml20->entryp)) {
3826 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3829 return chtml20->out;
3834 * It is a handler who processes the P tag.
3836 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3837 * destination is specified.
3838 * @param node [i] The P tag node is specified.
3839 * @return The conversion result is returned.
3842 s_chtml20_start_p_tag(void *pdoc, Node *node)
3848 char *attr_align = NULL;
3849 char *attr_style = NULL;
3850 char *attr_color = NULL;
3851 char *attr_blink = NULL;
3853 chtml20 = GET_CHTML20(pdoc);
3857 for (attr = qs_get_attr(doc,node);
3859 attr = qs_get_next_attr(doc,attr)) {
3860 char *nm = qs_get_attr_name(doc,attr);
3861 char *val = qs_get_attr_value(doc,attr);
3862 if (STRCASEEQ('a','A',"align", nm)) {
3863 /*----------------------------------------------------------------------*/
3864 /* CHTML 1.0 (W3C version 3.2) */
3865 /*----------------------------------------------------------------------*/
3866 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3867 attr_align = apr_pstrdup(doc->buf.pool, val);
3871 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3872 attr_style = apr_pstrdup(doc->buf.pool, val);
3875 if (IS_CSS_ON(chtml20->entryp)) {
3876 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
3878 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3879 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3880 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3881 css_property_t *cur;
3882 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3883 if (STRCASEEQ('l','L',"left",cur->value)) {
3884 attr_align = apr_pstrdup(doc->pool, "left");
3886 else if (STRCASEEQ('c','C',"center",cur->value)) {
3887 attr_align = apr_pstrdup(doc->pool, "center");
3889 else if (STRCASEEQ('r','R',"right",cur->value)) {
3890 attr_align = apr_pstrdup(doc->pool, "right");
3893 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3894 if (cur->value && *cur->value) {
3895 attr_color = apr_pstrdup(doc->pool, cur->value);
3898 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3899 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3900 attr_blink = apr_pstrdup(doc->pool, cur->value);
3912 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
3913 memset(flg, 0, sizeof(*flg));
3915 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3916 W_L("<font color=\"");
3919 flg->with_font_flag = 1;
3923 flg->with_blink_flag = 1;
3925 node->userData = (void *)flg;
3926 return chtml20->out;
3931 * It is a handler who processes the P tag.
3933 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3934 * destination is specified.
3935 * @param node [i] The P tag node is specified.
3936 * @return The conversion result is returned.
3939 s_chtml20_end_p_tag(void *pdoc, Node *node)
3945 chtml20 = GET_CHTML20(pdoc);
3949 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
3950 if (flg && flg->with_font_flag) {
3953 if (flg && flg->with_blink_flag) {
3957 if (IS_CSS_ON(chtml20->entryp)) {
3958 chxj_css_pop_prop_list(chtml20->css_prop_stack);
3960 return chtml20->out;
3965 s_chtml20_chxjif_tag(void *pdoc, Node *node)
3972 chtml20 = GET_CHTML20(pdoc);
3976 for (child = qs_get_child_node(doc, node);
3978 child = qs_get_next_node(doc, child)) {
3981 s_chtml20_chxjif_tag(pdoc, child);
3989 * It is a handler who processes the TEXTARE tag.
3991 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3992 * destination is specified.
3993 * @param node [i] The TEXTAREA tag node is specified.
3994 * @return The conversion result is returned.
3997 s_chtml20_start_textarea_tag(void *pdoc, Node *node)
4003 char *attr_accesskey = NULL;
4004 char *attr_name = NULL;
4005 char *attr_rows = NULL;
4006 char *attr_cols = NULL;
4007 char *attr_istyle = NULL;
4008 char *attr_style = NULL;
4010 chtml20 = GET_CHTML20(pdoc);
4014 chtml20->textarea_flag++;
4015 for (attr = qs_get_attr(doc,node);
4017 attr = qs_get_next_attr(doc,attr)) {
4018 char *name = qs_get_attr_name(doc,attr);
4019 char *value = qs_get_attr_value(doc,attr);
4023 if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
4024 attr_accesskey = value;
4030 if (strcasecmp(name, "name") == 0 && value && *value != 0) {
4037 if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
4044 if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
4051 if (strcasecmp(name, "istyle") == 0 && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4052 attr_istyle = value;
4057 if (strcasecmp(name, "style") == 0 && value && *value) {
4067 if (IS_CSS_ON(chtml20->entryp)) {
4068 css_prop_list_t *style = s_chtml20_nopush_and_get_now_style(pdoc, node, attr_style);
4070 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4071 css_property_t *cur;
4072 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4073 if (strcasestr(cur->value, "<ja:n>")) {
4076 else if (strcasestr(cur->value, "<ja:en>")) {
4079 else if (strcasestr(cur->value, "<ja:hk>")) {
4082 else if (strcasestr(cur->value, "<ja:h>")) {
4090 if (attr_accesskey) {
4091 W_L(" accesskey=\"");
4092 W_V(attr_accesskey);
4116 return chtml20->out;
4121 * It is a handler who processes the TEXTAREA tag.
4123 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4124 * destination is specified.
4125 * @param node [i] The TEXTAREA tag node is specified.
4126 * @return The conversion result is returned.
4129 s_chtml20_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4131 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4132 Doc *doc = chtml20->doc;
4135 chtml20->textarea_flag--;
4137 return chtml20->out;
4142 s_chtml20_text_tag(void *pdoc, Node *child)
4153 apr_size_t z2h_input_len;
4155 chtml20 = GET_CHTML20(pdoc);
4159 textval = qs_get_node_value(doc,child);
4160 if (strlen(textval) == 0) {
4161 return chtml20->out;
4164 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4165 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4167 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4168 memset(one_byte, 0, sizeof(one_byte));
4171 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4173 int rtn = s_chtml20_search_emoji(chtml20, &textval[ii], &out);
4175 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4179 if (is_sjis_kanji(textval[ii])) {
4180 one_byte[0] = textval[ii+0];
4181 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4182 one_byte[0] = textval[ii+1];
4183 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4187 if (chtml20->pre_flag) {
4188 one_byte[0] = textval[ii+0];
4189 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4192 if (chtml20->textarea_flag) {
4193 one_byte[0] = textval[ii+0];
4194 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4197 if (textval[ii] != '\r' && textval[ii] != '\n') {
4198 one_byte[0] = textval[ii+0];
4199 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4202 z2h_input_len = strlen(tdst);
4203 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml20->entryp);
4206 return chtml20->out;
4211 * It is a handler who processes the BLOCKQUOTE tag.
4213 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4214 * destination is specified.
4215 * @param node [i] The BLOCKQUOTE tag node is specified.
4216 * @return The conversion result is returned.
4219 s_chtml20_start_blockquote_tag(void *pdoc, Node *node)
4224 char *attr_style = NULL;
4225 char *attr_color = NULL;
4227 chtml20 = GET_CHTML20(pdoc);
4229 for (attr = qs_get_attr(doc,node);
4231 attr = qs_get_next_attr(doc,attr)) {
4232 char *nm = qs_get_attr_name(doc,attr);
4233 char *val = qs_get_attr_value(doc,attr);
4234 if (val && STRCASEEQ('s','S',"style", nm)) {
4238 if (IS_CSS_ON(chtml20->entryp)) {
4239 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
4241 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4242 css_property_t *cur;
4243 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4244 if (cur->value && *cur->value) {
4245 attr_color = apr_pstrdup(doc->pool, cur->value);
4250 W_L("<blockquote>");
4251 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
4252 memset(flg, 0, sizeof(*flg));
4254 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4255 W_L("<font color=\"");
4258 flg->with_font_flag = 1;
4260 node->userData = (void *)flg;
4261 return chtml20->out;
4266 * It is a handler who processes the BLOCKQUOTE tag.
4268 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4269 * destination is specified.
4270 * @param node [i] The BLOCKQUOTE tag node is specified.
4271 * @return The conversion result is returned.
4274 s_chtml20_end_blockquote_tag(void *pdoc, Node *node)
4276 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4277 Doc *doc = chtml20->doc;
4278 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
4279 if (flg && flg->with_font_flag) {
4282 W_L("</blockquote>");
4283 if (IS_CSS_ON(chtml20->entryp)) {
4284 chxj_css_pop_prop_list(chtml20->css_prop_stack);
4286 return chtml20->out;
4291 * It is a handler who processes the DIR tag.
4293 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4294 * destination is specified.
4295 * @param node [i] The DIR tag node is specified.
4296 * @return The conversion result is returned.
4299 s_chtml20_start_dir_tag(void *pdoc, Node *node)
4304 char *attr_style = NULL;
4305 char *attr_color = NULL;
4307 chtml20 = GET_CHTML20(pdoc);
4309 for (attr = qs_get_attr(doc,node);
4311 attr = qs_get_next_attr(doc,attr)) {
4312 char *nm = qs_get_attr_name(doc,attr);
4313 char *val = qs_get_attr_value(doc,attr);
4314 if (val && STRCASEEQ('s','S',"style", nm)) {
4318 if (IS_CSS_ON(chtml20->entryp)) {
4319 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
4321 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4322 css_property_t *cur;
4323 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4324 if (cur->value && *cur->value) {
4325 attr_color = apr_pstrdup(doc->pool, cur->value);
4331 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
4332 memset(flg, 0, sizeof(*flg));
4334 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4335 W_L("<font color=\"");
4338 flg->with_font_flag = 1;
4340 node->userData = (void *)flg;
4341 return chtml20->out;
4346 * It is a handler who processes the DIR tag.
4348 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4349 * destination is specified.
4350 * @param node [i] The DIR tag node is specified.
4351 * @return The conversion result is returned.
4354 s_chtml20_end_dir_tag(void *pdoc, Node *node)
4356 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4357 Doc *doc = chtml20->doc;
4359 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
4360 if (flg && flg->with_font_flag) {
4364 if (IS_CSS_ON(chtml20->entryp)) {
4365 chxj_css_pop_prop_list(chtml20->css_prop_stack);
4367 return chtml20->out;
4372 * It is a handler who processes the DL tag.
4374 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4375 * destination is specified.
4376 * @param node [i] The DL tag node is specified.
4377 * @return The conversion result is returned.
4380 s_chtml20_start_dl_tag(void *pdoc, Node *node)
4385 char *attr_style = NULL;
4386 char *attr_color = NULL;
4388 chtml20 = GET_CHTML20(pdoc);
4390 for (attr = qs_get_attr(doc,node);
4392 attr = qs_get_next_attr(doc,attr)) {
4393 char *nm = qs_get_attr_name(doc,attr);
4394 char *val = qs_get_attr_value(doc,attr);
4395 if (val && STRCASEEQ('s','S',"style", nm)) {
4399 if (IS_CSS_ON(chtml20->entryp)) {
4400 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
4402 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4403 css_property_t *cur;
4404 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4405 if (cur->value && *cur->value) {
4406 attr_color = apr_pstrdup(doc->pool, cur->value);
4412 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
4413 memset(flg, 0, sizeof(*flg));
4415 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4416 W_L("<font color=\"");
4419 flg->with_font_flag = 1;
4421 node->userData = (void *)flg;
4422 return chtml20->out;
4427 * It is a handler who processes the DL tag.
4429 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4430 * destination is specified.
4431 * @param node [i] The DL tag node is specified.
4432 * @return The conversion result is returned.
4435 s_chtml20_end_dl_tag(void *pdoc, Node *node)
4437 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4438 Doc *doc = chtml20->doc;
4439 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
4440 if (flg && flg->with_font_flag) {
4444 if (IS_CSS_ON(chtml20->entryp)) {
4445 chxj_css_pop_prop_list(chtml20->css_prop_stack);
4447 return chtml20->out;
4452 * It is a handler who processes the DT tag.
4454 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4455 * destination is specified.
4456 * @param node [i] The DT tag node is specified.
4457 * @return The conversion result is returned.
4460 s_chtml20_start_dt_tag(void *pdoc, Node *node)
4465 char *attr_style = NULL;
4466 char *attr_color = NULL;
4468 chtml20 = GET_CHTML20(pdoc);
4470 for (attr = qs_get_attr(doc,node);
4472 attr = qs_get_next_attr(doc,attr)) {
4473 char *nm = qs_get_attr_name(doc,attr);
4474 char *val = qs_get_attr_value(doc,attr);
4475 if (val && STRCASEEQ('s','S',"style", nm)) {
4479 if (IS_CSS_ON(chtml20->entryp)) {
4480 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
4482 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4483 css_property_t *cur;
4484 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4485 if (cur->value && *cur->value) {
4486 attr_color = apr_pstrdup(doc->pool, cur->value);
4492 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
4493 memset(flg, 0, sizeof(*flg));
4495 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4496 W_L("<font color=\"");
4499 flg->with_font_flag = 1;
4501 node->userData = (void *)flg;
4502 return chtml20->out;
4507 * It is a handler who processes the DT tag.
4509 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4510 * destination is specified.
4511 * @param node [i] The DT tag node is specified.
4512 * @return The conversion result is returned.
4515 s_chtml20_end_dt_tag(void *pdoc, Node *node)
4517 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4518 Doc *doc = chtml20->doc;
4519 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
4520 if (flg && flg->with_font_flag) {
4523 if (IS_CSS_ON(chtml20->entryp)) {
4524 chxj_css_pop_prop_list(chtml20->css_prop_stack);
4526 return chtml20->out;
4531 * It is a handler who processes the DD tag.
4533 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4534 * destination is specified.
4535 * @param node [i] The DD tag node is specified.
4536 * @return The conversion result is returned.
4539 s_chtml20_start_dd_tag(void *pdoc, Node *node)
4544 char *attr_style = NULL;
4545 char *attr_color = NULL;
4547 chtml20 = GET_CHTML20(pdoc);
4549 for (attr = qs_get_attr(doc,node);
4551 attr = qs_get_next_attr(doc,attr)) {
4552 char *nm = qs_get_attr_name(doc,attr);
4553 char *val = qs_get_attr_value(doc,attr);
4554 if (val && STRCASEEQ('s','S',"style", nm)) {
4558 if (IS_CSS_ON(chtml20->entryp)) {
4559 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
4561 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4562 css_property_t *cur;
4563 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4564 if (cur->value && *cur->value) {
4565 attr_color = apr_pstrdup(doc->pool, cur->value);
4571 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
4572 memset(flg, 0, sizeof(*flg));
4574 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4575 W_L("<font color=\"");
4578 flg->with_font_flag = 1;
4580 node->userData = (void *)flg;
4581 return chtml20->out;
4582 CHTML20_START_OF_TAG_WITH_CSS_FONT_COLOR("<dd>");
4588 * It is a handler who processes the DD tag.
4590 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4591 * destination is specified.
4592 * @param node [i] The DD tag node is specified.
4593 * @return The conversion result is returned.
4596 s_chtml20_end_dd_tag(void *pdoc, Node *node)
4598 CHTML20_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4604 * It is a handler who processes the MENU tag.
4606 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4607 * destination is specified.
4608 * @param node [i] The MENU tag node is specified.
4609 * @return The conversion result is returned.
4612 s_chtml20_start_menu_tag(void *pdoc, Node *node)
4614 CHTML20_START_OF_TAG_WITH_CSS_FONT_COLOR("<menu>");
4619 * It is a handler who processes the MENU tag.
4621 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4622 * destination is specified.
4623 * @param node [i] The MENU tag node is specified.
4624 * @return The conversion result is returned.
4627 s_chtml20_end_menu_tag(void *pdoc, Node *node)
4629 CHTML20_END_OF_CLOSE_TAG_WITH_FONT_TAG("</menu>");
4634 * It is a handler who processes the PLAINTEXT tag.
4636 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4637 * destination is specified.
4638 * @param node [i] The PLAINTEXT tag node is specified.
4639 * @return The conversion result is returned.
4642 s_chtml20_start_plaintext_tag(void *pdoc, Node *node)
4644 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4645 Doc *doc = chtml20->doc;
4648 s_chtml20_start_plaintext_tag_inner(pdoc,node);
4649 return chtml20->out;
4653 s_chtml20_start_plaintext_tag_inner(void *pdoc, Node *node)
4655 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4656 Doc *doc = chtml20->doc;
4659 for (child = qs_get_child_node(doc, node);
4661 child = qs_get_next_node(doc, child)) {
4663 s_chtml20_start_plaintext_tag_inner(pdoc, child);
4665 return chtml20->out;
4670 * It is a handler who processes the PLAINTEXT tag.
4672 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4673 * destination is specified.
4674 * @param node [i] The PLAINTEXT tag node is specified.
4675 * @return The conversion result is returned.
4678 s_chtml20_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4680 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4681 return chtml20->out;
4685 * It is a handler who processes the BLINK tag.
4687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4688 * destination is specified.
4689 * @param node [i] The BLINK tag node is specified.
4690 * @return The conversion result is returned.
4693 s_chtml20_start_blink_tag(void *pdoc, Node *node)
4695 CHTML20_START_OF_TAG_WITH_CSS_FONT_COLOR("<blink>");
4700 * It is a handler who processes the BLINK tag.
4702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4703 * destination is specified.
4704 * @param node [i] The BLINK tag node is specified.
4705 * @return The conversion result is returned.
4708 s_chtml20_end_blink_tag(void *pdoc, Node *node)
4710 CHTML20_END_OF_CLOSE_TAG_WITH_FONT_TAG("</blink>");
4715 * It is a hanmarqueeer who processes the MARQUEE tag.
4717 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4718 * destination is specified.
4719 * @param node [i] The MARQUEE tag node is specified.
4720 * @return The conversion result is returned.
4723 s_chtml20_start_marquee_tag(void *pdoc, Node *node)
4725 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4726 Doc *doc = chtml20->doc;
4728 char *attr_direction = NULL;
4729 char *attr_behavior = NULL;
4730 char *attr_loop = NULL;
4731 char *attr_style = NULL;
4732 char *attr_color = NULL;
4733 /*--------------------------------------------------------------------------*/
4734 /* Get Attributes */
4735 /*--------------------------------------------------------------------------*/
4736 for (attr = qs_get_attr(doc,node);
4738 attr = qs_get_next_attr(doc,attr)) {
4739 char *name = qs_get_attr_name(doc,attr);
4740 char *value = qs_get_attr_value(doc,attr);
4741 if (STRCASEEQ('d','D',"direction", name)) {
4742 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4743 attr_direction = value;
4746 else if (STRCASEEQ('b','B',"behavior",name)) {
4747 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4748 attr_behavior = value;
4751 else if (STRCASEEQ('l','L',"loop",name)) {
4752 if (value && *value) {
4756 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4760 if (IS_CSS_ON(chtml20->entryp)) {
4761 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
4763 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4764 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4765 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4766 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4767 css_property_t *cur;
4768 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4769 if (cur->value && *cur->value) {
4770 attr_color = apr_pstrdup(doc->pool, cur->value);
4773 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4774 if (cur->value && *cur->value) {
4775 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4778 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4779 if (cur->value && *cur->value) {
4780 attr_loop = apr_pstrdup(doc->pool, cur->value);
4781 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4786 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4787 if (cur->value && *cur->value) {
4788 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4789 attr_direction = "right";
4791 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4792 attr_direction = "left";
4799 if (attr_direction) {
4800 W_L(" direction=\"");
4801 W_V(attr_direction);
4804 if (attr_behavior) {
4805 W_L(" behavior=\"");
4816 chtml20_flags_t *flg = (chtml20_flags_t *)apr_palloc(doc->pool, sizeof(chtml20_flags_t));
4817 memset(flg, 0, sizeof(*flg));
4819 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4820 W_L("<font color=\"");
4823 flg->with_font_flag = 1;
4825 node->userData = (void *)flg;
4826 return chtml20->out;
4831 * It is a hanmarqueeer who processes the MARQUEE tag.
4833 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4834 * destination is specified.
4835 * @param node [i] The MARQUEE tag node is specified.
4836 * @return The conversion result is returned.
4839 s_chtml20_end_marquee_tag(void *pdoc, Node *node)
4841 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4842 Doc *doc = chtml20->doc;
4843 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
4844 if (flg && flg->with_font_flag) {
4848 if (IS_CSS_ON(chtml20->entryp)) {
4849 chxj_css_pop_prop_list(chtml20->css_prop_stack);
4851 return chtml20->out;
4856 * * It is handler who processes the New Line Code.
4859 s_chtml20_newline_mark(void *pdoc, Node *UNUSED(node))
4861 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4862 Doc *doc = chtml20->doc;
4864 return chtml20->out;
4869 * It is a handler who processes the LINK tag.
4871 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4872 * destination is specified.
4873 * @param node [i] The LINK tag node is specified.
4874 * @return The conversion result is returned.
4877 s_chtml20_link_tag(void *pdoc, Node *node)
4886 chtml20 = GET_CHTML20(pdoc);
4889 if (! IS_CSS_ON(chtml20->entryp)) {
4890 return chtml20->out;
4893 for (attr = qs_get_attr(doc,node);
4895 attr = qs_get_next_attr(doc,attr)) {
4896 char *name = qs_get_attr_name(doc,attr);
4897 char *value = qs_get_attr_value(doc,attr);
4898 if (STRCASEEQ('r','R',"rel", name)) {
4899 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4903 else if (STRCASEEQ('h','H',"href", name)) {
4904 if (value && *value) {
4908 else if (STRCASEEQ('t','T',"type", name)) {
4909 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4915 if (rel && href && type) {
4916 DBG(doc->r, "start load CSS. url:[%s]", href);
4917 chtml20->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml20->style, href);
4918 DBG(doc->r, "end load CSS. url:[%s]", href);
4921 return chtml20->out;
4925 static css_prop_list_t *
4926 s_chtml20_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4928 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4929 Doc *doc = chtml20->doc;
4930 css_prop_list_t *last_css = NULL;
4931 if (IS_CSS_ON(chtml20->entryp)) {
4932 css_prop_list_t *dup_css;
4933 css_selector_t *selector;
4935 last_css = chxj_css_get_last_prop_list(chtml20->css_prop_stack);
4936 dup_css = chxj_dup_css_prop_list(doc, last_css);
4937 selector = chxj_css_find_selector(doc, chtml20->style, node);
4939 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4941 chxj_css_push_prop_list(chtml20->css_prop_stack, dup_css);
4942 last_css = chxj_css_get_last_prop_list(chtml20->css_prop_stack);
4943 if (style_attr_value) {
4944 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));
4946 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4954 static css_prop_list_t *
4955 s_chtml20_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4957 chtml20_t *chtml20 = GET_CHTML20(pdoc);
4958 Doc *doc = chtml20->doc;
4959 css_prop_list_t *last_css = NULL;
4960 if (IS_CSS_ON(chtml20->entryp)) {
4961 css_prop_list_t *dup_css;
4962 css_selector_t *selector;
4964 last_css = chxj_css_get_last_prop_list(chtml20->css_prop_stack);
4965 dup_css = chxj_dup_css_prop_list(doc, last_css);
4966 selector = chxj_css_find_selector(doc, chtml20->style, node);
4968 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4972 if (style_attr_value) {
4973 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));
4975 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4984 * It is a handler who processes the SPAN tag.
4986 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4987 * destination is specified.
4988 * @param node [i] The SPAN tag node is specified.
4989 * @return The conversion result is returned.
4992 s_chtml20_start_span_tag(void *pdoc, Node *node)
4997 char *attr_style = NULL;
4998 char *attr_color = NULL;
4999 char *attr_align = NULL;
5000 char *attr_blink = NULL;
5001 char *attr_marquee = NULL;
5002 char *attr_marquee_dir = NULL;
5003 char *attr_marquee_style = NULL;
5004 char *attr_marquee_loop = NULL;
5006 chtml20 = GET_CHTML20(pdoc);
5009 for (attr = qs_get_attr(doc,node);
5011 attr = qs_get_next_attr(doc,attr)) {
5012 char *nm = qs_get_attr_name(doc,attr);
5013 char *val = qs_get_attr_value(doc,attr);
5014 if (val && STRCASEEQ('s','S',"style", nm)) {
5018 if (IS_CSS_ON(chtml20->entryp)) {
5019 css_prop_list_t *style = s_chtml20_push_and_get_now_style(pdoc, node, attr_style);
5021 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5022 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5023 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5024 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5025 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5026 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5027 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5028 css_property_t *cur;
5029 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5030 attr_color = apr_pstrdup(doc->pool, cur->value);
5032 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5033 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5034 attr_blink = apr_pstrdup(doc->pool, cur->value);
5037 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5038 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5039 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5042 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5043 if (cur->value && *cur->value) {
5044 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5045 attr_marquee_dir = "right";
5047 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5048 attr_marquee_dir = "left";
5052 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5053 if (cur->value && *cur->value) {
5054 if ( STRCASEEQ('s','S',"scroll",cur->value)
5055 || STRCASEEQ('s','S',"slide",cur->value)
5056 || STRCASEEQ('a','A',"alternate",cur->value)) {
5057 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5061 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5062 if (cur->value && *cur->value) {
5063 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5064 attr_marquee_loop = "16";
5067 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5071 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5072 if (STRCASEEQ('l','L',"left", cur->value)) {
5073 attr_align = apr_pstrdup(doc->pool, "left");
5075 else if (STRCASEEQ('c','C',"center",cur->value)) {
5076 attr_align = apr_pstrdup(doc->pool, "center");
5078 else if (STRCASEEQ('r','R',"right",cur->value)) {
5079 attr_align = apr_pstrdup(doc->pool, "right");
5084 if (attr_color || attr_align || attr_blink || attr_marquee) {
5085 chtml20_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5086 memset(flg, 0, sizeof(*flg));
5089 flg->with_blink_flag = 1;
5093 if (attr_marquee_dir) {
5094 W_L(" direction=\"");
5095 W_V(attr_marquee_dir);
5098 if (attr_marquee_style) {
5099 W_L(" behavior=\"");
5100 W_V(attr_marquee_style);
5103 if (attr_marquee_loop) {
5105 W_V(attr_marquee_loop);
5109 flg->with_marquee_flag = 1;
5112 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5113 W_L("<font color=\"");
5116 flg->with_font_flag = 1;
5119 W_L("<div align=\"");
5122 flg->with_div_flag = 1;
5124 node->userData = flg;
5127 node->userData = NULL;
5129 return chtml20->out;
5134 * It is a handler who processes the SPAN tag.
5136 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5137 * destination is specified.
5138 * @param node [i] The SPAN tag node is specified.
5139 * @return The conversion result is returned.
5142 s_chtml20_end_span_tag(void *pdoc, Node *node)
5144 chtml20_t *chtml20 = GET_CHTML20(pdoc);
5145 Doc *doc = chtml20->doc;
5147 chtml20_flags_t *flg = (chtml20_flags_t *)node->userData;
5148 if (flg && flg->with_div_flag) {
5151 if (flg && flg->with_font_flag) {
5154 if (flg && flg->with_marquee_flag) {
5157 if (flg && flg->with_blink_flag) {
5160 if (IS_CSS_ON(chtml20->entryp)) {
5161 chxj_css_pop_prop_list(chtml20->css_prop_stack);
5163 return chtml20->out;
5168 * It is a handler who processes the STYLE tag.
5170 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5171 * destination is specified.
5172 * @param node [i] The STYLE tag node is specified.
5173 * @return The conversion result is returned.
5176 s_chtml20_style_tag(void *pdoc, Node *node)
5183 chtml20 = GET_CHTML20(pdoc);
5186 if (! IS_CSS_ON(chtml20->entryp)) {
5187 return chtml20->out;
5190 for (attr = qs_get_attr(doc,node);
5192 attr = qs_get_next_attr(doc,attr)) {
5193 char *name = qs_get_attr_name(doc,attr);
5194 char *value = qs_get_attr_value(doc,attr);
5195 if (STRCASEEQ('t','T',"type", name)) {
5196 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5202 Node *child = qs_get_child_node(doc, node);
5203 if (type && child) {
5204 char *name = qs_get_node_name(doc, child);
5205 if (STRCASEEQ('t','T',"text", name)) {
5206 char *value = qs_get_node_value(doc, child);
5207 DBG(doc->r, "start load CSS. buf:[%s]", value);
5208 chtml20->style = chxj_css_parse_style_value(doc, chtml20->style, value);
5209 DBG(doc->r, "end load CSS. value:[%s]", value);
5212 return chtml20->out;