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_chtml40.h"
19 #include "chxj_hdml.h"
20 #include "chxj_str_util.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_conv_z2h.h"
28 #define GET_CHTML40(X) ((chtml40_t *)(X))
31 #define W_L(X) do { chtml40->out = BUFFERED_WRITE_LITERAL(chtml40->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { chtml40->out = (X) ? BUFFERED_WRITE_VALUE(chtml40->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(chtml40->out, &doc->buf, ""); } while(0)
35 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml40->conf); W_V(nlcode); } while (0)
37 #define CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE() \
38 if (IS_CSS_ON(chtml40->entryp)) { \
39 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style); \
41 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color"); \
42 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type"); \
43 css_property_t *cur; \
44 for (cur = color_prop->next; cur != color_prop; cur = cur->next) { \
45 if (cur->value && *cur->value) { \
46 attr_color = apr_pstrdup(doc->pool, cur->value); \
49 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) { \
50 if (cur->value && *cur->value) { \
51 attr_type = apr_pstrdup(doc->pool, cur->value); \
57 static char *s_chtml40_start_html_tag (void *pdoc, Node *node);
58 static char *s_chtml40_end_html_tag (void *pdoc, Node *node);
59 static char *s_chtml40_start_meta_tag (void *pdoc, Node *node);
60 static char *s_chtml40_end_meta_tag (void *pdoc, Node *node);
61 static char *s_chtml40_start_textarea_tag (void *pdoc, Node *node);
62 static char *s_chtml40_end_textarea_tag (void *pdoc, Node *node);
63 static char *s_chtml40_start_p_tag (void *pdoc, Node *node);
64 static char *s_chtml40_end_p_tag (void *pdoc, Node *node);
65 static char *s_chtml40_start_pre_tag (void *pdoc, Node *node);
66 static char *s_chtml40_end_pre_tag (void *pdoc, Node *node);
67 static char *s_chtml40_start_h1_tag (void *pdoc, Node *node);
68 static char *s_chtml40_end_h1_tag (void *pdoc, Node *node);
69 static char *s_chtml40_start_h2_tag (void *pdoc, Node *node);
70 static char *s_chtml40_end_h2_tag (void *pdoc, Node *node);
71 static char *s_chtml40_start_h3_tag (void *pdoc, Node *node);
72 static char *s_chtml40_end_h3_tag (void *pdoc, Node *node);
73 static char *s_chtml40_start_h4_tag (void *pdoc, Node *node);
74 static char *s_chtml40_end_h4_tag (void *pdoc, Node *node);
75 static char *s_chtml40_start_h5_tag (void *pdoc, Node *node);
76 static char *s_chtml40_end_h5_tag (void *pdoc, Node *node);
77 static char *s_chtml40_start_h6_tag (void *pdoc, Node *node);
78 static char *s_chtml40_end_h6_tag (void *pdoc, Node *node);
79 static char *s_chtml40_start_ul_tag (void *pdoc, Node *node);
80 static char *s_chtml40_end_ul_tag (void *pdoc, Node *node);
81 static char *s_chtml40_start_ol_tag (void *pdoc, Node *node);
82 static char *s_chtml40_end_ol_tag (void *pdoc, Node *node);
83 static char *s_chtml40_start_li_tag (void *pdoc, Node *node);
84 static char *s_chtml40_end_li_tag (void *pdoc, Node *node);
85 static char *s_chtml40_start_head_tag (void *pdoc, Node *node);
86 static char *s_chtml40_end_head_tag (void *pdoc, Node *node);
87 static char *s_chtml40_start_title_tag (void *pdoc, Node *node);
88 static char *s_chtml40_end_title_tag (void *pdoc, Node *node);
89 static char *s_chtml40_start_base_tag (void *pdoc, Node *node);
90 static char *s_chtml40_end_base_tag (void *pdoc, Node *node);
91 static char *s_chtml40_start_body_tag (void *pdoc, Node *node);
92 static char *s_chtml40_end_body_tag (void *pdoc, Node *node);
93 static char *s_chtml40_start_a_tag (void *pdoc, Node *node);
94 static char *s_chtml40_end_a_tag (void *pdoc, Node *node);
95 static char *s_chtml40_start_br_tag (void *pdoc, Node *node);
96 static char *s_chtml40_end_br_tag (void *pdoc, Node *node);
97 static char *s_chtml40_start_tr_tag (void *pdoc, Node *node);
98 static char *s_chtml40_end_tr_tag (void *pdoc, Node *node);
99 static char *s_chtml40_start_font_tag (void *pdoc, Node *node);
100 static char *s_chtml40_end_font_tag (void *pdoc, Node *node);
101 static char *s_chtml40_start_form_tag (void *pdoc, Node *node);
102 static char *s_chtml40_end_form_tag (void *pdoc, Node *node);
103 static char *s_chtml40_start_input_tag (void *pdoc, Node *node);
104 static char *s_chtml40_end_input_tag (void *pdoc, Node *node);
105 static char *s_chtml40_start_center_tag (void *pdoc, Node *node);
106 static char *s_chtml40_end_center_tag (void *pdoc, Node *node);
107 static char *s_chtml40_start_hr_tag (void *pdoc, Node *node);
108 static char *s_chtml40_end_hr_tag (void *pdoc, Node *node);
109 static char *s_chtml40_start_img_tag (void *pdoc, Node *node);
110 static char *s_chtml40_end_img_tag (void *pdoc, Node *node);
111 static char *s_chtml40_start_select_tag (void *pdoc, Node *node);
112 static char *s_chtml40_end_select_tag (void *pdoc, Node *node);
113 static char *s_chtml40_start_option_tag (void *pdoc, Node *node);
114 static char *s_chtml40_end_option_tag (void *pdoc, Node *node);
115 static char *s_chtml40_start_div_tag (void *pdoc, Node *node);
116 static char *s_chtml40_end_div_tag (void *pdoc, Node *node);
117 static char *s_chtml40_chxjif_tag (void *pdoc, Node *node);
118 static char *s_chtml40_text_tag (void *pdoc, Node *node);
119 static char *s_chtml40_start_blockquote_tag (void *pdoc, Node *node);
120 static char *s_chtml40_end_blockquote_tag (void *pdoc, Node *node);
121 static char *s_chtml40_start_dir_tag (void *pdoc, Node *node);
122 static char *s_chtml40_end_dir_tag (void *pdoc, Node *node);
123 static char *s_chtml40_start_dl_tag (void *pdoc, Node *node);
124 static char *s_chtml40_end_dl_tag (void *pdoc, Node *node);
125 static char *s_chtml40_start_dt_tag (void *pdoc, Node *node);
126 static char *s_chtml40_end_dt_tag (void *pdoc, Node *node);
127 static char *s_chtml40_start_dd_tag (void *pdoc, Node *node);
128 static char *s_chtml40_end_dd_tag (void *pdoc, Node *node);
129 static char *s_chtml40_start_marquee_tag (void *pdoc, Node *node);
130 static char *s_chtml40_end_marquee_tag (void *pdoc, Node *node);
131 static char *s_chtml40_start_blink_tag (void *pdoc, Node *node);
132 static char *s_chtml40_end_blink_tag (void *pdoc, Node *node);
133 static char *s_chtml40_start_menu_tag (void *pdoc, Node *node);
134 static char *s_chtml40_end_menu_tag (void *pdoc, Node *node);
135 static char *s_chtml40_start_plaintext_tag (void *pdoc, Node *node);
136 static char *s_chtml40_start_plaintext_tag_inner (void *pdoc, Node *node);
137 static char *s_chtml40_end_plaintext_tag (void *pdoc, Node *node);
138 static char *s_chtml40_newline_mark (void *pdoc, Node *node);
139 static char *s_chtml40_link_tag (void *pdoc, Node *node);
140 static char *s_chtml40_start_span_tag (void *pdoc, Node *node);
141 static char *s_chtml40_end_span_tag (void *pdoc, Node *node);
142 static char *s_chtml40_style_tag (void *pdoc, Node *node);
144 static void s_init_chtml40(chtml40_t *chtml, Doc *doc, request_rec *r, device_table *spec);
146 static int s_chtml40_search_emoji(chtml40_t *chtml, char *txt, char **rslt, Node *node);
147 static css_prop_list_t *s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
148 static css_prop_list_t *s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
151 tag_handler chtml40_handler[] = {
154 s_chtml40_start_html_tag,
155 s_chtml40_end_html_tag,
159 s_chtml40_start_meta_tag,
160 s_chtml40_end_meta_tag,
164 s_chtml40_start_textarea_tag,
165 s_chtml40_end_textarea_tag,
169 s_chtml40_start_p_tag,
174 s_chtml40_start_pre_tag,
175 s_chtml40_end_pre_tag,
179 s_chtml40_start_ul_tag,
180 s_chtml40_end_ul_tag,
184 s_chtml40_start_li_tag,
185 s_chtml40_end_li_tag,
189 s_chtml40_start_ol_tag,
190 s_chtml40_end_ol_tag,
194 s_chtml40_start_h1_tag,
195 s_chtml40_end_h1_tag,
199 s_chtml40_start_h2_tag,
200 s_chtml40_end_h2_tag,
204 s_chtml40_start_h3_tag,
205 s_chtml40_end_h3_tag,
209 s_chtml40_start_h4_tag,
210 s_chtml40_end_h4_tag,
214 s_chtml40_start_h5_tag,
215 s_chtml40_end_h5_tag,
219 s_chtml40_start_h6_tag,
220 s_chtml40_end_h6_tag,
224 s_chtml40_start_head_tag,
225 s_chtml40_end_head_tag,
229 s_chtml40_start_title_tag,
230 s_chtml40_end_title_tag,
234 s_chtml40_start_base_tag,
235 s_chtml40_end_base_tag,
239 s_chtml40_start_body_tag,
240 s_chtml40_end_body_tag,
244 s_chtml40_start_a_tag,
249 s_chtml40_start_br_tag,
250 s_chtml40_end_br_tag,
259 s_chtml40_start_tr_tag,
260 s_chtml40_end_tr_tag,
274 s_chtml40_start_font_tag,
275 s_chtml40_end_font_tag,
279 s_chtml40_start_form_tag,
280 s_chtml40_end_form_tag,
284 s_chtml40_start_input_tag,
285 s_chtml40_end_input_tag,
289 s_chtml40_start_center_tag,
290 s_chtml40_end_center_tag,
294 s_chtml40_start_hr_tag,
295 s_chtml40_end_hr_tag,
299 s_chtml40_start_img_tag,
300 s_chtml40_end_img_tag,
304 s_chtml40_start_select_tag,
305 s_chtml40_end_select_tag,
309 s_chtml40_start_option_tag,
310 s_chtml40_end_option_tag,
314 s_chtml40_start_div_tag,
315 s_chtml40_end_div_tag,
319 s_chtml40_chxjif_tag,
324 s_chtml40_chxjif_tag,
344 s_chtml40_start_span_tag,
345 s_chtml40_end_span_tag,
369 s_chtml40_start_dt_tag,
370 s_chtml40_end_dt_tag,
384 s_chtml40_start_blockquote_tag,
385 s_chtml40_end_blockquote_tag,
389 s_chtml40_start_dir_tag,
390 s_chtml40_end_dir_tag,
394 s_chtml40_start_dl_tag,
395 s_chtml40_end_dl_tag,
399 s_chtml40_start_dd_tag,
400 s_chtml40_end_dd_tag,
404 s_chtml40_start_menu_tag,
405 s_chtml40_end_menu_tag,
409 s_chtml40_start_plaintext_tag,
410 s_chtml40_end_plaintext_tag,
414 s_chtml40_start_blink_tag,
415 s_chtml40_end_blink_tag,
419 s_chtml40_start_marquee_tag,
420 s_chtml40_end_marquee_tag,
429 s_chtml40_newline_mark,
446 * converts from CHTML5.0 to CHTML3.0.
448 * @param r [i] Requet_rec is appointed.
449 * @param spec [i] The result of the device specification processing which
450 * was done in advance is appointed.
451 * @param src [i] The character string before the converting is appointed.
452 * @return The character string after the converting is returned.
455 chxj_convert_chtml40(
461 chxjconvrule_entry *entryp,
470 DBG(r, "start chxj_convert_chtml40()");
472 /*--------------------------------------------------------------------------*/
474 /*--------------------------------------------------------------------------*/
476 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
478 DBG(r,"i found qrcode xml");
479 DBG(r, "end chxj_convert_chtml40()");
482 DBG(r,"not found qrcode xml");
484 /*--------------------------------------------------------------------------*/
485 /* The CHTML structure is initialized. */
486 /*--------------------------------------------------------------------------*/
487 s_init_chtml40(&chtml40, &doc, r, spec);
489 chtml40.entryp = entryp;
490 chtml40.cookie = cookie;
492 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
494 /*--------------------------------------------------------------------------*/
495 /* The character string of the input is analyzed. */
496 /*--------------------------------------------------------------------------*/
497 qs_init_malloc(&doc);
498 qs_init_root_node(&doc);
500 ss = apr_pcalloc(r->pool, srclen + 1);
501 memset(ss, 0, srclen + 1);
502 memcpy(ss, src, srclen);
505 chxj_dump_out("[src] CHTML -> CHTML4.0", ss, srclen);
507 if (IS_CSS_ON(chtml40.entryp)) {
508 /* current property list */
509 chtml40.css_prop_stack = chxj_new_prop_list_stack(&doc);
512 chxj_buffered_write_init(r->pool, &doc.buf);
514 qs_parse_string(&doc,ss, strlen(ss));
516 /*--------------------------------------------------------------------------*/
517 /* It converts it from CHTML to CHTML. */
518 /*--------------------------------------------------------------------------*/
519 chxj_node_convert(spec,r,(void*)&chtml40, &doc, qs_get_root(&doc), 0);
520 chtml40.out = chxj_buffered_write_flush(chtml40.out, &doc.buf);
521 dst = apr_pstrdup(r->pool, chtml40.out);
522 chxj_buffered_write_terminate(&doc.buf);
524 qs_all_free(&doc,QX_LOGMARK);
527 dst = apr_pstrdup(r->pool,ss);
529 if (strlen(dst) == 0) {
530 dst = apr_psprintf(r->pool, "\n");
533 *dstlen = strlen(dst);
536 chxj_dump_out("[src] CHTML -> CHTML4.0", dst, *dstlen);
539 DBG(r, "end chxj_convert_chtml40()");
545 * The CHTML structure is initialized.
547 * @param chtml40 [i/o] The pointer to the HDML structure that wants to be
548 * initialized is specified.
549 * @param doc [i] The Doc structure that should be set to the initialized
550 * HDML structure is specified.
551 * @param r [i] To use POOL, the pointer to request_rec is specified.
552 * @param spec [i] The pointer to the device_table
555 s_init_chtml40(chtml40_t *chtml40, Doc *doc, request_rec *r, device_table *spec)
557 memset(doc, 0, sizeof(Doc));
558 memset(chtml40, 0, sizeof(chtml40_t));
562 chtml40->spec = spec;
563 chtml40->out = qs_alloc_zero_byte_string(r->pool);
564 chtml40->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
565 chtml40->doc->parse_mode = PARSE_MODE_CHTML;
570 * Corresponding EMOJI to a current character-code is retrieved.
571 * The substitution character string is stored in the rslt pointer if agreeing.
573 * @param chtml40 [i] The pointer to the CHTML structure is specified.
574 * @param txt [i] The character string to want to examine whether it is
575 * EMOJI is specified.
576 * @param rslt [o] The pointer to the pointer that stores the result is
578 * @param node [i] The current node to check whether tag is span/font for CHXJ_IMODE_EMOJI_COLOR_AUTO.
579 * @return When corresponding EMOJI exists, it returns it excluding 0.
582 s_chtml40_search_emoji(chtml40_t *chtml40, char *txt, char **rslt, Node *node)
589 spec = chtml40->spec;
595 DBG(r,"spec is NULL");
598 for (ee = chtml40->conf->emoji;
601 if (ee->imode == NULL) {
602 DBG(r, "emoji->imode is NULL");
606 if (ee->imode->string != NULL
607 && strlen(ee->imode->string) > 0
608 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
610 if (spec == NULL || spec->emoji_type == NULL) {
611 *rslt = apr_palloc(r->pool, 3);
612 (*rslt)[0] = ee->imode->hex1byte & 0xff;
613 (*rslt)[1] = ee->imode->hex2byte & 0xff;
616 if(chtml40->conf->imode_emoji_color >= CHXJ_IMODE_EMOJI_COLOR_AUTO ){
617 if(ee->imode->color != NULL){
618 if(chtml40->conf->imode_emoji_color == CHXJ_IMODE_EMOJI_COLOR_AUTO && node != NULL ){
619 if(strcasecmp(node->parent->name, "span") == 0 ||
620 strcasecmp(node->parent->name, "font") == 0 ){
621 return strlen(ee->imode->string);
624 char *tmp = apr_pstrdup(r->pool,*rslt);
625 *rslt = apr_psprintf(r->pool,
626 "<font color=\"%s\">%s</font>",ee->imode->color,tmp);
629 return strlen(ee->imode->string);
641 chxj_chtml40_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
652 chtml40 = &__chtml40;
655 DBG(r, "REQ[%X] start chxj_chtml40_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
656 memset(doc, 0, sizeof(Doc));
657 memset(chtml40, 0, sizeof(chtml40_t));
661 chtml40->spec = spec;
662 chtml40->out = qs_alloc_zero_byte_string(r->pool);
663 chtml40->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
664 chtml40->doc->parse_mode = PARSE_MODE_CHTML;
666 apr_pool_create(&pool, r->pool);
668 chxj_buffered_write_init(pool, &doc->buf);
670 for (ii=0; ii<len; ii++) {
674 rtn = s_chtml40_search_emoji(chtml40, (char *)&src[ii], &out, NULL);
681 if (is_sjis_kanji(src[ii])) {
682 two_byte[0] = src[ii+0];
683 two_byte[1] = src[ii+1];
689 one_byte[0] = src[ii+0];
694 chtml40->out = chxj_buffered_write_flush(chtml40->out, &doc->buf);
696 DBG(r, "REQ[%X] end chxj_chtml40_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
702 * It is a handler who processes the HTML tag.
704 * @param pdoc [i/o] The pointer to the CHTML structure at the output
705 * destination is specified.
706 * @param node [i] The HTML tag node is specified.
707 * @return The conversion result is returned.
710 s_chtml40_start_html_tag(void *pdoc, Node *UNUSED(node))
712 chtml40_t *chtml40 = GET_CHTML40(pdoc);
713 Doc *doc = chtml40->doc;
715 /*--------------------------------------------------------------------------*/
717 /*--------------------------------------------------------------------------*/
725 * It is a handler who processes the HTML tag.
727 * @param pdoc [i/o] The pointer to the CHTML structure at the output
728 * destination is specified.
729 * @param node [i] The HTML tag node is specified.
730 * @return The conversion result is returned.
733 s_chtml40_end_html_tag(void *pdoc, Node *UNUSED(child))
735 chtml40_t *chtml40 = GET_CHTML40(pdoc);
736 Doc *doc = chtml40->doc;
744 * It is a handler who processes the META tag.
746 * @param pdoc [i/o] The pointer to the CHTML structure at the output
747 * destination is specified.
748 * @param node [i] The META tag node is specified.
749 * @return The conversion result is returned.
752 s_chtml40_start_meta_tag(void *pdoc, Node *node)
758 int content_type_flag;
761 chtml40 = GET_CHTML40(pdoc);
765 content_type_flag = 0;
769 /*--------------------------------------------------------------------------*/
771 /*--------------------------------------------------------------------------*/
772 for (attr = qs_get_attr(doc,node);
774 attr = qs_get_next_attr(doc,attr)) {
775 char *name = qs_get_attr_name(doc,attr);
776 char *value = qs_get_attr_value(doc,attr);
780 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
781 /*----------------------------------------------------------------------*/
783 /*----------------------------------------------------------------------*/
784 W_L(" http-equiv=\"");
787 if (STRCASEEQ('c','C',"content-type", value))
788 content_type_flag = 1;
790 if (STRCASEEQ('r','R',"refresh", value))
797 if (strcasecmp(name, "content") == 0 && value && *value) {
798 if (content_type_flag) {
802 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
810 buf = apr_pstrdup(r->pool, value);
811 url = strchr(buf, ';');
813 sec = apr_pstrdup(r->pool, buf);
816 url = chxj_encoding_parameter(r, url, 0);
817 url = chxj_add_cookie_parameter(r, url, chtml40->cookie);
847 * It is a handler who processes the META tag.
849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
850 * destination is specified.
851 * @param node [i] The META tag node is specified.
852 * @return The conversion result is returned.
855 s_chtml40_end_meta_tag(void* pdoc, Node* UNUSED(child))
857 chtml40_t *chtml40 = GET_CHTML40(pdoc);
864 * It is a handler who processes the HEAD tag.
866 * @param pdoc [i/o] The pointer to the CHTML structure at the output
867 * destination is specified.
868 * @param node [i] The HEAD tag node is specified.
869 * @return The conversion result is returned.
872 s_chtml40_start_head_tag(void* pdoc, Node* UNUSED(node))
874 chtml40_t *chtml40 = GET_CHTML40(pdoc);
875 Doc *doc = chtml40->doc;
884 * It is a handler who processes the HEAD tag.
886 * @param pdoc [i/o] The pointer to the CHTML structure at the output
887 * destination is specified.
888 * @param node [i] The HEAD tag node is specified.
889 * @return The conversion result is returned.
892 s_chtml40_end_head_tag(void *pdoc, Node *UNUSED(node))
894 chtml40_t *chtml40 = GET_CHTML40(pdoc);
895 Doc *doc = chtml40->doc;
904 * It is a handler who processes the TITLE tag.
906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
907 * destination is specified.
908 * @param node [i] The TITLE tag node is specified.
909 * @return The conversion result is returned.
912 s_chtml40_start_title_tag(void *pdoc, Node *UNUSED(node))
914 chtml40_t *chtml40 = GET_CHTML40(pdoc);
915 Doc *doc = chtml40->doc;
924 * It is a handler who processes the TITLE tag.
926 * @param pdoc [i/o] The pointer to the CHTML structure at the output
927 * destination is specified.
928 * @param node [i] The TITLE tag node is specified.
929 * @return The conversion result is returned.
932 s_chtml40_end_title_tag(void *pdoc, Node *UNUSED(child))
934 chtml40_t *chtml40 = GET_CHTML40(pdoc);
935 Doc *doc = chtml40->doc;
944 * It is a handler who processes the BASE tag.
946 * @param pdoc [i/o] The pointer to the CHTML structure at the output
947 * destination is specified.
948 * @param node [i] The BASE tag node is specified.
949 * @return The conversion result is returned.
952 s_chtml40_start_base_tag(void *pdoc, Node *node)
959 chtml40 = GET_CHTML40(pdoc);
964 /*--------------------------------------------------------------------------*/
966 /*--------------------------------------------------------------------------*/
967 for (attr = qs_get_attr(doc,node);
969 attr = qs_get_next_attr(doc,attr)) {
970 char *name = qs_get_attr_name(doc,attr);
971 char *value = qs_get_attr_value(doc,attr);
972 if (STRCASEEQ('h','H',"href", name)) {
985 * It is a handler who processes the BASE tag.
987 * @param pdoc [i/o] The pointer to the CHTML structure at the output
988 * destination is specified.
989 * @param node [i] The BASE tag node is specified.
990 * @return The conversion result is returned.
993 s_chtml40_end_base_tag(void *pdoc, Node *UNUSED(child))
995 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1002 * It is a handler who processes the BODY tag.
1004 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1005 * destination is specified.
1006 * @param node [i] The BODY tag node is specified.
1007 * @return The conversion result is returned.
1010 s_chtml40_start_body_tag(void *pdoc, Node *node)
1016 char *attr_bgcolor = NULL;
1017 char *attr_text = NULL;
1018 char *attr_link = NULL;
1019 char *attr_style = NULL;
1020 char *attr_alink = NULL;
1021 char *attr_vlink = NULL;
1024 chtml40 = GET_CHTML40(pdoc);
1028 /*--------------------------------------------------------------------------*/
1029 /* Get Attributes */
1030 /*--------------------------------------------------------------------------*/
1031 for (attr = qs_get_attr(doc,node);
1033 attr = qs_get_next_attr(doc,attr)) {
1034 char *name = qs_get_attr_name(doc,attr);
1035 char *value = qs_get_attr_value(doc,attr);
1036 if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
1037 /*----------------------------------------------------------------------*/
1039 /*----------------------------------------------------------------------*/
1040 attr_bgcolor = value;
1042 else if (STRCASEEQ('t','T', "text", name) && value && *value) {
1043 /*----------------------------------------------------------------------*/
1045 /*----------------------------------------------------------------------*/
1048 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1049 /*----------------------------------------------------------------------*/
1051 /*----------------------------------------------------------------------*/
1054 else if (STRCASEEQ('a','A',"alink", name) && value && *value) {
1055 /*----------------------------------------------------------------------*/
1057 /*----------------------------------------------------------------------*/
1060 else if (STRCASEEQ('v','V',"vlink", name) && value && *value) {
1061 /*----------------------------------------------------------------------*/
1063 /*----------------------------------------------------------------------*/
1066 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1071 if (IS_CSS_ON(chtml40->entryp)) {
1072 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1074 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1075 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1076 css_property_t *cur;
1077 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1078 if (cur->value && *cur->value) {
1079 attr_text = apr_pstrdup(doc->pool, cur->value);
1082 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1083 if (cur->value && *cur->value) {
1084 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1088 if (chtml40->style) {
1089 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml40->style);
1090 css_selector_t *cur_sel;
1091 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1092 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1093 css_property_t *cur;
1094 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1095 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1096 attr_link = apr_pstrdup(doc->pool, cur->value);
1100 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1101 css_property_t *cur;
1102 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1103 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1104 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1108 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
1109 css_property_t *cur;
1110 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1111 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1112 attr_alink = apr_pstrdup(doc->pool, cur->value);
1122 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1128 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1134 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1140 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1146 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1153 return chtml40->out;
1158 * It is a handler who processes the BODY tag.
1160 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1161 * destination is specified.
1162 * @param node [i] The BODY tag node is specified.
1163 * @return The conversion result is returned.
1166 s_chtml40_end_body_tag(void *pdoc, Node *UNUSED(child))
1171 chtml40 = GET_CHTML40(pdoc);
1175 if (IS_CSS_ON(chtml40->entryp)) {
1176 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1179 return chtml40->out;
1184 * It is a handler who processes the A tag.
1186 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1187 * destination is specified.
1188 * @param node [i] The A tag node is specified.
1189 * @return The conversion result is returned.
1192 s_chtml40_start_a_tag(void *pdoc, Node *node)
1198 char *attr_style = NULL;
1200 chtml40 = GET_CHTML40(pdoc);
1205 /*--------------------------------------------------------------------------*/
1206 /* Get Attributes */
1207 /*--------------------------------------------------------------------------*/
1208 for (attr = qs_get_attr(doc,node);
1210 attr = qs_get_next_attr(doc,attr)) {
1211 char *name = qs_get_attr_name(doc,attr);
1212 char *value = qs_get_attr_value(doc,attr);
1213 if (STRCASEEQ('n','N',"name", name)) {
1214 /*----------------------------------------------------------------------*/
1216 /*----------------------------------------------------------------------*/
1221 else if (STRCASEEQ('h','H',"href", name)) {
1222 /*----------------------------------------------------------------------*/
1224 /*----------------------------------------------------------------------*/
1225 value = chxj_encoding_parameter(r, value, 0);
1226 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1227 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
1233 else if (STRCASEEQ('a','A',"accesskey", name)) {
1234 /*----------------------------------------------------------------------*/
1236 /*----------------------------------------------------------------------*/
1237 W_L(" accesskey=\"");
1241 else if (STRCASEEQ('c','C',"cti", name)) {
1242 /*----------------------------------------------------------------------*/
1244 /*----------------------------------------------------------------------*/
1249 else if (STRCASEEQ('i','I',"ijam", name)) {
1250 /*----------------------------------------------------------------------*/
1252 /*----------------------------------------------------------------------*/
1255 else if (STRCASEEQ('u','U',"utn", name)) {
1256 /*----------------------------------------------------------------------*/
1258 /* It is special only for CHTML. */
1259 /*----------------------------------------------------------------------*/
1262 else if (STRCASEEQ('t','T',"telbook", name)) {
1263 /*----------------------------------------------------------------------*/
1265 /*----------------------------------------------------------------------*/
1268 else if (STRCASEEQ('k','K',"kana", name)) {
1269 /*----------------------------------------------------------------------*/
1271 /*----------------------------------------------------------------------*/
1274 else if (STRCASEEQ('e','E',"email", name)) {
1275 /*----------------------------------------------------------------------*/
1277 /*----------------------------------------------------------------------*/
1280 else if (STRCASEEQ('i','I',"ista", name)) {
1281 /*----------------------------------------------------------------------*/
1283 /*----------------------------------------------------------------------*/
1286 else if (STRCASEEQ('i','I',"ilet", name)) {
1287 /*----------------------------------------------------------------------*/
1289 /*----------------------------------------------------------------------*/
1292 else if (STRCASEEQ('i','I',"iswf", name)) {
1293 /*----------------------------------------------------------------------*/
1295 /*----------------------------------------------------------------------*/
1298 else if (STRCASEEQ('i','I',"irst", name)) {
1299 /*----------------------------------------------------------------------*/
1301 /*----------------------------------------------------------------------*/
1304 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1310 if (IS_CSS_ON(chtml40->entryp)) {
1311 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1314 return chtml40->out;
1319 * It is a handler who processes the A tag.
1321 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1322 * destination is specified.
1323 * @param node [i] The A tag node is specified.
1324 * @return The conversion result is returned.
1327 s_chtml40_end_a_tag(void *pdoc, Node *UNUSED(child))
1332 chtml40 = GET_CHTML40(pdoc);
1337 if (IS_CSS_ON(chtml40->entryp)) {
1338 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1341 return chtml40->out;
1346 * It is a handler who processes the BR tag.
1348 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1349 * destination is specified.
1350 * @param node [i] The BR tag node is specified.
1351 * @return The conversion result is returned.
1354 s_chtml40_start_br_tag(void *pdoc, Node *node)
1361 chtml40 = GET_CHTML40(pdoc);
1365 /*--------------------------------------------------------------------------*/
1366 /* Get Attributes */
1367 /*--------------------------------------------------------------------------*/
1368 for (attr = qs_get_attr(doc,node);
1370 attr = qs_get_next_attr(doc,attr)) {
1371 char *name = qs_get_attr_name(doc,attr);
1372 char *value = qs_get_attr_value(doc,attr);
1373 if (STRCASEEQ('c','C',"clear",name)) {
1374 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1383 return chtml40->out;
1388 * It is a handler who processes the BR tag.
1390 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1391 * destination is specified.
1392 * @param node [i] The BR tag node is specified.
1393 * @return The conversion result is returned.
1396 s_chtml40_end_br_tag(void *pdoc, Node *UNUSED(child))
1398 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1400 return chtml40->out;
1405 * It is a handler who processes the TR tag.
1407 * @param chtml40 [i/o] The pointer to the CHTML structure at the output
1408 * destination is specified.
1409 * @param node [i] The TR tag node is specified.
1410 * @return The conversion result is returned.
1413 s_chtml40_start_tr_tag(void *pdoc, Node *UNUSED(node))
1415 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1417 return chtml40->out;
1422 * It is a handler who processes the TR tag.
1424 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1425 * destination is specified.
1426 * @param node [i] The TR tag node is specified.
1427 * @return The conversion result is returned.
1430 s_chtml40_end_tr_tag(void *pdoc, Node *UNUSED(child))
1436 chtml40 = GET_CHTML40(pdoc);
1442 return chtml40->out;
1447 * It is a handler who processes the FONT tag.
1449 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1450 * destination is specified.
1451 * @param node [i] The FONT tag node is specified.
1452 * @return The conversion result is returned.
1455 s_chtml40_start_font_tag(void *pdoc, Node *node)
1461 char *attr_color = NULL;
1462 char *attr_style = NULL;
1464 chtml40 = GET_CHTML40(pdoc);
1468 /*--------------------------------------------------------------------------*/
1469 /* Get Attributes */
1470 /*--------------------------------------------------------------------------*/
1471 for (attr = qs_get_attr(doc,node);
1473 attr = qs_get_next_attr(doc,attr)) {
1474 char *name = qs_get_attr_name(doc,attr);
1475 char *value = qs_get_attr_value(doc,attr);
1476 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1477 attr_color = apr_pstrdup(doc->buf.pool, value);
1480 else if (STRCASEEQ('s','S',"size", name)) {
1481 /*----------------------------------------------------------------------*/
1483 /*----------------------------------------------------------------------*/
1486 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1490 if (IS_CSS_ON(chtml40->entryp)) {
1491 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1493 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1494 css_property_t *cur;
1495 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1496 if (cur->value && *cur->value) {
1497 attr_color = apr_pstrdup(doc->pool, cur->value);
1503 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1504 W_L("<font color=\"");
1507 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1508 flg->with_font_flag = 1;
1509 node->userData = flg;
1512 node->userData = NULL;
1514 return chtml40->out;
1519 * It is a handler who processes the FONT tag.
1521 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1522 * destination is specified.
1523 * @param node [i] The FONT tag node is specified.
1524 * @return The conversion result is returned.
1527 s_chtml40_end_font_tag(void *pdoc, Node *node)
1533 chtml40 = GET_CHTML40(pdoc);
1537 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1538 if (flg && flg->with_font_flag) {
1541 if (IS_CSS_ON(chtml40->entryp)) {
1542 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1545 return chtml40->out;
1550 * It is a handler who processes the FORM tag.
1552 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1553 * destination is specified.
1554 * @param node [i] The FORM tag node is specified.
1555 * @return The conversion result is returned.
1558 s_chtml40_start_form_tag(void *pdoc, Node *node)
1564 char *attr_action = NULL;
1565 char *attr_method = NULL;
1566 char *attr_style = NULL;
1567 char *attr_color = NULL;
1568 char *attr_align = NULL;
1569 char *attr_utn = NULL;
1570 char *new_hidden_tag = NULL;
1572 chtml40 = GET_CHTML40(pdoc);
1576 /*--------------------------------------------------------------------------*/
1577 /* Get Attributes */
1578 /*--------------------------------------------------------------------------*/
1579 for (attr = qs_get_attr(doc,node);
1581 attr = qs_get_next_attr(doc,attr)) {
1582 char *name = qs_get_attr_name(doc,attr);
1583 char *value = qs_get_attr_value(doc,attr);
1587 if (strcasecmp(name, "action") == 0) {
1588 /*--------------------------------------------------------------------*/
1590 /*--------------------------------------------------------------------*/
1591 attr_action = value;
1597 if (strcasecmp(name, "method") == 0) {
1598 /*--------------------------------------------------------------------*/
1600 /*--------------------------------------------------------------------*/
1601 attr_method = value;
1607 if (strcasecmp(name, "utn") == 0) {
1608 /*--------------------------------------------------------------------*/
1610 /*--------------------------------------------------------------------*/
1617 if (strcasecmp(name, "style") == 0) {
1626 if (IS_CSS_ON(chtml40->entryp)) {
1627 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1629 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1630 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1631 css_property_t *cur;
1632 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1633 if (STRCASEEQ('l','L',"left", cur->value)) {
1634 attr_align = apr_pstrdup(doc->pool, "left");
1636 else if (STRCASEEQ('c','C',"center",cur->value)) {
1637 attr_align = apr_pstrdup(doc->pool, "center");
1639 else if (STRCASEEQ('r','R',"right",cur->value)) {
1640 attr_align = apr_pstrdup(doc->pool, "right");
1643 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1644 attr_color = apr_pstrdup(doc->pool, cur->value);
1649 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1653 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1654 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml40->cookie);
1656 char *new_query_string = NULL;
1657 q = strchr(attr_action, '?');
1659 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml40->entryp);
1660 if (new_hidden_tag || new_query_string) {
1666 if (new_query_string) {
1668 W_V(new_query_string);
1681 if (new_hidden_tag) {
1682 W_V(new_hidden_tag);
1685 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1686 memset(flg, 0, sizeof(*flg));
1688 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1689 W_L("<font color=\"");
1692 flg->with_font_flag = 1;
1695 W_L("<div align=\"");
1698 flg->with_div_flag = 1;
1700 node->userData = flg;
1702 return chtml40->out;
1707 * It is a handler who processes the FORM tag.
1709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1710 * destination is specified.
1711 * @param node [i] The FORM tag node is specified.
1712 * @return The conversion result is returned.
1715 s_chtml40_end_form_tag(void *pdoc, Node *node)
1720 chtml40 = GET_CHTML40(pdoc);
1723 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1724 if (flg && flg->with_div_flag) {
1727 if (flg && flg->with_font_flag) {
1731 if (IS_CSS_ON(chtml40->entryp)) {
1732 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1735 return chtml40->out;
1740 * It is a handler who processes the INPUT tag.
1742 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1743 * destination is specified.
1744 * @param node [i] The INPUT tag node is specified.
1745 * @return The conversion result is returned.
1748 s_chtml40_start_input_tag(void *pdoc, Node *node)
1754 char *attr_accesskey = NULL;
1755 char *attr_max_length = NULL;
1756 char *attr_type = NULL;
1757 char *attr_name = NULL;
1758 char *attr_value = NULL;
1759 char *attr_istyle = NULL;
1760 char *attr_size = NULL;
1761 char *attr_checked = NULL;
1762 char *attr_style = NULL;
1764 chtml40 = GET_CHTML40(pdoc);
1768 /*--------------------------------------------------------------------------*/
1769 /* Get Attributes */
1770 /*--------------------------------------------------------------------------*/
1771 for (attr = qs_get_attr(doc,node);
1773 attr = qs_get_next_attr(doc,attr)) {
1774 char *name = qs_get_attr_name(doc,attr);
1775 char *value = qs_get_attr_value(doc,attr);
1776 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1777 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1778 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1779 STRCASEEQ('p','P',"password",tmp_type) ||
1780 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1781 STRCASEEQ('r','R',"radio", tmp_type) ||
1782 STRCASEEQ('h','H',"hidden", tmp_type) ||
1783 STRCASEEQ('s','S',"submit", tmp_type) ||
1784 STRCASEEQ('r','R',"reset", tmp_type))) {
1785 attr_type = tmp_type;
1788 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1791 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1794 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1795 attr_istyle = value;
1797 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1798 attr_max_length = value;
1800 else if (STRCASEEQ('c','C',"checked", name)) {
1801 attr_checked = value;
1803 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1804 attr_accesskey = value;
1806 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1809 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1814 if (IS_CSS_ON(chtml40->entryp)) {
1815 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
1817 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1818 css_property_t *cur;
1819 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1820 if (strcasestr(cur->value, "<ja:n>")) {
1823 else if (strcasestr(cur->value, "<ja:en>")) {
1826 else if (strcasestr(cur->value, "<ja:hk>")) {
1829 else if (strcasestr(cur->value, "<ja:h>")) {
1853 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1854 apr_size_t value_len = strlen(attr_value);
1855 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml40->entryp);
1859 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1862 if (attr_accesskey) {
1863 W_L(" accesskey=\"");
1864 W_V(attr_accesskey);
1868 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1874 /*--------------------------------------------------------------------------*/
1875 /* The figure is default for the password. */
1876 /*--------------------------------------------------------------------------*/
1877 if (attr_max_length) {
1878 if (chxj_chk_numeric(attr_max_length) != 0) {
1879 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1881 if (attr_istyle && *attr_istyle == '1') {
1882 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1886 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1895 return chtml40->out;
1900 * It is a handler who processes the INPUT tag.
1902 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1903 * destination is specified.
1904 * @param node [i] The INPUT tag node is specified.
1905 * @return The conversion result is returned.
1908 s_chtml40_end_input_tag(void *pdoc, Node *UNUSED(child))
1910 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1912 return chtml40->out;
1917 * It is a handler who processes the CENTER tag.
1919 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1920 * destination is specified.
1921 * @param node [i] The CENTER tag node is specified.
1922 * @return The conversion result is returned.
1925 s_chtml40_start_center_tag(void *pdoc, Node *node)
1930 char *attr_style = NULL;
1931 char *attr_color = NULL;
1933 chtml40 = GET_CHTML40(pdoc);
1936 for (attr = qs_get_attr(doc,node);
1938 attr = qs_get_next_attr(doc,attr)) {
1939 char *name = qs_get_attr_name(doc,attr);
1940 char *value = qs_get_attr_value(doc,attr);
1941 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1945 if (IS_CSS_ON(chtml40->entryp)) {
1946 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1948 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1949 css_property_t *cur;
1950 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1951 if (cur->value && *cur->value) {
1952 attr_color = apr_pstrdup(doc->pool, cur->value);
1959 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1960 memset(flg, 0, sizeof(*flg));
1962 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1963 W_L("<font color=\"");
1966 flg->with_font_flag = 1;
1968 node->userData = flg;
1970 return chtml40->out;
1975 * It is a handler who processes the CENTER tag.
1977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1978 * destination is specified.
1979 * @param node [i] The CENTER tag node is specified.
1980 * @return The conversion result is returned.
1983 s_chtml40_end_center_tag(void *pdoc, Node *node)
1988 chtml40 = GET_CHTML40(pdoc);
1991 if (IS_CSS_ON(chtml40->entryp)) {
1992 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1994 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1995 if (flg && flg->with_font_flag) {
2000 return chtml40->out;
2005 * It is a handler who processes the HR tag.
2007 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2008 * destination is specified.
2009 * @param node [i] The HR tag node is specified.
2010 * @return The conversion result is returned.
2013 s_chtml40_start_hr_tag(void *pdoc, Node *node)
2019 char *attr_align = NULL;
2020 char *attr_size = NULL;
2021 char *attr_width = NULL;
2022 char *attr_noshade = NULL;
2023 char *attr_style = NULL;
2024 char *attr_color = NULL;
2026 chtml40 = GET_CHTML40(pdoc);
2030 for (attr = qs_get_attr(doc,node);
2032 attr = qs_get_next_attr(doc,attr)) {
2033 char *name = qs_get_attr_name (doc,attr);
2034 char *value = qs_get_attr_value(doc,attr);
2038 if (strcasecmp(name, "align") == 0) {
2039 /*--------------------------------------------------------------------*/
2041 /*--------------------------------------------------------------------*/
2042 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2050 if (strcasecmp(name, "size") == 0) {
2051 /*--------------------------------------------------------------------*/
2053 /*--------------------------------------------------------------------*/
2054 if (value && *value) {
2058 else if (strcasecmp(name, "style") == 0) {
2059 if (value && *value) {
2067 if (strcasecmp(name, "width") == 0) {
2068 /*--------------------------------------------------------------------*/
2070 /*--------------------------------------------------------------------*/
2071 if (value && *value) {
2079 if (strcasecmp(name, "noshade") == 0) {
2080 /*--------------------------------------------------------------------*/
2082 /*--------------------------------------------------------------------*/
2083 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2089 if (strcasecmp(name, "color") == 0 && value && *value) {
2090 /*--------------------------------------------------------------------*/
2092 /*--------------------------------------------------------------------*/
2101 if (IS_CSS_ON(chtml40->entryp)) {
2102 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2104 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2105 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2106 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2107 css_property_t *cur;
2108 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2109 if (STRCASEEQ('s','S',"solid",cur->value)) {
2110 attr_noshade = "noshade";
2113 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2114 char *tmp = apr_pstrdup(doc->pool, cur->value);
2115 char *tmpp = strstr(tmp, "px");
2118 attr_size = apr_pstrdup(doc->pool, tmp);
2121 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2122 char *tmp = apr_pstrdup(doc->pool, cur->value);
2123 char *tmpp = strstr(tmp, "px");
2126 attr_width = apr_pstrdup(doc->pool, tmp);
2129 tmpp = strstr(tmp, "%");
2131 attr_width = apr_pstrdup(doc->pool, tmp);
2162 return chtml40->out;
2167 * It is a handler who processes the HR tag.
2169 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2170 * destination is specified.
2171 * @param node [i] The HR tag node is specified.
2172 * @return The conversion result is returned.
2175 s_chtml40_end_hr_tag(void *pdoc, Node *UNUSED(child))
2177 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2179 return chtml40->out;
2184 * It is a handler who processes the IMG tag.
2186 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2187 * destination is specified.
2188 * @param node [i] The IMG tag node is specified.
2189 * @return The conversion result is returned.
2192 s_chtml40_start_img_tag(void *pdoc, Node *node)
2198 char *attr_src = NULL;
2199 char *attr_align = NULL;
2200 char *attr_style = NULL;
2201 char *attr_alt = NULL;
2202 char *attr_width = NULL;
2203 char *attr_height = NULL;
2204 char *attr_hspace = NULL;
2205 char *attr_vspace = NULL;
2206 #ifndef IMG_NOT_CONVERT_FILENAME
2210 chtml40 = GET_CHTML40(pdoc);
2211 #ifndef IMG_NOT_CONVERT_FILENAME
2212 spec = chtml40->spec;
2217 /*--------------------------------------------------------------------------*/
2218 /* Get Attributes */
2219 /*--------------------------------------------------------------------------*/
2220 for (attr = qs_get_attr(doc,node);
2222 attr = qs_get_next_attr(doc,attr)) {
2223 char *name = qs_get_attr_name (doc,attr);
2224 char *value = qs_get_attr_value(doc,attr);
2228 if (strcasecmp(name, "src") == 0) {
2229 /*--------------------------------------------------------------------*/
2231 /*--------------------------------------------------------------------*/
2232 #ifdef IMG_NOT_CONVERT_FILENAME
2233 value = chxj_encoding_parameter(r, value, 0);
2234 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2235 value = chxj_add_cookie_no_update_parameter(r, value);
2238 value = chxj_img_conv(r,spec,value);
2239 value = chxj_encoding_parameter(r, value, 0);
2240 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2241 value = chxj_add_cookie_no_update_parameter(r, value);
2245 else if (strcasecmp(name,"style") == 0 && value && *value) {
2252 if (strcasecmp(name, "align" ) == 0) {
2253 /*--------------------------------------------------------------------*/
2255 /*--------------------------------------------------------------------*/
2256 /*--------------------------------------------------------------------*/
2258 /*--------------------------------------------------------------------*/
2260 if (STRCASEEQ('t','T',"top", value) ||
2261 STRCASEEQ('m','M',"middle",value) ||
2262 STRCASEEQ('b','B',"bottom",value) ||
2263 STRCASEEQ('l','L',"left", value) ||
2264 STRCASEEQ('r','R',"right", value)) {
2267 else if (STRCASEEQ('c','C',"center", value)) {
2268 attr_align = apr_pstrdup(doc->pool, "middle");
2272 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2273 /*--------------------------------------------------------------------*/
2275 /*--------------------------------------------------------------------*/
2282 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2283 /*--------------------------------------------------------------------*/
2285 /*--------------------------------------------------------------------*/
2292 if (strcasecmp(name, "height") == 0 && value && *value) {
2293 /*--------------------------------------------------------------------*/
2295 /*--------------------------------------------------------------------*/
2296 attr_height = value;
2299 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2300 /*--------------------------------------------------------------------*/
2302 /*--------------------------------------------------------------------*/
2303 attr_hspace = value;
2309 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2310 /*--------------------------------------------------------------------*/
2312 /*--------------------------------------------------------------------*/
2313 attr_vspace = value;
2322 if (IS_CSS_ON(chtml40->entryp)) {
2323 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2325 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2326 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2327 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2328 css_property_t *cur;
2329 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2330 attr_height = apr_pstrdup(doc->pool, cur->value);
2332 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2333 attr_width = apr_pstrdup(doc->pool, cur->value);
2335 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2336 attr_align = apr_pstrdup(doc->pool, cur->value);
2378 return chtml40->out;
2383 * It is a handler who processes the IMG tag.
2385 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2386 * destination is specified.
2387 * @param node [i] The IMG tag node is specified.
2388 * @return The conversion result is returned.
2391 s_chtml40_end_img_tag(void *pdoc, Node *UNUSED(child))
2393 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2395 return chtml40->out;
2400 * It is a handler who processes the SELECT tag.
2402 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2403 * destination is specified.
2404 * @param node [i] The SELECT tag node is specified.
2405 * @return The conversion result is returned.
2408 s_chtml40_start_select_tag(void *pdoc, Node *node)
2410 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2411 Doc *doc = chtml40->doc;
2414 char *multiple = NULL;
2416 char *attr_style = NULL;
2419 for (attr = qs_get_attr(doc,node);
2421 attr = qs_get_next_attr(doc,attr)) {
2422 char *nm = qs_get_attr_name(doc,attr);
2423 char *val = qs_get_attr_value(doc,attr);
2424 if (STRCASEEQ('s','S',"size", nm)) {
2425 /*----------------------------------------------------------------------*/
2426 /* CHTML 1.0 version 2.0 */
2427 /*----------------------------------------------------------------------*/
2428 size = apr_pstrdup(doc->buf.pool, val);
2430 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2431 /*----------------------------------------------------------------------*/
2432 /* CHTML 1.0 version 2.0 */
2433 /*----------------------------------------------------------------------*/
2434 attr_style = apr_pstrdup(doc->buf.pool, val);
2436 else if (STRCASEEQ('n','N',"name", nm)) {
2437 /*----------------------------------------------------------------------*/
2438 /* CHTML 1.0 version 2.0 */
2439 /*----------------------------------------------------------------------*/
2440 name = apr_pstrdup(doc->buf.pool, val);
2442 else if (STRCASEEQ('m','M',"multiple", nm)) {
2443 /*----------------------------------------------------------------------*/
2444 /* CHTML 1.0 version 2.0 */
2445 /*----------------------------------------------------------------------*/
2446 multiple = apr_pstrdup(doc->buf.pool, val);
2449 if (size && *size) {
2454 if (name && *name) {
2463 if (IS_CSS_ON(chtml40->entryp)) {
2464 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2466 return chtml40->out;
2471 * It is a handler who processes the SELECT tag.
2473 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2474 * destination is specified.
2475 * @param node [i] The SELECT tag node is specified.
2476 * @return The conversion result is returned.
2479 s_chtml40_end_select_tag(void *pdoc, Node *UNUSED(child))
2481 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2482 Doc *doc = chtml40->doc;
2485 if (IS_CSS_ON(chtml40->entryp)) {
2486 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2488 return chtml40->out;
2493 * It is a handler who processes the OPTION tag.
2495 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2496 * destination is specified.
2497 * @param node [i] The OPTION tag node is specified.
2498 * @return The conversion result is returned.
2501 s_chtml40_start_option_tag(void *pdoc, Node *node)
2509 char *attr_style = NULL;
2511 chtml40 = GET_CHTML40(pdoc);
2518 for (attr = qs_get_attr(doc,node);
2520 attr = qs_get_next_attr(doc,attr)) {
2521 char *nm = qs_get_attr_name(doc,attr);
2522 char *val = qs_get_attr_value(doc,attr);
2523 if (STRCASEEQ('s','S',"selected", nm)) {
2524 /*----------------------------------------------------------------------*/
2525 /* CHTML 1.0 version 2.0 */
2526 /*----------------------------------------------------------------------*/
2527 selected = apr_pstrdup(doc->buf.pool, val);
2529 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2530 /*----------------------------------------------------------------------*/
2531 /* CHTML 1.0 version 2.0 */
2532 /*----------------------------------------------------------------------*/
2533 attr_style = apr_pstrdup(doc->buf.pool, val);
2535 else if (STRCASEEQ('v','V',"value", nm)) {
2536 /*----------------------------------------------------------------------*/
2537 /* CHTML 1.0 version 2.0 */
2538 /*----------------------------------------------------------------------*/
2539 value = apr_pstrdup(doc->buf.pool, val);
2552 if (IS_CSS_ON(chtml40->entryp)) {
2553 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2556 return chtml40->out;
2561 * It is a handler who processes the OPTION tag.
2563 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2564 * destination is specified.
2565 * @param node [i] The OPTION tag node is specified.
2566 * @return The conversion result is returned.
2569 s_chtml40_end_option_tag(void *pdoc, Node *UNUSED(child))
2571 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2574 if (IS_CSS_ON(chtml40->entryp)) {
2575 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2578 return chtml40->out;
2583 * It is a handler who processes the DIV tag.
2585 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2586 * destination is specified.
2587 * @param node [i] The DIV tag node is specified.
2588 * @return The conversion result is returned.
2591 s_chtml40_start_div_tag(void *pdoc, Node *node)
2597 char *attr_style = NULL;
2598 char *attr_align = NULL;
2599 char *attr_display = NULL;
2600 char *attr_decoration = NULL;
2601 char *attr_wap_marquee_style = NULL;
2602 char *attr_wap_marquee_dir = NULL;
2603 char *attr_wap_marquee_loop = NULL;
2604 char *attr_color = NULL;
2605 char *attr_bgcolor = NULL;
2607 chtml40 = GET_CHTML40(pdoc);
2611 for (attr = qs_get_attr(doc,node);
2613 attr = qs_get_next_attr(doc,attr)) {
2614 char *nm = qs_get_attr_name(doc,attr);
2615 char *val = qs_get_attr_value(doc,attr);
2616 if (STRCASEEQ('a','A', "align", nm)) {
2617 /*----------------------------------------------------------------------*/
2618 /* CHTML 1.0 (W3C version 3.2) */
2619 /*----------------------------------------------------------------------*/
2620 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2621 attr_align = apr_pstrdup(doc->buf.pool, val);
2624 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2625 attr_style = apr_pstrdup(doc->buf.pool, val);
2629 if (IS_CSS_ON(chtml40->entryp)) {
2630 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2632 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2633 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2634 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2635 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2636 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2637 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2639 css_property_t *cur;
2640 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2641 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2642 attr_display = apr_pstrdup(doc->pool, cur->value);
2645 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2646 if (STRCASEEQ('b','B',"blink", cur->value)) {
2647 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2650 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2651 attr_color = apr_pstrdup(doc->pool, cur->value);
2652 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2654 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2655 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2656 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2658 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2659 char *ss = strchr(cur->value, '#');
2661 ss = strstr(cur->value, "rgb");
2664 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2665 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2668 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2669 attr_align = apr_pstrdup(doc->pool, cur->value);
2672 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2673 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2674 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2675 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2676 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2677 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2680 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2681 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2682 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2684 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2685 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2688 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2689 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2690 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2693 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2699 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
2700 memset(flg, 0, sizeof(*flg));
2707 flg->with_div_flag = 1;
2711 flg->with_div_flag = 1;
2714 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2718 W_L("<font color=\"");
2721 flg->with_font_flag = 1;
2724 if (attr_decoration) {
2726 flg->with_blink_flag = 1;
2730 if (attr_wap_marquee_style) {
2731 W_L(" behavior=\"");
2732 W_V(attr_wap_marquee_style);
2735 if (attr_wap_marquee_dir) {
2736 W_L(" direction=\"");
2737 W_V(attr_wap_marquee_dir);
2740 if (attr_wap_marquee_loop) {
2742 W_V(attr_wap_marquee_loop);
2746 flg->with_marquee_flag = 1;
2748 node->userData = flg;
2750 return chtml40->out;
2755 * It is a handler who processes the DIV tag.
2757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2758 * destination is specified.
2759 * @param node [i] The DIV tag node is specified.
2760 * @return The conversion result is returned.
2763 s_chtml40_end_div_tag(void *pdoc, Node *node)
2765 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2766 Doc *doc = chtml40->doc;
2768 chtml40_flags_t *flg = node->userData;
2769 if (flg && flg->with_marquee_flag) {
2772 if (flg && flg->with_blink_flag) {
2775 if (flg && flg->with_font_flag) {
2778 if (flg && flg->with_div_flag) {
2781 if (IS_CSS_ON(chtml40->entryp)) {
2782 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2784 node->userData = NULL;
2786 return chtml40->out;
2791 * It is a handler who processes the UL tag.
2793 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2794 * destination is specified.
2795 * @param node [i] The UL tag node is specified.
2796 * @return The conversion result is returned.
2799 s_chtml40_start_ul_tag(void *pdoc, Node *node)
2801 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2802 Doc *doc = chtml40->doc;
2804 char *attr_type = NULL;
2805 char *attr_style = NULL;
2806 /*--------------------------------------------------------------------------*/
2807 /* Get Attributes */
2808 /*--------------------------------------------------------------------------*/
2809 for (attr = qs_get_attr(doc,node);
2811 attr = qs_get_next_attr(doc,attr)) {
2812 char *name = qs_get_attr_name(doc,attr);
2813 char *value = qs_get_attr_value(doc,attr);
2814 if (STRCASEEQ('t','T',"type",name)) {
2815 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2819 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2823 if (IS_CSS_ON(chtml40->entryp)) {
2824 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2826 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2827 css_property_t *cur;
2828 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2829 if (STRCASEEQ('d','D',"disc",cur->value)) {
2830 attr_type = apr_pstrdup(doc->pool, "disc");
2832 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2833 attr_type = apr_pstrdup(doc->pool, "circle");
2835 else if (STRCASEEQ('s','S',"square",cur->value)) {
2836 attr_type = apr_pstrdup(doc->pool, "square");
2849 return chtml40->out;
2854 * It is a handler who processes the UL tag.
2856 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2857 * destination is specified.
2858 * @param node [i] The UL tag node is specified.
2859 * @return The conversion result is returned.
2862 s_chtml40_end_ul_tag(void *pdoc, Node *UNUSED(child))
2864 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2865 Doc *doc = chtml40->doc;
2868 if (IS_CSS_ON(chtml40->entryp)) {
2869 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2872 return chtml40->out;
2877 * It is a handler who processes the PRE tag.
2879 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2880 * destination is specified.
2881 * @param node [i] The PRE tag node is specified.
2882 * @return The conversion result is returned.
2885 s_chtml40_start_pre_tag(void *pdoc, Node *node)
2887 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2888 Doc *doc = chtml40->doc;
2890 char *attr_style = NULL;
2892 for (attr = qs_get_attr(doc,node);
2894 attr = qs_get_next_attr(doc,attr)) {
2895 char *nm = qs_get_attr_name(doc,attr);
2896 char *val = qs_get_attr_value(doc,attr);
2897 if (val && STRCASEEQ('s','S',"style", nm)) {
2902 if (IS_CSS_ON(chtml40->entryp)) {
2903 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2906 chtml40->pre_flag++;
2909 return chtml40->out;
2914 * It is a handler who processes the PRE tag.
2916 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2917 * destination is specified.
2918 * @param node [i] The PRE tag node is specified.
2919 * @return The conversion result is returned.
2922 s_chtml40_end_pre_tag(void *pdoc, Node *UNUSED(child))
2924 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2925 Doc *doc = chtml40->doc;
2928 chtml40->pre_flag--;
2929 if (IS_CSS_ON(chtml40->entryp)) {
2930 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2933 return chtml40->out;
2938 * It is a handler who processes the P tag.
2940 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2941 * destination is specified.
2942 * @param node [i] The P tag node is specified.
2943 * @return The conversion result is returned.
2946 s_chtml40_start_p_tag(void *pdoc, Node *node)
2952 char *attr_align = NULL;
2953 char *attr_style = NULL;
2954 char *attr_color = NULL;
2955 char *attr_blink = NULL;
2957 chtml40 = GET_CHTML40(pdoc);
2961 for (attr = qs_get_attr(doc,node);
2963 attr = qs_get_next_attr(doc,attr)) {
2964 char *nm = qs_get_attr_name(doc,attr);
2965 char *val = qs_get_attr_value(doc,attr);
2966 if (STRCASEEQ('a','A',"align", nm)) {
2967 /*----------------------------------------------------------------------*/
2968 /* CHTML 1.0 (W3C version 3.2) */
2969 /*----------------------------------------------------------------------*/
2970 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2971 attr_align = apr_pstrdup(doc->buf.pool, val);
2975 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2976 attr_style = apr_pstrdup(doc->buf.pool, val);
2979 if (IS_CSS_ON(chtml40->entryp)) {
2980 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2982 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2983 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2984 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2985 css_property_t *cur;
2986 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2987 if (STRCASEEQ('l','L',"left",cur->value)) {
2988 attr_align = apr_pstrdup(doc->pool, "left");
2990 else if (STRCASEEQ('c','C',"center",cur->value)) {
2991 attr_align = apr_pstrdup(doc->pool, "center");
2993 else if (STRCASEEQ('r','R',"right",cur->value)) {
2994 attr_align = apr_pstrdup(doc->pool, "right");
2997 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2998 if (cur->value && *cur->value) {
2999 attr_color = apr_pstrdup(doc->pool, cur->value);
3002 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3003 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3004 attr_blink = apr_pstrdup(doc->pool, cur->value);
3017 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
3018 memset(flg, 0, sizeof(*flg));
3020 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3021 W_L("<font color=\"");
3024 flg->with_font_flag = 1;
3028 flg->with_blink_flag = 1;
3030 node->userData = (void *)flg;
3032 return chtml40->out;
3037 * It is a handler who processes the P tag.
3039 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3040 * destination is specified.
3041 * @param node [i] The P tag node is specified.
3042 * @return The conversion result is returned.
3045 s_chtml40_end_p_tag(void *pdoc, Node *node)
3050 chtml40 = GET_CHTML40(pdoc);
3053 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
3054 if (flg->with_font_flag) {
3057 if (flg->with_blink_flag) {
3061 if (IS_CSS_ON(chtml40->entryp)) {
3062 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3065 return chtml40->out;
3070 * It is a handler who processes the OL tag.
3072 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3073 * destination is specified.
3074 * @param node [i] The OL tag node is specified.
3075 * @return The conversion result is returned.
3078 s_chtml40_start_ol_tag(void *pdoc, Node *node)
3084 char *attr_style = NULL;
3085 char *attr_start = NULL;
3086 char *attr_type = NULL;
3088 chtml40 = GET_CHTML40(pdoc);
3092 /*--------------------------------------------------------------------------*/
3093 /* Get Attributes */
3094 /*--------------------------------------------------------------------------*/
3095 for (attr = qs_get_attr(doc,node);
3097 attr = qs_get_next_attr(doc,attr)) {
3098 char *name = qs_get_attr_name(doc,attr);
3099 char *value = qs_get_attr_value(doc,attr);
3100 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3103 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3106 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3110 if (IS_CSS_ON(chtml40->entryp)) {
3111 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3113 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3114 css_property_t *cur;
3115 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3116 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3117 attr_type = apr_pstrdup(doc->pool, "1");
3119 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3120 attr_type = apr_pstrdup(doc->pool, "A");
3122 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3123 attr_type = apr_pstrdup(doc->pool, "a");
3141 return chtml40->out;
3146 * It is a handler who processes the OL tag.
3148 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3149 * destination is specified.
3150 * @param node [i] The OL tag node is specified.
3151 * @return The conversion result is returned.
3154 s_chtml40_end_ol_tag(void *pdoc, Node *UNUSED(node))
3156 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3157 Doc *doc = chtml40->doc;
3160 if (IS_CSS_ON(chtml40->entryp)) {
3161 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3164 return chtml40->out;
3169 * It is a handler who processes the LI tag.
3171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3172 * destination is specified.
3173 * @param node [i] The LI tag node is specified.
3174 * @return The conversion result is returned.
3177 s_chtml40_start_li_tag(void *pdoc, Node *node)
3179 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3180 Doc *doc = chtml40->doc;
3182 char *attr_type = NULL;
3183 char *attr_value = NULL;
3184 char *attr_style = NULL;
3186 /*--------------------------------------------------------------------------*/
3187 /* Get Attributes */
3188 /*--------------------------------------------------------------------------*/
3189 for (attr = qs_get_attr(doc,node);
3191 attr = qs_get_next_attr(doc,attr)) {
3192 char *name = qs_get_attr_name(doc,attr);
3193 char *value = qs_get_attr_value(doc,attr);
3194 if (STRCASEEQ('t','T',"type",name)) {
3195 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3199 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3202 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3206 if (IS_CSS_ON(chtml40->entryp)) {
3207 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3209 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3210 css_property_t *cur;
3211 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3212 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3213 attr_type = apr_pstrdup(doc->pool, "1");
3215 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3216 attr_type = apr_pstrdup(doc->pool, "A");
3218 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3219 attr_type = apr_pstrdup(doc->pool, "a");
3221 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3222 attr_type = apr_pstrdup(doc->pool, "disc");
3224 else if (STRCASEEQ('s','S',"square", cur->value)) {
3225 attr_type = apr_pstrdup(doc->pool, "square");
3227 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3228 attr_type = apr_pstrdup(doc->pool, "circle");
3246 return chtml40->out;
3251 * It is a handler who processes the LI tag.
3253 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3254 * destination is specified.
3255 * @param node [i] The LI tag node is specified.
3256 * @return The conversion result is returned.
3259 s_chtml40_end_li_tag(void *pdoc, Node *UNUSED(child))
3261 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3263 if (IS_CSS_ON(chtml40->entryp)) {
3264 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3266 return chtml40->out;
3271 * It is a handler who processes the H1 tag.
3273 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3274 * destination is specified.
3275 * @param node [i] The H1 tag node is specified.
3276 * @return The conversion result is returned.
3279 s_chtml40_start_h1_tag(void *pdoc, Node *node)
3285 char *attr_style = NULL;
3286 char *attr_align = NULL;
3288 chtml40 = GET_CHTML40(pdoc);
3292 for (attr = qs_get_attr(doc,node);
3294 attr = qs_get_next_attr(doc,attr)) {
3295 char *name = qs_get_attr_name(doc,attr);
3296 char *value = qs_get_attr_value(doc,attr);
3297 if (STRCASEEQ('a','A',"align", name)) {
3298 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3302 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3306 if (IS_CSS_ON(chtml40->entryp)) {
3307 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3309 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3310 css_property_t *cur;
3311 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3312 if (STRCASEEQ('l','L',"left", cur->value)) {
3313 attr_align = apr_pstrdup(doc->pool, "left");
3315 else if (STRCASEEQ('c','C',"center",cur->value)) {
3316 attr_align = apr_pstrdup(doc->pool, "center");
3318 else if (STRCASEEQ('r','R',"right",cur->value)) {
3319 attr_align = apr_pstrdup(doc->pool, "right");
3332 return chtml40->out;
3337 * It is a handler who processes the H1 tag.
3339 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3340 * destination is specified.
3341 * @param node [i] The H1 tag node is specified.
3342 * @return The conversion result is returned.
3345 s_chtml40_end_h1_tag(void *pdoc, Node *UNUSED(child))
3350 chtml40 = GET_CHTML40(pdoc);
3354 if (IS_CSS_ON(chtml40->entryp)) {
3355 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3358 return chtml40->out;
3363 * It is a handler who processes the H2 tag.
3365 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3366 * destination is specified.
3367 * @param node [i] The H2 tag node is specified.
3368 * @return The conversion result is returned.
3371 s_chtml40_start_h2_tag(void *pdoc, Node *node)
3377 char *attr_style = NULL;
3378 char *attr_align = NULL;
3380 chtml40 = GET_CHTML40(pdoc);
3384 for (attr = qs_get_attr(doc,node);
3386 attr = qs_get_next_attr(doc,attr)) {
3387 char *name = qs_get_attr_name(doc,attr);
3388 char *value = qs_get_attr_value(doc,attr);
3389 if (STRCASEEQ('a','A',"align", name)) {
3390 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3394 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3398 if (IS_CSS_ON(chtml40->entryp)) {
3399 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3401 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3402 css_property_t *cur;
3403 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3404 if (STRCASEEQ('l','L',"left", cur->value)) {
3405 attr_align = apr_pstrdup(doc->pool, "left");
3407 else if (STRCASEEQ('c','C',"center",cur->value)) {
3408 attr_align = apr_pstrdup(doc->pool, "center");
3410 else if (STRCASEEQ('r','R',"right",cur->value)) {
3411 attr_align = apr_pstrdup(doc->pool, "right");
3424 return chtml40->out;
3429 * It is a handler who processes the H2 tag.
3431 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3432 * destination is specified.
3433 * @param node [i] The H2 tag node is specified.
3434 * @return The conversion result is returned.
3437 s_chtml40_end_h2_tag(void *pdoc, Node *UNUSED(child))
3439 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3440 Doc *doc = chtml40->doc;
3443 if (IS_CSS_ON(chtml40->entryp)) {
3444 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3447 return chtml40->out;
3452 * It is a handler who processes the H3 tag.
3454 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3455 * destination is specified.
3456 * @param node [i] The H3 tag node is specified.
3457 * @return The conversion result is returned.
3460 s_chtml40_start_h3_tag(void *pdoc, Node *node)
3466 char *attr_style = NULL;
3467 char *attr_align = NULL;
3469 chtml40 = GET_CHTML40(pdoc);
3473 for (attr = qs_get_attr(doc,node);
3475 attr = qs_get_next_attr(doc,attr)) {
3476 char *name = qs_get_attr_name(doc,attr);
3477 char *value = qs_get_attr_value(doc,attr);
3478 if (STRCASEEQ('a','A',"align", name)) {
3479 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3483 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3487 if (IS_CSS_ON(chtml40->entryp)) {
3488 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3490 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3491 css_property_t *cur;
3492 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3493 if (STRCASEEQ('l','L',"left", cur->value)) {
3494 attr_align = apr_pstrdup(doc->pool, "left");
3496 else if (STRCASEEQ('c','C',"center",cur->value)) {
3497 attr_align = apr_pstrdup(doc->pool, "center");
3499 else if (STRCASEEQ('r','R',"right",cur->value)) {
3500 attr_align = apr_pstrdup(doc->pool, "right");
3513 return chtml40->out;
3518 * It is a handler who processes the H3 tag.
3520 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3521 * destination is specified.
3522 * @param node [i] The H3 tag node is specified.
3523 * @return The conversion result is returned.
3526 s_chtml40_end_h3_tag(void *pdoc, Node *UNUSED(child))
3528 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3529 Doc *doc = chtml40->doc;
3532 if (IS_CSS_ON(chtml40->entryp)) {
3533 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3536 return chtml40->out;
3541 * It is a handler who processes the H4 tag.
3543 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3544 * destination is specified.
3545 * @param node [i] The H4 tag node is specified.
3546 * @return The conversion result is returned.
3549 s_chtml40_start_h4_tag(void *pdoc, Node *node)
3555 char *attr_style = NULL;
3556 char *attr_align = NULL;
3558 chtml40 = GET_CHTML40(pdoc);
3562 for (attr = qs_get_attr(doc,node);
3564 attr = qs_get_next_attr(doc,attr)) {
3565 char *name = qs_get_attr_name(doc,attr);
3566 char *value = qs_get_attr_value(doc,attr);
3567 if (STRCASEEQ('a','A',"align", name)) {
3568 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3572 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3576 if (IS_CSS_ON(chtml40->entryp)) {
3577 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3579 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3580 css_property_t *cur;
3581 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3582 if (STRCASEEQ('l','L',"left", cur->value)) {
3583 attr_align = apr_pstrdup(doc->pool, "left");
3585 else if (STRCASEEQ('c','C',"center",cur->value)) {
3586 attr_align = apr_pstrdup(doc->pool, "center");
3588 else if (STRCASEEQ('r','R',"right",cur->value)) {
3589 attr_align = apr_pstrdup(doc->pool, "right");
3602 return chtml40->out;
3607 * It is a handler who processes the H4 tag.
3609 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3610 * destination is specified.
3611 * @param node [i] The H4 tag node is specified.
3612 * @return The conversion result is returned.
3615 s_chtml40_end_h4_tag(void *pdoc, Node *UNUSED(child))
3617 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3618 Doc *doc = chtml40->doc;
3621 if (IS_CSS_ON(chtml40->entryp)) {
3622 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3625 return chtml40->out;
3630 * It is a handler who processes the H5 tag.
3632 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3633 * destination is specified.
3634 * @param node [i] The H5 tag node is specified.
3635 * @return The conversion result is returned.
3638 s_chtml40_start_h5_tag(void *pdoc, Node *node)
3644 char *attr_style = NULL;
3645 char *attr_align = NULL;
3647 chtml40 = GET_CHTML40(pdoc);
3651 for (attr = qs_get_attr(doc,node);
3653 attr = qs_get_next_attr(doc,attr)) {
3654 char *name = qs_get_attr_name(doc,attr);
3655 char *value = qs_get_attr_value(doc,attr);
3656 if (STRCASEEQ('a','A',"align", name)) {
3657 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3661 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3665 if (IS_CSS_ON(chtml40->entryp)) {
3666 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3668 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3669 css_property_t *cur;
3670 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3671 if (STRCASEEQ('l','L',"left", cur->value)) {
3672 attr_align = apr_pstrdup(doc->pool, "left");
3674 else if (STRCASEEQ('c','C',"center",cur->value)) {
3675 attr_align = apr_pstrdup(doc->pool, "center");
3677 else if (STRCASEEQ('r','R',"right",cur->value)) {
3678 attr_align = apr_pstrdup(doc->pool, "right");
3691 return chtml40->out;
3696 * It is a handler who processes the H5 tag.
3698 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3699 * destination is specified.
3700 * @param node [i] The H5 tag node is specified.
3701 * @return The conversion result is returned.
3704 s_chtml40_end_h5_tag(void *pdoc, Node *UNUSED(child))
3706 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3707 Doc *doc = chtml40->doc;
3710 if (IS_CSS_ON(chtml40->entryp)) {
3711 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3714 return chtml40->out;
3719 * It is a handler who processes the H6 tag.
3721 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3722 * destination is specified.
3723 * @param node [i] The H6 tag node is specified.
3724 * @return The conversion result is returned.
3727 s_chtml40_start_h6_tag(void *pdoc, Node *node)
3733 char *attr_style = NULL;
3734 char *attr_align = NULL;
3736 chtml40 = GET_CHTML40(pdoc);
3740 for (attr = qs_get_attr(doc,node);
3742 attr = qs_get_next_attr(doc,attr)) {
3743 char *name = qs_get_attr_name(doc,attr);
3744 char *value = qs_get_attr_value(doc,attr);
3745 if (STRCASEEQ('a','A',"align", name)) {
3746 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3750 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3754 if (IS_CSS_ON(chtml40->entryp)) {
3755 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3757 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3758 css_property_t *cur;
3759 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3760 if (STRCASEEQ('l','L',"left", cur->value)) {
3761 attr_align = apr_pstrdup(doc->pool, "left");
3763 else if (STRCASEEQ('c','C',"center",cur->value)) {
3764 attr_align = apr_pstrdup(doc->pool, "center");
3766 else if (STRCASEEQ('r','R',"right",cur->value)) {
3767 attr_align = apr_pstrdup(doc->pool, "right");
3780 return chtml40->out;
3785 * It is a handler who processes the H6 tag.
3787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3788 * destination is specified.
3789 * @param node [i] The H6 tag node is specified.
3790 * @return The conversion result is returned.
3793 s_chtml40_end_h6_tag(void *pdoc, Node *UNUSED(child))
3795 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3796 Doc *doc = chtml40->doc;
3799 if (IS_CSS_ON(chtml40->entryp)) {
3800 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3803 return chtml40->out;
3808 * It is a handler who processes the TEXTARE tag.
3810 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3811 * destination is specified.
3812 * @param node [i] The TEXTAREA tag node is specified.
3813 * @return The conversion result is returned.
3816 s_chtml40_start_textarea_tag(void *pdoc, Node *node)
3822 char *attr_accesskey = NULL;
3823 char *attr_name = NULL;
3824 char *attr_rows = NULL;
3825 char *attr_cols = NULL;
3826 char *attr_istyle = NULL;
3827 char *attr_style = NULL;
3829 chtml40 = GET_CHTML40(pdoc);
3833 chtml40->textarea_flag++;
3835 for (attr = qs_get_attr(doc,node);
3837 attr = qs_get_next_attr(doc,attr)) {
3838 char *name = qs_get_attr_name(doc,attr);
3839 char *value = qs_get_attr_value(doc,attr);
3840 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3841 attr_accesskey = value;
3843 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3844 attr_istyle = value;
3846 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3849 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3852 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3855 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3859 if (IS_CSS_ON(chtml40->entryp)) {
3860 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
3862 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3863 css_property_t *cur;
3864 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3865 if (strcasestr(cur->value, "<ja:n>")) {
3868 else if (strcasestr(cur->value, "<ja:en>")) {
3871 else if (strcasestr(cur->value, "<ja:hk>")) {
3874 else if (strcasestr(cur->value, "<ja:h>")) {
3881 if (attr_accesskey) {
3882 W_L(" accesskey=\"");
3883 W_V(attr_accesskey);
3907 return chtml40->out;
3912 * It is a handler who processes the TEXTAREA tag.
3914 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3915 * destination is specified.
3916 * @param node [i] The TEXTAREA tag node is specified.
3917 * @return The conversion result is returned.
3920 s_chtml40_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3922 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3923 Doc *doc = chtml40->doc;
3926 chtml40->textarea_flag--;
3928 return chtml40->out;
3933 s_chtml40_chxjif_tag(void *pdoc, Node *node)
3940 chtml40 = GET_CHTML40(pdoc);
3944 for (child = qs_get_child_node(doc, node);
3946 child = qs_get_next_node(doc, child)) {
3948 s_chtml40_chxjif_tag(chtml40, child);
3956 s_chtml40_text_tag(void *pdoc, Node *child)
3968 apr_size_t z2h_input_len;
3970 chtml40 = GET_CHTML40(pdoc);
3974 textval = qs_get_node_value(doc,child);
3975 if (strlen(textval) == 0) {
3976 return chtml40->out;
3979 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3980 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3982 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3983 memset(one_byte, 0, sizeof(one_byte));
3986 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3988 int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out, child);
3990 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3995 if (is_sjis_kanji(textval[ii])) {
3996 one_byte[0] = textval[ii+0];
3997 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3998 one_byte[0] = textval[ii+1];
3999 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4002 else if (chtml40->pre_flag) {
4003 one_byte[0] = textval[ii+0];
4004 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4006 else if (chtml40->textarea_flag) {
4007 one_byte[0] = textval[ii+0];
4008 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4010 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4011 one_byte[0] = textval[ii+0];
4012 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4015 z2h_input_len = strlen(tdst);
4016 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml40->entryp);
4018 return chtml40->out;
4023 * It is a handler who processes the BLOCKQUOTE tag.
4025 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4026 * destination is specified.
4027 * @param node [i] The BLOCKQUOTE tag node is specified.
4028 * @return The conversion result is returned.
4031 s_chtml40_start_blockquote_tag(void *pdoc, Node *node)
4036 char *attr_style = NULL;
4037 char *attr_color = NULL;
4039 chtml40 = GET_CHTML40(pdoc);
4041 for (attr = qs_get_attr(doc,node);
4043 attr = qs_get_next_attr(doc,attr)) {
4044 char *nm = qs_get_attr_name(doc,attr);
4045 char *val = qs_get_attr_value(doc,attr);
4046 if (val && STRCASEEQ('s','S',"style", nm)) {
4050 if (IS_CSS_ON(chtml40->entryp)) {
4051 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4053 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4054 css_property_t *cur;
4055 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4056 if (cur->value && *cur->value) {
4057 attr_color = apr_pstrdup(doc->pool, cur->value);
4062 W_L("<blockquote>");
4063 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4064 memset(flg, 0, sizeof(*flg));
4066 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4067 W_L("<font color=\"");
4070 flg->with_font_flag = 1;
4072 node->userData = (void *)flg;
4073 return chtml40->out;
4078 * It is a handler who processes the BLOCKQUOTE tag.
4080 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4081 * destination is specified.
4082 * @param node [i] The BLOCKQUOTE tag node is specified.
4083 * @return The conversion result is returned.
4086 s_chtml40_end_blockquote_tag(void *pdoc, Node *node)
4088 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4089 Doc *doc = chtml40->doc;
4090 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4091 if (flg && flg->with_font_flag) {
4094 W_L("</blockquote>");
4095 if (IS_CSS_ON(chtml40->entryp)) {
4096 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4098 return chtml40->out;
4103 * It is a handler who processes the DIR tag.
4105 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4106 * destination is specified.
4107 * @param node [i] The DIR tag node is specified.
4108 * @return The conversion result is returned.
4111 s_chtml40_start_dir_tag(void *pdoc, Node *node)
4113 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4114 Doc *doc = chtml40->doc;
4116 char *attr_style = NULL;
4117 char *attr_color = NULL;
4118 char *attr_type = NULL;
4119 for (attr = qs_get_attr(doc,node);
4121 attr = qs_get_next_attr(doc,attr)) {
4122 char *name = qs_get_attr_name(doc,attr);
4123 char *value = qs_get_attr_value(doc,attr);
4124 if (STRCASEEQ('t','T',"type",name)) {
4125 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4129 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4133 CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE();
4141 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4142 memset(flg, 0, sizeof(*flg));
4144 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4145 W_L("<font color=\"");
4148 flg->with_font_flag = 1;
4150 node->userData = (void *)flg;
4151 return chtml40->out;
4156 * It is a handler who processes the DIR tag.
4158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4159 * destination is specified.
4160 * @param node [i] The DIR tag node is specified.
4161 * @return The conversion result is returned.
4164 s_chtml40_end_dir_tag(void *pdoc, Node *node)
4166 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4167 Doc *doc = chtml40->doc;
4168 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4169 if (flg && flg->with_font_flag) {
4173 if (IS_CSS_ON(chtml40->entryp)) {
4174 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4176 return chtml40->out;
4181 * It is a handler who processes the DL tag.
4183 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4184 * destination is specified.
4185 * @param node [i] The DL tag node is specified.
4186 * @return The conversion result is returned.
4189 s_chtml40_start_dl_tag(void *pdoc, Node *node)
4194 char *attr_style = NULL;
4195 char *attr_color = NULL;
4197 chtml40 = GET_CHTML40(pdoc);
4199 for (attr = qs_get_attr(doc,node);
4201 attr = qs_get_next_attr(doc,attr)) {
4202 char *nm = qs_get_attr_name(doc,attr);
4203 char *val = qs_get_attr_value(doc,attr);
4204 if (val && STRCASEEQ('s','S',"style", nm)) {
4208 if (IS_CSS_ON(chtml40->entryp)) {
4209 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4211 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4212 css_property_t *cur;
4213 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4214 if (cur->value && *cur->value) {
4215 attr_color = apr_pstrdup(doc->pool, cur->value);
4221 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4222 memset(flg, 0, sizeof(*flg));
4224 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4225 W_L("<font color=\"");
4228 flg->with_font_flag = 1;
4230 node->userData = (void *)flg;
4231 return chtml40->out;
4236 * It is a handler who processes the DL tag.
4238 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4239 * destination is specified.
4240 * @param node [i] The DL tag node is specified.
4241 * @return The conversion result is returned.
4244 s_chtml40_end_dl_tag(void *pdoc, Node *node)
4246 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4247 Doc *doc = chtml40->doc;
4248 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4249 if (flg && flg->with_font_flag) {
4253 if (IS_CSS_ON(chtml40->entryp)) {
4254 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4256 return chtml40->out;
4261 * It is a handler who processes the DT tag.
4263 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4264 * destination is specified.
4265 * @param node [i] The DT tag node is specified.
4266 * @return The conversion result is returned.
4269 s_chtml40_start_dt_tag(void *pdoc, Node *node)
4274 char *attr_style = NULL;
4275 char *attr_color = NULL;
4277 chtml40 = GET_CHTML40(pdoc);
4279 for (attr = qs_get_attr(doc,node);
4281 attr = qs_get_next_attr(doc,attr)) {
4282 char *nm = qs_get_attr_name(doc,attr);
4283 char *val = qs_get_attr_value(doc,attr);
4284 if (val && STRCASEEQ('s','S',"style", nm)) {
4288 if (IS_CSS_ON(chtml40->entryp)) {
4289 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4291 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4292 css_property_t *cur;
4293 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4294 if (cur->value && *cur->value) {
4295 attr_color = apr_pstrdup(doc->pool, cur->value);
4301 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4302 memset(flg, 0, sizeof(*flg));
4304 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4305 W_L("<font color=\"");
4308 flg->with_font_flag = 1;
4310 node->userData = (void *)flg;
4311 return chtml40->out;
4316 * It is a handler who processes the DT tag.
4318 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4319 * destination is specified.
4320 * @param node [i] The DT tag node is specified.
4321 * @return The conversion result is returned.
4324 s_chtml40_end_dt_tag(void *pdoc, Node *node)
4326 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4327 Doc *doc = chtml40->doc;
4328 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4329 if (flg && flg->with_font_flag) {
4332 if (IS_CSS_ON(chtml40->entryp)) {
4333 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4335 return chtml40->out;
4340 * It is a handler who processes the DD tag.
4342 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4343 * destination is specified.
4344 * @param node [i] The DD tag node is specified.
4345 * @return The conversion result is returned.
4348 s_chtml40_start_dd_tag(void *pdoc, Node *node)
4353 char *attr_style = NULL;
4354 char *attr_color = NULL;
4356 chtml40 = GET_CHTML40(pdoc);
4358 for (attr = qs_get_attr(doc,node);
4360 attr = qs_get_next_attr(doc,attr)) {
4361 char *nm = qs_get_attr_name(doc,attr);
4362 char *val = qs_get_attr_value(doc,attr);
4363 if (val && STRCASEEQ('s','S',"style", nm)) {
4367 if (IS_CSS_ON(chtml40->entryp)) {
4368 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4370 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4371 css_property_t *cur;
4372 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4373 if (cur->value && *cur->value) {
4374 attr_color = apr_pstrdup(doc->pool, cur->value);
4380 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4381 memset(flg, 0, sizeof(*flg));
4383 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4384 W_L("<font color=\"");
4387 flg->with_font_flag = 1;
4389 node->userData = (void *)flg;
4390 return chtml40->out;
4395 * It is a handler who processes the DD tag.
4397 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4398 * destination is specified.
4399 * @param node [i] The DD tag node is specified.
4400 * @return The conversion result is returned.
4403 s_chtml40_end_dd_tag(void *pdoc, Node *node)
4405 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4406 Doc *doc = chtml40->doc;
4407 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4408 if (flg && flg->with_font_flag) {
4411 if (IS_CSS_ON(chtml40->entryp)) {
4412 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4414 return chtml40->out;
4419 * It is a handler who processes the MARQUEE tag.
4421 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4422 * destination is specified.
4423 * @param node [i] The MARQUEE tag node is specified.
4424 * @return The conversion result is returned.
4427 s_chtml40_start_marquee_tag(void *pdoc, Node *node)
4429 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4430 Doc *doc = chtml40->doc;
4432 char *attr_direction = NULL;
4433 char *attr_behavior = NULL;
4434 char *attr_loop = NULL;
4435 char *attr_style = NULL;
4436 char *attr_color = NULL;
4437 /*--------------------------------------------------------------------------*/
4438 /* Get Attributes */
4439 /*--------------------------------------------------------------------------*/
4440 for (attr = qs_get_attr(doc,node);
4442 attr = qs_get_next_attr(doc,attr)) {
4443 char *name = qs_get_attr_name(doc,attr);
4444 char *value = qs_get_attr_value(doc,attr);
4445 if (STRCASEEQ('d','D',"direction", name)) {
4446 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4447 attr_direction = value;
4450 else if (STRCASEEQ('b','B',"behavior",name)) {
4451 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4452 attr_behavior = value;
4455 else if (STRCASEEQ('l','L',"loop",name)) {
4456 if (value && *value) {
4460 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4464 if (IS_CSS_ON(chtml40->entryp)) {
4465 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4467 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4468 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4469 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4470 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4471 css_property_t *cur;
4472 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4473 if (cur->value && *cur->value) {
4474 attr_color = apr_pstrdup(doc->pool, cur->value);
4477 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4478 if (cur->value && *cur->value) {
4479 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4482 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4483 if (cur->value && *cur->value) {
4484 attr_loop = apr_pstrdup(doc->pool, cur->value);
4485 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4490 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4491 if (cur->value && *cur->value) {
4492 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4493 attr_direction = "right";
4495 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4496 attr_direction = "left";
4503 if (attr_direction) {
4504 W_L(" direction=\"");
4505 W_V(attr_direction);
4508 if (attr_behavior) {
4509 W_L(" behavior=\"");
4520 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4521 memset(flg, 0, sizeof(*flg));
4523 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4524 W_L("<font color=\"");
4527 flg->with_font_flag = 1;
4529 node->userData = (void *)flg;
4530 return chtml40->out;
4535 * It is a handler who processes the MARQUEE tag.
4537 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4538 * destination is specified.
4539 * @param node [i] The MARQUEE tag node is specified.
4540 * @return The conversion result is returned.
4543 s_chtml40_end_marquee_tag(void *pdoc, Node *node)
4545 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4546 Doc *doc = chtml40->doc;
4547 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4548 if (flg && flg->with_font_flag) {
4552 if (IS_CSS_ON(chtml40->entryp)) {
4553 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4555 return chtml40->out;
4560 * It is a handler who processes the BLINK tag.
4562 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4563 * destination is specified.
4564 * @param node [i] The BLINK tag node is specified.
4565 * @return The conversion result is returned.
4568 s_chtml40_start_blink_tag(void *pdoc, Node *node)
4573 char *attr_style = NULL;
4574 char *attr_color = NULL;
4576 chtml40 = GET_CHTML40(pdoc);
4578 for (attr = qs_get_attr(doc,node);
4580 attr = qs_get_next_attr(doc,attr)) {
4581 char *nm = qs_get_attr_name(doc,attr);
4582 char *val = qs_get_attr_value(doc,attr);
4583 if (val && STRCASEEQ('s','S',"style", nm)) {
4587 if (IS_CSS_ON(chtml40->entryp)) {
4588 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4590 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4591 css_property_t *cur;
4592 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4593 if (cur->value && *cur->value) {
4594 attr_color = apr_pstrdup(doc->pool, cur->value);
4600 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4601 memset(flg, 0, sizeof(*flg));
4603 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4604 W_L("<font color=\"");
4607 flg->with_font_flag = 1;
4609 node->userData = (void *)flg;
4610 return chtml40->out;
4615 * It is a handler who processes the BLINK tag.
4617 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4618 * destination is specified.
4619 * @param node [i] The BLINK tag node is specified.
4620 * @return The conversion result is returned.
4623 s_chtml40_end_blink_tag(void *pdoc, Node *node)
4625 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4626 Doc *doc = chtml40->doc;
4627 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4628 if (flg && flg->with_font_flag) {
4632 if (IS_CSS_ON(chtml40->entryp)) {
4633 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4635 return chtml40->out;
4640 * It is a handler who processes the MENU tag.
4642 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4643 * destination is specified.
4644 * @param node [i] The MENU tag node is specified.
4645 * @return The conversion result is returned.
4648 s_chtml40_start_menu_tag(void *pdoc, Node *node)
4650 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4651 Doc *doc = chtml40->doc;
4653 char *attr_style = NULL;
4654 char *attr_type = NULL;
4655 char *attr_color = NULL;
4656 /*--------------------------------------------------------------------------*/
4657 /* Get Attributes */
4658 /*--------------------------------------------------------------------------*/
4659 for (attr = qs_get_attr(doc,node);
4661 attr = qs_get_next_attr(doc,attr)) {
4662 char *name = qs_get_attr_name(doc,attr);
4663 char *value = qs_get_attr_value(doc,attr);
4664 if (STRCASEEQ('t','T',"type",name)) {
4665 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4669 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4673 CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE();
4681 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4682 memset(flg, 0, sizeof(*flg));
4684 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4685 W_L("<font color=\"");
4688 flg->with_font_flag = 1;
4690 node->userData = (void *)flg;
4692 return chtml40->out;
4697 * It is a handler who processes the MENU tag.
4699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4700 * destination is specified.
4701 * @param node [i] The MENU tag node is specified.
4702 * @return The conversion result is returned.
4705 s_chtml40_end_menu_tag(void *pdoc, Node *node)
4707 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4708 Doc *doc = chtml40->doc;
4709 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4710 if (flg && flg->with_font_flag) {
4714 if (IS_CSS_ON(chtml40->entryp)) {
4715 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4717 return chtml40->out;
4722 * It is a handler who processes the PLAINTEXT tag.
4724 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4725 * destination is specified.
4726 * @param node [i] The PLAINTEXT tag node is specified.
4727 * @return The conversion result is returned.
4730 s_chtml40_start_plaintext_tag(void *pdoc, Node *node)
4732 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4733 Doc *doc = chtml40->doc;
4735 s_chtml40_start_plaintext_tag_inner(pdoc,node);
4736 return chtml40->out;
4740 s_chtml40_start_plaintext_tag_inner(void *pdoc, Node *node)
4742 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4743 Doc *doc = chtml40->doc;
4745 for (child = qs_get_child_node(doc, node);
4747 child = qs_get_next_node(doc, child)) {
4749 s_chtml40_start_plaintext_tag_inner(pdoc, child);
4751 return chtml40->out;
4756 * It is a handler who processes the PLAINTEXT tag.
4758 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4759 * destination is specified.
4760 * @param node [i] The PLAINTEXT tag node is specified.
4761 * @return The conversion result is returned.
4764 s_chtml40_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4766 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4767 return chtml40->out;
4772 * It is handler who processes the New Line Code.
4775 s_chtml40_newline_mark(void *pdoc, Node *UNUSED(node))
4777 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4778 Doc *doc = chtml40->doc;
4780 return chtml40->out;
4785 * It is a handler who processes the LINK tag.
4787 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4788 * destination is specified.
4789 * @param node [i] The LINK tag node is specified.
4790 * @return The conversion result is returned.
4793 s_chtml40_link_tag(void *pdoc, Node *node)
4802 chtml40 = GET_CHTML40(pdoc);
4805 if (! IS_CSS_ON(chtml40->entryp)) {
4806 return chtml40->out;
4809 for (attr = qs_get_attr(doc,node);
4811 attr = qs_get_next_attr(doc,attr)) {
4812 char *name = qs_get_attr_name(doc,attr);
4813 char *value = qs_get_attr_value(doc,attr);
4814 if (STRCASEEQ('r','R',"rel", name)) {
4815 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4819 else if (STRCASEEQ('h','H',"href", name)) {
4820 if (value && *value) {
4824 else if (STRCASEEQ('t','T',"type", name)) {
4825 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4831 if (rel && href && type) {
4832 DBG(doc->r, "start load CSS. url:[%s]", href);
4833 chtml40->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml40->style, href);
4834 DBG(doc->r, "end load CSS. url:[%s]", href);
4837 return chtml40->out;
4840 static css_prop_list_t *
4841 s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4843 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4844 Doc *doc = chtml40->doc;
4845 css_prop_list_t *last_css = NULL;
4846 if (IS_CSS_ON(chtml40->entryp)) {
4847 css_prop_list_t *dup_css;
4848 css_selector_t *selector;
4850 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4851 dup_css = chxj_dup_css_prop_list(doc, last_css);
4852 selector = chxj_css_find_selector(doc, chtml40->style, node);
4854 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4856 chxj_css_push_prop_list(chtml40->css_prop_stack, dup_css);
4857 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4859 if (style_attr_value) {
4860 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));
4862 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4870 static css_prop_list_t *
4871 s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4873 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4874 Doc *doc = chtml40->doc;
4875 css_prop_list_t *last_css = NULL;
4876 if (IS_CSS_ON(chtml40->entryp)) {
4877 css_prop_list_t *dup_css;
4878 css_selector_t *selector;
4880 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4881 dup_css = chxj_dup_css_prop_list(doc, last_css);
4882 selector = chxj_css_find_selector(doc, chtml40->style, node);
4884 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4888 if (style_attr_value) {
4889 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));
4891 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4901 * It is a handler who processes the SPAN tag.
4903 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4904 * destination is specified.
4905 * @param node [i] The SPAN tag node is specified.
4906 * @return The conversion result is returned.
4909 s_chtml40_start_span_tag(void *pdoc, Node *node)
4914 char *attr_style = NULL;
4915 char *attr_color = NULL;
4916 char *attr_align = NULL;
4917 char *attr_blink = NULL;
4918 char *attr_marquee = NULL;
4919 char *attr_marquee_dir = NULL;
4920 char *attr_marquee_style = NULL;
4921 char *attr_marquee_loop = NULL;
4923 chtml40 = GET_CHTML40(pdoc);
4926 for (attr = qs_get_attr(doc,node);
4928 attr = qs_get_next_attr(doc,attr)) {
4929 char *nm = qs_get_attr_name(doc,attr);
4930 char *val = qs_get_attr_value(doc,attr);
4931 if (val && STRCASEEQ('s','S',"style", nm)) {
4935 if (IS_CSS_ON(chtml40->entryp)) {
4936 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4938 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4939 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4940 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4941 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4942 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4943 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4944 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4945 css_property_t *cur;
4946 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4947 attr_color = apr_pstrdup(doc->pool, cur->value);
4949 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4950 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4951 attr_blink = apr_pstrdup(doc->pool, cur->value);
4954 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4955 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4956 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4959 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4960 if (cur->value && *cur->value) {
4961 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4962 attr_marquee_dir = "right";
4964 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4965 attr_marquee_dir = "left";
4969 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4970 if (cur->value && *cur->value) {
4971 if ( STRCASEEQ('s','S',"scroll",cur->value)
4972 || STRCASEEQ('s','S',"slide",cur->value)
4973 || STRCASEEQ('a','A',"alternate",cur->value)) {
4974 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4978 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4979 if (cur->value && *cur->value) {
4980 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4981 attr_marquee_loop = "16";
4984 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4988 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4989 if (STRCASEEQ('l','L',"left", cur->value)) {
4990 attr_align = apr_pstrdup(doc->pool, "left");
4992 else if (STRCASEEQ('c','C',"center",cur->value)) {
4993 attr_align = apr_pstrdup(doc->pool, "center");
4995 else if (STRCASEEQ('r','R',"right",cur->value)) {
4996 attr_align = apr_pstrdup(doc->pool, "right");
5001 if (attr_color || attr_align || attr_blink || attr_marquee) {
5002 chtml40_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5003 memset(flg, 0, sizeof(*flg));
5006 flg->with_blink_flag = 1;
5010 if (attr_marquee_dir) {
5011 W_L(" direction=\"");
5012 W_V(attr_marquee_dir);
5015 if (attr_marquee_style) {
5016 W_L(" behavior=\"");
5017 W_V(attr_marquee_style);
5020 if (attr_marquee_loop) {
5022 W_V(attr_marquee_loop);
5026 flg->with_marquee_flag = 1;
5029 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5030 W_L("<font color=\"");
5033 flg->with_font_flag = 1;
5036 W_L("<div align=\"");
5039 flg->with_div_flag = 1;
5041 node->userData = flg;
5044 node->userData = NULL;
5046 return chtml40->out;
5051 * It is a handler who processes the SPAN tag.
5053 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5054 * destination is specified.
5055 * @param node [i] The SPAN tag node is specified.
5056 * @return The conversion result is returned.
5059 s_chtml40_end_span_tag(void *pdoc, Node *node)
5061 chtml40_t *chtml40 = GET_CHTML40(pdoc);
5062 Doc *doc = chtml40->doc;
5064 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
5065 if (flg && flg->with_div_flag) {
5068 if (flg && flg->with_font_flag) {
5071 if (flg && flg->with_marquee_flag) {
5074 if (flg && flg->with_blink_flag) {
5077 if (IS_CSS_ON(chtml40->entryp)) {
5078 chxj_css_pop_prop_list(chtml40->css_prop_stack);
5080 return chtml40->out;
5085 * It is a handler who processes the STYLE tag.
5087 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5088 * destination is specified.
5089 * @param node [i] The STYLE tag node is specified.
5090 * @return The conversion result is returned.
5093 s_chtml40_style_tag(void *pdoc, Node *node)
5100 chtml40 = GET_CHTML40(pdoc);
5103 if (! IS_CSS_ON(chtml40->entryp)) {
5104 return chtml40->out;
5107 for (attr = qs_get_attr(doc,node);
5109 attr = qs_get_next_attr(doc,attr)) {
5110 char *name = qs_get_attr_name(doc,attr);
5111 char *value = qs_get_attr_value(doc,attr);
5112 if (STRCASEEQ('t','T',"type", name)) {
5113 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5119 Node *child = qs_get_child_node(doc, node);
5120 if (type && child) {
5121 char *name = qs_get_node_name(doc, child);
5122 if (STRCASEEQ('t','T',"text", name)) {
5123 char *value = qs_get_node_value(doc, child);
5124 DBG(doc->r, "start load CSS. buf:[%s]", value);
5125 chtml40->style = chxj_css_parse_style_value(doc, chtml40->style, value);
5126 DBG(doc->r, "end load CSS. value:[%s]", value);
5129 return chtml40->out;