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"
27 #define GET_CHTML30(X) ((chtml30_t *)(X))
30 #define W_L(X) do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
31 #define W_V(X) do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X)) \
32 : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
34 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml30->conf); W_V(nlcode); } while (0)
38 #define CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR(tagname) \
43 char *attr_style = NULL; \
44 char *attr_color = NULL; \
46 chtml30 = GET_CHTML30(pdoc); \
48 for (attr = qs_get_attr(doc,node); \
50 attr = qs_get_next_attr(doc,attr)) { \
51 char *nm = qs_get_attr_name(doc,attr); \
52 char *val = qs_get_attr_value(doc,attr); \
53 if (val && STRCASEEQ('s','S',"style", nm)) { \
57 if (IS_CSS_ON(chtml30->entryp)) { \
58 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style); \
60 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color"); \
61 css_property_t *cur; \
62 for (cur = color_prop->next; cur != color_prop; cur = cur->next) { \
63 if (cur->value && *cur->value) { \
64 attr_color = apr_pstrdup(doc->pool, cur->value); \
70 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t)); \
71 memset(flg, 0, sizeof(*flg)); \
73 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color); \
74 W_L("<font color=\""); \
77 flg->with_font_flag = 1; \
79 node->userData = (void *)flg; \
80 return chtml30->out; \
83 #define CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG() \
85 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
86 Doc *doc = chtml30->doc; \
87 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
88 if (flg && flg->with_font_flag) { \
91 if (IS_CSS_ON(chtml30->entryp)) { \
92 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
94 return chtml30->out; \
97 #define CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG(tagname) \
99 chtml30_t *chtml30 = GET_CHTML30(pdoc); \
100 Doc *doc = chtml30->doc; \
101 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData; \
102 if (flg && flg->with_font_flag) { \
106 if (IS_CSS_ON(chtml30->entryp)) { \
107 chxj_css_pop_prop_list(chtml30->css_prop_stack); \
109 return chtml30->out; \
113 static char *s_chtml30_start_html_tag (void *pdoc, Node *node);
114 static char *s_chtml30_end_html_tag (void *pdoc, Node *node);
115 static char *s_chtml30_start_meta_tag (void *pdoc, Node *node);
116 static char *s_chtml30_end_meta_tag (void *pdoc, Node *node);
117 static char *s_chtml30_start_textarea_tag (void *pdoc, Node *node);
118 static char *s_chtml30_end_textarea_tag (void *pdoc, Node *node);
119 static char *s_chtml30_start_p_tag (void *pdoc, Node *node);
120 static char *s_chtml30_end_p_tag (void *pdoc, Node *node);
121 static char *s_chtml30_start_pre_tag (void *pdoc, Node *node);
122 static char *s_chtml30_end_pre_tag (void *pdoc, Node *node);
123 static char *s_chtml30_start_h1_tag (void *pdoc, Node *node);
124 static char *s_chtml30_end_h1_tag (void *pdoc, Node *node);
125 static char *s_chtml30_start_h2_tag (void *pdoc, Node *node);
126 static char *s_chtml30_end_h2_tag (void *pdoc, Node *node);
127 static char *s_chtml30_start_h3_tag (void *pdoc, Node *node);
128 static char *s_chtml30_end_h3_tag (void *pdoc, Node *node);
129 static char *s_chtml30_start_h4_tag (void *pdoc, Node *node);
130 static char *s_chtml30_end_h4_tag (void *pdoc, Node *node);
131 static char *s_chtml30_start_h5_tag (void *pdoc, Node *node);
132 static char *s_chtml30_end_h5_tag (void *pdoc, Node *node);
133 static char *s_chtml30_start_h6_tag (void *pdoc, Node *node);
134 static char *s_chtml30_end_h6_tag (void *pdoc, Node *node);
135 static char *s_chtml30_start_ul_tag (void *pdoc, Node *node);
136 static char *s_chtml30_end_ul_tag (void *pdoc, Node *node);
137 static char *s_chtml30_start_ol_tag (void *pdoc, Node *node);
138 static char *s_chtml30_end_ol_tag (void *pdoc, Node *node);
139 static char *s_chtml30_start_li_tag (void *pdoc, Node *node);
140 static char *s_chtml30_end_li_tag (void *pdoc, Node *node);
141 static char *s_chtml30_start_head_tag (void *pdoc, Node *node);
142 static char *s_chtml30_end_head_tag (void *pdoc, Node *node);
143 static char *s_chtml30_start_title_tag (void *pdoc, Node *node);
144 static char *s_chtml30_end_title_tag (void *pdoc, Node *node);
145 static char *s_chtml30_start_base_tag (void *pdoc, Node *node);
146 static char *s_chtml30_end_base_tag (void *pdoc, Node *node);
147 static char *s_chtml30_start_body_tag (void *pdoc, Node *node);
148 static char *s_chtml30_end_body_tag (void *pdoc, Node *node);
149 static char *s_chtml30_start_a_tag (void *pdoc, Node *node);
150 static char *s_chtml30_end_a_tag (void *pdoc, Node *node);
151 static char *s_chtml30_start_br_tag (void *pdoc, Node *node);
152 static char *s_chtml30_end_br_tag (void *pdoc, Node *node);
153 static char *s_chtml30_start_tr_tag (void *pdoc, Node *node);
154 static char *s_chtml30_end_tr_tag (void *pdoc, Node *node);
155 static char *s_chtml30_start_font_tag (void *pdoc, Node *node);
156 static char *s_chtml30_end_font_tag (void *pdoc, Node *node);
157 static char *s_chtml30_start_form_tag (void *pdoc, Node *node);
158 static char *s_chtml30_end_form_tag (void *pdoc, Node *node);
159 static char *s_chtml30_start_input_tag (void *pdoc, Node *node);
160 static char *s_chtml30_end_input_tag (void *pdoc, Node *node);
161 static char *s_chtml30_start_center_tag (void *pdoc, Node *node);
162 static char *s_chtml30_end_center_tag (void *pdoc, Node *node);
163 static char *s_chtml30_start_hr_tag (void *pdoc, Node *node);
164 static char *s_chtml30_end_hr_tag (void *pdoc, Node *node);
165 static char *s_chtml30_start_img_tag (void *pdoc, Node *node);
166 static char *s_chtml30_end_img_tag (void *pdoc, Node *node);
167 static char *s_chtml30_start_select_tag (void *pdoc, Node *node);
168 static char *s_chtml30_end_select_tag (void *pdoc, Node *node);
169 static char *s_chtml30_start_option_tag (void *pdoc, Node *node);
170 static char *s_chtml30_end_option_tag (void *pdoc, Node *node);
171 static char *s_chtml30_start_div_tag (void *pdoc, Node *node);
172 static char *s_chtml30_end_div_tag (void *pdoc, Node *node);
173 static char *s_chtml30_chxjif_tag (void *pdoc, Node *node);
174 static char *s_chtml30_text_tag (void *pdoc, Node *node);
175 static char *s_chtml30_start_blockquote_tag (void *pdoc, Node *node);
176 static char *s_chtml30_end_blockquote_tag (void *pdoc, Node *node);
177 static char *s_chtml30_start_dir_tag (void *pdoc, Node *node);
178 static char *s_chtml30_end_dir_tag (void *pdoc, Node *node);
179 static char *s_chtml30_start_dl_tag (void *pdoc, Node *node);
180 static char *s_chtml30_end_dl_tag (void *pdoc, Node *node);
181 static char *s_chtml30_start_dt_tag (void *pdoc, Node *node);
182 static char *s_chtml30_end_dt_tag (void *pdoc, Node *node);
183 static char *s_chtml30_start_dd_tag (void *pdoc, Node *node);
184 static char *s_chtml30_end_dd_tag (void *pdoc, Node *node);
185 static char *s_chtml30_start_marquee_tag (void *pdoc, Node *node);
186 static char *s_chtml30_end_marquee_tag (void *pdoc, Node *node);
187 static char *s_chtml30_start_blink_tag (void *pdoc, Node *node);
188 static char *s_chtml30_end_blink_tag (void *pdoc, Node *node);
189 static char *s_chtml30_start_menu_tag (void *pdoc, Node *node);
190 static char *s_chtml30_end_menu_tag (void *pdoc, Node *node);
191 static char *s_chtml30_start_plaintext_tag (void *pdoc, Node *node);
192 static char *s_chtml30_start_plaintext_tag_inner (void *pdoc, Node *node);
193 static char *s_chtml30_end_plaintext_tag (void *pdoc, Node *node);
194 static char *s_chtml30_style_tag (void *pdoc, Node *node);
195 static char *s_chtml30_newline_mark (void *pdoc, Node *node);
196 static char *s_chtml30_link_tag (void *pdoc, Node *node);
197 static char *s_chtml30_start_span_tag (void *pdoc, Node *node);
198 static char *s_chtml30_end_span_tag (void *pdoc, Node *node);
200 static void s_init_chtml30(chtml30_t *chtml, Doc *doc, request_rec *r, device_table *spec);
202 static int s_chtml30_search_emoji(chtml30_t *chtml, char *txt, char **rslt);
203 static css_prop_list_t *s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
204 static css_prop_list_t *s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
207 tag_handler chtml30_handler[] = {
210 s_chtml30_start_html_tag,
211 s_chtml30_end_html_tag,
215 s_chtml30_start_meta_tag,
216 s_chtml30_end_meta_tag,
220 s_chtml30_start_textarea_tag,
221 s_chtml30_end_textarea_tag,
225 s_chtml30_start_p_tag,
230 s_chtml30_start_pre_tag,
231 s_chtml30_end_pre_tag,
235 s_chtml30_start_ul_tag,
236 s_chtml30_end_ul_tag,
240 s_chtml30_start_li_tag,
241 s_chtml30_end_li_tag,
245 s_chtml30_start_ol_tag,
246 s_chtml30_end_ol_tag,
250 s_chtml30_start_h1_tag,
251 s_chtml30_end_h1_tag,
255 s_chtml30_start_h2_tag,
256 s_chtml30_end_h2_tag,
260 s_chtml30_start_h3_tag,
261 s_chtml30_end_h3_tag,
265 s_chtml30_start_h4_tag,
266 s_chtml30_end_h4_tag,
270 s_chtml30_start_h5_tag,
271 s_chtml30_end_h5_tag,
275 s_chtml30_start_h6_tag,
276 s_chtml30_end_h6_tag,
280 s_chtml30_start_head_tag,
281 s_chtml30_end_head_tag,
285 s_chtml30_start_title_tag,
286 s_chtml30_end_title_tag,
290 s_chtml30_start_base_tag,
291 s_chtml30_end_base_tag,
295 s_chtml30_start_body_tag,
296 s_chtml30_end_body_tag,
300 s_chtml30_start_a_tag,
305 s_chtml30_start_br_tag,
306 s_chtml30_end_br_tag,
315 s_chtml30_start_tr_tag,
316 s_chtml30_end_tr_tag,
330 s_chtml30_start_font_tag,
331 s_chtml30_end_font_tag,
335 s_chtml30_start_form_tag,
336 s_chtml30_end_form_tag,
340 s_chtml30_start_input_tag,
341 s_chtml30_end_input_tag,
345 s_chtml30_start_center_tag,
346 s_chtml30_end_center_tag,
350 s_chtml30_start_hr_tag,
351 s_chtml30_end_hr_tag,
355 s_chtml30_start_img_tag,
356 s_chtml30_end_img_tag,
360 s_chtml30_start_select_tag,
361 s_chtml30_end_select_tag,
365 s_chtml30_start_option_tag,
366 s_chtml30_end_option_tag,
370 s_chtml30_start_div_tag,
371 s_chtml30_end_div_tag,
375 s_chtml30_chxjif_tag,
395 s_chtml30_start_span_tag,
396 s_chtml30_end_span_tag,
420 s_chtml30_start_dt_tag,
421 s_chtml30_end_dt_tag,
435 s_chtml30_start_blockquote_tag,
436 s_chtml30_end_blockquote_tag,
440 s_chtml30_start_dir_tag,
441 s_chtml30_end_dir_tag,
445 s_chtml30_start_dl_tag,
446 s_chtml30_end_dl_tag,
450 s_chtml30_start_dd_tag,
451 s_chtml30_end_dd_tag,
455 s_chtml30_start_menu_tag,
456 s_chtml30_end_menu_tag,
460 s_chtml30_start_plaintext_tag,
461 s_chtml30_end_plaintext_tag,
465 s_chtml30_start_blink_tag,
466 s_chtml30_end_blink_tag,
470 s_chtml30_start_marquee_tag,
471 s_chtml30_end_marquee_tag,
480 s_chtml30_newline_mark,
487 * converts from CHTML5.0 to CHTML3.0.
489 * @param r [i] Requet_rec is appointed.
490 * @param spec [i] The result of the device specification processing which
491 * was done in advance is appointed.
492 * @param src [i] The character string before the converting is appointed.
493 * @return The character string after the converting is returned.
496 chxj_convert_chtml30(
502 chxjconvrule_entry *entryp,
511 DBG(r, "start chxj_convert_chtml30()");
513 /*--------------------------------------------------------------------------*/
515 /*--------------------------------------------------------------------------*/
517 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
519 DBG(r,"i found qrcode xml");
520 DBG(r, "end chxj_convert_chtml30()");
523 DBG(r,"not found qrcode xml");
525 /*--------------------------------------------------------------------------*/
526 /* The CHTML structure is initialized. */
527 /*--------------------------------------------------------------------------*/
528 s_init_chtml30(&chtml30, &doc, r, spec);
530 chtml30.entryp = entryp;
531 chtml30.cookie = cookie;
533 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
535 /*--------------------------------------------------------------------------*/
536 /* The character string of the input is analyzed. */
537 /*--------------------------------------------------------------------------*/
538 qs_init_malloc(&doc);
539 qs_init_root_node(&doc);
541 ss = apr_pcalloc(r->pool, srclen + 1);
542 memset(ss, 0, srclen + 1);
543 memcpy(ss, src, srclen);
546 chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
548 if (IS_CSS_ON(chtml30.entryp)) {
549 /* current property list */
550 chtml30.css_prop_stack = chxj_new_prop_list_stack(&doc);
553 chxj_buffered_write_init(r->pool, &doc.buf);
555 qs_parse_string(&doc,ss, strlen(ss));
557 /*--------------------------------------------------------------------------*/
558 /* It converts it from CHTML to CHTML. */
559 /*--------------------------------------------------------------------------*/
560 chxj_node_convert(spec,r,(void*)&chtml30, &doc, qs_get_root(&doc), 0);
561 chtml30.out = chxj_buffered_write_flush(chtml30.out, &doc.buf);
562 dst = apr_pstrdup(r->pool, chtml30.out);
563 chxj_buffered_write_terminate(&doc.buf);
565 qs_all_free(&doc,QX_LOGMARK);
568 dst = apr_pstrdup(r->pool,ss);
570 if (strlen(dst) == 0) {
571 dst = apr_psprintf(r->pool, "\n");
574 *dstlen = strlen(dst);
577 chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
580 DBG(r, "end chxj_convert_chtml30()");
586 * The CHTML structure is initialized.
588 * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
589 * initialized is specified.
590 * @param doc [i] The Doc structure that should be set to the initialized
591 * HDML structure is specified.
592 * @param r [i] To use POOL, the pointer to request_rec is specified.
593 * @param spec [i] The pointer to the device_table
596 s_init_chtml30(chtml30_t *chtml30, Doc *doc, request_rec *r, device_table *spec)
598 memset(doc, 0, sizeof(Doc));
599 memset(chtml30, 0, sizeof(chtml30_t));
603 chtml30->spec = spec;
604 chtml30->out = qs_alloc_zero_byte_string(r->pool);
605 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
606 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
611 * Corresponding EMOJI to a current character-code is retrieved.
612 * The substitution character string is stored in the rslt pointer if agreeing.
614 * @param chtml30 [i] The pointer to the CHTML structure is specified.
615 * @param txt [i] The character string to want to examine whether it is
616 * EMOJI is specified.
617 * @param rslt [o] The pointer to the pointer that stores the result is
619 * @return When corresponding EMOJI exists, it returns it excluding 0.
622 s_chtml30_search_emoji(chtml30_t *chtml30, char *txt, char **rslt)
629 spec = chtml30->spec;
635 DBG(r,"spec is NULL");
638 for (ee = chtml30->conf->emoji;
641 if (ee->imode == NULL) {
642 DBG(r, "emoji->imode is NULL");
646 if (ee->imode->string != NULL
647 && strlen(ee->imode->string) > 0
648 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
650 if (spec == NULL || spec->emoji_type == NULL) {
651 *rslt = apr_palloc(r->pool, 3);
652 (*rslt)[0] = ee->imode->hex1byte & 0xff;
653 (*rslt)[1] = ee->imode->hex2byte & 0xff;
655 return strlen(ee->imode->string);
667 chxj_chtml30_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
678 chtml30 = &__chtml30;
681 DBG(r, "REQ[%X] start chxj_chtml30_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
682 memset(doc, 0, sizeof(Doc));
683 memset(chtml30, 0, sizeof(chtml30_t));
687 chtml30->spec = spec;
688 chtml30->out = qs_alloc_zero_byte_string(r->pool);
689 chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
690 chtml30->doc->parse_mode = PARSE_MODE_CHTML;
692 apr_pool_create(&pool, r->pool);
694 chxj_buffered_write_init(pool, &doc->buf);
696 for (ii=0; ii<len; ii++) {
700 rtn = s_chtml30_search_emoji(chtml30, (char *)&src[ii], &out);
707 if (is_sjis_kanji(src[ii])) {
708 two_byte[0] = src[ii+0];
709 two_byte[1] = src[ii+1];
715 one_byte[0] = src[ii+0];
720 chtml30->out = chxj_buffered_write_flush(chtml30->out, &doc->buf);
722 DBG(r, "REQ[%X] end chxj_chtml30_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
728 * It is a handler who processes the HTML tag.
730 * @param pdoc [i/o] The pointer to the CHTML structure at the output
731 * destination is specified.
732 * @param node [i] The HTML tag node is specified.
733 * @return The conversion result is returned.
736 s_chtml30_start_html_tag(void *pdoc, Node *UNUSED(node))
738 chtml30_t *chtml30 = GET_CHTML30(pdoc);
739 Doc *doc = chtml30->doc;
741 /*--------------------------------------------------------------------------*/
743 /*--------------------------------------------------------------------------*/
751 * It is a handler who processes the HTML tag.
753 * @param pdoc [i/o] The pointer to the CHTML structure at the output
754 * destination is specified.
755 * @param node [i] The HTML tag node is specified.
756 * @return The conversion result is returned.
759 s_chtml30_end_html_tag(void *pdoc, Node *UNUSED(child))
761 chtml30_t *chtml30 = GET_CHTML30(pdoc);
762 Doc *doc = chtml30->doc;
771 * It is a handler who processes the META tag.
773 * @param pdoc [i/o] The pointer to the CHTML structure at the output
774 * destination is specified.
775 * @param node [i] The META tag node is specified.
776 * @return The conversion result is returned.
779 s_chtml30_start_meta_tag(void *pdoc, Node *node)
785 int content_type_flag;
788 chtml30 = GET_CHTML30(pdoc);
792 content_type_flag = 0;
796 /*--------------------------------------------------------------------------*/
798 /*--------------------------------------------------------------------------*/
799 for (attr = qs_get_attr(doc,node);
801 attr = qs_get_next_attr(doc,attr)) {
802 char *name = qs_get_attr_name(doc,attr);
803 char *value = qs_get_attr_value(doc,attr);
807 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
808 /*----------------------------------------------------------------------*/
810 /*----------------------------------------------------------------------*/
811 W_L(" http-equiv=\"");
814 if (STRCASEEQ('c','C',"content-type", value))
815 content_type_flag = 1;
817 if (STRCASEEQ('r','R',"refresh", value))
824 if (strcasecmp(name, "content") == 0 && value && *value) {
825 if (content_type_flag) {
829 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
837 buf = apr_pstrdup(r->pool, value);
838 url = strchr(buf, ';');
840 sec = apr_pstrdup(r->pool, buf);
843 url = chxj_encoding_parameter(r, url, 0);
844 url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
874 * It is a handler who processes the META tag.
876 * @param pdoc [i/o] The pointer to the CHTML structure at the output
877 * destination is specified.
878 * @param node [i] The META tag node is specified.
879 * @return The conversion result is returned.
882 s_chtml30_end_meta_tag(void* pdoc, Node* UNUSED(child))
884 chtml30_t *chtml30 = GET_CHTML30(pdoc);
891 * It is a handler who processes the HEAD tag.
893 * @param pdoc [i/o] The pointer to the CHTML structure at the output
894 * destination is specified.
895 * @param node [i] The HEAD tag node is specified.
896 * @return The conversion result is returned.
899 s_chtml30_start_head_tag(void* pdoc, Node* UNUSED(node))
901 chtml30_t *chtml30 = GET_CHTML30(pdoc);
902 Doc *doc = chtml30->doc;
911 * It is a handler who processes the HEAD tag.
913 * @param pdoc [i/o] The pointer to the CHTML structure at the output
914 * destination is specified.
915 * @param node [i] The HEAD tag node is specified.
916 * @return The conversion result is returned.
919 s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node))
921 chtml30_t *chtml30 = GET_CHTML30(pdoc);
922 Doc *doc = chtml30->doc;
931 * It is a handler who processes the TITLE tag.
933 * @param pdoc [i/o] The pointer to the CHTML structure at the output
934 * destination is specified.
935 * @param node [i] The TITLE tag node is specified.
936 * @return The conversion result is returned.
939 s_chtml30_start_title_tag(void *pdoc, Node *UNUSED(node))
941 chtml30_t *chtml30 = GET_CHTML30(pdoc);
942 Doc *doc = chtml30->doc;
951 * It is a handler who processes the TITLE tag.
953 * @param pdoc [i/o] The pointer to the CHTML structure at the output
954 * destination is specified.
955 * @param node [i] The TITLE tag node is specified.
956 * @return The conversion result is returned.
959 s_chtml30_end_title_tag(void *pdoc, Node *UNUSED(child))
961 chtml30_t *chtml30 = GET_CHTML30(pdoc);
962 Doc *doc = chtml30->doc;
971 * It is a handler who processes the BASE tag.
973 * @param pdoc [i/o] The pointer to the CHTML structure at the output
974 * destination is specified.
975 * @param node [i] The BASE tag node is specified.
976 * @return The conversion result is returned.
979 s_chtml30_start_base_tag(void *pdoc, Node *node)
986 chtml30 = GET_CHTML30(pdoc);
991 /*--------------------------------------------------------------------------*/
993 /*--------------------------------------------------------------------------*/
994 for (attr = qs_get_attr(doc,node);
996 attr = qs_get_next_attr(doc,attr)) {
997 char *name = qs_get_attr_name(doc,attr);
998 char *value = qs_get_attr_value(doc,attr);
999 if (STRCASEEQ('h','H',"href", name)) {
1006 return chtml30->out;
1011 * It is a handler who processes the BASE tag.
1013 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1014 * destination is specified.
1015 * @param node [i] The BASE tag node is specified.
1016 * @return The conversion result is returned.
1019 s_chtml30_end_base_tag(void *pdoc, Node *UNUSED(child))
1021 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1023 return chtml30->out;
1028 * It is a handler who processes the BODY tag.
1030 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1031 * destination is specified.
1032 * @param node [i] The BODY tag node is specified.
1033 * @return The conversion result is returned.
1036 s_chtml30_start_body_tag(void *pdoc, Node *node)
1042 char *attr_bgcolor = NULL;
1043 char *attr_text = NULL;
1044 char *attr_link = NULL;
1045 char *attr_style = NULL;
1047 chtml30 = GET_CHTML30(pdoc);
1051 /*--------------------------------------------------------------------------*/
1052 /* Get Attributes */
1053 /*--------------------------------------------------------------------------*/
1054 for (attr = qs_get_attr(doc,node);
1056 attr = qs_get_next_attr(doc,attr)) {
1057 char *name = qs_get_attr_name(doc,attr);
1058 char *value = qs_get_attr_value(doc,attr);
1062 if (strcasecmp(name, "bgcolor") == 0 && value && *value != 0) {
1063 /*----------------------------------------------------------------------*/
1065 /*----------------------------------------------------------------------*/
1066 attr_bgcolor = value;
1072 if (strcasecmp(name, "text") == 0 && value && *value != 0) {
1073 /*----------------------------------------------------------------------*/
1075 /*----------------------------------------------------------------------*/
1082 if (strcasecmp(name, "style") == 0 && value && *value != 0) {
1089 if (strcasecmp(name, "link") == 0 && value && *value != 0) {
1090 /*----------------------------------------------------------------------*/
1092 /*----------------------------------------------------------------------*/
1099 if (strcasecmp(name, "alink") == 0) {
1100 /*----------------------------------------------------------------------*/
1102 /*----------------------------------------------------------------------*/
1109 if (strcasecmp(name, "vlink") == 0) {
1110 /*----------------------------------------------------------------------*/
1112 /*----------------------------------------------------------------------*/
1121 if (IS_CSS_ON(chtml30->entryp)) {
1122 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1124 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1125 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1126 css_property_t *cur;
1127 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1128 if (cur->value && *cur->value) {
1129 attr_text = apr_pstrdup(doc->pool, cur->value);
1132 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1133 if (cur->value && *cur->value) {
1134 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1138 if (chtml30->style) {
1139 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml30->style);
1140 css_selector_t *cur_sel;
1141 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1142 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1143 css_property_t *cur;
1144 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1145 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1146 attr_link = apr_pstrdup(doc->pool, cur->value);
1155 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1161 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1167 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1174 return chtml30->out;
1179 * It is a handler who processes the BODY tag.
1181 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1182 * destination is specified.
1183 * @param node [i] The BODY tag node is specified.
1184 * @return The conversion result is returned.
1187 s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child))
1192 chtml30 = GET_CHTML30(pdoc);
1196 if (IS_CSS_ON(chtml30->entryp)) {
1197 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1200 return chtml30->out;
1205 * It is a handler who processes the A tag.
1207 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1208 * destination is specified.
1209 * @param node [i] The A tag node is specified.
1210 * @return The conversion result is returned.
1213 s_chtml30_start_a_tag(void *pdoc, Node *node)
1219 char *attr_style = NULL;
1221 chtml30 = GET_CHTML30(pdoc);
1226 /*--------------------------------------------------------------------------*/
1227 /* Get Attributes */
1228 /*--------------------------------------------------------------------------*/
1229 for (attr = qs_get_attr(doc,node);
1231 attr = qs_get_next_attr(doc,attr)) {
1232 char *name = qs_get_attr_name(doc,attr);
1233 char *value = qs_get_attr_value(doc,attr);
1234 if (STRCASEEQ('n','N',"name", name)) {
1235 /*----------------------------------------------------------------------*/
1237 /*----------------------------------------------------------------------*/
1242 else if (STRCASEEQ('h','H',"href", name)) {
1243 /*----------------------------------------------------------------------*/
1245 /*----------------------------------------------------------------------*/
1246 value = chxj_encoding_parameter(r, value, 0);
1247 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1248 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
1254 else if (STRCASEEQ('a','A',"accesskey", name)) {
1255 /*----------------------------------------------------------------------*/
1257 /*----------------------------------------------------------------------*/
1258 W_L(" accesskey=\"");
1262 else if (STRCASEEQ('c','C',"cti", name)) {
1263 /*----------------------------------------------------------------------*/
1265 /*----------------------------------------------------------------------*/
1270 else if (STRCASEEQ('i','I',"ijam", name)) {
1271 /*----------------------------------------------------------------------*/
1273 /*----------------------------------------------------------------------*/
1276 else if (STRCASEEQ('u','U',"utn", name)) {
1277 /*----------------------------------------------------------------------*/
1279 /* It is special only for CHTML. */
1280 /*----------------------------------------------------------------------*/
1283 else if (STRCASEEQ('t','T',"telbook", name)) {
1284 /*----------------------------------------------------------------------*/
1286 /*----------------------------------------------------------------------*/
1289 else if (STRCASEEQ('k','K',"kana", name)) {
1290 /*----------------------------------------------------------------------*/
1292 /*----------------------------------------------------------------------*/
1295 else if (STRCASEEQ('e','E',"email", name)) {
1296 /*----------------------------------------------------------------------*/
1298 /*----------------------------------------------------------------------*/
1301 else if (STRCASEEQ('i','I',"ista", name)) {
1302 /*----------------------------------------------------------------------*/
1304 /*----------------------------------------------------------------------*/
1307 else if (STRCASEEQ('i','I',"ilet", name)) {
1308 /*----------------------------------------------------------------------*/
1310 /*----------------------------------------------------------------------*/
1313 else if (STRCASEEQ('i','I',"iswf", name)) {
1314 /*----------------------------------------------------------------------*/
1316 /*----------------------------------------------------------------------*/
1319 else if (STRCASEEQ('i','I',"irst", name)) {
1320 /*----------------------------------------------------------------------*/
1322 /*----------------------------------------------------------------------*/
1325 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1331 if (IS_CSS_ON(chtml30->entryp)) {
1332 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1335 return chtml30->out;
1340 * It is a handler who processes the A tag.
1342 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1343 * destination is specified.
1344 * @param node [i] The A tag node is specified.
1345 * @return The conversion result is returned.
1348 s_chtml30_end_a_tag(void *pdoc, Node *UNUSED(child))
1353 chtml30 = GET_CHTML30(pdoc);
1357 if (IS_CSS_ON(chtml30->entryp)) {
1358 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1361 return chtml30->out;
1366 * It is a handler who processes the BR tag.
1368 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1369 * destination is specified.
1370 * @param node [i] The BR tag node is specified.
1371 * @return The conversion result is returned.
1374 s_chtml30_start_br_tag(void *pdoc, Node *node)
1381 chtml30 = GET_CHTML30(pdoc);
1385 /*--------------------------------------------------------------------------*/
1386 /* Get Attributes */
1387 /*--------------------------------------------------------------------------*/
1388 for (attr = qs_get_attr(doc,node);
1390 attr = qs_get_next_attr(doc,attr)) {
1391 char *name = qs_get_attr_name(doc,attr);
1392 char *value = qs_get_attr_value(doc,attr);
1393 if (STRCASEEQ('c','C',"clear",name)) {
1394 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1402 return chtml30->out;
1407 * It is a handler who processes the BR tag.
1409 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1410 * destination is specified.
1411 * @param node [i] The BR tag node is specified.
1412 * @return The conversion result is returned.
1415 s_chtml30_end_br_tag(void *pdoc, Node *UNUSED(child))
1417 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1419 return chtml30->out;
1424 * It is a handler who processes the TR tag.
1426 * @param chtml30 [i/o] The pointer to the CHTML structure at the output
1427 * destination is specified.
1428 * @param node [i] The TR tag node is specified.
1429 * @return The conversion result is returned.
1432 s_chtml30_start_tr_tag(void *pdoc, Node *UNUSED(node))
1434 chtml30_t *chtml30 = GET_CHTML30(pdoc);
1436 return chtml30->out;
1441 * It is a handler who processes the TR tag.
1443 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1444 * destination is specified.
1445 * @param node [i] The TR tag node is specified.
1446 * @return The conversion result is returned.
1449 s_chtml30_end_tr_tag(void *pdoc, Node *UNUSED(child))
1455 chtml30 = GET_CHTML30(pdoc);
1461 return chtml30->out;
1466 * It is a handler who processes the FONT tag.
1468 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1469 * destination is specified.
1470 * @param node [i] The FONT tag node is specified.
1471 * @return The conversion result is returned.
1474 s_chtml30_start_font_tag(void *pdoc, Node *node)
1480 char *attr_color = NULL;
1481 char *attr_style = NULL;
1483 chtml30 = GET_CHTML30(pdoc);
1487 /*--------------------------------------------------------------------------*/
1488 /* Get Attributes */
1489 /*--------------------------------------------------------------------------*/
1490 for (attr = qs_get_attr(doc,node);
1492 attr = qs_get_next_attr(doc,attr)) {
1493 char *name = qs_get_attr_name(doc,attr);
1494 char *value = qs_get_attr_value(doc,attr);
1495 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1496 attr_color = apr_pstrdup(doc->buf.pool, value);
1498 else if (STRCASEEQ('s','S',"size", name)) {
1499 /*----------------------------------------------------------------------*/
1501 /*----------------------------------------------------------------------*/
1504 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1508 if (IS_CSS_ON(chtml30->entryp)) {
1509 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1511 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1512 css_property_t *cur;
1513 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1514 if (cur->value && *cur->value) {
1515 attr_color = apr_pstrdup(doc->pool, cur->value);
1521 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1522 W_L("<font color=\"");
1526 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1527 flg->with_font_flag = 1;
1528 node->userData = flg;
1531 node->userData = NULL;
1533 return chtml30->out;
1538 * It is a handler who processes the FONT tag.
1540 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1541 * destination is specified.
1542 * @param node [i] The FONT tag node is specified.
1543 * @return The conversion result is returned.
1546 s_chtml30_end_font_tag(void *pdoc, Node *node)
1552 chtml30 = GET_CHTML30(pdoc);
1556 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1557 if (flg && flg->with_font_flag) {
1560 if (IS_CSS_ON(chtml30->entryp)) {
1561 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1564 return chtml30->out;
1569 * It is a handler who processes the FORM tag.
1571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1572 * destination is specified.
1573 * @param node [i] The FORM tag node is specified.
1574 * @return The conversion result is returned.
1577 s_chtml30_start_form_tag(void *pdoc, Node *node)
1583 char *attr_style = NULL;
1584 char *attr_color = NULL;
1585 char *attr_align = NULL;
1586 char *new_hidden_tag = NULL;
1587 char *attr_method = NULL;
1588 char *attr_action = NULL;
1589 char *attr_utn = NULL;
1591 chtml30 = GET_CHTML30(pdoc);
1595 /*--------------------------------------------------------------------------*/
1596 /* Get Attributes */
1597 /*--------------------------------------------------------------------------*/
1598 for (attr = qs_get_attr(doc,node);
1600 attr = qs_get_next_attr(doc,attr)) {
1601 char *name = qs_get_attr_name(doc,attr);
1602 char *value = qs_get_attr_value(doc,attr);
1606 if (strcasecmp(name, "action") == 0) {
1607 /*--------------------------------------------------------------------*/
1609 /*--------------------------------------------------------------------*/
1610 attr_action = value;
1616 if (strcasecmp(name, "method") == 0) {
1617 /*--------------------------------------------------------------------*/
1619 /*--------------------------------------------------------------------*/
1620 attr_method = value;
1626 if (strcasecmp(name, "utn") == 0) {
1627 /*--------------------------------------------------------------------*/
1629 /*--------------------------------------------------------------------*/
1636 if (strcasecmp(name, "style") == 0) {
1645 if (IS_CSS_ON(chtml30->entryp)) {
1646 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1648 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1649 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1650 css_property_t *cur;
1651 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1652 if (STRCASEEQ('l','L',"left", cur->value)) {
1653 attr_align = apr_pstrdup(doc->pool, "left");
1655 else if (STRCASEEQ('c','C',"center",cur->value)) {
1656 attr_align = apr_pstrdup(doc->pool, "center");
1658 else if (STRCASEEQ('r','R',"right",cur->value)) {
1659 attr_align = apr_pstrdup(doc->pool, "right");
1662 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1663 attr_color = apr_pstrdup(doc->pool, cur->value);
1668 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1672 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1673 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml30->cookie);
1675 char *new_query_string = NULL;
1676 q = strchr(attr_action, '?');
1678 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);
1679 if (new_hidden_tag || new_query_string) {
1685 if (new_query_string) {
1687 W_V(new_query_string);
1701 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1702 memset(flg, 0, sizeof(*flg));
1704 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1705 W_L("<font color=\"");
1708 flg->with_font_flag = 1;
1711 W_L("<div align=\"");
1714 flg->with_div_flag = 1;
1716 node->userData = flg;
1718 if (new_hidden_tag) {
1719 W_V(new_hidden_tag);
1721 return chtml30->out;
1726 * It is a handler who processes the FORM tag.
1728 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1729 * destination is specified.
1730 * @param node [i] The FORM tag node is specified.
1731 * @return The conversion result is returned.
1734 s_chtml30_end_form_tag(void *pdoc, Node *node)
1739 chtml30 = GET_CHTML30(pdoc);
1742 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
1743 if (flg && flg->with_div_flag) {
1746 if (flg && flg->with_font_flag) {
1750 if (IS_CSS_ON(chtml30->entryp)) {
1751 chxj_css_pop_prop_list(chtml30->css_prop_stack);
1754 return chtml30->out;
1759 * It is a handler who processes the INPUT tag.
1761 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1762 * destination is specified.
1763 * @param node [i] The INPUT tag node is specified.
1764 * @return The conversion result is returned.
1767 s_chtml30_start_input_tag(void *pdoc, Node *node)
1773 char *attr_accesskey = NULL;
1774 char *attr_max_length = NULL;
1775 char *attr_type = NULL;
1776 char *attr_name = NULL;
1777 char *attr_value = NULL;
1778 char *attr_istyle = NULL;
1779 char *attr_size = NULL;
1780 char *attr_checked = NULL;
1781 char *attr_style = NULL;
1783 chtml30 = GET_CHTML30(pdoc);
1787 /*--------------------------------------------------------------------------*/
1788 /* Get Attributes */
1789 /*--------------------------------------------------------------------------*/
1790 for (attr = qs_get_attr(doc,node);
1792 attr = qs_get_next_attr(doc,attr)) {
1793 char *name = qs_get_attr_name(doc,attr);
1794 char *value = qs_get_attr_value(doc,attr);
1795 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1796 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1797 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1798 STRCASEEQ('p','P',"password",tmp_type) ||
1799 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1800 STRCASEEQ('r','R',"radio", tmp_type) ||
1801 STRCASEEQ('h','H',"hidden", tmp_type) ||
1802 STRCASEEQ('s','S',"submit", tmp_type) ||
1803 STRCASEEQ('r','R',"reset", tmp_type))) {
1804 attr_type = tmp_type;
1807 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1810 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1813 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1814 attr_istyle = value;
1816 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1817 attr_max_length = value;
1819 else if (STRCASEEQ('c','C',"checked", name)) {
1820 attr_checked = value;
1822 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1823 attr_accesskey = value;
1825 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1828 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1833 if (IS_CSS_ON(chtml30->entryp)) {
1834 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
1836 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1837 css_property_t *cur;
1838 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1839 if (strcasestr(cur->value, "<ja:n>")) {
1842 else if (strcasestr(cur->value, "<ja:en>")) {
1845 else if (strcasestr(cur->value, "<ja:hk>")) {
1848 else if (strcasestr(cur->value, "<ja:h>")) {
1873 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1876 if (attr_accesskey) {
1877 W_L(" accesskey=\"");
1878 W_V(attr_accesskey);
1882 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1888 /*--------------------------------------------------------------------------*/
1889 /* The figure is default for the password. */
1890 /*--------------------------------------------------------------------------*/
1891 if (attr_max_length) {
1892 if (chxj_chk_numeric(attr_max_length) != 0) {
1893 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1895 if (attr_istyle && *attr_istyle == '1') {
1896 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1900 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1909 return chtml30->out;
1914 * It is a handler who processes the INPUT tag.
1916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1917 * destination is specified.
1918 * @param node [i] The INPUT tag node is specified.
1919 * @return The conversion result is returned.
1922 s_chtml30_end_input_tag(void *pdoc, Node *UNUSED(node))
1928 chtml30 = GET_CHTML30(pdoc);
1932 return chtml30->out;
1937 * It is a handler who processes the CENTER tag.
1939 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1940 * destination is specified.
1941 * @param node [i] The CENTER tag node is specified.
1942 * @return The conversion result is returned.
1945 s_chtml30_start_center_tag(void *pdoc, Node *node)
1950 char *attr_style = NULL;
1951 char *attr_color = NULL;
1953 chtml30 = GET_CHTML30(pdoc);
1956 for (attr = qs_get_attr(doc,node);
1958 attr = qs_get_next_attr(doc,attr)) {
1959 char *name = qs_get_attr_name(doc,attr);
1960 char *value = qs_get_attr_value(doc,attr);
1961 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1966 if (IS_CSS_ON(chtml30->entryp)) {
1967 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
1969 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1970 css_property_t *cur;
1971 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1972 if (cur->value && *cur->value) {
1973 attr_color = apr_pstrdup(doc->pool, cur->value);
1980 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
1981 memset(flg, 0, sizeof(*flg));
1983 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1984 W_L("<font color=\"");
1987 flg->with_font_flag = 1;
1989 node->userData = flg;
1991 return chtml30->out;
1996 * It is a handler who processes the CENTER tag.
1998 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1999 * destination is specified.
2000 * @param node [i] The CENTER tag node is specified.
2001 * @return The conversion result is returned.
2004 s_chtml30_end_center_tag(void *pdoc, Node *node)
2009 chtml30 = GET_CHTML30(pdoc);
2012 if (IS_CSS_ON(chtml30->entryp)) {
2013 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2015 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
2016 if (flg && flg->with_font_flag) {
2021 return chtml30->out;
2026 * It is a handler who processes the HR tag.
2028 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2029 * destination is specified.
2030 * @param node [i] The HR tag node is specified.
2031 * @return The conversion result is returned.
2034 s_chtml30_start_hr_tag(void *pdoc, Node *node)
2040 char *attr_align = NULL;
2041 char *attr_size = NULL;
2042 char *attr_width = NULL;
2043 char *attr_noshade = NULL;
2044 char *attr_style = NULL;
2046 chtml30 = GET_CHTML30(pdoc);
2050 for (attr = qs_get_attr(doc,node);
2052 attr = qs_get_next_attr(doc,attr)) {
2053 char *name = qs_get_attr_name (doc,attr);
2054 char *value = qs_get_attr_value(doc,attr);
2058 if (strcasecmp(name, "align") == 0) {
2059 /*--------------------------------------------------------------------*/
2061 /*--------------------------------------------------------------------*/
2062 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2070 if (strcasecmp(name, "size") == 0) {
2071 /*--------------------------------------------------------------------*/
2073 /*--------------------------------------------------------------------*/
2074 if (value && *value) {
2078 else if (strcasecmp(name, "style") == 0) {
2079 if (value && *value) {
2087 if (strcasecmp(name, "width") == 0) {
2088 /*--------------------------------------------------------------------*/
2090 /*--------------------------------------------------------------------*/
2091 if (value && *value) {
2099 if (strcasecmp(name, "noshade") == 0) {
2100 /*--------------------------------------------------------------------*/
2102 /*--------------------------------------------------------------------*/
2103 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2109 if (strcasecmp(name, "color") == 0) {
2110 /*--------------------------------------------------------------------*/
2112 /*--------------------------------------------------------------------*/
2121 if (IS_CSS_ON(chtml30->entryp)) {
2122 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2124 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2125 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2126 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2127 css_property_t *cur;
2128 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2129 if (STRCASEEQ('s','S',"solid",cur->value)) {
2130 attr_noshade = "noshade";
2133 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2134 char *tmp = apr_pstrdup(doc->pool, cur->value);
2135 char *tmpp = strstr(tmp, "px");
2138 attr_size = apr_pstrdup(doc->pool, tmp);
2141 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2142 char *tmp = apr_pstrdup(doc->pool, cur->value);
2143 char *tmpp = strstr(tmp, "px");
2146 attr_width = apr_pstrdup(doc->pool, tmp);
2149 tmpp = strstr(tmp, "%");
2151 attr_width = apr_pstrdup(doc->pool, tmp);
2177 return chtml30->out;
2182 * It is a handler who processes the HR tag.
2184 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2185 * destination is specified.
2186 * @param node [i] The HR tag node is specified.
2187 * @return The conversion result is returned.
2190 s_chtml30_end_hr_tag(void *pdoc, Node *UNUSED(child))
2192 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2193 return chtml30->out;
2198 * It is a handler who processes the IMG tag.
2200 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2201 * destination is specified.
2202 * @param node [i] The IMG tag node is specified.
2203 * @return The conversion result is returned.
2206 s_chtml30_start_img_tag(void *pdoc, Node *node)
2212 char *attr_src = NULL;
2213 char *attr_align = NULL;
2214 char *attr_style = NULL;
2215 char *attr_alt = NULL;
2216 char *attr_width = NULL;
2217 char *attr_height = NULL;
2218 char *attr_hspace = NULL;
2219 char *attr_vspace = NULL;
2220 #ifndef IMG_NOT_CONVERT_FILENAME
2224 chtml30 = GET_CHTML30(pdoc);
2225 #ifndef IMG_NOT_CONVERT_FILENAME
2226 spec = chtml30->spec;
2231 /*--------------------------------------------------------------------------*/
2232 /* Get Attributes */
2233 /*--------------------------------------------------------------------------*/
2234 for (attr = qs_get_attr(doc,node);
2236 attr = qs_get_next_attr(doc,attr)) {
2237 char *name = qs_get_attr_name (doc,attr);
2238 char *value = qs_get_attr_value(doc,attr);
2242 if (strcasecmp(name, "src") == 0) {
2243 /*--------------------------------------------------------------------*/
2245 /*--------------------------------------------------------------------*/
2246 #ifdef IMG_NOT_CONVERT_FILENAME
2247 value = chxj_encoding_parameter(r, value, 0);
2248 value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
2249 value = chxj_add_cookie_no_update_parameter(r, value);
2252 value = chxj_img_conv(r,spec,value);
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);
2259 else if (strcasecmp(name,"style") == 0 && value && *value) {
2266 if (strcasecmp(name, "align" ) == 0) {
2267 /*--------------------------------------------------------------------*/
2269 /*--------------------------------------------------------------------*/
2270 /*--------------------------------------------------------------------*/
2272 /*--------------------------------------------------------------------*/
2274 if (STRCASEEQ('t','T',"top", value) ||
2275 STRCASEEQ('m','M',"middle",value) ||
2276 STRCASEEQ('b','B',"bottom",value) ||
2277 STRCASEEQ('l','L',"left", value) ||
2278 STRCASEEQ('r','R',"right", value)) {
2281 else if (STRCASEEQ('c','C',"center", value)) {
2282 attr_align = apr_pstrdup(doc->pool, "middle");
2286 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2287 /*--------------------------------------------------------------------*/
2289 /*--------------------------------------------------------------------*/
2296 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2297 /*--------------------------------------------------------------------*/
2299 /*--------------------------------------------------------------------*/
2306 if (strcasecmp(name, "height") == 0 && value && *value) {
2307 /*--------------------------------------------------------------------*/
2309 /*--------------------------------------------------------------------*/
2310 attr_height = value;
2313 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2314 /*--------------------------------------------------------------------*/
2316 /*--------------------------------------------------------------------*/
2317 attr_hspace = value;
2323 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2324 /*--------------------------------------------------------------------*/
2326 /*--------------------------------------------------------------------*/
2327 attr_vspace = value;
2336 if (IS_CSS_ON(chtml30->entryp)) {
2337 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2339 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2340 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2341 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2342 css_property_t *cur;
2343 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2344 attr_height = apr_pstrdup(doc->pool, cur->value);
2346 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2347 attr_width = apr_pstrdup(doc->pool, cur->value);
2349 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2350 attr_align = apr_pstrdup(doc->pool, cur->value);
2392 return chtml30->out;
2397 * It is a handler who processes the IMG tag.
2399 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2400 * destination is specified.
2401 * @param node [i] The IMG tag node is specified.
2402 * @return The conversion result is returned.
2405 s_chtml30_end_img_tag(void *pdoc, Node *UNUSED(child))
2407 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2409 return chtml30->out;
2414 * It is a handler who processes the SELECT tag.
2416 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2417 * destination is specified.
2418 * @param node [i] The SELECT tag node is specified.
2419 * @return The conversion result is returned.
2422 s_chtml30_start_select_tag(void *pdoc, Node *node)
2424 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2425 Doc *doc = chtml30->doc;
2428 char *multiple = NULL;
2430 char *attr_style = NULL;
2433 for (attr = qs_get_attr(doc,node);
2435 attr = qs_get_next_attr(doc,attr)) {
2436 char *nm = qs_get_attr_name(doc,attr);
2437 char *val = qs_get_attr_value(doc,attr);
2438 if (STRCASEEQ('s','S',"size", nm)) {
2439 /*----------------------------------------------------------------------*/
2440 /* CHTML 1.0 version 2.0 */
2441 /*----------------------------------------------------------------------*/
2442 size = apr_pstrdup(doc->buf.pool, val);
2444 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2445 /*----------------------------------------------------------------------*/
2446 /* CHTML 1.0 version 2.0 */
2447 /*----------------------------------------------------------------------*/
2448 attr_style = apr_pstrdup(doc->buf.pool, val);
2450 else if (STRCASEEQ('n','N',"name", nm)) {
2451 /*----------------------------------------------------------------------*/
2452 /* CHTML 1.0 version 2.0 */
2453 /*----------------------------------------------------------------------*/
2454 name = apr_pstrdup(doc->buf.pool, val);
2456 else if (STRCASEEQ('m','M',"multiple", nm)) {
2457 /*----------------------------------------------------------------------*/
2458 /* CHTML 1.0 version 2.0 */
2459 /*----------------------------------------------------------------------*/
2460 multiple = apr_pstrdup(doc->buf.pool, val);
2463 if (size && *size) {
2468 if (name && *name) {
2477 if (IS_CSS_ON(chtml30->entryp)) {
2478 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2480 return chtml30->out;
2485 * It is a handler who processes the SELECT tag.
2487 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2488 * destination is specified.
2489 * @param node [i] The SELECT tag node is specified.
2490 * @return The conversion result is returned.
2493 s_chtml30_end_select_tag(void *pdoc, Node *UNUSED(child))
2495 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2496 Doc *doc = chtml30->doc;
2499 if (IS_CSS_ON(chtml30->entryp)) {
2500 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2503 return chtml30->out;
2508 * It is a handler who processes the OPTION tag.
2510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2511 * destination is specified.
2512 * @param node [i] The OPTION tag node is specified.
2513 * @return The conversion result is returned.
2516 s_chtml30_start_option_tag(void *pdoc, Node *node)
2524 char *attr_style = NULL;
2526 chtml30 = GET_CHTML30(pdoc);
2533 for (attr = qs_get_attr(doc,node);
2535 attr = qs_get_next_attr(doc,attr)) {
2536 char *nm = qs_get_attr_name(doc,attr);
2537 char *val = qs_get_attr_value(doc,attr);
2538 if (STRCASEEQ('s','S',"selected", nm)) {
2539 /*----------------------------------------------------------------------*/
2540 /* CHTML 1.0 version 2.0 */
2541 /*----------------------------------------------------------------------*/
2542 selected = apr_pstrdup(doc->buf.pool, val);
2544 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2545 /*----------------------------------------------------------------------*/
2546 /* CHTML 1.0 version 2.0 */
2547 /*----------------------------------------------------------------------*/
2548 attr_style = apr_pstrdup(doc->buf.pool, val);
2550 else if (STRCASEEQ('v','V',"value", nm)) {
2551 /*----------------------------------------------------------------------*/
2552 /* CHTML 1.0 version 2.0 */
2553 /*----------------------------------------------------------------------*/
2554 value = apr_pstrdup(doc->buf.pool, val);
2566 if (IS_CSS_ON(chtml30->entryp)) {
2567 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2569 return chtml30->out;
2574 * It is a handler who processes the OPTION tag.
2576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2577 * destination is specified.
2578 * @param node [i] The OPTION tag node is specified.
2579 * @return The conversion result is returned.
2582 s_chtml30_end_option_tag(void *pdoc, Node *UNUSED(child))
2584 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2587 if (IS_CSS_ON(chtml30->entryp)) {
2588 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2591 return chtml30->out;
2596 * It is a handler who processes the DIV tag.
2598 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2599 * destination is specified.
2600 * @param node [i] The DIV tag node is specified.
2601 * @return The conversion result is returned.
2604 s_chtml30_start_div_tag(void *pdoc, Node *node)
2610 char *attr_style = NULL;
2611 char *attr_align = NULL;
2612 char *attr_display = NULL;
2613 char *attr_decoration = NULL;
2614 char *attr_wap_marquee_style = NULL;
2615 char *attr_wap_marquee_dir = NULL;
2616 char *attr_wap_marquee_loop = NULL;
2617 char *attr_color = NULL;
2618 char *attr_bgcolor = NULL;
2620 chtml30 = GET_CHTML30(pdoc);
2624 for (attr = qs_get_attr(doc,node);
2626 attr = qs_get_next_attr(doc,attr)) {
2627 char *nm = qs_get_attr_name(doc,attr);
2628 char *val = qs_get_attr_value(doc,attr);
2629 if (STRCASEEQ('a','A', "align", nm)) {
2630 /*----------------------------------------------------------------------*/
2631 /* CHTML 1.0 (W3C version 3.2) */
2632 /*----------------------------------------------------------------------*/
2633 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2634 attr_align = apr_pstrdup(doc->buf.pool, val);
2637 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2638 attr_style = apr_pstrdup(doc->buf.pool, val);
2642 if (IS_CSS_ON(chtml30->entryp)) {
2643 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
2645 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2646 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2647 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2648 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2649 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2650 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2652 css_property_t *cur;
2653 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2654 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2655 attr_display = apr_pstrdup(doc->pool, cur->value);
2658 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2659 if (STRCASEEQ('b','B',"blink", cur->value)) {
2660 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2663 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2664 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2665 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2667 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2668 char *ss = strchr(cur->value, '#');
2670 ss = strstr(cur->value, "rgb");
2673 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2674 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2677 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2678 attr_color = apr_pstrdup(doc->pool, cur->value);
2679 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2681 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2682 attr_align = apr_pstrdup(doc->pool, cur->value);
2685 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2686 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2687 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2688 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2689 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2690 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2693 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2694 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2695 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2697 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2698 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2701 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2702 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2703 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2706 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2712 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
2713 memset(flg, 0, sizeof(*flg));
2720 flg->with_div_flag = 1;
2724 flg->with_div_flag = 1;
2727 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2731 W_L("<font color=\"");
2734 flg->with_font_flag = 1;
2737 if (attr_decoration) {
2739 flg->with_blink_flag = 1;
2743 if (attr_wap_marquee_style) {
2744 W_L(" behavior=\"");
2745 W_V(attr_wap_marquee_style);
2748 if (attr_wap_marquee_dir) {
2749 W_L(" direction=\"");
2750 W_V(attr_wap_marquee_dir);
2753 if (attr_wap_marquee_loop) {
2755 W_V(attr_wap_marquee_loop);
2759 flg->with_marquee_flag = 1;
2761 node->userData = flg;
2763 return chtml30->out;
2768 * It is a handler who processes the DIV tag.
2770 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2771 * destination is specified.
2772 * @param node [i] The DIV tag node is specified.
2773 * @return The conversion result is returned.
2776 s_chtml30_end_div_tag(void *pdoc, Node *node)
2778 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2779 Doc *doc = chtml30->doc;
2781 chtml30_flags_t *flg = node->userData;
2782 if (flg && flg->with_marquee_flag) {
2785 if (flg && flg->with_blink_flag) {
2788 if (flg && flg->with_font_flag) {
2791 if (flg && flg->with_div_flag) {
2794 if (IS_CSS_ON(chtml30->entryp)) {
2795 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2797 node->userData = NULL;
2799 return chtml30->out;
2804 * It is a handler who processes the UL tag.
2806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2807 * destination is specified.
2808 * @param node [i] The UL tag node is specified.
2809 * @return The conversion result is returned.
2812 s_chtml30_start_ul_tag(void *pdoc, Node *node)
2814 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2815 Doc *doc = chtml30->doc;
2817 char *attr_style = NULL;
2819 for (attr = qs_get_attr(doc,node);
2821 attr = qs_get_next_attr(doc,attr)) {
2822 char *nm = qs_get_attr_name(doc,attr);
2823 char *val = qs_get_attr_value(doc,attr);
2824 if (val && STRCASEEQ('s','S',"style", nm)) {
2829 if (IS_CSS_ON(chtml30->entryp)) {
2830 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2835 return chtml30->out;
2840 * It is a handler who processes the UL tag.
2842 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2843 * destination is specified.
2844 * @param node [i] The UL tag node is specified.
2845 * @return The conversion result is returned.
2848 s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
2850 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2851 Doc *doc = chtml30->doc;
2853 if (IS_CSS_ON(chtml30->entryp)) {
2854 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2858 return chtml30->out;
2863 * It is a handler who processes the PRE tag.
2865 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2866 * destination is specified.
2867 * @param node [i] The PRE tag node is specified.
2868 * @return The conversion result is returned.
2871 s_chtml30_start_pre_tag(void *pdoc, Node *node)
2873 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2874 Doc *doc = chtml30->doc;
2876 char *attr_style = NULL;
2878 for (attr = qs_get_attr(doc,node);
2880 attr = qs_get_next_attr(doc,attr)) {
2881 char *nm = qs_get_attr_name(doc,attr);
2882 char *val = qs_get_attr_value(doc,attr);
2883 if (val && STRCASEEQ('s','S',"style", nm)) {
2888 if (IS_CSS_ON(chtml30->entryp)) {
2889 s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2892 chtml30->pre_flag++;
2895 return chtml30->out;
2900 * It is a handler who processes the PRE tag.
2902 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2903 * destination is specified.
2904 * @param node [i] The PRE tag node is specified.
2905 * @return The conversion result is returned.
2908 s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
2910 chtml30_t *chtml30 = GET_CHTML30(pdoc);
2911 Doc *doc = chtml30->doc;
2914 chtml30->pre_flag--;
2915 if (IS_CSS_ON(chtml30->entryp)) {
2916 chxj_css_pop_prop_list(chtml30->css_prop_stack);
2919 return chtml30->out;
2924 * It is a handler who processes the P tag.
2926 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2927 * destination is specified.
2928 * @param node [i] The P tag node is specified.
2929 * @return The conversion result is returned.
2932 s_chtml30_start_p_tag(void *pdoc, Node *node)
2938 char *attr_align = NULL;
2939 char *attr_style = NULL;
2940 char *attr_color = NULL;
2941 char *attr_blink = NULL;
2943 chtml30 = GET_CHTML30(pdoc);
2947 for (attr = qs_get_attr(doc,node);
2949 attr = qs_get_next_attr(doc,attr)) {
2950 char *nm = qs_get_attr_name(doc,attr);
2951 char *val = qs_get_attr_value(doc,attr);
2952 if (STRCASEEQ('a','A',"align", nm)) {
2953 /*----------------------------------------------------------------------*/
2954 /* CHTML 1.0 (W3C version 3.2) */
2955 /*----------------------------------------------------------------------*/
2956 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2957 attr_align = apr_pstrdup(doc->buf.pool, val);
2961 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2962 attr_style = apr_pstrdup(doc->buf.pool, val);
2965 if (IS_CSS_ON(chtml30->entryp)) {
2966 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
2968 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2969 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2970 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2971 css_property_t *cur;
2972 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2973 if (STRCASEEQ('l','L',"left",cur->value)) {
2974 attr_align = apr_pstrdup(doc->pool, "left");
2976 else if (STRCASEEQ('c','C',"center",cur->value)) {
2977 attr_align = apr_pstrdup(doc->pool, "center");
2979 else if (STRCASEEQ('r','R',"right",cur->value)) {
2980 attr_align = apr_pstrdup(doc->pool, "right");
2983 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2984 if (cur->value && *cur->value) {
2985 attr_color = apr_pstrdup(doc->pool, cur->value);
2988 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2989 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2990 attr_blink = apr_pstrdup(doc->pool, cur->value);
3003 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
3004 memset(flg, 0, sizeof(*flg));
3006 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3007 W_L("<font color=\"");
3010 flg->with_font_flag = 1;
3014 flg->with_blink_flag = 1;
3016 node->userData = (void *)flg;
3018 return chtml30->out;
3023 * It is a handler who processes the P tag.
3025 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3026 * destination is specified.
3027 * @param node [i] The P tag node is specified.
3028 * @return The conversion result is returned.
3031 s_chtml30_end_p_tag(void *pdoc, Node *node)
3036 chtml30 = GET_CHTML30(pdoc);
3039 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
3040 if (flg->with_font_flag) {
3043 if (flg->with_blink_flag) {
3047 if (IS_CSS_ON(chtml30->entryp)) {
3048 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3051 return chtml30->out;
3056 * It is a handler who processes the OL tag.
3058 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3059 * destination is specified.
3060 * @param node [i] The OL tag node is specified.
3061 * @return The conversion result is returned.
3064 s_chtml30_start_ol_tag(void *pdoc, Node *node)
3070 char *attr_style = NULL;
3071 char *attr_start = NULL;
3072 char *attr_type = NULL;
3074 chtml30 = GET_CHTML30(pdoc);
3078 /*--------------------------------------------------------------------------*/
3079 /* Get Attributes */
3080 /*--------------------------------------------------------------------------*/
3081 for (attr = qs_get_attr(doc,node);
3083 attr = qs_get_next_attr(doc,attr)) {
3084 char *name = qs_get_attr_name(doc,attr);
3085 char *value = qs_get_attr_value(doc,attr);
3086 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3089 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3092 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3096 if (IS_CSS_ON(chtml30->entryp)) {
3097 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3099 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3100 css_property_t *cur;
3101 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3102 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3103 attr_type = apr_pstrdup(doc->pool, "1");
3105 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3106 attr_type = apr_pstrdup(doc->pool, "A");
3108 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3109 attr_type = apr_pstrdup(doc->pool, "a");
3127 return chtml30->out;
3132 * It is a handler who processes the OL tag.
3134 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3135 * destination is specified.
3136 * @param node [i] The OL tag node is specified.
3137 * @return The conversion result is returned.
3140 s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
3142 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3143 Doc *doc = chtml30->doc;
3146 if (IS_CSS_ON(chtml30->entryp)) {
3147 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3150 return chtml30->out;
3155 * It is a handler who processes the LI tag.
3157 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3158 * destination is specified.
3159 * @param node [i] The LI tag node is specified.
3160 * @return The conversion result is returned.
3163 s_chtml30_start_li_tag(void *pdoc, Node *node)
3165 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3166 Doc *doc = chtml30->doc;
3168 char *attr_type = NULL;
3169 char *attr_value = NULL;
3170 char *attr_style = NULL;
3171 /*--------------------------------------------------------------------------*/
3172 /* Get Attributes */
3173 /*--------------------------------------------------------------------------*/
3174 for (attr = qs_get_attr(doc,node);
3176 attr = qs_get_next_attr(doc,attr)) {
3177 char *name = qs_get_attr_name(doc,attr);
3178 char *value = qs_get_attr_value(doc,attr);
3179 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3182 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3185 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3189 if (IS_CSS_ON(chtml30->entryp)) {
3190 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3192 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3193 css_property_t *cur;
3194 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3195 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3196 attr_type = apr_pstrdup(doc->pool, "1");
3198 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3199 attr_type = apr_pstrdup(doc->pool, "A");
3201 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3202 attr_type = apr_pstrdup(doc->pool, "a");
3232 return chtml30->out;
3237 * It is a handler who processes the LI tag.
3239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3240 * destination is specified.
3241 * @param node [i] The LI tag node is specified.
3242 * @return The conversion result is returned.
3245 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
3247 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3249 if (IS_CSS_ON(chtml30->entryp)) {
3250 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3252 return chtml30->out;
3257 * It is a handler who processes the H1 tag.
3259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3260 * destination is specified.
3261 * @param node [i] The H1 tag node is specified.
3262 * @return The conversion result is returned.
3265 s_chtml30_start_h1_tag(void *pdoc, Node *node)
3271 char *attr_style = NULL;
3272 char *attr_align = NULL;
3275 chtml30 = GET_CHTML30(pdoc);
3279 for (attr = qs_get_attr(doc,node);
3281 attr = qs_get_next_attr(doc,attr)) {
3282 char *name = qs_get_attr_name(doc,attr);
3283 char *value = qs_get_attr_value(doc,attr);
3284 if (STRCASEEQ('a','A',"align", name)) {
3285 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3289 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3293 if (IS_CSS_ON(chtml30->entryp)) {
3294 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3296 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3297 css_property_t *cur;
3298 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3299 if (STRCASEEQ('l','L',"left", cur->value)) {
3300 attr_align = apr_pstrdup(doc->pool, "left");
3302 else if (STRCASEEQ('c','C',"center",cur->value)) {
3303 attr_align = apr_pstrdup(doc->pool, "center");
3305 else if (STRCASEEQ('r','R',"right",cur->value)) {
3306 attr_align = apr_pstrdup(doc->pool, "right");
3319 return chtml30->out;
3324 * It is a handler who processes the H1 tag.
3326 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3327 * destination is specified.
3328 * @param node [i] The H1 tag node is specified.
3329 * @return The conversion result is returned.
3332 s_chtml30_end_h1_tag(void *pdoc, Node *UNUSED(child))
3337 chtml30 = GET_CHTML30(pdoc);
3341 if (IS_CSS_ON(chtml30->entryp)) {
3342 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3345 return chtml30->out;
3350 * It is a handler who processes the H2 tag.
3352 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3353 * destination is specified.
3354 * @param node [i] The H2 tag node is specified.
3355 * @return The conversion result is returned.
3358 s_chtml30_start_h2_tag(void *pdoc, Node *node)
3364 char *attr_style = NULL;
3365 char *attr_align = NULL;
3367 chtml30 = GET_CHTML30(pdoc);
3371 for (attr = qs_get_attr(doc,node);
3373 attr = qs_get_next_attr(doc,attr)) {
3374 char *name = qs_get_attr_name(doc,attr);
3375 char *value = qs_get_attr_value(doc,attr);
3376 if (STRCASEEQ('a','A',"align", name)) {
3377 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3381 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3385 if (IS_CSS_ON(chtml30->entryp)) {
3386 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3388 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3389 css_property_t *cur;
3390 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3391 if (STRCASEEQ('l','L',"left", cur->value)) {
3392 attr_align = apr_pstrdup(doc->pool, "left");
3394 else if (STRCASEEQ('c','C',"center",cur->value)) {
3395 attr_align = apr_pstrdup(doc->pool, "center");
3397 else if (STRCASEEQ('r','R',"right",cur->value)) {
3398 attr_align = apr_pstrdup(doc->pool, "right");
3411 return chtml30->out;
3416 * It is a handler who processes the H2 tag.
3418 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3419 * destination is specified.
3420 * @param node [i] The H2 tag node is specified.
3421 * @return The conversion result is returned.
3424 s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child))
3426 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3427 Doc *doc = chtml30->doc;
3430 if (IS_CSS_ON(chtml30->entryp)) {
3431 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3434 return chtml30->out;
3439 * It is a handler who processes the H3 tag.
3441 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3442 * destination is specified.
3443 * @param node [i] The H3 tag node is specified.
3444 * @return The conversion result is returned.
3447 s_chtml30_start_h3_tag(void *pdoc, Node *node)
3453 char *attr_style = NULL;
3454 char *attr_align = NULL;
3456 chtml30 = GET_CHTML30(pdoc);
3460 for (attr = qs_get_attr(doc,node);
3462 attr = qs_get_next_attr(doc,attr)) {
3463 char *name = qs_get_attr_name(doc,attr);
3464 char *value = qs_get_attr_value(doc,attr);
3465 if (STRCASEEQ('a','A',"align", name)) {
3466 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3470 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3474 if (IS_CSS_ON(chtml30->entryp)) {
3475 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3477 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3478 css_property_t *cur;
3479 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3480 if (STRCASEEQ('l','L',"left", cur->value)) {
3481 attr_align = apr_pstrdup(doc->pool, "left");
3483 else if (STRCASEEQ('c','C',"center",cur->value)) {
3484 attr_align = apr_pstrdup(doc->pool, "center");
3486 else if (STRCASEEQ('r','R',"right",cur->value)) {
3487 attr_align = apr_pstrdup(doc->pool, "right");
3500 return chtml30->out;
3505 * It is a handler who processes the H3 tag.
3507 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3508 * destination is specified.
3509 * @param node [i] The H3 tag node is specified.
3510 * @return The conversion result is returned.
3513 s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
3515 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3516 Doc *doc = chtml30->doc;
3519 if (IS_CSS_ON(chtml30->entryp)) {
3520 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3523 return chtml30->out;
3528 * It is a handler who processes the H4 tag.
3530 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3531 * destination is specified.
3532 * @param node [i] The H4 tag node is specified.
3533 * @return The conversion result is returned.
3536 s_chtml30_start_h4_tag(void *pdoc, Node *node)
3542 char *attr_style = NULL;
3543 char *attr_align = NULL;
3545 chtml30 = GET_CHTML30(pdoc);
3549 for (attr = qs_get_attr(doc,node);
3551 attr = qs_get_next_attr(doc,attr)) {
3552 char *name = qs_get_attr_name(doc,attr);
3553 char *value = qs_get_attr_value(doc,attr);
3554 if (STRCASEEQ('a','A',"align", name)) {
3555 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3559 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3563 if (IS_CSS_ON(chtml30->entryp)) {
3564 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3566 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3567 css_property_t *cur;
3568 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3569 if (STRCASEEQ('l','L',"left", cur->value)) {
3570 attr_align = apr_pstrdup(doc->pool, "left");
3572 else if (STRCASEEQ('c','C',"center",cur->value)) {
3573 attr_align = apr_pstrdup(doc->pool, "center");
3575 else if (STRCASEEQ('r','R',"right",cur->value)) {
3576 attr_align = apr_pstrdup(doc->pool, "right");
3589 return chtml30->out;
3594 * It is a handler who processes the H4 tag.
3596 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3597 * destination is specified.
3598 * @param node [i] The H4 tag node is specified.
3599 * @return The conversion result is returned.
3602 s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child))
3604 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3605 Doc *doc = chtml30->doc;
3608 if (IS_CSS_ON(chtml30->entryp)) {
3609 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3612 return chtml30->out;
3617 * It is a handler who processes the H5 tag.
3619 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3620 * destination is specified.
3621 * @param node [i] The H5 tag node is specified.
3622 * @return The conversion result is returned.
3625 s_chtml30_start_h5_tag(void *pdoc, Node *node)
3631 char *attr_style = NULL;
3632 char *attr_align = NULL;
3634 chtml30 = GET_CHTML30(pdoc);
3638 for (attr = qs_get_attr(doc,node);
3640 attr = qs_get_next_attr(doc,attr)) {
3641 char *name = qs_get_attr_name(doc,attr);
3642 char *value = qs_get_attr_value(doc,attr);
3643 if (STRCASEEQ('a','A',"align", name)) {
3644 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3648 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3652 if (IS_CSS_ON(chtml30->entryp)) {
3653 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3655 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3656 css_property_t *cur;
3657 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3658 if (STRCASEEQ('l','L',"left", cur->value)) {
3659 attr_align = apr_pstrdup(doc->pool, "left");
3661 else if (STRCASEEQ('c','C',"center",cur->value)) {
3662 attr_align = apr_pstrdup(doc->pool, "center");
3664 else if (STRCASEEQ('r','R',"right",cur->value)) {
3665 attr_align = apr_pstrdup(doc->pool, "right");
3684 return chtml30->out;
3689 * It is a handler who processes the H5 tag.
3691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3692 * destination is specified.
3693 * @param node [i] The H5 tag node is specified.
3694 * @return The conversion result is returned.
3697 s_chtml30_end_h5_tag(void *pdoc, Node *UNUSED(child))
3699 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3700 Doc *doc = chtml30->doc;
3703 if (IS_CSS_ON(chtml30->entryp)) {
3704 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3707 return chtml30->out;
3712 * It is a handler who processes the H6 tag.
3714 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3715 * destination is specified.
3716 * @param node [i] The H6 tag node is specified.
3717 * @return The conversion result is returned.
3720 s_chtml30_start_h6_tag(void *pdoc, Node *node)
3726 char *attr_style = NULL;
3727 char *attr_align = NULL;
3729 chtml30 = GET_CHTML30(pdoc);
3733 for (attr = qs_get_attr(doc,node);
3735 attr = qs_get_next_attr(doc,attr)) {
3736 char *name = qs_get_attr_name(doc,attr);
3737 char *value = qs_get_attr_value(doc,attr);
3738 if (STRCASEEQ('a','A',"align", name)) {
3739 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3743 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3747 if (IS_CSS_ON(chtml30->entryp)) {
3748 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
3750 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3751 css_property_t *cur;
3752 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3753 if (STRCASEEQ('l','L',"left", cur->value)) {
3754 attr_align = apr_pstrdup(doc->pool, "left");
3756 else if (STRCASEEQ('c','C',"center",cur->value)) {
3757 attr_align = apr_pstrdup(doc->pool, "center");
3759 else if (STRCASEEQ('r','R',"right",cur->value)) {
3760 attr_align = apr_pstrdup(doc->pool, "right");
3773 return chtml30->out;
3778 * It is a handler who processes the H6 tag.
3780 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3781 * destination is specified.
3782 * @param node [i] The H6 tag node is specified.
3783 * @return The conversion result is returned.
3786 s_chtml30_end_h6_tag(void *pdoc, Node *UNUSED(child))
3788 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3789 Doc *doc = chtml30->doc;
3792 if (IS_CSS_ON(chtml30->entryp)) {
3793 chxj_css_pop_prop_list(chtml30->css_prop_stack);
3796 return chtml30->out;
3801 * It is a handler who processes the TEXTARE tag.
3803 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3804 * destination is specified.
3805 * @param node [i] The TEXTAREA tag node is specified.
3806 * @return The conversion result is returned.
3809 s_chtml30_start_textarea_tag(void *pdoc, Node *node)
3815 char *attr_accesskey = NULL;
3816 char *attr_name = NULL;
3817 char *attr_rows = NULL;
3818 char *attr_cols = NULL;
3819 char *attr_istyle = NULL;
3820 char *attr_style = NULL;
3822 chtml30 = GET_CHTML30(pdoc);
3826 chtml30->textarea_flag++;
3828 for (attr = qs_get_attr(doc,node);
3830 attr = qs_get_next_attr(doc,attr)) {
3831 char *name = qs_get_attr_name(doc,attr);
3832 char *value = qs_get_attr_value(doc,attr);
3833 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3834 attr_accesskey = value;
3836 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3837 attr_istyle = value;
3839 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3842 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3845 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3848 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3854 if (attr_accesskey) {
3855 W_L(" accesskey=\"");
3856 W_V(attr_accesskey);
3880 if (IS_CSS_ON(chtml30->entryp)) {
3881 css_prop_list_t *style = s_chtml30_nopush_and_get_now_style(pdoc, node, attr_style);
3883 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3884 css_property_t *cur;
3885 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3886 if (strcasestr(cur->value, "<ja:n>")) {
3889 else if (strcasestr(cur->value, "<ja:en>")) {
3892 else if (strcasestr(cur->value, "<ja:hk>")) {
3895 else if (strcasestr(cur->value, "<ja:h>")) {
3903 if (attr_accesskey) {
3904 W_L(" accesskey=\"");
3905 W_V(attr_accesskey);
3929 return chtml30->out;
3934 * It is a handler who processes the TEXTAREA tag.
3936 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3937 * destination is specified.
3938 * @param node [i] The TEXTAREA tag node is specified.
3939 * @return The conversion result is returned.
3942 s_chtml30_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3944 chtml30_t *chtml30 = GET_CHTML30(pdoc);
3945 Doc *doc = chtml30->doc;
3948 chtml30->textarea_flag--;
3950 return chtml30->out;
3955 s_chtml30_chxjif_tag(void *pdoc, Node *node)
3962 chtml30 = GET_CHTML30(pdoc);
3966 for (child = qs_get_child_node(doc, node);
3968 child = qs_get_next_node(doc, child)) {
3970 s_chtml30_chxjif_tag(chtml30, child);
3978 s_chtml30_text_tag(void *pdoc, Node *child)
3991 chtml30 = GET_CHTML30(pdoc);
3995 textval = qs_get_node_value(doc,child);
3996 if (strlen(textval) == 0) {
3997 return chtml30->out;
4000 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4001 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4003 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4004 memset(one_byte, 0, sizeof(one_byte));
4007 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4009 int rtn = s_chtml30_search_emoji(chtml30, &textval[ii], &out);
4011 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4016 if (is_sjis_kanji(textval[ii])) {
4017 one_byte[0] = textval[ii+0];
4018 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4019 one_byte[0] = textval[ii+1];
4020 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4023 else if (chtml30->pre_flag) {
4024 one_byte[0] = textval[ii+0];
4025 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4027 else if (chtml30->textarea_flag) {
4028 one_byte[0] = textval[ii+0];
4029 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4031 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4032 one_byte[0] = textval[ii+0];
4033 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4037 return chtml30->out;
4042 * It is a handler who processes the BLOCKQUOTE tag.
4044 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4045 * destination is specified.
4046 * @param node [i] The BLOCKQUOTE tag node is specified.
4047 * @return The conversion result is returned.
4050 s_chtml30_start_blockquote_tag(void *pdoc, Node *node)
4055 char *attr_style = NULL;
4056 char *attr_color = NULL;
4058 chtml30 = GET_CHTML30(pdoc);
4060 for (attr = qs_get_attr(doc,node);
4062 attr = qs_get_next_attr(doc,attr)) {
4063 char *nm = qs_get_attr_name(doc,attr);
4064 char *val = qs_get_attr_value(doc,attr);
4065 if (val && STRCASEEQ('s','S',"style", nm)) {
4069 if (IS_CSS_ON(chtml30->entryp)) {
4070 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4072 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4073 css_property_t *cur;
4074 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4075 if (cur->value && *cur->value) {
4076 attr_color = apr_pstrdup(doc->pool, cur->value);
4081 W_L("<blockquote>");
4082 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4083 memset(flg, 0, sizeof(*flg));
4085 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4086 W_L("<font color=\"");
4089 flg->with_font_flag = 1;
4091 node->userData = (void *)flg;
4092 return chtml30->out;
4097 * It is a handler who processes the BLOCKQUOTE tag.
4099 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4100 * destination is specified.
4101 * @param node [i] The BLOCKQUOTE tag node is specified.
4102 * @return The conversion result is returned.
4105 s_chtml30_end_blockquote_tag(void *pdoc, Node *node)
4107 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4108 Doc *doc = chtml30->doc;
4109 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4110 if (flg && flg->with_font_flag) {
4113 W_L("</blockquote>");
4114 if (IS_CSS_ON(chtml30->entryp)) {
4115 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4117 return chtml30->out;
4122 * It is a handler who processes the DIR tag.
4124 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4125 * destination is specified.
4126 * @param node [i] The DIR tag node is specified.
4127 * @return The conversion result is returned.
4130 s_chtml30_start_dir_tag(void *pdoc, Node *node)
4135 char *attr_style = NULL;
4136 char *attr_color = NULL;
4138 chtml30 = GET_CHTML30(pdoc);
4140 for (attr = qs_get_attr(doc,node);
4142 attr = qs_get_next_attr(doc,attr)) {
4143 char *nm = qs_get_attr_name(doc,attr);
4144 char *val = qs_get_attr_value(doc,attr);
4145 if (val && STRCASEEQ('s','S',"style", nm)) {
4149 if (IS_CSS_ON(chtml30->entryp)) {
4150 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4152 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4153 css_property_t *cur;
4154 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4155 if (cur->value && *cur->value) {
4156 attr_color = apr_pstrdup(doc->pool, cur->value);
4162 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4163 memset(flg, 0, sizeof(*flg));
4165 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4166 W_L("<font color=\"");
4169 flg->with_font_flag = 1;
4171 node->userData = (void *)flg;
4172 return chtml30->out;
4177 * It is a handler who processes the DIR tag.
4179 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4180 * destination is specified.
4181 * @param node [i] The DIR tag node is specified.
4182 * @return The conversion result is returned.
4185 s_chtml30_end_dir_tag(void *pdoc, Node *node)
4187 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dir>");
4192 * It is a handler who processes the DL tag.
4194 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4195 * destination is specified.
4196 * @param node [i] The DL tag node is specified.
4197 * @return The conversion result is returned.
4200 s_chtml30_start_dl_tag(void *pdoc, Node *node)
4202 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dl>");
4207 * It is a handler who processes the DL tag.
4209 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4210 * destination is specified.
4211 * @param node [i] The DL tag node is specified.
4212 * @return The conversion result is returned.
4215 s_chtml30_end_dl_tag(void *pdoc, Node *node)
4217 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</dl>");
4222 * It is a handler who processes the DT tag.
4224 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4225 * destination is specified.
4226 * @param node [i] The DT tag node is specified.
4227 * @return The conversion result is returned.
4230 s_chtml30_start_dt_tag(void *pdoc, Node *node)
4232 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dt>");
4237 * It is a handler who processes the DT tag.
4239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4240 * destination is specified.
4241 * @param node [i] The DT tag node is specified.
4242 * @return The conversion result is returned.
4245 s_chtml30_end_dt_tag(void *pdoc, Node *node)
4247 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4252 * It is a handler who processes the DD tag.
4254 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4255 * destination is specified.
4256 * @param node [i] The DD tag node is specified.
4257 * @return The conversion result is returned.
4260 s_chtml30_start_dd_tag(void *pdoc, Node *node)
4262 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<dd>");
4267 * It is a handler who processes the DD tag.
4269 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4270 * destination is specified.
4271 * @param node [i] The DD tag node is specified.
4272 * @return The conversion result is returned.
4275 s_chtml30_end_dd_tag(void *pdoc, Node *node)
4277 CHTML30_END_OF_NO_CLOSE_TAG_WITH_FONT_TAG();
4282 * It is a handler who processes the MARQUEE tag.
4284 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4285 * destination is specified.
4286 * @param node [i] The MARQUEE tag node is specified.
4287 * @return The conversion result is returned.
4290 s_chtml30_start_marquee_tag(void *pdoc, Node *node)
4292 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4293 Doc *doc = chtml30->doc;
4295 char *attr_direction = NULL;
4296 char *attr_behavior = NULL;
4297 char *attr_loop = NULL;
4298 char *attr_style = NULL;
4299 char *attr_color = NULL;
4300 /*--------------------------------------------------------------------------*/
4301 /* Get Attributes */
4302 /*--------------------------------------------------------------------------*/
4303 for (attr = qs_get_attr(doc,node);
4305 attr = qs_get_next_attr(doc,attr)) {
4306 char *name = qs_get_attr_name(doc,attr);
4307 char *value = qs_get_attr_value(doc,attr);
4308 if (STRCASEEQ('d','D',"direction", name)) {
4309 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4310 attr_direction = value;
4313 else if (STRCASEEQ('b','B',"behavior",name)) {
4314 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4315 attr_behavior = value;
4318 else if (STRCASEEQ('l','L',"loop",name)) {
4319 if (value && *value) {
4323 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4327 if (IS_CSS_ON(chtml30->entryp)) {
4328 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4330 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4331 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4332 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4333 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4334 css_property_t *cur;
4335 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4336 if (cur->value && *cur->value) {
4337 attr_color = apr_pstrdup(doc->pool, cur->value);
4340 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4341 if (cur->value && *cur->value) {
4342 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4345 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4346 if (cur->value && *cur->value) {
4347 attr_loop = apr_pstrdup(doc->pool, cur->value);
4348 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4353 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4354 if (cur->value && *cur->value) {
4355 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4356 attr_direction = "right";
4358 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4359 attr_direction = "left";
4366 if (attr_direction) {
4367 W_L(" direction=\"");
4368 W_V(attr_direction);
4371 if (attr_behavior) {
4372 W_L(" behavior=\"");
4382 if (attr_direction) {
4383 W_L(" direction=\"");
4384 W_V(attr_direction);
4387 if (attr_behavior) {
4388 W_L(" behavior=\"");
4399 chtml30_flags_t *flg = (chtml30_flags_t *)apr_palloc(doc->pool, sizeof(chtml30_flags_t));
4400 memset(flg, 0, sizeof(*flg));
4402 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4403 W_L("<font color=\"");
4406 flg->with_font_flag = 1;
4408 node->userData = (void *)flg;
4409 return chtml30->out;
4414 * It is a handler who processes the MARQUEE tag.
4416 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4417 * destination is specified.
4418 * @param node [i] The MARQUEE tag node is specified.
4419 * @return The conversion result is returned.
4422 s_chtml30_end_marquee_tag(void *pdoc, Node *node)
4424 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4425 Doc *doc = chtml30->doc;
4426 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4427 if (flg && flg->with_font_flag) {
4431 if (IS_CSS_ON(chtml30->entryp)) {
4432 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4434 return chtml30->out;
4439 * It is a handler who processes the BLINK tag.
4441 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4442 * destination is specified.
4443 * @param node [i] The BLINK tag node is specified.
4444 * @return The conversion result is returned.
4447 s_chtml30_start_blink_tag(void *pdoc, Node *node)
4449 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<blink>");
4454 * It is a handler who processes the BLINK tag.
4456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4457 * destination is specified.
4458 * @param node [i] The BLINK tag node is specified.
4459 * @return The conversion result is returned.
4462 s_chtml30_end_blink_tag(void *pdoc, Node *node)
4464 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</blink>");
4469 * It is a handler who processes the MENU tag.
4471 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4472 * destination is specified.
4473 * @param node [i] The MENU tag node is specified.
4474 * @return The conversion result is returned.
4477 s_chtml30_start_menu_tag(void *pdoc, Node *node)
4479 CHTML30_START_OF_TAG_WITH_CSS_FONT_COLOR("<menu>");
4484 * It is a handler who processes the MENU tag.
4486 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4487 * destination is specified.
4488 * @param node [i] The MENU tag node is specified.
4489 * @return The conversion result is returned.
4492 s_chtml30_end_menu_tag(void *pdoc, Node *node)
4494 CHTML30_END_OF_CLOSE_TAG_WITH_FONT_TAG("</menu>");
4499 * It is a handler who processes the PLAINTEXT tag.
4501 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4502 * destination is specified.
4503 * @param node [i] The PLAINTEXT tag node is specified.
4504 * @return The conversion result is returned.
4507 s_chtml30_start_plaintext_tag(void *pdoc, Node *node)
4509 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4510 Doc *doc = chtml30->doc;
4512 s_chtml30_start_plaintext_tag_inner(pdoc,node);
4513 return chtml30->out;
4517 s_chtml30_start_plaintext_tag_inner(void *pdoc, Node *node)
4519 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4520 Doc *doc = chtml30->doc;
4522 for (child = qs_get_child_node(doc, node);
4524 child = qs_get_next_node(doc, child)) {
4526 s_chtml30_start_plaintext_tag_inner(pdoc, child);
4528 return chtml30->out;
4533 * It is a handler who processes the PLAINTEXT tag.
4535 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4536 * destination is specified.
4537 * @param node [i] The PLAINTEXT tag node is specified.
4538 * @return The conversion result is returned.
4541 s_chtml30_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4543 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4544 return chtml30->out;
4549 * * It is handler who processes the New Line Code.
4552 s_chtml30_newline_mark(void *pdoc, Node *UNUSED(node))
4554 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4555 Doc *doc = chtml30->doc;
4557 return chtml30->out;
4562 * It is a handler who processes the LINK tag.
4564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4565 * destination is specified.
4566 * @param node [i] The LINK tag node is specified.
4567 * @return The conversion result is returned.
4570 s_chtml30_link_tag(void *pdoc, Node *node)
4579 chtml30 = GET_CHTML30(pdoc);
4582 if (! IS_CSS_ON(chtml30->entryp)) {
4583 return chtml30->out;
4586 for (attr = qs_get_attr(doc,node);
4588 attr = qs_get_next_attr(doc,attr)) {
4589 char *name = qs_get_attr_name(doc,attr);
4590 char *value = qs_get_attr_value(doc,attr);
4591 if (STRCASEEQ('r','R',"rel", name)) {
4592 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4596 else if (STRCASEEQ('h','H',"href", name)) {
4597 if (value && *value) {
4601 else if (STRCASEEQ('t','T',"type", name)) {
4602 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4608 if (rel && href && type) {
4609 DBG(doc->r, "start load CSS. url:[%s]", href);
4610 chtml30->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml30->style, href);
4611 DBG(doc->r, "end load CSS. url:[%s]", href);
4614 return chtml30->out;
4618 static css_prop_list_t *
4619 s_chtml30_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4621 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4622 Doc *doc = chtml30->doc;
4623 css_prop_list_t *last_css = NULL;
4624 if (IS_CSS_ON(chtml30->entryp)) {
4625 css_prop_list_t *dup_css;
4626 css_selector_t *selector;
4628 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4629 dup_css = chxj_dup_css_prop_list(doc, last_css);
4630 selector = chxj_css_find_selector(doc, chtml30->style, node);
4632 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4634 chxj_css_push_prop_list(chtml30->css_prop_stack, dup_css);
4635 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4637 if (style_attr_value) {
4638 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));
4640 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4648 static css_prop_list_t *
4649 s_chtml30_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4651 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4652 Doc *doc = chtml30->doc;
4653 css_prop_list_t *last_css = NULL;
4654 if (IS_CSS_ON(chtml30->entryp)) {
4655 css_prop_list_t *dup_css;
4656 css_selector_t *selector;
4658 last_css = chxj_css_get_last_prop_list(chtml30->css_prop_stack);
4659 dup_css = chxj_dup_css_prop_list(doc, last_css);
4660 selector = chxj_css_find_selector(doc, chtml30->style, node);
4662 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4666 if (style_attr_value) {
4667 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));
4669 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4679 * It is a handler who processes the SPAN tag.
4681 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4682 * destination is specified.
4683 * @param node [i] The SPAN tag node is specified.
4684 * @return The conversion result is returned.
4687 s_chtml30_start_span_tag(void *pdoc, Node *node)
4692 char *attr_style = NULL;
4693 char *attr_color = NULL;
4694 char *attr_align = NULL;
4695 char *attr_blink = NULL;
4696 char *attr_marquee = NULL;
4697 char *attr_marquee_dir = NULL;
4698 char *attr_marquee_style = NULL;
4699 char *attr_marquee_loop = NULL;
4701 chtml30 = GET_CHTML30(pdoc);
4704 for (attr = qs_get_attr(doc,node);
4706 attr = qs_get_next_attr(doc,attr)) {
4707 char *nm = qs_get_attr_name(doc,attr);
4708 char *val = qs_get_attr_value(doc,attr);
4709 if (val && STRCASEEQ('s','S',"style", nm)) {
4713 if (IS_CSS_ON(chtml30->entryp)) {
4714 css_prop_list_t *style = s_chtml30_push_and_get_now_style(pdoc, node, attr_style);
4716 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4717 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4718 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4719 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4720 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4721 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4722 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4723 css_property_t *cur;
4724 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4725 attr_color = apr_pstrdup(doc->pool, cur->value);
4727 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4728 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4729 attr_blink = apr_pstrdup(doc->pool, cur->value);
4732 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4733 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4734 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4737 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4738 if (cur->value && *cur->value) {
4739 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4740 attr_marquee_dir = "right";
4742 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4743 attr_marquee_dir = "left";
4747 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4748 if (cur->value && *cur->value) {
4749 if ( STRCASEEQ('s','S',"scroll",cur->value)
4750 || STRCASEEQ('s','S',"slide",cur->value)
4751 || STRCASEEQ('a','A',"alternate",cur->value)) {
4752 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4756 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4757 if (cur->value && *cur->value) {
4758 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4759 attr_marquee_loop = "16";
4762 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4766 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4767 if (STRCASEEQ('l','L',"left", cur->value)) {
4768 attr_align = apr_pstrdup(doc->pool, "left");
4770 else if (STRCASEEQ('c','C',"center",cur->value)) {
4771 attr_align = apr_pstrdup(doc->pool, "center");
4773 else if (STRCASEEQ('r','R',"right",cur->value)) {
4774 attr_align = apr_pstrdup(doc->pool, "right");
4779 if (attr_color || attr_align || attr_blink || attr_marquee) {
4780 chtml30_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4781 memset(flg, 0, sizeof(*flg));
4784 flg->with_blink_flag = 1;
4788 if (attr_marquee_dir) {
4789 W_L(" direction=\"");
4790 W_V(attr_marquee_dir);
4793 if (attr_marquee_style) {
4794 W_L(" behavior=\"");
4795 W_V(attr_marquee_style);
4798 if (attr_marquee_loop) {
4800 W_V(attr_marquee_loop);
4804 flg->with_marquee_flag = 1;
4807 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4808 W_L("<font color=\"");
4811 flg->with_font_flag = 1;
4814 W_L("<div align=\"");
4817 flg->with_div_flag = 1;
4819 node->userData = flg;
4822 node->userData = NULL;
4824 return chtml30->out;
4829 * It is a handler who processes the SPAN tag.
4831 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4832 * destination is specified.
4833 * @param node [i] The SPAN tag node is specified.
4834 * @return The conversion result is returned.
4837 s_chtml30_end_span_tag(void *pdoc, Node *node)
4839 chtml30_t *chtml30 = GET_CHTML30(pdoc);
4840 Doc *doc = chtml30->doc;
4842 chtml30_flags_t *flg = (chtml30_flags_t *)node->userData;
4843 if (flg && flg->with_div_flag) {
4846 if (flg && flg->with_font_flag) {
4849 if (flg && flg->with_marquee_flag) {
4852 if (flg && flg->with_blink_flag) {
4855 if (IS_CSS_ON(chtml30->entryp)) {
4856 chxj_css_pop_prop_list(chtml30->css_prop_stack);
4858 return chtml30->out;
4864 * It is a handler who processes the STYLE tag.
4866 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4867 * destination is specified.
4868 * @param node [i] The STYLE tag node is specified.
4869 * @return The conversion result is returned.
4872 s_chtml30_style_tag(void *pdoc, Node *node)
4879 chtml30 = GET_CHTML30(pdoc);
4882 if (! IS_CSS_ON(chtml30->entryp)) {
4883 return chtml30->out;
4886 for (attr = qs_get_attr(doc,node);
4888 attr = qs_get_next_attr(doc,attr)) {
4889 char *name = qs_get_attr_name(doc,attr);
4890 char *value = qs_get_attr_value(doc,attr);
4891 if (STRCASEEQ('t','T',"type", name)) {
4892 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4898 Node *child = qs_get_child_node(doc, node);
4899 if (type && child) {
4900 char *name = qs_get_node_name(doc, child);
4901 if (STRCASEEQ('t','T',"text", name)) {
4902 char *value = qs_get_node_value(doc, child);
4903 DBG(doc->r, "start load CSS. buf:[%s]", value);
4904 chtml30->style = chxj_css_parse_style_value(doc, chtml30->style, value);
4905 DBG(doc->r, "end load CSS. value:[%s]", value);
4908 return chtml30->out;