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");
3127 return chtml40->out;
3132 * It is a handler who processes the OL tag.
3134 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3135 * destination is specified.
3136 * @param node [i] The OL tag node is specified.
3137 * @return The conversion result is returned.
3140 s_chtml40_end_ol_tag(void *pdoc, Node *UNUSED(node))
3142 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3143 Doc *doc = chtml40->doc;
3146 if (IS_CSS_ON(chtml40->entryp)) {
3147 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3150 return chtml40->out;
3155 * It is a handler who processes the LI tag.
3157 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3158 * destination is specified.
3159 * @param node [i] The LI tag node is specified.
3160 * @return The conversion result is returned.
3163 s_chtml40_start_li_tag(void *pdoc, Node *node)
3165 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3166 Doc *doc = chtml40->doc;
3168 char *attr_type = NULL;
3169 char *attr_value = NULL;
3170 char *attr_style = NULL;
3172 /*--------------------------------------------------------------------------*/
3173 /* Get Attributes */
3174 /*--------------------------------------------------------------------------*/
3175 for (attr = qs_get_attr(doc,node);
3177 attr = qs_get_next_attr(doc,attr)) {
3178 char *name = qs_get_attr_name(doc,attr);
3179 char *value = qs_get_attr_value(doc,attr);
3180 if (STRCASEEQ('t','T',"type",name)) {
3181 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3185 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3188 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3192 if (IS_CSS_ON(chtml40->entryp)) {
3193 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3195 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3196 css_property_t *cur;
3197 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3198 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3199 attr_type = apr_pstrdup(doc->pool, "1");
3201 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3202 attr_type = apr_pstrdup(doc->pool, "A");
3204 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3205 attr_type = apr_pstrdup(doc->pool, "a");
3207 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3208 attr_type = apr_pstrdup(doc->pool, "disc");
3210 else if (STRCASEEQ('s','S',"square", cur->value)) {
3211 attr_type = apr_pstrdup(doc->pool, "square");
3213 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3214 attr_type = apr_pstrdup(doc->pool, "circle");
3232 return chtml40->out;
3237 * It is a handler who processes the LI tag.
3239 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3240 * destination is specified.
3241 * @param node [i] The LI tag node is specified.
3242 * @return The conversion result is returned.
3245 s_chtml40_end_li_tag(void *pdoc, Node *UNUSED(child))
3247 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3249 if (IS_CSS_ON(chtml40->entryp)) {
3250 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3252 return chtml40->out;
3257 * It is a handler who processes the H1 tag.
3259 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3260 * destination is specified.
3261 * @param node [i] The H1 tag node is specified.
3262 * @return The conversion result is returned.
3265 s_chtml40_start_h1_tag(void *pdoc, Node *node)
3271 char *attr_style = NULL;
3272 char *attr_align = NULL;
3274 chtml40 = GET_CHTML40(pdoc);
3278 for (attr = qs_get_attr(doc,node);
3280 attr = qs_get_next_attr(doc,attr)) {
3281 char *name = qs_get_attr_name(doc,attr);
3282 char *value = qs_get_attr_value(doc,attr);
3283 if (STRCASEEQ('a','A',"align", name)) {
3284 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3288 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3292 if (IS_CSS_ON(chtml40->entryp)) {
3293 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3295 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3296 css_property_t *cur;
3297 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3298 if (STRCASEEQ('l','L',"left", cur->value)) {
3299 attr_align = apr_pstrdup(doc->pool, "left");
3301 else if (STRCASEEQ('c','C',"center",cur->value)) {
3302 attr_align = apr_pstrdup(doc->pool, "center");
3304 else if (STRCASEEQ('r','R',"right",cur->value)) {
3305 attr_align = apr_pstrdup(doc->pool, "right");
3318 return chtml40->out;
3323 * It is a handler who processes the H1 tag.
3325 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3326 * destination is specified.
3327 * @param node [i] The H1 tag node is specified.
3328 * @return The conversion result is returned.
3331 s_chtml40_end_h1_tag(void *pdoc, Node *UNUSED(child))
3336 chtml40 = GET_CHTML40(pdoc);
3340 if (IS_CSS_ON(chtml40->entryp)) {
3341 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3344 return chtml40->out;
3349 * It is a handler who processes the H2 tag.
3351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3352 * destination is specified.
3353 * @param node [i] The H2 tag node is specified.
3354 * @return The conversion result is returned.
3357 s_chtml40_start_h2_tag(void *pdoc, Node *node)
3363 char *attr_style = NULL;
3364 char *attr_align = NULL;
3366 chtml40 = GET_CHTML40(pdoc);
3370 for (attr = qs_get_attr(doc,node);
3372 attr = qs_get_next_attr(doc,attr)) {
3373 char *name = qs_get_attr_name(doc,attr);
3374 char *value = qs_get_attr_value(doc,attr);
3375 if (STRCASEEQ('a','A',"align", name)) {
3376 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3380 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3384 if (IS_CSS_ON(chtml40->entryp)) {
3385 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3387 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3388 css_property_t *cur;
3389 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3390 if (STRCASEEQ('l','L',"left", cur->value)) {
3391 attr_align = apr_pstrdup(doc->pool, "left");
3393 else if (STRCASEEQ('c','C',"center",cur->value)) {
3394 attr_align = apr_pstrdup(doc->pool, "center");
3396 else if (STRCASEEQ('r','R',"right",cur->value)) {
3397 attr_align = apr_pstrdup(doc->pool, "right");
3410 return chtml40->out;
3415 * It is a handler who processes the H2 tag.
3417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3418 * destination is specified.
3419 * @param node [i] The H2 tag node is specified.
3420 * @return The conversion result is returned.
3423 s_chtml40_end_h2_tag(void *pdoc, Node *UNUSED(child))
3425 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3426 Doc *doc = chtml40->doc;
3429 if (IS_CSS_ON(chtml40->entryp)) {
3430 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3433 return chtml40->out;
3438 * It is a handler who processes the H3 tag.
3440 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3441 * destination is specified.
3442 * @param node [i] The H3 tag node is specified.
3443 * @return The conversion result is returned.
3446 s_chtml40_start_h3_tag(void *pdoc, Node *node)
3452 char *attr_style = NULL;
3453 char *attr_align = NULL;
3455 chtml40 = GET_CHTML40(pdoc);
3459 for (attr = qs_get_attr(doc,node);
3461 attr = qs_get_next_attr(doc,attr)) {
3462 char *name = qs_get_attr_name(doc,attr);
3463 char *value = qs_get_attr_value(doc,attr);
3464 if (STRCASEEQ('a','A',"align", name)) {
3465 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3469 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3473 if (IS_CSS_ON(chtml40->entryp)) {
3474 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3476 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3477 css_property_t *cur;
3478 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3479 if (STRCASEEQ('l','L',"left", cur->value)) {
3480 attr_align = apr_pstrdup(doc->pool, "left");
3482 else if (STRCASEEQ('c','C',"center",cur->value)) {
3483 attr_align = apr_pstrdup(doc->pool, "center");
3485 else if (STRCASEEQ('r','R',"right",cur->value)) {
3486 attr_align = apr_pstrdup(doc->pool, "right");
3499 return chtml40->out;
3504 * It is a handler who processes the H3 tag.
3506 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3507 * destination is specified.
3508 * @param node [i] The H3 tag node is specified.
3509 * @return The conversion result is returned.
3512 s_chtml40_end_h3_tag(void *pdoc, Node *UNUSED(child))
3514 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3515 Doc *doc = chtml40->doc;
3518 if (IS_CSS_ON(chtml40->entryp)) {
3519 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3522 return chtml40->out;
3527 * It is a handler who processes the H4 tag.
3529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3530 * destination is specified.
3531 * @param node [i] The H4 tag node is specified.
3532 * @return The conversion result is returned.
3535 s_chtml40_start_h4_tag(void *pdoc, Node *node)
3541 char *attr_style = NULL;
3542 char *attr_align = NULL;
3544 chtml40 = GET_CHTML40(pdoc);
3548 for (attr = qs_get_attr(doc,node);
3550 attr = qs_get_next_attr(doc,attr)) {
3551 char *name = qs_get_attr_name(doc,attr);
3552 char *value = qs_get_attr_value(doc,attr);
3553 if (STRCASEEQ('a','A',"align", name)) {
3554 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3558 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3562 if (IS_CSS_ON(chtml40->entryp)) {
3563 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3565 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3566 css_property_t *cur;
3567 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3568 if (STRCASEEQ('l','L',"left", cur->value)) {
3569 attr_align = apr_pstrdup(doc->pool, "left");
3571 else if (STRCASEEQ('c','C',"center",cur->value)) {
3572 attr_align = apr_pstrdup(doc->pool, "center");
3574 else if (STRCASEEQ('r','R',"right",cur->value)) {
3575 attr_align = apr_pstrdup(doc->pool, "right");
3588 return chtml40->out;
3593 * It is a handler who processes the H4 tag.
3595 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3596 * destination is specified.
3597 * @param node [i] The H4 tag node is specified.
3598 * @return The conversion result is returned.
3601 s_chtml40_end_h4_tag(void *pdoc, Node *UNUSED(child))
3603 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3604 Doc *doc = chtml40->doc;
3607 if (IS_CSS_ON(chtml40->entryp)) {
3608 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3611 return chtml40->out;
3616 * It is a handler who processes the H5 tag.
3618 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3619 * destination is specified.
3620 * @param node [i] The H5 tag node is specified.
3621 * @return The conversion result is returned.
3624 s_chtml40_start_h5_tag(void *pdoc, Node *node)
3630 char *attr_style = NULL;
3631 char *attr_align = NULL;
3633 chtml40 = GET_CHTML40(pdoc);
3637 for (attr = qs_get_attr(doc,node);
3639 attr = qs_get_next_attr(doc,attr)) {
3640 char *name = qs_get_attr_name(doc,attr);
3641 char *value = qs_get_attr_value(doc,attr);
3642 if (STRCASEEQ('a','A',"align", name)) {
3643 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3647 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3651 if (IS_CSS_ON(chtml40->entryp)) {
3652 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3654 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3655 css_property_t *cur;
3656 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3657 if (STRCASEEQ('l','L',"left", cur->value)) {
3658 attr_align = apr_pstrdup(doc->pool, "left");
3660 else if (STRCASEEQ('c','C',"center",cur->value)) {
3661 attr_align = apr_pstrdup(doc->pool, "center");
3663 else if (STRCASEEQ('r','R',"right",cur->value)) {
3664 attr_align = apr_pstrdup(doc->pool, "right");
3683 return chtml40->out;
3688 * It is a handler who processes the H5 tag.
3690 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3691 * destination is specified.
3692 * @param node [i] The H5 tag node is specified.
3693 * @return The conversion result is returned.
3696 s_chtml40_end_h5_tag(void *pdoc, Node *UNUSED(child))
3698 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3699 Doc *doc = chtml40->doc;
3702 if (IS_CSS_ON(chtml40->entryp)) {
3703 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3706 return chtml40->out;
3711 * It is a handler who processes the H6 tag.
3713 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3714 * destination is specified.
3715 * @param node [i] The H6 tag node is specified.
3716 * @return The conversion result is returned.
3719 s_chtml40_start_h6_tag(void *pdoc, Node *node)
3725 char *attr_style = NULL;
3726 char *attr_align = NULL;
3728 chtml40 = GET_CHTML40(pdoc);
3732 for (attr = qs_get_attr(doc,node);
3734 attr = qs_get_next_attr(doc,attr)) {
3735 char *name = qs_get_attr_name(doc,attr);
3736 char *value = qs_get_attr_value(doc,attr);
3737 if (STRCASEEQ('a','A',"align", name)) {
3738 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3742 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3746 if (IS_CSS_ON(chtml40->entryp)) {
3747 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3749 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3750 css_property_t *cur;
3751 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3752 if (STRCASEEQ('l','L',"left", cur->value)) {
3753 attr_align = apr_pstrdup(doc->pool, "left");
3755 else if (STRCASEEQ('c','C',"center",cur->value)) {
3756 attr_align = apr_pstrdup(doc->pool, "center");
3758 else if (STRCASEEQ('r','R',"right",cur->value)) {
3759 attr_align = apr_pstrdup(doc->pool, "right");
3772 return chtml40->out;
3777 * It is a handler who processes the H6 tag.
3779 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3780 * destination is specified.
3781 * @param node [i] The H6 tag node is specified.
3782 * @return The conversion result is returned.
3785 s_chtml40_end_h6_tag(void *pdoc, Node *UNUSED(child))
3787 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3788 Doc *doc = chtml40->doc;
3791 if (IS_CSS_ON(chtml40->entryp)) {
3792 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3795 return chtml40->out;
3800 * It is a handler who processes the TEXTARE tag.
3802 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3803 * destination is specified.
3804 * @param node [i] The TEXTAREA tag node is specified.
3805 * @return The conversion result is returned.
3808 s_chtml40_start_textarea_tag(void *pdoc, Node *node)
3814 char *attr_accesskey = NULL;
3815 char *attr_name = NULL;
3816 char *attr_rows = NULL;
3817 char *attr_cols = NULL;
3818 char *attr_istyle = NULL;
3819 char *attr_style = NULL;
3821 chtml40 = GET_CHTML40(pdoc);
3825 chtml40->textarea_flag++;
3827 for (attr = qs_get_attr(doc,node);
3829 attr = qs_get_next_attr(doc,attr)) {
3830 char *name = qs_get_attr_name(doc,attr);
3831 char *value = qs_get_attr_value(doc,attr);
3832 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3833 attr_accesskey = value;
3835 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3836 attr_istyle = value;
3838 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3841 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3844 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3847 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3851 if (IS_CSS_ON(chtml40->entryp)) {
3852 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
3854 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3855 css_property_t *cur;
3856 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3857 if (strcasestr(cur->value, "<ja:n>")) {
3860 else if (strcasestr(cur->value, "<ja:en>")) {
3863 else if (strcasestr(cur->value, "<ja:hk>")) {
3866 else if (strcasestr(cur->value, "<ja:h>")) {
3873 if (attr_accesskey) {
3874 W_L(" accesskey=\"");
3875 W_V(attr_accesskey);
3899 return chtml40->out;
3904 * It is a handler who processes the TEXTAREA tag.
3906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3907 * destination is specified.
3908 * @param node [i] The TEXTAREA tag node is specified.
3909 * @return The conversion result is returned.
3912 s_chtml40_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3914 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3915 Doc *doc = chtml40->doc;
3918 chtml40->textarea_flag--;
3920 return chtml40->out;
3925 s_chtml40_chxjif_tag(void *pdoc, Node *node)
3932 chtml40 = GET_CHTML40(pdoc);
3936 for (child = qs_get_child_node(doc, node);
3938 child = qs_get_next_node(doc, child)) {
3940 s_chtml40_chxjif_tag(chtml40, child);
3948 s_chtml40_text_tag(void *pdoc, Node *child)
3960 apr_size_t z2h_input_len;
3962 chtml40 = GET_CHTML40(pdoc);
3966 textval = qs_get_node_value(doc,child);
3967 if (strlen(textval) == 0) {
3968 return chtml40->out;
3971 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3972 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3974 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3975 memset(one_byte, 0, sizeof(one_byte));
3978 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3980 int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out);
3982 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3987 if (is_sjis_kanji(textval[ii])) {
3988 one_byte[0] = textval[ii+0];
3989 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3990 one_byte[0] = textval[ii+1];
3991 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3994 else if (chtml40->pre_flag) {
3995 one_byte[0] = textval[ii+0];
3996 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3998 else if (chtml40->textarea_flag) {
3999 one_byte[0] = textval[ii+0];
4000 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4002 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4003 one_byte[0] = textval[ii+0];
4004 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4007 z2h_input_len = strlen(tdst);
4008 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml40->entryp);
4010 return chtml40->out;
4015 * It is a handler who processes the BLOCKQUOTE tag.
4017 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4018 * destination is specified.
4019 * @param node [i] The BLOCKQUOTE tag node is specified.
4020 * @return The conversion result is returned.
4023 s_chtml40_start_blockquote_tag(void *pdoc, Node *node)
4028 char *attr_style = NULL;
4029 char *attr_color = NULL;
4031 chtml40 = GET_CHTML40(pdoc);
4033 for (attr = qs_get_attr(doc,node);
4035 attr = qs_get_next_attr(doc,attr)) {
4036 char *nm = qs_get_attr_name(doc,attr);
4037 char *val = qs_get_attr_value(doc,attr);
4038 if (val && STRCASEEQ('s','S',"style", nm)) {
4042 if (IS_CSS_ON(chtml40->entryp)) {
4043 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4045 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4046 css_property_t *cur;
4047 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4048 if (cur->value && *cur->value) {
4049 attr_color = apr_pstrdup(doc->pool, cur->value);
4054 W_L("<blockquote>");
4055 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4056 memset(flg, 0, sizeof(*flg));
4058 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4059 W_L("<font color=\"");
4062 flg->with_font_flag = 1;
4064 node->userData = (void *)flg;
4065 return chtml40->out;
4070 * It is a handler who processes the BLOCKQUOTE tag.
4072 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4073 * destination is specified.
4074 * @param node [i] The BLOCKQUOTE tag node is specified.
4075 * @return The conversion result is returned.
4078 s_chtml40_end_blockquote_tag(void *pdoc, Node *node)
4080 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4081 Doc *doc = chtml40->doc;
4082 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4083 if (flg && flg->with_font_flag) {
4086 W_L("</blockquote>");
4087 if (IS_CSS_ON(chtml40->entryp)) {
4088 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4090 return chtml40->out;
4095 * It is a handler who processes the DIR tag.
4097 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4098 * destination is specified.
4099 * @param node [i] The DIR tag node is specified.
4100 * @return The conversion result is returned.
4103 s_chtml40_start_dir_tag(void *pdoc, Node *node)
4105 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4106 Doc *doc = chtml40->doc;
4108 char *attr_style = NULL;
4109 char *attr_color = NULL;
4110 char *attr_type = NULL;
4111 for (attr = qs_get_attr(doc,node);
4113 attr = qs_get_next_attr(doc,attr)) {
4114 char *name = qs_get_attr_name(doc,attr);
4115 char *value = qs_get_attr_value(doc,attr);
4116 if (STRCASEEQ('t','T',"type",name)) {
4117 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4121 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4125 CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE();
4133 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4134 memset(flg, 0, sizeof(*flg));
4136 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4137 W_L("<font color=\"");
4140 flg->with_font_flag = 1;
4142 node->userData = (void *)flg;
4143 return chtml40->out;
4148 * It is a handler who processes the DIR tag.
4150 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4151 * destination is specified.
4152 * @param node [i] The DIR tag node is specified.
4153 * @return The conversion result is returned.
4156 s_chtml40_end_dir_tag(void *pdoc, Node *node)
4158 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4159 Doc *doc = chtml40->doc;
4160 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4161 if (flg && flg->with_font_flag) {
4165 if (IS_CSS_ON(chtml40->entryp)) {
4166 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4168 return chtml40->out;
4173 * It is a handler who processes the DL tag.
4175 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4176 * destination is specified.
4177 * @param node [i] The DL tag node is specified.
4178 * @return The conversion result is returned.
4181 s_chtml40_start_dl_tag(void *pdoc, Node *node)
4186 char *attr_style = NULL;
4187 char *attr_color = NULL;
4189 chtml40 = GET_CHTML40(pdoc);
4191 for (attr = qs_get_attr(doc,node);
4193 attr = qs_get_next_attr(doc,attr)) {
4194 char *nm = qs_get_attr_name(doc,attr);
4195 char *val = qs_get_attr_value(doc,attr);
4196 if (val && STRCASEEQ('s','S',"style", nm)) {
4200 if (IS_CSS_ON(chtml40->entryp)) {
4201 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4203 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4204 css_property_t *cur;
4205 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4206 if (cur->value && *cur->value) {
4207 attr_color = apr_pstrdup(doc->pool, cur->value);
4213 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4214 memset(flg, 0, sizeof(*flg));
4216 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4217 W_L("<font color=\"");
4220 flg->with_font_flag = 1;
4222 node->userData = (void *)flg;
4223 return chtml40->out;
4228 * It is a handler who processes the DL tag.
4230 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4231 * destination is specified.
4232 * @param node [i] The DL tag node is specified.
4233 * @return The conversion result is returned.
4236 s_chtml40_end_dl_tag(void *pdoc, Node *node)
4238 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4239 Doc *doc = chtml40->doc;
4240 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4241 if (flg && flg->with_font_flag) {
4245 if (IS_CSS_ON(chtml40->entryp)) {
4246 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4248 return chtml40->out;
4253 * It is a handler who processes the DT tag.
4255 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4256 * destination is specified.
4257 * @param node [i] The DT tag node is specified.
4258 * @return The conversion result is returned.
4261 s_chtml40_start_dt_tag(void *pdoc, Node *node)
4266 char *attr_style = NULL;
4267 char *attr_color = NULL;
4269 chtml40 = GET_CHTML40(pdoc);
4271 for (attr = qs_get_attr(doc,node);
4273 attr = qs_get_next_attr(doc,attr)) {
4274 char *nm = qs_get_attr_name(doc,attr);
4275 char *val = qs_get_attr_value(doc,attr);
4276 if (val && STRCASEEQ('s','S',"style", nm)) {
4280 if (IS_CSS_ON(chtml40->entryp)) {
4281 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4283 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4284 css_property_t *cur;
4285 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4286 if (cur->value && *cur->value) {
4287 attr_color = apr_pstrdup(doc->pool, cur->value);
4293 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4294 memset(flg, 0, sizeof(*flg));
4296 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4297 W_L("<font color=\"");
4300 flg->with_font_flag = 1;
4302 node->userData = (void *)flg;
4303 return chtml40->out;
4308 * It is a handler who processes the DT tag.
4310 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4311 * destination is specified.
4312 * @param node [i] The DT tag node is specified.
4313 * @return The conversion result is returned.
4316 s_chtml40_end_dt_tag(void *pdoc, Node *node)
4318 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4319 Doc *doc = chtml40->doc;
4320 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4321 if (flg && flg->with_font_flag) {
4324 if (IS_CSS_ON(chtml40->entryp)) {
4325 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4327 return chtml40->out;
4332 * It is a handler who processes the DD tag.
4334 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4335 * destination is specified.
4336 * @param node [i] The DD tag node is specified.
4337 * @return The conversion result is returned.
4340 s_chtml40_start_dd_tag(void *pdoc, Node *node)
4345 char *attr_style = NULL;
4346 char *attr_color = NULL;
4348 chtml40 = GET_CHTML40(pdoc);
4350 for (attr = qs_get_attr(doc,node);
4352 attr = qs_get_next_attr(doc,attr)) {
4353 char *nm = qs_get_attr_name(doc,attr);
4354 char *val = qs_get_attr_value(doc,attr);
4355 if (val && STRCASEEQ('s','S',"style", nm)) {
4359 if (IS_CSS_ON(chtml40->entryp)) {
4360 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4362 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4363 css_property_t *cur;
4364 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4365 if (cur->value && *cur->value) {
4366 attr_color = apr_pstrdup(doc->pool, cur->value);
4372 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4373 memset(flg, 0, sizeof(*flg));
4375 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4376 W_L("<font color=\"");
4379 flg->with_font_flag = 1;
4381 node->userData = (void *)flg;
4382 return chtml40->out;
4387 * It is a handler who processes the DD tag.
4389 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4390 * destination is specified.
4391 * @param node [i] The DD tag node is specified.
4392 * @return The conversion result is returned.
4395 s_chtml40_end_dd_tag(void *pdoc, Node *node)
4397 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4398 Doc *doc = chtml40->doc;
4399 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4400 if (flg && flg->with_font_flag) {
4403 if (IS_CSS_ON(chtml40->entryp)) {
4404 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4406 return chtml40->out;
4411 * It is a handler who processes the MARQUEE tag.
4413 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4414 * destination is specified.
4415 * @param node [i] The MARQUEE tag node is specified.
4416 * @return The conversion result is returned.
4419 s_chtml40_start_marquee_tag(void *pdoc, Node *node)
4421 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4422 Doc *doc = chtml40->doc;
4424 char *attr_direction = NULL;
4425 char *attr_behavior = NULL;
4426 char *attr_loop = NULL;
4427 char *attr_style = NULL;
4428 char *attr_color = NULL;
4429 /*--------------------------------------------------------------------------*/
4430 /* Get Attributes */
4431 /*--------------------------------------------------------------------------*/
4432 for (attr = qs_get_attr(doc,node);
4434 attr = qs_get_next_attr(doc,attr)) {
4435 char *name = qs_get_attr_name(doc,attr);
4436 char *value = qs_get_attr_value(doc,attr);
4437 if (STRCASEEQ('d','D',"direction", name)) {
4438 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4439 attr_direction = value;
4442 else if (STRCASEEQ('b','B',"behavior",name)) {
4443 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4444 attr_behavior = value;
4447 else if (STRCASEEQ('l','L',"loop",name)) {
4448 if (value && *value) {
4452 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4456 if (IS_CSS_ON(chtml40->entryp)) {
4457 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4459 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4460 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4461 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4462 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4463 css_property_t *cur;
4464 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4465 if (cur->value && *cur->value) {
4466 attr_color = apr_pstrdup(doc->pool, cur->value);
4469 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4470 if (cur->value && *cur->value) {
4471 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4474 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4475 if (cur->value && *cur->value) {
4476 attr_loop = apr_pstrdup(doc->pool, cur->value);
4477 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4482 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4483 if (cur->value && *cur->value) {
4484 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4485 attr_direction = "right";
4487 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4488 attr_direction = "left";
4495 if (attr_direction) {
4496 W_L(" direction=\"");
4497 W_V(attr_direction);
4500 if (attr_behavior) {
4501 W_L(" behavior=\"");
4512 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4513 memset(flg, 0, sizeof(*flg));
4515 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4516 W_L("<font color=\"");
4519 flg->with_font_flag = 1;
4521 node->userData = (void *)flg;
4522 return chtml40->out;
4527 * It is a handler who processes the MARQUEE tag.
4529 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4530 * destination is specified.
4531 * @param node [i] The MARQUEE tag node is specified.
4532 * @return The conversion result is returned.
4535 s_chtml40_end_marquee_tag(void *pdoc, Node *node)
4537 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4538 Doc *doc = chtml40->doc;
4539 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4540 if (flg && flg->with_font_flag) {
4544 if (IS_CSS_ON(chtml40->entryp)) {
4545 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4547 return chtml40->out;
4552 * It is a handler who processes the BLINK tag.
4554 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4555 * destination is specified.
4556 * @param node [i] The BLINK tag node is specified.
4557 * @return The conversion result is returned.
4560 s_chtml40_start_blink_tag(void *pdoc, Node *node)
4565 char *attr_style = NULL;
4566 char *attr_color = NULL;
4568 chtml40 = GET_CHTML40(pdoc);
4570 for (attr = qs_get_attr(doc,node);
4572 attr = qs_get_next_attr(doc,attr)) {
4573 char *nm = qs_get_attr_name(doc,attr);
4574 char *val = qs_get_attr_value(doc,attr);
4575 if (val && STRCASEEQ('s','S',"style", nm)) {
4579 if (IS_CSS_ON(chtml40->entryp)) {
4580 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4582 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4583 css_property_t *cur;
4584 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4585 if (cur->value && *cur->value) {
4586 attr_color = apr_pstrdup(doc->pool, cur->value);
4592 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4593 memset(flg, 0, sizeof(*flg));
4595 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4596 W_L("<font color=\"");
4599 flg->with_font_flag = 1;
4601 node->userData = (void *)flg;
4602 return chtml40->out;
4607 * It is a handler who processes the BLINK tag.
4609 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4610 * destination is specified.
4611 * @param node [i] The BLINK tag node is specified.
4612 * @return The conversion result is returned.
4615 s_chtml40_end_blink_tag(void *pdoc, Node *node)
4617 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4618 Doc *doc = chtml40->doc;
4619 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4620 if (flg && flg->with_font_flag) {
4624 if (IS_CSS_ON(chtml40->entryp)) {
4625 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4627 return chtml40->out;
4632 * It is a handler who processes the MENU tag.
4634 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4635 * destination is specified.
4636 * @param node [i] The MENU tag node is specified.
4637 * @return The conversion result is returned.
4640 s_chtml40_start_menu_tag(void *pdoc, Node *node)
4642 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4643 Doc *doc = chtml40->doc;
4645 char *attr_style = NULL;
4646 char *attr_type = NULL;
4647 char *attr_color = NULL;
4648 /*--------------------------------------------------------------------------*/
4649 /* Get Attributes */
4650 /*--------------------------------------------------------------------------*/
4651 for (attr = qs_get_attr(doc,node);
4653 attr = qs_get_next_attr(doc,attr)) {
4654 char *name = qs_get_attr_name(doc,attr);
4655 char *value = qs_get_attr_value(doc,attr);
4656 if (STRCASEEQ('t','T',"type",name)) {
4657 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4661 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4665 CHTML40_GET_CSS_COLOR_AND_LIST_STYLE_TYPE();
4673 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
4674 memset(flg, 0, sizeof(*flg));
4676 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4677 W_L("<font color=\"");
4680 flg->with_font_flag = 1;
4682 node->userData = (void *)flg;
4684 return chtml40->out;
4689 * It is a handler who processes the MENU tag.
4691 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4692 * destination is specified.
4693 * @param node [i] The MENU tag node is specified.
4694 * @return The conversion result is returned.
4697 s_chtml40_end_menu_tag(void *pdoc, Node *node)
4699 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4700 Doc *doc = chtml40->doc;
4701 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
4702 if (flg && flg->with_font_flag) {
4706 if (IS_CSS_ON(chtml40->entryp)) {
4707 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4709 return chtml40->out;
4714 * It is a handler who processes the PLAINTEXT tag.
4716 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4717 * destination is specified.
4718 * @param node [i] The PLAINTEXT tag node is specified.
4719 * @return The conversion result is returned.
4722 s_chtml40_start_plaintext_tag(void *pdoc, Node *node)
4724 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4725 Doc *doc = chtml40->doc;
4727 s_chtml40_start_plaintext_tag_inner(pdoc,node);
4728 return chtml40->out;
4732 s_chtml40_start_plaintext_tag_inner(void *pdoc, Node *node)
4734 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4735 Doc *doc = chtml40->doc;
4737 for (child = qs_get_child_node(doc, node);
4739 child = qs_get_next_node(doc, child)) {
4741 s_chtml40_start_plaintext_tag_inner(pdoc, child);
4743 return chtml40->out;
4748 * It is a handler who processes the PLAINTEXT tag.
4750 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4751 * destination is specified.
4752 * @param node [i] The PLAINTEXT tag node is specified.
4753 * @return The conversion result is returned.
4756 s_chtml40_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4758 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4759 return chtml40->out;
4764 * It is handler who processes the New Line Code.
4767 s_chtml40_newline_mark(void *pdoc, Node *UNUSED(node))
4769 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4770 Doc *doc = chtml40->doc;
4772 return chtml40->out;
4777 * It is a handler who processes the LINK tag.
4779 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4780 * destination is specified.
4781 * @param node [i] The LINK tag node is specified.
4782 * @return The conversion result is returned.
4785 s_chtml40_link_tag(void *pdoc, Node *node)
4794 chtml40 = GET_CHTML40(pdoc);
4797 if (! IS_CSS_ON(chtml40->entryp)) {
4798 return chtml40->out;
4801 for (attr = qs_get_attr(doc,node);
4803 attr = qs_get_next_attr(doc,attr)) {
4804 char *name = qs_get_attr_name(doc,attr);
4805 char *value = qs_get_attr_value(doc,attr);
4806 if (STRCASEEQ('r','R',"rel", name)) {
4807 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4811 else if (STRCASEEQ('h','H',"href", name)) {
4812 if (value && *value) {
4816 else if (STRCASEEQ('t','T',"type", name)) {
4817 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4823 if (rel && href && type) {
4824 DBG(doc->r, "start load CSS. url:[%s]", href);
4825 chtml40->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml40->style, href);
4826 DBG(doc->r, "end load CSS. url:[%s]", href);
4829 return chtml40->out;
4832 static css_prop_list_t *
4833 s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4835 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4836 Doc *doc = chtml40->doc;
4837 css_prop_list_t *last_css = NULL;
4838 if (IS_CSS_ON(chtml40->entryp)) {
4839 css_prop_list_t *dup_css;
4840 css_selector_t *selector;
4842 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4843 dup_css = chxj_dup_css_prop_list(doc, last_css);
4844 selector = chxj_css_find_selector(doc, chtml40->style, node);
4846 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4848 chxj_css_push_prop_list(chtml40->css_prop_stack, dup_css);
4849 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4851 if (style_attr_value) {
4852 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));
4854 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4862 static css_prop_list_t *
4863 s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4865 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4866 Doc *doc = chtml40->doc;
4867 css_prop_list_t *last_css = NULL;
4868 if (IS_CSS_ON(chtml40->entryp)) {
4869 css_prop_list_t *dup_css;
4870 css_selector_t *selector;
4872 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4873 dup_css = chxj_dup_css_prop_list(doc, last_css);
4874 selector = chxj_css_find_selector(doc, chtml40->style, node);
4876 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4880 if (style_attr_value) {
4881 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));
4883 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4893 * It is a handler who processes the SPAN tag.
4895 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4896 * destination is specified.
4897 * @param node [i] The SPAN tag node is specified.
4898 * @return The conversion result is returned.
4901 s_chtml40_start_span_tag(void *pdoc, Node *node)
4906 char *attr_style = NULL;
4907 char *attr_color = NULL;
4908 char *attr_align = NULL;
4909 char *attr_blink = NULL;
4910 char *attr_marquee = NULL;
4911 char *attr_marquee_dir = NULL;
4912 char *attr_marquee_style = NULL;
4913 char *attr_marquee_loop = NULL;
4915 chtml40 = GET_CHTML40(pdoc);
4918 for (attr = qs_get_attr(doc,node);
4920 attr = qs_get_next_attr(doc,attr)) {
4921 char *nm = qs_get_attr_name(doc,attr);
4922 char *val = qs_get_attr_value(doc,attr);
4923 if (val && STRCASEEQ('s','S',"style", nm)) {
4927 if (IS_CSS_ON(chtml40->entryp)) {
4928 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4930 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4931 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4932 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4933 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4934 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4935 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4936 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4937 css_property_t *cur;
4938 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4939 attr_color = apr_pstrdup(doc->pool, cur->value);
4941 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
4942 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
4943 attr_blink = apr_pstrdup(doc->pool, cur->value);
4946 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4947 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
4948 attr_marquee = apr_pstrdup(doc->pool, cur->value);
4951 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
4952 if (cur->value && *cur->value) {
4953 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4954 attr_marquee_dir = "right";
4956 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4957 attr_marquee_dir = "left";
4961 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
4962 if (cur->value && *cur->value) {
4963 if ( STRCASEEQ('s','S',"scroll",cur->value)
4964 || STRCASEEQ('s','S',"slide",cur->value)
4965 || STRCASEEQ('a','A',"alternate",cur->value)) {
4966 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
4970 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
4971 if (cur->value && *cur->value) {
4972 if (STRCASEEQ('i','I',"infinite",cur->value)) {
4973 attr_marquee_loop = "16";
4976 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4980 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4981 if (STRCASEEQ('l','L',"left", cur->value)) {
4982 attr_align = apr_pstrdup(doc->pool, "left");
4984 else if (STRCASEEQ('c','C',"center",cur->value)) {
4985 attr_align = apr_pstrdup(doc->pool, "center");
4987 else if (STRCASEEQ('r','R',"right",cur->value)) {
4988 attr_align = apr_pstrdup(doc->pool, "right");
4993 if (attr_color || attr_align || attr_blink || attr_marquee) {
4994 chtml40_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4995 memset(flg, 0, sizeof(*flg));
4998 flg->with_blink_flag = 1;
5002 if (attr_marquee_dir) {
5003 W_L(" direction=\"");
5004 W_V(attr_marquee_dir);
5007 if (attr_marquee_style) {
5008 W_L(" behavior=\"");
5009 W_V(attr_marquee_style);
5012 if (attr_marquee_loop) {
5014 W_V(attr_marquee_loop);
5018 flg->with_marquee_flag = 1;
5021 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5022 W_L("<font color=\"");
5025 flg->with_font_flag = 1;
5028 W_L("<div align=\"");
5031 flg->with_div_flag = 1;
5033 node->userData = flg;
5036 node->userData = NULL;
5038 return chtml40->out;
5043 * It is a handler who processes the SPAN tag.
5045 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5046 * destination is specified.
5047 * @param node [i] The SPAN tag node is specified.
5048 * @return The conversion result is returned.
5051 s_chtml40_end_span_tag(void *pdoc, Node *node)
5053 chtml40_t *chtml40 = GET_CHTML40(pdoc);
5054 Doc *doc = chtml40->doc;
5056 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
5057 if (flg && flg->with_div_flag) {
5060 if (flg && flg->with_font_flag) {
5063 if (flg && flg->with_marquee_flag) {
5066 if (flg && flg->with_blink_flag) {
5069 if (IS_CSS_ON(chtml40->entryp)) {
5070 chxj_css_pop_prop_list(chtml40->css_prop_stack);
5072 return chtml40->out;
5077 * It is a handler who processes the STYLE tag.
5079 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5080 * destination is specified.
5081 * @param node [i] The STYLE tag node is specified.
5082 * @return The conversion result is returned.
5085 s_chtml40_style_tag(void *pdoc, Node *node)
5092 chtml40 = GET_CHTML40(pdoc);
5095 if (! IS_CSS_ON(chtml40->entryp)) {
5096 return chtml40->out;
5099 for (attr = qs_get_attr(doc,node);
5101 attr = qs_get_next_attr(doc,attr)) {
5102 char *name = qs_get_attr_name(doc,attr);
5103 char *value = qs_get_attr_value(doc,attr);
5104 if (STRCASEEQ('t','T',"type", name)) {
5105 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5111 Node *child = qs_get_child_node(doc, node);
5112 if (type && child) {
5113 char *name = qs_get_node_name(doc, child);
5114 if (STRCASEEQ('t','T',"text", name)) {
5115 char *value = qs_get_node_value(doc, child);
5116 DBG(doc->r, "start load CSS. buf:[%s]", value);
5117 chtml40->style = chxj_css_parse_style_value(doc, chtml40->style, value);
5118 DBG(doc->r, "end load CSS. value:[%s]", value);
5121 return chtml40->out;