2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_chtml30.h"
19 #include "chxj_hdml.h"
20 #include "chxj_str_util.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_conv_z2h.h"
28 #define GET_CHTML30(X) ((chtml30_t *)(X))
31 #define W_L(X) do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
35 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml30->conf); W_V(nlcode); } while (0)
39 #define CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR(tagname) \
44 char *attr_style = NULL; \
45 char *attr_color = NULL; \
47 chtml30 = GET_CHTML30(pdoc); \
49 for (attr = qs_get_attr(doc,node); \
51 attr = qs_get_next_attr(doc,attr)) { \
52 char *nm = qs_get_attr_name(doc,attr); \
53 char *val = qs_get_attr_value(doc,attr); \
54 if (val && STRCASEEQ('s','S',"style", nm)) { \
58 if (IS_CSS_ON(chtml30->entryp)) { \
59 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style); \
61 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color"); \
62 css_property_t *cur; \
63 for (cur = color_prop->next; cur != color_prop; cur = cur->next) { \
64 if (cur->value && *cur->value) { \
65 attr_color = apr_pstrdup(doc->pool, cur->value); \
71 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t)); \
72 memset(flg, 0, sizeof(*flg)); \
74 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color); \
75 W_L("<font color=\""); \
78 flg->with_font_flag = 1; \
80 node->userData = (void *)flg; \
81 return chtml30->out; \
84 #define CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG() \
86 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
87 Doc *doc = chtml30->doc; \
88 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
89 if (flg && flg->with_font_flag) { \
92 if (IS_CSS_ON(chtml30->entryp)) { \
93 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
95 return chtml30->out; \
98 #define CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG(tagname) \
100 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
101 Doc *doc = chtml30->doc; \
102 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
103 if (flg && flg->with_font_flag) { \
107 if (IS_CSS_ON(chtml30->entryp)) { \
108 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
110 return chtml30->out; \
114 static char *s_chtml30_start_html_tag (void *pdoc, Node *node);
115 static char *s_chtml30_end_html_tag (void *pdoc, Node *node);
116 static char *s_chtml30_start_meta_tag (void *pdoc, Node *node);
117 static char *s_chtml30_end_meta_tag (void *pdoc, Node *node);
118 static char *s_chtml30_start_textarea_tag (void *pdoc, Node *node);
119 static char *s_chtml30_end_textarea_tag (void *pdoc, Node *node);
120 static char *s_chtml30_start_p_tag (void *pdoc, Node *node);
121 static char *s_chtml30_end_p_tag (void *pdoc, Node *node);
122 static char *s_chtml30_start_pre_tag (void *pdoc, Node *node);
123 static char *s_chtml30_end_pre_tag (void *pdoc, Node *node);
124 static char *s_chtml30_start_h1_tag (void *pdoc, Node *node);
125 static char *s_chtml30_end_h1_tag (void *pdoc, Node *node);
126 static char *s_chtml30_start_h2_tag (void *pdoc, Node *node);
127 static char *s_chtml30_end_h2_tag (void *pdoc, Node *node);
128 static char *s_chtml30_start_h3_tag (void *pdoc, Node *node);
129 static char *s_chtml30_end_h3_tag (void *pdoc, Node *node);
130 static char *s_chtml30_start_h4_tag (void *pdoc, Node *node);
131 static char *s_chtml30_end_h4_tag (void *pdoc, Node *node);
132 static char *s_chtml30_start_h5_tag (void *pdoc, Node *node);
133 static char *s_chtml30_end_h5_tag (void *pdoc, Node *node);
134 static char *s_chtml30_start_h6_tag (void *pdoc, Node *node);
135 static char *s_chtml30_end_h6_tag (void *pdoc, Node *node);
136 static char *s_chtml30_start_ul_tag (void *pdoc, Node *node);
137 static char *s_chtml30_end_ul_tag (void *pdoc, Node *node);
138 static char *s_chtml30_start_ol_tag (void *pdoc, Node *node);
139 static char *s_chtml30_end_ol_tag (void *pdoc, Node *node);
140 static char *s_chtml30_start_li_tag (void *pdoc, Node *node);
141 static char *s_chtml30_end_li_tag (void *pdoc, Node *node);
142 static char *s_chtml30_start_head_tag (void *pdoc, Node *node);
143 static char *s_chtml30_end_head_tag (void *pdoc, Node *node);
144 static char *s_chtml30_start_title_tag (void *pdoc, Node *node);
145 static char *s_chtml30_end_title_tag (void *pdoc, Node *node);
146 static char *s_chtml30_start_base_tag (void *pdoc, Node *node);
147 static char *s_chtml30_end_base_tag (void *pdoc, Node *node);
148 static char *s_chtml30_start_body_tag (void *pdoc, Node *node);
149 static char *s_chtml30_end_body_tag (void *pdoc, Node *node);
150 static char *s_chtml30_start_a_tag (void *pdoc, Node *node);
151 static char *s_chtml30_end_a_tag (void *pdoc, Node *node);
152 static char *s_chtml30_start_br_tag (void *pdoc, Node *node);
153 static char *s_chtml30_end_br_tag (void *pdoc, Node *node);
154 static char *s_chtml30_start_tr_tag (void *pdoc, Node *node);
155 static char *s_chtml30_end_tr_tag (void *pdoc, Node *node);
156 static char *s_chtml30_start_font_tag (void *pdoc, Node *node);
157 static char *s_chtml30_end_font_tag (void *pdoc, Node *node);
158 static char *s_chtml30_start_form_tag (void *pdoc, Node *node);
159 static char *s_chtml30_end_form_tag (void *pdoc, Node *node);
160 static char *s_chtml30_start_input_tag (void *pdoc, Node *node);
161 static char *s_chtml30_end_input_tag (void *pdoc, Node *node);
162 static char *s_chtml30_start_center_tag (void *pdoc, Node *node);
163 static char *s_chtml30_end_center_tag (void *pdoc, Node *node);
164 static char *s_chtml30_start_hr_tag (void *pdoc, Node *node);
165 static char *s_chtml30_end_hr_tag (void *pdoc, Node *node);
166 static char *s_chtml30_start_img_tag (void *pdoc, Node *node);
167 static char *s_chtml30_end_img_tag (void *pdoc, Node *node);
168 static char *s_chtml30_start_select_tag (void *pdoc, Node *node);
169 static char *s_chtml30_end_select_tag (void *pdoc, Node *node);
170 static char *s_chtml30_start_option_tag (void *pdoc, Node *node);
171 static char *s_chtml30_end_option_tag (void *pdoc, Node *node);
172 static char *s_chtml30_start_div_tag (void *pdoc, Node *node);
173 static char *s_chtml30_end_div_tag (void *pdoc, Node *node);
174 static char *s_chtml30_chxjif_tag (void *pdoc, Node *node);
175 static char *s_chtml30_text_tag (void *pdoc, Node *node);
176 static char *s_chtml30_start_blockquote_tag (void *pdoc, Node *node);
177 static char *s_chtml30_end_blockquote_tag (void *pdoc, Node *node);
178 static char *s_chtml30_start_dir_tag (void *pdoc, Node *node);
179 static char *s_chtml30_end_dir_tag (void *pdoc, Node *node);
180 static char *s_chtml30_start_dl_tag (void *pdoc, Node *node);
181 static char *s_chtml30_end_dl_tag (void *pdoc, Node *node);
182 static char *s_chtml30_start_dt_tag (void *pdoc, Node *node);
183 static char *s_chtml30_end_dt_tag (void *pdoc, Node *node);
184 static char *s_chtml30_start_dd_tag (void *pdoc, Node *node);
185 static char *s_chtml30_end_dd_tag (void *pdoc, Node *node);
186 static char *s_chtml30_start_marquee_tag (void *pdoc, Node *node);
187 static char *s_chtml30_end_marquee_tag (void *pdoc, Node *node);
188 static char *s_chtml30_start_blink_tag (void *pdoc, Node *node);
189 static char *s_chtml30_end_blink_tag (void *pdoc, Node *node);
190 static char *s_chtml30_start_menu_tag (void *pdoc, Node *node);
191 static char *s_chtml30_end_menu_tag (void *pdoc, Node *node);
192 static char *s_chtml30_start_plaintext_tag (void *pdoc, Node *node);
193 static char *s_chtml30_start_plaintext_tag_inner (void *pdoc, Node *node);
194 static char *s_chtml30_end_plaintext_tag (void *pdoc, Node *node);
195 static char *s_chtml30_style_tag (void *pdoc, Node *node);
196 static char *s_chtml30_newline_mark (void *pdoc, Node *node);
197 static char *s_chtml30_link_tag (void *pdoc, Node *node);
198 static char *s_chtml30_start_span_tag (void *pdoc, Node *node);
199 static char *s_chtml30_end_span_tag (void *pdoc, Node *node);
201 static void s_init_chtml30(chtml30_t *chtml, Doc *doc, request_rec *r, device_table *spec);
203 static int s_chtml30_search_emoji(chtml30_t *chtml, char *txt, char **rslt);
204 static css_prop_list_t *s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
205 static css_prop_list_t *s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
208 tag_handler chtml30_handler[] = {
211 s_chtml30_start_html_tag,
212 s_chtml30_end_html_tag,
216 s_chtml30_start_meta_tag,
217 s_chtml30_end_meta_tag,
221 s_chtml30_start_textarea_tag,
222 s_chtml30_end_textarea_tag,
226 s_chtml30_start_p_tag,
231 s_chtml30_start_pre_tag,
232 s_chtml30_end_pre_tag,
236 s_chtml30_start_ul_tag,
237 s_chtml30_end_ul_tag,
241 s_chtml30_start_li_tag,
242 s_chtml30_end_li_tag,
246 s_chtml30_start_ol_tag,
247 s_chtml30_end_ol_tag,
251 s_chtml30_start_h1_tag,
252 s_chtml30_end_h1_tag,
256 s_chtml30_start_h2_tag,
257 s_chtml30_end_h2_tag,
261 s_chtml30_start_h3_tag,
262 s_chtml30_end_h3_tag,
266 s_chtml30_start_h4_tag,
267 s_chtml30_end_h4_tag,
271 s_chtml30_start_h5_tag,
272 s_chtml30_end_h5_tag,
276 s_chtml30_start_h6_tag,
277 s_chtml30_end_h6_tag,
281 s_chtml30_start_head_tag,
282 s_chtml30_end_head_tag,
286 s_chtml30_start_title_tag,
287 s_chtml30_end_title_tag,
291 s_chtml30_start_base_tag,
292 s_chtml30_end_base_tag,
296 s_chtml30_start_body_tag,
297 s_chtml30_end_body_tag,
301 s_chtml30_start_a_tag,
306 s_chtml30_start_br_tag,
307 s_chtml30_end_br_tag,
316 s_chtml30_start_tr_tag,
317 s_chtml30_end_tr_tag,
331 s_chtml30_start_font_tag,
332 s_chtml30_end_font_tag,
336 s_chtml30_start_form_tag,
337 s_chtml30_end_form_tag,
341 s_chtml30_start_input_tag,
342 s_chtml30_end_input_tag,
346 s_chtml30_start_center_tag,
347 s_chtml30_end_center_tag,
351 s_chtml30_start_hr_tag,
352 s_chtml30_end_hr_tag,
356 s_chtml30_start_img_tag,
357 s_chtml30_end_img_tag,
361 s_chtml30_start_select_tag,
362 s_chtml30_end_select_tag,
366 s_chtml30_start_option_tag,
367 s_chtml30_end_option_tag,
371 s_chtml30_start_div_tag,
372 s_chtml30_end_div_tag,
376 s_chtml30_chxjif_tag,
381 s_chtml30_chxjif_tag,
401 s_chtml30_start_span_tag,
402 s_chtml30_end_span_tag,
426 s_chtml30_start_dt_tag,
427 s_chtml30_end_dt_tag,
441 s_chtml30_start_blockquote_tag,
442 s_chtml30_end_blockquote_tag,
446 s_chtml30_start_dir_tag,
447 s_chtml30_end_dir_tag,
451 s_chtml30_start_dl_tag,
452 s_chtml30_end_dl_tag,
456 s_chtml30_start_dd_tag,
457 s_chtml30_end_dd_tag,
461 s_chtml30_start_menu_tag,
462 s_chtml30_end_menu_tag,
466 s_chtml30_start_plaintext_tag,
467 s_chtml30_end_plaintext_tag,
471 s_chtml30_start_blink_tag,
472 s_chtml30_end_blink_tag,
476 s_chtml30_start_marquee_tag,
477 s_chtml30_end_marquee_tag,
486 s_chtml30_newline_mark,
493 * converts from CHTML5.0 to CHTML3.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_chtml30(
508 chxjconvrule_entry *entryp,
517 DBG(r, "start chxj_convert_chtml30()");
519 /*--------------------------------------------------------------------------*/
521 /*--------------------------------------------------------------------------*/
523 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
525 DBG(r,"i found qrcode xml");
526 DBG(r, "end chxj_convert_chtml30()");
529 DBG(r,"not found qrcode xml");
531 /*--------------------------------------------------------------------------*/
532 /* The CHTML structure is initialized. */
533 /*--------------------------------------------------------------------------*/
534 s_init_chtml30(&chtml30, &doc, r, spec);
536 chtml30.entryp = entryp;
537 chtml30.cookie = cookie;
539 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
541 /*--------------------------------------------------------------------------*/
542 /* The character string of the input is analyzed. */
543 /*--------------------------------------------------------------------------*/
544 qs_init_malloc(&doc);
545 qs_init_root_node(&doc);
547 ss = apr_pcalloc(r->pool, srclen + 1);
548 memset(ss, 0, srclen + 1);
549 memcpy(ss, src, srclen);
552 chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
554 if (IS_CSS_ON(chtml30.entryp)) {
555 /* current property list */
556 chtml30.css_prop_stack = chxj_new_prop_list_stack(&doc);
559 chxj_buffered_write_init(r->pool, &doc.buf);
561 qs_parse_string(&doc,ss, strlen(ss));
563 /*--------------------------------------------------------------------------*/
564 /* It converts it from CHTML to CHTML. */
565 /*--------------------------------------------------------------------------*/
566 chxj_node_convert(spec,r,(void*)&chtml30, &doc, qs_get_root(&doc), 0);
567 chtml30.out = chxj_buffered_write_flush(chtml30.out, &doc.buf);
568 dst = apr_pstrdup(r->pool, chtml30.out);
569 chxj_buffered_write_terminate(&doc.buf);
571 qs_all_free(&doc,QX_LOGMARK);
574 dst = apr_pstrdup(r->pool,ss);
576 if (strlen(dst) == 0) {
577 dst = apr_psprintf(r->pool, "\n");
580 *dstlen = strlen(dst);
583 chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
586 DBG(r, "end chxj_convert_chtml30()");
592 * The CHTML structure is initialized.
594 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
595 * initialized is specified.
596 * @param doc [i] The Doc structure that should be set to the initialized
597 * HDML structure is specified.
598 * @param r [i] To use POOL, the pointer to request_rec is specified.
599 * @param spec [i] The pointer to the device_table
602 s_init_chtml30(chtml30_t *chtml30, Doc *doc, request_rec *r, device_table *spec)
604 memset(doc, 0, sizeof(Doc));
605 memset(chtml30, 0, sizeof(chtml30_t));
609 chtml30->spec = spec;
610 chtml30->out = qs_alloc_zero_byte_string(r->pool);
611 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
612 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
617 * Corresponding EMOJI to a current character-code is retrieved.
618 * The substitution character string is stored in the rslt pointer if agreeing.
620 * @param chtml30 [i] The pointer to the CHTML structure is specified.
621 * @param txt [i] The character string to want to examine whether it is
622 * EMOJI is specified.
623 * @param rslt [o] The pointer to the pointer that stores the result is
625 * @return When corresponding EMOJI exists, it returns it excluding 0.
628 s_chtml30_search_emoji(chtml30_t *chtml30, char *txt, char **rslt)
635 spec = chtml30->spec;
641 DBG(r,"spec is NULL");
644 for (ee = chtml30->conf->emoji;
647 if (ee->imode == NULL) {
648 DBG(r, "emoji->imode is NULL");
652 if (ee->imode->string != NULL
653 && strlen(ee->imode->string) > 0
654 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
656 if (spec == NULL || spec->emoji_type == NULL) {
657 *rslt = apr_palloc(r->pool, 3);
658 (*rslt)[0] = ee->imode->hex1byte & 0xff;
659 (*rslt)[1] = ee->imode->hex2byte & 0xff;
661 return strlen(ee->imode->string);
673 chxj_chtml30_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
684 chtml30 = &__chtml30;
687 DBG(r, "REQ[%X] start chxj_chtml30_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
688 memset(doc, 0, sizeof(Doc));
689 memset(chtml30, 0, sizeof(chtml30_t));
693 chtml30->spec = spec;
694 chtml30->out = qs_alloc_zero_byte_string(r->pool);
695 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
696 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
698 apr_pool_create(&pool, r->pool);
700 chxj_buffered_write_init(pool, &doc->buf);
702 for (ii=0; ii<len; ii++) {
706 rtn = s_chtml30_search_emoji(chtml30, (char *)&src[ii], &out);
713 if (is_sjis_kanji(src[ii])) {
714 two_byte[0] = src[ii+0];
715 two_byte[1] = src[ii+1];
721 one_byte[0] = src[ii+0];
726 chtml30->out = chxj_buffered_write_flush(chtml30->out, &doc->buf);
728 DBG(r, "REQ[%X] end chxj_chtml30_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
734 * It is a handler who processes the HTML tag.
736 * @param pdoc [i/o] The pointer to the CHTML structure at the output
737 * destination is specified.
738 * @param node [i] The HTML tag node is specified.
739 * @return The conversion result is returned.
742 s_chtml30_start_html_tag(void *pdoc, Node *UNUSED(node))
744 chtml30_t *chtml30 = GET_CHTML30(pdoc);
745 Doc *doc = chtml30->doc;
747 /*--------------------------------------------------------------------------*/
749 /*--------------------------------------------------------------------------*/
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_chtml30_end_html_tag(void *pdoc, Node *UNUSED(child))
767 chtml30_t *chtml30 = GET_CHTML30(pdoc);
768 Doc *doc = chtml30->doc;
777 * It is a handler who processes the META tag.
779 * @param pdoc [i/o] The pointer to the CHTML structure at the output
780 * destination is specified.
781 * @param node [i] The META tag node is specified.
782 * @return The conversion result is returned.
785 s_chtml30_start_meta_tag(void *pdoc, Node *node)
791 int content_type_flag;
794 chtml30 = GET_CHTML30(pdoc);
798 content_type_flag = 0;
802 /*--------------------------------------------------------------------------*/
804 /*--------------------------------------------------------------------------*/
805 for (attr = qs_get_attr(doc,node);
807 attr = qs_get_next_attr(doc,attr)) {
808 char *name = qs_get_attr_name(doc,attr);
809 char *value = qs_get_attr_value(doc,attr);
813 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
814 /*----------------------------------------------------------------------*/
816 /*----------------------------------------------------------------------*/
817 W_L(" http-equiv=\"");
820 if (STRCASEEQ('c','C',"content-type", value))
821 content_type_flag = 1;
823 if (STRCASEEQ('r','R',"refresh", value))
830 if (strcasecmp(name, "content") == 0 && value && *value) {
831 if (content_type_flag) {
835 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
843 buf = apr_pstrdup(r->pool, value);
844 url = strchr(buf, ';');
846 sec = apr_pstrdup(r->pool, buf);
849 url = chxj_encoding_parameter(r, url, 0);
850 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
880 * It is a handler who processes the META tag.
882 * @param pdoc [i/o] The pointer to the CHTML structure at the output
883 * destination is specified.
884 * @param node [i] The META tag node is specified.
885 * @return The conversion result is returned.
888 s_chtml30_end_meta_tag(void* pdoc, Node* UNUSED(child))
890 chtml30_t *chtml30 = GET_CHTML30(pdoc);
897 * It is a handler who processes the HEAD tag.
899 * @param pdoc [i/o] The pointer to the CHTML structure at the output
900 * destination is specified.
901 * @param node [i] The HEAD tag node is specified.
902 * @return The conversion result is returned.
905 s_chtml30_start_head_tag(void* pdoc, Node* UNUSED(node))
907 chtml30_t *chtml30 = GET_CHTML30(pdoc);
908 Doc *doc = chtml30->doc;
917 * It is a handler who processes the HEAD tag.
919 * @param pdoc [i/o] The pointer to the CHTML structure at the output
920 * destination is specified.
921 * @param node [i] The HEAD tag node is specified.
922 * @return The conversion result is returned.
925 s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node))
927 chtml30_t *chtml30 = GET_CHTML30(pdoc);
928 Doc *doc = chtml30->doc;
937 * It is a handler who processes the TITLE tag.
939 * @param pdoc [i/o] The pointer to the CHTML structure at the output
940 * destination is specified.
941 * @param node [i] The TITLE tag node is specified.
942 * @return The conversion result is returned.
945 s_chtml30_start_title_tag(void *pdoc, Node *UNUSED(node))
947 chtml30_t *chtml30 = GET_CHTML30(pdoc);
948 Doc *doc = chtml30->doc;
957 * It is a handler who processes the TITLE tag.
959 * @param pdoc [i/o] The pointer to the CHTML structure at the output
960 * destination is specified.
961 * @param node [i] The TITLE tag node is specified.
962 * @return The conversion result is returned.
965 s_chtml30_end_title_tag(void *pdoc, Node *UNUSED(child))
967 chtml30_t *chtml30 = GET_CHTML30(pdoc);
968 Doc *doc = chtml30->doc;
977 * It is a handler who processes the BASE tag.
979 * @param pdoc [i/o] The pointer to the CHTML structure at the output
980 * destination is specified.
981 * @param node [i] The BASE tag node is specified.
982 * @return The conversion result is returned.
985 s_chtml30_start_base_tag(void *pdoc, Node *node)
992 chtml30 = GET_CHTML30(pdoc);
997 /*--------------------------------------------------------------------------*/
999 /*--------------------------------------------------------------------------*/
1000 for (attr = qs_get_attr(doc,node);
1002 attr = qs_get_next_attr(doc,attr)) {
1003 char *name = qs_get_attr_name(doc,attr);
1004 char *value = qs_get_attr_value(doc,attr);
1005 if (STRCASEEQ('h','H',"href", name)) {
1012 return chtml30->out;
1017 * It is a handler who processes the BASE tag.
1019 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1020 * destination is specified.
1021 * @param node [i] The BASE tag node is specified.
1022 * @return The conversion result is returned.
1025 s_chtml30_end_base_tag(void *pdoc, Node *UNUSED(child))
1027 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1029 return chtml30->out;
1034 * It is a handler who processes the BODY tag.
1036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1037 * destination is specified.
1038 * @param node [i] The BODY tag node is specified.
1039 * @return The conversion result is returned.
1042 s_chtml30_start_body_tag(void *pdoc, Node *node)
1048 char *attr_bgcolor = NULL;
1049 char *attr_text = NULL;
1050 char *attr_link = NULL;
1051 char *attr_style = NULL;
1053 chtml30 = GET_CHTML30(pdoc);
1057 /*--------------------------------------------------------------------------*/
1058 /* Get Attributes */
1059 /*--------------------------------------------------------------------------*/
1060 for (attr = qs_get_attr(doc,node);
1062 attr = qs_get_next_attr(doc,attr)) {
1063 char *name = qs_get_attr_name(doc,attr);
1064 char *value = qs_get_attr_value(doc,attr);
1068 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
1069 /*----------------------------------------------------------------------*/
1071 /*----------------------------------------------------------------------*/
1072 attr_bgcolor = value;
1078 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
1079 /*----------------------------------------------------------------------*/
1081 /*----------------------------------------------------------------------*/
1088 if (strcasecmp(name, "style") == 0 && value && *value != 0) {
1095 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
1096 /*----------------------------------------------------------------------*/
1098 /*----------------------------------------------------------------------*/
1105 if (strcasecmp(name, "alink") == 0) {
1106 /*----------------------------------------------------------------------*/
1108 /*----------------------------------------------------------------------*/
1115 if (strcasecmp(name, "vlink") == 0) {
1116 /*----------------------------------------------------------------------*/
1118 /*----------------------------------------------------------------------*/
1127 if (IS_CSS_ON(chtml30->entryp)) {
1128 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1130 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1131 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1132 css_property_t *cur;
1133 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1134 if (cur->value && *cur->value) {
1135 attr_text = apr_pstrdup(doc->pool, cur->value);
1138 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1139 if (cur->value && *cur->value) {
1140 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1144 if (chtml30->style) {
1145 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml30->style);
1146 css_selector_t *cur_sel;
1147 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1148 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1149 css_property_t *cur;
1150 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1151 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1152 attr_link = apr_pstrdup(doc->pool, cur->value);
1161 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1167 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1173 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1180 return chtml30->out;
1185 * It is a handler who processes the BODY tag.
1187 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1188 * destination is specified.
1189 * @param node [i] The BODY tag node is specified.
1190 * @return The conversion result is returned.
1193 s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child))
1198 chtml30 = GET_CHTML30(pdoc);
1202 if (IS_CSS_ON(chtml30->entryp)) {
1203 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1206 return chtml30->out;
1211 * It is a handler who processes the A tag.
1213 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1214 * destination is specified.
1215 * @param node [i] The A tag node is specified.
1216 * @return The conversion result is returned.
1219 s_chtml30_start_a_tag(void *pdoc, Node *node)
1225 char *attr_style = NULL;
1227 chtml30 = GET_CHTML30(pdoc);
1232 /*--------------------------------------------------------------------------*/
1233 /* Get Attributes */
1234 /*--------------------------------------------------------------------------*/
1235 for (attr = qs_get_attr(doc,node);
1237 attr = qs_get_next_attr(doc,attr)) {
1238 char *name = qs_get_attr_name(doc,attr);
1239 char *value = qs_get_attr_value(doc,attr);
1240 if (STRCASEEQ('n','N',"name", name)) {
1241 /*----------------------------------------------------------------------*/
1243 /*----------------------------------------------------------------------*/
1248 else if (STRCASEEQ('h','H',"href", name)) {
1249 /*----------------------------------------------------------------------*/
1251 /*----------------------------------------------------------------------*/
1252 value = chxj_encoding_parameter(r, value, 0);
1253 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1254 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1260 else if (STRCASEEQ('a','A',"accesskey", name)) {
1261 /*----------------------------------------------------------------------*/
1263 /*----------------------------------------------------------------------*/
1264 W_L(" accesskey=\"");
1268 else if (STRCASEEQ('c','C',"cti", name)) {
1269 /*----------------------------------------------------------------------*/
1271 /*----------------------------------------------------------------------*/
1276 else if (STRCASEEQ('i','I',"ijam", name)) {
1277 /*----------------------------------------------------------------------*/
1279 /*----------------------------------------------------------------------*/
1282 else if (STRCASEEQ('u','U',"utn", name)) {
1283 /*----------------------------------------------------------------------*/
1285 /* It is special only for CHTML. */
1286 /*----------------------------------------------------------------------*/
1289 else if (STRCASEEQ('t','T',"telbook", name)) {
1290 /*----------------------------------------------------------------------*/
1292 /*----------------------------------------------------------------------*/
1295 else if (STRCASEEQ('k','K',"kana", name)) {
1296 /*----------------------------------------------------------------------*/
1298 /*----------------------------------------------------------------------*/
1301 else if (STRCASEEQ('e','E',"email", name)) {
1302 /*----------------------------------------------------------------------*/
1304 /*----------------------------------------------------------------------*/
1307 else if (STRCASEEQ('i','I',"ista", name)) {
1308 /*----------------------------------------------------------------------*/
1310 /*----------------------------------------------------------------------*/
1313 else if (STRCASEEQ('i','I',"ilet", name)) {
1314 /*----------------------------------------------------------------------*/
1316 /*----------------------------------------------------------------------*/
1319 else if (STRCASEEQ('i','I',"iswf", name)) {
1320 /*----------------------------------------------------------------------*/
1322 /*----------------------------------------------------------------------*/
1325 else if (STRCASEEQ('i','I',"irst", name)) {
1326 /*----------------------------------------------------------------------*/
1328 /*----------------------------------------------------------------------*/
1331 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1337 if (IS_CSS_ON(chtml30->entryp)) {
1338 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1341 return chtml30->out;
1346 * It is a handler who processes the A tag.
1348 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1349 * destination is specified.
1350 * @param node [i] The A tag node is specified.
1351 * @return The conversion result is returned.
1354 s_chtml30_end_a_tag(void *pdoc, Node *UNUSED(child))
1359 chtml30 = GET_CHTML30(pdoc);
1363 if (IS_CSS_ON(chtml30->entryp)) {
1364 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1367 return chtml30->out;
1372 * It is a handler who processes the BR tag.
1374 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1375 * destination is specified.
1376 * @param node [i] The BR tag node is specified.
1377 * @return The conversion result is returned.
1380 s_chtml30_start_br_tag(void *pdoc, Node *node)
1387 chtml30 = GET_CHTML30(pdoc);
1391 /*--------------------------------------------------------------------------*/
1392 /* Get Attributes */
1393 /*--------------------------------------------------------------------------*/
1394 for (attr = qs_get_attr(doc,node);
1396 attr = qs_get_next_attr(doc,attr)) {
1397 char *name = qs_get_attr_name(doc,attr);
1398 char *value = qs_get_attr_value(doc,attr);
1399 if (STRCASEEQ('c','C',"clear",name)) {
1400 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1408 return chtml30->out;
1413 * It is a handler who processes the BR tag.
1415 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1416 * destination is specified.
1417 * @param node [i] The BR tag node is specified.
1418 * @return The conversion result is returned.
1421 s_chtml30_end_br_tag(void *pdoc, Node *UNUSED(child))
1423 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1425 return chtml30->out;
1430 * It is a handler who processes the TR tag.
1432 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1433 * destination is specified.
1434 * @param node [i] The TR tag node is specified.
1435 * @return The conversion result is returned.
1438 s_chtml30_start_tr_tag(void *pdoc, Node *UNUSED(node))
1440 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1442 return chtml30->out;
1447 * It is a handler who processes the TR tag.
1449 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1450 * destination is specified.
1451 * @param node [i] The TR tag node is specified.
1452 * @return The conversion result is returned.
1455 s_chtml30_end_tr_tag(void *pdoc, Node *UNUSED(child))
1461 chtml30 = GET_CHTML30(pdoc);
1467 return chtml30->out;
1472 * It is a handler who processes the FONT tag.
1474 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1475 * destination is specified.
1476 * @param node [i] The FONT tag node is specified.
1477 * @return The conversion result is returned.
1480 s_chtml30_start_font_tag(void *pdoc, Node *node)
1486 char *attr_color = NULL;
1487 char *attr_style = NULL;
1489 chtml30 = GET_CHTML30(pdoc);
1493 /*--------------------------------------------------------------------------*/
1494 /* Get Attributes */
1495 /*--------------------------------------------------------------------------*/
1496 for (attr = qs_get_attr(doc,node);
1498 attr = qs_get_next_attr(doc,attr)) {
1499 char *name = qs_get_attr_name(doc,attr);
1500 char *value = qs_get_attr_value(doc,attr);
1501 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1502 attr_color = apr_pstrdup(doc->buf.pool, value);
1504 else if (STRCASEEQ('s','S',"size", name)) {
1505 /*----------------------------------------------------------------------*/
1507 /*----------------------------------------------------------------------*/
1510 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1514 if (IS_CSS_ON(chtml30->entryp)) {
1515 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1517 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1518 css_property_t *cur;
1519 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1520 if (cur->value && *cur->value) {
1521 attr_color = apr_pstrdup(doc->pool, cur->value);
1527 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1528 W_L("<font color=\"");
1532 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1533 flg->with_font_flag = 1;
1534 node->userData = flg;
1537 node->userData = NULL;
1539 return chtml30->out;
1544 * It is a handler who processes the FONT tag.
1546 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1547 * destination is specified.
1548 * @param node [i] The FONT tag node is specified.
1549 * @return The conversion result is returned.
1552 s_chtml30_end_font_tag(void *pdoc, Node *node)
1558 chtml30 = GET_CHTML30(pdoc);
1562 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1563 if (flg && flg->with_font_flag) {
1566 if (IS_CSS_ON(chtml30->entryp)) {
1567 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1570 return chtml30->out;
1575 * It is a handler who processes the FORM tag.
1577 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1578 * destination is specified.
1579 * @param node [i] The FORM tag node is specified.
1580 * @return The conversion result is returned.
1583 s_chtml30_start_form_tag(void *pdoc, Node *node)
1589 char *attr_style = NULL;
1590 char *attr_color = NULL;
1591 char *attr_align = NULL;
1592 char *new_hidden_tag = NULL;
1593 char *attr_method = NULL;
1594 char *attr_action = NULL;
1595 char *attr_utn = NULL;
1597 chtml30 = GET_CHTML30(pdoc);
1601 /*--------------------------------------------------------------------------*/
1602 /* Get Attributes */
1603 /*--------------------------------------------------------------------------*/
1604 for (attr = qs_get_attr(doc,node);
1606 attr = qs_get_next_attr(doc,attr)) {
1607 char *name = qs_get_attr_name(doc,attr);
1608 char *value = qs_get_attr_value(doc,attr);
1612 if (strcasecmp(name, "action") == 0) {
1613 /*--------------------------------------------------------------------*/
1615 /*--------------------------------------------------------------------*/
1616 attr_action = value;
1622 if (strcasecmp(name, "method") == 0) {
1623 /*--------------------------------------------------------------------*/
1625 /*--------------------------------------------------------------------*/
1626 attr_method = value;
1632 if (strcasecmp(name, "utn") == 0) {
1633 /*--------------------------------------------------------------------*/
1635 /*--------------------------------------------------------------------*/
1642 if (strcasecmp(name, "style") == 0) {
1651 if (IS_CSS_ON(chtml30->entryp)) {
1652 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1654 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1655 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1656 css_property_t *cur;
1657 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1658 if (STRCASEEQ('l','L',"left", cur->value)) {
1659 attr_align = apr_pstrdup(doc->pool, "left");
1661 else if (STRCASEEQ('c','C',"center",cur->value)) {
1662 attr_align = apr_pstrdup(doc->pool, "center");
1664 else if (STRCASEEQ('r','R',"right",cur->value)) {
1665 attr_align = apr_pstrdup(doc->pool, "right");
1668 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1669 attr_color = apr_pstrdup(doc->pool, cur->value);
1674 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1678 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1679 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml30->cookie);
1681 char *new_query_string = NULL;
1682 q = strchr(attr_action, '?');
1684 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml30->entryp);
1685 if (new_hidden_tag || new_query_string) {
1691 if (new_query_string) {
1693 W_V(new_query_string);
1707 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1708 memset(flg, 0, sizeof(*flg));
1710 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1711 W_L("<font color=\"");
1714 flg->with_font_flag = 1;
1717 W_L("<div align=\"");
1720 flg->with_div_flag = 1;
1722 node->userData = flg;
1724 if (new_hidden_tag) {
1725 W_V(new_hidden_tag);
1727 return chtml30->out;
1732 * It is a handler who processes the FORM tag.
1734 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1735 * destination is specified.
1736 * @param node [i] The FORM tag node is specified.
1737 * @return The conversion result is returned.
1740 s_chtml30_end_form_tag(void *pdoc, Node *node)
1745 chtml30 = GET_CHTML30(pdoc);
1748 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1749 if (flg && flg->with_div_flag) {
1752 if (flg && flg->with_font_flag) {
1756 if (IS_CSS_ON(chtml30->entryp)) {
1757 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1760 return chtml30->out;
1765 * It is a handler who processes the INPUT tag.
1767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1768 * destination is specified.
1769 * @param node [i] The INPUT tag node is specified.
1770 * @return The conversion result is returned.
1773 s_chtml30_start_input_tag(void *pdoc, Node *node)
1779 char *attr_accesskey = NULL;
1780 char *attr_max_length = NULL;
1781 char *attr_type = NULL;
1782 char *attr_name = NULL;
1783 char *attr_value = NULL;
1784 char *attr_istyle = NULL;
1785 char *attr_size = NULL;
1786 char *attr_checked = NULL;
1787 char *attr_style = NULL;
1789 chtml30 = GET_CHTML30(pdoc);
1793 /*--------------------------------------------------------------------------*/
1794 /* Get Attributes */
1795 /*--------------------------------------------------------------------------*/
1796 for (attr = qs_get_attr(doc,node);
1798 attr = qs_get_next_attr(doc,attr)) {
1799 char *name = qs_get_attr_name(doc,attr);
1800 char *value = qs_get_attr_value(doc,attr);
1801 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1802 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1803 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1804 STRCASEEQ('p','P',"password",tmp_type) ||
1805 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1806 STRCASEEQ('r','R',"radio", tmp_type) ||
1807 STRCASEEQ('h','H',"hidden", tmp_type) ||
1808 STRCASEEQ('s','S',"submit", tmp_type) ||
1809 STRCASEEQ('r','R',"reset", tmp_type))) {
1810 attr_type = tmp_type;
1813 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1816 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1819 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1820 attr_istyle = value;
1822 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1823 attr_max_length = value;
1825 else if (STRCASEEQ('c','C',"checked", name)) {
1826 attr_checked = value;
1828 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1829 attr_accesskey = value;
1831 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1834 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1839 if (IS_CSS_ON(chtml30->entryp)) {
1840 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
1842 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1843 css_property_t *cur;
1844 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1845 if (strcasestr(cur->value, "<ja:n>")) {
1848 else if (strcasestr(cur->value, "<ja:en>")) {
1851 else if (strcasestr(cur->value, "<ja:hk>")) {
1854 else if (strcasestr(cur->value, "<ja:h>")) {
1878 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1879 apr_size_t value_len = strlen(attr_value);
1880 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml30->entryp);
1884 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1887 if (attr_accesskey) {
1888 W_L(" accesskey=\"");
1889 W_V(attr_accesskey);
1893 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1899 /*--------------------------------------------------------------------------*/
1900 /* The figure is default for the password. */
1901 /*--------------------------------------------------------------------------*/
1902 if (attr_max_length) {
1903 if (chxj_chk_numeric(attr_max_length) != 0) {
1904 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1906 if (attr_istyle && *attr_istyle == '1') {
1907 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1911 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1920 return chtml30->out;
1925 * It is a handler who processes the INPUT tag.
1927 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1928 * destination is specified.
1929 * @param node [i] The INPUT tag node is specified.
1930 * @return The conversion result is returned.
1933 s_chtml30_end_input_tag(void *pdoc, Node *UNUSED(node))
1939 chtml30 = GET_CHTML30(pdoc);
1943 return chtml30->out;
1948 * It is a handler who processes the CENTER tag.
1950 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1951 * destination is specified.
1952 * @param node [i] The CENTER tag node is specified.
1953 * @return The conversion result is returned.
1956 s_chtml30_start_center_tag(void *pdoc, Node *node)
1961 char *attr_style = NULL;
1962 char *attr_color = NULL;
1964 chtml30 = GET_CHTML30(pdoc);
1967 for (attr = qs_get_attr(doc,node);
1969 attr = qs_get_next_attr(doc,attr)) {
1970 char *name = qs_get_attr_name(doc,attr);
1971 char *value = qs_get_attr_value(doc,attr);
1972 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1977 if (IS_CSS_ON(chtml30->entryp)) {
1978 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1980 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1981 css_property_t *cur;
1982 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1983 if (cur->value && *cur->value) {
1984 attr_color = apr_pstrdup(doc->pool, cur->value);
1991 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1992 memset(flg, 0, sizeof(*flg));
1994 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1995 W_L("<font color=\"");
1998 flg->with_font_flag = 1;
2000 node->userData = flg;
2002 return chtml30->out;
2007 * It is a handler who processes the CENTER tag.
2009 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2010 * destination is specified.
2011 * @param node [i] The CENTER tag node is specified.
2012 * @return The conversion result is returned.
2015 s_chtml30_end_center_tag(void *pdoc, Node *node)
2020 chtml30 = GET_CHTML30(pdoc);
2023 if (IS_CSS_ON(chtml30->entryp)) {
2024 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2026 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
2027 if (flg && flg->with_font_flag) {
2032 return chtml30->out;
2037 * It is a handler who processes the HR tag.
2039 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2040 * destination is specified.
2041 * @param node [i] The HR tag node is specified.
2042 * @return The conversion result is returned.
2045 s_chtml30_start_hr_tag(void *pdoc, Node *node)
2051 char *attr_align = NULL;
2052 char *attr_size = NULL;
2053 char *attr_width = NULL;
2054 char *attr_noshade = NULL;
2055 char *attr_style = NULL;
2057 chtml30 = GET_CHTML30(pdoc);
2061 for (attr = qs_get_attr(doc,node);
2063 attr = qs_get_next_attr(doc,attr)) {
2064 char *name = qs_get_attr_name (doc,attr);
2065 char *value = qs_get_attr_value(doc,attr);
2069 if (strcasecmp(name, "align") == 0) {
2070 /*--------------------------------------------------------------------*/
2072 /*--------------------------------------------------------------------*/
2073 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2081 if (strcasecmp(name, "size") == 0) {
2082 /*--------------------------------------------------------------------*/
2084 /*--------------------------------------------------------------------*/
2085 if (value && *value) {
2089 else if (strcasecmp(name, "style") == 0) {
2090 if (value && *value) {
2098 if (strcasecmp(name, "width") == 0) {
2099 /*--------------------------------------------------------------------*/
2101 /*--------------------------------------------------------------------*/
2102 if (value && *value) {
2110 if (strcasecmp(name, "noshade") == 0) {
2111 /*--------------------------------------------------------------------*/
2113 /*--------------------------------------------------------------------*/
2114 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2120 if (strcasecmp(name, "color") == 0) {
2121 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2132 if (IS_CSS_ON(chtml30->entryp)) {
2133 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2135 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2136 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2137 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2138 css_property_t *cur;
2139 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2140 if (STRCASEEQ('s','S',"solid",cur->value)) {
2141 attr_noshade = "noshade";
2144 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2145 char *tmp = apr_pstrdup(doc->pool, cur->value);
2146 char *tmpp = strstr(tmp, "px");
2149 attr_size = apr_pstrdup(doc->pool, tmp);
2152 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2153 char *tmp = apr_pstrdup(doc->pool, cur->value);
2154 char *tmpp = strstr(tmp, "px");
2157 attr_width = apr_pstrdup(doc->pool, tmp);
2160 tmpp = strstr(tmp, "%");
2162 attr_width = apr_pstrdup(doc->pool, tmp);
2188 return chtml30->out;
2193 * It is a handler who processes the HR tag.
2195 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2196 * destination is specified.
2197 * @param node [i] The HR tag node is specified.
2198 * @return The conversion result is returned.
2201 s_chtml30_end_hr_tag(void *pdoc, Node *UNUSED(child))
2203 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2204 return chtml30->out;
2209 * It is a handler who processes the IMG tag.
2211 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2212 * destination is specified.
2213 * @param node [i] The IMG tag node is specified.
2214 * @return The conversion result is returned.
2217 s_chtml30_start_img_tag(void *pdoc, Node *node)
2223 char *attr_src = NULL;
2224 char *attr_align = NULL;
2225 char *attr_style = NULL;
2226 char *attr_alt = NULL;
2227 char *attr_width = NULL;
2228 char *attr_height = NULL;
2229 char *attr_hspace = NULL;
2230 char *attr_vspace = NULL;
2231 #ifndef IMG_NOT_CONVERT_FILENAME
2235 chtml30 = GET_CHTML30(pdoc);
2236 #ifndef IMG_NOT_CONVERT_FILENAME
2237 spec = chtml30->spec;
2242 /*--------------------------------------------------------------------------*/
2243 /* Get Attributes */
2244 /*--------------------------------------------------------------------------*/
2245 for (attr = qs_get_attr(doc,node);
2247 attr = qs_get_next_attr(doc,attr)) {
2248 char *name = qs_get_attr_name (doc,attr);
2249 char *value = qs_get_attr_value(doc,attr);
2253 if (strcasecmp(name, "src") == 0) {
2254 /*--------------------------------------------------------------------*/
2256 /*--------------------------------------------------------------------*/
2257 #ifdef IMG_NOT_CONVERT_FILENAME
2258 value = chxj_encoding_parameter(r, value, 0);
2259 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2260 value = chxj_add_cookie_no_update_parameter(r, value);
2263 value = chxj_img_conv(r,spec,value);
2264 value = chxj_encoding_parameter(r, value, 0);
2265 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2266 value = chxj_add_cookie_no_update_parameter(r, value);
2270 else if (strcasecmp(name,"style") == 0 && value && *value) {
2277 if (strcasecmp(name, "align" ) == 0) {
2278 /*--------------------------------------------------------------------*/
2280 /*--------------------------------------------------------------------*/
2281 /*--------------------------------------------------------------------*/
2283 /*--------------------------------------------------------------------*/
2285 if (STRCASEEQ('t','T',"top", value) ||
2286 STRCASEEQ('m','M',"middle",value) ||
2287 STRCASEEQ('b','B',"bottom",value) ||
2288 STRCASEEQ('l','L',"left", value) ||
2289 STRCASEEQ('r','R',"right", value)) {
2292 else if (STRCASEEQ('c','C',"center", value)) {
2293 attr_align = apr_pstrdup(doc->pool, "middle");
2297 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2298 /*--------------------------------------------------------------------*/
2300 /*--------------------------------------------------------------------*/
2307 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2308 /*--------------------------------------------------------------------*/
2310 /*--------------------------------------------------------------------*/
2317 if (strcasecmp(name, "height") == 0 && value && *value) {
2318 /*--------------------------------------------------------------------*/
2320 /*--------------------------------------------------------------------*/
2321 attr_height = value;
2324 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2325 /*--------------------------------------------------------------------*/
2327 /*--------------------------------------------------------------------*/
2328 attr_hspace = value;
2334 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2335 /*--------------------------------------------------------------------*/
2337 /*--------------------------------------------------------------------*/
2338 attr_vspace = value;
2347 if (IS_CSS_ON(chtml30->entryp)) {
2348 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2350 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2351 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2352 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2353 css_property_t *cur;
2354 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2355 attr_height = apr_pstrdup(doc->pool, cur->value);
2357 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2358 attr_width = apr_pstrdup(doc->pool, cur->value);
2360 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2361 attr_align = apr_pstrdup(doc->pool, cur->value);
2403 return chtml30->out;
2408 * It is a handler who processes the IMG tag.
2410 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2411 * destination is specified.
2412 * @param node [i] The IMG tag node is specified.
2413 * @return The conversion result is returned.
2416 s_chtml30_end_img_tag(void *pdoc, Node *UNUSED(child))
2418 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2420 return chtml30->out;
2425 * It is a handler who processes the SELECT tag.
2427 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2428 * destination is specified.
2429 * @param node [i] The SELECT tag node is specified.
2430 * @return The conversion result is returned.
2433 s_chtml30_start_select_tag(void *pdoc, Node *node)
2435 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2436 Doc *doc = chtml30->doc;
2439 char *multiple = NULL;
2441 char *attr_style = NULL;
2444 for (attr = qs_get_attr(doc,node);
2446 attr = qs_get_next_attr(doc,attr)) {
2447 char *nm = qs_get_attr_name(doc,attr);
2448 char *val = qs_get_attr_value(doc,attr);
2449 if (STRCASEEQ('s','S',"size", nm)) {
2450 /*----------------------------------------------------------------------*/
2451 /* CHTML 1.0 version 2.0 */
2452 /*----------------------------------------------------------------------*/
2453 size = apr_pstrdup(doc->buf.pool, val);
2455 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2456 /*----------------------------------------------------------------------*/
2457 /* CHTML 1.0 version 2.0 */
2458 /*----------------------------------------------------------------------*/
2459 attr_style = apr_pstrdup(doc->buf.pool, val);
2461 else if (STRCASEEQ('n','N',"name", nm)) {
2462 /*----------------------------------------------------------------------*/
2463 /* CHTML 1.0 version 2.0 */
2464 /*----------------------------------------------------------------------*/
2465 name = apr_pstrdup(doc->buf.pool, val);
2467 else if (STRCASEEQ('m','M',"multiple", nm)) {
2468 /*----------------------------------------------------------------------*/
2469 /* CHTML 1.0 version 2.0 */
2470 /*----------------------------------------------------------------------*/
2471 multiple = apr_pstrdup(doc->buf.pool, val);
2474 if (size && *size) {
2479 if (name && *name) {
2488 if (IS_CSS_ON(chtml30->entryp)) {
2489 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2491 return chtml30->out;
2496 * It is a handler who processes the SELECT tag.
2498 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2499 * destination is specified.
2500 * @param node [i] The SELECT tag node is specified.
2501 * @return The conversion result is returned.
2504 s_chtml30_end_select_tag(void *pdoc, Node *UNUSED(child))
2506 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2507 Doc *doc = chtml30->doc;
2510 if (IS_CSS_ON(chtml30->entryp)) {
2511 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2514 return chtml30->out;
2519 * It is a handler who processes the OPTION tag.
2521 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2522 * destination is specified.
2523 * @param node [i] The OPTION tag node is specified.
2524 * @return The conversion result is returned.
2527 s_chtml30_start_option_tag(void *pdoc, Node *node)
2535 char *attr_style = NULL;
2537 chtml30 = GET_CHTML30(pdoc);
2544 for (attr = qs_get_attr(doc,node);
2546 attr = qs_get_next_attr(doc,attr)) {
2547 char *nm = qs_get_attr_name(doc,attr);
2548 char *val = qs_get_attr_value(doc,attr);
2549 if (STRCASEEQ('s','S',"selected", nm)) {
2550 /*----------------------------------------------------------------------*/
2551 /* CHTML 1.0 version 2.0 */
2552 /*----------------------------------------------------------------------*/
2553 selected = apr_pstrdup(doc->buf.pool, val);
2555 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2556 /*----------------------------------------------------------------------*/
2557 /* CHTML 1.0 version 2.0 */
2558 /*----------------------------------------------------------------------*/
2559 attr_style = apr_pstrdup(doc->buf.pool, val);
2561 else if (STRCASEEQ('v','V',"value", nm)) {
2562 /*----------------------------------------------------------------------*/
2563 /* CHTML 1.0 version 2.0 */
2564 /*----------------------------------------------------------------------*/
2565 value = apr_pstrdup(doc->buf.pool, val);
2577 if (IS_CSS_ON(chtml30->entryp)) {
2578 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2580 return chtml30->out;
2585 * It is a handler who processes the OPTION tag.
2587 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2588 * destination is specified.
2589 * @param node [i] The OPTION tag node is specified.
2590 * @return The conversion result is returned.
2593 s_chtml30_end_option_tag(void *pdoc, Node *UNUSED(child))
2595 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2598 if (IS_CSS_ON(chtml30->entryp)) {
2599 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2602 return chtml30->out;
2607 * It is a handler who processes the DIV tag.
2609 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2610 * destination is specified.
2611 * @param node [i] The DIV tag node is specified.
2612 * @return The conversion result is returned.
2615 s_chtml30_start_div_tag(void *pdoc, Node *node)
2621 char *attr_style = NULL;
2622 char *attr_align = NULL;
2623 char *attr_display = NULL;
2624 char *attr_decoration = NULL;
2625 char *attr_wap_marquee_style = NULL;
2626 char *attr_wap_marquee_dir = NULL;
2627 char *attr_wap_marquee_loop = NULL;
2628 char *attr_color = NULL;
2629 char *attr_bgcolor = NULL;
2631 chtml30 = GET_CHTML30(pdoc);
2635 for (attr = qs_get_attr(doc,node);
2637 attr = qs_get_next_attr(doc,attr)) {
2638 char *nm = qs_get_attr_name(doc,attr);
2639 char *val = qs_get_attr_value(doc,attr);
2640 if (STRCASEEQ('a','A', "align", nm)) {
2641 /*----------------------------------------------------------------------*/
2642 /* CHTML 1.0 (W3C version 3.2) */
2643 /*----------------------------------------------------------------------*/
2644 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2645 attr_align = apr_pstrdup(doc->buf.pool, val);
2648 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2649 attr_style = apr_pstrdup(doc->buf.pool, val);
2653 if (IS_CSS_ON(chtml30->entryp)) {
2654 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2656 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2657 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2658 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2659 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2660 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2661 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2663 css_property_t *cur;
2664 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2665 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2666 attr_display = apr_pstrdup(doc->pool, cur->value);
2669 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2670 if (STRCASEEQ('b','B',"blink", cur->value)) {
2671 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2674 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2675 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2676 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2678 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2679 char *ss = strchr(cur->value, '#');
2681 ss = strstr(cur->value, "rgb");
2684 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2685 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2688 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2689 attr_color = apr_pstrdup(doc->pool, cur->value);
2690 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2692 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2693 attr_align = apr_pstrdup(doc->pool, cur->value);
2696 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2697 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2698 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2699 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2700 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2701 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2704 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2705 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2706 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2708 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2709 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2712 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2713 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2714 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2717 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2723 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2724 memset(flg, 0, sizeof(*flg));
2731 flg->with_div_flag = 1;
2735 flg->with_div_flag = 1;
2738 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2742 W_L("<font color=\"");
2745 flg->with_font_flag = 1;
2748 if (attr_decoration) {
2750 flg->with_blink_flag = 1;
2754 if (attr_wap_marquee_style) {
2755 W_L(" behavior=\"");
2756 W_V(attr_wap_marquee_style);
2759 if (attr_wap_marquee_dir) {
2760 W_L(" direction=\"");
2761 W_V(attr_wap_marquee_dir);
2764 if (attr_wap_marquee_loop) {
2766 W_V(attr_wap_marquee_loop);
2770 flg->with_marquee_flag = 1;
2772 node->userData = flg;
2774 return chtml30->out;
2779 * It is a handler who processes the DIV tag.
2781 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2782 * destination is specified.
2783 * @param node [i] The DIV tag node is specified.
2784 * @return The conversion result is returned.
2787 s_chtml30_end_div_tag(void *pdoc, Node *node)
2789 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2790 Doc *doc = chtml30->doc;
2792 chtml30_flags_t *flg = node->userData;
2793 if (flg && flg->with_marquee_flag) {
2796 if (flg && flg->with_blink_flag) {
2799 if (flg && flg->with_font_flag) {
2802 if (flg && flg->with_div_flag) {
2805 if (IS_CSS_ON(chtml30->entryp)) {
2806 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2808 node->userData = NULL;
2810 return chtml30->out;
2815 * It is a handler who processes the UL tag.
2817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2818 * destination is specified.
2819 * @param node [i] The UL tag node is specified.
2820 * @return The conversion result is returned.
2823 s_chtml30_start_ul_tag(void *pdoc, Node *node)
2825 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2826 Doc *doc = chtml30->doc;
2828 char *attr_style = 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);
2835 if (val && STRCASEEQ('s','S',"style", nm)) {
2840 if (IS_CSS_ON(chtml30->entryp)) {
2841 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2846 return chtml30->out;
2851 * It is a handler who processes the UL tag.
2853 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2854 * destination is specified.
2855 * @param node [i] The UL tag node is specified.
2856 * @return The conversion result is returned.
2859 s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
2861 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2862 Doc *doc = chtml30->doc;
2864 if (IS_CSS_ON(chtml30->entryp)) {
2865 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2869 return chtml30->out;
2874 * It is a handler who processes the PRE tag.
2876 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2877 * destination is specified.
2878 * @param node [i] The PRE tag node is specified.
2879 * @return The conversion result is returned.
2882 s_chtml30_start_pre_tag(void *pdoc, Node *node)
2884 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2885 Doc *doc = chtml30->doc;
2887 char *attr_style = NULL;
2889 for (attr = qs_get_attr(doc,node);
2891 attr = qs_get_next_attr(doc,attr)) {
2892 char *nm = qs_get_attr_name(doc,attr);
2893 char *val = qs_get_attr_value(doc,attr);
2894 if (val && STRCASEEQ('s','S',"style", nm)) {
2899 if (IS_CSS_ON(chtml30->entryp)) {
2900 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2903 chtml30->pre_flag++;
2906 return chtml30->out;
2911 * It is a handler who processes the PRE tag.
2913 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2914 * destination is specified.
2915 * @param node [i] The PRE tag node is specified.
2916 * @return The conversion result is returned.
2919 s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
2921 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2922 Doc *doc = chtml30->doc;
2925 chtml30->pre_flag--;
2926 if (IS_CSS_ON(chtml30->entryp)) {
2927 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2930 return chtml30->out;
2935 * It is a handler who processes the P tag.
2937 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2938 * destination is specified.
2939 * @param node [i] The P tag node is specified.
2940 * @return The conversion result is returned.
2943 s_chtml30_start_p_tag(void *pdoc, Node *node)
2949 char *attr_align = NULL;
2950 char *attr_style = NULL;
2951 char *attr_color = NULL;
2952 char *attr_blink = NULL;
2954 chtml30 = GET_CHTML30(pdoc);
2958 for (attr = qs_get_attr(doc,node);
2960 attr = qs_get_next_attr(doc,attr)) {
2961 char *nm = qs_get_attr_name(doc,attr);
2962 char *val = qs_get_attr_value(doc,attr);
2963 if (STRCASEEQ('a','A',"align", nm)) {
2964 /*----------------------------------------------------------------------*/
2965 /* CHTML 1.0 (W3C version 3.2) */
2966 /*----------------------------------------------------------------------*/
2967 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2968 attr_align = apr_pstrdup(doc->buf.pool, val);
2972 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2973 attr_style = apr_pstrdup(doc->buf.pool, val);
2976 if (IS_CSS_ON(chtml30->entryp)) {
2977 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2979 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2980 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2981 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2982 css_property_t *cur;
2983 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2984 if (STRCASEEQ('l','L',"left",cur->value)) {
2985 attr_align = apr_pstrdup(doc->pool, "left");
2987 else if (STRCASEEQ('c','C',"center",cur->value)) {
2988 attr_align = apr_pstrdup(doc->pool, "center");
2990 else if (STRCASEEQ('r','R',"right",cur->value)) {
2991 attr_align = apr_pstrdup(doc->pool, "right");
2994 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2995 if (cur->value && *cur->value) {
2996 attr_color = apr_pstrdup(doc->pool, cur->value);
2999 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3000 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3001 attr_blink = apr_pstrdup(doc->pool, cur->value);
3014 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
3015 memset(flg, 0, sizeof(*flg));
3017 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3018 W_L("<font color=\"");
3021 flg->with_font_flag = 1;
3025 flg->with_blink_flag = 1;
3027 node->userData = (void *)flg;
3029 return chtml30->out;
3034 * It is a handler who processes the P tag.
3036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3037 * destination is specified.
3038 * @param node [i] The P tag node is specified.
3039 * @return The conversion result is returned.
3042 s_chtml30_end_p_tag(void *pdoc, Node *node)
3047 chtml30 = GET_CHTML30(pdoc);
3050 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
3051 if (flg->with_font_flag) {
3054 if (flg->with_blink_flag) {
3058 if (IS_CSS_ON(chtml30->entryp)) {
3059 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3062 return chtml30->out;
3067 * It is a handler who processes the OL tag.
3069 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3070 * destination is specified.
3071 * @param node [i] The OL tag node is specified.
3072 * @return The conversion result is returned.
3075 s_chtml30_start_ol_tag(void *pdoc, Node *node)
3081 char *attr_style = NULL;
3082 char *attr_start = NULL;
3083 char *attr_type = NULL;
3085 chtml30 = GET_CHTML30(pdoc);
3089 /*--------------------------------------------------------------------------*/
3090 /* Get Attributes */
3091 /*--------------------------------------------------------------------------*/
3092 for (attr = qs_get_attr(doc,node);
3094 attr = qs_get_next_attr(doc,attr)) {
3095 char *name = qs_get_attr_name(doc,attr);
3096 char *value = qs_get_attr_value(doc,attr);
3097 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3100 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3103 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3107 if (IS_CSS_ON(chtml30->entryp)) {
3108 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3110 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3111 css_property_t *cur;
3112 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3113 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3114 attr_type = apr_pstrdup(doc->pool, "1");
3116 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3117 attr_type = apr_pstrdup(doc->pool, "A");
3119 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3120 attr_type = apr_pstrdup(doc->pool, "a");
3138 return chtml30->out;
3143 * It is a handler who processes the OL tag.
3145 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3146 * destination is specified.
3147 * @param node [i] The OL tag node is specified.
3148 * @return The conversion result is returned.
3151 s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
3153 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3154 Doc *doc = chtml30->doc;
3157 if (IS_CSS_ON(chtml30->entryp)) {
3158 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3161 return chtml30->out;
3166 * It is a handler who processes the LI tag.
3168 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3169 * destination is specified.
3170 * @param node [i] The LI tag node is specified.
3171 * @return The conversion result is returned.
3174 s_chtml30_start_li_tag(void *pdoc, Node *node)
3176 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3177 Doc *doc = chtml30->doc;
3179 char *attr_type = NULL;
3180 char *attr_value = NULL;
3181 char *attr_style = NULL;
3182 /*--------------------------------------------------------------------------*/
3183 /* Get Attributes */
3184 /*--------------------------------------------------------------------------*/
3185 for (attr = qs_get_attr(doc,node);
3187 attr = qs_get_next_attr(doc,attr)) {
3188 char *name = qs_get_attr_name(doc,attr);
3189 char *value = qs_get_attr_value(doc,attr);
3190 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3193 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3196 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3200 if (IS_CSS_ON(chtml30->entryp)) {
3201 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3203 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3204 css_property_t *cur;
3205 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3206 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3207 attr_type = apr_pstrdup(doc->pool, "1");
3209 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3210 attr_type = apr_pstrdup(doc->pool, "A");
3212 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3213 attr_type = apr_pstrdup(doc->pool, "a");
3231 return chtml30->out;
3236 * It is a handler who processes the LI tag.
3238 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3239 * destination is specified.
3240 * @param node [i] The LI tag node is specified.
3241 * @return The conversion result is returned.
3244 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
3246 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3248 if (IS_CSS_ON(chtml30->entryp)) {
3249 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3251 return chtml30->out;
3256 * It is a handler who processes the H1 tag.
3258 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3259 * destination is specified.
3260 * @param node [i] The H1 tag node is specified.
3261 * @return The conversion result is returned.
3264 s_chtml30_start_h1_tag(void *pdoc, Node *node)
3270 char *attr_style = NULL;
3271 char *attr_align = NULL;
3274 chtml30 = GET_CHTML30(pdoc);
3278 for (attr = qs_get_attr(doc,node);
3280 attr = qs_get_next_attr(doc,attr)) {
3281 char *name = qs_get_attr_name(doc,attr);
3282 char *value = qs_get_attr_value(doc,attr);
3283 if (STRCASEEQ('a','A',"align", name)) {
3284 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3288 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3292 if (IS_CSS_ON(chtml30->entryp)) {
3293 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3295 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3296 css_property_t *cur;
3297 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3298 if (STRCASEEQ('l','L',"left", cur->value)) {
3299 attr_align = apr_pstrdup(doc->pool, "left");
3301 else if (STRCASEEQ('c','C',"center",cur->value)) {
3302 attr_align = apr_pstrdup(doc->pool, "center");
3304 else if (STRCASEEQ('r','R',"right",cur->value)) {
3305 attr_align = apr_pstrdup(doc->pool, "right");
3318 return chtml30->out;
3323 * It is a handler who processes the H1 tag.
3325 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3326 * destination is specified.
3327 * @param node [i] The H1 tag node is specified.
3328 * @return The conversion result is returned.
3331 s_chtml30_end_h1_tag(void *pdoc, Node *UNUSED(child))
3336 chtml30 = GET_CHTML30(pdoc);
3340 if (IS_CSS_ON(chtml30->entryp)) {
3341 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3344 return chtml30->out;
3349 * It is a handler who processes the H2 tag.
3351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3352 * destination is specified.
3353 * @param node [i] The H2 tag node is specified.
3354 * @return The conversion result is returned.
3357 s_chtml30_start_h2_tag(void *pdoc, Node *node)
3363 char *attr_style = NULL;
3364 char *attr_align = NULL;
3366 chtml30 = GET_CHTML30(pdoc);
3370 for (attr = qs_get_attr(doc,node);
3372 attr = qs_get_next_attr(doc,attr)) {
3373 char *name = qs_get_attr_name(doc,attr);
3374 char *value = qs_get_attr_value(doc,attr);
3375 if (STRCASEEQ('a','A',"align", name)) {
3376 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3380 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3384 if (IS_CSS_ON(chtml30->entryp)) {
3385 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3387 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3388 css_property_t *cur;
3389 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3390 if (STRCASEEQ('l','L',"left", cur->value)) {
3391 attr_align = apr_pstrdup(doc->pool, "left");
3393 else if (STRCASEEQ('c','C',"center",cur->value)) {
3394 attr_align = apr_pstrdup(doc->pool, "center");
3396 else if (STRCASEEQ('r','R',"right",cur->value)) {
3397 attr_align = apr_pstrdup(doc->pool, "right");
3410 return chtml30->out;
3415 * It is a handler who processes the H2 tag.
3417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3418 * destination is specified.
3419 * @param node [i] The H2 tag node is specified.
3420 * @return The conversion result is returned.
3423 s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child))
3425 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3426 Doc *doc = chtml30->doc;
3429 if (IS_CSS_ON(chtml30->entryp)) {
3430 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3433 return chtml30->out;
3438 * It is a handler who processes the H3 tag.
3440 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3441 * destination is specified.
3442 * @param node [i] The H3 tag node is specified.
3443 * @return The conversion result is returned.
3446 s_chtml30_start_h3_tag(void *pdoc, Node *node)
3452 char *attr_style = NULL;
3453 char *attr_align = NULL;
3455 chtml30 = GET_CHTML30(pdoc);
3459 for (attr = qs_get_attr(doc,node);
3461 attr = qs_get_next_attr(doc,attr)) {
3462 char *name = qs_get_attr_name(doc,attr);
3463 char *value = qs_get_attr_value(doc,attr);
3464 if (STRCASEEQ('a','A',"align", name)) {
3465 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3469 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3473 if (IS_CSS_ON(chtml30->entryp)) {
3474 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3476 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3477 css_property_t *cur;
3478 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3479 if (STRCASEEQ('l','L',"left", cur->value)) {
3480 attr_align = apr_pstrdup(doc->pool, "left");
3482 else if (STRCASEEQ('c','C',"center",cur->value)) {
3483 attr_align = apr_pstrdup(doc->pool, "center");
3485 else if (STRCASEEQ('r','R',"right",cur->value)) {
3486 attr_align = apr_pstrdup(doc->pool, "right");
3499 return chtml30->out;
3504 * It is a handler who processes the H3 tag.
3506 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3507 * destination is specified.
3508 * @param node [i] The H3 tag node is specified.
3509 * @return The conversion result is returned.
3512 s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
3514 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3515 Doc *doc = chtml30->doc;
3518 if (IS_CSS_ON(chtml30->entryp)) {
3519 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3522 return chtml30->out;
3527 * It is a handler who processes the H4 tag.
3529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3530 * destination is specified.
3531 * @param node [i] The H4 tag node is specified.
3532 * @return The conversion result is returned.
3535 s_chtml30_start_h4_tag(void *pdoc, Node *node)
3541 char *attr_style = NULL;
3542 char *attr_align = NULL;
3544 chtml30 = GET_CHTML30(pdoc);
3548 for (attr = qs_get_attr(doc,node);
3550 attr = qs_get_next_attr(doc,attr)) {
3551 char *name = qs_get_attr_name(doc,attr);
3552 char *value = qs_get_attr_value(doc,attr);
3553 if (STRCASEEQ('a','A',"align", name)) {
3554 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3558 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3562 if (IS_CSS_ON(chtml30->entryp)) {
3563 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3565 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3566 css_property_t *cur;
3567 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3568 if (STRCASEEQ('l','L',"left", cur->value)) {
3569 attr_align = apr_pstrdup(doc->pool, "left");
3571 else if (STRCASEEQ('c','C',"center",cur->value)) {
3572 attr_align = apr_pstrdup(doc->pool, "center");
3574 else if (STRCASEEQ('r','R',"right",cur->value)) {
3575 attr_align = apr_pstrdup(doc->pool, "right");
3588 return chtml30->out;
3593 * It is a handler who processes the H4 tag.
3595 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3596 * destination is specified.
3597 * @param node [i] The H4 tag node is specified.
3598 * @return The conversion result is returned.
3601 s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child))
3603 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3604 Doc *doc = chtml30->doc;
3607 if (IS_CSS_ON(chtml30->entryp)) {
3608 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3611 return chtml30->out;
3616 * It is a handler who processes the H5 tag.
3618 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3619 * destination is specified.
3620 * @param node [i] The H5 tag node is specified.
3621 * @return The conversion result is returned.
3624 s_chtml30_start_h5_tag(void *pdoc, Node *node)
3630 char *attr_style = NULL;
3631 char *attr_align = NULL;
3633 chtml30 = GET_CHTML30(pdoc);
3637 for (attr = qs_get_attr(doc,node);
3639 attr = qs_get_next_attr(doc,attr)) {
3640 char *name = qs_get_attr_name(doc,attr);
3641 char *value = qs_get_attr_value(doc,attr);
3642 if (STRCASEEQ('a','A',"align", name)) {
3643 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3647 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3651 if (IS_CSS_ON(chtml30->entryp)) {
3652 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3654 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3655 css_property_t *cur;
3656 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3657 if (STRCASEEQ('l','L',"left", cur->value)) {
3658 attr_align = apr_pstrdup(doc->pool, "left");
3660 else if (STRCASEEQ('c','C',"center",cur->value)) {
3661 attr_align = apr_pstrdup(doc->pool, "center");
3663 else if (STRCASEEQ('r','R',"right",cur->value)) {
3664 attr_align = apr_pstrdup(doc->pool, "right");
3677 return chtml30->out;
3682 * It is a handler who processes the H5 tag.
3684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3685 * destination is specified.
3686 * @param node [i] The H5 tag node is specified.
3687 * @return The conversion result is returned.
3690 s_chtml30_end_h5_tag(void *pdoc, Node *UNUSED(child))
3692 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3693 Doc *doc = chtml30->doc;
3696 if (IS_CSS_ON(chtml30->entryp)) {
3697 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3700 return chtml30->out;
3705 * It is a handler who processes the H6 tag.
3707 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3708 * destination is specified.
3709 * @param node [i] The H6 tag node is specified.
3710 * @return The conversion result is returned.
3713 s_chtml30_start_h6_tag(void *pdoc, Node *node)
3719 char *attr_style = NULL;
3720 char *attr_align = NULL;
3722 chtml30 = GET_CHTML30(pdoc);
3726 for (attr = qs_get_attr(doc,node);
3728 attr = qs_get_next_attr(doc,attr)) {
3729 char *name = qs_get_attr_name(doc,attr);
3730 char *value = qs_get_attr_value(doc,attr);
3731 if (STRCASEEQ('a','A',"align", name)) {
3732 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3736 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3740 if (IS_CSS_ON(chtml30->entryp)) {
3741 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3743 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3744 css_property_t *cur;
3745 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3746 if (STRCASEEQ('l','L',"left", cur->value)) {
3747 attr_align = apr_pstrdup(doc->pool, "left");
3749 else if (STRCASEEQ('c','C',"center",cur->value)) {
3750 attr_align = apr_pstrdup(doc->pool, "center");
3752 else if (STRCASEEQ('r','R',"right",cur->value)) {
3753 attr_align = apr_pstrdup(doc->pool, "right");
3766 return chtml30->out;
3771 * It is a handler who processes the H6 tag.
3773 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3774 * destination is specified.
3775 * @param node [i] The H6 tag node is specified.
3776 * @return The conversion result is returned.
3779 s_chtml30_end_h6_tag(void *pdoc, Node *UNUSED(child))
3781 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3782 Doc *doc = chtml30->doc;
3785 if (IS_CSS_ON(chtml30->entryp)) {
3786 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3789 return chtml30->out;
3794 * It is a handler who processes the TEXTARE tag.
3796 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3797 * destination is specified.
3798 * @param node [i] The TEXTAREA tag node is specified.
3799 * @return The conversion result is returned.
3802 s_chtml30_start_textarea_tag(void *pdoc, Node *node)
3808 char *attr_accesskey = NULL;
3809 char *attr_name = NULL;
3810 char *attr_rows = NULL;
3811 char *attr_cols = NULL;
3812 char *attr_istyle = NULL;
3813 char *attr_style = NULL;
3815 chtml30 = GET_CHTML30(pdoc);
3819 chtml30->textarea_flag++;
3821 for (attr = qs_get_attr(doc,node);
3823 attr = qs_get_next_attr(doc,attr)) {
3824 char *name = qs_get_attr_name(doc,attr);
3825 char *value = qs_get_attr_value(doc,attr);
3826 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3827 attr_accesskey = value;
3829 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3830 attr_istyle = value;
3832 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3835 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3838 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3841 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3846 if (IS_CSS_ON(chtml30->entryp)) {
3847 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
3849 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3850 css_property_t *cur;
3851 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3852 if (strcasestr(cur->value, "<ja:n>")) {
3855 else if (strcasestr(cur->value, "<ja:en>")) {
3858 else if (strcasestr(cur->value, "<ja:hk>")) {
3861 else if (strcasestr(cur->value, "<ja:h>")) {
3869 if (attr_accesskey) {
3870 W_L(" accesskey=\"");
3871 W_V(attr_accesskey);
3895 return chtml30->out;
3900 * It is a handler who processes the TEXTAREA tag.
3902 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3903 * destination is specified.
3904 * @param node [i] The TEXTAREA tag node is specified.
3905 * @return The conversion result is returned.
3908 s_chtml30_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3910 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3911 Doc *doc = chtml30->doc;
3914 chtml30->textarea_flag--;
3916 return chtml30->out;
3921 s_chtml30_chxjif_tag(void *pdoc, Node *node)
3928 chtml30 = GET_CHTML30(pdoc);
3932 for (child = qs_get_child_node(doc, node);
3934 child = qs_get_next_node(doc, child)) {
3936 s_chtml30_chxjif_tag(chtml30, child);
3944 s_chtml30_text_tag(void *pdoc, Node *child)
3956 apr_size_t z2h_input_len;
3958 chtml30 = GET_CHTML30(pdoc);
3962 textval = qs_get_node_value(doc,child);
3963 if (strlen(textval) == 0) {
3964 return chtml30->out;
3967 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3968 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3970 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3971 memset(one_byte, 0, sizeof(one_byte));
3974 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3976 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
3978 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3983 if (is_sjis_kanji(textval[ii])) {
3984 one_byte[0] = textval[ii+0];
3985 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3986 one_byte[0] = textval[ii+1];
3987 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3990 else if (chtml30->pre_flag) {
3991 one_byte[0] = textval[ii+0];
3992 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3994 else if (chtml30->textarea_flag) {
3995 one_byte[0] = textval[ii+0];
3996 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3998 else if (textval[ii] != '\r' && textval[ii] != '\n') {
3999 one_byte[0] = textval[ii+0];
4000 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4003 z2h_input_len = strlen(tdst);
4004 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml30->entryp);
4007 return chtml30->out;
4012 * It is a handler who processes the BLOCKQUOTE tag.
4014 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4015 * destination is specified.
4016 * @param node [i] The BLOCKQUOTE tag node is specified.
4017 * @return The conversion result is returned.
4020 s_chtml30_start_blockquote_tag(void *pdoc, Node *node)
4025 char *attr_style = NULL;
4026 char *attr_color = NULL;
4028 chtml30 = GET_CHTML30(pdoc);
4030 for (attr = qs_get_attr(doc,node);
4032 attr = qs_get_next_attr(doc,attr)) {
4033 char *nm = qs_get_attr_name(doc,attr);
4034 char *val = qs_get_attr_value(doc,attr);
4035 if (val && STRCASEEQ('s','S',"style", nm)) {
4039 if (IS_CSS_ON(chtml30->entryp)) {
4040 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4042 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4043 css_property_t *cur;
4044 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4045 if (cur->value && *cur->value) {
4046 attr_color = apr_pstrdup(doc->pool, cur->value);
4051 W_L("<blockquote>");
4052 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4053 memset(flg, 0, sizeof(*flg));
4055 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4056 W_L("<font color=\"");
4059 flg->with_font_flag = 1;
4061 node->userData = (void *)flg;
4062 return chtml30->out;
4067 * It is a handler who processes the BLOCKQUOTE tag.
4069 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4070 * destination is specified.
4071 * @param node [i] The BLOCKQUOTE tag node is specified.
4072 * @return The conversion result is returned.
4075 s_chtml30_end_blockquote_tag(void *pdoc, Node *node)
4077 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4078 Doc *doc = chtml30->doc;
4079 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4080 if (flg && flg->with_font_flag) {
4083 W_L("</blockquote>");
4084 if (IS_CSS_ON(chtml30->entryp)) {
4085 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4087 return chtml30->out;
4092 * It is a handler who processes the DIR tag.
4094 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4095 * destination is specified.
4096 * @param node [i] The DIR tag node is specified.
4097 * @return The conversion result is returned.
4100 s_chtml30_start_dir_tag(void *pdoc, Node *node)
4105 char *attr_style = NULL;
4106 char *attr_color = NULL;
4108 chtml30 = GET_CHTML30(pdoc);
4110 for (attr = qs_get_attr(doc,node);
4112 attr = qs_get_next_attr(doc,attr)) {
4113 char *nm = qs_get_attr_name(doc,attr);
4114 char *val = qs_get_attr_value(doc,attr);
4115 if (val && STRCASEEQ('s','S',"style", nm)) {
4119 if (IS_CSS_ON(chtml30->entryp)) {
4120 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4122 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4123 css_property_t *cur;
4124 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4125 if (cur->value && *cur->value) {
4126 attr_color = apr_pstrdup(doc->pool, cur->value);
4132 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4133 memset(flg, 0, sizeof(*flg));
4135 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4136 W_L("<font color=\"");
4139 flg->with_font_flag = 1;
4141 node->userData = (void *)flg;
4142 return chtml30->out;
4147 * It is a handler who processes the DIR tag.
4149 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4150 * destination is specified.
4151 * @param node [i] The DIR tag node is specified.
4152 * @return The conversion result is returned.
4155 s_chtml30_end_dir_tag(void *pdoc, Node *node)
4157 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dir>");
4162 * It is a handler who processes the DL tag.
4164 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4165 * destination is specified.
4166 * @param node [i] The DL tag node is specified.
4167 * @return The conversion result is returned.
4170 s_chtml30_start_dl_tag(void *pdoc, Node *node)
4172 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dl>");
4177 * It is a handler who processes the DL tag.
4179 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4180 * destination is specified.
4181 * @param node [i] The DL tag node is specified.
4182 * @return The conversion result is returned.
4185 s_chtml30_end_dl_tag(void *pdoc, Node *node)
4187 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dl>");
4192 * It is a handler who processes the DT tag.
4194 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4195 * destination is specified.
4196 * @param node [i] The DT tag node is specified.
4197 * @return The conversion result is returned.
4200 s_chtml30_start_dt_tag(void *pdoc, Node *node)
4202 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dt>");
4207 * It is a handler who processes the DT tag.
4209 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4210 * destination is specified.
4211 * @param node [i] The DT tag node is specified.
4212 * @return The conversion result is returned.
4215 s_chtml30_end_dt_tag(void *pdoc, Node *node)
4217 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4222 * It is a handler who processes the DD tag.
4224 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4225 * destination is specified.
4226 * @param node [i] The DD tag node is specified.
4227 * @return The conversion result is returned.
4230 s_chtml30_start_dd_tag(void *pdoc, Node *node)
4232 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dd>");
4237 * It is a handler who processes the DD tag.
4239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4240 * destination is specified.
4241 * @param node [i] The DD tag node is specified.
4242 * @return The conversion result is returned.
4245 s_chtml30_end_dd_tag(void *pdoc, Node *node)
4247 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4252 * It is a handler who processes the MARQUEE tag.
4254 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4255 * destination is specified.
4256 * @param node [i] The MARQUEE tag node is specified.
4257 * @return The conversion result is returned.
4260 s_chtml30_start_marquee_tag(void *pdoc, Node *node)
4262 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4263 Doc *doc = chtml30->doc;
4265 char *attr_direction = NULL;
4266 char *attr_behavior = NULL;
4267 char *attr_loop = NULL;
4268 char *attr_style = NULL;
4269 char *attr_color = NULL;
4270 /*--------------------------------------------------------------------------*/
4271 /* Get Attributes */
4272 /*--------------------------------------------------------------------------*/
4273 for (attr = qs_get_attr(doc,node);
4275 attr = qs_get_next_attr(doc,attr)) {
4276 char *name = qs_get_attr_name(doc,attr);
4277 char *value = qs_get_attr_value(doc,attr);
4278 if (STRCASEEQ('d','D',"direction", name)) {
4279 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4280 attr_direction = value;
4283 else if (STRCASEEQ('b','B',"behavior",name)) {
4284 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4285 attr_behavior = value;
4288 else if (STRCASEEQ('l','L',"loop",name)) {
4289 if (value && *value) {
4293 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4297 if (IS_CSS_ON(chtml30->entryp)) {
4298 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4300 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4301 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4302 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4303 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4304 css_property_t *cur;
4305 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4306 if (cur->value && *cur->value) {
4307 attr_color = apr_pstrdup(doc->pool, cur->value);
4310 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4311 if (cur->value && *cur->value) {
4312 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4315 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4316 if (cur->value && *cur->value) {
4317 attr_loop = apr_pstrdup(doc->pool, cur->value);
4318 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4323 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4324 if (cur->value && *cur->value) {
4325 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4326 attr_direction = "right";
4328 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4329 attr_direction = "left";
4336 if (attr_direction) {
4337 W_L(" direction=\"");
4338 W_V(attr_direction);
4341 if (attr_behavior) {
4342 W_L(" behavior=\"");
4353 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4354 memset(flg, 0, sizeof(*flg));
4356 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4357 W_L("<font color=\"");
4360 flg->with_font_flag = 1;
4362 node->userData = (void *)flg;
4363 return chtml30->out;
4368 * It is a handler who processes the MARQUEE tag.
4370 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4371 * destination is specified.
4372 * @param node [i] The MARQUEE tag node is specified.
4373 * @return The conversion result is returned.
4376 s_chtml30_end_marquee_tag(void *pdoc, Node *node)
4378 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4379 Doc *doc = chtml30->doc;
4380 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4381 if (flg && flg->with_font_flag) {
4385 if (IS_CSS_ON(chtml30->entryp)) {
4386 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4388 return chtml30->out;
4393 * It is a handler who processes the BLINK tag.
4395 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4396 * destination is specified.
4397 * @param node [i] The BLINK tag node is specified.
4398 * @return The conversion result is returned.
4401 s_chtml30_start_blink_tag(void *pdoc, Node *node)
4403 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<blink>");
4408 * It is a handler who processes the BLINK tag.
4410 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4411 * destination is specified.
4412 * @param node [i] The BLINK tag node is specified.
4413 * @return The conversion result is returned.
4416 s_chtml30_end_blink_tag(void *pdoc, Node *node)
4418 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</blink>");
4423 * It is a handler who processes the MENU tag.
4425 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4426 * destination is specified.
4427 * @param node [i] The MENU tag node is specified.
4428 * @return The conversion result is returned.
4431 s_chtml30_start_menu_tag(void *pdoc, Node *node)
4433 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<menu>");
4438 * It is a handler who processes the MENU tag.
4440 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4441 * destination is specified.
4442 * @param node [i] The MENU tag node is specified.
4443 * @return The conversion result is returned.
4446 s_chtml30_end_menu_tag(void *pdoc, Node *node)
4448 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</menu>");
4453 * It is a handler who processes the PLAINTEXT tag.
4455 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4456 * destination is specified.
4457 * @param node [i] The PLAINTEXT tag node is specified.
4458 * @return The conversion result is returned.
4461 s_chtml30_start_plaintext_tag(void *pdoc, Node *node)
4463 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4464 Doc *doc = chtml30->doc;
4466 s_chtml30_start_plaintext_tag_inner(pdoc,node);
4467 return chtml30->out;
4471 s_chtml30_start_plaintext_tag_inner(void *pdoc, Node *node)
4473 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4474 Doc *doc = chtml30->doc;
4476 for (child = qs_get_child_node(doc, node);
4478 child = qs_get_next_node(doc, child)) {
4480 s_chtml30_start_plaintext_tag_inner(pdoc, child);
4482 return chtml30->out;
4487 * It is a handler who processes the PLAINTEXT tag.
4489 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4490 * destination is specified.
4491 * @param node [i] The PLAINTEXT tag node is specified.
4492 * @return The conversion result is returned.
4495 s_chtml30_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4497 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4498 return chtml30->out;
4503 * * It is handler who processes the New Line Code.
4506 s_chtml30_newline_mark(void *pdoc, Node *UNUSED(node))
4508 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4509 Doc *doc = chtml30->doc;
4511 return chtml30->out;
4516 * It is a handler who processes the LINK tag.
4518 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4519 * destination is specified.
4520 * @param node [i] The LINK tag node is specified.
4521 * @return The conversion result is returned.
4524 s_chtml30_link_tag(void *pdoc, Node *node)
4533 chtml30 = GET_CHTML30(pdoc);
4536 if (! IS_CSS_ON(chtml30->entryp)) {
4537 return chtml30->out;
4540 for (attr = qs_get_attr(doc,node);
4542 attr = qs_get_next_attr(doc,attr)) {
4543 char *name = qs_get_attr_name(doc,attr);
4544 char *value = qs_get_attr_value(doc,attr);
4545 if (STRCASEEQ('r','R',"rel", name)) {
4546 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4550 else if (STRCASEEQ('h','H',"href", name)) {
4551 if (value && *value) {
4555 else if (STRCASEEQ('t','T',"type", name)) {
4556 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4562 if (rel && href && type) {
4563 DBG(doc->r, "start load CSS. url:[%s]", href);
4564 chtml30->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml30->style, href);
4565 DBG(doc->r, "end load CSS. url:[%s]", href);
4568 return chtml30->out;
4572 static css_prop_list_t *
4573 s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4575 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4576 Doc *doc = chtml30->doc;
4577 css_prop_list_t *last_css = NULL;
4578 if (IS_CSS_ON(chtml30->entryp)) {
4579 css_prop_list_t *dup_css;
4580 css_selector_t *selector;
4582 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4583 dup_css = chxj_dup_css_prop_list(doc, last_css);
4584 selector = chxj_css_find_selector(doc, chtml30->style, node);
4586 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4588 chxj_css_push_prop_list(chtml30->css_prop_stack, dup_css);
4589 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4591 if (style_attr_value) {
4592 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));
4594 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4602 static css_prop_list_t *
4603 s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4605 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4606 Doc *doc = chtml30->doc;
4607 css_prop_list_t *last_css = NULL;
4608 if (IS_CSS_ON(chtml30->entryp)) {
4609 css_prop_list_t *dup_css;
4610 css_selector_t *selector;
4612 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4613 dup_css = chxj_dup_css_prop_list(doc, last_css);
4614 selector = chxj_css_find_selector(doc, chtml30->style, node);
4616 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4620 if (style_attr_value) {
4621 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));
4623 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4633 * It is a handler who processes the SPAN tag.
4635 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4636 * destination is specified.
4637 * @param node [i] The SPAN tag node is specified.
4638 * @return The conversion result is returned.
4641 s_chtml30_start_span_tag(void *pdoc, Node *node)
4646 char *attr_style = NULL;
4647 char *attr_color = NULL;
4648 char *attr_align = NULL;
4649 char *attr_blink = NULL;
4650 char *attr_marquee = NULL;
4651 char *attr_marquee_dir = NULL;
4652 char *attr_marquee_style = NULL;
4653 char *attr_marquee_loop = NULL;
4655 chtml30 = GET_CHTML30(pdoc);
4658 for (attr = qs_get_attr(doc,node);
4660 attr = qs_get_next_attr(doc,attr)) {
4661 char *nm = qs_get_attr_name(doc,attr);
4662 char *val = qs_get_attr_value(doc,attr);
4663 if (val && STRCASEEQ('s','S',"style", nm)) {
4667 if (IS_CSS_ON(chtml30->entryp)) {
4668 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4670 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4671 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4672 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4673 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4674 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4675 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4676 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4677 css_property_t *cur;
4678 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4679 attr_color = apr_pstrdup(doc->pool, cur->value);
4681 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4682 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4683 attr_blink = apr_pstrdup(doc->pool, cur->value);
4686 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4687 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4688 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4691 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4692 if (cur->value && *cur->value) {
4693 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4694 attr_marquee_dir = "right";
4696 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4697 attr_marquee_dir = "left";
4701 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4702 if (cur->value && *cur->value) {
4703 if ( STRCASEEQ('s','S',"scroll",cur->value)
4704 || STRCASEEQ('s','S',"slide",cur->value)
4705 || STRCASEEQ('a','A',"alternate",cur->value)) {
4706 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4710 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4711 if (cur->value && *cur->value) {
4712 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4713 attr_marquee_loop = "16";
4716 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4720 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4721 if (STRCASEEQ('l','L',"left", cur->value)) {
4722 attr_align = apr_pstrdup(doc->pool, "left");
4724 else if (STRCASEEQ('c','C',"center",cur->value)) {
4725 attr_align = apr_pstrdup(doc->pool, "center");
4727 else if (STRCASEEQ('r','R',"right",cur->value)) {
4728 attr_align = apr_pstrdup(doc->pool, "right");
4733 if (attr_color || attr_align || attr_blink || attr_marquee) {
4734 chtml30_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4735 memset(flg, 0, sizeof(*flg));
4738 flg->with_blink_flag = 1;
4742 if (attr_marquee_dir) {
4743 W_L(" direction=\"");
4744 W_V(attr_marquee_dir);
4747 if (attr_marquee_style) {
4748 W_L(" behavior=\"");
4749 W_V(attr_marquee_style);
4752 if (attr_marquee_loop) {
4754 W_V(attr_marquee_loop);
4758 flg->with_marquee_flag = 1;
4761 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4762 W_L("<font color=\"");
4765 flg->with_font_flag = 1;
4768 W_L("<div align=\"");
4771 flg->with_div_flag = 1;
4773 node->userData = flg;
4776 node->userData = NULL;
4778 return chtml30->out;
4783 * It is a handler who processes the SPAN tag.
4785 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4786 * destination is specified.
4787 * @param node [i] The SPAN tag node is specified.
4788 * @return The conversion result is returned.
4791 s_chtml30_end_span_tag(void *pdoc, Node *node)
4793 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4794 Doc *doc = chtml30->doc;
4796 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4797 if (flg && flg->with_div_flag) {
4800 if (flg && flg->with_font_flag) {
4803 if (flg && flg->with_marquee_flag) {
4806 if (flg && flg->with_blink_flag) {
4809 if (IS_CSS_ON(chtml30->entryp)) {
4810 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4812 return chtml30->out;
4818 * It is a handler who processes the STYLE tag.
4820 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4821 * destination is specified.
4822 * @param node [i] The STYLE tag node is specified.
4823 * @return The conversion result is returned.
4826 s_chtml30_style_tag(void *pdoc, Node *node)
4833 chtml30 = GET_CHTML30(pdoc);
4836 if (! IS_CSS_ON(chtml30->entryp)) {
4837 return chtml30->out;
4840 for (attr = qs_get_attr(doc,node);
4842 attr = qs_get_next_attr(doc,attr)) {
4843 char *name = qs_get_attr_name(doc,attr);
4844 char *value = qs_get_attr_value(doc,attr);
4845 if (STRCASEEQ('t','T',"type", name)) {
4846 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4852 Node *child = qs_get_child_node(doc, node);
4853 if (type && child) {
4854 char *name = qs_get_node_name(doc, child);
4855 if (STRCASEEQ('t','T',"text", name)) {
4856 char *value = qs_get_node_value(doc, child);
4857 DBG(doc->r, "start load CSS. buf:[%s]", value);
4858 chtml30->style = chxj_css_parse_style_value(doc, chtml30->style, value);
4859 DBG(doc->r, "end load CSS. value:[%s]", value);
4862 return chtml30->out;