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);
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,
436 * converts from CHTML5.0 to CHTML3.0.
438 * @param r [i] Requet_rec is appointed.
439 * @param spec [i] The result of the device specification processing which
440 * was done in advance is appointed.
441 * @param src [i] The character string before the converting is appointed.
442 * @return The character string after the converting is returned.
445 chxj_convert_chtml40(
451 chxjconvrule_entry *entryp,
460 DBG(r, "start chxj_convert_chtml40()");
462 /*--------------------------------------------------------------------------*/
464 /*--------------------------------------------------------------------------*/
466 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
468 DBG(r,"i found qrcode xml");
469 DBG(r, "end chxj_convert_chtml40()");
472 DBG(r,"not found qrcode xml");
474 /*--------------------------------------------------------------------------*/
475 /* The CHTML structure is initialized. */
476 /*--------------------------------------------------------------------------*/
477 s_init_chtml40(&chtml40, &doc, r, spec);
479 chtml40.entryp = entryp;
480 chtml40.cookie = cookie;
482 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
484 /*--------------------------------------------------------------------------*/
485 /* The character string of the input is analyzed. */
486 /*--------------------------------------------------------------------------*/
487 qs_init_malloc(&doc);
488 qs_init_root_node(&doc);
490 ss = apr_pcalloc(r->pool, srclen + 1);
491 memset(ss, 0, srclen + 1);
492 memcpy(ss, src, srclen);
495 chxj_dump_out("[src] CHTML -> CHTML4.0", ss, srclen);
497 if (IS_CSS_ON(chtml40.entryp)) {
498 /* current property list */
499 chtml40.css_prop_stack = chxj_new_prop_list_stack(&doc);
502 chxj_buffered_write_init(r->pool, &doc.buf);
504 qs_parse_string(&doc,ss, strlen(ss));
506 /*--------------------------------------------------------------------------*/
507 /* It converts it from CHTML to CHTML. */
508 /*--------------------------------------------------------------------------*/
509 chxj_node_convert(spec,r,(void*)&chtml40, &doc, qs_get_root(&doc), 0);
510 chtml40.out = chxj_buffered_write_flush(chtml40.out, &doc.buf);
511 dst = apr_pstrdup(r->pool, chtml40.out);
512 chxj_buffered_write_terminate(&doc.buf);
514 qs_all_free(&doc,QX_LOGMARK);
517 dst = apr_pstrdup(r->pool,ss);
519 if (strlen(dst) == 0) {
520 dst = apr_psprintf(r->pool, "\n");
523 *dstlen = strlen(dst);
526 chxj_dump_out("[src] CHTML -> CHTML4.0", dst, *dstlen);
529 DBG(r, "end chxj_convert_chtml40()");
535 * The CHTML structure is initialized.
537 * @param chtml40 [i/o] The pointer to the HDML structure that wants to be
538 * initialized is specified.
539 * @param doc [i] The Doc structure that should be set to the initialized
540 * HDML structure is specified.
541 * @param r [i] To use POOL, the pointer to request_rec is specified.
542 * @param spec [i] The pointer to the device_table
545 s_init_chtml40(chtml40_t *chtml40, Doc *doc, request_rec *r, device_table *spec)
547 memset(doc, 0, sizeof(Doc));
548 memset(chtml40, 0, sizeof(chtml40_t));
552 chtml40->spec = spec;
553 chtml40->out = qs_alloc_zero_byte_string(r->pool);
554 chtml40->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
555 chtml40->doc->parse_mode = PARSE_MODE_CHTML;
560 * Corresponding EMOJI to a current character-code is retrieved.
561 * The substitution character string is stored in the rslt pointer if agreeing.
563 * @param chtml40 [i] The pointer to the CHTML structure is specified.
564 * @param txt [i] The character string to want to examine whether it is
565 * EMOJI is specified.
566 * @param rslt [o] The pointer to the pointer that stores the result is
568 * @return When corresponding EMOJI exists, it returns it excluding 0.
571 s_chtml40_search_emoji(chtml40_t *chtml40, char *txt, char **rslt)
578 spec = chtml40->spec;
584 DBG(r,"spec is NULL");
587 for (ee = chtml40->conf->emoji;
590 if (ee->imode == NULL) {
591 DBG(r, "emoji->imode is NULL");
595 if (ee->imode->string != NULL
596 && strlen(ee->imode->string) > 0
597 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
599 if (spec == NULL || spec->emoji_type == NULL) {
600 *rslt = apr_palloc(r->pool, 3);
601 (*rslt)[0] = ee->imode->hex1byte & 0xff;
602 (*rslt)[1] = ee->imode->hex2byte & 0xff;
604 return strlen(ee->imode->string);
616 chxj_chtml40_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
627 chtml40 = &__chtml40;
630 DBG(r, "REQ[%X] start chxj_chtml40_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
631 memset(doc, 0, sizeof(Doc));
632 memset(chtml40, 0, sizeof(chtml40_t));
636 chtml40->spec = spec;
637 chtml40->out = qs_alloc_zero_byte_string(r->pool);
638 chtml40->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
639 chtml40->doc->parse_mode = PARSE_MODE_CHTML;
641 apr_pool_create(&pool, r->pool);
643 chxj_buffered_write_init(pool, &doc->buf);
645 for (ii=0; ii<len; ii++) {
649 rtn = s_chtml40_search_emoji(chtml40, (char *)&src[ii], &out);
656 if (is_sjis_kanji(src[ii])) {
657 two_byte[0] = src[ii+0];
658 two_byte[1] = src[ii+1];
664 one_byte[0] = src[ii+0];
669 chtml40->out = chxj_buffered_write_flush(chtml40->out, &doc->buf);
671 DBG(r, "REQ[%X] end chxj_chtml40_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
677 * It is a handler who processes the HTML tag.
679 * @param pdoc [i/o] The pointer to the CHTML structure at the output
680 * destination is specified.
681 * @param node [i] The HTML tag node is specified.
682 * @return The conversion result is returned.
685 s_chtml40_start_html_tag(void *pdoc, Node *UNUSED(node))
687 chtml40_t *chtml40 = GET_CHTML40(pdoc);
688 Doc *doc = chtml40->doc;
690 /*--------------------------------------------------------------------------*/
692 /*--------------------------------------------------------------------------*/
700 * It is a handler who processes the HTML tag.
702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
703 * destination is specified.
704 * @param node [i] The HTML tag node is specified.
705 * @return The conversion result is returned.
708 s_chtml40_end_html_tag(void *pdoc, Node *UNUSED(child))
710 chtml40_t *chtml40 = GET_CHTML40(pdoc);
711 Doc *doc = chtml40->doc;
719 * It is a handler who processes the META tag.
721 * @param pdoc [i/o] The pointer to the CHTML structure at the output
722 * destination is specified.
723 * @param node [i] The META tag node is specified.
724 * @return The conversion result is returned.
727 s_chtml40_start_meta_tag(void *pdoc, Node *node)
733 int content_type_flag;
736 chtml40 = GET_CHTML40(pdoc);
740 content_type_flag = 0;
744 /*--------------------------------------------------------------------------*/
746 /*--------------------------------------------------------------------------*/
747 for (attr = qs_get_attr(doc,node);
749 attr = qs_get_next_attr(doc,attr)) {
750 char *name = qs_get_attr_name(doc,attr);
751 char *value = qs_get_attr_value(doc,attr);
755 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
756 /*----------------------------------------------------------------------*/
758 /*----------------------------------------------------------------------*/
759 W_L(" http-equiv=\"");
762 if (STRCASEEQ('c','C',"content-type", value))
763 content_type_flag = 1;
765 if (STRCASEEQ('r','R',"refresh", value))
772 if (strcasecmp(name, "content") == 0 && value && *value) {
773 if (content_type_flag) {
777 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
785 buf = apr_pstrdup(r->pool, value);
786 url = strchr(buf, ';');
788 sec = apr_pstrdup(r->pool, buf);
791 url = chxj_encoding_parameter(r, url, 0);
792 url = chxj_add_cookie_parameter(r, url, chtml40->cookie);
822 * It is a handler who processes the META tag.
824 * @param pdoc [i/o] The pointer to the CHTML structure at the output
825 * destination is specified.
826 * @param node [i] The META tag node is specified.
827 * @return The conversion result is returned.
830 s_chtml40_end_meta_tag(void* pdoc, Node* UNUSED(child))
832 chtml40_t *chtml40 = GET_CHTML40(pdoc);
839 * It is a handler who processes the HEAD tag.
841 * @param pdoc [i/o] The pointer to the CHTML structure at the output
842 * destination is specified.
843 * @param node [i] The HEAD tag node is specified.
844 * @return The conversion result is returned.
847 s_chtml40_start_head_tag(void* pdoc, Node* UNUSED(node))
849 chtml40_t *chtml40 = GET_CHTML40(pdoc);
850 Doc *doc = chtml40->doc;
859 * It is a handler who processes the HEAD tag.
861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
862 * destination is specified.
863 * @param node [i] The HEAD tag node is specified.
864 * @return The conversion result is returned.
867 s_chtml40_end_head_tag(void *pdoc, Node *UNUSED(node))
869 chtml40_t *chtml40 = GET_CHTML40(pdoc);
870 Doc *doc = chtml40->doc;
879 * It is a handler who processes the TITLE tag.
881 * @param pdoc [i/o] The pointer to the CHTML structure at the output
882 * destination is specified.
883 * @param node [i] The TITLE tag node is specified.
884 * @return The conversion result is returned.
887 s_chtml40_start_title_tag(void *pdoc, Node *UNUSED(node))
889 chtml40_t *chtml40 = GET_CHTML40(pdoc);
890 Doc *doc = chtml40->doc;
899 * It is a handler who processes the TITLE tag.
901 * @param pdoc [i/o] The pointer to the CHTML structure at the output
902 * destination is specified.
903 * @param node [i] The TITLE tag node is specified.
904 * @return The conversion result is returned.
907 s_chtml40_end_title_tag(void *pdoc, Node *UNUSED(child))
909 chtml40_t *chtml40 = GET_CHTML40(pdoc);
910 Doc *doc = chtml40->doc;
919 * It is a handler who processes the BASE tag.
921 * @param pdoc [i/o] The pointer to the CHTML structure at the output
922 * destination is specified.
923 * @param node [i] The BASE tag node is specified.
924 * @return The conversion result is returned.
927 s_chtml40_start_base_tag(void *pdoc, Node *node)
934 chtml40 = GET_CHTML40(pdoc);
939 /*--------------------------------------------------------------------------*/
941 /*--------------------------------------------------------------------------*/
942 for (attr = qs_get_attr(doc,node);
944 attr = qs_get_next_attr(doc,attr)) {
945 char *name = qs_get_attr_name(doc,attr);
946 char *value = qs_get_attr_value(doc,attr);
947 if (STRCASEEQ('h','H',"href", name)) {
960 * It is a handler who processes the BASE tag.
962 * @param pdoc [i/o] The pointer to the CHTML structure at the output
963 * destination is specified.
964 * @param node [i] The BASE tag node is specified.
965 * @return The conversion result is returned.
968 s_chtml40_end_base_tag(void *pdoc, Node *UNUSED(child))
970 chtml40_t *chtml40 = GET_CHTML40(pdoc);
977 * It is a handler who processes the BODY tag.
979 * @param pdoc [i/o] The pointer to the CHTML structure at the output
980 * destination is specified.
981 * @param node [i] The BODY tag node is specified.
982 * @return The conversion result is returned.
985 s_chtml40_start_body_tag(void *pdoc, Node *node)
991 char *attr_bgcolor = NULL;
992 char *attr_text = NULL;
993 char *attr_link = NULL;
994 char *attr_style = NULL;
995 char *attr_alink = NULL;
996 char *attr_vlink = NULL;
999 chtml40 = GET_CHTML40(pdoc);
1003 /*--------------------------------------------------------------------------*/
1004 /* Get Attributes */
1005 /*--------------------------------------------------------------------------*/
1006 for (attr = qs_get_attr(doc,node);
1008 attr = qs_get_next_attr(doc,attr)) {
1009 char *name = qs_get_attr_name(doc,attr);
1010 char *value = qs_get_attr_value(doc,attr);
1011 if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
1012 /*----------------------------------------------------------------------*/
1014 /*----------------------------------------------------------------------*/
1015 attr_bgcolor = value;
1017 else if (STRCASEEQ('t','T', "text", name) && value && *value) {
1018 /*----------------------------------------------------------------------*/
1020 /*----------------------------------------------------------------------*/
1023 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1024 /*----------------------------------------------------------------------*/
1026 /*----------------------------------------------------------------------*/
1029 else if (STRCASEEQ('a','A',"alink", name) && value && *value) {
1030 /*----------------------------------------------------------------------*/
1032 /*----------------------------------------------------------------------*/
1035 else if (STRCASEEQ('v','V',"vlink", name) && value && *value) {
1036 /*----------------------------------------------------------------------*/
1038 /*----------------------------------------------------------------------*/
1041 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1046 if (IS_CSS_ON(chtml40->entryp)) {
1047 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1049 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1050 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1051 css_property_t *cur;
1052 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1053 if (cur->value && *cur->value) {
1054 attr_text = apr_pstrdup(doc->pool, cur->value);
1057 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1058 if (cur->value && *cur->value) {
1059 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1063 if (chtml40->style) {
1064 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml40->style);
1065 css_selector_t *cur_sel;
1066 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1067 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1068 css_property_t *cur;
1069 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1070 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1071 attr_link = apr_pstrdup(doc->pool, cur->value);
1075 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1076 css_property_t *cur;
1077 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1078 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1079 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1083 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
1084 css_property_t *cur;
1085 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1086 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1087 attr_alink = apr_pstrdup(doc->pool, cur->value);
1097 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1103 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1109 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1115 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1121 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1128 return chtml40->out;
1133 * It is a handler who processes the BODY tag.
1135 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1136 * destination is specified.
1137 * @param node [i] The BODY tag node is specified.
1138 * @return The conversion result is returned.
1141 s_chtml40_end_body_tag(void *pdoc, Node *UNUSED(child))
1146 chtml40 = GET_CHTML40(pdoc);
1150 if (IS_CSS_ON(chtml40->entryp)) {
1151 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1154 return chtml40->out;
1159 * It is a handler who processes the A tag.
1161 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1162 * destination is specified.
1163 * @param node [i] The A tag node is specified.
1164 * @return The conversion result is returned.
1167 s_chtml40_start_a_tag(void *pdoc, Node *node)
1173 char *attr_style = NULL;
1175 chtml40 = GET_CHTML40(pdoc);
1180 /*--------------------------------------------------------------------------*/
1181 /* Get Attributes */
1182 /*--------------------------------------------------------------------------*/
1183 for (attr = qs_get_attr(doc,node);
1185 attr = qs_get_next_attr(doc,attr)) {
1186 char *name = qs_get_attr_name(doc,attr);
1187 char *value = qs_get_attr_value(doc,attr);
1188 if (STRCASEEQ('n','N',"name", name)) {
1189 /*----------------------------------------------------------------------*/
1191 /*----------------------------------------------------------------------*/
1196 else if (STRCASEEQ('h','H',"href", name)) {
1197 /*----------------------------------------------------------------------*/
1199 /*----------------------------------------------------------------------*/
1200 value = chxj_encoding_parameter(r, value, 0);
1201 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1202 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
1208 else if (STRCASEEQ('a','A',"accesskey", name)) {
1209 /*----------------------------------------------------------------------*/
1211 /*----------------------------------------------------------------------*/
1212 W_L(" accesskey=\"");
1216 else if (STRCASEEQ('c','C',"cti", name)) {
1217 /*----------------------------------------------------------------------*/
1219 /*----------------------------------------------------------------------*/
1224 else if (STRCASEEQ('i','I',"ijam", name)) {
1225 /*----------------------------------------------------------------------*/
1227 /*----------------------------------------------------------------------*/
1230 else if (STRCASEEQ('u','U',"utn", name)) {
1231 /*----------------------------------------------------------------------*/
1233 /* It is special only for CHTML. */
1234 /*----------------------------------------------------------------------*/
1237 else if (STRCASEEQ('t','T',"telbook", name)) {
1238 /*----------------------------------------------------------------------*/
1240 /*----------------------------------------------------------------------*/
1243 else if (STRCASEEQ('k','K',"kana", name)) {
1244 /*----------------------------------------------------------------------*/
1246 /*----------------------------------------------------------------------*/
1249 else if (STRCASEEQ('e','E',"email", name)) {
1250 /*----------------------------------------------------------------------*/
1252 /*----------------------------------------------------------------------*/
1255 else if (STRCASEEQ('i','I',"ista", name)) {
1256 /*----------------------------------------------------------------------*/
1258 /*----------------------------------------------------------------------*/
1261 else if (STRCASEEQ('i','I',"ilet", name)) {
1262 /*----------------------------------------------------------------------*/
1264 /*----------------------------------------------------------------------*/
1267 else if (STRCASEEQ('i','I',"iswf", name)) {
1268 /*----------------------------------------------------------------------*/
1270 /*----------------------------------------------------------------------*/
1273 else if (STRCASEEQ('i','I',"irst", name)) {
1274 /*----------------------------------------------------------------------*/
1276 /*----------------------------------------------------------------------*/
1279 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1285 if (IS_CSS_ON(chtml40->entryp)) {
1286 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1289 return chtml40->out;
1294 * It is a handler who processes the A tag.
1296 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1297 * destination is specified.
1298 * @param node [i] The A tag node is specified.
1299 * @return The conversion result is returned.
1302 s_chtml40_end_a_tag(void *pdoc, Node *UNUSED(child))
1307 chtml40 = GET_CHTML40(pdoc);
1312 if (IS_CSS_ON(chtml40->entryp)) {
1313 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1316 return chtml40->out;
1321 * It is a handler who processes the BR tag.
1323 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1324 * destination is specified.
1325 * @param node [i] The BR tag node is specified.
1326 * @return The conversion result is returned.
1329 s_chtml40_start_br_tag(void *pdoc, Node *node)
1336 chtml40 = GET_CHTML40(pdoc);
1340 /*--------------------------------------------------------------------------*/
1341 /* Get Attributes */
1342 /*--------------------------------------------------------------------------*/
1343 for (attr = qs_get_attr(doc,node);
1345 attr = qs_get_next_attr(doc,attr)) {
1346 char *name = qs_get_attr_name(doc,attr);
1347 char *value = qs_get_attr_value(doc,attr);
1348 if (STRCASEEQ('c','C',"clear",name)) {
1349 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1358 return chtml40->out;
1363 * It is a handler who processes the BR tag.
1365 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1366 * destination is specified.
1367 * @param node [i] The BR tag node is specified.
1368 * @return The conversion result is returned.
1371 s_chtml40_end_br_tag(void *pdoc, Node *UNUSED(child))
1373 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1375 return chtml40->out;
1380 * It is a handler who processes the TR tag.
1382 * @param chtml40 [i/o] The pointer to the CHTML structure at the output
1383 * destination is specified.
1384 * @param node [i] The TR tag node is specified.
1385 * @return The conversion result is returned.
1388 s_chtml40_start_tr_tag(void *pdoc, Node *UNUSED(node))
1390 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1392 return chtml40->out;
1397 * It is a handler who processes the TR tag.
1399 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1400 * destination is specified.
1401 * @param node [i] The TR tag node is specified.
1402 * @return The conversion result is returned.
1405 s_chtml40_end_tr_tag(void *pdoc, Node *UNUSED(child))
1411 chtml40 = GET_CHTML40(pdoc);
1417 return chtml40->out;
1422 * It is a handler who processes the FONT tag.
1424 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1425 * destination is specified.
1426 * @param node [i] The FONT tag node is specified.
1427 * @return The conversion result is returned.
1430 s_chtml40_start_font_tag(void *pdoc, Node *node)
1436 char *attr_color = NULL;
1437 char *attr_style = NULL;
1439 chtml40 = GET_CHTML40(pdoc);
1443 /*--------------------------------------------------------------------------*/
1444 /* Get Attributes */
1445 /*--------------------------------------------------------------------------*/
1446 for (attr = qs_get_attr(doc,node);
1448 attr = qs_get_next_attr(doc,attr)) {
1449 char *name = qs_get_attr_name(doc,attr);
1450 char *value = qs_get_attr_value(doc,attr);
1451 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1452 attr_color = apr_pstrdup(doc->buf.pool, value);
1455 else if (STRCASEEQ('s','S',"size", name)) {
1456 /*----------------------------------------------------------------------*/
1458 /*----------------------------------------------------------------------*/
1461 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1465 if (IS_CSS_ON(chtml40->entryp)) {
1466 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1468 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1469 css_property_t *cur;
1470 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1471 if (cur->value && *cur->value) {
1472 attr_color = apr_pstrdup(doc->pool, cur->value);
1478 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1479 W_L("<font color=\"");
1482 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1483 flg->with_font_flag = 1;
1484 node->userData = flg;
1487 node->userData = NULL;
1489 return chtml40->out;
1494 * It is a handler who processes the FONT tag.
1496 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1497 * destination is specified.
1498 * @param node [i] The FONT tag node is specified.
1499 * @return The conversion result is returned.
1502 s_chtml40_end_font_tag(void *pdoc, Node *node)
1508 chtml40 = GET_CHTML40(pdoc);
1512 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1513 if (flg && flg->with_font_flag) {
1516 if (IS_CSS_ON(chtml40->entryp)) {
1517 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1520 return chtml40->out;
1525 * It is a handler who processes the FORM tag.
1527 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1528 * destination is specified.
1529 * @param node [i] The FORM tag node is specified.
1530 * @return The conversion result is returned.
1533 s_chtml40_start_form_tag(void *pdoc, Node *node)
1539 char *attr_action = NULL;
1540 char *attr_method = NULL;
1541 char *attr_style = NULL;
1542 char *attr_color = NULL;
1543 char *attr_align = NULL;
1544 char *attr_utn = NULL;
1545 char *new_hidden_tag = NULL;
1547 chtml40 = GET_CHTML40(pdoc);
1551 /*--------------------------------------------------------------------------*/
1552 /* Get Attributes */
1553 /*--------------------------------------------------------------------------*/
1554 for (attr = qs_get_attr(doc,node);
1556 attr = qs_get_next_attr(doc,attr)) {
1557 char *name = qs_get_attr_name(doc,attr);
1558 char *value = qs_get_attr_value(doc,attr);
1562 if (strcasecmp(name, "action") == 0) {
1563 /*--------------------------------------------------------------------*/
1565 /*--------------------------------------------------------------------*/
1566 attr_action = value;
1572 if (strcasecmp(name, "method") == 0) {
1573 /*--------------------------------------------------------------------*/
1575 /*--------------------------------------------------------------------*/
1576 attr_method = value;
1582 if (strcasecmp(name, "utn") == 0) {
1583 /*--------------------------------------------------------------------*/
1585 /*--------------------------------------------------------------------*/
1592 if (strcasecmp(name, "style") == 0) {
1601 if (IS_CSS_ON(chtml40->entryp)) {
1602 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1604 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1605 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1606 css_property_t *cur;
1607 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1608 if (STRCASEEQ('l','L',"left", cur->value)) {
1609 attr_align = apr_pstrdup(doc->pool, "left");
1611 else if (STRCASEEQ('c','C',"center",cur->value)) {
1612 attr_align = apr_pstrdup(doc->pool, "center");
1614 else if (STRCASEEQ('r','R',"right",cur->value)) {
1615 attr_align = apr_pstrdup(doc->pool, "right");
1618 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1619 attr_color = apr_pstrdup(doc->pool, cur->value);
1624 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1628 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1629 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml40->cookie);
1631 char *new_query_string = NULL;
1632 q = strchr(attr_action, '?');
1634 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);
1635 if (new_hidden_tag || new_query_string) {
1641 if (new_query_string) {
1643 W_V(new_query_string);
1656 if (new_hidden_tag) {
1657 W_V(new_hidden_tag);
1660 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1661 memset(flg, 0, sizeof(*flg));
1663 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1664 W_L("<font color=\"");
1667 flg->with_font_flag = 1;
1670 W_L("<div align=\"");
1673 flg->with_div_flag = 1;
1675 node->userData = flg;
1677 return chtml40->out;
1682 * It is a handler who processes the FORM tag.
1684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1685 * destination is specified.
1686 * @param node [i] The FORM tag node is specified.
1687 * @return The conversion result is returned.
1690 s_chtml40_end_form_tag(void *pdoc, Node *node)
1695 chtml40 = GET_CHTML40(pdoc);
1698 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1699 if (flg && flg->with_div_flag) {
1702 if (flg && flg->with_font_flag) {
1706 if (IS_CSS_ON(chtml40->entryp)) {
1707 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1710 return chtml40->out;
1715 * It is a handler who processes the INPUT tag.
1717 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1718 * destination is specified.
1719 * @param node [i] The INPUT tag node is specified.
1720 * @return The conversion result is returned.
1723 s_chtml40_start_input_tag(void *pdoc, Node *node)
1729 char *attr_accesskey = NULL;
1730 char *attr_max_length = NULL;
1731 char *attr_type = NULL;
1732 char *attr_name = NULL;
1733 char *attr_value = NULL;
1734 char *attr_istyle = NULL;
1735 char *attr_size = NULL;
1736 char *attr_checked = NULL;
1737 char *attr_style = NULL;
1739 chtml40 = GET_CHTML40(pdoc);
1743 /*--------------------------------------------------------------------------*/
1744 /* Get Attributes */
1745 /*--------------------------------------------------------------------------*/
1746 for (attr = qs_get_attr(doc,node);
1748 attr = qs_get_next_attr(doc,attr)) {
1749 char *name = qs_get_attr_name(doc,attr);
1750 char *value = qs_get_attr_value(doc,attr);
1751 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1752 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1753 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1754 STRCASEEQ('p','P',"password",tmp_type) ||
1755 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1756 STRCASEEQ('r','R',"radio", tmp_type) ||
1757 STRCASEEQ('h','H',"hidden", tmp_type) ||
1758 STRCASEEQ('s','S',"submit", tmp_type) ||
1759 STRCASEEQ('r','R',"reset", tmp_type))) {
1760 attr_type = tmp_type;
1763 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1766 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1769 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1770 attr_istyle = value;
1772 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1773 attr_max_length = value;
1775 else if (STRCASEEQ('c','C',"checked", name)) {
1776 attr_checked = value;
1778 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1779 attr_accesskey = value;
1781 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1784 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1789 if (IS_CSS_ON(chtml40->entryp)) {
1790 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
1792 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1793 css_property_t *cur;
1794 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1795 if (strcasestr(cur->value, "<ja:n>")) {
1798 else if (strcasestr(cur->value, "<ja:en>")) {
1801 else if (strcasestr(cur->value, "<ja:hk>")) {
1804 else if (strcasestr(cur->value, "<ja:h>")) {
1828 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1829 apr_size_t value_len = strlen(attr_value);
1830 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml40->entryp);
1834 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1837 if (attr_accesskey) {
1838 W_L(" accesskey=\"");
1839 W_V(attr_accesskey);
1843 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1849 /*--------------------------------------------------------------------------*/
1850 /* The figure is default for the password. */
1851 /*--------------------------------------------------------------------------*/
1852 if (attr_max_length) {
1853 if (chxj_chk_numeric(attr_max_length) != 0) {
1854 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1856 if (attr_istyle && *attr_istyle == '1') {
1857 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1861 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1870 return chtml40->out;
1875 * It is a handler who processes the INPUT tag.
1877 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1878 * destination is specified.
1879 * @param node [i] The INPUT tag node is specified.
1880 * @return The conversion result is returned.
1883 s_chtml40_end_input_tag(void *pdoc, Node *UNUSED(child))
1885 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1887 return chtml40->out;
1892 * It is a handler who processes the CENTER tag.
1894 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1895 * destination is specified.
1896 * @param node [i] The CENTER tag node is specified.
1897 * @return The conversion result is returned.
1900 s_chtml40_start_center_tag(void *pdoc, Node *node)
1905 char *attr_style = NULL;
1906 char *attr_color = NULL;
1908 chtml40 = GET_CHTML40(pdoc);
1911 for (attr = qs_get_attr(doc,node);
1913 attr = qs_get_next_attr(doc,attr)) {
1914 char *name = qs_get_attr_name(doc,attr);
1915 char *value = qs_get_attr_value(doc,attr);
1916 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1920 if (IS_CSS_ON(chtml40->entryp)) {
1921 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1923 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1924 css_property_t *cur;
1925 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1926 if (cur->value && *cur->value) {
1927 attr_color = apr_pstrdup(doc->pool, cur->value);
1934 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1935 memset(flg, 0, sizeof(*flg));
1937 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1938 W_L("<font color=\"");
1941 flg->with_font_flag = 1;
1943 node->userData = flg;
1945 return chtml40->out;
1950 * It is a handler who processes the CENTER tag.
1952 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1953 * destination is specified.
1954 * @param node [i] The CENTER tag node is specified.
1955 * @return The conversion result is returned.
1958 s_chtml40_end_center_tag(void *pdoc, Node *node)
1963 chtml40 = GET_CHTML40(pdoc);
1966 if (IS_CSS_ON(chtml40->entryp)) {
1967 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1969 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1970 if (flg && flg->with_font_flag) {
1975 return chtml40->out;
1980 * It is a handler who processes the HR tag.
1982 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1983 * destination is specified.
1984 * @param node [i] The HR tag node is specified.
1985 * @return The conversion result is returned.
1988 s_chtml40_start_hr_tag(void *pdoc, Node *node)
1994 char *attr_align = NULL;
1995 char *attr_size = NULL;
1996 char *attr_width = NULL;
1997 char *attr_noshade = NULL;
1998 char *attr_style = NULL;
1999 char *attr_color = NULL;
2001 chtml40 = GET_CHTML40(pdoc);
2005 for (attr = qs_get_attr(doc,node);
2007 attr = qs_get_next_attr(doc,attr)) {
2008 char *name = qs_get_attr_name (doc,attr);
2009 char *value = qs_get_attr_value(doc,attr);
2013 if (strcasecmp(name, "align") == 0) {
2014 /*--------------------------------------------------------------------*/
2016 /*--------------------------------------------------------------------*/
2017 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2025 if (strcasecmp(name, "size") == 0) {
2026 /*--------------------------------------------------------------------*/
2028 /*--------------------------------------------------------------------*/
2029 if (value && *value) {
2033 else if (strcasecmp(name, "style") == 0) {
2034 if (value && *value) {
2042 if (strcasecmp(name, "width") == 0) {
2043 /*--------------------------------------------------------------------*/
2045 /*--------------------------------------------------------------------*/
2046 if (value && *value) {
2054 if (strcasecmp(name, "noshade") == 0) {
2055 /*--------------------------------------------------------------------*/
2057 /*--------------------------------------------------------------------*/
2058 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2064 if (strcasecmp(name, "color") == 0 && value && *value) {
2065 /*--------------------------------------------------------------------*/
2067 /*--------------------------------------------------------------------*/
2076 if (IS_CSS_ON(chtml40->entryp)) {
2077 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2079 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2080 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2081 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2082 css_property_t *cur;
2083 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2084 if (STRCASEEQ('s','S',"solid",cur->value)) {
2085 attr_noshade = "noshade";
2088 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2089 char *tmp = apr_pstrdup(doc->pool, cur->value);
2090 char *tmpp = strstr(tmp, "px");
2093 attr_size = apr_pstrdup(doc->pool, tmp);
2096 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2097 char *tmp = apr_pstrdup(doc->pool, cur->value);
2098 char *tmpp = strstr(tmp, "px");
2101 attr_width = apr_pstrdup(doc->pool, tmp);
2104 tmpp = strstr(tmp, "%");
2106 attr_width = apr_pstrdup(doc->pool, tmp);
2137 return chtml40->out;
2142 * It is a handler who processes the HR tag.
2144 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2145 * destination is specified.
2146 * @param node [i] The HR tag node is specified.
2147 * @return The conversion result is returned.
2150 s_chtml40_end_hr_tag(void *pdoc, Node *UNUSED(child))
2152 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2154 return chtml40->out;
2159 * It is a handler who processes the IMG tag.
2161 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2162 * destination is specified.
2163 * @param node [i] The IMG tag node is specified.
2164 * @return The conversion result is returned.
2167 s_chtml40_start_img_tag(void *pdoc, Node *node)
2173 char *attr_src = NULL;
2174 char *attr_align = NULL;
2175 char *attr_style = NULL;
2176 char *attr_alt = NULL;
2177 char *attr_width = NULL;
2178 char *attr_height = NULL;
2179 char *attr_hspace = NULL;
2180 char *attr_vspace = NULL;
2181 #ifndef IMG_NOT_CONVERT_FILENAME
2185 chtml40 = GET_CHTML40(pdoc);
2186 #ifndef IMG_NOT_CONVERT_FILENAME
2187 spec = chtml40->spec;
2192 /*--------------------------------------------------------------------------*/
2193 /* Get Attributes */
2194 /*--------------------------------------------------------------------------*/
2195 for (attr = qs_get_attr(doc,node);
2197 attr = qs_get_next_attr(doc,attr)) {
2198 char *name = qs_get_attr_name (doc,attr);
2199 char *value = qs_get_attr_value(doc,attr);
2203 if (strcasecmp(name, "src") == 0) {
2204 /*--------------------------------------------------------------------*/
2206 /*--------------------------------------------------------------------*/
2207 #ifdef IMG_NOT_CONVERT_FILENAME
2208 value = chxj_encoding_parameter(r, value, 0);
2209 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2210 value = chxj_add_cookie_no_update_parameter(r, value);
2213 value = chxj_img_conv(r,spec,value);
2214 value = chxj_encoding_parameter(r, value, 0);
2215 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2216 value = chxj_add_cookie_no_update_parameter(r, value);
2220 else if (strcasecmp(name,"style") == 0 && value && *value) {
2227 if (strcasecmp(name, "align" ) == 0) {
2228 /*--------------------------------------------------------------------*/
2230 /*--------------------------------------------------------------------*/
2231 /*--------------------------------------------------------------------*/
2233 /*--------------------------------------------------------------------*/
2235 if (STRCASEEQ('t','T',"top", value) ||
2236 STRCASEEQ('m','M',"middle",value) ||
2237 STRCASEEQ('b','B',"bottom",value) ||
2238 STRCASEEQ('l','L',"left", value) ||
2239 STRCASEEQ('r','R',"right", value)) {
2242 else if (STRCASEEQ('c','C',"center", value)) {
2243 attr_align = apr_pstrdup(doc->pool, "middle");
2247 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2248 /*--------------------------------------------------------------------*/
2250 /*--------------------------------------------------------------------*/
2257 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2258 /*--------------------------------------------------------------------*/
2260 /*--------------------------------------------------------------------*/
2267 if (strcasecmp(name, "height") == 0 && value && *value) {
2268 /*--------------------------------------------------------------------*/
2270 /*--------------------------------------------------------------------*/
2271 attr_height = value;
2274 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2275 /*--------------------------------------------------------------------*/
2277 /*--------------------------------------------------------------------*/
2278 attr_hspace = value;
2284 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2285 /*--------------------------------------------------------------------*/
2287 /*--------------------------------------------------------------------*/
2288 attr_vspace = value;
2297 if (IS_CSS_ON(chtml40->entryp)) {
2298 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2300 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2301 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2302 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2303 css_property_t *cur;
2304 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2305 attr_height = apr_pstrdup(doc->pool, cur->value);
2307 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2308 attr_width = apr_pstrdup(doc->pool, cur->value);
2310 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2311 attr_align = apr_pstrdup(doc->pool, cur->value);
2353 return chtml40->out;
2358 * It is a handler who processes the IMG tag.
2360 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2361 * destination is specified.
2362 * @param node [i] The IMG tag node is specified.
2363 * @return The conversion result is returned.
2366 s_chtml40_end_img_tag(void *pdoc, Node *UNUSED(child))
2368 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2370 return chtml40->out;
2375 * It is a handler who processes the SELECT tag.
2377 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2378 * destination is specified.
2379 * @param node [i] The SELECT tag node is specified.
2380 * @return The conversion result is returned.
2383 s_chtml40_start_select_tag(void *pdoc, Node *node)
2385 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2386 Doc *doc = chtml40->doc;
2389 char *multiple = NULL;
2391 char *attr_style = NULL;
2394 for (attr = qs_get_attr(doc,node);
2396 attr = qs_get_next_attr(doc,attr)) {
2397 char *nm = qs_get_attr_name(doc,attr);
2398 char *val = qs_get_attr_value(doc,attr);
2399 if (STRCASEEQ('s','S',"size", nm)) {
2400 /*----------------------------------------------------------------------*/
2401 /* CHTML 1.0 version 2.0 */
2402 /*----------------------------------------------------------------------*/
2403 size = apr_pstrdup(doc->buf.pool, val);
2405 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2406 /*----------------------------------------------------------------------*/
2407 /* CHTML 1.0 version 2.0 */
2408 /*----------------------------------------------------------------------*/
2409 attr_style = apr_pstrdup(doc->buf.pool, val);
2411 else if (STRCASEEQ('n','N',"name", nm)) {
2412 /*----------------------------------------------------------------------*/
2413 /* CHTML 1.0 version 2.0 */
2414 /*----------------------------------------------------------------------*/
2415 name = apr_pstrdup(doc->buf.pool, val);
2417 else if (STRCASEEQ('m','M',"multiple", nm)) {
2418 /*----------------------------------------------------------------------*/
2419 /* CHTML 1.0 version 2.0 */
2420 /*----------------------------------------------------------------------*/
2421 multiple = apr_pstrdup(doc->buf.pool, val);
2424 if (size && *size) {
2429 if (name && *name) {
2438 if (IS_CSS_ON(chtml40->entryp)) {
2439 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2441 return chtml40->out;
2446 * It is a handler who processes the SELECT tag.
2448 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2449 * destination is specified.
2450 * @param node [i] The SELECT tag node is specified.
2451 * @return The conversion result is returned.
2454 s_chtml40_end_select_tag(void *pdoc, Node *UNUSED(child))
2456 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2457 Doc *doc = chtml40->doc;
2460 if (IS_CSS_ON(chtml40->entryp)) {
2461 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2463 return chtml40->out;
2468 * It is a handler who processes the OPTION tag.
2470 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2471 * destination is specified.
2472 * @param node [i] The OPTION tag node is specified.
2473 * @return The conversion result is returned.
2476 s_chtml40_start_option_tag(void *pdoc, Node *node)
2484 char *attr_style = NULL;
2486 chtml40 = GET_CHTML40(pdoc);
2493 for (attr = qs_get_attr(doc,node);
2495 attr = qs_get_next_attr(doc,attr)) {
2496 char *nm = qs_get_attr_name(doc,attr);
2497 char *val = qs_get_attr_value(doc,attr);
2498 if (STRCASEEQ('s','S',"selected", nm)) {
2499 /*----------------------------------------------------------------------*/
2500 /* CHTML 1.0 version 2.0 */
2501 /*----------------------------------------------------------------------*/
2502 selected = apr_pstrdup(doc->buf.pool, val);
2504 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2505 /*----------------------------------------------------------------------*/
2506 /* CHTML 1.0 version 2.0 */
2507 /*----------------------------------------------------------------------*/
2508 attr_style = apr_pstrdup(doc->buf.pool, val);
2510 else if (STRCASEEQ('v','V',"value", nm)) {
2511 /*----------------------------------------------------------------------*/
2512 /* CHTML 1.0 version 2.0 */
2513 /*----------------------------------------------------------------------*/
2514 value = apr_pstrdup(doc->buf.pool, val);
2527 if (IS_CSS_ON(chtml40->entryp)) {
2528 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2531 return chtml40->out;
2536 * It is a handler who processes the OPTION tag.
2538 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2539 * destination is specified.
2540 * @param node [i] The OPTION tag node is specified.
2541 * @return The conversion result is returned.
2544 s_chtml40_end_option_tag(void *pdoc, Node *UNUSED(child))
2546 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2549 if (IS_CSS_ON(chtml40->entryp)) {
2550 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2553 return chtml40->out;
2558 * It is a handler who processes the DIV tag.
2560 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2561 * destination is specified.
2562 * @param node [i] The DIV tag node is specified.
2563 * @return The conversion result is returned.
2566 s_chtml40_start_div_tag(void *pdoc, Node *node)
2572 char *attr_style = NULL;
2573 char *attr_align = NULL;
2574 char *attr_display = NULL;
2575 char *attr_decoration = NULL;
2576 char *attr_wap_marquee_style = NULL;
2577 char *attr_wap_marquee_dir = NULL;
2578 char *attr_wap_marquee_loop = NULL;
2579 char *attr_color = NULL;
2580 char *attr_bgcolor = NULL;
2582 chtml40 = GET_CHTML40(pdoc);
2586 for (attr = qs_get_attr(doc,node);
2588 attr = qs_get_next_attr(doc,attr)) {
2589 char *nm = qs_get_attr_name(doc,attr);
2590 char *val = qs_get_attr_value(doc,attr);
2591 if (STRCASEEQ('a','A', "align", nm)) {
2592 /*----------------------------------------------------------------------*/
2593 /* CHTML 1.0 (W3C version 3.2) */
2594 /*----------------------------------------------------------------------*/
2595 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2596 attr_align = apr_pstrdup(doc->buf.pool, val);
2599 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2600 attr_style = apr_pstrdup(doc->buf.pool, val);
2604 if (IS_CSS_ON(chtml40->entryp)) {
2605 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2607 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2608 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2609 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2610 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2611 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2612 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2614 css_property_t *cur;
2615 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2616 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2617 attr_display = apr_pstrdup(doc->pool, cur->value);
2620 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2621 if (STRCASEEQ('b','B',"blink", cur->value)) {
2622 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2625 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2626 attr_color = apr_pstrdup(doc->pool, cur->value);
2627 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2629 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2630 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2631 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2633 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2634 char *ss = strchr(cur->value, '#');
2636 ss = strstr(cur->value, "rgb");
2639 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2640 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2643 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2644 attr_align = apr_pstrdup(doc->pool, cur->value);
2647 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2648 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2649 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2650 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2651 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2652 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2655 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2656 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2657 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2659 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2660 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2663 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2664 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2665 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2668 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2674 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
2675 memset(flg, 0, sizeof(*flg));
2682 flg->with_div_flag = 1;
2686 flg->with_div_flag = 1;
2689 if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
2693 W_L("<font color=\"");
2696 flg->with_font_flag = 1;
2699 if (attr_decoration) {
2701 flg->with_blink_flag = 1;
2705 if (attr_wap_marquee_style) {
2706 W_L(" behavior=\"");
2707 W_V(attr_wap_marquee_style);
2710 if (attr_wap_marquee_dir) {
2711 W_L(" direction=\"");
2712 W_V(attr_wap_marquee_dir);
2715 if (attr_wap_marquee_loop) {
2717 W_V(attr_wap_marquee_loop);
2721 flg->with_marquee_flag = 1;
2723 node->userData = flg;
2725 return chtml40->out;
2730 * It is a handler who processes the DIV tag.
2732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2733 * destination is specified.
2734 * @param node [i] The DIV tag node is specified.
2735 * @return The conversion result is returned.
2738 s_chtml40_end_div_tag(void *pdoc, Node *node)
2740 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2741 Doc *doc = chtml40->doc;
2743 chtml40_flags_t *flg = node->userData;
2744 if (flg && flg->with_marquee_flag) {
2747 if (flg && flg->with_blink_flag) {
2750 if (flg && flg->with_font_flag) {
2753 if (flg && flg->with_div_flag) {
2756 if (IS_CSS_ON(chtml40->entryp)) {
2757 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2759 node->userData = NULL;
2761 return chtml40->out;
2766 * It is a handler who processes the UL tag.
2768 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2769 * destination is specified.
2770 * @param node [i] The UL tag node is specified.
2771 * @return The conversion result is returned.
2774 s_chtml40_start_ul_tag(void *pdoc, Node *node)
2776 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2777 Doc *doc = chtml40->doc;
2779 char *attr_type = NULL;
2780 char *attr_style = NULL;
2781 /*--------------------------------------------------------------------------*/
2782 /* Get Attributes */
2783 /*--------------------------------------------------------------------------*/
2784 for (attr = qs_get_attr(doc,node);
2786 attr = qs_get_next_attr(doc,attr)) {
2787 char *name = qs_get_attr_name(doc,attr);
2788 char *value = qs_get_attr_value(doc,attr);
2789 if (STRCASEEQ('t','T',"type",name)) {
2790 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2794 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2798 if (IS_CSS_ON(chtml40->entryp)) {
2799 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2801 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2802 css_property_t *cur;
2803 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2804 if (STRCASEEQ('d','D',"disc",cur->value)) {
2805 attr_type = apr_pstrdup(doc->pool, "disc");
2807 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2808 attr_type = apr_pstrdup(doc->pool, "circle");
2810 else if (STRCASEEQ('s','S',"square",cur->value)) {
2811 attr_type = apr_pstrdup(doc->pool, "square");
2824 return chtml40->out;
2829 * It is a handler who processes the UL tag.
2831 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2832 * destination is specified.
2833 * @param node [i] The UL tag node is specified.
2834 * @return The conversion result is returned.
2837 s_chtml40_end_ul_tag(void *pdoc, Node *UNUSED(child))
2839 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2840 Doc *doc = chtml40->doc;
2843 if (IS_CSS_ON(chtml40->entryp)) {
2844 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2847 return chtml40->out;
2852 * It is a handler who processes the PRE tag.
2854 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2855 * destination is specified.
2856 * @param node [i] The PRE tag node is specified.
2857 * @return The conversion result is returned.
2860 s_chtml40_start_pre_tag(void *pdoc, Node *node)
2862 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2863 Doc *doc = chtml40->doc;
2865 char *attr_style = NULL;
2867 for (attr = qs_get_attr(doc,node);
2869 attr = qs_get_next_attr(doc,attr)) {
2870 char *nm = qs_get_attr_name(doc,attr);
2871 char *val = qs_get_attr_value(doc,attr);
2872 if (val && STRCASEEQ('s','S',"style", nm)) {
2877 if (IS_CSS_ON(chtml40->entryp)) {
2878 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2881 chtml40->pre_flag++;
2884 return chtml40->out;
2889 * It is a handler who processes the PRE tag.
2891 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2892 * destination is specified.
2893 * @param node [i] The PRE tag node is specified.
2894 * @return The conversion result is returned.
2897 s_chtml40_end_pre_tag(void *pdoc, Node *UNUSED(child))
2899 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2900 Doc *doc = chtml40->doc;
2903 chtml40->pre_flag--;
2904 if (IS_CSS_ON(chtml40->entryp)) {
2905 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2908 return chtml40->out;
2913 * It is a handler who processes the P tag.
2915 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2916 * destination is specified.
2917 * @param node [i] The P tag node is specified.
2918 * @return The conversion result is returned.
2921 s_chtml40_start_p_tag(void *pdoc, Node *node)
2927 char *attr_align = NULL;
2928 char *attr_style = NULL;
2929 char *attr_color = NULL;
2930 char *attr_blink = NULL;
2932 chtml40 = GET_CHTML40(pdoc);
2936 for (attr = qs_get_attr(doc,node);
2938 attr = qs_get_next_attr(doc,attr)) {
2939 char *nm = qs_get_attr_name(doc,attr);
2940 char *val = qs_get_attr_value(doc,attr);
2941 if (STRCASEEQ('a','A',"align", nm)) {
2942 /*----------------------------------------------------------------------*/
2943 /* CHTML 1.0 (W3C version 3.2) */
2944 /*----------------------------------------------------------------------*/
2945 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2946 attr_align = apr_pstrdup(doc->buf.pool, val);
2950 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2951 attr_style = apr_pstrdup(doc->buf.pool, val);
2954 if (IS_CSS_ON(chtml40->entryp)) {
2955 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2957 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2958 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2959 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2960 css_property_t *cur;
2961 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2962 if (STRCASEEQ('l','L',"left",cur->value)) {
2963 attr_align = apr_pstrdup(doc->pool, "left");
2965 else if (STRCASEEQ('c','C',"center",cur->value)) {
2966 attr_align = apr_pstrdup(doc->pool, "center");
2968 else if (STRCASEEQ('r','R',"right",cur->value)) {
2969 attr_align = apr_pstrdup(doc->pool, "right");
2972 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2973 if (cur->value && *cur->value) {
2974 attr_color = apr_pstrdup(doc->pool, cur->value);
2977 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2978 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2979 attr_blink = apr_pstrdup(doc->pool, cur->value);
2992 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
2993 memset(flg, 0, sizeof(*flg));
2995 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2996 W_L("<font color=\"");
2999 flg->with_font_flag = 1;
3003 flg->with_blink_flag = 1;
3005 node->userData = (void *)flg;
3007 return chtml40->out;
3012 * It is a handler who processes the P tag.
3014 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3015 * destination is specified.
3016 * @param node [i] The P tag node is specified.
3017 * @return The conversion result is returned.
3020 s_chtml40_end_p_tag(void *pdoc, Node *node)
3025 chtml40 = GET_CHTML40(pdoc);
3028 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
3029 if (flg->with_font_flag) {
3032 if (flg->with_blink_flag) {
3036 if (IS_CSS_ON(chtml40->entryp)) {
3037 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3040 return chtml40->out;
3045 * It is a handler who processes the OL tag.
3047 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3048 * destination is specified.
3049 * @param node [i] The OL tag node is specified.
3050 * @return The conversion result is returned.
3053 s_chtml40_start_ol_tag(void *pdoc, Node *node)
3059 char *attr_style = NULL;
3060 char *attr_start = NULL;
3061 char *attr_type = NULL;
3063 chtml40 = GET_CHTML40(pdoc);
3067 /*--------------------------------------------------------------------------*/
3068 /* Get Attributes */
3069 /*--------------------------------------------------------------------------*/
3070 for (attr = qs_get_attr(doc,node);
3072 attr = qs_get_next_attr(doc,attr)) {
3073 char *name = qs_get_attr_name(doc,attr);
3074 char *value = qs_get_attr_value(doc,attr);
3075 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3078 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3081 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3085 if (IS_CSS_ON(chtml40->entryp)) {
3086 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3088 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3089 css_property_t *cur;
3090 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3091 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3092 attr_type = apr_pstrdup(doc->pool, "1");
3094 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3095 attr_type = apr_pstrdup(doc->pool, "A");
3097 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3098 attr_type = apr_pstrdup(doc->pool, "a");
3116 return chtml40->out;
3121 * It is a handler who processes the OL tag.
3123 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3124 * destination is specified.
3125 * @param node [i] The OL tag node is specified.
3126 * @return The conversion result is returned.
3129 s_chtml40_end_ol_tag(void *pdoc, Node *UNUSED(node))
3131 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3132 Doc *doc = chtml40->doc;
3135 if (IS_CSS_ON(chtml40->entryp)) {
3136 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3139 return chtml40->out;
3144 * It is a handler who processes the LI tag.
3146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3147 * destination is specified.
3148 * @param node [i] The LI tag node is specified.
3149 * @return The conversion result is returned.
3152 s_chtml40_start_li_tag(void *pdoc, Node *node)
3154 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3155 Doc *doc = chtml40->doc;
3157 char *attr_type = NULL;
3158 char *attr_value = NULL;
3159 char *attr_style = NULL;
3161 /*--------------------------------------------------------------------------*/
3162 /* Get Attributes */
3163 /*--------------------------------------------------------------------------*/
3164 for (attr = qs_get_attr(doc,node);
3166 attr = qs_get_next_attr(doc,attr)) {
3167 char *name = qs_get_attr_name(doc,attr);
3168 char *value = qs_get_attr_value(doc,attr);
3169 if (STRCASEEQ('t','T',"type",name)) {
3170 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3174 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3177 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3181 if (IS_CSS_ON(chtml40->entryp)) {
3182 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3184 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3185 css_property_t *cur;
3186 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3187 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3188 attr_type = apr_pstrdup(doc->pool, "1");
3190 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3191 attr_type = apr_pstrdup(doc->pool, "A");
3193 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3194 attr_type = apr_pstrdup(doc->pool, "a");
3196 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3197 attr_type = apr_pstrdup(doc->pool, "disc");
3199 else if (STRCASEEQ('s','S',"square", cur->value)) {
3200 attr_type = apr_pstrdup(doc->pool, "square");
3202 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3203 attr_type = apr_pstrdup(doc->pool, "circle");
3221 return chtml40->out;
3226 * It is a handler who processes the LI tag.
3228 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3229 * destination is specified.
3230 * @param node [i] The LI tag node is specified.
3231 * @return The conversion result is returned.
3234 s_chtml40_end_li_tag(void *pdoc, Node *UNUSED(child))
3236 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3238 if (IS_CSS_ON(chtml40->entryp)) {
3239 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3241 return chtml40->out;
3246 * It is a handler who processes the H1 tag.
3248 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3249 * destination is specified.
3250 * @param node [i] The H1 tag node is specified.
3251 * @return The conversion result is returned.
3254 s_chtml40_start_h1_tag(void *pdoc, Node *node)
3260 char *attr_style = NULL;
3261 char *attr_align = NULL;
3263 chtml40 = GET_CHTML40(pdoc);
3267 for (attr = qs_get_attr(doc,node);
3269 attr = qs_get_next_attr(doc,attr)) {
3270 char *name = qs_get_attr_name(doc,attr);
3271 char *value = qs_get_attr_value(doc,attr);
3272 if (STRCASEEQ('a','A',"align", name)) {
3273 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3277 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3281 if (IS_CSS_ON(chtml40->entryp)) {
3282 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3284 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3285 css_property_t *cur;
3286 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3287 if (STRCASEEQ('l','L',"left", cur->value)) {
3288 attr_align = apr_pstrdup(doc->pool, "left");
3290 else if (STRCASEEQ('c','C',"center",cur->value)) {
3291 attr_align = apr_pstrdup(doc->pool, "center");
3293 else if (STRCASEEQ('r','R',"right",cur->value)) {
3294 attr_align = apr_pstrdup(doc->pool, "right");
3307 return chtml40->out;
3312 * It is a handler who processes the H1 tag.
3314 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3315 * destination is specified.
3316 * @param node [i] The H1 tag node is specified.
3317 * @return The conversion result is returned.
3320 s_chtml40_end_h1_tag(void *pdoc, Node *UNUSED(child))
3325 chtml40 = GET_CHTML40(pdoc);
3329 if (IS_CSS_ON(chtml40->entryp)) {
3330 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3333 return chtml40->out;
3338 * It is a handler who processes the H2 tag.
3340 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3341 * destination is specified.
3342 * @param node [i] The H2 tag node is specified.
3343 * @return The conversion result is returned.
3346 s_chtml40_start_h2_tag(void *pdoc, Node *node)
3352 char *attr_style = NULL;
3353 char *attr_align = NULL;
3355 chtml40 = GET_CHTML40(pdoc);
3359 for (attr = qs_get_attr(doc,node);
3361 attr = qs_get_next_attr(doc,attr)) {
3362 char *name = qs_get_attr_name(doc,attr);
3363 char *value = qs_get_attr_value(doc,attr);
3364 if (STRCASEEQ('a','A',"align", name)) {
3365 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3369 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3373 if (IS_CSS_ON(chtml40->entryp)) {
3374 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3376 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3377 css_property_t *cur;
3378 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3379 if (STRCASEEQ('l','L',"left", cur->value)) {
3380 attr_align = apr_pstrdup(doc->pool, "left");
3382 else if (STRCASEEQ('c','C',"center",cur->value)) {
3383 attr_align = apr_pstrdup(doc->pool, "center");
3385 else if (STRCASEEQ('r','R',"right",cur->value)) {
3386 attr_align = apr_pstrdup(doc->pool, "right");
3399 return chtml40->out;
3404 * It is a handler who processes the H2 tag.
3406 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3407 * destination is specified.
3408 * @param node [i] The H2 tag node is specified.
3409 * @return The conversion result is returned.
3412 s_chtml40_end_h2_tag(void *pdoc, Node *UNUSED(child))
3414 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3415 Doc *doc = chtml40->doc;
3418 if (IS_CSS_ON(chtml40->entryp)) {
3419 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3422 return chtml40->out;
3427 * It is a handler who processes the H3 tag.
3429 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3430 * destination is specified.
3431 * @param node [i] The H3 tag node is specified.
3432 * @return The conversion result is returned.
3435 s_chtml40_start_h3_tag(void *pdoc, Node *node)
3441 char *attr_style = NULL;
3442 char *attr_align = NULL;
3444 chtml40 = GET_CHTML40(pdoc);
3448 for (attr = qs_get_attr(doc,node);
3450 attr = qs_get_next_attr(doc,attr)) {
3451 char *name = qs_get_attr_name(doc,attr);
3452 char *value = qs_get_attr_value(doc,attr);
3453 if (STRCASEEQ('a','A',"align", name)) {
3454 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3458 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3462 if (IS_CSS_ON(chtml40->entryp)) {
3463 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3465 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3466 css_property_t *cur;
3467 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3468 if (STRCASEEQ('l','L',"left", cur->value)) {
3469 attr_align = apr_pstrdup(doc->pool, "left");
3471 else if (STRCASEEQ('c','C',"center",cur->value)) {
3472 attr_align = apr_pstrdup(doc->pool, "center");
3474 else if (STRCASEEQ('r','R',"right",cur->value)) {
3475 attr_align = apr_pstrdup(doc->pool, "right");
3488 return chtml40->out;
3493 * It is a handler who processes the H3 tag.
3495 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3496 * destination is specified.
3497 * @param node [i] The H3 tag node is specified.
3498 * @return The conversion result is returned.
3501 s_chtml40_end_h3_tag(void *pdoc, Node *UNUSED(child))
3503 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3504 Doc *doc = chtml40->doc;
3507 if (IS_CSS_ON(chtml40->entryp)) {
3508 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3511 return chtml40->out;
3516 * It is a handler who processes the H4 tag.
3518 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3519 * destination is specified.
3520 * @param node [i] The H4 tag node is specified.
3521 * @return The conversion result is returned.
3524 s_chtml40_start_h4_tag(void *pdoc, Node *node)
3530 char *attr_style = NULL;
3531 char *attr_align = NULL;
3533 chtml40 = GET_CHTML40(pdoc);
3537 for (attr = qs_get_attr(doc,node);
3539 attr = qs_get_next_attr(doc,attr)) {
3540 char *name = qs_get_attr_name(doc,attr);
3541 char *value = qs_get_attr_value(doc,attr);
3542 if (STRCASEEQ('a','A',"align", name)) {
3543 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3547 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3551 if (IS_CSS_ON(chtml40->entryp)) {
3552 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3554 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3555 css_property_t *cur;
3556 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3557 if (STRCASEEQ('l','L',"left", cur->value)) {
3558 attr_align = apr_pstrdup(doc->pool, "left");
3560 else if (STRCASEEQ('c','C',"center",cur->value)) {
3561 attr_align = apr_pstrdup(doc->pool, "center");
3563 else if (STRCASEEQ('r','R',"right",cur->value)) {
3564 attr_align = apr_pstrdup(doc->pool, "right");
3577 return chtml40->out;
3582 * It is a handler who processes the H4 tag.
3584 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3585 * destination is specified.
3586 * @param node [i] The H4 tag node is specified.
3587 * @return The conversion result is returned.
3590 s_chtml40_end_h4_tag(void *pdoc, Node *UNUSED(child))
3592 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3593 Doc *doc = chtml40->doc;
3596 if (IS_CSS_ON(chtml40->entryp)) {
3597 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3600 return chtml40->out;
3605 * It is a handler who processes the H5 tag.
3607 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3608 * destination is specified.
3609 * @param node [i] The H5 tag node is specified.
3610 * @return The conversion result is returned.
3613 s_chtml40_start_h5_tag(void *pdoc, Node *node)
3619 char *attr_style = NULL;
3620 char *attr_align = NULL;
3622 chtml40 = GET_CHTML40(pdoc);
3626 for (attr = qs_get_attr(doc,node);
3628 attr = qs_get_next_attr(doc,attr)) {
3629 char *name = qs_get_attr_name(doc,attr);
3630 char *value = qs_get_attr_value(doc,attr);
3631 if (STRCASEEQ('a','A',"align", name)) {
3632 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3636 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3640 if (IS_CSS_ON(chtml40->entryp)) {
3641 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3643 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3644 css_property_t *cur;
3645 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3646 if (STRCASEEQ('l','L',"left", cur->value)) {
3647 attr_align = apr_pstrdup(doc->pool, "left");
3649 else if (STRCASEEQ('c','C',"center",cur->value)) {
3650 attr_align = apr_pstrdup(doc->pool, "center");
3652 else if (STRCASEEQ('r','R',"right",cur->value)) {
3653 attr_align = apr_pstrdup(doc->pool, "right");
3666 return chtml40->out;
3671 * It is a handler who processes the H5 tag.
3673 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3674 * destination is specified.
3675 * @param node [i] The H5 tag node is specified.
3676 * @return The conversion result is returned.
3679 s_chtml40_end_h5_tag(void *pdoc, Node *UNUSED(child))
3681 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3682 Doc *doc = chtml40->doc;
3685 if (IS_CSS_ON(chtml40->entryp)) {
3686 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3689 return chtml40->out;
3694 * It is a handler who processes the H6 tag.
3696 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3697 * destination is specified.
3698 * @param node [i] The H6 tag node is specified.
3699 * @return The conversion result is returned.
3702 s_chtml40_start_h6_tag(void *pdoc, Node *node)
3708 char *attr_style = NULL;
3709 char *attr_align = NULL;
3711 chtml40 = GET_CHTML40(pdoc);
3715 for (attr = qs_get_attr(doc,node);
3717 attr = qs_get_next_attr(doc,attr)) {
3718 char *name = qs_get_attr_name(doc,attr);
3719 char *value = qs_get_attr_value(doc,attr);
3720 if (STRCASEEQ('a','A',"align", name)) {
3721 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3725 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3729 if (IS_CSS_ON(chtml40->entryp)) {
3730 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3732 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3733 css_property_t *cur;
3734 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3735 if (STRCASEEQ('l','L',"left", cur->value)) {
3736 attr_align = apr_pstrdup(doc->pool, "left");
3738 else if (STRCASEEQ('c','C',"center",cur->value)) {
3739 attr_align = apr_pstrdup(doc->pool, "center");
3741 else if (STRCASEEQ('r','R',"right",cur->value)) {
3742 attr_align = apr_pstrdup(doc->pool, "right");
3755 return chtml40->out;
3760 * It is a handler who processes the H6 tag.
3762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3763 * destination is specified.
3764 * @param node [i] The H6 tag node is specified.
3765 * @return The conversion result is returned.
3768 s_chtml40_end_h6_tag(void *pdoc, Node *UNUSED(child))
3770 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3771 Doc *doc = chtml40->doc;
3774 if (IS_CSS_ON(chtml40->entryp)) {
3775 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3778 return chtml40->out;
3783 * It is a handler who processes the TEXTARE tag.
3785 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3786 * destination is specified.
3787 * @param node [i] The TEXTAREA tag node is specified.
3788 * @return The conversion result is returned.
3791 s_chtml40_start_textarea_tag(void *pdoc, Node *node)
3797 char *attr_accesskey = NULL;
3798 char *attr_name = NULL;
3799 char *attr_rows = NULL;
3800 char *attr_cols = NULL;
3801 char *attr_istyle = NULL;
3802 char *attr_style = NULL;
3804 chtml40 = GET_CHTML40(pdoc);
3808 chtml40->textarea_flag++;
3810 for (attr = qs_get_attr(doc,node);
3812 attr = qs_get_next_attr(doc,attr)) {
3813 char *name = qs_get_attr_name(doc,attr);
3814 char *value = qs_get_attr_value(doc,attr);
3815 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3816 attr_accesskey = value;
3818 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3819 attr_istyle = value;
3821 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3824 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3827 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3830 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3834 if (IS_CSS_ON(chtml40->entryp)) {
3835 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
3837 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3838 css_property_t *cur;
3839 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3840 if (strcasestr(cur->value, "<ja:n>")) {
3843 else if (strcasestr(cur->value, "<ja:en>")) {
3846 else if (strcasestr(cur->value, "<ja:hk>")) {
3849 else if (strcasestr(cur->value, "<ja:h>")) {
3856 if (attr_accesskey) {
3857 W_L(" accesskey=\"");
3858 W_V(attr_accesskey);
3882 return chtml40->out;
3887 * It is a handler who processes the TEXTAREA tag.
3889 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3890 * destination is specified.
3891 * @param node [i] The TEXTAREA tag node is specified.
3892 * @return The conversion result is returned.
3895 s_chtml40_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3897 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3898 Doc *doc = chtml40->doc;
3901 chtml40->textarea_flag--;
3903 return chtml40->out;
3908 s_chtml40_chxjif_tag(void *pdoc, Node *node)
3915 chtml40 = GET_CHTML40(pdoc);
3919 for (child = qs_get_child_node(doc, node);
3921 child = qs_get_next_node(doc, child)) {
3923 s_chtml40_chxjif_tag(chtml40, child);
3931 s_chtml40_text_tag(void *pdoc, Node *child)
3943 apr_size_t z2h_input_len;
3945 chtml40 = GET_CHTML40(pdoc);
3949 textval = qs_get_node_value(doc,child);
3950 if (strlen(textval) == 0) {
3951 return chtml40->out;
3954 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3955 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3957 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3958 memset(one_byte, 0, sizeof(one_byte));
3961 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3963 int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out);
3965 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3970 if (is_sjis_kanji(textval[ii])) {
3971 one_byte[0] = textval[ii+0];
3972 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3973 one_byte[0] = textval[ii+1];
3974 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3977 else if (chtml40->pre_flag) {
3978 one_byte[0] = textval[ii+0];
3979 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3981 else if (chtml40->textarea_flag) {
3982 one_byte[0] = textval[ii+0];
3983 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3985 else if (textval[ii] != '\r' && textval[ii] != '\n') {
3986 one_byte[0] = textval[ii+0];
3987 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3990 z2h_input_len = strlen(tdst);
3991 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml40->entryp);
3993 return chtml40->out;
3998 * It is a handler who processes the BLOCKQUOTE tag.
4000 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4001 * destination is specified.
4002 * @param node [i] The BLOCKQUOTE tag node is specified.
4003 * @return The conversion result is returned.
4006 s_chtml40_start_blockquote_tag(void *pdoc, Node *node)
4011 char *attr_style = NULL;
4012 char *attr_color = NULL;
4014 chtml40 = GET_CHTML40(pdoc);
4016 for (attr = qs_get_attr(doc,node);
4018 attr = qs_get_next_attr(doc,attr)) {
4019 char *nm = qs_get_attr_name(doc,attr);
4020 char *val = qs_get_attr_value(doc,attr);
4021 if (val && STRCASEEQ('s','S',"style", nm)) {
4025 if (IS_CSS_ON(chtml40->entryp)) {
4026 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4028 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4029 css_property_t *cur;
4030 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4031 if (cur->value && *cur->value) {
4032 attr_color = apr_pstrdup(doc->pool, cur->value);
4037 W_L("<blockquote>");
4038 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4039 memset(flg, 0, sizeof(*flg));
4041 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4042 W_L("<font color=\"");
4045 flg->with_font_flag = 1;
4047 node->userData = (void *)flg;
4048 return chtml40->out;
4053 * It is a handler who processes the BLOCKQUOTE tag.
4055 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4056 * destination is specified.
4057 * @param node [i] The BLOCKQUOTE tag node is specified.
4058 * @return The conversion result is returned.
4061 s_chtml40_end_blockquote_tag(void *pdoc, Node *node)
4063 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4064 Doc *doc = chtml40->doc;
4065 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4066 if (flg && flg->with_font_flag) {
4069 W_L("</blockquote>");
4070 if (IS_CSS_ON(chtml40->entryp)) {
4071 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4073 return chtml40->out;
4078 * It is a handler who processes the DIR tag.
4080 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4081 * destination is specified.
4082 * @param node [i] The DIR tag node is specified.
4083 * @return The conversion result is returned.
4086 s_chtml40_start_dir_tag(void *pdoc, Node *node)
4088 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4089 Doc *doc = chtml40->doc;
4091 char *attr_style = NULL;
4092 char *attr_color = NULL;
4093 char *attr_type = NULL;
4094 for (attr = qs_get_attr(doc,node);
4096 attr = qs_get_next_attr(doc,attr)) {
4097 char *name = qs_get_attr_name(doc,attr);
4098 char *value = qs_get_attr_value(doc,attr);
4099 if (STRCASEEQ('t','T',"type",name)) {
4100 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4104 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4108 CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE();
4116 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4117 memset(flg, 0, sizeof(*flg));
4119 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4120 W_L("<font color=\"");
4123 flg->with_font_flag = 1;
4125 node->userData = (void *)flg;
4126 return chtml40->out;
4131 * It is a handler who processes the DIR tag.
4133 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4134 * destination is specified.
4135 * @param node [i] The DIR tag node is specified.
4136 * @return The conversion result is returned.
4139 s_chtml40_end_dir_tag(void *pdoc, Node *node)
4141 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4142 Doc *doc = chtml40->doc;
4143 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4144 if (flg && flg->with_font_flag) {
4148 if (IS_CSS_ON(chtml40->entryp)) {
4149 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4151 return chtml40->out;
4156 * It is a handler who processes the DL tag.
4158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4159 * destination is specified.
4160 * @param node [i] The DL tag node is specified.
4161 * @return The conversion result is returned.
4164 s_chtml40_start_dl_tag(void *pdoc, Node *node)
4169 char *attr_style = NULL;
4170 char *attr_color = NULL;
4172 chtml40 = GET_CHTML40(pdoc);
4174 for (attr = qs_get_attr(doc,node);
4176 attr = qs_get_next_attr(doc,attr)) {
4177 char *nm = qs_get_attr_name(doc,attr);
4178 char *val = qs_get_attr_value(doc,attr);
4179 if (val && STRCASEEQ('s','S',"style", nm)) {
4183 if (IS_CSS_ON(chtml40->entryp)) {
4184 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4186 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4187 css_property_t *cur;
4188 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4189 if (cur->value && *cur->value) {
4190 attr_color = apr_pstrdup(doc->pool, cur->value);
4196 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4197 memset(flg, 0, sizeof(*flg));
4199 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4200 W_L("<font color=\"");
4203 flg->with_font_flag = 1;
4205 node->userData = (void *)flg;
4206 return chtml40->out;
4211 * It is a handler who processes the DL tag.
4213 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4214 * destination is specified.
4215 * @param node [i] The DL tag node is specified.
4216 * @return The conversion result is returned.
4219 s_chtml40_end_dl_tag(void *pdoc, Node *node)
4221 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4222 Doc *doc = chtml40->doc;
4223 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4224 if (flg && flg->with_font_flag) {
4228 if (IS_CSS_ON(chtml40->entryp)) {
4229 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4231 return chtml40->out;
4236 * It is a handler who processes the DT tag.
4238 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4239 * destination is specified.
4240 * @param node [i] The DT tag node is specified.
4241 * @return The conversion result is returned.
4244 s_chtml40_start_dt_tag(void *pdoc, Node *node)
4249 char *attr_style = NULL;
4250 char *attr_color = NULL;
4252 chtml40 = GET_CHTML40(pdoc);
4254 for (attr = qs_get_attr(doc,node);
4256 attr = qs_get_next_attr(doc,attr)) {
4257 char *nm = qs_get_attr_name(doc,attr);
4258 char *val = qs_get_attr_value(doc,attr);
4259 if (val && STRCASEEQ('s','S',"style", nm)) {
4263 if (IS_CSS_ON(chtml40->entryp)) {
4264 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4266 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4267 css_property_t *cur;
4268 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4269 if (cur->value && *cur->value) {
4270 attr_color = apr_pstrdup(doc->pool, cur->value);
4276 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4277 memset(flg, 0, sizeof(*flg));
4279 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4280 W_L("<font color=\"");
4283 flg->with_font_flag = 1;
4285 node->userData = (void *)flg;
4286 return chtml40->out;
4291 * It is a handler who processes the DT tag.
4293 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4294 * destination is specified.
4295 * @param node [i] The DT tag node is specified.
4296 * @return The conversion result is returned.
4299 s_chtml40_end_dt_tag(void *pdoc, Node *node)
4301 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4302 Doc *doc = chtml40->doc;
4303 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4304 if (flg && flg->with_font_flag) {
4307 if (IS_CSS_ON(chtml40->entryp)) {
4308 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4310 return chtml40->out;
4315 * It is a handler who processes the DD tag.
4317 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4318 * destination is specified.
4319 * @param node [i] The DD tag node is specified.
4320 * @return The conversion result is returned.
4323 s_chtml40_start_dd_tag(void *pdoc, Node *node)
4328 char *attr_style = NULL;
4329 char *attr_color = NULL;
4331 chtml40 = GET_CHTML40(pdoc);
4333 for (attr = qs_get_attr(doc,node);
4335 attr = qs_get_next_attr(doc,attr)) {
4336 char *nm = qs_get_attr_name(doc,attr);
4337 char *val = qs_get_attr_value(doc,attr);
4338 if (val && STRCASEEQ('s','S',"style", nm)) {
4342 if (IS_CSS_ON(chtml40->entryp)) {
4343 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4345 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4346 css_property_t *cur;
4347 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4348 if (cur->value && *cur->value) {
4349 attr_color = apr_pstrdup(doc->pool, cur->value);
4355 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4356 memset(flg, 0, sizeof(*flg));
4358 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4359 W_L("<font color=\"");
4362 flg->with_font_flag = 1;
4364 node->userData = (void *)flg;
4365 return chtml40->out;
4370 * It is a handler who processes the DD tag.
4372 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4373 * destination is specified.
4374 * @param node [i] The DD tag node is specified.
4375 * @return The conversion result is returned.
4378 s_chtml40_end_dd_tag(void *pdoc, Node *node)
4380 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4381 Doc *doc = chtml40->doc;
4382 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4383 if (flg && flg->with_font_flag) {
4386 if (IS_CSS_ON(chtml40->entryp)) {
4387 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4389 return chtml40->out;
4394 * It is a handler who processes the MARQUEE tag.
4396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4397 * destination is specified.
4398 * @param node [i] The MARQUEE tag node is specified.
4399 * @return The conversion result is returned.
4402 s_chtml40_start_marquee_tag(void *pdoc, Node *node)
4404 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4405 Doc *doc = chtml40->doc;
4407 char *attr_direction = NULL;
4408 char *attr_behavior = NULL;
4409 char *attr_loop = NULL;
4410 char *attr_style = NULL;
4411 char *attr_color = NULL;
4412 /*--------------------------------------------------------------------------*/
4413 /* Get Attributes */
4414 /*--------------------------------------------------------------------------*/
4415 for (attr = qs_get_attr(doc,node);
4417 attr = qs_get_next_attr(doc,attr)) {
4418 char *name = qs_get_attr_name(doc,attr);
4419 char *value = qs_get_attr_value(doc,attr);
4420 if (STRCASEEQ('d','D',"direction", name)) {
4421 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4422 attr_direction = value;
4425 else if (STRCASEEQ('b','B',"behavior",name)) {
4426 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4427 attr_behavior = value;
4430 else if (STRCASEEQ('l','L',"loop",name)) {
4431 if (value && *value) {
4435 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4439 if (IS_CSS_ON(chtml40->entryp)) {
4440 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4442 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4443 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4444 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4445 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4446 css_property_t *cur;
4447 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4448 if (cur->value && *cur->value) {
4449 attr_color = apr_pstrdup(doc->pool, cur->value);
4452 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4453 if (cur->value && *cur->value) {
4454 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4457 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4458 if (cur->value && *cur->value) {
4459 attr_loop = apr_pstrdup(doc->pool, cur->value);
4460 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4465 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4466 if (cur->value && *cur->value) {
4467 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4468 attr_direction = "right";
4470 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4471 attr_direction = "left";
4478 if (attr_direction) {
4479 W_L(" direction=\"");
4480 W_V(attr_direction);
4483 if (attr_behavior) {
4484 W_L(" behavior=\"");
4495 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4496 memset(flg, 0, sizeof(*flg));
4498 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4499 W_L("<font color=\"");
4502 flg->with_font_flag = 1;
4504 node->userData = (void *)flg;
4505 return chtml40->out;
4510 * It is a handler who processes the MARQUEE tag.
4512 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4513 * destination is specified.
4514 * @param node [i] The MARQUEE tag node is specified.
4515 * @return The conversion result is returned.
4518 s_chtml40_end_marquee_tag(void *pdoc, Node *node)
4520 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4521 Doc *doc = chtml40->doc;
4522 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4523 if (flg && flg->with_font_flag) {
4527 if (IS_CSS_ON(chtml40->entryp)) {
4528 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4530 return chtml40->out;
4535 * It is a handler who processes the BLINK tag.
4537 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4538 * destination is specified.
4539 * @param node [i] The BLINK tag node is specified.
4540 * @return The conversion result is returned.
4543 s_chtml40_start_blink_tag(void *pdoc, Node *node)
4548 char *attr_style = NULL;
4549 char *attr_color = NULL;
4551 chtml40 = GET_CHTML40(pdoc);
4553 for (attr = qs_get_attr(doc,node);
4555 attr = qs_get_next_attr(doc,attr)) {
4556 char *nm = qs_get_attr_name(doc,attr);
4557 char *val = qs_get_attr_value(doc,attr);
4558 if (val && STRCASEEQ('s','S',"style", nm)) {
4562 if (IS_CSS_ON(chtml40->entryp)) {
4563 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4565 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4566 css_property_t *cur;
4567 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4568 if (cur->value && *cur->value) {
4569 attr_color = apr_pstrdup(doc->pool, cur->value);
4575 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4576 memset(flg, 0, sizeof(*flg));
4578 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4579 W_L("<font color=\"");
4582 flg->with_font_flag = 1;
4584 node->userData = (void *)flg;
4585 return chtml40->out;
4590 * It is a handler who processes the BLINK tag.
4592 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4593 * destination is specified.
4594 * @param node [i] The BLINK tag node is specified.
4595 * @return The conversion result is returned.
4598 s_chtml40_end_blink_tag(void *pdoc, Node *node)
4600 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4601 Doc *doc = chtml40->doc;
4602 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4603 if (flg && flg->with_font_flag) {
4607 if (IS_CSS_ON(chtml40->entryp)) {
4608 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4610 return chtml40->out;
4615 * It is a handler who processes the MENU tag.
4617 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4618 * destination is specified.
4619 * @param node [i] The MENU tag node is specified.
4620 * @return The conversion result is returned.
4623 s_chtml40_start_menu_tag(void *pdoc, Node *node)
4625 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4626 Doc *doc = chtml40->doc;
4628 char *attr_style = NULL;
4629 char *attr_type = NULL;
4630 char *attr_color = NULL;
4631 /*--------------------------------------------------------------------------*/
4632 /* Get Attributes */
4633 /*--------------------------------------------------------------------------*/
4634 for (attr = qs_get_attr(doc,node);
4636 attr = qs_get_next_attr(doc,attr)) {
4637 char *name = qs_get_attr_name(doc,attr);
4638 char *value = qs_get_attr_value(doc,attr);
4639 if (STRCASEEQ('t','T',"type",name)) {
4640 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4644 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4648 CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE();
4656 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4657 memset(flg, 0, sizeof(*flg));
4659 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4660 W_L("<font color=\"");
4663 flg->with_font_flag = 1;
4665 node->userData = (void *)flg;
4667 return chtml40->out;
4672 * It is a handler who processes the MENU tag.
4674 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4675 * destination is specified.
4676 * @param node [i] The MENU tag node is specified.
4677 * @return The conversion result is returned.
4680 s_chtml40_end_menu_tag(void *pdoc, Node *node)
4682 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4683 Doc *doc = chtml40->doc;
4684 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4685 if (flg && flg->with_font_flag) {
4689 if (IS_CSS_ON(chtml40->entryp)) {
4690 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4692 return chtml40->out;
4697 * It is a handler who processes the PLAINTEXT tag.
4699 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4700 * destination is specified.
4701 * @param node [i] The PLAINTEXT tag node is specified.
4702 * @return The conversion result is returned.
4705 s_chtml40_start_plaintext_tag(void *pdoc, Node *node)
4707 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4708 Doc *doc = chtml40->doc;
4710 s_chtml40_start_plaintext_tag_inner(pdoc,node);
4711 return chtml40->out;
4715 s_chtml40_start_plaintext_tag_inner(void *pdoc, Node *node)
4717 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4718 Doc *doc = chtml40->doc;
4720 for (child = qs_get_child_node(doc, node);
4722 child = qs_get_next_node(doc, child)) {
4724 s_chtml40_start_plaintext_tag_inner(pdoc, child);
4726 return chtml40->out;
4731 * It is a handler who processes the PLAINTEXT tag.
4733 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4734 * destination is specified.
4735 * @param node [i] The PLAINTEXT tag node is specified.
4736 * @return The conversion result is returned.
4739 s_chtml40_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4741 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4742 return chtml40->out;
4747 * It is handler who processes the New Line Code.
4750 s_chtml40_newline_mark(void *pdoc, Node *UNUSED(node))
4752 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4753 Doc *doc = chtml40->doc;
4755 return chtml40->out;
4760 * It is a handler who processes the LINK tag.
4762 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4763 * destination is specified.
4764 * @param node [i] The LINK tag node is specified.
4765 * @return The conversion result is returned.
4768 s_chtml40_link_tag(void *pdoc, Node *node)
4777 chtml40 = GET_CHTML40(pdoc);
4780 if (! IS_CSS_ON(chtml40->entryp)) {
4781 return chtml40->out;
4784 for (attr = qs_get_attr(doc,node);
4786 attr = qs_get_next_attr(doc,attr)) {
4787 char *name = qs_get_attr_name(doc,attr);
4788 char *value = qs_get_attr_value(doc,attr);
4789 if (STRCASEEQ('r','R',"rel", name)) {
4790 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4794 else if (STRCASEEQ('h','H',"href", name)) {
4795 if (value && *value) {
4799 else if (STRCASEEQ('t','T',"type", name)) {
4800 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4806 if (rel && href && type) {
4807 DBG(doc->r, "start load CSS. url:[%s]", href);
4808 chtml40->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml40->style, href);
4809 DBG(doc->r, "end load CSS. url:[%s]", href);
4812 return chtml40->out;
4815 static css_prop_list_t *
4816 s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4818 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4819 Doc *doc = chtml40->doc;
4820 css_prop_list_t *last_css = NULL;
4821 if (IS_CSS_ON(chtml40->entryp)) {
4822 css_prop_list_t *dup_css;
4823 css_selector_t *selector;
4825 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4826 dup_css = chxj_dup_css_prop_list(doc, last_css);
4827 selector = chxj_css_find_selector(doc, chtml40->style, node);
4829 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4831 chxj_css_push_prop_list(chtml40->css_prop_stack, dup_css);
4832 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4834 if (style_attr_value) {
4835 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));
4837 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4845 static css_prop_list_t *
4846 s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4848 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4849 Doc *doc = chtml40->doc;
4850 css_prop_list_t *last_css = NULL;
4851 if (IS_CSS_ON(chtml40->entryp)) {
4852 css_prop_list_t *dup_css;
4853 css_selector_t *selector;
4855 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4856 dup_css = chxj_dup_css_prop_list(doc, last_css);
4857 selector = chxj_css_find_selector(doc, chtml40->style, node);
4859 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4863 if (style_attr_value) {
4864 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));
4866 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4876 * It is a handler who processes the SPAN tag.
4878 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4879 * destination is specified.
4880 * @param node [i] The SPAN tag node is specified.
4881 * @return The conversion result is returned.
4884 s_chtml40_start_span_tag(void *pdoc, Node *node)
4889 char *attr_style = NULL;
4890 char *attr_color = NULL;
4891 char *attr_align = NULL;
4892 char *attr_blink = NULL;
4893 char *attr_marquee = NULL;
4894 char *attr_marquee_dir = NULL;
4895 char *attr_marquee_style = NULL;
4896 char *attr_marquee_loop = NULL;
4898 chtml40 = GET_CHTML40(pdoc);
4901 for (attr = qs_get_attr(doc,node);
4903 attr = qs_get_next_attr(doc,attr)) {
4904 char *nm = qs_get_attr_name(doc,attr);
4905 char *val = qs_get_attr_value(doc,attr);
4906 if (val && STRCASEEQ('s','S',"style", nm)) {
4910 if (IS_CSS_ON(chtml40->entryp)) {
4911 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4913 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4914 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4915 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4916 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4917 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4918 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4919 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4920 css_property_t *cur;
4921 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4922 attr_color = apr_pstrdup(doc->pool, cur->value);
4924 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4925 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4926 attr_blink = apr_pstrdup(doc->pool, cur->value);
4929 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4930 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4931 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4934 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4935 if (cur->value && *cur->value) {
4936 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4937 attr_marquee_dir = "right";
4939 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4940 attr_marquee_dir = "left";
4944 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4945 if (cur->value && *cur->value) {
4946 if ( STRCASEEQ('s','S',"scroll",cur->value)
4947 || STRCASEEQ('s','S',"slide",cur->value)
4948 || STRCASEEQ('a','A',"alternate",cur->value)) {
4949 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4953 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4954 if (cur->value && *cur->value) {
4955 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4956 attr_marquee_loop = "16";
4959 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4963 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4964 if (STRCASEEQ('l','L',"left", cur->value)) {
4965 attr_align = apr_pstrdup(doc->pool, "left");
4967 else if (STRCASEEQ('c','C',"center",cur->value)) {
4968 attr_align = apr_pstrdup(doc->pool, "center");
4970 else if (STRCASEEQ('r','R',"right",cur->value)) {
4971 attr_align = apr_pstrdup(doc->pool, "right");
4976 if (attr_color || attr_align || attr_blink || attr_marquee) {
4977 chtml40_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4978 memset(flg, 0, sizeof(*flg));
4981 flg->with_blink_flag = 1;
4985 if (attr_marquee_dir) {
4986 W_L(" direction=\"");
4987 W_V(attr_marquee_dir);
4990 if (attr_marquee_style) {
4991 W_L(" behavior=\"");
4992 W_V(attr_marquee_style);
4995 if (attr_marquee_loop) {
4997 W_V(attr_marquee_loop);
5001 flg->with_marquee_flag = 1;
5004 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5005 W_L("<font color=\"");
5008 flg->with_font_flag = 1;
5011 W_L("<div align=\"");
5014 flg->with_div_flag = 1;
5016 node->userData = flg;
5019 node->userData = NULL;
5021 return chtml40->out;
5026 * It is a handler who processes the SPAN tag.
5028 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5029 * destination is specified.
5030 * @param node [i] The SPAN tag node is specified.
5031 * @return The conversion result is returned.
5034 s_chtml40_end_span_tag(void *pdoc, Node *node)
5036 chtml40_t *chtml40 = GET_CHTML40(pdoc);
5037 Doc *doc = chtml40->doc;
5039 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
5040 if (flg && flg->with_div_flag) {
5043 if (flg && flg->with_font_flag) {
5046 if (flg && flg->with_marquee_flag) {
5049 if (flg && flg->with_blink_flag) {
5052 if (IS_CSS_ON(chtml40->entryp)) {
5053 chxj_css_pop_prop_list(chtml40->css_prop_stack);
5055 return chtml40->out;
5060 * It is a handler who processes the STYLE tag.
5062 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5063 * destination is specified.
5064 * @param node [i] The STYLE tag node is specified.
5065 * @return The conversion result is returned.
5068 s_chtml40_style_tag(void *pdoc, Node *node)
5075 chtml40 = GET_CHTML40(pdoc);
5078 if (! IS_CSS_ON(chtml40->entryp)) {
5079 return chtml40->out;
5082 for (attr = qs_get_attr(doc,node);
5084 attr = qs_get_next_attr(doc,attr)) {
5085 char *name = qs_get_attr_name(doc,attr);
5086 char *value = qs_get_attr_value(doc,attr);
5087 if (STRCASEEQ('t','T',"type", name)) {
5088 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5094 Node *child = qs_get_child_node(doc, node);
5095 if (type && child) {
5096 char *name = qs_get_node_name(doc, child);
5097 if (STRCASEEQ('t','T',"text", name)) {
5098 char *value = qs_get_node_value(doc, child);
5099 DBG(doc->r, "start load CSS. buf:[%s]", value);
5100 chtml40->style = chxj_css_parse_style_value(doc, chtml40->style, value);
5101 DBG(doc->r, "end load CSS. value:[%s]", value);
5104 return chtml40->out;