2 * Copyright (C) 2005-2011 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_chtml50.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"
27 #include "chxj_google.h"
29 #define GET_CHTML50(X) ((chtml50_t *)(X))
32 #define W_L(X) do { chtml50->out = BUFFERED_WRITE_LITERAL(chtml50->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { chtml50->out = (X) ? BUFFERED_WRITE_VALUE(chtml50->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(chtml50->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml50->conf); W_V(nlcode); } while (0)
38 static char *s_chtml50_start_html_tag (void *pdoc, Node *node);
39 static char *s_chtml50_end_html_tag (void *pdoc, Node *node);
40 static char *s_chtml50_start_meta_tag (void *pdoc, Node *node);
41 static char *s_chtml50_end_meta_tag (void *pdoc, Node *node);
42 static char *s_chtml50_start_textarea_tag (void *pdoc, Node *node);
43 static char *s_chtml50_end_textarea_tag (void *pdoc, Node *node);
44 static char *s_chtml50_start_p_tag (void *pdoc, Node *node);
45 static char *s_chtml50_end_p_tag (void *pdoc, Node *node);
46 static char *s_chtml50_start_pre_tag (void *pdoc, Node *node);
47 static char *s_chtml50_end_pre_tag (void *pdoc, Node *node);
48 static char *s_chtml50_start_h1_tag (void *pdoc, Node *node);
49 static char *s_chtml50_end_h1_tag (void *pdoc, Node *node);
50 static char *s_chtml50_start_h2_tag (void *pdoc, Node *node);
51 static char *s_chtml50_end_h2_tag (void *pdoc, Node *node);
52 static char *s_chtml50_start_h3_tag (void *pdoc, Node *node);
53 static char *s_chtml50_end_h3_tag (void *pdoc, Node *node);
54 static char *s_chtml50_start_h4_tag (void *pdoc, Node *node);
55 static char *s_chtml50_end_h4_tag (void *pdoc, Node *node);
56 static char *s_chtml50_start_h5_tag (void *pdoc, Node *node);
57 static char *s_chtml50_end_h5_tag (void *pdoc, Node *node);
58 static char *s_chtml50_start_h6_tag (void *pdoc, Node *node);
59 static char *s_chtml50_end_h6_tag (void *pdoc, Node *node);
60 static char *s_chtml50_start_ul_tag (void *pdoc, Node *node);
61 static char *s_chtml50_end_ul_tag (void *pdoc, Node *node);
62 static char *s_chtml50_start_ol_tag (void *pdoc, Node *node);
63 static char *s_chtml50_end_ol_tag (void *pdoc, Node *node);
64 static char *s_chtml50_start_li_tag (void *pdoc, Node *node);
65 static char *s_chtml50_end_li_tag (void *pdoc, Node *node);
66 static char *s_chtml50_start_head_tag (void *pdoc, Node *node);
67 static char *s_chtml50_end_head_tag (void *pdoc, Node *node);
68 static char *s_chtml50_start_title_tag (void *pdoc, Node *node);
69 static char *s_chtml50_end_title_tag (void *pdoc, Node *node);
70 static char *s_chtml50_start_base_tag (void *pdoc, Node *node);
71 static char *s_chtml50_end_base_tag (void *pdoc, Node *node);
72 static char *s_chtml50_start_body_tag (void *pdoc, Node *node);
73 static char *s_chtml50_end_body_tag (void *pdoc, Node *node);
74 static char *s_chtml50_start_a_tag (void *pdoc, Node *node);
75 static char *s_chtml50_end_a_tag (void *pdoc, Node *node);
76 static char *s_chtml50_start_br_tag (void *pdoc, Node *node);
77 static char *s_chtml50_end_br_tag (void *pdoc, Node *node);
78 static char *s_chtml50_start_tr_tag (void *pdoc, Node *node);
79 static char *s_chtml50_end_tr_tag (void *pdoc, Node *node);
80 static char *s_chtml50_start_font_tag (void *pdoc, Node *node);
81 static char *s_chtml50_end_font_tag (void *pdoc, Node *node);
82 static char *s_chtml50_start_form_tag (void *pdoc, Node *node);
83 static char *s_chtml50_end_form_tag (void *pdoc, Node *node);
84 static char *s_chtml50_start_input_tag (void *pdoc, Node *node);
85 static char *s_chtml50_end_input_tag (void *pdoc, Node *node);
86 static char *s_chtml50_start_center_tag (void *pdoc, Node *node);
87 static char *s_chtml50_end_center_tag (void *pdoc, Node *node);
88 static char *s_chtml50_start_hr_tag (void *pdoc, Node *node);
89 static char *s_chtml50_end_hr_tag (void *pdoc, Node *node);
90 static char *s_chtml50_start_img_tag (void *pdoc, Node *node);
91 static char *s_chtml50_end_img_tag (void *pdoc, Node *node);
92 static char *s_chtml50_start_select_tag (void *pdoc, Node *node);
93 static char *s_chtml50_end_select_tag (void *pdoc, Node *node);
94 static char *s_chtml50_start_option_tag (void *pdoc, Node *node);
95 static char *s_chtml50_end_option_tag (void *pdoc, Node *node);
96 static char *s_chtml50_start_div_tag (void *pdoc, Node *node);
97 static char *s_chtml50_end_div_tag (void *pdoc, Node *node);
98 static char *s_chtml50_chxjif_tag (void *pdoc, Node *node);
99 static char *s_chtml50_text_tag (void *pdoc, Node *node);
100 static char *s_chtml50_start_blockquote_tag (void *pdoc, Node *node);
101 static char *s_chtml50_end_blockquote_tag (void *pdoc, Node *node);
102 static char *s_chtml50_start_dir_tag (void *pdoc, Node *node);
103 static char *s_chtml50_end_dir_tag (void *pdoc, Node *node);
104 static char *s_chtml50_start_dl_tag (void *pdoc, Node *node);
105 static char *s_chtml50_end_dl_tag (void *pdoc, Node *node);
106 static char *s_chtml50_start_dt_tag (void *pdoc, Node *node);
107 static char *s_chtml50_end_dt_tag (void *pdoc, Node *node);
108 static char *s_chtml50_start_dd_tag (void *pdoc, Node *node);
109 static char *s_chtml50_end_dd_tag (void *pdoc, Node *node);
110 static char *s_chtml50_start_marquee_tag (void *pdoc, Node *node);
111 static char *s_chtml50_end_marquee_tag (void *pdoc, Node *node);
112 static char *s_chtml50_start_blink_tag (void *pdoc, Node *node);
113 static char *s_chtml50_end_blink_tag (void *pdoc, Node *node);
114 static char *s_chtml50_start_menu_tag (void *pdoc, Node *node);
115 static char *s_chtml50_end_menu_tag (void *pdoc, Node *node);
116 static char *s_chtml50_start_plaintext_tag (void *pdoc, Node *node);
117 static char *s_chtml50_start_plaintext_tag_inner (void *pdoc, Node *node);
118 static char *s_chtml50_end_plaintext_tag (void *pdoc, Node *node);
119 static char *s_chtml50_newline_mark (void *pdoc, Node *node);
120 static char *s_chtml50_link_tag (void *pdoc, Node *node);
121 static char *s_chtml50_start_span_tag (void *pdoc, Node *node);
122 static char *s_chtml50_end_span_tag (void *pdoc, Node *node);
123 static char *s_chtml50_style_tag (void *pdoc, Node *node);
125 static void s_init_chtml50(chtml50_t *chtml, Doc *doc, request_rec *r, device_table *spec);
127 static int s_chtml50_search_emoji(chtml50_t *chtml, char *txt, char **rslt, Node *node);
128 static css_prop_list_t *s_chtml50_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
129 static css_prop_list_t *s_chtml50_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
132 tag_handler chtml50_handler[] = {
135 s_chtml50_start_html_tag,
136 s_chtml50_end_html_tag,
140 s_chtml50_start_meta_tag,
141 s_chtml50_end_meta_tag,
145 s_chtml50_start_textarea_tag,
146 s_chtml50_end_textarea_tag,
150 s_chtml50_start_p_tag,
155 s_chtml50_start_pre_tag,
156 s_chtml50_end_pre_tag,
160 s_chtml50_start_ul_tag,
161 s_chtml50_end_ul_tag,
165 s_chtml50_start_li_tag,
166 s_chtml50_end_li_tag,
170 s_chtml50_start_ol_tag,
171 s_chtml50_end_ol_tag,
175 s_chtml50_start_h1_tag,
176 s_chtml50_end_h1_tag,
180 s_chtml50_start_h2_tag,
181 s_chtml50_end_h2_tag,
185 s_chtml50_start_h3_tag,
186 s_chtml50_end_h3_tag,
190 s_chtml50_start_h4_tag,
191 s_chtml50_end_h4_tag,
195 s_chtml50_start_h5_tag,
196 s_chtml50_end_h5_tag,
200 s_chtml50_start_h6_tag,
201 s_chtml50_end_h6_tag,
205 s_chtml50_start_head_tag,
206 s_chtml50_end_head_tag,
210 s_chtml50_start_title_tag,
211 s_chtml50_end_title_tag,
215 s_chtml50_start_base_tag,
216 s_chtml50_end_base_tag,
220 s_chtml50_start_body_tag,
221 s_chtml50_end_body_tag,
225 s_chtml50_start_a_tag,
230 s_chtml50_start_br_tag,
231 s_chtml50_end_br_tag,
240 s_chtml50_start_tr_tag,
241 s_chtml50_end_tr_tag,
255 s_chtml50_start_font_tag,
256 s_chtml50_end_font_tag,
260 s_chtml50_start_form_tag,
261 s_chtml50_end_form_tag,
265 s_chtml50_start_input_tag,
266 s_chtml50_end_input_tag,
270 s_chtml50_start_center_tag,
271 s_chtml50_end_center_tag,
275 s_chtml50_start_hr_tag,
276 s_chtml50_end_hr_tag,
280 s_chtml50_start_img_tag,
281 s_chtml50_end_img_tag,
285 s_chtml50_start_select_tag,
286 s_chtml50_end_select_tag,
290 s_chtml50_start_option_tag,
291 s_chtml50_end_option_tag,
295 s_chtml50_start_div_tag,
296 s_chtml50_end_div_tag,
300 s_chtml50_chxjif_tag,
305 s_chtml50_chxjif_tag,
325 s_chtml50_start_span_tag,
326 s_chtml50_end_span_tag,
350 s_chtml50_start_dt_tag,
351 s_chtml50_end_dt_tag,
365 s_chtml50_start_blockquote_tag,
366 s_chtml50_end_blockquote_tag,
370 s_chtml50_start_dir_tag,
371 s_chtml50_end_dir_tag,
375 s_chtml50_start_dl_tag,
376 s_chtml50_end_dl_tag,
380 s_chtml50_start_dd_tag,
381 s_chtml50_end_dd_tag,
385 s_chtml50_start_menu_tag,
386 s_chtml50_end_menu_tag,
390 s_chtml50_start_plaintext_tag,
391 s_chtml50_end_plaintext_tag,
395 s_chtml50_start_blink_tag,
396 s_chtml50_end_blink_tag,
400 s_chtml50_start_marquee_tag,
401 s_chtml50_end_marquee_tag,
410 s_chtml50_newline_mark,
432 * converts from CHTML5.0 to CHTML3.0.
434 * @param r [i] Requet_rec is appointed.
435 * @param spec [i] The result of the device specification processing which
436 * was done in advance is appointed.
437 * @param src [i] The character string before the converting is appointed.
438 * @return The character string after the converting is returned.
441 chxj_convert_chtml50(
447 chxjconvrule_entry *entryp,
456 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
458 /*--------------------------------------------------------------------------*/
460 /*--------------------------------------------------------------------------*/
462 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
464 DBG(r,"REQ[%X] i found qrcode xml",TO_ADDR(r));
465 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
469 /*--------------------------------------------------------------------------*/
470 /* The CHTML structure is initialized. */
471 /*--------------------------------------------------------------------------*/
472 s_init_chtml50(&chtml50, &doc, r, spec);
474 chtml50.entryp = entryp;
475 chtml50.cookie = cookie;
477 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
479 /*--------------------------------------------------------------------------*/
480 /* The character string of the input is analyzed. */
481 /*--------------------------------------------------------------------------*/
482 qs_init_malloc(&doc);
483 qs_init_root_node(&doc);
485 ss = apr_pcalloc(r->pool, srclen + 1);
486 memset(ss, 0, srclen + 1);
487 memcpy(ss, src, srclen);
490 chxj_dump_out("[src] CHTML -> CHTML4.0", ss, srclen);
492 if (IS_CSS_ON(chtml50.entryp)) {
493 /* current property list */
494 chtml50.css_prop_stack = chxj_new_prop_list_stack(&doc);
497 chxj_buffered_write_init(r->pool, &doc.buf);
499 qs_parse_string(&doc,ss, strlen(ss));
501 /*--------------------------------------------------------------------------*/
502 /* It converts it from CHTML to CHTML. */
503 /*--------------------------------------------------------------------------*/
504 chxj_node_convert(spec,r,(void*)&chtml50, &doc, qs_get_root(&doc), 0);
505 chtml50.out = chxj_buffered_write_flush(chtml50.out, &doc.buf);
506 dst = apr_pstrdup(r->pool, chtml50.out);
507 chxj_buffered_write_terminate(&doc.buf);
509 qs_all_free(&doc,QX_LOGMARK);
512 dst = apr_pstrdup(r->pool,ss);
514 if (strlen(dst) == 0) {
515 dst = apr_psprintf(r->pool, "\n");
518 *dstlen = strlen(dst);
521 chxj_dump_out("[src] CHTML -> CHTML4.0", dst, *dstlen);
524 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
530 * The CHTML structure is initialized.
532 * @param chtml50 [i/o] The pointer to the HDML structure that wants to be
533 * initialized is specified.
534 * @param doc [i] The Doc structure that should be set to the initialized
535 * HDML structure is specified.
536 * @param r [i] To use POOL, the pointer to request_rec is specified.
537 * @param spec [i] The pointer to the device_table
540 s_init_chtml50(chtml50_t *chtml50, Doc *doc, request_rec *r, device_table *spec)
542 memset(doc, 0, sizeof(Doc));
543 memset(chtml50, 0, sizeof(chtml50_t));
547 chtml50->spec = spec;
548 chtml50->out = qs_alloc_zero_byte_string(r->pool);
549 chtml50->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
550 chtml50->doc->parse_mode = PARSE_MODE_CHTML;
555 * Corresponding EMOJI to a current character-code is retrieved.
556 * The substitution character string is stored in the rslt pointer if agreeing.
558 * @param chtml50 [i] The pointer to the CHTML structure is specified.
559 * @param txt [i] The character string to want to examine whether it is
560 * EMOJI is specified.
561 * @param rslt [o] The pointer to the pointer that stores the result is
563 * @param node [i] The current node to check whether tag is span/font for CHXJ_IMODE_EMOJI_COLOR_AUTO.
564 * @return When corresponding EMOJI exists, it returns it excluding 0.
567 s_chtml50_search_emoji(chtml50_t *chtml50, char *txt, char **rslt, Node *node)
574 spec = chtml50->spec;
580 DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
583 for (ee = chtml50->conf->emoji;
586 if (ee->imode == NULL) {
587 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
591 if (ee->imode->string != NULL
592 && strlen(ee->imode->string) > 0
593 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
595 if (spec == NULL || spec->emoji_type == NULL) {
596 *rslt = apr_palloc(r->pool, 3);
597 (*rslt)[0] = ee->imode->hex1byte & 0xff;
598 (*rslt)[1] = ee->imode->hex2byte & 0xff;
601 if(chtml50->conf->imode_emoji_color >= CHXJ_IMODE_EMOJI_COLOR_AUTO ){
602 if(ee->imode->color != NULL){
603 if(chtml50->conf->imode_emoji_color == CHXJ_IMODE_EMOJI_COLOR_AUTO && node != NULL ){
604 if(strcasecmp(node->parent->name, "span") == 0 ||
605 strcasecmp(node->parent->name, "font") == 0 ){
606 return strlen(ee->imode->string);
609 char *tmp = apr_pstrdup(r->pool,*rslt);
610 *rslt = apr_psprintf(r->pool,
611 "<font color=\"%s\">%s</font>",ee->imode->color,tmp);
614 return strlen(ee->imode->string);
626 chxj_chtml50_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
637 chtml50 = &__chtml50;
640 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
641 memset(doc, 0, sizeof(Doc));
642 memset(chtml50, 0, sizeof(chtml50_t));
646 chtml50->spec = spec;
647 chtml50->out = qs_alloc_zero_byte_string(r->pool);
648 chtml50->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
649 chtml50->doc->parse_mode = PARSE_MODE_CHTML;
651 apr_pool_create(&pool, r->pool);
653 chxj_buffered_write_init(pool, &doc->buf);
655 for (ii=0; ii<len; ii++) {
659 rtn = s_chtml50_search_emoji(chtml50, (char *)&src[ii], &out, NULL);
666 if (is_sjis_kanji(src[ii])) {
667 two_byte[0] = src[ii+0];
668 two_byte[1] = src[ii+1];
674 one_byte[0] = src[ii+0];
679 chtml50->out = chxj_buffered_write_flush(chtml50->out, &doc->buf);
681 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
687 * It is a handler who processes the HTML tag.
689 * @param pdoc [i/o] The pointer to the CHTML structure at the output
690 * destination is specified.
691 * @param node [i] The HTML tag node is specified.
692 * @return The conversion result is returned.
695 s_chtml50_start_html_tag(void *pdoc, Node *UNUSED(node))
697 chtml50_t *chtml50 = GET_CHTML50(pdoc);
698 Doc *doc = chtml50->doc;
700 /*--------------------------------------------------------------------------*/
702 /*--------------------------------------------------------------------------*/
710 * It is a handler who processes the HTML tag.
712 * @param pdoc [i/o] The pointer to the CHTML structure at the output
713 * destination is specified.
714 * @param node [i] The HTML tag node is specified.
715 * @return The conversion result is returned.
718 s_chtml50_end_html_tag(void *pdoc, Node *UNUSED(child))
720 chtml50_t *chtml50 = GET_CHTML50(pdoc);
721 Doc *doc = chtml50->doc;
730 * It is a handler who processes the META tag.
732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
733 * destination is specified.
734 * @param node [i] The META tag node is specified.
735 * @return The conversion result is returned.
738 s_chtml50_start_meta_tag(void *pdoc, Node *node)
744 int content_type_flag;
747 chtml50 = GET_CHTML50(pdoc);
751 content_type_flag = 0;
755 /*--------------------------------------------------------------------------*/
757 /*--------------------------------------------------------------------------*/
758 for (attr = qs_get_attr(doc,node);
760 attr = qs_get_next_attr(doc,attr)) {
761 char *name = qs_get_attr_name(doc,attr);
762 char *value = qs_get_attr_value(doc,attr);
766 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
767 /*----------------------------------------------------------------------*/
769 /*----------------------------------------------------------------------*/
770 W_L(" http-equiv=\"");
773 if (STRCASEEQ('c','C',"content-type", value))
774 content_type_flag = 1;
776 if (STRCASEEQ('r','R',"refresh", value))
783 if (strcasecmp(name, "content") == 0 && value && *value) {
784 if (content_type_flag) {
788 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
796 buf = apr_pstrdup(r->pool, value);
797 url = strchr(buf, ';');
799 sec = apr_pstrdup(r->pool, buf);
802 url = chxj_encoding_parameter(r, url, 0);
803 url = chxj_add_cookie_parameter(r, url, chtml50->cookie);
834 * It is a handler who processes the META tag.
836 * @param pdoc [i/o] The pointer to the CHTML structure at the output
837 * destination is specified.
838 * @param node [i] The META tag node is specified.
839 * @return The conversion result is returned.
842 s_chtml50_end_meta_tag(void* pdoc, Node* UNUSED(child))
844 chtml50_t *chtml50 = GET_CHTML50(pdoc);
851 * It is a handler who processes the HEAD tag.
853 * @param pdoc [i/o] The pointer to the CHTML structure at the output
854 * destination is specified.
855 * @param node [i] The HEAD tag node is specified.
856 * @return The conversion result is returned.
859 s_chtml50_start_head_tag(void* pdoc, Node* UNUSED(node))
861 chtml50_t *chtml50 = GET_CHTML50(pdoc);
862 Doc *doc = chtml50->doc;
871 * It is a handler who processes the HEAD tag.
873 * @param pdoc [i/o] The pointer to the CHTML structure at the output
874 * destination is specified.
875 * @param node [i] The HEAD tag node is specified.
876 * @return The conversion result is returned.
879 s_chtml50_end_head_tag(void *pdoc, Node *UNUSED(node))
881 chtml50_t *chtml50 = GET_CHTML50(pdoc);
882 Doc *doc = chtml50->doc;
891 * It is a handler who processes the TITLE tag.
893 * @param pdoc [i/o] The pointer to the CHTML structure at the output
894 * destination is specified.
895 * @param node [i] The TITLE tag node is specified.
896 * @return The conversion result is returned.
899 s_chtml50_start_title_tag(void *pdoc, Node *node)
901 chtml50_t *chtml50 = GET_CHTML50(pdoc);
902 Doc *doc = chtml50->doc;
906 if (chtml50->conf->use_google_analytics) {
907 chtml50->pagetitle = "";
909 for (child = qs_get_child_node(doc,node);
911 child = qs_get_next_node(doc,child)) {
912 char *textval = qs_get_node_value(doc,child);
913 chtml50->pagetitle = apr_pstrcat(doc->r->pool, chtml50->pagetitle, textval, NULL);
922 * It is a handler who processes the TITLE tag.
924 * @param pdoc [i/o] The pointer to the CHTML structure at the output
925 * destination is specified.
926 * @param node [i] The TITLE tag node is specified.
927 * @return The conversion result is returned.
930 s_chtml50_end_title_tag(void *pdoc, Node *UNUSED(child))
932 chtml50_t *chtml50 = GET_CHTML50(pdoc);
933 Doc *doc = chtml50->doc;
942 * It is a handler who processes the BASE tag.
944 * @param pdoc [i/o] The pointer to the CHTML structure at the output
945 * destination is specified.
946 * @param node [i] The BASE tag node is specified.
947 * @return The conversion result is returned.
950 s_chtml50_start_base_tag(void *pdoc, Node *node)
957 chtml50 = GET_CHTML50(pdoc);
962 /*--------------------------------------------------------------------------*/
964 /*--------------------------------------------------------------------------*/
965 for (attr = qs_get_attr(doc,node);
967 attr = qs_get_next_attr(doc,attr)) {
968 char *name = qs_get_attr_name(doc,attr);
969 char *value = qs_get_attr_value(doc,attr);
970 if (STRCASEEQ('h','H',"href", name)) {
983 * It is a handler who processes the BASE tag.
985 * @param pdoc [i/o] The pointer to the CHTML structure at the output
986 * destination is specified.
987 * @param node [i] The BASE tag node is specified.
988 * @return The conversion result is returned.
991 s_chtml50_end_base_tag(void *pdoc, Node *UNUSED(child))
993 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1000 * It is a handler who processes the BODY tag.
1002 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The BODY tag node is specified.
1005 * @return The conversion result is returned.
1008 s_chtml50_start_body_tag(void *pdoc, Node *node)
1014 char *attr_bgcolor = NULL;
1015 char *attr_text = NULL;
1016 char *attr_link = NULL;
1017 char *attr_style = NULL;
1018 char *attr_alink = NULL;
1019 char *attr_vlink = NULL;
1021 chtml50 = GET_CHTML50(pdoc);
1025 /*--------------------------------------------------------------------------*/
1026 /* Get Attributes */
1027 /*--------------------------------------------------------------------------*/
1028 for (attr = qs_get_attr(doc,node);
1030 attr = qs_get_next_attr(doc,attr)) {
1031 char *name = qs_get_attr_name(doc,attr);
1032 char *value = qs_get_attr_value(doc,attr);
1033 if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
1034 /*----------------------------------------------------------------------*/
1036 /*----------------------------------------------------------------------*/
1037 attr_bgcolor = value;
1039 else if (STRCASEEQ('t','T', "text", name) && value && *value) {
1040 /*----------------------------------------------------------------------*/
1042 /*----------------------------------------------------------------------*/
1045 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1051 else if (STRCASEEQ('a','A',"alink", name) && value && *value) {
1052 /*----------------------------------------------------------------------*/
1054 /*----------------------------------------------------------------------*/
1057 else if (STRCASEEQ('v','V',"vlink", name) && value && *value) {
1058 /*----------------------------------------------------------------------*/
1060 /*----------------------------------------------------------------------*/
1063 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1068 if (IS_CSS_ON(chtml50->entryp)) {
1069 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1071 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1072 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1073 css_property_t *cur;
1074 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1075 if (cur->value && *cur->value) {
1076 attr_text = apr_pstrdup(doc->pool, cur->value);
1079 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1080 if (cur->value && *cur->value) {
1081 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1085 if (chtml50->style) {
1086 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml50->style);
1087 css_selector_t *cur_sel;
1088 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1089 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1090 css_property_t *cur;
1091 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1092 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1093 attr_link = apr_pstrdup(doc->pool, cur->value);
1097 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1098 css_property_t *cur;
1099 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1100 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1101 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1105 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
1106 css_property_t *cur;
1107 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1108 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1109 attr_alink = apr_pstrdup(doc->pool, cur->value);
1119 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1125 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1131 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1137 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1143 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1150 return chtml50->out;
1155 * It is a handler who processes the BODY tag.
1157 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1158 * destination is specified.
1159 * @param node [i] The BODY tag node is specified.
1160 * @return The conversion result is returned.
1163 s_chtml50_end_body_tag(void *pdoc, Node *UNUSED(child))
1168 chtml50 = GET_CHTML50(pdoc);
1171 if (chtml50->conf->use_google_analytics) {
1172 char *src = chxj_google_analytics_get_image_url(doc->r, chtml50->pagetitle);
1178 if (IS_CSS_ON(chtml50->entryp)) {
1179 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1182 return chtml50->out;
1187 * It is a handler who processes the A tag.
1189 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1190 * destination is specified.
1191 * @param node [i] The A tag node is specified.
1192 * @return The conversion result is returned.
1195 s_chtml50_start_a_tag(void *pdoc, Node *node)
1201 char *attr_style = NULL;
1203 chtml50 = GET_CHTML50(pdoc);
1208 /*--------------------------------------------------------------------------*/
1209 /* Get Attributes */
1210 /*--------------------------------------------------------------------------*/
1211 for (attr = qs_get_attr(doc,node);
1213 attr = qs_get_next_attr(doc,attr)) {
1214 char *name = qs_get_attr_name(doc,attr);
1215 char *value = qs_get_attr_value(doc,attr);
1216 if (STRCASEEQ('n','N',"name", name)) {
1217 /*----------------------------------------------------------------------*/
1219 /*----------------------------------------------------------------------*/
1224 else if (STRCASEEQ('h','H',"href", name)) {
1225 /*----------------------------------------------------------------------*/
1227 /*----------------------------------------------------------------------*/
1228 value = chxj_encoding_parameter(r, value, 0);
1229 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1230 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
1236 else if (STRCASEEQ('a','A',"accesskey", name)) {
1237 /*----------------------------------------------------------------------*/
1239 /*----------------------------------------------------------------------*/
1240 W_L(" accesskey=\"");
1244 else if (STRCASEEQ('c','C',"cti", name)) {
1245 /*----------------------------------------------------------------------*/
1247 /*----------------------------------------------------------------------*/
1252 else if (STRCASEEQ('i','I',"ijam", name)) {
1253 /*----------------------------------------------------------------------*/
1255 /*----------------------------------------------------------------------*/
1258 else if (STRCASEEQ('u','U',"utn", name)) {
1259 /*----------------------------------------------------------------------*/
1261 /* It is special only for CHTML. */
1262 /*----------------------------------------------------------------------*/
1265 else if (STRCASEEQ('t','T',"telbook", name)) {
1266 /*----------------------------------------------------------------------*/
1268 /*----------------------------------------------------------------------*/
1271 else if (STRCASEEQ('k','K',"kana", name)) {
1272 /*----------------------------------------------------------------------*/
1274 /*----------------------------------------------------------------------*/
1277 else if (STRCASEEQ('e','E',"email", name)) {
1278 /*----------------------------------------------------------------------*/
1280 /*----------------------------------------------------------------------*/
1283 else if (STRCASEEQ('i','I',"ista", name)) {
1284 /*----------------------------------------------------------------------*/
1286 /*----------------------------------------------------------------------*/
1289 else if (STRCASEEQ('i','I',"ilet", name)) {
1290 /*----------------------------------------------------------------------*/
1292 /*----------------------------------------------------------------------*/
1295 else if (STRCASEEQ('i','I',"iswf", name)) {
1296 /*----------------------------------------------------------------------*/
1298 /*----------------------------------------------------------------------*/
1301 else if (STRCASEEQ('i','I',"irst", name)) {
1302 /*----------------------------------------------------------------------*/
1304 /*----------------------------------------------------------------------*/
1307 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1313 if (IS_CSS_ON(chtml50->entryp)) {
1314 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1317 return chtml50->out;
1322 * It is a handler who processes the A tag.
1324 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1325 * destination is specified.
1326 * @param node [i] The A tag node is specified.
1327 * @return The conversion result is returned.
1330 s_chtml50_end_a_tag(void *pdoc, Node *UNUSED(child))
1335 chtml50 = GET_CHTML50(pdoc);
1340 if (IS_CSS_ON(chtml50->entryp)) {
1341 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1344 return chtml50->out;
1349 * It is a handler who processes the BR tag.
1351 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1352 * destination is specified.
1353 * @param node [i] The BR tag node is specified.
1354 * @return The conversion result is returned.
1357 s_chtml50_start_br_tag(void *pdoc, Node *node)
1364 chtml50 = GET_CHTML50(pdoc);
1368 /*--------------------------------------------------------------------------*/
1369 /* Get Attributes */
1370 /*--------------------------------------------------------------------------*/
1371 for (attr = qs_get_attr(doc,node);
1373 attr = qs_get_next_attr(doc,attr)) {
1374 char *name = qs_get_attr_name(doc,attr);
1375 char *value = qs_get_attr_value(doc,attr);
1376 if (STRCASEEQ('c','C',"clear",name)) {
1377 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1385 return chtml50->out;
1390 * It is a handler who processes the BR tag.
1392 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1393 * destination is specified.
1394 * @param node [i] The BR tag node is specified.
1395 * @return The conversion result is returned.
1398 s_chtml50_end_br_tag(void *pdoc, Node *UNUSED(child))
1400 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1402 return chtml50->out;
1407 * It is a handler who processes the TR tag.
1409 * @param chtml50 [i/o] The pointer to the CHTML structure at the output
1410 * destination is specified.
1411 * @param node [i] The TR tag node is specified.
1412 * @return The conversion result is returned.
1415 s_chtml50_start_tr_tag(void *pdoc, Node *UNUSED(node))
1417 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1419 return chtml50->out;
1424 * It is a handler who processes the TR tag.
1426 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1427 * destination is specified.
1428 * @param node [i] The TR tag node is specified.
1429 * @return The conversion result is returned.
1432 s_chtml50_end_tr_tag(void *pdoc, Node *UNUSED(child))
1438 chtml50 = GET_CHTML50(pdoc);
1444 return chtml50->out;
1449 * It is a handler who processes the FONT tag.
1451 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1452 * destination is specified.
1453 * @param node [i] The FONT tag node is specified.
1454 * @return The conversion result is returned.
1457 s_chtml50_start_font_tag(void *pdoc, Node *node)
1463 char *attr_color = NULL;
1464 char *attr_size = NULL;
1465 char *attr_style = NULL;
1467 chtml50 = GET_CHTML50(pdoc);
1471 /*--------------------------------------------------------------------------*/
1472 /* Get Attributes */
1473 /*--------------------------------------------------------------------------*/
1474 for (attr = qs_get_attr(doc,node);
1476 attr = qs_get_next_attr(doc,attr)) {
1477 char *name = qs_get_attr_name(doc,attr);
1478 char *value = qs_get_attr_value(doc,attr);
1479 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1480 attr_color = apr_pstrdup(doc->buf.pool, value);
1482 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1483 /*----------------------------------------------------------------------*/
1485 /*----------------------------------------------------------------------*/
1486 attr_size = apr_pstrdup(doc->buf.pool, value);
1487 switch (*attr_size) {
1495 if (*(attr_size + 1) == 0) {
1504 char ch = *(attr_size + 1);
1505 if (ch == '1' || ch == '2' || ch == '3') {
1506 if (*(attr_size + 2) == 0) {
1518 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1522 if (IS_CSS_ON(chtml50->entryp)) {
1523 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1525 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1526 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1527 css_property_t *cur;
1528 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1529 if (cur->value && *cur->value) {
1530 attr_color = apr_pstrdup(doc->pool, cur->value);
1533 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1534 if (cur->value && *cur->value) {
1535 attr_size = apr_pstrdup(doc->pool, cur->value);
1536 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1537 attr_size = apr_pstrdup(doc->pool, "1");
1539 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1540 attr_size = apr_pstrdup(doc->pool, "2");
1542 else if (STRCASEEQ('s','S',"small",attr_size)) {
1543 attr_size = apr_pstrdup(doc->pool, "3");
1545 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1546 attr_size = apr_pstrdup(doc->pool, "4");
1548 else if (STRCASEEQ('l','L',"large",attr_size)) {
1549 attr_size = apr_pstrdup(doc->pool, "5");
1551 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1552 attr_size = apr_pstrdup(doc->pool, "6");
1554 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1555 attr_size = apr_pstrdup(doc->pool, "7");
1562 if (attr_color || attr_size) {
1565 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1576 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1577 flg->with_font_flag = 1;
1578 node->userData = flg;
1581 node->userData = NULL;
1583 return chtml50->out;
1588 * It is a handler who processes the FONT tag.
1590 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1591 * destination is specified.
1592 * @param node [i] The FONT tag node is specified.
1593 * @return The conversion result is returned.
1596 s_chtml50_end_font_tag(void *pdoc, Node *node)
1602 chtml50 = GET_CHTML50(pdoc);
1606 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
1607 if (flg && flg->with_font_flag) {
1610 if (IS_CSS_ON(chtml50->entryp)) {
1611 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1614 return chtml50->out;
1619 * It is a handler who processes the FORM tag.
1621 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1622 * destination is specified.
1623 * @param node [i] The FORM tag node is specified.
1624 * @return The conversion result is returned.
1627 s_chtml50_start_form_tag(void *pdoc, Node *node)
1633 char *attr_action = NULL;
1634 char *attr_method = NULL;
1635 char *attr_style = NULL;
1636 char *attr_color = NULL;
1637 char *attr_align = NULL;
1638 char *attr_utn = NULL;
1639 char *new_hidden_tag = NULL;
1641 chtml50 = GET_CHTML50(pdoc);
1645 /*--------------------------------------------------------------------------*/
1646 /* Get Attributes */
1647 /*--------------------------------------------------------------------------*/
1648 for (attr = qs_get_attr(doc,node);
1650 attr = qs_get_next_attr(doc,attr)) {
1651 char *name = qs_get_attr_name(doc,attr);
1652 char *value = qs_get_attr_value(doc,attr);
1656 if (strcasecmp(name, "action") == 0) {
1657 /*--------------------------------------------------------------------*/
1659 /*--------------------------------------------------------------------*/
1660 attr_action = value;
1666 if (strcasecmp(name, "method") == 0) {
1667 /*--------------------------------------------------------------------*/
1669 /*--------------------------------------------------------------------*/
1670 attr_method = value;
1676 if (strcasecmp(name, "utn") == 0) {
1677 /*--------------------------------------------------------------------*/
1679 /*--------------------------------------------------------------------*/
1686 if (strcasecmp(name, "style") == 0) {
1695 if (IS_CSS_ON(chtml50->entryp)) {
1696 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1698 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1699 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1700 css_property_t *cur;
1701 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1702 if (STRCASEEQ('l','L',"left", cur->value)) {
1703 attr_align = apr_pstrdup(doc->pool, "left");
1705 else if (STRCASEEQ('c','C',"center",cur->value)) {
1706 attr_align = apr_pstrdup(doc->pool, "center");
1708 else if (STRCASEEQ('r','R',"right",cur->value)) {
1709 attr_align = apr_pstrdup(doc->pool, "right");
1712 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1713 attr_color = apr_pstrdup(doc->pool, cur->value);
1718 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1722 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1723 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml50->cookie);
1725 char *new_query_string = NULL;
1726 q = strchr(attr_action, '?');
1728 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml50->entryp);
1729 if (new_hidden_tag || new_query_string) {
1735 if (new_query_string) {
1737 W_V(new_query_string);
1751 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
1752 memset(flg, 0, sizeof(*flg));
1754 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1755 W_L("<font color=\"");
1758 flg->with_font_flag = 1;
1761 W_L("<div align=\"");
1764 flg->with_div_flag = 1;
1766 node->userData = flg;
1767 if (new_hidden_tag) {
1768 W_V(new_hidden_tag);
1771 return chtml50->out;
1776 * It is a handler who processes the FORM tag.
1778 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1779 * destination is specified.
1780 * @param node [i] The FORM tag node is specified.
1781 * @return The conversion result is returned.
1784 s_chtml50_end_form_tag(void *pdoc, Node *node)
1789 chtml50 = GET_CHTML50(pdoc);
1792 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
1793 if (flg && flg->with_div_flag) {
1796 if (flg && flg->with_font_flag) {
1800 if (IS_CSS_ON(chtml50->entryp)) {
1801 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1804 return chtml50->out;
1809 * It is a handler who processes the INPUT tag.
1811 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1812 * destination is specified.
1813 * @param node [i] The INPUT tag node is specified.
1814 * @return The conversion result is returned.
1817 s_chtml50_start_input_tag(void *pdoc, Node *node)
1823 char *attr_accesskey = NULL;
1824 char *attr_max_length = NULL;
1825 char *attr_type = NULL;
1826 char *attr_name = NULL;
1827 char *attr_value = NULL;
1828 char *attr_istyle = NULL;
1829 char *attr_size = NULL;
1830 char *attr_checked = NULL;
1831 char *attr_style = NULL;
1833 chtml50 = GET_CHTML50(pdoc);
1837 /*--------------------------------------------------------------------------*/
1838 /* Get Attributes */
1839 /*--------------------------------------------------------------------------*/
1840 for (attr = qs_get_attr(doc,node);
1842 attr = qs_get_next_attr(doc,attr)) {
1843 char *name = qs_get_attr_name(doc,attr);
1844 char *value = qs_get_attr_value(doc,attr);
1845 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1846 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1847 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1848 STRCASEEQ('p','P',"password",tmp_type) ||
1849 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1850 STRCASEEQ('r','R',"radio", tmp_type) ||
1851 STRCASEEQ('h','H',"hidden", tmp_type) ||
1852 STRCASEEQ('s','S',"submit", tmp_type) ||
1853 STRCASEEQ('r','R',"reset", tmp_type))) {
1854 attr_type = tmp_type;
1857 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1860 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1863 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1864 attr_istyle = value;
1866 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1867 attr_max_length = value;
1869 else if (STRCASEEQ('c','C',"checked", name)) {
1870 attr_checked = value;
1872 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1873 attr_accesskey = value;
1875 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1878 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1883 if (IS_CSS_ON(chtml50->entryp)) {
1884 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
1886 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1887 css_property_t *cur;
1888 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1889 if (strcasestr(cur->value, "<ja:n>")) {
1892 else if (strcasestr(cur->value, "<ja:en>")) {
1895 else if (strcasestr(cur->value, "<ja:hk>")) {
1898 else if (strcasestr(cur->value, "<ja:h>")) {
1922 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1923 apr_size_t value_len = strlen(attr_value);
1924 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml50->entryp);
1928 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1931 if (attr_accesskey) {
1932 W_L(" accesskey=\"");
1933 W_V(attr_accesskey);
1937 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1943 /*--------------------------------------------------------------------------*/
1944 /* The figure is default for the password. */
1945 /*--------------------------------------------------------------------------*/
1946 if (attr_max_length) {
1947 if (chxj_chk_numeric(attr_max_length) != 0) {
1948 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1950 if (attr_istyle && *attr_istyle == '1') {
1951 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1955 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1964 return chtml50->out;
1969 * It is a handler who processes the INPUT tag.
1971 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1972 * destination is specified.
1973 * @param node [i] The INPUT tag node is specified.
1974 * @return The conversion result is returned.
1977 s_chtml50_end_input_tag(void *pdoc, Node *UNUSED(child))
1979 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1981 return chtml50->out;
1986 * It is a handler who processes the CENTER tag.
1988 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1989 * destination is specified.
1990 * @param node [i] The CENTER tag node is specified.
1991 * @return The conversion result is returned.
1994 s_chtml50_start_center_tag(void *pdoc, Node *node)
1999 char *attr_style = NULL;
2000 char *attr_color = NULL;
2001 char *attr_size = NULL;
2003 chtml50 = GET_CHTML50(pdoc);
2006 for (attr = qs_get_attr(doc,node);
2008 attr = qs_get_next_attr(doc,attr)) {
2009 char *name = qs_get_attr_name(doc,attr);
2010 char *value = qs_get_attr_value(doc,attr);
2011 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2015 if (IS_CSS_ON(chtml50->entryp)) {
2016 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2018 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2019 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2020 css_property_t *cur;
2021 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2022 if (cur->value && *cur->value) {
2023 attr_color = apr_pstrdup(doc->pool, cur->value);
2026 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2027 if (cur->value && *cur->value) {
2028 attr_size = apr_pstrdup(doc->pool, cur->value);
2029 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2030 attr_size = apr_pstrdup(doc->pool, "1");
2032 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2033 attr_size = apr_pstrdup(doc->pool, "2");
2035 else if (STRCASEEQ('s','S',"small",attr_size)) {
2036 attr_size = apr_pstrdup(doc->pool, "3");
2038 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2039 attr_size = apr_pstrdup(doc->pool, "4");
2041 else if (STRCASEEQ('l','L',"large",attr_size)) {
2042 attr_size = apr_pstrdup(doc->pool, "5");
2044 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2045 attr_size = apr_pstrdup(doc->pool, "6");
2047 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2048 attr_size = apr_pstrdup(doc->pool, "7");
2056 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
2057 memset(flg, 0, sizeof(*flg));
2058 if (attr_color || attr_size) {
2061 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2071 flg->with_font_flag = 1;
2074 node->userData = flg;
2076 return chtml50->out;
2081 * It is a handler who processes the CENTER tag.
2083 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2084 * destination is specified.
2085 * @param node [i] The CENTER tag node is specified.
2086 * @return The conversion result is returned.
2089 s_chtml50_end_center_tag(void *pdoc, Node *node)
2094 chtml50 = GET_CHTML50(pdoc);
2097 if (IS_CSS_ON(chtml50->entryp)) {
2098 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2100 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
2101 if (flg && flg->with_font_flag) {
2106 return chtml50->out;
2111 * It is a handler who processes the HR tag.
2113 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2114 * destination is specified.
2115 * @param node [i] The HR tag node is specified.
2116 * @return The conversion result is returned.
2119 s_chtml50_start_hr_tag(void *pdoc, Node *node)
2125 char *attr_align = NULL;
2126 char *attr_size = NULL;
2127 char *attr_width = NULL;
2128 char *attr_noshade = NULL;
2129 char *attr_style = NULL;
2130 char *attr_color = NULL;
2132 chtml50 = GET_CHTML50(pdoc);
2136 for (attr = qs_get_attr(doc,node);
2138 attr = qs_get_next_attr(doc,attr)) {
2139 char *name = qs_get_attr_name (doc,attr);
2140 char *value = qs_get_attr_value(doc,attr);
2144 if (strcasecmp(name, "align") == 0) {
2145 /*--------------------------------------------------------------------*/
2147 /*--------------------------------------------------------------------*/
2148 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2156 if (strcasecmp(name, "size") == 0) {
2157 /*--------------------------------------------------------------------*/
2159 /*--------------------------------------------------------------------*/
2160 if (value && *value) {
2164 else if (strcasecmp(name, "style") == 0) {
2165 if (value && *value) {
2173 if (strcasecmp(name, "width") == 0) {
2174 /*--------------------------------------------------------------------*/
2176 /*--------------------------------------------------------------------*/
2177 if (value && *value) {
2185 if (strcasecmp(name, "noshade") == 0) {
2186 /*--------------------------------------------------------------------*/
2188 /*--------------------------------------------------------------------*/
2189 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2195 if (strcasecmp(name, "color") == 0 && value && *value) {
2196 /*--------------------------------------------------------------------*/
2198 /*--------------------------------------------------------------------*/
2207 if (IS_CSS_ON(chtml50->entryp)) {
2208 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2210 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2211 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2212 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2213 css_property_t *cur;
2214 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2215 if (STRCASEEQ('s','S',"solid",cur->value)) {
2216 attr_noshade = "noshade";
2219 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2220 char *tmp = apr_pstrdup(doc->pool, cur->value);
2221 char *tmpp = strstr(tmp, "px");
2224 attr_size = apr_pstrdup(doc->pool, tmp);
2227 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2228 char *tmp = apr_pstrdup(doc->pool, cur->value);
2229 char *tmpp = strstr(tmp, "px");
2232 attr_width = apr_pstrdup(doc->pool, tmp);
2235 tmpp = strstr(tmp, "%");
2237 attr_width = apr_pstrdup(doc->pool, tmp);
2268 return chtml50->out;
2273 * It is a handler who processes the HR tag.
2275 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2276 * destination is specified.
2277 * @param node [i] The HR tag node is specified.
2278 * @return The conversion result is returned.
2281 s_chtml50_end_hr_tag(void *pdoc, Node *UNUSED(child))
2283 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2285 return chtml50->out;
2290 * It is a handler who processes the IMG tag.
2292 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2293 * destination is specified.
2294 * @param node [i] The IMG tag node is specified.
2295 * @return The conversion result is returned.
2298 s_chtml50_start_img_tag(void *pdoc, Node *node)
2304 char *attr_src = NULL;
2305 char *attr_align = NULL;
2306 char *attr_style = NULL;
2307 char *attr_alt = NULL;
2308 char *attr_width = NULL;
2309 char *attr_height = NULL;
2310 char *attr_hspace = NULL;
2311 char *attr_vspace = NULL;
2312 #ifndef IMG_NOT_CONVERT_FILENAME
2316 chtml50 = GET_CHTML50(pdoc);
2317 #ifndef IMG_NOT_CONVERT_FILENAME
2318 spec = chtml50->spec;
2323 /*--------------------------------------------------------------------------*/
2324 /* Get Attributes */
2325 /*--------------------------------------------------------------------------*/
2326 for (attr = qs_get_attr(doc,node);
2328 attr = qs_get_next_attr(doc,attr)) {
2329 char *name = qs_get_attr_name (doc,attr);
2330 char *value = qs_get_attr_value(doc,attr);
2334 if (strcasecmp(name, "src") == 0) {
2335 /*--------------------------------------------------------------------*/
2337 /*--------------------------------------------------------------------*/
2338 #ifdef IMG_NOT_CONVERT_FILENAME
2339 value = chxj_encoding_parameter(r, value, 0);
2340 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
2341 value = chxj_add_cookie_no_update_parameter(r, value, 0);
2342 value = chxj_img_rewrite_parameter(r,chtml50->conf,value);
2345 value = chxj_img_conv(r,spec,value);
2346 value = chxj_encoding_parameter(r, value, 0);
2347 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
2348 value = chxj_add_cookie_no_update_parameter(r, value, 0);
2349 value = chxj_img_rewrite_parameter(r,chtml50->conf,value);
2353 else if (strcasecmp(name,"style") == 0 && value && *value) {
2360 if (strcasecmp(name, "align" ) == 0) {
2361 /*--------------------------------------------------------------------*/
2363 /*--------------------------------------------------------------------*/
2364 /*--------------------------------------------------------------------*/
2366 /*--------------------------------------------------------------------*/
2368 if (STRCASEEQ('t','T',"top", value) ||
2369 STRCASEEQ('m','M',"middle",value) ||
2370 STRCASEEQ('b','B',"bottom",value) ||
2371 STRCASEEQ('l','L',"left", value) ||
2372 STRCASEEQ('r','R',"right", value)) {
2375 else if (STRCASEEQ('c','C',"center", value)) {
2376 attr_align = apr_pstrdup(doc->pool, "middle");
2380 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2381 /*--------------------------------------------------------------------*/
2383 /*--------------------------------------------------------------------*/
2390 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2391 /*--------------------------------------------------------------------*/
2393 /*--------------------------------------------------------------------*/
2400 if (strcasecmp(name, "height") == 0 && value && *value) {
2401 /*--------------------------------------------------------------------*/
2403 /*--------------------------------------------------------------------*/
2404 attr_height = value;
2407 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2408 /*--------------------------------------------------------------------*/
2410 /*--------------------------------------------------------------------*/
2411 attr_hspace = value;
2417 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2418 /*--------------------------------------------------------------------*/
2420 /*--------------------------------------------------------------------*/
2421 attr_vspace = value;
2430 if (IS_CSS_ON(chtml50->entryp)) {
2431 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2433 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2434 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2435 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2436 css_property_t *cur;
2437 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2438 attr_height = apr_pstrdup(doc->pool, cur->value);
2440 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2441 attr_width = apr_pstrdup(doc->pool, cur->value);
2443 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2444 attr_align = apr_pstrdup(doc->pool, cur->value);
2486 return chtml50->out;
2491 * It is a handler who processes the IMG tag.
2493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2494 * destination is specified.
2495 * @param node [i] The IMG tag node is specified.
2496 * @return The conversion result is returned.
2499 s_chtml50_end_img_tag(void *pdoc, Node *UNUSED(child))
2501 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2503 return chtml50->out;
2508 * It is a handler who processes the SELECT tag.
2510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2511 * destination is specified.
2512 * @param node [i] The SELECT tag node is specified.
2513 * @return The conversion result is returned.
2516 s_chtml50_start_select_tag(void *pdoc, Node *node)
2518 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2519 Doc *doc = chtml50->doc;
2522 char *multiple = NULL;
2524 char *attr_style = NULL;
2527 for (attr = qs_get_attr(doc, node);
2529 attr = qs_get_next_attr(doc,attr)) {
2530 char *nm = qs_get_attr_name(doc,attr);
2531 char *val = qs_get_attr_value(doc,attr);
2532 if (STRCASEEQ('s','S',"size", nm)) {
2533 /*----------------------------------------------------------------------*/
2534 /* CHTML 1.0 version 2.0 */
2535 /*----------------------------------------------------------------------*/
2536 size = apr_pstrdup(doc->buf.pool, val);
2538 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2539 /*----------------------------------------------------------------------*/
2540 /* CHTML 1.0 version 2.0 */
2541 /*----------------------------------------------------------------------*/
2542 attr_style = apr_pstrdup(doc->buf.pool, val);
2544 else if (STRCASEEQ('n','N',"name", nm)) {
2545 /*----------------------------------------------------------------------*/
2546 /* CHTML 1.0 version 2.0 */
2547 /*----------------------------------------------------------------------*/
2548 name = apr_pstrdup(doc->buf.pool, val);
2550 else if (STRCASEEQ('m','M',"multiple", nm)) {
2551 /*----------------------------------------------------------------------*/
2552 /* CHTML 1.0 version 2.0 */
2553 /*----------------------------------------------------------------------*/
2554 multiple = apr_pstrdup(doc->buf.pool, val);
2557 if (size && *size) {
2562 if (name && *name) {
2571 if (IS_CSS_ON(chtml50->entryp)) {
2572 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2575 return chtml50->out;
2580 * It is a handler who processes the SELECT tag.
2582 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2583 * destination is specified.
2584 * @param node [i] The SELECT tag node is specified.
2585 * @return The conversion result is returned.
2588 s_chtml50_end_select_tag(void *pdoc, Node *UNUSED(child))
2590 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2591 Doc *doc = chtml50->doc;
2594 if (IS_CSS_ON(chtml50->entryp)) {
2595 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2598 return chtml50->out;
2603 * It is a handler who processes the OPTION tag.
2605 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2606 * destination is specified.
2607 * @param node [i] The OPTION tag node is specified.
2608 * @return The conversion result is returned.
2611 s_chtml50_start_option_tag(void *pdoc, Node *node)
2619 char *attr_style = NULL;
2621 chtml50 = GET_CHTML50(pdoc);
2628 for (attr = qs_get_attr(doc,node);
2630 attr = qs_get_next_attr(doc,attr)) {
2631 char *nm = qs_get_attr_name(doc,attr);
2632 char *val = qs_get_attr_value(doc,attr);
2633 if (STRCASEEQ('s','S',"selected", nm)) {
2634 /*----------------------------------------------------------------------*/
2635 /* CHTML 1.0 version 2.0 */
2636 /*----------------------------------------------------------------------*/
2637 selected = apr_pstrdup(doc->buf.pool, val);
2639 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2640 /*----------------------------------------------------------------------*/
2641 /* CHTML 1.0 version 2.0 */
2642 /*----------------------------------------------------------------------*/
2643 attr_style = apr_pstrdup(doc->buf.pool, val);
2645 else if (STRCASEEQ('v','V',"value", nm)) {
2646 /*----------------------------------------------------------------------*/
2647 /* CHTML 1.0 version 2.0 */
2648 /*----------------------------------------------------------------------*/
2649 value = apr_pstrdup(doc->buf.pool, val);
2662 if (IS_CSS_ON(chtml50->entryp)) {
2663 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2666 return chtml50->out;
2671 * It is a handler who processes the OPTION tag.
2673 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2674 * destination is specified.
2675 * @param node [i] The OPTION tag node is specified.
2676 * @return The conversion result is returned.
2679 s_chtml50_end_option_tag(void *pdoc, Node *UNUSED(child))
2681 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2684 if (IS_CSS_ON(chtml50->entryp)) {
2685 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2688 return chtml50->out;
2693 * It is a handler who processes the DIV tag.
2695 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2696 * destination is specified.
2697 * @param node [i] The DIV tag node is specified.
2698 * @return The conversion result is returned.
2701 s_chtml50_start_div_tag(void *pdoc, Node *node)
2707 char *attr_style = NULL;
2708 char *attr_align = NULL;
2709 char *attr_display = NULL;
2710 char *attr_decoration = NULL;
2711 char *attr_wap_marquee_style = NULL;
2712 char *attr_wap_marquee_dir = NULL;
2713 char *attr_wap_marquee_loop = NULL;
2714 char *attr_color = NULL;
2715 char *attr_bgcolor = NULL;
2716 char *attr_font_size = NULL;
2718 chtml50 = GET_CHTML50(pdoc);
2722 for (attr = qs_get_attr(doc,node);
2724 attr = qs_get_next_attr(doc,attr)) {
2725 char *nm = qs_get_attr_name(doc,attr);
2726 char *val = qs_get_attr_value(doc,attr);
2727 if (STRCASEEQ('a','A', "align", nm)) {
2728 /*----------------------------------------------------------------------*/
2729 /* CHTML 1.0 (W3C version 3.2) */
2730 /*----------------------------------------------------------------------*/
2731 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2732 attr_align = apr_pstrdup(doc->buf.pool, val);
2735 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2736 attr_style = apr_pstrdup(doc->buf.pool, val);
2740 if (IS_CSS_ON(chtml50->entryp)) {
2741 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2743 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2744 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2745 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2746 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2747 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
2748 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2749 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2751 css_property_t *cur;
2752 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2753 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2754 attr_display = apr_pstrdup(doc->pool, cur->value);
2757 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2758 if (STRCASEEQ('b','B',"blink", cur->value)) {
2759 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2762 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2763 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2764 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2766 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2767 char *ss = strchr(cur->value, '#');
2769 ss = strstr(cur->value, "rgb");
2772 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2773 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2776 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2777 attr_color = apr_pstrdup(doc->pool, cur->value);
2778 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2780 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2781 attr_align = apr_pstrdup(doc->pool, cur->value);
2783 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
2784 attr_font_size = apr_pstrdup(doc->pool, cur->value);
2785 if (STRCASEEQ('x','X',"xx-small",attr_font_size)) {
2786 attr_font_size = apr_pstrdup(doc->pool, "1");
2788 else if (STRCASEEQ('x','X',"x-small",attr_font_size)) {
2789 attr_font_size = apr_pstrdup(doc->pool, "2");
2791 else if (STRCASEEQ('s','S',"small",attr_font_size)) {
2792 attr_font_size = apr_pstrdup(doc->pool, "3");
2794 else if (STRCASEEQ('m','M',"medium",attr_font_size)) {
2795 attr_font_size = apr_pstrdup(doc->pool, "4");
2797 else if (STRCASEEQ('l','L',"large",attr_font_size)) {
2798 attr_font_size = apr_pstrdup(doc->pool, "5");
2800 else if (STRCASEEQ('x','X',"x-large",attr_font_size)) {
2801 attr_font_size = apr_pstrdup(doc->pool, "6");
2803 else if (STRCASEEQ('x','X',"xx-large",attr_font_size)) {
2804 attr_font_size = apr_pstrdup(doc->pool, "7");
2808 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2809 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2810 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2811 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2812 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2813 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2816 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2817 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2818 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2820 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2821 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2824 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2825 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2826 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2829 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2835 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
2836 memset(flg, 0, sizeof(*flg));
2843 flg->with_div_flag = 1;
2847 flg->with_div_flag = 1;
2849 if (attr_color || attr_font_size) {
2850 if (! attr_display && attr_color && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff", attr_color))) {
2859 if (attr_font_size) {
2861 W_V(attr_font_size);
2865 flg->with_font_flag = 1;
2868 if (attr_decoration) {
2870 flg->with_blink_flag = 1;
2874 if (attr_wap_marquee_style) {
2875 W_L(" behavior=\"");
2876 W_V(attr_wap_marquee_style);
2879 if (attr_wap_marquee_dir) {
2880 W_L(" direction=\"");
2881 W_V(attr_wap_marquee_dir);
2884 if (attr_wap_marquee_loop) {
2886 W_V(attr_wap_marquee_loop);
2895 flg->with_marquee_flag = 1;
2897 node->userData = flg;
2899 return chtml50->out;
2904 * It is a handler who processes the DIV tag.
2906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2907 * destination is specified.
2908 * @param node [i] The DIV tag node is specified.
2909 * @return The conversion result is returned.
2912 s_chtml50_end_div_tag(void *pdoc, Node *node)
2914 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2915 Doc *doc = chtml50->doc;
2917 chtml50_flags_t *flg = node->userData;
2918 if (flg && flg->with_marquee_flag) {
2921 if (flg && flg->with_blink_flag) {
2924 if (flg && flg->with_font_flag) {
2927 if (flg && flg->with_div_flag) {
2930 if (IS_CSS_ON(chtml50->entryp)) {
2931 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2933 node->userData = NULL;
2935 return chtml50->out;
2940 * It is a handler who processes the UL tag.
2942 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2943 * destination is specified.
2944 * @param node [i] The UL tag node is specified.
2945 * @return The conversion result is returned.
2948 s_chtml50_start_ul_tag(void *pdoc, Node *node)
2950 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2951 Doc *doc = chtml50->doc;
2953 char *attr_type = NULL;
2954 char *attr_style = NULL;
2955 /*--------------------------------------------------------------------------*/
2956 /* Get Attributes */
2957 /*--------------------------------------------------------------------------*/
2958 for (attr = qs_get_attr(doc,node);
2960 attr = qs_get_next_attr(doc,attr)) {
2961 char *name = qs_get_attr_name(doc,attr);
2962 char *value = qs_get_attr_value(doc,attr);
2963 if (STRCASEEQ('t','T',"type",name)) {
2964 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2968 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2972 if (IS_CSS_ON(chtml50->entryp)) {
2973 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2975 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2976 css_property_t *cur;
2977 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2978 if (STRCASEEQ('d','D',"disc",cur->value)) {
2979 attr_type = apr_pstrdup(doc->pool, "disc");
2981 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2982 attr_type = apr_pstrdup(doc->pool, "circle");
2984 else if (STRCASEEQ('s','S',"square",cur->value)) {
2985 attr_type = apr_pstrdup(doc->pool, "square");
2997 return chtml50->out;
3002 * It is a handler who processes the UL tag.
3004 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3005 * destination is specified.
3006 * @param node [i] The UL tag node is specified.
3007 * @return The conversion result is returned.
3010 s_chtml50_end_ul_tag(void *pdoc, Node *UNUSED(child))
3012 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3013 Doc *doc = chtml50->doc;
3016 if (IS_CSS_ON(chtml50->entryp)) {
3017 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3019 return chtml50->out;
3024 * It is a handler who processes the PRE tag.
3026 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3027 * destination is specified.
3028 * @param node [i] The PRE tag node is specified.
3029 * @return The conversion result is returned.
3032 s_chtml50_start_pre_tag(void *pdoc, Node *node)
3034 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3035 Doc *doc = chtml50->doc;
3037 char *attr_style = NULL;
3039 for (attr = qs_get_attr(doc,node);
3041 attr = qs_get_next_attr(doc,attr)) {
3042 char *nm = qs_get_attr_name(doc,attr);
3043 char *val = qs_get_attr_value(doc,attr);
3044 if (val && STRCASEEQ('s','S',"style", nm)) {
3049 if (IS_CSS_ON(chtml50->entryp)) {
3050 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3053 chtml50->pre_flag++;
3056 return chtml50->out;
3061 * It is a handler who processes the PRE tag.
3063 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3064 * destination is specified.
3065 * @param node [i] The PRE tag node is specified.
3066 * @return The conversion result is returned.
3069 s_chtml50_end_pre_tag(void *pdoc, Node *UNUSED(child))
3071 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3072 Doc *doc = chtml50->doc;
3075 chtml50->pre_flag--;
3076 if (IS_CSS_ON(chtml50->entryp)) {
3077 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3080 return chtml50->out;
3085 * It is a handler who processes the P tag.
3087 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3088 * destination is specified.
3089 * @param node [i] The P tag node is specified.
3090 * @return The conversion result is returned.
3093 s_chtml50_start_p_tag(void *pdoc, Node *node)
3099 char *attr_align = NULL;
3100 char *attr_style = NULL;
3101 char *attr_color = NULL;
3102 char *attr_blink = NULL;
3105 chtml50 = GET_CHTML50(pdoc);
3109 for (attr = qs_get_attr(doc,node);
3111 attr = qs_get_next_attr(doc,attr)) {
3112 char *nm = qs_get_attr_name(doc,attr);
3113 char *val = qs_get_attr_value(doc,attr);
3114 if (STRCASEEQ('a','A',"align", nm)) {
3115 /*----------------------------------------------------------------------*/
3116 /* CHTML 1.0 (W3C version 3.2) */
3117 /*----------------------------------------------------------------------*/
3118 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3119 attr_align = apr_pstrdup(doc->buf.pool, val);
3123 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3124 attr_style = apr_pstrdup(doc->buf.pool, val);
3127 if (IS_CSS_ON(chtml50->entryp)) {
3128 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3130 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3131 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3132 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3133 css_property_t *cur;
3134 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3135 if (STRCASEEQ('l','L',"left",cur->value)) {
3136 attr_align = apr_pstrdup(doc->pool, "left");
3138 else if (STRCASEEQ('c','C',"center",cur->value)) {
3139 attr_align = apr_pstrdup(doc->pool, "center");
3141 else if (STRCASEEQ('r','R',"right",cur->value)) {
3142 attr_align = apr_pstrdup(doc->pool, "right");
3145 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3146 if (cur->value && *cur->value) {
3147 attr_color = apr_pstrdup(doc->pool, cur->value);
3150 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3151 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3152 attr_blink = apr_pstrdup(doc->pool, cur->value);
3165 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
3166 memset(flg, 0, sizeof(*flg));
3168 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3169 W_L("<font color=\"");
3172 flg->with_font_flag = 1;
3176 flg->with_blink_flag = 1;
3178 node->userData = (void *)flg;
3179 return chtml50->out;
3184 * It is a handler who processes the P tag.
3186 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3187 * destination is specified.
3188 * @param node [i] The P tag node is specified.
3189 * @return The conversion result is returned.
3192 s_chtml50_end_p_tag(void *pdoc, Node *node)
3197 chtml50 = GET_CHTML50(pdoc);
3200 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
3201 if (flg->with_font_flag) {
3204 if (flg->with_blink_flag) {
3208 if (IS_CSS_ON(chtml50->entryp)) {
3209 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3212 return chtml50->out;
3217 * It is a handler who processes the OL tag.
3219 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3220 * destination is specified.
3221 * @param node [i] The OL tag node is specified.
3222 * @return The conversion result is returned.
3225 s_chtml50_start_ol_tag(void *pdoc, Node *node)
3231 char *attr_style = NULL;
3232 char *attr_start = NULL;
3233 char *attr_type = NULL;
3235 chtml50 = GET_CHTML50(pdoc);
3239 /*--------------------------------------------------------------------------*/
3240 /* Get Attributes */
3241 /*--------------------------------------------------------------------------*/
3242 for (attr = qs_get_attr(doc,node);
3244 attr = qs_get_next_attr(doc,attr)) {
3245 char *name = qs_get_attr_name(doc,attr);
3246 char *value = qs_get_attr_value(doc,attr);
3247 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3250 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3253 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3257 if (IS_CSS_ON(chtml50->entryp)) {
3258 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3260 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3261 css_property_t *cur;
3262 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3263 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3264 attr_type = apr_pstrdup(doc->pool, "1");
3266 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3267 attr_type = apr_pstrdup(doc->pool, "A");
3269 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3270 attr_type = apr_pstrdup(doc->pool, "a");
3288 return chtml50->out;
3293 * It is a handler who processes the OL tag.
3295 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3296 * destination is specified.
3297 * @param node [i] The OL tag node is specified.
3298 * @return The conversion result is returned.
3301 s_chtml50_end_ol_tag(void *pdoc, Node *UNUSED(node))
3303 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3304 Doc *doc = chtml50->doc;
3307 if (IS_CSS_ON(chtml50->entryp)) {
3308 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3311 return chtml50->out;
3316 * It is a handler who processes the LI tag.
3318 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3319 * destination is specified.
3320 * @param node [i] The LI tag node is specified.
3321 * @return The conversion result is returned.
3324 s_chtml50_start_li_tag(void *pdoc, Node *node)
3326 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3327 Doc *doc = chtml50->doc;
3329 char *attr_type = NULL;
3330 char *attr_value = NULL;
3331 char *attr_style = NULL;
3333 for (attr = qs_get_attr(doc,node);
3335 attr = qs_get_next_attr(doc,attr)) {
3336 char *name = qs_get_attr_name(doc,attr);
3337 char *value = qs_get_attr_value(doc,attr);
3338 if (STRCASEEQ('t','T',"type",name)) {
3339 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3343 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3346 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3350 if (IS_CSS_ON(chtml50->entryp)) {
3351 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3353 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3354 css_property_t *cur;
3355 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3356 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3357 attr_type = apr_pstrdup(doc->pool, "1");
3359 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3360 attr_type = apr_pstrdup(doc->pool, "A");
3362 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3363 attr_type = apr_pstrdup(doc->pool, "a");
3365 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3366 attr_type = apr_pstrdup(doc->pool, "disc");
3368 else if (STRCASEEQ('s','S',"square", cur->value)) {
3369 attr_type = apr_pstrdup(doc->pool, "square");
3371 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3372 attr_type = apr_pstrdup(doc->pool, "circle");
3390 return chtml50->out;
3395 * It is a handler who processes the LI tag.
3397 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3398 * destination is specified.
3399 * @param node [i] The LI tag node is specified.
3400 * @return The conversion result is returned.
3403 s_chtml50_end_li_tag(void *pdoc, Node *UNUSED(child))
3405 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3407 if (IS_CSS_ON(chtml50->entryp)) {
3408 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3411 return chtml50->out;
3416 * It is a handler who processes the H1 tag.
3418 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3419 * destination is specified.
3420 * @param node [i] The H1 tag node is specified.
3421 * @return The conversion result is returned.
3424 s_chtml50_start_h1_tag(void *pdoc, Node *node)
3430 char *attr_style = NULL;
3431 char *attr_align = NULL;
3433 chtml50 = GET_CHTML50(pdoc);
3437 for (attr = qs_get_attr(doc,node);
3439 attr = qs_get_next_attr(doc,attr)) {
3440 char *name = qs_get_attr_name(doc,attr);
3441 char *value = qs_get_attr_value(doc,attr);
3442 if (STRCASEEQ('a','A',"align", name)) {
3443 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3447 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3451 if (IS_CSS_ON(chtml50->entryp)) {
3452 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3454 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3455 css_property_t *cur;
3456 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3457 if (STRCASEEQ('l','L',"left", cur->value)) {
3458 attr_align = apr_pstrdup(doc->pool, "left");
3460 else if (STRCASEEQ('c','C',"center",cur->value)) {
3461 attr_align = apr_pstrdup(doc->pool, "center");
3463 else if (STRCASEEQ('r','R',"right",cur->value)) {
3464 attr_align = apr_pstrdup(doc->pool, "right");
3477 return chtml50->out;
3482 * It is a handler who processes the H1 tag.
3484 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3485 * destination is specified.
3486 * @param node [i] The H1 tag node is specified.
3487 * @return The conversion result is returned.
3490 s_chtml50_end_h1_tag(void *pdoc, Node *UNUSED(child))
3495 chtml50 = GET_CHTML50(pdoc);
3499 if (IS_CSS_ON(chtml50->entryp)) {
3500 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3503 return chtml50->out;
3508 * It is a handler who processes the H2 tag.
3510 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3511 * destination is specified.
3512 * @param node [i] The H2 tag node is specified.
3513 * @return The conversion result is returned.
3516 s_chtml50_start_h2_tag(void *pdoc, Node *node)
3522 char *attr_style = NULL;
3523 char *attr_align = NULL;
3525 chtml50 = GET_CHTML50(pdoc);
3529 for (attr = qs_get_attr(doc,node);
3531 attr = qs_get_next_attr(doc,attr)) {
3532 char *name = qs_get_attr_name(doc,attr);
3533 char *value = qs_get_attr_value(doc,attr);
3534 if (STRCASEEQ('a','A',"align", name)) {
3535 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3539 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3543 if (IS_CSS_ON(chtml50->entryp)) {
3544 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3546 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3547 css_property_t *cur;
3548 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3549 if (STRCASEEQ('l','L',"left", cur->value)) {
3550 attr_align = apr_pstrdup(doc->pool, "left");
3552 else if (STRCASEEQ('c','C',"center",cur->value)) {
3553 attr_align = apr_pstrdup(doc->pool, "center");
3555 else if (STRCASEEQ('r','R',"right",cur->value)) {
3556 attr_align = apr_pstrdup(doc->pool, "right");
3569 return chtml50->out;
3574 * It is a handler who processes the H2 tag.
3576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3577 * destination is specified.
3578 * @param node [i] The H2 tag node is specified.
3579 * @return The conversion result is returned.
3582 s_chtml50_end_h2_tag(void *pdoc, Node *UNUSED(child))
3584 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3585 Doc *doc = chtml50->doc;
3588 if (IS_CSS_ON(chtml50->entryp)) {
3589 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3592 return chtml50->out;
3597 * It is a handler who processes the H3 tag.
3599 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3600 * destination is specified.
3601 * @param node [i] The H3 tag node is specified.
3602 * @return The conversion result is returned.
3605 s_chtml50_start_h3_tag(void *pdoc, Node *node)
3611 char *attr_style = NULL;
3612 char *attr_align = NULL;
3614 chtml50 = GET_CHTML50(pdoc);
3618 for (attr = qs_get_attr(doc,node);
3620 attr = qs_get_next_attr(doc,attr)) {
3621 char *name = qs_get_attr_name(doc,attr);
3622 char *value = qs_get_attr_value(doc,attr);
3623 if (STRCASEEQ('a','A',"align", name)) {
3624 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3628 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3632 if (IS_CSS_ON(chtml50->entryp)) {
3633 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3635 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3636 css_property_t *cur;
3637 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3638 if (STRCASEEQ('l','L',"left", cur->value)) {
3639 attr_align = apr_pstrdup(doc->pool, "left");
3641 else if (STRCASEEQ('c','C',"center",cur->value)) {
3642 attr_align = apr_pstrdup(doc->pool, "center");
3644 else if (STRCASEEQ('r','R',"right",cur->value)) {
3645 attr_align = apr_pstrdup(doc->pool, "right");
3658 return chtml50->out;
3663 * It is a handler who processes the H3 tag.
3665 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3666 * destination is specified.
3667 * @param node [i] The H3 tag node is specified.
3668 * @return The conversion result is returned.
3671 s_chtml50_end_h3_tag(void *pdoc, Node *UNUSED(child))
3673 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3674 Doc *doc = chtml50->doc;
3677 if (IS_CSS_ON(chtml50->entryp)) {
3678 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3681 return chtml50->out;
3686 * It is a handler who processes the H4 tag.
3688 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3689 * destination is specified.
3690 * @param node [i] The H4 tag node is specified.
3691 * @return The conversion result is returned.
3694 s_chtml50_start_h4_tag(void *pdoc, Node *node)
3700 char *attr_style = NULL;
3701 char *attr_align = NULL;
3703 chtml50 = GET_CHTML50(pdoc);
3707 for (attr = qs_get_attr(doc,node);
3709 attr = qs_get_next_attr(doc,attr)) {
3710 char *name = qs_get_attr_name(doc,attr);
3711 char *value = qs_get_attr_value(doc,attr);
3712 if (STRCASEEQ('a','A',"align", name)) {
3713 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3717 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3721 if (IS_CSS_ON(chtml50->entryp)) {
3722 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3724 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3725 css_property_t *cur;
3726 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3727 if (STRCASEEQ('l','L',"left", cur->value)) {
3728 attr_align = apr_pstrdup(doc->pool, "left");
3730 else if (STRCASEEQ('c','C',"center",cur->value)) {
3731 attr_align = apr_pstrdup(doc->pool, "center");
3733 else if (STRCASEEQ('r','R',"right",cur->value)) {
3734 attr_align = apr_pstrdup(doc->pool, "right");
3747 return chtml50->out;
3752 * It is a handler who processes the H4 tag.
3754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3755 * destination is specified.
3756 * @param node [i] The H4 tag node is specified.
3757 * @return The conversion result is returned.
3760 s_chtml50_end_h4_tag(void *pdoc, Node *UNUSED(child))
3762 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3763 Doc *doc = chtml50->doc;
3766 if (IS_CSS_ON(chtml50->entryp)) {
3767 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3770 return chtml50->out;
3775 * It is a handler who processes the H5 tag.
3777 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3778 * destination is specified.
3779 * @param node [i] The H5 tag node is specified.
3780 * @return The conversion result is returned.
3783 s_chtml50_start_h5_tag(void *pdoc, Node *node)
3789 char *attr_style = NULL;
3790 char *attr_align = NULL;
3792 chtml50 = GET_CHTML50(pdoc);
3796 for (attr = qs_get_attr(doc,node);
3798 attr = qs_get_next_attr(doc,attr)) {
3799 char *name = qs_get_attr_name(doc,attr);
3800 char *value = qs_get_attr_value(doc,attr);
3801 if (STRCASEEQ('a','A',"align", name)) {
3802 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3806 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3810 if (IS_CSS_ON(chtml50->entryp)) {
3811 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3813 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3814 css_property_t *cur;
3815 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3816 if (STRCASEEQ('l','L',"left", cur->value)) {
3817 attr_align = apr_pstrdup(doc->pool, "left");
3819 else if (STRCASEEQ('c','C',"center",cur->value)) {
3820 attr_align = apr_pstrdup(doc->pool, "center");
3822 else if (STRCASEEQ('r','R',"right",cur->value)) {
3823 attr_align = apr_pstrdup(doc->pool, "right");
3836 return chtml50->out;
3841 * It is a handler who processes the H5 tag.
3843 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3844 * destination is specified.
3845 * @param node [i] The H5 tag node is specified.
3846 * @return The conversion result is returned.
3849 s_chtml50_end_h5_tag(void *pdoc, Node *UNUSED(child))
3851 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3852 Doc *doc = chtml50->doc;
3855 if (IS_CSS_ON(chtml50->entryp)) {
3856 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3859 return chtml50->out;
3864 * It is a handler who processes the H6 tag.
3866 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3867 * destination is specified.
3868 * @param node [i] The H6 tag node is specified.
3869 * @return The conversion result is returned.
3872 s_chtml50_start_h6_tag(void *pdoc, Node *node)
3878 char *attr_style = NULL;
3879 char *attr_align = NULL;
3881 chtml50 = GET_CHTML50(pdoc);
3885 for (attr = qs_get_attr(doc,node);
3887 attr = qs_get_next_attr(doc,attr)) {
3888 char *name = qs_get_attr_name(doc,attr);
3889 char *value = qs_get_attr_value(doc,attr);
3890 if (STRCASEEQ('a','A',"align", name)) {
3891 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3895 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3899 if (IS_CSS_ON(chtml50->entryp)) {
3900 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3902 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3903 css_property_t *cur;
3904 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3905 if (STRCASEEQ('l','L',"left", cur->value)) {
3906 attr_align = apr_pstrdup(doc->pool, "left");
3908 else if (STRCASEEQ('c','C',"center",cur->value)) {
3909 attr_align = apr_pstrdup(doc->pool, "center");
3911 else if (STRCASEEQ('r','R',"right",cur->value)) {
3912 attr_align = apr_pstrdup(doc->pool, "right");
3925 return chtml50->out;
3930 * It is a handler who processes the H6 tag.
3932 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3933 * destination is specified.
3934 * @param node [i] The H6 tag node is specified.
3935 * @return The conversion result is returned.
3938 s_chtml50_end_h6_tag(void *pdoc, Node *UNUSED(child))
3940 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3941 Doc *doc = chtml50->doc;
3944 if (IS_CSS_ON(chtml50->entryp)) {
3945 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3948 return chtml50->out;
3953 * It is a handler who processes the TEXTARE tag.
3955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3956 * destination is specified.
3957 * @param node [i] The TEXTAREA tag node is specified.
3958 * @return The conversion result is returned.
3961 s_chtml50_start_textarea_tag(void *pdoc, Node *node)
3967 char *attr_accesskey = NULL;
3968 char *attr_name = NULL;
3969 char *attr_rows = NULL;
3970 char *attr_cols = NULL;
3971 char *attr_istyle = NULL;
3972 char *attr_style = NULL;
3974 chtml50 = GET_CHTML50(pdoc);
3978 chtml50->textarea_flag++;
3980 for (attr = qs_get_attr(doc,node);
3982 attr = qs_get_next_attr(doc,attr)) {
3983 char *name = qs_get_attr_name(doc,attr);
3984 char *value = qs_get_attr_value(doc,attr);
3985 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3986 attr_accesskey = value;
3988 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3989 attr_istyle = value;
3991 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3994 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3997 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4000 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4004 if (IS_CSS_ON(chtml50->entryp)) {
4005 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
4007 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4008 css_property_t *cur;
4009 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4010 if (strcasestr(cur->value, "<ja:n>")) {
4013 else if (strcasestr(cur->value, "<ja:en>")) {
4016 else if (strcasestr(cur->value, "<ja:hk>")) {
4019 else if (strcasestr(cur->value, "<ja:h>")) {
4026 if (attr_accesskey) {
4027 W_L(" accesskey=\"");
4028 W_V(attr_accesskey);
4052 return chtml50->out;
4057 * It is a handler who processes the TEXTAREA tag.
4059 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4060 * destination is specified.
4061 * @param node [i] The TEXTAREA tag node is specified.
4062 * @return The conversion result is returned.
4065 s_chtml50_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4067 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4068 Doc *doc = chtml50->doc;
4071 chtml50->textarea_flag--;
4073 return chtml50->out;
4078 s_chtml50_chxjif_tag(void *pdoc, Node *node)
4085 chtml50 = GET_CHTML50(pdoc);
4089 for (child = qs_get_child_node(doc, node);
4091 child = qs_get_next_node(doc, child)) {
4093 s_chtml50_chxjif_tag(chtml50, child);
4101 s_chtml50_text_tag(void *pdoc, Node *child)
4113 apr_size_t z2h_input_len;
4115 chtml50 = GET_CHTML50(pdoc);
4119 textval = qs_get_node_value(doc,child);
4120 if (strlen(textval) == 0) {
4121 return chtml50->out;
4124 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4125 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4127 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4128 memset(one_byte, 0, sizeof(one_byte));
4131 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4133 int rtn = s_chtml50_search_emoji(chtml50, &textval[ii], &out, child);
4135 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4140 if (is_sjis_kanji(textval[ii])) {
4141 one_byte[0] = textval[ii+0];
4142 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4143 one_byte[0] = textval[ii+1];
4144 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4147 else if (chtml50->pre_flag) {
4148 one_byte[0] = textval[ii+0];
4149 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4151 else if (chtml50->textarea_flag) {
4152 one_byte[0] = textval[ii+0];
4153 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4155 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4156 one_byte[0] = textval[ii+0];
4157 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4160 z2h_input_len = strlen(tdst);
4161 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml50->entryp);
4163 return chtml50->out;
4168 * It is a handler who processes the BLOCKQUOTE tag.
4170 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4171 * destination is specified.
4172 * @param node [i] The BLOCKQUOTE tag node is specified.
4173 * @return The conversion result is returned.
4176 s_chtml50_start_blockquote_tag(void *pdoc, Node *node)
4181 char *attr_style = NULL;
4182 char *attr_color = NULL;
4183 char *attr_size = NULL;
4185 chtml50 = GET_CHTML50(pdoc);
4187 for (attr = qs_get_attr(doc,node);
4189 attr = qs_get_next_attr(doc,attr)) {
4190 char *nm = qs_get_attr_name(doc,attr);
4191 char *val = qs_get_attr_value(doc,attr);
4192 if (val && STRCASEEQ('s','S',"style", nm)) {
4196 if (IS_CSS_ON(chtml50->entryp)) {
4197 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4199 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4200 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4201 css_property_t *cur;
4202 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4203 if (cur->value && *cur->value) {
4204 attr_color = apr_pstrdup(doc->pool, cur->value);
4207 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4208 if (cur->value && *cur->value) {
4209 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4210 attr_size = apr_pstrdup(doc->pool, "1");
4212 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4213 attr_size = apr_pstrdup(doc->pool, "2");
4215 else if (STRCASEEQ('s','S',"small",cur->value)) {
4216 attr_size = apr_pstrdup(doc->pool, "3");
4218 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4219 attr_size = apr_pstrdup(doc->pool, "4");
4221 else if (STRCASEEQ('l','L',"large",cur->value)) {
4222 attr_size = apr_pstrdup(doc->pool, "5");
4224 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4225 attr_size = apr_pstrdup(doc->pool, "6");
4227 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4228 attr_size = apr_pstrdup(doc->pool, "7");
4234 W_L("<blockquote>");
4235 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4236 memset(flg, 0, sizeof(*flg));
4237 if (attr_color || attr_size) {
4240 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4251 flg->with_font_flag = 1;
4253 node->userData = (void *)flg;
4254 return chtml50->out;
4259 * It is a handler who processes the BLOCKQUOTE tag.
4261 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4262 * destination is specified.
4263 * @param node [i] The BLOCKQUOTE tag node is specified.
4264 * @return The conversion result is returned.
4267 s_chtml50_end_blockquote_tag(void *pdoc, Node *node)
4269 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4270 Doc *doc = chtml50->doc;
4271 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4272 if (flg && flg->with_font_flag) {
4275 W_L("</blockquote>");
4276 if (IS_CSS_ON(chtml50->entryp)) {
4277 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4279 return chtml50->out;
4284 * It is a handler who processes the DIR tag.
4286 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4287 * destination is specified.
4288 * @param node [i] The DIR tag node is specified.
4289 * @return The conversion result is returned.
4292 s_chtml50_start_dir_tag(void *pdoc, Node *node)
4294 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4295 Doc *doc = chtml50->doc;
4297 char *attr_style = NULL;
4298 char *attr_color = NULL;
4299 char *attr_type = NULL;
4300 char *attr_size = NULL;
4301 for (attr = qs_get_attr(doc,node);
4303 attr = qs_get_next_attr(doc,attr)) {
4304 char *name = qs_get_attr_name(doc,attr);
4305 char *value = qs_get_attr_value(doc,attr);
4306 if (STRCASEEQ('t','T',"type",name)) {
4307 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4311 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4315 if (IS_CSS_ON(chtml50->entryp)) {
4316 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4318 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4319 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4320 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4321 css_property_t *cur;
4322 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4323 if (cur->value && *cur->value) {
4324 attr_color = apr_pstrdup(doc->pool, cur->value);
4327 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4328 if (cur->value && *cur->value) {
4329 attr_type = apr_pstrdup(doc->pool, cur->value);
4332 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4333 if (cur->value && *cur->value) {
4334 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4335 attr_size = apr_pstrdup(doc->pool, "1");
4337 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4338 attr_size = apr_pstrdup(doc->pool, "2");
4340 else if (STRCASEEQ('s','S',"small",cur->value)) {
4341 attr_size = apr_pstrdup(doc->pool, "3");
4343 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4344 attr_size = apr_pstrdup(doc->pool, "4");
4346 else if (STRCASEEQ('l','L',"large",cur->value)) {
4347 attr_size = apr_pstrdup(doc->pool, "5");
4349 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4350 attr_size = apr_pstrdup(doc->pool, "6");
4352 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4353 attr_size = apr_pstrdup(doc->pool, "7");
4366 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4367 memset(flg, 0, sizeof(*flg));
4368 if (attr_color || attr_size) {
4371 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4382 flg->with_font_flag = 1;
4384 node->userData = (void *)flg;
4385 return chtml50->out;
4390 * It is a handler who processes the DIR tag.
4392 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4393 * destination is specified.
4394 * @param node [i] The DIR tag node is specified.
4395 * @return The conversion result is returned.
4398 s_chtml50_end_dir_tag(void *pdoc, Node *node)
4400 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4401 Doc *doc = chtml50->doc;
4402 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4403 if (flg && flg->with_font_flag) {
4407 if (IS_CSS_ON(chtml50->entryp)) {
4408 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4410 return chtml50->out;
4415 * It is a handler who processes the DL tag.
4417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4418 * destination is specified.
4419 * @param node [i] The DL tag node is specified.
4420 * @return The conversion result is returned.
4423 s_chtml50_start_dl_tag(void *pdoc, Node *node)
4425 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4426 Doc *doc = chtml50->doc;
4428 char *attr_style = NULL;
4429 char *attr_color = NULL;
4430 char *attr_size = NULL;
4431 for (attr = qs_get_attr(doc,node);
4433 attr = qs_get_next_attr(doc,attr)) {
4434 char *name = qs_get_attr_name(doc,attr);
4435 char *value = qs_get_attr_value(doc,attr);
4436 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4440 if (IS_CSS_ON(chtml50->entryp)) {
4441 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4443 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4444 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4445 css_property_t *cur;
4446 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4447 if (cur->value && *cur->value) {
4448 attr_color = apr_pstrdup(doc->pool, cur->value);
4451 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4452 if (cur->value && *cur->value) {
4453 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4454 attr_size = apr_pstrdup(doc->pool, "1");
4456 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4457 attr_size = apr_pstrdup(doc->pool, "2");
4459 else if (STRCASEEQ('s','S',"small",cur->value)) {
4460 attr_size = apr_pstrdup(doc->pool, "3");
4462 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4463 attr_size = apr_pstrdup(doc->pool, "4");
4465 else if (STRCASEEQ('l','L',"large",cur->value)) {
4466 attr_size = apr_pstrdup(doc->pool, "5");
4468 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4469 attr_size = apr_pstrdup(doc->pool, "6");
4471 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4472 attr_size = apr_pstrdup(doc->pool, "7");
4479 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4480 memset(flg, 0, sizeof(*flg));
4481 if (attr_color || attr_size) {
4484 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4495 flg->with_font_flag = 1;
4497 node->userData = (void *)flg;
4498 return chtml50->out;
4503 * It is a handler who processes the DL tag.
4505 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4506 * destination is specified.
4507 * @param node [i] The DL tag node is specified.
4508 * @return The conversion result is returned.
4511 s_chtml50_end_dl_tag(void *pdoc, Node *node)
4513 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4514 Doc *doc = chtml50->doc;
4515 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4516 if (flg && flg->with_font_flag) {
4520 if (IS_CSS_ON(chtml50->entryp)) {
4521 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4523 return chtml50->out;
4528 * It is a handler who processes the DT tag.
4530 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4531 * destination is specified.
4532 * @param node [i] The DT tag node is specified.
4533 * @return The conversion result is returned.
4536 s_chtml50_start_dt_tag(void *pdoc, Node *node)
4538 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4539 Doc *doc = chtml50->doc;
4541 char *attr_style = NULL;
4542 char *attr_color = NULL;
4543 char *attr_size = NULL;
4544 for (attr = qs_get_attr(doc,node);
4546 attr = qs_get_next_attr(doc,attr)) {
4547 char *name = qs_get_attr_name(doc,attr);
4548 char *value = qs_get_attr_value(doc,attr);
4549 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4553 if (IS_CSS_ON(chtml50->entryp)) {
4554 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4556 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4557 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4558 css_property_t *cur;
4559 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4560 if (cur->value && *cur->value) {
4561 attr_color = apr_pstrdup(doc->pool, cur->value);
4564 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4565 if (cur->value && *cur->value) {
4566 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4567 attr_size = apr_pstrdup(doc->pool, "1");
4569 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4570 attr_size = apr_pstrdup(doc->pool, "2");
4572 else if (STRCASEEQ('s','S',"small",cur->value)) {
4573 attr_size = apr_pstrdup(doc->pool, "3");
4575 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4576 attr_size = apr_pstrdup(doc->pool, "4");
4578 else if (STRCASEEQ('l','L',"large",cur->value)) {
4579 attr_size = apr_pstrdup(doc->pool, "5");
4581 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4582 attr_size = apr_pstrdup(doc->pool, "6");
4584 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4585 attr_size = apr_pstrdup(doc->pool, "7");
4592 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4593 memset(flg, 0, sizeof(*flg));
4594 if (attr_color || attr_size) {
4597 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4608 flg->with_font_flag = 1;
4610 node->userData = (void *)flg;
4611 return chtml50->out;
4616 * It is a handler who processes the DT tag.
4618 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4619 * destination is specified.
4620 * @param node [i] The DT tag node is specified.
4621 * @return The conversion result is returned.
4624 s_chtml50_end_dt_tag(void *pdoc, Node *node)
4626 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4627 Doc *doc = chtml50->doc;
4629 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4630 if (flg && flg->with_font_flag) {
4633 if (IS_CSS_ON(chtml50->entryp)) {
4634 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4637 return chtml50->out;
4642 * It is a handler who processes the DD tag.
4644 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4645 * destination is specified.
4646 * @param node [i] The DD tag node is specified.
4647 * @return The conversion result is returned.
4650 s_chtml50_start_dd_tag(void *pdoc, Node *node)
4652 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4653 Doc *doc = chtml50->doc;
4655 char *attr_style = NULL;
4656 char *attr_color = NULL;
4657 char *attr_size = NULL;
4658 for (attr = qs_get_attr(doc,node);
4660 attr = qs_get_next_attr(doc,attr)) {
4661 char *name = qs_get_attr_name(doc,attr);
4662 char *value = qs_get_attr_value(doc,attr);
4663 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4667 if (IS_CSS_ON(chtml50->entryp)) {
4668 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4670 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4671 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4672 css_property_t *cur;
4673 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4674 if (cur->value && *cur->value) {
4675 attr_color = apr_pstrdup(doc->pool, cur->value);
4678 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4679 if (cur->value && *cur->value) {
4680 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4681 attr_size = apr_pstrdup(doc->pool, "1");
4683 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4684 attr_size = apr_pstrdup(doc->pool, "2");
4686 else if (STRCASEEQ('s','S',"small",cur->value)) {
4687 attr_size = apr_pstrdup(doc->pool, "3");
4689 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4690 attr_size = apr_pstrdup(doc->pool, "4");
4692 else if (STRCASEEQ('l','L',"large",cur->value)) {
4693 attr_size = apr_pstrdup(doc->pool, "5");
4695 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4696 attr_size = apr_pstrdup(doc->pool, "6");
4698 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4699 attr_size = apr_pstrdup(doc->pool, "7");
4706 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4707 memset(flg, 0, sizeof(*flg));
4708 if (attr_color || attr_size) {
4711 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4722 flg->with_font_flag = 1;
4724 node->userData = (void *)flg;
4725 return chtml50->out;
4730 * It is a handler who processes the DD tag.
4732 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4733 * destination is specified.
4734 * @param node [i] The DD tag node is specified.
4735 * @return The conversion result is returned.
4738 s_chtml50_end_dd_tag(void *pdoc, Node *node)
4740 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4741 Doc *doc = chtml50->doc;
4743 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4744 if (flg && flg->with_font_flag) {
4747 if (IS_CSS_ON(chtml50->entryp)) {
4748 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4750 return chtml50->out;
4755 * It is a handler who processes the MARQUEE tag.
4757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4758 * destination is specified.
4759 * @param node [i] The MARQUEE tag node is specified.
4760 * @return The conversion result is returned.
4763 s_chtml50_start_marquee_tag(void *pdoc, Node *node)
4765 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4766 Doc *doc = chtml50->doc;
4768 char *attr_direction = NULL;
4769 char *attr_behavior = NULL;
4770 char *attr_loop = NULL;
4771 char *attr_style = NULL;
4772 char *attr_color = NULL;
4773 char *attr_size = NULL;
4774 char *attr_bgcolor = NULL;
4775 /*--------------------------------------------------------------------------*/
4776 /* Get Attributes */
4777 /*--------------------------------------------------------------------------*/
4778 for (attr = qs_get_attr(doc,node);
4780 attr = qs_get_next_attr(doc,attr)) {
4781 char *name = qs_get_attr_name(doc,attr);
4782 char *value = qs_get_attr_value(doc,attr);
4783 if (STRCASEEQ('d','D',"direction", name)) {
4784 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4785 attr_direction = value;
4788 else if (STRCASEEQ('b','B',"behavior",name)) {
4789 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4790 attr_behavior = value;
4793 else if (STRCASEEQ('l','L',"loop",name)) {
4794 if (value && *value) {
4798 else if (STRCASEEQ('b','B',"bgcolor",name)) {
4799 if (value && *value) {
4800 attr_bgcolor = value;
4803 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4807 if (IS_CSS_ON(chtml50->entryp)) {
4808 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4810 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4811 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4812 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
4813 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4814 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4815 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4816 css_property_t *cur;
4817 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4818 if (cur->value && *cur->value) {
4819 attr_color = apr_pstrdup(doc->pool, cur->value);
4822 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
4823 if (cur->value && *cur->value) {
4824 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4827 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4828 if (cur->value && *cur->value) {
4829 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4832 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4833 if (cur->value && *cur->value) {
4834 attr_loop = apr_pstrdup(doc->pool, cur->value);
4835 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4840 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4841 if (cur->value && *cur->value) {
4842 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4843 attr_direction = "right";
4845 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4846 attr_direction = "left";
4850 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4851 if (cur->value && *cur->value) {
4852 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4853 attr_size = apr_pstrdup(doc->pool, "1");
4855 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4856 attr_size = apr_pstrdup(doc->pool, "2");
4858 else if (STRCASEEQ('s','S',"small",cur->value)) {
4859 attr_size = apr_pstrdup(doc->pool, "3");
4861 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4862 attr_size = apr_pstrdup(doc->pool, "4");
4864 else if (STRCASEEQ('l','L',"large",cur->value)) {
4865 attr_size = apr_pstrdup(doc->pool, "5");
4867 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4868 attr_size = apr_pstrdup(doc->pool, "6");
4870 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4871 attr_size = apr_pstrdup(doc->pool, "7");
4878 if (attr_direction) {
4879 W_L(" direction=\"");
4880 W_V(attr_direction);
4883 if (attr_behavior) {
4884 W_L(" behavior=\"");
4894 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4901 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4902 memset(flg, 0, sizeof(*flg));
4903 if (attr_color || attr_size) {
4906 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4917 flg->with_font_flag = 1;
4919 node->userData = (void *)flg;
4920 return chtml50->out;
4925 * It is a handler who processes the MARQUEE tag.
4927 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4928 * destination is specified.
4929 * @param node [i] The MARQUEE tag node is specified.
4930 * @return The conversion result is returned.
4933 s_chtml50_end_marquee_tag(void *pdoc, Node *node)
4935 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4936 Doc *doc = chtml50->doc;
4938 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4939 if (flg && flg->with_font_flag) {
4943 if (IS_CSS_ON(chtml50->entryp)) {
4944 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4946 return chtml50->out;
4951 * It is a handler who processes the BLINK tag.
4953 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4954 * destination is specified.
4955 * @param node [i] The BLINK tag node is specified.
4956 * @return The conversion result is returned.
4959 s_chtml50_start_blink_tag(void *pdoc, Node *node)
4961 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4962 Doc *doc = chtml50->doc;
4964 char *attr_style = NULL;
4965 char *attr_color = NULL;
4966 char *attr_size = NULL;
4967 for (attr = qs_get_attr(doc,node);
4969 attr = qs_get_next_attr(doc,attr)) {
4970 char *name = qs_get_attr_name(doc,attr);
4971 char *value = qs_get_attr_value(doc,attr);
4972 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4976 if (IS_CSS_ON(chtml50->entryp)) {
4977 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4979 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4980 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4981 css_property_t *cur;
4982 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4983 if (cur->value && *cur->value) {
4984 attr_color = apr_pstrdup(doc->pool, cur->value);
4987 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4988 if (cur->value && *cur->value) {
4989 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4990 attr_size = apr_pstrdup(doc->pool, "1");
4992 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4993 attr_size = apr_pstrdup(doc->pool, "2");
4995 else if (STRCASEEQ('s','S',"small",cur->value)) {
4996 attr_size = apr_pstrdup(doc->pool, "3");
4998 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4999 attr_size = apr_pstrdup(doc->pool, "4");
5001 else if (STRCASEEQ('l','L',"large",cur->value)) {
5002 attr_size = apr_pstrdup(doc->pool, "5");
5004 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5005 attr_size = apr_pstrdup(doc->pool, "6");
5007 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5008 attr_size = apr_pstrdup(doc->pool, "7");
5015 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
5016 memset(flg, 0, sizeof(*flg));
5017 if (attr_color || attr_size) {
5020 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5031 flg->with_font_flag = 1;
5033 node->userData = (void *)flg;
5034 return chtml50->out;
5039 * It is a handler who processes the BLINK tag.
5041 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5042 * destination is specified.
5043 * @param node [i] The BLINK tag node is specified.
5044 * @return The conversion result is returned.
5047 s_chtml50_end_blink_tag(void *pdoc, Node *node)
5049 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5050 Doc *doc = chtml50->doc;
5052 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5053 if (flg && flg->with_font_flag) {
5057 if (IS_CSS_ON(chtml50->entryp)) {
5058 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5060 return chtml50->out;
5065 * It is a handler who processes the MENU tag.
5067 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5068 * destination is specified.
5069 * @param node [i] The MENU tag node is specified.
5070 * @return The conversion result is returned.
5073 s_chtml50_start_menu_tag(void *pdoc, Node *node)
5075 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5076 Doc *doc = chtml50->doc;
5078 char *attr_style = NULL;
5079 char *attr_color = NULL;
5080 char *attr_type = NULL;
5081 char *attr_size = NULL;
5082 for (attr = qs_get_attr(doc,node);
5084 attr = qs_get_next_attr(doc,attr)) {
5085 char *name = qs_get_attr_name(doc,attr);
5086 char *value = qs_get_attr_value(doc,attr);
5087 if (STRCASEEQ('t','T',"type",name)) {
5088 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5092 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5096 if (IS_CSS_ON(chtml50->entryp)) {
5097 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
5099 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5100 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5101 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5102 css_property_t *cur;
5103 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5104 if (cur->value && *cur->value) {
5105 attr_color = apr_pstrdup(doc->pool, cur->value);
5108 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5109 if (cur->value && *cur->value) {
5110 attr_type = apr_pstrdup(doc->pool, cur->value);
5113 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5114 if (cur->value && *cur->value) {
5115 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5116 attr_size = apr_pstrdup(doc->pool, "1");
5118 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5119 attr_size = apr_pstrdup(doc->pool, "2");
5121 else if (STRCASEEQ('s','S',"small",cur->value)) {
5122 attr_size = apr_pstrdup(doc->pool, "3");
5124 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5125 attr_size = apr_pstrdup(doc->pool, "4");
5127 else if (STRCASEEQ('l','L',"large",cur->value)) {
5128 attr_size = apr_pstrdup(doc->pool, "5");
5130 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5131 attr_size = apr_pstrdup(doc->pool, "6");
5133 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5134 attr_size = apr_pstrdup(doc->pool, "7");
5147 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
5148 memset(flg, 0, sizeof(*flg));
5149 if (attr_color || attr_size) {
5152 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5163 flg->with_font_flag = 1;
5165 node->userData = (void *)flg;
5166 return chtml50->out;
5171 * It is a handler who processes the MENU tag.
5173 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5174 * destination is specified.
5175 * @param node [i] The MENU tag node is specified.
5176 * @return The conversion result is returned.
5179 s_chtml50_end_menu_tag(void *pdoc, Node *node)
5181 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5182 Doc *doc = chtml50->doc;
5183 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5184 if (flg && flg->with_font_flag) {
5188 if (IS_CSS_ON(chtml50->entryp)) {
5189 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5191 return chtml50->out;
5196 * It is a handler who processes the PLAINTEXT tag.
5198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5199 * destination is specified.
5200 * @param node [i] The PLAINTEXT tag node is specified.
5201 * @return The conversion result is returned.
5204 s_chtml50_start_plaintext_tag(void *pdoc, Node *node)
5206 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5207 Doc *doc = chtml50->doc;
5209 s_chtml50_start_plaintext_tag_inner(pdoc,node);
5210 return chtml50->out;
5214 s_chtml50_start_plaintext_tag_inner(void *pdoc, Node *node)
5216 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5217 Doc *doc = chtml50->doc;
5219 for (child = qs_get_child_node(doc, node);
5221 child = qs_get_next_node(doc, child)) {
5223 s_chtml50_start_plaintext_tag_inner(pdoc, child);
5225 return chtml50->out;
5230 * It is a handler who processes the PLAINTEXT tag.
5232 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5233 * destination is specified.
5234 * @param node [i] The PLAINTEXT tag node is specified.
5235 * @return The conversion result is returned.
5238 s_chtml50_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5240 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5241 return chtml50->out;
5246 * It is handler who processes the New Line Code.
5249 s_chtml50_newline_mark(void *pdoc, Node *UNUSED(node))
5251 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5252 Doc *doc = chtml50->doc;
5254 return chtml50->out;
5259 * It is a handler who processes the LINK tag.
5261 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5262 * destination is specified.
5263 * @param node [i] The LINK tag node is specified.
5264 * @return The conversion result is returned.
5267 s_chtml50_link_tag(void *pdoc, Node *node)
5276 chtml50 = GET_CHTML50(pdoc);
5279 if (! IS_CSS_ON(chtml50->entryp)) {
5280 return chtml50->out;
5283 for (attr = qs_get_attr(doc,node);
5285 attr = qs_get_next_attr(doc,attr)) {
5286 char *name = qs_get_attr_name(doc,attr);
5287 char *value = qs_get_attr_value(doc,attr);
5288 if (STRCASEEQ('r','R',"rel", name)) {
5289 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5293 else if (STRCASEEQ('h','H',"href", name)) {
5294 if (value && *value) {
5298 else if (STRCASEEQ('t','T',"type", name)) {
5299 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5305 if (rel && href && type) {
5306 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
5307 chtml50->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml50->style, href);
5308 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
5311 return chtml50->out;
5315 static css_prop_list_t *
5316 s_chtml50_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5318 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5319 Doc *doc = chtml50->doc;
5320 css_prop_list_t *last_css = NULL;
5321 if (IS_CSS_ON(chtml50->entryp)) {
5322 css_prop_list_t *dup_css;
5323 css_selector_t *selector;
5325 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5326 dup_css = chxj_dup_css_prop_list(doc, last_css);
5327 selector = chxj_css_find_selector(doc, chtml50->style, node);
5329 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5331 chxj_css_push_prop_list(chtml50->css_prop_stack, dup_css);
5332 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5334 if (style_attr_value) {
5335 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));
5337 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5345 static css_prop_list_t *
5346 s_chtml50_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5348 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5349 Doc *doc = chtml50->doc;
5350 css_prop_list_t *last_css = NULL;
5351 if (IS_CSS_ON(chtml50->entryp)) {
5352 css_prop_list_t *dup_css;
5353 css_selector_t *selector;
5355 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5356 dup_css = chxj_dup_css_prop_list(doc, last_css);
5357 selector = chxj_css_find_selector(doc, chtml50->style, node);
5359 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5363 if (style_attr_value) {
5364 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));
5366 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5376 * It is a handler who processes the SPAN tag.
5378 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5379 * destination is specified.
5380 * @param node [i] The SPAN tag node is specified.
5381 * @return The conversion result is returned.
5384 s_chtml50_start_span_tag(void *pdoc, Node *node)
5389 char *attr_style = NULL;
5390 char *attr_color = NULL;
5391 char *attr_size = NULL;
5392 char *attr_align = NULL;
5393 char *attr_blink = NULL;
5394 char *attr_marquee = NULL;
5395 char *attr_marquee_dir = NULL;
5396 char *attr_marquee_style = NULL;
5397 char *attr_marquee_loop = NULL;
5399 chtml50 = GET_CHTML50(pdoc);
5402 for (attr = qs_get_attr(doc,node);
5404 attr = qs_get_next_attr(doc,attr)) {
5405 char *nm = qs_get_attr_name(doc,attr);
5406 char *val = qs_get_attr_value(doc,attr);
5407 if (val && STRCASEEQ('s','S',"style", nm)) {
5411 if (IS_CSS_ON(chtml50->entryp)) {
5412 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
5414 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5415 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5416 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5417 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5418 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5419 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5420 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5421 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5422 css_property_t *cur;
5423 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5424 attr_color = apr_pstrdup(doc->pool, cur->value);
5426 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5427 if (cur->value && *cur->value) {
5428 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5429 attr_size = apr_pstrdup(doc->pool, "1");
5431 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5432 attr_size = apr_pstrdup(doc->pool, "2");
5434 else if (STRCASEEQ('s','S',"small",cur->value)) {
5435 attr_size = apr_pstrdup(doc->pool, "3");
5437 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5438 attr_size = apr_pstrdup(doc->pool, "4");
5440 else if (STRCASEEQ('l','L',"large",cur->value)) {
5441 attr_size = apr_pstrdup(doc->pool, "5");
5443 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5444 attr_size = apr_pstrdup(doc->pool, "6");
5446 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5447 attr_size = apr_pstrdup(doc->pool, "7");
5451 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5452 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5453 attr_blink = apr_pstrdup(doc->pool, cur->value);
5456 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5457 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5458 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5461 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5462 if (cur->value && *cur->value) {
5463 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5464 attr_marquee_dir = "right";
5466 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5467 attr_marquee_dir = "left";
5471 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5472 if (cur->value && *cur->value) {
5473 if ( STRCASEEQ('s','S',"scroll",cur->value)
5474 || STRCASEEQ('s','S',"slide",cur->value)
5475 || STRCASEEQ('a','A',"alternate",cur->value)) {
5476 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5480 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5481 if (cur->value && *cur->value) {
5482 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5483 attr_marquee_loop = "16";
5486 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5490 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5491 if (STRCASEEQ('l','L',"left", cur->value)) {
5492 attr_align = apr_pstrdup(doc->pool, "left");
5494 else if (STRCASEEQ('c','C',"center",cur->value)) {
5495 attr_align = apr_pstrdup(doc->pool, "center");
5497 else if (STRCASEEQ('r','R',"right",cur->value)) {
5498 attr_align = apr_pstrdup(doc->pool, "right");
5503 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5504 chtml50_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5505 memset(flg, 0, sizeof(*flg));
5508 flg->with_blink_flag = 1;
5512 if (attr_marquee_dir) {
5513 W_L(" direction=\"");
5514 W_V(attr_marquee_dir);
5517 if (attr_marquee_style) {
5518 W_L(" behavior=\"");
5519 W_V(attr_marquee_style);
5522 if (attr_marquee_loop) {
5524 W_V(attr_marquee_loop);
5528 flg->with_marquee_flag = 1;
5530 if (attr_color||attr_size) {
5533 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5544 flg->with_font_flag = 1;
5547 W_L("<div align=\"");
5550 flg->with_div_flag = 1;
5552 node->userData = flg;
5555 node->userData = NULL;
5557 return chtml50->out;
5562 * It is a handler who processes the SPAN tag.
5564 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5565 * destination is specified.
5566 * @param node [i] The SPAN tag node is specified.
5567 * @return The conversion result is returned.
5570 s_chtml50_end_span_tag(void *pdoc, Node *node)
5572 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5573 Doc *doc = chtml50->doc;
5575 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5576 if (flg && flg->with_div_flag) {
5579 if (flg && flg->with_font_flag) {
5582 if (flg && flg->with_marquee_flag) {
5585 if (flg && flg->with_blink_flag) {
5588 if (IS_CSS_ON(chtml50->entryp)) {
5589 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5591 return chtml50->out;
5596 * It is a handler who processes the STYLE tag.
5598 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5599 * destination is specified.
5600 * @param node [i] The STYLE tag node is specified.
5601 * @return The conversion result is returned.
5604 s_chtml50_style_tag(void *pdoc, Node *node)
5611 chtml50 = GET_CHTML50(pdoc);
5614 if (! IS_CSS_ON(chtml50->entryp)) {
5615 return chtml50->out;
5618 for (attr = qs_get_attr(doc,node);
5620 attr = qs_get_next_attr(doc,attr)) {
5621 char *name = qs_get_attr_name(doc,attr);
5622 char *value = qs_get_attr_value(doc,attr);
5623 if (STRCASEEQ('t','T',"type", name)) {
5624 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5630 Node *child = qs_get_child_node(doc, node);
5631 if (type && child) {
5632 char *name = qs_get_node_name(doc, child);
5633 if (STRCASEEQ('t','T',"text", name)) {
5634 char *value = qs_get_node_value(doc, child);
5635 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]",TO_ADDR(doc->r), value);
5636 chtml50->style = chxj_css_parse_style_value(doc, chtml50->style, value);
5637 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]",TO_ADDR(doc->r), value);
5640 return chtml50->out;