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,
396 s_chtml30_start_span_tag,
397 s_chtml30_end_span_tag,
421 s_chtml30_start_dt_tag,
422 s_chtml30_end_dt_tag,
436 s_chtml30_start_blockquote_tag,
437 s_chtml30_end_blockquote_tag,
441 s_chtml30_start_dir_tag,
442 s_chtml30_end_dir_tag,
446 s_chtml30_start_dl_tag,
447 s_chtml30_end_dl_tag,
451 s_chtml30_start_dd_tag,
452 s_chtml30_end_dd_tag,
456 s_chtml30_start_menu_tag,
457 s_chtml30_end_menu_tag,
461 s_chtml30_start_plaintext_tag,
462 s_chtml30_end_plaintext_tag,
466 s_chtml30_start_blink_tag,
467 s_chtml30_end_blink_tag,
471 s_chtml30_start_marquee_tag,
472 s_chtml30_end_marquee_tag,
481 s_chtml30_newline_mark,
488 * converts from CHTML5.0 to CHTML3.0.
490 * @param r [i] Requet_rec is appointed.
491 * @param spec [i] The result of the device specification processing which
492 * was done in advance is appointed.
493 * @param src [i] The character string before the converting is appointed.
494 * @return The character string after the converting is returned.
497 chxj_convert_chtml30(
503 chxjconvrule_entry *entryp,
512 DBG(r, "start chxj_convert_chtml30()");
514 /*--------------------------------------------------------------------------*/
516 /*--------------------------------------------------------------------------*/
518 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
520 DBG(r,"i found qrcode xml");
521 DBG(r, "end chxj_convert_chtml30()");
524 DBG(r,"not found qrcode xml");
526 /*--------------------------------------------------------------------------*/
527 /* The CHTML structure is initialized. */
528 /*--------------------------------------------------------------------------*/
529 s_init_chtml30(&chtml30, &doc, r, spec);
531 chtml30.entryp = entryp;
532 chtml30.cookie = cookie;
534 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
536 /*--------------------------------------------------------------------------*/
537 /* The character string of the input is analyzed. */
538 /*--------------------------------------------------------------------------*/
539 qs_init_malloc(&doc);
540 qs_init_root_node(&doc);
542 ss = apr_pcalloc(r->pool, srclen + 1);
543 memset(ss, 0, srclen + 1);
544 memcpy(ss, src, srclen);
547 chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
549 if (IS_CSS_ON(chtml30.entryp)) {
550 /* current property list */
551 chtml30.css_prop_stack = chxj_new_prop_list_stack(&doc);
554 chxj_buffered_write_init(r->pool, &doc.buf);
556 qs_parse_string(&doc,ss, strlen(ss));
558 /*--------------------------------------------------------------------------*/
559 /* It converts it from CHTML to CHTML. */
560 /*--------------------------------------------------------------------------*/
561 chxj_node_convert(spec,r,(void*)&chtml30, &doc, qs_get_root(&doc), 0);
562 chtml30.out = chxj_buffered_write_flush(chtml30.out, &doc.buf);
563 dst = apr_pstrdup(r->pool, chtml30.out);
564 chxj_buffered_write_terminate(&doc.buf);
566 qs_all_free(&doc,QX_LOGMARK);
569 dst = apr_pstrdup(r->pool,ss);
571 if (strlen(dst) == 0) {
572 dst = apr_psprintf(r->pool, "\n");
575 *dstlen = strlen(dst);
578 chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
581 DBG(r, "end chxj_convert_chtml30()");
587 * The CHTML structure is initialized.
589 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
590 * initialized is specified.
591 * @param doc [i] The Doc structure that should be set to the initialized
592 * HDML structure is specified.
593 * @param r [i] To use POOL, the pointer to request_rec is specified.
594 * @param spec [i] The pointer to the device_table
597 s_init_chtml30(chtml30_t *chtml30, Doc *doc, request_rec *r, device_table *spec)
599 memset(doc, 0, sizeof(Doc));
600 memset(chtml30, 0, sizeof(chtml30_t));
604 chtml30->spec = spec;
605 chtml30->out = qs_alloc_zero_byte_string(r->pool);
606 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
607 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
612 * Corresponding EMOJI to a current character-code is retrieved.
613 * The substitution character string is stored in the rslt pointer if agreeing.
615 * @param chtml30 [i] The pointer to the CHTML structure is specified.
616 * @param txt [i] The character string to want to examine whether it is
617 * EMOJI is specified.
618 * @param rslt [o] The pointer to the pointer that stores the result is
620 * @return When corresponding EMOJI exists, it returns it excluding 0.
623 s_chtml30_search_emoji(chtml30_t *chtml30, char *txt, char **rslt)
630 spec = chtml30->spec;
636 DBG(r,"spec is NULL");
639 for (ee = chtml30->conf->emoji;
642 if (ee->imode == NULL) {
643 DBG(r, "emoji->imode is NULL");
647 if (ee->imode->string != NULL
648 && strlen(ee->imode->string) > 0
649 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
651 if (spec == NULL || spec->emoji_type == NULL) {
652 *rslt = apr_palloc(r->pool, 3);
653 (*rslt)[0] = ee->imode->hex1byte & 0xff;
654 (*rslt)[1] = ee->imode->hex2byte & 0xff;
656 return strlen(ee->imode->string);
668 chxj_chtml30_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
679 chtml30 = &__chtml30;
682 DBG(r, "REQ[%X] start chxj_chtml30_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
683 memset(doc, 0, sizeof(Doc));
684 memset(chtml30, 0, sizeof(chtml30_t));
688 chtml30->spec = spec;
689 chtml30->out = qs_alloc_zero_byte_string(r->pool);
690 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
691 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
693 apr_pool_create(&pool, r->pool);
695 chxj_buffered_write_init(pool, &doc->buf);
697 for (ii=0; ii<len; ii++) {
701 rtn = s_chtml30_search_emoji(chtml30, (char *)&src[ii], &out);
708 if (is_sjis_kanji(src[ii])) {
709 two_byte[0] = src[ii+0];
710 two_byte[1] = src[ii+1];
716 one_byte[0] = src[ii+0];
721 chtml30->out = chxj_buffered_write_flush(chtml30->out, &doc->buf);
723 DBG(r, "REQ[%X] end chxj_chtml30_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
729 * It is a handler who processes the HTML tag.
731 * @param pdoc [i/o] The pointer to the CHTML structure at the output
732 * destination is specified.
733 * @param node [i] The HTML tag node is specified.
734 * @return The conversion result is returned.
737 s_chtml30_start_html_tag(void *pdoc, Node *UNUSED(node))
739 chtml30_t *chtml30 = GET_CHTML30(pdoc);
740 Doc *doc = chtml30->doc;
742 /*--------------------------------------------------------------------------*/
744 /*--------------------------------------------------------------------------*/
752 * It is a handler who processes the HTML tag.
754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
755 * destination is specified.
756 * @param node [i] The HTML tag node is specified.
757 * @return The conversion result is returned.
760 s_chtml30_end_html_tag(void *pdoc, Node *UNUSED(child))
762 chtml30_t *chtml30 = GET_CHTML30(pdoc);
763 Doc *doc = chtml30->doc;
772 * It is a handler who processes the META tag.
774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
775 * destination is specified.
776 * @param node [i] The META tag node is specified.
777 * @return The conversion result is returned.
780 s_chtml30_start_meta_tag(void *pdoc, Node *node)
786 int content_type_flag;
789 chtml30 = GET_CHTML30(pdoc);
793 content_type_flag = 0;
797 /*--------------------------------------------------------------------------*/
799 /*--------------------------------------------------------------------------*/
800 for (attr = qs_get_attr(doc,node);
802 attr = qs_get_next_attr(doc,attr)) {
803 char *name = qs_get_attr_name(doc,attr);
804 char *value = qs_get_attr_value(doc,attr);
808 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
809 /*----------------------------------------------------------------------*/
811 /*----------------------------------------------------------------------*/
812 W_L(" http-equiv=\"");
815 if (STRCASEEQ('c','C',"content-type", value))
816 content_type_flag = 1;
818 if (STRCASEEQ('r','R',"refresh", value))
825 if (strcasecmp(name, "content") == 0 && value && *value) {
826 if (content_type_flag) {
830 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
838 buf = apr_pstrdup(r->pool, value);
839 url = strchr(buf, ';');
841 sec = apr_pstrdup(r->pool, buf);
844 url = chxj_encoding_parameter(r, url, 0);
845 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
875 * It is a handler who processes the META tag.
877 * @param pdoc [i/o] The pointer to the CHTML structure at the output
878 * destination is specified.
879 * @param node [i] The META tag node is specified.
880 * @return The conversion result is returned.
883 s_chtml30_end_meta_tag(void* pdoc, Node* UNUSED(child))
885 chtml30_t *chtml30 = GET_CHTML30(pdoc);
892 * It is a handler who processes the HEAD tag.
894 * @param pdoc [i/o] The pointer to the CHTML structure at the output
895 * destination is specified.
896 * @param node [i] The HEAD tag node is specified.
897 * @return The conversion result is returned.
900 s_chtml30_start_head_tag(void* pdoc, Node* UNUSED(node))
902 chtml30_t *chtml30 = GET_CHTML30(pdoc);
903 Doc *doc = chtml30->doc;
912 * It is a handler who processes the HEAD tag.
914 * @param pdoc [i/o] The pointer to the CHTML structure at the output
915 * destination is specified.
916 * @param node [i] The HEAD tag node is specified.
917 * @return The conversion result is returned.
920 s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node))
922 chtml30_t *chtml30 = GET_CHTML30(pdoc);
923 Doc *doc = chtml30->doc;
932 * It is a handler who processes the TITLE tag.
934 * @param pdoc [i/o] The pointer to the CHTML structure at the output
935 * destination is specified.
936 * @param node [i] The TITLE tag node is specified.
937 * @return The conversion result is returned.
940 s_chtml30_start_title_tag(void *pdoc, Node *UNUSED(node))
942 chtml30_t *chtml30 = GET_CHTML30(pdoc);
943 Doc *doc = chtml30->doc;
952 * It is a handler who processes the TITLE tag.
954 * @param pdoc [i/o] The pointer to the CHTML structure at the output
955 * destination is specified.
956 * @param node [i] The TITLE tag node is specified.
957 * @return The conversion result is returned.
960 s_chtml30_end_title_tag(void *pdoc, Node *UNUSED(child))
962 chtml30_t *chtml30 = GET_CHTML30(pdoc);
963 Doc *doc = chtml30->doc;
972 * It is a handler who processes the BASE tag.
974 * @param pdoc [i/o] The pointer to the CHTML structure at the output
975 * destination is specified.
976 * @param node [i] The BASE tag node is specified.
977 * @return The conversion result is returned.
980 s_chtml30_start_base_tag(void *pdoc, Node *node)
987 chtml30 = GET_CHTML30(pdoc);
992 /*--------------------------------------------------------------------------*/
994 /*--------------------------------------------------------------------------*/
995 for (attr = qs_get_attr(doc,node);
997 attr = qs_get_next_attr(doc,attr)) {
998 char *name = qs_get_attr_name(doc,attr);
999 char *value = qs_get_attr_value(doc,attr);
1000 if (STRCASEEQ('h','H',"href", name)) {
1007 return chtml30->out;
1012 * It is a handler who processes the BASE tag.
1014 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1015 * destination is specified.
1016 * @param node [i] The BASE tag node is specified.
1017 * @return The conversion result is returned.
1020 s_chtml30_end_base_tag(void *pdoc, Node *UNUSED(child))
1022 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1024 return chtml30->out;
1029 * It is a handler who processes the BODY tag.
1031 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1032 * destination is specified.
1033 * @param node [i] The BODY tag node is specified.
1034 * @return The conversion result is returned.
1037 s_chtml30_start_body_tag(void *pdoc, Node *node)
1043 char *attr_bgcolor = NULL;
1044 char *attr_text = NULL;
1045 char *attr_link = NULL;
1046 char *attr_style = NULL;
1048 chtml30 = GET_CHTML30(pdoc);
1052 /*--------------------------------------------------------------------------*/
1053 /* Get Attributes */
1054 /*--------------------------------------------------------------------------*/
1055 for (attr = qs_get_attr(doc,node);
1057 attr = qs_get_next_attr(doc,attr)) {
1058 char *name = qs_get_attr_name(doc,attr);
1059 char *value = qs_get_attr_value(doc,attr);
1063 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
1064 /*----------------------------------------------------------------------*/
1066 /*----------------------------------------------------------------------*/
1067 attr_bgcolor = value;
1073 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
1074 /*----------------------------------------------------------------------*/
1076 /*----------------------------------------------------------------------*/
1083 if (strcasecmp(name, "style") == 0 && value && *value != 0) {
1090 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
1091 /*----------------------------------------------------------------------*/
1093 /*----------------------------------------------------------------------*/
1100 if (strcasecmp(name, "alink") == 0) {
1101 /*----------------------------------------------------------------------*/
1103 /*----------------------------------------------------------------------*/
1110 if (strcasecmp(name, "vlink") == 0) {
1111 /*----------------------------------------------------------------------*/
1113 /*----------------------------------------------------------------------*/
1122 if (IS_CSS_ON(chtml30->entryp)) {
1123 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1125 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1126 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1127 css_property_t *cur;
1128 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1129 if (cur->value && *cur->value) {
1130 attr_text = apr_pstrdup(doc->pool, cur->value);
1133 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1134 if (cur->value && *cur->value) {
1135 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1139 if (chtml30->style) {
1140 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml30->style);
1141 css_selector_t *cur_sel;
1142 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1143 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1144 css_property_t *cur;
1145 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1146 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1147 attr_link = apr_pstrdup(doc->pool, cur->value);
1156 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1162 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1168 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1175 return chtml30->out;
1180 * It is a handler who processes the BODY tag.
1182 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1183 * destination is specified.
1184 * @param node [i] The BODY tag node is specified.
1185 * @return The conversion result is returned.
1188 s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child))
1193 chtml30 = GET_CHTML30(pdoc);
1197 if (IS_CSS_ON(chtml30->entryp)) {
1198 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1201 return chtml30->out;
1206 * It is a handler who processes the A tag.
1208 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1209 * destination is specified.
1210 * @param node [i] The A tag node is specified.
1211 * @return The conversion result is returned.
1214 s_chtml30_start_a_tag(void *pdoc, Node *node)
1220 char *attr_style = NULL;
1222 chtml30 = GET_CHTML30(pdoc);
1227 /*--------------------------------------------------------------------------*/
1228 /* Get Attributes */
1229 /*--------------------------------------------------------------------------*/
1230 for (attr = qs_get_attr(doc,node);
1232 attr = qs_get_next_attr(doc,attr)) {
1233 char *name = qs_get_attr_name(doc,attr);
1234 char *value = qs_get_attr_value(doc,attr);
1235 if (STRCASEEQ('n','N',"name", name)) {
1236 /*----------------------------------------------------------------------*/
1238 /*----------------------------------------------------------------------*/
1243 else if (STRCASEEQ('h','H',"href", name)) {
1244 /*----------------------------------------------------------------------*/
1246 /*----------------------------------------------------------------------*/
1247 value = chxj_encoding_parameter(r, value, 0);
1248 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1249 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1255 else if (STRCASEEQ('a','A',"accesskey", name)) {
1256 /*----------------------------------------------------------------------*/
1258 /*----------------------------------------------------------------------*/
1259 W_L(" accesskey=\"");
1263 else if (STRCASEEQ('c','C',"cti", name)) {
1264 /*----------------------------------------------------------------------*/
1266 /*----------------------------------------------------------------------*/
1271 else if (STRCASEEQ('i','I',"ijam", name)) {
1272 /*----------------------------------------------------------------------*/
1274 /*----------------------------------------------------------------------*/
1277 else if (STRCASEEQ('u','U',"utn", name)) {
1278 /*----------------------------------------------------------------------*/
1280 /* It is special only for CHTML. */
1281 /*----------------------------------------------------------------------*/
1284 else if (STRCASEEQ('t','T',"telbook", name)) {
1285 /*----------------------------------------------------------------------*/
1287 /*----------------------------------------------------------------------*/
1290 else if (STRCASEEQ('k','K',"kana", name)) {
1291 /*----------------------------------------------------------------------*/
1293 /*----------------------------------------------------------------------*/
1296 else if (STRCASEEQ('e','E',"email", name)) {
1297 /*----------------------------------------------------------------------*/
1299 /*----------------------------------------------------------------------*/
1302 else if (STRCASEEQ('i','I',"ista", name)) {
1303 /*----------------------------------------------------------------------*/
1305 /*----------------------------------------------------------------------*/
1308 else if (STRCASEEQ('i','I',"ilet", name)) {
1309 /*----------------------------------------------------------------------*/
1311 /*----------------------------------------------------------------------*/
1314 else if (STRCASEEQ('i','I',"iswf", name)) {
1315 /*----------------------------------------------------------------------*/
1317 /*----------------------------------------------------------------------*/
1320 else if (STRCASEEQ('i','I',"irst", name)) {
1321 /*----------------------------------------------------------------------*/
1323 /*----------------------------------------------------------------------*/
1326 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1332 if (IS_CSS_ON(chtml30->entryp)) {
1333 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1336 return chtml30->out;
1341 * It is a handler who processes the A tag.
1343 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1344 * destination is specified.
1345 * @param node [i] The A tag node is specified.
1346 * @return The conversion result is returned.
1349 s_chtml30_end_a_tag(void *pdoc, Node *UNUSED(child))
1354 chtml30 = GET_CHTML30(pdoc);
1358 if (IS_CSS_ON(chtml30->entryp)) {
1359 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1362 return chtml30->out;
1367 * It is a handler who processes the BR tag.
1369 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1370 * destination is specified.
1371 * @param node [i] The BR tag node is specified.
1372 * @return The conversion result is returned.
1375 s_chtml30_start_br_tag(void *pdoc, Node *node)
1382 chtml30 = GET_CHTML30(pdoc);
1386 /*--------------------------------------------------------------------------*/
1387 /* Get Attributes */
1388 /*--------------------------------------------------------------------------*/
1389 for (attr = qs_get_attr(doc,node);
1391 attr = qs_get_next_attr(doc,attr)) {
1392 char *name = qs_get_attr_name(doc,attr);
1393 char *value = qs_get_attr_value(doc,attr);
1394 if (STRCASEEQ('c','C',"clear",name)) {
1395 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1403 return chtml30->out;
1408 * It is a handler who processes the BR tag.
1410 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1411 * destination is specified.
1412 * @param node [i] The BR tag node is specified.
1413 * @return The conversion result is returned.
1416 s_chtml30_end_br_tag(void *pdoc, Node *UNUSED(child))
1418 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1420 return chtml30->out;
1425 * It is a handler who processes the TR tag.
1427 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1428 * destination is specified.
1429 * @param node [i] The TR tag node is specified.
1430 * @return The conversion result is returned.
1433 s_chtml30_start_tr_tag(void *pdoc, Node *UNUSED(node))
1435 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1437 return chtml30->out;
1442 * It is a handler who processes the TR tag.
1444 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1445 * destination is specified.
1446 * @param node [i] The TR tag node is specified.
1447 * @return The conversion result is returned.
1450 s_chtml30_end_tr_tag(void *pdoc, Node *UNUSED(child))
1456 chtml30 = GET_CHTML30(pdoc);
1462 return chtml30->out;
1467 * It is a handler who processes the FONT tag.
1469 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1470 * destination is specified.
1471 * @param node [i] The FONT tag node is specified.
1472 * @return The conversion result is returned.
1475 s_chtml30_start_font_tag(void *pdoc, Node *node)
1481 char *attr_color = NULL;
1482 char *attr_style = NULL;
1484 chtml30 = GET_CHTML30(pdoc);
1488 /*--------------------------------------------------------------------------*/
1489 /* Get Attributes */
1490 /*--------------------------------------------------------------------------*/
1491 for (attr = qs_get_attr(doc,node);
1493 attr = qs_get_next_attr(doc,attr)) {
1494 char *name = qs_get_attr_name(doc,attr);
1495 char *value = qs_get_attr_value(doc,attr);
1496 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1497 attr_color = apr_pstrdup(doc->buf.pool, value);
1499 else if (STRCASEEQ('s','S',"size", name)) {
1500 /*----------------------------------------------------------------------*/
1502 /*----------------------------------------------------------------------*/
1505 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1509 if (IS_CSS_ON(chtml30->entryp)) {
1510 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1512 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1513 css_property_t *cur;
1514 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1515 if (cur->value && *cur->value) {
1516 attr_color = apr_pstrdup(doc->pool, cur->value);
1522 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1523 W_L("<font color=\"");
1527 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1528 flg->with_font_flag = 1;
1529 node->userData = flg;
1532 node->userData = NULL;
1534 return chtml30->out;
1539 * It is a handler who processes the FONT tag.
1541 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1542 * destination is specified.
1543 * @param node [i] The FONT tag node is specified.
1544 * @return The conversion result is returned.
1547 s_chtml30_end_font_tag(void *pdoc, Node *node)
1553 chtml30 = GET_CHTML30(pdoc);
1557 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1558 if (flg && flg->with_font_flag) {
1561 if (IS_CSS_ON(chtml30->entryp)) {
1562 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1565 return chtml30->out;
1570 * It is a handler who processes the FORM tag.
1572 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1573 * destination is specified.
1574 * @param node [i] The FORM tag node is specified.
1575 * @return The conversion result is returned.
1578 s_chtml30_start_form_tag(void *pdoc, Node *node)
1584 char *attr_style = NULL;
1585 char *attr_color = NULL;
1586 char *attr_align = NULL;
1587 char *new_hidden_tag = NULL;
1588 char *attr_method = NULL;
1589 char *attr_action = NULL;
1590 char *attr_utn = NULL;
1592 chtml30 = GET_CHTML30(pdoc);
1596 /*--------------------------------------------------------------------------*/
1597 /* Get Attributes */
1598 /*--------------------------------------------------------------------------*/
1599 for (attr = qs_get_attr(doc,node);
1601 attr = qs_get_next_attr(doc,attr)) {
1602 char *name = qs_get_attr_name(doc,attr);
1603 char *value = qs_get_attr_value(doc,attr);
1607 if (strcasecmp(name, "action") == 0) {
1608 /*--------------------------------------------------------------------*/
1610 /*--------------------------------------------------------------------*/
1611 attr_action = value;
1617 if (strcasecmp(name, "method") == 0) {
1618 /*--------------------------------------------------------------------*/
1620 /*--------------------------------------------------------------------*/
1621 attr_method = value;
1627 if (strcasecmp(name, "utn") == 0) {
1628 /*--------------------------------------------------------------------*/
1630 /*--------------------------------------------------------------------*/
1637 if (strcasecmp(name, "style") == 0) {
1646 if (IS_CSS_ON(chtml30->entryp)) {
1647 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1649 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1650 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1651 css_property_t *cur;
1652 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1653 if (STRCASEEQ('l','L',"left", cur->value)) {
1654 attr_align = apr_pstrdup(doc->pool, "left");
1656 else if (STRCASEEQ('c','C',"center",cur->value)) {
1657 attr_align = apr_pstrdup(doc->pool, "center");
1659 else if (STRCASEEQ('r','R',"right",cur->value)) {
1660 attr_align = apr_pstrdup(doc->pool, "right");
1663 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1664 attr_color = apr_pstrdup(doc->pool, cur->value);
1669 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1673 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1674 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml30->cookie);
1676 char *new_query_string = NULL;
1677 q = strchr(attr_action, '?');
1679 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);
1680 if (new_hidden_tag || new_query_string) {
1686 if (new_query_string) {
1688 W_V(new_query_string);
1702 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1703 memset(flg, 0, sizeof(*flg));
1705 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1706 W_L("<font color=\"");
1709 flg->with_font_flag = 1;
1712 W_L("<div align=\"");
1715 flg->with_div_flag = 1;
1717 node->userData = flg;
1719 if (new_hidden_tag) {
1720 W_V(new_hidden_tag);
1722 return chtml30->out;
1727 * It is a handler who processes the FORM tag.
1729 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1730 * destination is specified.
1731 * @param node [i] The FORM tag node is specified.
1732 * @return The conversion result is returned.
1735 s_chtml30_end_form_tag(void *pdoc, Node *node)
1740 chtml30 = GET_CHTML30(pdoc);
1743 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1744 if (flg && flg->with_div_flag) {
1747 if (flg && flg->with_font_flag) {
1751 if (IS_CSS_ON(chtml30->entryp)) {
1752 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1755 return chtml30->out;
1760 * It is a handler who processes the INPUT tag.
1762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1763 * destination is specified.
1764 * @param node [i] The INPUT tag node is specified.
1765 * @return The conversion result is returned.
1768 s_chtml30_start_input_tag(void *pdoc, Node *node)
1774 char *attr_accesskey = NULL;
1775 char *attr_max_length = NULL;
1776 char *attr_type = NULL;
1777 char *attr_name = NULL;
1778 char *attr_value = NULL;
1779 char *attr_istyle = NULL;
1780 char *attr_size = NULL;
1781 char *attr_checked = NULL;
1782 char *attr_style = NULL;
1784 chtml30 = GET_CHTML30(pdoc);
1788 /*--------------------------------------------------------------------------*/
1789 /* Get Attributes */
1790 /*--------------------------------------------------------------------------*/
1791 for (attr = qs_get_attr(doc,node);
1793 attr = qs_get_next_attr(doc,attr)) {
1794 char *name = qs_get_attr_name(doc,attr);
1795 char *value = qs_get_attr_value(doc,attr);
1796 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1797 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1798 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1799 STRCASEEQ('p','P',"password",tmp_type) ||
1800 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1801 STRCASEEQ('r','R',"radio", tmp_type) ||
1802 STRCASEEQ('h','H',"hidden", tmp_type) ||
1803 STRCASEEQ('s','S',"submit", tmp_type) ||
1804 STRCASEEQ('r','R',"reset", tmp_type))) {
1805 attr_type = tmp_type;
1808 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1811 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1814 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1815 attr_istyle = value;
1817 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1818 attr_max_length = value;
1820 else if (STRCASEEQ('c','C',"checked", name)) {
1821 attr_checked = value;
1823 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1824 attr_accesskey = value;
1826 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1829 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1834 if (IS_CSS_ON(chtml30->entryp)) {
1835 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
1837 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1838 css_property_t *cur;
1839 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1840 if (strcasestr(cur->value, "<ja:n>")) {
1843 else if (strcasestr(cur->value, "<ja:en>")) {
1846 else if (strcasestr(cur->value, "<ja:hk>")) {
1849 else if (strcasestr(cur->value, "<ja:h>")) {
1873 if (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type)) {
1874 apr_size_t value_len = strlen(attrvalue);
1875 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml30->entryp);
1879 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1882 if (attr_accesskey) {
1883 W_L(" accesskey=\"");
1884 W_V(attr_accesskey);
1888 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1894 /*--------------------------------------------------------------------------*/
1895 /* The figure is default for the password. */
1896 /*--------------------------------------------------------------------------*/
1897 if (attr_max_length) {
1898 if (chxj_chk_numeric(attr_max_length) != 0) {
1899 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1901 if (attr_istyle && *attr_istyle == '1') {
1902 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1906 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1915 return chtml30->out;
1920 * It is a handler who processes the INPUT tag.
1922 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1923 * destination is specified.
1924 * @param node [i] The INPUT tag node is specified.
1925 * @return The conversion result is returned.
1928 s_chtml30_end_input_tag(void *pdoc, Node *UNUSED(node))
1934 chtml30 = GET_CHTML30(pdoc);
1938 return chtml30->out;
1943 * It is a handler who processes the CENTER tag.
1945 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1946 * destination is specified.
1947 * @param node [i] The CENTER tag node is specified.
1948 * @return The conversion result is returned.
1951 s_chtml30_start_center_tag(void *pdoc, Node *node)
1956 char *attr_style = NULL;
1957 char *attr_color = NULL;
1959 chtml30 = GET_CHTML30(pdoc);
1962 for (attr = qs_get_attr(doc,node);
1964 attr = qs_get_next_attr(doc,attr)) {
1965 char *name = qs_get_attr_name(doc,attr);
1966 char *value = qs_get_attr_value(doc,attr);
1967 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1972 if (IS_CSS_ON(chtml30->entryp)) {
1973 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1975 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1976 css_property_t *cur;
1977 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1978 if (cur->value && *cur->value) {
1979 attr_color = apr_pstrdup(doc->pool, cur->value);
1986 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1987 memset(flg, 0, sizeof(*flg));
1989 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1990 W_L("<font color=\"");
1993 flg->with_font_flag = 1;
1995 node->userData = flg;
1997 return chtml30->out;
2002 * It is a handler who processes the CENTER tag.
2004 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2005 * destination is specified.
2006 * @param node [i] The CENTER tag node is specified.
2007 * @return The conversion result is returned.
2010 s_chtml30_end_center_tag(void *pdoc, Node *node)
2015 chtml30 = GET_CHTML30(pdoc);
2018 if (IS_CSS_ON(chtml30->entryp)) {
2019 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2021 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
2022 if (flg && flg->with_font_flag) {
2027 return chtml30->out;
2032 * It is a handler who processes the HR tag.
2034 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2035 * destination is specified.
2036 * @param node [i] The HR tag node is specified.
2037 * @return The conversion result is returned.
2040 s_chtml30_start_hr_tag(void *pdoc, Node *node)
2046 char *attr_align = NULL;
2047 char *attr_size = NULL;
2048 char *attr_width = NULL;
2049 char *attr_noshade = NULL;
2050 char *attr_style = NULL;
2052 chtml30 = GET_CHTML30(pdoc);
2056 for (attr = qs_get_attr(doc,node);
2058 attr = qs_get_next_attr(doc,attr)) {
2059 char *name = qs_get_attr_name (doc,attr);
2060 char *value = qs_get_attr_value(doc,attr);
2064 if (strcasecmp(name, "align") == 0) {
2065 /*--------------------------------------------------------------------*/
2067 /*--------------------------------------------------------------------*/
2068 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2076 if (strcasecmp(name, "size") == 0) {
2077 /*--------------------------------------------------------------------*/
2079 /*--------------------------------------------------------------------*/
2080 if (value && *value) {
2084 else if (strcasecmp(name, "style") == 0) {
2085 if (value && *value) {
2093 if (strcasecmp(name, "width") == 0) {
2094 /*--------------------------------------------------------------------*/
2096 /*--------------------------------------------------------------------*/
2097 if (value && *value) {
2105 if (strcasecmp(name, "noshade") == 0) {
2106 /*--------------------------------------------------------------------*/
2108 /*--------------------------------------------------------------------*/
2109 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2115 if (strcasecmp(name, "color") == 0) {
2116 /*--------------------------------------------------------------------*/
2118 /*--------------------------------------------------------------------*/
2127 if (IS_CSS_ON(chtml30->entryp)) {
2128 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2130 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2131 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2132 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2133 css_property_t *cur;
2134 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2135 if (STRCASEEQ('s','S',"solid",cur->value)) {
2136 attr_noshade = "noshade";
2139 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2140 char *tmp = apr_pstrdup(doc->pool, cur->value);
2141 char *tmpp = strstr(tmp, "px");
2144 attr_size = apr_pstrdup(doc->pool, tmp);
2147 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2148 char *tmp = apr_pstrdup(doc->pool, cur->value);
2149 char *tmpp = strstr(tmp, "px");
2152 attr_width = apr_pstrdup(doc->pool, tmp);
2155 tmpp = strstr(tmp, "%");
2157 attr_width = apr_pstrdup(doc->pool, tmp);
2183 return chtml30->out;
2188 * It is a handler who processes the HR tag.
2190 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2191 * destination is specified.
2192 * @param node [i] The HR tag node is specified.
2193 * @return The conversion result is returned.
2196 s_chtml30_end_hr_tag(void *pdoc, Node *UNUSED(child))
2198 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2199 return chtml30->out;
2204 * It is a handler who processes the IMG tag.
2206 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2207 * destination is specified.
2208 * @param node [i] The IMG tag node is specified.
2209 * @return The conversion result is returned.
2212 s_chtml30_start_img_tag(void *pdoc, Node *node)
2218 char *attr_src = NULL;
2219 char *attr_align = NULL;
2220 char *attr_style = NULL;
2221 char *attr_alt = NULL;
2222 char *attr_width = NULL;
2223 char *attr_height = NULL;
2224 char *attr_hspace = NULL;
2225 char *attr_vspace = NULL;
2226 #ifndef IMG_NOT_CONVERT_FILENAME
2230 chtml30 = GET_CHTML30(pdoc);
2231 #ifndef IMG_NOT_CONVERT_FILENAME
2232 spec = chtml30->spec;
2237 /*--------------------------------------------------------------------------*/
2238 /* Get Attributes */
2239 /*--------------------------------------------------------------------------*/
2240 for (attr = qs_get_attr(doc,node);
2242 attr = qs_get_next_attr(doc,attr)) {
2243 char *name = qs_get_attr_name (doc,attr);
2244 char *value = qs_get_attr_value(doc,attr);
2248 if (strcasecmp(name, "src") == 0) {
2249 /*--------------------------------------------------------------------*/
2251 /*--------------------------------------------------------------------*/
2252 #ifdef IMG_NOT_CONVERT_FILENAME
2253 value = chxj_encoding_parameter(r, value, 0);
2254 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2255 value = chxj_add_cookie_no_update_parameter(r, value);
2258 value = chxj_img_conv(r,spec,value);
2259 value = chxj_encoding_parameter(r, value, 0);
2260 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2261 value = chxj_add_cookie_no_update_parameter(r, value);
2265 else if (strcasecmp(name,"style") == 0 && value && *value) {
2272 if (strcasecmp(name, "align" ) == 0) {
2273 /*--------------------------------------------------------------------*/
2275 /*--------------------------------------------------------------------*/
2276 /*--------------------------------------------------------------------*/
2278 /*--------------------------------------------------------------------*/
2280 if (STRCASEEQ('t','T',"top", value) ||
2281 STRCASEEQ('m','M',"middle",value) ||
2282 STRCASEEQ('b','B',"bottom",value) ||
2283 STRCASEEQ('l','L',"left", value) ||
2284 STRCASEEQ('r','R',"right", value)) {
2287 else if (STRCASEEQ('c','C',"center", value)) {
2288 attr_align = apr_pstrdup(doc->pool, "middle");
2292 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2293 /*--------------------------------------------------------------------*/
2295 /*--------------------------------------------------------------------*/
2302 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2303 /*--------------------------------------------------------------------*/
2305 /*--------------------------------------------------------------------*/
2312 if (strcasecmp(name, "height") == 0 && value && *value) {
2313 /*--------------------------------------------------------------------*/
2315 /*--------------------------------------------------------------------*/
2316 attr_height = value;
2319 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2320 /*--------------------------------------------------------------------*/
2322 /*--------------------------------------------------------------------*/
2323 attr_hspace = value;
2329 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2330 /*--------------------------------------------------------------------*/
2332 /*--------------------------------------------------------------------*/
2333 attr_vspace = value;
2342 if (IS_CSS_ON(chtml30->entryp)) {
2343 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2345 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2346 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2347 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2348 css_property_t *cur;
2349 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2350 attr_height = apr_pstrdup(doc->pool, cur->value);
2352 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2353 attr_width = apr_pstrdup(doc->pool, cur->value);
2355 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2356 attr_align = apr_pstrdup(doc->pool, cur->value);
2398 return chtml30->out;
2403 * It is a handler who processes the IMG tag.
2405 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2406 * destination is specified.
2407 * @param node [i] The IMG tag node is specified.
2408 * @return The conversion result is returned.
2411 s_chtml30_end_img_tag(void *pdoc, Node *UNUSED(child))
2413 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2415 return chtml30->out;
2420 * It is a handler who processes the SELECT tag.
2422 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2423 * destination is specified.
2424 * @param node [i] The SELECT tag node is specified.
2425 * @return The conversion result is returned.
2428 s_chtml30_start_select_tag(void *pdoc, Node *node)
2430 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2431 Doc *doc = chtml30->doc;
2434 char *multiple = NULL;
2436 char *attr_style = NULL;
2439 for (attr = qs_get_attr(doc,node);
2441 attr = qs_get_next_attr(doc,attr)) {
2442 char *nm = qs_get_attr_name(doc,attr);
2443 char *val = qs_get_attr_value(doc,attr);
2444 if (STRCASEEQ('s','S',"size", nm)) {
2445 /*----------------------------------------------------------------------*/
2446 /* CHTML 1.0 version 2.0 */
2447 /*----------------------------------------------------------------------*/
2448 size = apr_pstrdup(doc->buf.pool, val);
2450 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2451 /*----------------------------------------------------------------------*/
2452 /* CHTML 1.0 version 2.0 */
2453 /*----------------------------------------------------------------------*/
2454 attr_style = apr_pstrdup(doc->buf.pool, val);
2456 else if (STRCASEEQ('n','N',"name", nm)) {
2457 /*----------------------------------------------------------------------*/
2458 /* CHTML 1.0 version 2.0 */
2459 /*----------------------------------------------------------------------*/
2460 name = apr_pstrdup(doc->buf.pool, val);
2462 else if (STRCASEEQ('m','M',"multiple", nm)) {
2463 /*----------------------------------------------------------------------*/
2464 /* CHTML 1.0 version 2.0 */
2465 /*----------------------------------------------------------------------*/
2466 multiple = apr_pstrdup(doc->buf.pool, val);
2469 if (size && *size) {
2474 if (name && *name) {
2483 if (IS_CSS_ON(chtml30->entryp)) {
2484 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2486 return chtml30->out;
2491 * It is a handler who processes the SELECT tag.
2493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2494 * destination is specified.
2495 * @param node [i] The SELECT tag node is specified.
2496 * @return The conversion result is returned.
2499 s_chtml30_end_select_tag(void *pdoc, Node *UNUSED(child))
2501 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2502 Doc *doc = chtml30->doc;
2505 if (IS_CSS_ON(chtml30->entryp)) {
2506 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2509 return chtml30->out;
2514 * It is a handler who processes the OPTION tag.
2516 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2517 * destination is specified.
2518 * @param node [i] The OPTION tag node is specified.
2519 * @return The conversion result is returned.
2522 s_chtml30_start_option_tag(void *pdoc, Node *node)
2530 char *attr_style = NULL;
2532 chtml30 = GET_CHTML30(pdoc);
2539 for (attr = qs_get_attr(doc,node);
2541 attr = qs_get_next_attr(doc,attr)) {
2542 char *nm = qs_get_attr_name(doc,attr);
2543 char *val = qs_get_attr_value(doc,attr);
2544 if (STRCASEEQ('s','S',"selected", nm)) {
2545 /*----------------------------------------------------------------------*/
2546 /* CHTML 1.0 version 2.0 */
2547 /*----------------------------------------------------------------------*/
2548 selected = apr_pstrdup(doc->buf.pool, val);
2550 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2551 /*----------------------------------------------------------------------*/
2552 /* CHTML 1.0 version 2.0 */
2553 /*----------------------------------------------------------------------*/
2554 attr_style = apr_pstrdup(doc->buf.pool, val);
2556 else if (STRCASEEQ('v','V',"value", nm)) {
2557 /*----------------------------------------------------------------------*/
2558 /* CHTML 1.0 version 2.0 */
2559 /*----------------------------------------------------------------------*/
2560 value = apr_pstrdup(doc->buf.pool, val);
2572 if (IS_CSS_ON(chtml30->entryp)) {
2573 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2575 return chtml30->out;
2580 * It is a handler who processes the OPTION tag.
2582 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2583 * destination is specified.
2584 * @param node [i] The OPTION tag node is specified.
2585 * @return The conversion result is returned.
2588 s_chtml30_end_option_tag(void *pdoc, Node *UNUSED(child))
2590 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2593 if (IS_CSS_ON(chtml30->entryp)) {
2594 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2597 return chtml30->out;
2602 * It is a handler who processes the DIV tag.
2604 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2605 * destination is specified.
2606 * @param node [i] The DIV tag node is specified.
2607 * @return The conversion result is returned.
2610 s_chtml30_start_div_tag(void *pdoc, Node *node)
2616 char *attr_style = NULL;
2617 char *attr_align = NULL;
2618 char *attr_display = NULL;
2619 char *attr_decoration = NULL;
2620 char *attr_wap_marquee_style = NULL;
2621 char *attr_wap_marquee_dir = NULL;
2622 char *attr_wap_marquee_loop = NULL;
2623 char *attr_color = NULL;
2624 char *attr_bgcolor = NULL;
2626 chtml30 = GET_CHTML30(pdoc);
2630 for (attr = qs_get_attr(doc,node);
2632 attr = qs_get_next_attr(doc,attr)) {
2633 char *nm = qs_get_attr_name(doc,attr);
2634 char *val = qs_get_attr_value(doc,attr);
2635 if (STRCASEEQ('a','A', "align", nm)) {
2636 /*----------------------------------------------------------------------*/
2637 /* CHTML 1.0 (W3C version 3.2) */
2638 /*----------------------------------------------------------------------*/
2639 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2640 attr_align = apr_pstrdup(doc->buf.pool, val);
2643 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2644 attr_style = apr_pstrdup(doc->buf.pool, val);
2648 if (IS_CSS_ON(chtml30->entryp)) {
2649 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2651 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2652 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2653 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2654 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2655 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2656 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2658 css_property_t *cur;
2659 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2660 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2661 attr_display = apr_pstrdup(doc->pool, cur->value);
2664 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2665 if (STRCASEEQ('b','B',"blink", cur->value)) {
2666 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2669 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2670 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2671 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2673 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2674 char *ss = strchr(cur->value, '#');
2676 ss = strstr(cur->value, "rgb");
2679 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2680 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2683 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2684 attr_color = apr_pstrdup(doc->pool, cur->value);
2685 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2687 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2688 attr_align = apr_pstrdup(doc->pool, cur->value);
2691 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2692 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2693 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2694 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2695 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2696 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2699 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2700 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2701 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2703 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2704 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2707 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2708 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2709 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2712 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2718 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2719 memset(flg, 0, sizeof(*flg));
2726 flg->with_div_flag = 1;
2730 flg->with_div_flag = 1;
2733 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2737 W_L("<font color=\"");
2740 flg->with_font_flag = 1;
2743 if (attr_decoration) {
2745 flg->with_blink_flag = 1;
2749 if (attr_wap_marquee_style) {
2750 W_L(" behavior=\"");
2751 W_V(attr_wap_marquee_style);
2754 if (attr_wap_marquee_dir) {
2755 W_L(" direction=\"");
2756 W_V(attr_wap_marquee_dir);
2759 if (attr_wap_marquee_loop) {
2761 W_V(attr_wap_marquee_loop);
2765 flg->with_marquee_flag = 1;
2767 node->userData = flg;
2769 return chtml30->out;
2774 * It is a handler who processes the DIV tag.
2776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2777 * destination is specified.
2778 * @param node [i] The DIV tag node is specified.
2779 * @return The conversion result is returned.
2782 s_chtml30_end_div_tag(void *pdoc, Node *node)
2784 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2785 Doc *doc = chtml30->doc;
2787 chtml30_flags_t *flg = node->userData;
2788 if (flg && flg->with_marquee_flag) {
2791 if (flg && flg->with_blink_flag) {
2794 if (flg && flg->with_font_flag) {
2797 if (flg && flg->with_div_flag) {
2800 if (IS_CSS_ON(chtml30->entryp)) {
2801 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2803 node->userData = NULL;
2805 return chtml30->out;
2810 * It is a handler who processes the UL tag.
2812 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2813 * destination is specified.
2814 * @param node [i] The UL tag node is specified.
2815 * @return The conversion result is returned.
2818 s_chtml30_start_ul_tag(void *pdoc, Node *node)
2820 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2821 Doc *doc = chtml30->doc;
2823 char *attr_style = NULL;
2825 for (attr = qs_get_attr(doc,node);
2827 attr = qs_get_next_attr(doc,attr)) {
2828 char *nm = qs_get_attr_name(doc,attr);
2829 char *val = qs_get_attr_value(doc,attr);
2830 if (val && STRCASEEQ('s','S',"style", nm)) {
2835 if (IS_CSS_ON(chtml30->entryp)) {
2836 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2841 return chtml30->out;
2846 * It is a handler who processes the UL tag.
2848 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2849 * destination is specified.
2850 * @param node [i] The UL tag node is specified.
2851 * @return The conversion result is returned.
2854 s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
2856 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2857 Doc *doc = chtml30->doc;
2859 if (IS_CSS_ON(chtml30->entryp)) {
2860 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2864 return chtml30->out;
2869 * It is a handler who processes the PRE tag.
2871 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2872 * destination is specified.
2873 * @param node [i] The PRE tag node is specified.
2874 * @return The conversion result is returned.
2877 s_chtml30_start_pre_tag(void *pdoc, Node *node)
2879 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2880 Doc *doc = chtml30->doc;
2882 char *attr_style = NULL;
2884 for (attr = qs_get_attr(doc,node);
2886 attr = qs_get_next_attr(doc,attr)) {
2887 char *nm = qs_get_attr_name(doc,attr);
2888 char *val = qs_get_attr_value(doc,attr);
2889 if (val && STRCASEEQ('s','S',"style", nm)) {
2894 if (IS_CSS_ON(chtml30->entryp)) {
2895 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2898 chtml30->pre_flag++;
2901 return chtml30->out;
2906 * It is a handler who processes the PRE tag.
2908 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2909 * destination is specified.
2910 * @param node [i] The PRE tag node is specified.
2911 * @return The conversion result is returned.
2914 s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
2916 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2917 Doc *doc = chtml30->doc;
2920 chtml30->pre_flag--;
2921 if (IS_CSS_ON(chtml30->entryp)) {
2922 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2925 return chtml30->out;
2930 * It is a handler who processes the P tag.
2932 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2933 * destination is specified.
2934 * @param node [i] The P tag node is specified.
2935 * @return The conversion result is returned.
2938 s_chtml30_start_p_tag(void *pdoc, Node *node)
2944 char *attr_align = NULL;
2945 char *attr_style = NULL;
2946 char *attr_color = NULL;
2947 char *attr_blink = NULL;
2949 chtml30 = GET_CHTML30(pdoc);
2953 for (attr = qs_get_attr(doc,node);
2955 attr = qs_get_next_attr(doc,attr)) {
2956 char *nm = qs_get_attr_name(doc,attr);
2957 char *val = qs_get_attr_value(doc,attr);
2958 if (STRCASEEQ('a','A',"align", nm)) {
2959 /*----------------------------------------------------------------------*/
2960 /* CHTML 1.0 (W3C version 3.2) */
2961 /*----------------------------------------------------------------------*/
2962 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2963 attr_align = apr_pstrdup(doc->buf.pool, val);
2967 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2968 attr_style = apr_pstrdup(doc->buf.pool, val);
2971 if (IS_CSS_ON(chtml30->entryp)) {
2972 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2974 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2975 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2976 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2977 css_property_t *cur;
2978 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2979 if (STRCASEEQ('l','L',"left",cur->value)) {
2980 attr_align = apr_pstrdup(doc->pool, "left");
2982 else if (STRCASEEQ('c','C',"center",cur->value)) {
2983 attr_align = apr_pstrdup(doc->pool, "center");
2985 else if (STRCASEEQ('r','R',"right",cur->value)) {
2986 attr_align = apr_pstrdup(doc->pool, "right");
2989 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2990 if (cur->value && *cur->value) {
2991 attr_color = apr_pstrdup(doc->pool, cur->value);
2994 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2995 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2996 attr_blink = apr_pstrdup(doc->pool, cur->value);
3009 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
3010 memset(flg, 0, sizeof(*flg));
3012 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3013 W_L("<font color=\"");
3016 flg->with_font_flag = 1;
3020 flg->with_blink_flag = 1;
3022 node->userData = (void *)flg;
3024 return chtml30->out;
3029 * It is a handler who processes the P tag.
3031 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3032 * destination is specified.
3033 * @param node [i] The P tag node is specified.
3034 * @return The conversion result is returned.
3037 s_chtml30_end_p_tag(void *pdoc, Node *node)
3042 chtml30 = GET_CHTML30(pdoc);
3045 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
3046 if (flg->with_font_flag) {
3049 if (flg->with_blink_flag) {
3053 if (IS_CSS_ON(chtml30->entryp)) {
3054 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3057 return chtml30->out;
3062 * It is a handler who processes the OL tag.
3064 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3065 * destination is specified.
3066 * @param node [i] The OL tag node is specified.
3067 * @return The conversion result is returned.
3070 s_chtml30_start_ol_tag(void *pdoc, Node *node)
3076 char *attr_style = NULL;
3077 char *attr_start = NULL;
3078 char *attr_type = NULL;
3080 chtml30 = GET_CHTML30(pdoc);
3084 /*--------------------------------------------------------------------------*/
3085 /* Get Attributes */
3086 /*--------------------------------------------------------------------------*/
3087 for (attr = qs_get_attr(doc,node);
3089 attr = qs_get_next_attr(doc,attr)) {
3090 char *name = qs_get_attr_name(doc,attr);
3091 char *value = qs_get_attr_value(doc,attr);
3092 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3095 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3098 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3102 if (IS_CSS_ON(chtml30->entryp)) {
3103 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3105 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3106 css_property_t *cur;
3107 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3108 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3109 attr_type = apr_pstrdup(doc->pool, "1");
3111 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3112 attr_type = apr_pstrdup(doc->pool, "A");
3114 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3115 attr_type = apr_pstrdup(doc->pool, "a");
3133 return chtml30->out;
3138 * It is a handler who processes the OL tag.
3140 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3141 * destination is specified.
3142 * @param node [i] The OL tag node is specified.
3143 * @return The conversion result is returned.
3146 s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
3148 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3149 Doc *doc = chtml30->doc;
3152 if (IS_CSS_ON(chtml30->entryp)) {
3153 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3156 return chtml30->out;
3161 * It is a handler who processes the LI tag.
3163 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3164 * destination is specified.
3165 * @param node [i] The LI tag node is specified.
3166 * @return The conversion result is returned.
3169 s_chtml30_start_li_tag(void *pdoc, Node *node)
3171 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3172 Doc *doc = chtml30->doc;
3174 char *attr_type = NULL;
3175 char *attr_value = NULL;
3176 char *attr_style = NULL;
3177 /*--------------------------------------------------------------------------*/
3178 /* Get Attributes */
3179 /*--------------------------------------------------------------------------*/
3180 for (attr = qs_get_attr(doc,node);
3182 attr = qs_get_next_attr(doc,attr)) {
3183 char *name = qs_get_attr_name(doc,attr);
3184 char *value = qs_get_attr_value(doc,attr);
3185 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3188 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3191 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3195 if (IS_CSS_ON(chtml30->entryp)) {
3196 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3198 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3199 css_property_t *cur;
3200 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3201 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3202 attr_type = apr_pstrdup(doc->pool, "1");
3204 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3205 attr_type = apr_pstrdup(doc->pool, "A");
3207 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3208 attr_type = apr_pstrdup(doc->pool, "a");
3226 return chtml30->out;
3231 * It is a handler who processes the LI tag.
3233 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3234 * destination is specified.
3235 * @param node [i] The LI tag node is specified.
3236 * @return The conversion result is returned.
3239 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
3241 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3243 if (IS_CSS_ON(chtml30->entryp)) {
3244 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3246 return chtml30->out;
3251 * It is a handler who processes the H1 tag.
3253 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3254 * destination is specified.
3255 * @param node [i] The H1 tag node is specified.
3256 * @return The conversion result is returned.
3259 s_chtml30_start_h1_tag(void *pdoc, Node *node)
3265 char *attr_style = NULL;
3266 char *attr_align = NULL;
3269 chtml30 = GET_CHTML30(pdoc);
3273 for (attr = qs_get_attr(doc,node);
3275 attr = qs_get_next_attr(doc,attr)) {
3276 char *name = qs_get_attr_name(doc,attr);
3277 char *value = qs_get_attr_value(doc,attr);
3278 if (STRCASEEQ('a','A',"align", name)) {
3279 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3283 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3287 if (IS_CSS_ON(chtml30->entryp)) {
3288 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3290 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3291 css_property_t *cur;
3292 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3293 if (STRCASEEQ('l','L',"left", cur->value)) {
3294 attr_align = apr_pstrdup(doc->pool, "left");
3296 else if (STRCASEEQ('c','C',"center",cur->value)) {
3297 attr_align = apr_pstrdup(doc->pool, "center");
3299 else if (STRCASEEQ('r','R',"right",cur->value)) {
3300 attr_align = apr_pstrdup(doc->pool, "right");
3313 return chtml30->out;
3318 * It is a handler who processes the H1 tag.
3320 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3321 * destination is specified.
3322 * @param node [i] The H1 tag node is specified.
3323 * @return The conversion result is returned.
3326 s_chtml30_end_h1_tag(void *pdoc, Node *UNUSED(child))
3331 chtml30 = GET_CHTML30(pdoc);
3335 if (IS_CSS_ON(chtml30->entryp)) {
3336 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3339 return chtml30->out;
3344 * It is a handler who processes the H2 tag.
3346 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3347 * destination is specified.
3348 * @param node [i] The H2 tag node is specified.
3349 * @return The conversion result is returned.
3352 s_chtml30_start_h2_tag(void *pdoc, Node *node)
3358 char *attr_style = NULL;
3359 char *attr_align = NULL;
3361 chtml30 = GET_CHTML30(pdoc);
3365 for (attr = qs_get_attr(doc,node);
3367 attr = qs_get_next_attr(doc,attr)) {
3368 char *name = qs_get_attr_name(doc,attr);
3369 char *value = qs_get_attr_value(doc,attr);
3370 if (STRCASEEQ('a','A',"align", name)) {
3371 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3375 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3379 if (IS_CSS_ON(chtml30->entryp)) {
3380 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3382 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3383 css_property_t *cur;
3384 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3385 if (STRCASEEQ('l','L',"left", cur->value)) {
3386 attr_align = apr_pstrdup(doc->pool, "left");
3388 else if (STRCASEEQ('c','C',"center",cur->value)) {
3389 attr_align = apr_pstrdup(doc->pool, "center");
3391 else if (STRCASEEQ('r','R',"right",cur->value)) {
3392 attr_align = apr_pstrdup(doc->pool, "right");
3405 return chtml30->out;
3410 * It is a handler who processes the H2 tag.
3412 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3413 * destination is specified.
3414 * @param node [i] The H2 tag node is specified.
3415 * @return The conversion result is returned.
3418 s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child))
3420 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3421 Doc *doc = chtml30->doc;
3424 if (IS_CSS_ON(chtml30->entryp)) {
3425 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3428 return chtml30->out;
3433 * It is a handler who processes the H3 tag.
3435 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3436 * destination is specified.
3437 * @param node [i] The H3 tag node is specified.
3438 * @return The conversion result is returned.
3441 s_chtml30_start_h3_tag(void *pdoc, Node *node)
3447 char *attr_style = NULL;
3448 char *attr_align = NULL;
3450 chtml30 = GET_CHTML30(pdoc);
3454 for (attr = qs_get_attr(doc,node);
3456 attr = qs_get_next_attr(doc,attr)) {
3457 char *name = qs_get_attr_name(doc,attr);
3458 char *value = qs_get_attr_value(doc,attr);
3459 if (STRCASEEQ('a','A',"align", name)) {
3460 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3464 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3468 if (IS_CSS_ON(chtml30->entryp)) {
3469 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3471 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3472 css_property_t *cur;
3473 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3474 if (STRCASEEQ('l','L',"left", cur->value)) {
3475 attr_align = apr_pstrdup(doc->pool, "left");
3477 else if (STRCASEEQ('c','C',"center",cur->value)) {
3478 attr_align = apr_pstrdup(doc->pool, "center");
3480 else if (STRCASEEQ('r','R',"right",cur->value)) {
3481 attr_align = apr_pstrdup(doc->pool, "right");
3494 return chtml30->out;
3499 * It is a handler who processes the H3 tag.
3501 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3502 * destination is specified.
3503 * @param node [i] The H3 tag node is specified.
3504 * @return The conversion result is returned.
3507 s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
3509 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3510 Doc *doc = chtml30->doc;
3513 if (IS_CSS_ON(chtml30->entryp)) {
3514 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3517 return chtml30->out;
3522 * It is a handler who processes the H4 tag.
3524 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3525 * destination is specified.
3526 * @param node [i] The H4 tag node is specified.
3527 * @return The conversion result is returned.
3530 s_chtml30_start_h4_tag(void *pdoc, Node *node)
3536 char *attr_style = NULL;
3537 char *attr_align = NULL;
3539 chtml30 = GET_CHTML30(pdoc);
3543 for (attr = qs_get_attr(doc,node);
3545 attr = qs_get_next_attr(doc,attr)) {
3546 char *name = qs_get_attr_name(doc,attr);
3547 char *value = qs_get_attr_value(doc,attr);
3548 if (STRCASEEQ('a','A',"align", name)) {
3549 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3553 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3557 if (IS_CSS_ON(chtml30->entryp)) {
3558 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3560 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3561 css_property_t *cur;
3562 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3563 if (STRCASEEQ('l','L',"left", cur->value)) {
3564 attr_align = apr_pstrdup(doc->pool, "left");
3566 else if (STRCASEEQ('c','C',"center",cur->value)) {
3567 attr_align = apr_pstrdup(doc->pool, "center");
3569 else if (STRCASEEQ('r','R',"right",cur->value)) {
3570 attr_align = apr_pstrdup(doc->pool, "right");
3583 return chtml30->out;
3588 * It is a handler who processes the H4 tag.
3590 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3591 * destination is specified.
3592 * @param node [i] The H4 tag node is specified.
3593 * @return The conversion result is returned.
3596 s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child))
3598 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3599 Doc *doc = chtml30->doc;
3602 if (IS_CSS_ON(chtml30->entryp)) {
3603 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3606 return chtml30->out;
3611 * It is a handler who processes the H5 tag.
3613 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3614 * destination is specified.
3615 * @param node [i] The H5 tag node is specified.
3616 * @return The conversion result is returned.
3619 s_chtml30_start_h5_tag(void *pdoc, Node *node)
3625 char *attr_style = NULL;
3626 char *attr_align = NULL;
3628 chtml30 = GET_CHTML30(pdoc);
3632 for (attr = qs_get_attr(doc,node);
3634 attr = qs_get_next_attr(doc,attr)) {
3635 char *name = qs_get_attr_name(doc,attr);
3636 char *value = qs_get_attr_value(doc,attr);
3637 if (STRCASEEQ('a','A',"align", name)) {
3638 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3642 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3646 if (IS_CSS_ON(chtml30->entryp)) {
3647 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3649 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3650 css_property_t *cur;
3651 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3652 if (STRCASEEQ('l','L',"left", cur->value)) {
3653 attr_align = apr_pstrdup(doc->pool, "left");
3655 else if (STRCASEEQ('c','C',"center",cur->value)) {
3656 attr_align = apr_pstrdup(doc->pool, "center");
3658 else if (STRCASEEQ('r','R',"right",cur->value)) {
3659 attr_align = apr_pstrdup(doc->pool, "right");
3672 return chtml30->out;
3677 * It is a handler who processes the H5 tag.
3679 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3680 * destination is specified.
3681 * @param node [i] The H5 tag node is specified.
3682 * @return The conversion result is returned.
3685 s_chtml30_end_h5_tag(void *pdoc, Node *UNUSED(child))
3687 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3688 Doc *doc = chtml30->doc;
3691 if (IS_CSS_ON(chtml30->entryp)) {
3692 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3695 return chtml30->out;
3700 * It is a handler who processes the H6 tag.
3702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3703 * destination is specified.
3704 * @param node [i] The H6 tag node is specified.
3705 * @return The conversion result is returned.
3708 s_chtml30_start_h6_tag(void *pdoc, Node *node)
3714 char *attr_style = NULL;
3715 char *attr_align = NULL;
3717 chtml30 = GET_CHTML30(pdoc);
3721 for (attr = qs_get_attr(doc,node);
3723 attr = qs_get_next_attr(doc,attr)) {
3724 char *name = qs_get_attr_name(doc,attr);
3725 char *value = qs_get_attr_value(doc,attr);
3726 if (STRCASEEQ('a','A',"align", name)) {
3727 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3731 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3735 if (IS_CSS_ON(chtml30->entryp)) {
3736 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3738 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3739 css_property_t *cur;
3740 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3741 if (STRCASEEQ('l','L',"left", cur->value)) {
3742 attr_align = apr_pstrdup(doc->pool, "left");
3744 else if (STRCASEEQ('c','C',"center",cur->value)) {
3745 attr_align = apr_pstrdup(doc->pool, "center");
3747 else if (STRCASEEQ('r','R',"right",cur->value)) {
3748 attr_align = apr_pstrdup(doc->pool, "right");
3761 return chtml30->out;
3766 * It is a handler who processes the H6 tag.
3768 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3769 * destination is specified.
3770 * @param node [i] The H6 tag node is specified.
3771 * @return The conversion result is returned.
3774 s_chtml30_end_h6_tag(void *pdoc, Node *UNUSED(child))
3776 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3777 Doc *doc = chtml30->doc;
3780 if (IS_CSS_ON(chtml30->entryp)) {
3781 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3784 return chtml30->out;
3789 * It is a handler who processes the TEXTARE tag.
3791 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3792 * destination is specified.
3793 * @param node [i] The TEXTAREA tag node is specified.
3794 * @return The conversion result is returned.
3797 s_chtml30_start_textarea_tag(void *pdoc, Node *node)
3803 char *attr_accesskey = NULL;
3804 char *attr_name = NULL;
3805 char *attr_rows = NULL;
3806 char *attr_cols = NULL;
3807 char *attr_istyle = NULL;
3808 char *attr_style = NULL;
3810 chtml30 = GET_CHTML30(pdoc);
3814 chtml30->textarea_flag++;
3816 for (attr = qs_get_attr(doc,node);
3818 attr = qs_get_next_attr(doc,attr)) {
3819 char *name = qs_get_attr_name(doc,attr);
3820 char *value = qs_get_attr_value(doc,attr);
3821 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3822 attr_accesskey = value;
3824 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3825 attr_istyle = value;
3827 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3830 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3833 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3836 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3841 if (IS_CSS_ON(chtml30->entryp)) {
3842 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
3844 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3845 css_property_t *cur;
3846 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3847 if (strcasestr(cur->value, "<ja:n>")) {
3850 else if (strcasestr(cur->value, "<ja:en>")) {
3853 else if (strcasestr(cur->value, "<ja:hk>")) {
3856 else if (strcasestr(cur->value, "<ja:h>")) {
3864 if (attr_accesskey) {
3865 W_L(" accesskey=\"");
3866 W_V(attr_accesskey);
3890 return chtml30->out;
3895 * It is a handler who processes the TEXTAREA tag.
3897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3898 * destination is specified.
3899 * @param node [i] The TEXTAREA tag node is specified.
3900 * @return The conversion result is returned.
3903 s_chtml30_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3905 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3906 Doc *doc = chtml30->doc;
3909 chtml30->textarea_flag--;
3911 return chtml30->out;
3916 s_chtml30_chxjif_tag(void *pdoc, Node *node)
3923 chtml30 = GET_CHTML30(pdoc);
3927 for (child = qs_get_child_node(doc, node);
3929 child = qs_get_next_node(doc, child)) {
3931 s_chtml30_chxjif_tag(chtml30, child);
3939 s_chtml30_text_tag(void *pdoc, Node *child)
3951 apr_size_t z2h_input_len;
3953 chtml30 = GET_CHTML30(pdoc);
3957 textval = qs_get_node_value(doc,child);
3958 if (strlen(textval) == 0) {
3959 return chtml30->out;
3962 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3963 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3965 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3966 memset(one_byte, 0, sizeof(one_byte));
3969 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3971 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
3973 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3978 if (is_sjis_kanji(textval[ii])) {
3979 one_byte[0] = textval[ii+0];
3980 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3981 one_byte[0] = textval[ii+1];
3982 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3985 else if (chtml30->pre_flag) {
3986 one_byte[0] = textval[ii+0];
3987 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3989 else if (chtml30->textarea_flag) {
3990 one_byte[0] = textval[ii+0];
3991 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3993 else if (textval[ii] != '\r' && textval[ii] != '\n') {
3994 one_byte[0] = textval[ii+0];
3995 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3998 z2h_input_len = strlen(tdst);
3999 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml30->entryp);
4002 return chtml30->out;
4007 * It is a handler who processes the BLOCKQUOTE tag.
4009 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4010 * destination is specified.
4011 * @param node [i] The BLOCKQUOTE tag node is specified.
4012 * @return The conversion result is returned.
4015 s_chtml30_start_blockquote_tag(void *pdoc, Node *node)
4020 char *attr_style = NULL;
4021 char *attr_color = NULL;
4023 chtml30 = GET_CHTML30(pdoc);
4025 for (attr = qs_get_attr(doc,node);
4027 attr = qs_get_next_attr(doc,attr)) {
4028 char *nm = qs_get_attr_name(doc,attr);
4029 char *val = qs_get_attr_value(doc,attr);
4030 if (val && STRCASEEQ('s','S',"style", nm)) {
4034 if (IS_CSS_ON(chtml30->entryp)) {
4035 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4037 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4038 css_property_t *cur;
4039 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4040 if (cur->value && *cur->value) {
4041 attr_color = apr_pstrdup(doc->pool, cur->value);
4046 W_L("<blockquote>");
4047 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4048 memset(flg, 0, sizeof(*flg));
4050 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4051 W_L("<font color=\"");
4054 flg->with_font_flag = 1;
4056 node->userData = (void *)flg;
4057 return chtml30->out;
4062 * It is a handler who processes the BLOCKQUOTE tag.
4064 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4065 * destination is specified.
4066 * @param node [i] The BLOCKQUOTE tag node is specified.
4067 * @return The conversion result is returned.
4070 s_chtml30_end_blockquote_tag(void *pdoc, Node *node)
4072 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4073 Doc *doc = chtml30->doc;
4074 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4075 if (flg && flg->with_font_flag) {
4078 W_L("</blockquote>");
4079 if (IS_CSS_ON(chtml30->entryp)) {
4080 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4082 return chtml30->out;
4087 * It is a handler who processes the DIR tag.
4089 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4090 * destination is specified.
4091 * @param node [i] The DIR tag node is specified.
4092 * @return The conversion result is returned.
4095 s_chtml30_start_dir_tag(void *pdoc, Node *node)
4100 char *attr_style = NULL;
4101 char *attr_color = NULL;
4103 chtml30 = GET_CHTML30(pdoc);
4105 for (attr = qs_get_attr(doc,node);
4107 attr = qs_get_next_attr(doc,attr)) {
4108 char *nm = qs_get_attr_name(doc,attr);
4109 char *val = qs_get_attr_value(doc,attr);
4110 if (val && STRCASEEQ('s','S',"style", nm)) {
4114 if (IS_CSS_ON(chtml30->entryp)) {
4115 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4117 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4118 css_property_t *cur;
4119 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4120 if (cur->value && *cur->value) {
4121 attr_color = apr_pstrdup(doc->pool, cur->value);
4127 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4128 memset(flg, 0, sizeof(*flg));
4130 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4131 W_L("<font color=\"");
4134 flg->with_font_flag = 1;
4136 node->userData = (void *)flg;
4137 return chtml30->out;
4142 * It is a handler who processes the DIR tag.
4144 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4145 * destination is specified.
4146 * @param node [i] The DIR tag node is specified.
4147 * @return The conversion result is returned.
4150 s_chtml30_end_dir_tag(void *pdoc, Node *node)
4152 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dir>");
4157 * It is a handler who processes the DL tag.
4159 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4160 * destination is specified.
4161 * @param node [i] The DL tag node is specified.
4162 * @return The conversion result is returned.
4165 s_chtml30_start_dl_tag(void *pdoc, Node *node)
4167 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dl>");
4172 * It is a handler who processes the DL tag.
4174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4175 * destination is specified.
4176 * @param node [i] The DL tag node is specified.
4177 * @return The conversion result is returned.
4180 s_chtml30_end_dl_tag(void *pdoc, Node *node)
4182 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dl>");
4187 * It is a handler who processes the DT tag.
4189 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4190 * destination is specified.
4191 * @param node [i] The DT tag node is specified.
4192 * @return The conversion result is returned.
4195 s_chtml30_start_dt_tag(void *pdoc, Node *node)
4197 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dt>");
4202 * It is a handler who processes the DT tag.
4204 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4205 * destination is specified.
4206 * @param node [i] The DT tag node is specified.
4207 * @return The conversion result is returned.
4210 s_chtml30_end_dt_tag(void *pdoc, Node *node)
4212 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4217 * It is a handler who processes the DD tag.
4219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4220 * destination is specified.
4221 * @param node [i] The DD tag node is specified.
4222 * @return The conversion result is returned.
4225 s_chtml30_start_dd_tag(void *pdoc, Node *node)
4227 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dd>");
4232 * It is a handler who processes the DD tag.
4234 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4235 * destination is specified.
4236 * @param node [i] The DD tag node is specified.
4237 * @return The conversion result is returned.
4240 s_chtml30_end_dd_tag(void *pdoc, Node *node)
4242 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4247 * It is a handler who processes the MARQUEE tag.
4249 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4250 * destination is specified.
4251 * @param node [i] The MARQUEE tag node is specified.
4252 * @return The conversion result is returned.
4255 s_chtml30_start_marquee_tag(void *pdoc, Node *node)
4257 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4258 Doc *doc = chtml30->doc;
4260 char *attr_direction = NULL;
4261 char *attr_behavior = NULL;
4262 char *attr_loop = NULL;
4263 char *attr_style = NULL;
4264 char *attr_color = NULL;
4265 /*--------------------------------------------------------------------------*/
4266 /* Get Attributes */
4267 /*--------------------------------------------------------------------------*/
4268 for (attr = qs_get_attr(doc,node);
4270 attr = qs_get_next_attr(doc,attr)) {
4271 char *name = qs_get_attr_name(doc,attr);
4272 char *value = qs_get_attr_value(doc,attr);
4273 if (STRCASEEQ('d','D',"direction", name)) {
4274 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4275 attr_direction = value;
4278 else if (STRCASEEQ('b','B',"behavior",name)) {
4279 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4280 attr_behavior = value;
4283 else if (STRCASEEQ('l','L',"loop",name)) {
4284 if (value && *value) {
4288 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4292 if (IS_CSS_ON(chtml30->entryp)) {
4293 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4295 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4296 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4297 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4298 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4299 css_property_t *cur;
4300 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4301 if (cur->value && *cur->value) {
4302 attr_color = apr_pstrdup(doc->pool, cur->value);
4305 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4306 if (cur->value && *cur->value) {
4307 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4310 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4311 if (cur->value && *cur->value) {
4312 attr_loop = apr_pstrdup(doc->pool, cur->value);
4313 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4318 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4319 if (cur->value && *cur->value) {
4320 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4321 attr_direction = "right";
4323 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4324 attr_direction = "left";
4331 if (attr_direction) {
4332 W_L(" direction=\"");
4333 W_V(attr_direction);
4336 if (attr_behavior) {
4337 W_L(" behavior=\"");
4348 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4349 memset(flg, 0, sizeof(*flg));
4351 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4352 W_L("<font color=\"");
4355 flg->with_font_flag = 1;
4357 node->userData = (void *)flg;
4358 return chtml30->out;
4363 * It is a handler who processes the MARQUEE tag.
4365 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4366 * destination is specified.
4367 * @param node [i] The MARQUEE tag node is specified.
4368 * @return The conversion result is returned.
4371 s_chtml30_end_marquee_tag(void *pdoc, Node *node)
4373 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4374 Doc *doc = chtml30->doc;
4375 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4376 if (flg && flg->with_font_flag) {
4380 if (IS_CSS_ON(chtml30->entryp)) {
4381 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4383 return chtml30->out;
4388 * It is a handler who processes the BLINK tag.
4390 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4391 * destination is specified.
4392 * @param node [i] The BLINK tag node is specified.
4393 * @return The conversion result is returned.
4396 s_chtml30_start_blink_tag(void *pdoc, Node *node)
4398 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<blink>");
4403 * It is a handler who processes the BLINK tag.
4405 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4406 * destination is specified.
4407 * @param node [i] The BLINK tag node is specified.
4408 * @return The conversion result is returned.
4411 s_chtml30_end_blink_tag(void *pdoc, Node *node)
4413 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</blink>");
4418 * It is a handler who processes the MENU tag.
4420 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4421 * destination is specified.
4422 * @param node [i] The MENU tag node is specified.
4423 * @return The conversion result is returned.
4426 s_chtml30_start_menu_tag(void *pdoc, Node *node)
4428 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<menu>");
4433 * It is a handler who processes the MENU tag.
4435 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4436 * destination is specified.
4437 * @param node [i] The MENU tag node is specified.
4438 * @return The conversion result is returned.
4441 s_chtml30_end_menu_tag(void *pdoc, Node *node)
4443 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</menu>");
4448 * It is a handler who processes the PLAINTEXT tag.
4450 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4451 * destination is specified.
4452 * @param node [i] The PLAINTEXT tag node is specified.
4453 * @return The conversion result is returned.
4456 s_chtml30_start_plaintext_tag(void *pdoc, Node *node)
4458 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4459 Doc *doc = chtml30->doc;
4461 s_chtml30_start_plaintext_tag_inner(pdoc,node);
4462 return chtml30->out;
4466 s_chtml30_start_plaintext_tag_inner(void *pdoc, Node *node)
4468 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4469 Doc *doc = chtml30->doc;
4471 for (child = qs_get_child_node(doc, node);
4473 child = qs_get_next_node(doc, child)) {
4475 s_chtml30_start_plaintext_tag_inner(pdoc, child);
4477 return chtml30->out;
4482 * It is a handler who processes the PLAINTEXT tag.
4484 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4485 * destination is specified.
4486 * @param node [i] The PLAINTEXT tag node is specified.
4487 * @return The conversion result is returned.
4490 s_chtml30_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4492 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4493 return chtml30->out;
4498 * * It is handler who processes the New Line Code.
4501 s_chtml30_newline_mark(void *pdoc, Node *UNUSED(node))
4503 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4504 Doc *doc = chtml30->doc;
4506 return chtml30->out;
4511 * It is a handler who processes the LINK tag.
4513 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4514 * destination is specified.
4515 * @param node [i] The LINK tag node is specified.
4516 * @return The conversion result is returned.
4519 s_chtml30_link_tag(void *pdoc, Node *node)
4528 chtml30 = GET_CHTML30(pdoc);
4531 if (! IS_CSS_ON(chtml30->entryp)) {
4532 return chtml30->out;
4535 for (attr = qs_get_attr(doc,node);
4537 attr = qs_get_next_attr(doc,attr)) {
4538 char *name = qs_get_attr_name(doc,attr);
4539 char *value = qs_get_attr_value(doc,attr);
4540 if (STRCASEEQ('r','R',"rel", name)) {
4541 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4545 else if (STRCASEEQ('h','H',"href", name)) {
4546 if (value && *value) {
4550 else if (STRCASEEQ('t','T',"type", name)) {
4551 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4557 if (rel && href && type) {
4558 DBG(doc->r, "start load CSS. url:[%s]", href);
4559 chtml30->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml30->style, href);
4560 DBG(doc->r, "end load CSS. url:[%s]", href);
4563 return chtml30->out;
4567 static css_prop_list_t *
4568 s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4570 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4571 Doc *doc = chtml30->doc;
4572 css_prop_list_t *last_css = NULL;
4573 if (IS_CSS_ON(chtml30->entryp)) {
4574 css_prop_list_t *dup_css;
4575 css_selector_t *selector;
4577 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4578 dup_css = chxj_dup_css_prop_list(doc, last_css);
4579 selector = chxj_css_find_selector(doc, chtml30->style, node);
4581 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4583 chxj_css_push_prop_list(chtml30->css_prop_stack, dup_css);
4584 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4586 if (style_attr_value) {
4587 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));
4589 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4597 static css_prop_list_t *
4598 s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4600 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4601 Doc *doc = chtml30->doc;
4602 css_prop_list_t *last_css = NULL;
4603 if (IS_CSS_ON(chtml30->entryp)) {
4604 css_prop_list_t *dup_css;
4605 css_selector_t *selector;
4607 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4608 dup_css = chxj_dup_css_prop_list(doc, last_css);
4609 selector = chxj_css_find_selector(doc, chtml30->style, node);
4611 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4615 if (style_attr_value) {
4616 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));
4618 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4628 * It is a handler who processes the SPAN tag.
4630 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4631 * destination is specified.
4632 * @param node [i] The SPAN tag node is specified.
4633 * @return The conversion result is returned.
4636 s_chtml30_start_span_tag(void *pdoc, Node *node)
4641 char *attr_style = NULL;
4642 char *attr_color = NULL;
4643 char *attr_align = NULL;
4644 char *attr_blink = NULL;
4645 char *attr_marquee = NULL;
4646 char *attr_marquee_dir = NULL;
4647 char *attr_marquee_style = NULL;
4648 char *attr_marquee_loop = NULL;
4650 chtml30 = GET_CHTML30(pdoc);
4653 for (attr = qs_get_attr(doc,node);
4655 attr = qs_get_next_attr(doc,attr)) {
4656 char *nm = qs_get_attr_name(doc,attr);
4657 char *val = qs_get_attr_value(doc,attr);
4658 if (val && STRCASEEQ('s','S',"style", nm)) {
4662 if (IS_CSS_ON(chtml30->entryp)) {
4663 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4665 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4666 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4667 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4668 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4669 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4670 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4671 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4672 css_property_t *cur;
4673 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4674 attr_color = apr_pstrdup(doc->pool, cur->value);
4676 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4677 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4678 attr_blink = apr_pstrdup(doc->pool, cur->value);
4681 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4682 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4683 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4686 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4687 if (cur->value && *cur->value) {
4688 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4689 attr_marquee_dir = "right";
4691 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4692 attr_marquee_dir = "left";
4696 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4697 if (cur->value && *cur->value) {
4698 if ( STRCASEEQ('s','S',"scroll",cur->value)
4699 || STRCASEEQ('s','S',"slide",cur->value)
4700 || STRCASEEQ('a','A',"alternate",cur->value)) {
4701 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4705 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4706 if (cur->value && *cur->value) {
4707 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4708 attr_marquee_loop = "16";
4711 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4715 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4716 if (STRCASEEQ('l','L',"left", cur->value)) {
4717 attr_align = apr_pstrdup(doc->pool, "left");
4719 else if (STRCASEEQ('c','C',"center",cur->value)) {
4720 attr_align = apr_pstrdup(doc->pool, "center");
4722 else if (STRCASEEQ('r','R',"right",cur->value)) {
4723 attr_align = apr_pstrdup(doc->pool, "right");
4728 if (attr_color || attr_align || attr_blink || attr_marquee) {
4729 chtml30_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4730 memset(flg, 0, sizeof(*flg));
4733 flg->with_blink_flag = 1;
4737 if (attr_marquee_dir) {
4738 W_L(" direction=\"");
4739 W_V(attr_marquee_dir);
4742 if (attr_marquee_style) {
4743 W_L(" behavior=\"");
4744 W_V(attr_marquee_style);
4747 if (attr_marquee_loop) {
4749 W_V(attr_marquee_loop);
4753 flg->with_marquee_flag = 1;
4756 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4757 W_L("<font color=\"");
4760 flg->with_font_flag = 1;
4763 W_L("<div align=\"");
4766 flg->with_div_flag = 1;
4768 node->userData = flg;
4771 node->userData = NULL;
4773 return chtml30->out;
4778 * It is a handler who processes the SPAN tag.
4780 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4781 * destination is specified.
4782 * @param node [i] The SPAN tag node is specified.
4783 * @return The conversion result is returned.
4786 s_chtml30_end_span_tag(void *pdoc, Node *node)
4788 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4789 Doc *doc = chtml30->doc;
4791 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4792 if (flg && flg->with_div_flag) {
4795 if (flg && flg->with_font_flag) {
4798 if (flg && flg->with_marquee_flag) {
4801 if (flg && flg->with_blink_flag) {
4804 if (IS_CSS_ON(chtml30->entryp)) {
4805 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4807 return chtml30->out;
4813 * It is a handler who processes the STYLE tag.
4815 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4816 * destination is specified.
4817 * @param node [i] The STYLE tag node is specified.
4818 * @return The conversion result is returned.
4821 s_chtml30_style_tag(void *pdoc, Node *node)
4828 chtml30 = GET_CHTML30(pdoc);
4831 if (! IS_CSS_ON(chtml30->entryp)) {
4832 return chtml30->out;
4835 for (attr = qs_get_attr(doc,node);
4837 attr = qs_get_next_attr(doc,attr)) {
4838 char *name = qs_get_attr_name(doc,attr);
4839 char *value = qs_get_attr_value(doc,attr);
4840 if (STRCASEEQ('t','T',"type", name)) {
4841 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4847 Node *child = qs_get_child_node(doc, node);
4848 if (type && child) {
4849 char *name = qs_get_node_name(doc, child);
4850 if (STRCASEEQ('t','T',"text", name)) {
4851 char *value = qs_get_node_value(doc, child);
4852 DBG(doc->r, "start load CSS. buf:[%s]", value);
4853 chtml30->style = chxj_css_parse_style_value(doc, chtml30->style, value);
4854 DBG(doc->r, "end load CSS. value:[%s]", value);
4857 return chtml30->out;