2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_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"
28 #define GET_CHTML50(X) ((chtml50_t *)(X))
31 #define W_L(X) do { chtml50->out = BUFFERED_WRITE_LITERAL(chtml50->out, &doc->buf, (X)); } while(0)
32 #define W_V(X) do { chtml50->out = (X) ? BUFFERED_WRITE_VALUE(chtml50->out, &doc->buf, (X)) \
33 : BUFFERED_WRITE_LITERAL(chtml50->out, &doc->buf, ""); } while(0)
35 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml50->conf); W_V(nlcode); } while (0)
37 static char *s_chtml50_start_html_tag (void *pdoc, Node *node);
38 static char *s_chtml50_end_html_tag (void *pdoc, Node *node);
39 static char *s_chtml50_start_meta_tag (void *pdoc, Node *node);
40 static char *s_chtml50_end_meta_tag (void *pdoc, Node *node);
41 static char *s_chtml50_start_textarea_tag (void *pdoc, Node *node);
42 static char *s_chtml50_end_textarea_tag (void *pdoc, Node *node);
43 static char *s_chtml50_start_p_tag (void *pdoc, Node *node);
44 static char *s_chtml50_end_p_tag (void *pdoc, Node *node);
45 static char *s_chtml50_start_pre_tag (void *pdoc, Node *node);
46 static char *s_chtml50_end_pre_tag (void *pdoc, Node *node);
47 static char *s_chtml50_start_h1_tag (void *pdoc, Node *node);
48 static char *s_chtml50_end_h1_tag (void *pdoc, Node *node);
49 static char *s_chtml50_start_h2_tag (void *pdoc, Node *node);
50 static char *s_chtml50_end_h2_tag (void *pdoc, Node *node);
51 static char *s_chtml50_start_h3_tag (void *pdoc, Node *node);
52 static char *s_chtml50_end_h3_tag (void *pdoc, Node *node);
53 static char *s_chtml50_start_h4_tag (void *pdoc, Node *node);
54 static char *s_chtml50_end_h4_tag (void *pdoc, Node *node);
55 static char *s_chtml50_start_h5_tag (void *pdoc, Node *node);
56 static char *s_chtml50_end_h5_tag (void *pdoc, Node *node);
57 static char *s_chtml50_start_h6_tag (void *pdoc, Node *node);
58 static char *s_chtml50_end_h6_tag (void *pdoc, Node *node);
59 static char *s_chtml50_start_ul_tag (void *pdoc, Node *node);
60 static char *s_chtml50_end_ul_tag (void *pdoc, Node *node);
61 static char *s_chtml50_start_ol_tag (void *pdoc, Node *node);
62 static char *s_chtml50_end_ol_tag (void *pdoc, Node *node);
63 static char *s_chtml50_start_li_tag (void *pdoc, Node *node);
64 static char *s_chtml50_end_li_tag (void *pdoc, Node *node);
65 static char *s_chtml50_start_head_tag (void *pdoc, Node *node);
66 static char *s_chtml50_end_head_tag (void *pdoc, Node *node);
67 static char *s_chtml50_start_title_tag (void *pdoc, Node *node);
68 static char *s_chtml50_end_title_tag (void *pdoc, Node *node);
69 static char *s_chtml50_start_base_tag (void *pdoc, Node *node);
70 static char *s_chtml50_end_base_tag (void *pdoc, Node *node);
71 static char *s_chtml50_start_body_tag (void *pdoc, Node *node);
72 static char *s_chtml50_end_body_tag (void *pdoc, Node *node);
73 static char *s_chtml50_start_a_tag (void *pdoc, Node *node);
74 static char *s_chtml50_end_a_tag (void *pdoc, Node *node);
75 static char *s_chtml50_start_br_tag (void *pdoc, Node *node);
76 static char *s_chtml50_end_br_tag (void *pdoc, Node *node);
77 static char *s_chtml50_start_tr_tag (void *pdoc, Node *node);
78 static char *s_chtml50_end_tr_tag (void *pdoc, Node *node);
79 static char *s_chtml50_start_font_tag (void *pdoc, Node *node);
80 static char *s_chtml50_end_font_tag (void *pdoc, Node *node);
81 static char *s_chtml50_start_form_tag (void *pdoc, Node *node);
82 static char *s_chtml50_end_form_tag (void *pdoc, Node *node);
83 static char *s_chtml50_start_input_tag (void *pdoc, Node *node);
84 static char *s_chtml50_end_input_tag (void *pdoc, Node *node);
85 static char *s_chtml50_start_center_tag (void *pdoc, Node *node);
86 static char *s_chtml50_end_center_tag (void *pdoc, Node *node);
87 static char *s_chtml50_start_hr_tag (void *pdoc, Node *node);
88 static char *s_chtml50_end_hr_tag (void *pdoc, Node *node);
89 static char *s_chtml50_start_img_tag (void *pdoc, Node *node);
90 static char *s_chtml50_end_img_tag (void *pdoc, Node *node);
91 static char *s_chtml50_start_select_tag (void *pdoc, Node *node);
92 static char *s_chtml50_end_select_tag (void *pdoc, Node *node);
93 static char *s_chtml50_start_option_tag (void *pdoc, Node *node);
94 static char *s_chtml50_end_option_tag (void *pdoc, Node *node);
95 static char *s_chtml50_start_div_tag (void *pdoc, Node *node);
96 static char *s_chtml50_end_div_tag (void *pdoc, Node *node);
97 static char *s_chtml50_chxjif_tag (void *pdoc, Node *node);
98 static char *s_chtml50_text_tag (void *pdoc, Node *node);
99 static char *s_chtml50_start_blockquote_tag (void *pdoc, Node *node);
100 static char *s_chtml50_end_blockquote_tag (void *pdoc, Node *node);
101 static char *s_chtml50_start_dir_tag (void *pdoc, Node *node);
102 static char *s_chtml50_end_dir_tag (void *pdoc, Node *node);
103 static char *s_chtml50_start_dl_tag (void *pdoc, Node *node);
104 static char *s_chtml50_end_dl_tag (void *pdoc, Node *node);
105 static char *s_chtml50_start_dt_tag (void *pdoc, Node *node);
106 static char *s_chtml50_end_dt_tag (void *pdoc, Node *node);
107 static char *s_chtml50_start_dd_tag (void *pdoc, Node *node);
108 static char *s_chtml50_end_dd_tag (void *pdoc, Node *node);
109 static char *s_chtml50_start_marquee_tag (void *pdoc, Node *node);
110 static char *s_chtml50_end_marquee_tag (void *pdoc, Node *node);
111 static char *s_chtml50_start_blink_tag (void *pdoc, Node *node);
112 static char *s_chtml50_end_blink_tag (void *pdoc, Node *node);
113 static char *s_chtml50_start_menu_tag (void *pdoc, Node *node);
114 static char *s_chtml50_end_menu_tag (void *pdoc, Node *node);
115 static char *s_chtml50_start_plaintext_tag (void *pdoc, Node *node);
116 static char *s_chtml50_start_plaintext_tag_inner (void *pdoc, Node *node);
117 static char *s_chtml50_end_plaintext_tag (void *pdoc, Node *node);
118 static char *s_chtml50_newline_mark (void *pdoc, Node *node);
119 static char *s_chtml50_link_tag (void *pdoc, Node *node);
120 static char *s_chtml50_start_span_tag (void *pdoc, Node *node);
121 static char *s_chtml50_end_span_tag (void *pdoc, Node *node);
122 static char *s_chtml50_style_tag (void *pdoc, Node *node);
124 static void s_init_chtml50(chtml50_t *chtml, Doc *doc, request_rec *r, device_table *spec);
126 static int s_chtml50_search_emoji(chtml50_t *chtml, char *txt, char **rslt, Node *node);
127 static css_prop_list_t *s_chtml50_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
128 static css_prop_list_t *s_chtml50_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
131 tag_handler chtml50_handler[] = {
134 s_chtml50_start_html_tag,
135 s_chtml50_end_html_tag,
139 s_chtml50_start_meta_tag,
140 s_chtml50_end_meta_tag,
144 s_chtml50_start_textarea_tag,
145 s_chtml50_end_textarea_tag,
149 s_chtml50_start_p_tag,
154 s_chtml50_start_pre_tag,
155 s_chtml50_end_pre_tag,
159 s_chtml50_start_ul_tag,
160 s_chtml50_end_ul_tag,
164 s_chtml50_start_li_tag,
165 s_chtml50_end_li_tag,
169 s_chtml50_start_ol_tag,
170 s_chtml50_end_ol_tag,
174 s_chtml50_start_h1_tag,
175 s_chtml50_end_h1_tag,
179 s_chtml50_start_h2_tag,
180 s_chtml50_end_h2_tag,
184 s_chtml50_start_h3_tag,
185 s_chtml50_end_h3_tag,
189 s_chtml50_start_h4_tag,
190 s_chtml50_end_h4_tag,
194 s_chtml50_start_h5_tag,
195 s_chtml50_end_h5_tag,
199 s_chtml50_start_h6_tag,
200 s_chtml50_end_h6_tag,
204 s_chtml50_start_head_tag,
205 s_chtml50_end_head_tag,
209 s_chtml50_start_title_tag,
210 s_chtml50_end_title_tag,
214 s_chtml50_start_base_tag,
215 s_chtml50_end_base_tag,
219 s_chtml50_start_body_tag,
220 s_chtml50_end_body_tag,
224 s_chtml50_start_a_tag,
229 s_chtml50_start_br_tag,
230 s_chtml50_end_br_tag,
239 s_chtml50_start_tr_tag,
240 s_chtml50_end_tr_tag,
254 s_chtml50_start_font_tag,
255 s_chtml50_end_font_tag,
259 s_chtml50_start_form_tag,
260 s_chtml50_end_form_tag,
264 s_chtml50_start_input_tag,
265 s_chtml50_end_input_tag,
269 s_chtml50_start_center_tag,
270 s_chtml50_end_center_tag,
274 s_chtml50_start_hr_tag,
275 s_chtml50_end_hr_tag,
279 s_chtml50_start_img_tag,
280 s_chtml50_end_img_tag,
284 s_chtml50_start_select_tag,
285 s_chtml50_end_select_tag,
289 s_chtml50_start_option_tag,
290 s_chtml50_end_option_tag,
294 s_chtml50_start_div_tag,
295 s_chtml50_end_div_tag,
299 s_chtml50_chxjif_tag,
304 s_chtml50_chxjif_tag,
324 s_chtml50_start_span_tag,
325 s_chtml50_end_span_tag,
349 s_chtml50_start_dt_tag,
350 s_chtml50_end_dt_tag,
364 s_chtml50_start_blockquote_tag,
365 s_chtml50_end_blockquote_tag,
369 s_chtml50_start_dir_tag,
370 s_chtml50_end_dir_tag,
374 s_chtml50_start_dl_tag,
375 s_chtml50_end_dl_tag,
379 s_chtml50_start_dd_tag,
380 s_chtml50_end_dd_tag,
384 s_chtml50_start_menu_tag,
385 s_chtml50_end_menu_tag,
389 s_chtml50_start_plaintext_tag,
390 s_chtml50_end_plaintext_tag,
394 s_chtml50_start_blink_tag,
395 s_chtml50_end_blink_tag,
399 s_chtml50_start_marquee_tag,
400 s_chtml50_end_marquee_tag,
409 s_chtml50_newline_mark,
431 * converts from CHTML5.0 to CHTML3.0.
433 * @param r [i] Requet_rec is appointed.
434 * @param spec [i] The result of the device specification processing which
435 * was done in advance is appointed.
436 * @param src [i] The character string before the converting is appointed.
437 * @return The character string after the converting is returned.
440 chxj_convert_chtml50(
446 chxjconvrule_entry *entryp,
455 DBG(r, "start chxj_convert_chtml50()");
457 /*--------------------------------------------------------------------------*/
459 /*--------------------------------------------------------------------------*/
461 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
463 DBG(r,"i found qrcode xml");
464 DBG(r, "end chxj_convert_chtml50()");
467 DBG(r,"not found qrcode xml");
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, "end chxj_convert_chtml50()");
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,"spec is NULL");
583 for (ee = chtml50->conf->emoji;
586 if (ee->imode == NULL) {
587 DBG(r, "emoji->imode is NULL");
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 chxj_chtml50_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
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 chxj_chtml50_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
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 *UNUSED(node))
901 chtml50_t *chtml50 = GET_CHTML50(pdoc);
902 Doc *doc = chtml50->doc;
911 * It is a handler who processes the TITLE tag.
913 * @param pdoc [i/o] The pointer to the CHTML structure at the output
914 * destination is specified.
915 * @param node [i] The TITLE tag node is specified.
916 * @return The conversion result is returned.
919 s_chtml50_end_title_tag(void *pdoc, Node *UNUSED(child))
921 chtml50_t *chtml50 = GET_CHTML50(pdoc);
922 Doc *doc = chtml50->doc;
931 * It is a handler who processes the BASE tag.
933 * @param pdoc [i/o] The pointer to the CHTML structure at the output
934 * destination is specified.
935 * @param node [i] The BASE tag node is specified.
936 * @return The conversion result is returned.
939 s_chtml50_start_base_tag(void *pdoc, Node *node)
946 chtml50 = GET_CHTML50(pdoc);
951 /*--------------------------------------------------------------------------*/
953 /*--------------------------------------------------------------------------*/
954 for (attr = qs_get_attr(doc,node);
956 attr = qs_get_next_attr(doc,attr)) {
957 char *name = qs_get_attr_name(doc,attr);
958 char *value = qs_get_attr_value(doc,attr);
959 if (STRCASEEQ('h','H',"href", name)) {
972 * It is a handler who processes the BASE tag.
974 * @param pdoc [i/o] The pointer to the CHTML structure at the output
975 * destination is specified.
976 * @param node [i] The BASE tag node is specified.
977 * @return The conversion result is returned.
980 s_chtml50_end_base_tag(void *pdoc, Node *UNUSED(child))
982 chtml50_t *chtml50 = GET_CHTML50(pdoc);
989 * It is a handler who processes the BODY tag.
991 * @param pdoc [i/o] The pointer to the CHTML structure at the output
992 * destination is specified.
993 * @param node [i] The BODY tag node is specified.
994 * @return The conversion result is returned.
997 s_chtml50_start_body_tag(void *pdoc, Node *node)
1003 char *attr_bgcolor = NULL;
1004 char *attr_text = NULL;
1005 char *attr_link = NULL;
1006 char *attr_style = NULL;
1007 char *attr_alink = NULL;
1008 char *attr_vlink = NULL;
1010 chtml50 = GET_CHTML50(pdoc);
1014 /*--------------------------------------------------------------------------*/
1015 /* Get Attributes */
1016 /*--------------------------------------------------------------------------*/
1017 for (attr = qs_get_attr(doc,node);
1019 attr = qs_get_next_attr(doc,attr)) {
1020 char *name = qs_get_attr_name(doc,attr);
1021 char *value = qs_get_attr_value(doc,attr);
1022 if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
1023 /*----------------------------------------------------------------------*/
1025 /*----------------------------------------------------------------------*/
1026 attr_bgcolor = value;
1028 else if (STRCASEEQ('t','T', "text", name) && value && *value) {
1029 /*----------------------------------------------------------------------*/
1031 /*----------------------------------------------------------------------*/
1034 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1035 /*----------------------------------------------------------------------*/
1037 /*----------------------------------------------------------------------*/
1040 else if (STRCASEEQ('a','A',"alink", name) && value && *value) {
1041 /*----------------------------------------------------------------------*/
1043 /*----------------------------------------------------------------------*/
1046 else if (STRCASEEQ('v','V',"vlink", name) && value && *value) {
1047 /*----------------------------------------------------------------------*/
1049 /*----------------------------------------------------------------------*/
1052 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1057 if (IS_CSS_ON(chtml50->entryp)) {
1058 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1060 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1061 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1062 css_property_t *cur;
1063 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1064 if (cur->value && *cur->value) {
1065 attr_text = apr_pstrdup(doc->pool, cur->value);
1068 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1069 if (cur->value && *cur->value) {
1070 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1074 if (chtml50->style) {
1075 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml50->style);
1076 css_selector_t *cur_sel;
1077 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1078 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1079 css_property_t *cur;
1080 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1081 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1082 attr_link = apr_pstrdup(doc->pool, cur->value);
1086 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1087 css_property_t *cur;
1088 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1089 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1090 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1094 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
1095 css_property_t *cur;
1096 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1097 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1098 attr_alink = apr_pstrdup(doc->pool, cur->value);
1108 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1114 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1120 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1126 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1132 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1139 return chtml50->out;
1144 * It is a handler who processes the BODY tag.
1146 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1147 * destination is specified.
1148 * @param node [i] The BODY tag node is specified.
1149 * @return The conversion result is returned.
1152 s_chtml50_end_body_tag(void *pdoc, Node *UNUSED(child))
1157 chtml50 = GET_CHTML50(pdoc);
1161 if (IS_CSS_ON(chtml50->entryp)) {
1162 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1165 return chtml50->out;
1170 * It is a handler who processes the A tag.
1172 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1173 * destination is specified.
1174 * @param node [i] The A tag node is specified.
1175 * @return The conversion result is returned.
1178 s_chtml50_start_a_tag(void *pdoc, Node *node)
1184 char *attr_style = NULL;
1186 chtml50 = GET_CHTML50(pdoc);
1191 /*--------------------------------------------------------------------------*/
1192 /* Get Attributes */
1193 /*--------------------------------------------------------------------------*/
1194 for (attr = qs_get_attr(doc,node);
1196 attr = qs_get_next_attr(doc,attr)) {
1197 char *name = qs_get_attr_name(doc,attr);
1198 char *value = qs_get_attr_value(doc,attr);
1199 if (STRCASEEQ('n','N',"name", name)) {
1200 /*----------------------------------------------------------------------*/
1202 /*----------------------------------------------------------------------*/
1207 else if (STRCASEEQ('h','H',"href", name)) {
1208 /*----------------------------------------------------------------------*/
1210 /*----------------------------------------------------------------------*/
1211 value = chxj_encoding_parameter(r, value, 0);
1212 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1213 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
1219 else if (STRCASEEQ('a','A',"accesskey", name)) {
1220 /*----------------------------------------------------------------------*/
1222 /*----------------------------------------------------------------------*/
1223 W_L(" accesskey=\"");
1227 else if (STRCASEEQ('c','C',"cti", name)) {
1228 /*----------------------------------------------------------------------*/
1230 /*----------------------------------------------------------------------*/
1235 else if (STRCASEEQ('i','I',"ijam", name)) {
1236 /*----------------------------------------------------------------------*/
1238 /*----------------------------------------------------------------------*/
1241 else if (STRCASEEQ('u','U',"utn", name)) {
1242 /*----------------------------------------------------------------------*/
1244 /* It is special only for CHTML. */
1245 /*----------------------------------------------------------------------*/
1248 else if (STRCASEEQ('t','T',"telbook", name)) {
1249 /*----------------------------------------------------------------------*/
1251 /*----------------------------------------------------------------------*/
1254 else if (STRCASEEQ('k','K',"kana", name)) {
1255 /*----------------------------------------------------------------------*/
1257 /*----------------------------------------------------------------------*/
1260 else if (STRCASEEQ('e','E',"email", name)) {
1261 /*----------------------------------------------------------------------*/
1263 /*----------------------------------------------------------------------*/
1266 else if (STRCASEEQ('i','I',"ista", name)) {
1267 /*----------------------------------------------------------------------*/
1269 /*----------------------------------------------------------------------*/
1272 else if (STRCASEEQ('i','I',"ilet", name)) {
1273 /*----------------------------------------------------------------------*/
1275 /*----------------------------------------------------------------------*/
1278 else if (STRCASEEQ('i','I',"iswf", name)) {
1279 /*----------------------------------------------------------------------*/
1281 /*----------------------------------------------------------------------*/
1284 else if (STRCASEEQ('i','I',"irst", name)) {
1285 /*----------------------------------------------------------------------*/
1287 /*----------------------------------------------------------------------*/
1290 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1296 if (IS_CSS_ON(chtml50->entryp)) {
1297 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1300 return chtml50->out;
1305 * It is a handler who processes the A tag.
1307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1308 * destination is specified.
1309 * @param node [i] The A tag node is specified.
1310 * @return The conversion result is returned.
1313 s_chtml50_end_a_tag(void *pdoc, Node *UNUSED(child))
1318 chtml50 = GET_CHTML50(pdoc);
1323 if (IS_CSS_ON(chtml50->entryp)) {
1324 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1327 return chtml50->out;
1332 * It is a handler who processes the BR tag.
1334 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1335 * destination is specified.
1336 * @param node [i] The BR tag node is specified.
1337 * @return The conversion result is returned.
1340 s_chtml50_start_br_tag(void *pdoc, Node *node)
1347 chtml50 = GET_CHTML50(pdoc);
1351 /*--------------------------------------------------------------------------*/
1352 /* Get Attributes */
1353 /*--------------------------------------------------------------------------*/
1354 for (attr = qs_get_attr(doc,node);
1356 attr = qs_get_next_attr(doc,attr)) {
1357 char *name = qs_get_attr_name(doc,attr);
1358 char *value = qs_get_attr_value(doc,attr);
1359 if (STRCASEEQ('c','C',"clear",name)) {
1360 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1368 return chtml50->out;
1373 * It is a handler who processes the BR tag.
1375 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1376 * destination is specified.
1377 * @param node [i] The BR tag node is specified.
1378 * @return The conversion result is returned.
1381 s_chtml50_end_br_tag(void *pdoc, Node *UNUSED(child))
1383 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1385 return chtml50->out;
1390 * It is a handler who processes the TR tag.
1392 * @param chtml50 [i/o] The pointer to the CHTML structure at the output
1393 * destination is specified.
1394 * @param node [i] The TR tag node is specified.
1395 * @return The conversion result is returned.
1398 s_chtml50_start_tr_tag(void *pdoc, Node *UNUSED(node))
1400 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1402 return chtml50->out;
1407 * It is a handler who processes the TR tag.
1409 * @param pdoc [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_end_tr_tag(void *pdoc, Node *UNUSED(child))
1421 chtml50 = GET_CHTML50(pdoc);
1427 return chtml50->out;
1432 * It is a handler who processes the FONT tag.
1434 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1435 * destination is specified.
1436 * @param node [i] The FONT tag node is specified.
1437 * @return The conversion result is returned.
1440 s_chtml50_start_font_tag(void *pdoc, Node *node)
1446 char *attr_color = NULL;
1447 char *attr_size = NULL;
1448 char *attr_style = NULL;
1450 chtml50 = GET_CHTML50(pdoc);
1454 /*--------------------------------------------------------------------------*/
1455 /* Get Attributes */
1456 /*--------------------------------------------------------------------------*/
1457 for (attr = qs_get_attr(doc,node);
1459 attr = qs_get_next_attr(doc,attr)) {
1460 char *name = qs_get_attr_name(doc,attr);
1461 char *value = qs_get_attr_value(doc,attr);
1462 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1463 attr_color = apr_pstrdup(doc->buf.pool, value);
1465 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1466 /*----------------------------------------------------------------------*/
1468 /*----------------------------------------------------------------------*/
1469 attr_size = apr_pstrdup(doc->buf.pool, value);
1470 switch (*attr_size) {
1478 if (*(attr_size + 1) == 0) {
1487 char ch = *(attr_size + 1);
1488 if (ch == '1' || ch == '2' || ch == '3') {
1489 if (*(attr_size + 2) == 0) {
1501 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1505 if (IS_CSS_ON(chtml50->entryp)) {
1506 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1508 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1509 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1510 css_property_t *cur;
1511 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1512 if (cur->value && *cur->value) {
1513 attr_color = apr_pstrdup(doc->pool, cur->value);
1516 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1517 if (cur->value && *cur->value) {
1518 attr_size = apr_pstrdup(doc->pool, cur->value);
1519 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1520 attr_size = apr_pstrdup(doc->pool, "1");
1522 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1523 attr_size = apr_pstrdup(doc->pool, "2");
1525 else if (STRCASEEQ('s','S',"small",attr_size)) {
1526 attr_size = apr_pstrdup(doc->pool, "3");
1528 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1529 attr_size = apr_pstrdup(doc->pool, "4");
1531 else if (STRCASEEQ('l','L',"large",attr_size)) {
1532 attr_size = apr_pstrdup(doc->pool, "5");
1534 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1535 attr_size = apr_pstrdup(doc->pool, "6");
1537 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1538 attr_size = apr_pstrdup(doc->pool, "7");
1545 if (attr_color || attr_size) {
1548 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1559 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1560 flg->with_font_flag = 1;
1561 node->userData = flg;
1564 node->userData = NULL;
1566 return chtml50->out;
1571 * It is a handler who processes the FONT tag.
1573 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1574 * destination is specified.
1575 * @param node [i] The FONT tag node is specified.
1576 * @return The conversion result is returned.
1579 s_chtml50_end_font_tag(void *pdoc, Node *node)
1585 chtml50 = GET_CHTML50(pdoc);
1589 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
1590 if (flg && flg->with_font_flag) {
1593 if (IS_CSS_ON(chtml50->entryp)) {
1594 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1597 return chtml50->out;
1602 * It is a handler who processes the FORM tag.
1604 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1605 * destination is specified.
1606 * @param node [i] The FORM tag node is specified.
1607 * @return The conversion result is returned.
1610 s_chtml50_start_form_tag(void *pdoc, Node *node)
1616 char *attr_action = NULL;
1617 char *attr_method = NULL;
1618 char *attr_style = NULL;
1619 char *attr_color = NULL;
1620 char *attr_align = NULL;
1621 char *attr_utn = NULL;
1622 char *new_hidden_tag = NULL;
1624 chtml50 = GET_CHTML50(pdoc);
1628 /*--------------------------------------------------------------------------*/
1629 /* Get Attributes */
1630 /*--------------------------------------------------------------------------*/
1631 for (attr = qs_get_attr(doc,node);
1633 attr = qs_get_next_attr(doc,attr)) {
1634 char *name = qs_get_attr_name(doc,attr);
1635 char *value = qs_get_attr_value(doc,attr);
1639 if (strcasecmp(name, "action") == 0) {
1640 /*--------------------------------------------------------------------*/
1642 /*--------------------------------------------------------------------*/
1643 attr_action = value;
1649 if (strcasecmp(name, "method") == 0) {
1650 /*--------------------------------------------------------------------*/
1652 /*--------------------------------------------------------------------*/
1653 attr_method = value;
1659 if (strcasecmp(name, "utn") == 0) {
1660 /*--------------------------------------------------------------------*/
1662 /*--------------------------------------------------------------------*/
1669 if (strcasecmp(name, "style") == 0) {
1678 if (IS_CSS_ON(chtml50->entryp)) {
1679 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1681 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1682 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1683 css_property_t *cur;
1684 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1685 if (STRCASEEQ('l','L',"left", cur->value)) {
1686 attr_align = apr_pstrdup(doc->pool, "left");
1688 else if (STRCASEEQ('c','C',"center",cur->value)) {
1689 attr_align = apr_pstrdup(doc->pool, "center");
1691 else if (STRCASEEQ('r','R',"right",cur->value)) {
1692 attr_align = apr_pstrdup(doc->pool, "right");
1695 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1696 attr_color = apr_pstrdup(doc->pool, cur->value);
1701 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1705 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1706 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml50->cookie);
1708 char *new_query_string = NULL;
1709 q = strchr(attr_action, '?');
1711 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);
1712 if (new_hidden_tag || new_query_string) {
1718 if (new_query_string) {
1720 W_V(new_query_string);
1734 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
1735 memset(flg, 0, sizeof(*flg));
1737 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1738 W_L("<font color=\"");
1741 flg->with_font_flag = 1;
1744 W_L("<div align=\"");
1747 flg->with_div_flag = 1;
1749 node->userData = flg;
1750 if (new_hidden_tag) {
1751 W_V(new_hidden_tag);
1754 return chtml50->out;
1759 * It is a handler who processes the FORM tag.
1761 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1762 * destination is specified.
1763 * @param node [i] The FORM tag node is specified.
1764 * @return The conversion result is returned.
1767 s_chtml50_end_form_tag(void *pdoc, Node *node)
1772 chtml50 = GET_CHTML50(pdoc);
1775 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
1776 if (flg && flg->with_div_flag) {
1779 if (flg && flg->with_font_flag) {
1783 if (IS_CSS_ON(chtml50->entryp)) {
1784 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1787 return chtml50->out;
1792 * It is a handler who processes the INPUT tag.
1794 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1795 * destination is specified.
1796 * @param node [i] The INPUT tag node is specified.
1797 * @return The conversion result is returned.
1800 s_chtml50_start_input_tag(void *pdoc, Node *node)
1806 char *attr_accesskey = NULL;
1807 char *attr_max_length = NULL;
1808 char *attr_type = NULL;
1809 char *attr_name = NULL;
1810 char *attr_value = NULL;
1811 char *attr_istyle = NULL;
1812 char *attr_size = NULL;
1813 char *attr_checked = NULL;
1814 char *attr_style = NULL;
1816 chtml50 = GET_CHTML50(pdoc);
1820 /*--------------------------------------------------------------------------*/
1821 /* Get Attributes */
1822 /*--------------------------------------------------------------------------*/
1823 for (attr = qs_get_attr(doc,node);
1825 attr = qs_get_next_attr(doc,attr)) {
1826 char *name = qs_get_attr_name(doc,attr);
1827 char *value = qs_get_attr_value(doc,attr);
1828 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1829 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1830 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1831 STRCASEEQ('p','P',"password",tmp_type) ||
1832 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1833 STRCASEEQ('r','R',"radio", tmp_type) ||
1834 STRCASEEQ('h','H',"hidden", tmp_type) ||
1835 STRCASEEQ('s','S',"submit", tmp_type) ||
1836 STRCASEEQ('r','R',"reset", tmp_type))) {
1837 attr_type = tmp_type;
1840 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1843 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1846 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1847 attr_istyle = value;
1849 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1850 attr_max_length = value;
1852 else if (STRCASEEQ('c','C',"checked", name)) {
1853 attr_checked = value;
1855 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1856 attr_accesskey = value;
1858 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1861 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1866 if (IS_CSS_ON(chtml50->entryp)) {
1867 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
1869 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1870 css_property_t *cur;
1871 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1872 if (strcasestr(cur->value, "<ja:n>")) {
1875 else if (strcasestr(cur->value, "<ja:en>")) {
1878 else if (strcasestr(cur->value, "<ja:hk>")) {
1881 else if (strcasestr(cur->value, "<ja:h>")) {
1905 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1906 apr_size_t value_len = strlen(attr_value);
1907 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml50->entryp);
1911 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1914 if (attr_accesskey) {
1915 W_L(" accesskey=\"");
1916 W_V(attr_accesskey);
1920 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1926 /*--------------------------------------------------------------------------*/
1927 /* The figure is default for the password. */
1928 /*--------------------------------------------------------------------------*/
1929 if (attr_max_length) {
1930 if (chxj_chk_numeric(attr_max_length) != 0) {
1931 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1933 if (attr_istyle && *attr_istyle == '1') {
1934 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1938 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1947 return chtml50->out;
1952 * It is a handler who processes the INPUT tag.
1954 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1955 * destination is specified.
1956 * @param node [i] The INPUT tag node is specified.
1957 * @return The conversion result is returned.
1960 s_chtml50_end_input_tag(void *pdoc, Node *UNUSED(child))
1962 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1964 return chtml50->out;
1969 * It is a handler who processes the CENTER tag.
1971 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1972 * destination is specified.
1973 * @param node [i] The CENTER tag node is specified.
1974 * @return The conversion result is returned.
1977 s_chtml50_start_center_tag(void *pdoc, Node *node)
1982 char *attr_style = NULL;
1983 char *attr_color = NULL;
1984 char *attr_size = NULL;
1986 chtml50 = GET_CHTML50(pdoc);
1989 for (attr = qs_get_attr(doc,node);
1991 attr = qs_get_next_attr(doc,attr)) {
1992 char *name = qs_get_attr_name(doc,attr);
1993 char *value = qs_get_attr_value(doc,attr);
1994 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1998 if (IS_CSS_ON(chtml50->entryp)) {
1999 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2001 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2002 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2003 css_property_t *cur;
2004 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2005 if (cur->value && *cur->value) {
2006 attr_color = apr_pstrdup(doc->pool, cur->value);
2009 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2010 if (cur->value && *cur->value) {
2011 attr_size = apr_pstrdup(doc->pool, cur->value);
2012 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2013 attr_size = apr_pstrdup(doc->pool, "1");
2015 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2016 attr_size = apr_pstrdup(doc->pool, "2");
2018 else if (STRCASEEQ('s','S',"small",attr_size)) {
2019 attr_size = apr_pstrdup(doc->pool, "3");
2021 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2022 attr_size = apr_pstrdup(doc->pool, "4");
2024 else if (STRCASEEQ('l','L',"large",attr_size)) {
2025 attr_size = apr_pstrdup(doc->pool, "5");
2027 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2028 attr_size = apr_pstrdup(doc->pool, "6");
2030 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2031 attr_size = apr_pstrdup(doc->pool, "7");
2039 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
2040 memset(flg, 0, sizeof(*flg));
2041 if (attr_color || attr_size) {
2044 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2054 flg->with_font_flag = 1;
2057 node->userData = flg;
2059 return chtml50->out;
2064 * It is a handler who processes the CENTER tag.
2066 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2067 * destination is specified.
2068 * @param node [i] The CENTER tag node is specified.
2069 * @return The conversion result is returned.
2072 s_chtml50_end_center_tag(void *pdoc, Node *node)
2077 chtml50 = GET_CHTML50(pdoc);
2080 if (IS_CSS_ON(chtml50->entryp)) {
2081 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2083 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
2084 if (flg && flg->with_font_flag) {
2089 return chtml50->out;
2094 * It is a handler who processes the HR tag.
2096 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2097 * destination is specified.
2098 * @param node [i] The HR tag node is specified.
2099 * @return The conversion result is returned.
2102 s_chtml50_start_hr_tag(void *pdoc, Node *node)
2108 char *attr_align = NULL;
2109 char *attr_size = NULL;
2110 char *attr_width = NULL;
2111 char *attr_noshade = NULL;
2112 char *attr_style = NULL;
2113 char *attr_color = NULL;
2115 chtml50 = GET_CHTML50(pdoc);
2119 for (attr = qs_get_attr(doc,node);
2121 attr = qs_get_next_attr(doc,attr)) {
2122 char *name = qs_get_attr_name (doc,attr);
2123 char *value = qs_get_attr_value(doc,attr);
2127 if (strcasecmp(name, "align") == 0) {
2128 /*--------------------------------------------------------------------*/
2130 /*--------------------------------------------------------------------*/
2131 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2139 if (strcasecmp(name, "size") == 0) {
2140 /*--------------------------------------------------------------------*/
2142 /*--------------------------------------------------------------------*/
2143 if (value && *value) {
2147 else if (strcasecmp(name, "style") == 0) {
2148 if (value && *value) {
2156 if (strcasecmp(name, "width") == 0) {
2157 /*--------------------------------------------------------------------*/
2159 /*--------------------------------------------------------------------*/
2160 if (value && *value) {
2168 if (strcasecmp(name, "noshade") == 0) {
2169 /*--------------------------------------------------------------------*/
2171 /*--------------------------------------------------------------------*/
2172 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2178 if (strcasecmp(name, "color") == 0 && value && *value) {
2179 /*--------------------------------------------------------------------*/
2181 /*--------------------------------------------------------------------*/
2190 if (IS_CSS_ON(chtml50->entryp)) {
2191 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2193 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2194 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2195 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2196 css_property_t *cur;
2197 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2198 if (STRCASEEQ('s','S',"solid",cur->value)) {
2199 attr_noshade = "noshade";
2202 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2203 char *tmp = apr_pstrdup(doc->pool, cur->value);
2204 char *tmpp = strstr(tmp, "px");
2207 attr_size = apr_pstrdup(doc->pool, tmp);
2210 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2211 char *tmp = apr_pstrdup(doc->pool, cur->value);
2212 char *tmpp = strstr(tmp, "px");
2215 attr_width = apr_pstrdup(doc->pool, tmp);
2218 tmpp = strstr(tmp, "%");
2220 attr_width = apr_pstrdup(doc->pool, tmp);
2251 return chtml50->out;
2256 * It is a handler who processes the HR tag.
2258 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2259 * destination is specified.
2260 * @param node [i] The HR tag node is specified.
2261 * @return The conversion result is returned.
2264 s_chtml50_end_hr_tag(void *pdoc, Node *UNUSED(child))
2266 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2268 return chtml50->out;
2273 * It is a handler who processes the IMG tag.
2275 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2276 * destination is specified.
2277 * @param node [i] The IMG tag node is specified.
2278 * @return The conversion result is returned.
2281 s_chtml50_start_img_tag(void *pdoc, Node *node)
2287 char *attr_src = NULL;
2288 char *attr_align = NULL;
2289 char *attr_style = NULL;
2290 char *attr_alt = NULL;
2291 char *attr_width = NULL;
2292 char *attr_height = NULL;
2293 char *attr_hspace = NULL;
2294 char *attr_vspace = NULL;
2295 #ifndef IMG_NOT_CONVERT_FILENAME
2299 chtml50 = GET_CHTML50(pdoc);
2300 #ifndef IMG_NOT_CONVERT_FILENAME
2301 spec = chtml50->spec;
2306 /*--------------------------------------------------------------------------*/
2307 /* Get Attributes */
2308 /*--------------------------------------------------------------------------*/
2309 for (attr = qs_get_attr(doc,node);
2311 attr = qs_get_next_attr(doc,attr)) {
2312 char *name = qs_get_attr_name (doc,attr);
2313 char *value = qs_get_attr_value(doc,attr);
2317 if (strcasecmp(name, "src") == 0) {
2318 /*--------------------------------------------------------------------*/
2320 /*--------------------------------------------------------------------*/
2321 #ifdef IMG_NOT_CONVERT_FILENAME
2322 value = chxj_encoding_parameter(r, value, 0);
2323 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
2324 value = chxj_add_cookie_no_update_parameter(r, value);
2325 value = chxj_img_rewrite_parameter(r,chtml50->conf,value);
2328 value = chxj_img_conv(r,spec,value);
2329 value = chxj_encoding_parameter(r, value, 0);
2330 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
2331 value = chxj_add_cookie_no_update_parameter(r, value);
2332 value = chxj_img_rewrite_parameter(r,chtml50->conf,value);
2336 else if (strcasecmp(name,"style") == 0 && value && *value) {
2343 if (strcasecmp(name, "align" ) == 0) {
2344 /*--------------------------------------------------------------------*/
2346 /*--------------------------------------------------------------------*/
2347 /*--------------------------------------------------------------------*/
2349 /*--------------------------------------------------------------------*/
2351 if (STRCASEEQ('t','T',"top", value) ||
2352 STRCASEEQ('m','M',"middle",value) ||
2353 STRCASEEQ('b','B',"bottom",value) ||
2354 STRCASEEQ('l','L',"left", value) ||
2355 STRCASEEQ('r','R',"right", value)) {
2358 else if (STRCASEEQ('c','C',"center", value)) {
2359 attr_align = apr_pstrdup(doc->pool, "middle");
2363 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2364 /*--------------------------------------------------------------------*/
2366 /*--------------------------------------------------------------------*/
2373 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2374 /*--------------------------------------------------------------------*/
2376 /*--------------------------------------------------------------------*/
2383 if (strcasecmp(name, "height") == 0 && value && *value) {
2384 /*--------------------------------------------------------------------*/
2386 /*--------------------------------------------------------------------*/
2387 attr_height = value;
2390 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2391 /*--------------------------------------------------------------------*/
2393 /*--------------------------------------------------------------------*/
2394 attr_hspace = value;
2400 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2401 /*--------------------------------------------------------------------*/
2403 /*--------------------------------------------------------------------*/
2404 attr_vspace = value;
2413 if (IS_CSS_ON(chtml50->entryp)) {
2414 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2416 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2417 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2418 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2419 css_property_t *cur;
2420 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2421 attr_height = apr_pstrdup(doc->pool, cur->value);
2423 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2424 attr_width = apr_pstrdup(doc->pool, cur->value);
2426 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2427 attr_align = apr_pstrdup(doc->pool, cur->value);
2469 return chtml50->out;
2474 * It is a handler who processes the IMG tag.
2476 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2477 * destination is specified.
2478 * @param node [i] The IMG tag node is specified.
2479 * @return The conversion result is returned.
2482 s_chtml50_end_img_tag(void *pdoc, Node *UNUSED(child))
2484 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2486 return chtml50->out;
2491 * It is a handler who processes the SELECT tag.
2493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2494 * destination is specified.
2495 * @param node [i] The SELECT tag node is specified.
2496 * @return The conversion result is returned.
2499 s_chtml50_start_select_tag(void *pdoc, Node *node)
2501 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2502 Doc *doc = chtml50->doc;
2505 char *multiple = NULL;
2507 char *attr_style = NULL;
2510 for (attr = qs_get_attr(doc, node);
2512 attr = qs_get_next_attr(doc,attr)) {
2513 char *nm = qs_get_attr_name(doc,attr);
2514 char *val = qs_get_attr_value(doc,attr);
2515 if (STRCASEEQ('s','S',"size", nm)) {
2516 /*----------------------------------------------------------------------*/
2517 /* CHTML 1.0 version 2.0 */
2518 /*----------------------------------------------------------------------*/
2519 size = apr_pstrdup(doc->buf.pool, val);
2521 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2522 /*----------------------------------------------------------------------*/
2523 /* CHTML 1.0 version 2.0 */
2524 /*----------------------------------------------------------------------*/
2525 attr_style = apr_pstrdup(doc->buf.pool, val);
2527 else if (STRCASEEQ('n','N',"name", nm)) {
2528 /*----------------------------------------------------------------------*/
2529 /* CHTML 1.0 version 2.0 */
2530 /*----------------------------------------------------------------------*/
2531 name = apr_pstrdup(doc->buf.pool, val);
2533 else if (STRCASEEQ('m','M',"multiple", nm)) {
2534 /*----------------------------------------------------------------------*/
2535 /* CHTML 1.0 version 2.0 */
2536 /*----------------------------------------------------------------------*/
2537 multiple = apr_pstrdup(doc->buf.pool, val);
2540 if (size && *size) {
2545 if (name && *name) {
2554 if (IS_CSS_ON(chtml50->entryp)) {
2555 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2558 return chtml50->out;
2563 * It is a handler who processes the SELECT tag.
2565 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2566 * destination is specified.
2567 * @param node [i] The SELECT tag node is specified.
2568 * @return The conversion result is returned.
2571 s_chtml50_end_select_tag(void *pdoc, Node *UNUSED(child))
2573 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2574 Doc *doc = chtml50->doc;
2577 if (IS_CSS_ON(chtml50->entryp)) {
2578 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2581 return chtml50->out;
2586 * It is a handler who processes the OPTION tag.
2588 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2589 * destination is specified.
2590 * @param node [i] The OPTION tag node is specified.
2591 * @return The conversion result is returned.
2594 s_chtml50_start_option_tag(void *pdoc, Node *node)
2602 char *attr_style = NULL;
2604 chtml50 = GET_CHTML50(pdoc);
2611 for (attr = qs_get_attr(doc,node);
2613 attr = qs_get_next_attr(doc,attr)) {
2614 char *nm = qs_get_attr_name(doc,attr);
2615 char *val = qs_get_attr_value(doc,attr);
2616 if (STRCASEEQ('s','S',"selected", nm)) {
2617 /*----------------------------------------------------------------------*/
2618 /* CHTML 1.0 version 2.0 */
2619 /*----------------------------------------------------------------------*/
2620 selected = apr_pstrdup(doc->buf.pool, val);
2622 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2623 /*----------------------------------------------------------------------*/
2624 /* CHTML 1.0 version 2.0 */
2625 /*----------------------------------------------------------------------*/
2626 attr_style = apr_pstrdup(doc->buf.pool, val);
2628 else if (STRCASEEQ('v','V',"value", nm)) {
2629 /*----------------------------------------------------------------------*/
2630 /* CHTML 1.0 version 2.0 */
2631 /*----------------------------------------------------------------------*/
2632 value = apr_pstrdup(doc->buf.pool, val);
2645 if (IS_CSS_ON(chtml50->entryp)) {
2646 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2649 return chtml50->out;
2654 * It is a handler who processes the OPTION tag.
2656 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2657 * destination is specified.
2658 * @param node [i] The OPTION tag node is specified.
2659 * @return The conversion result is returned.
2662 s_chtml50_end_option_tag(void *pdoc, Node *UNUSED(child))
2664 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2667 if (IS_CSS_ON(chtml50->entryp)) {
2668 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2671 return chtml50->out;
2676 * It is a handler who processes the DIV tag.
2678 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2679 * destination is specified.
2680 * @param node [i] The DIV tag node is specified.
2681 * @return The conversion result is returned.
2684 s_chtml50_start_div_tag(void *pdoc, Node *node)
2690 char *attr_style = NULL;
2691 char *attr_align = NULL;
2692 char *attr_display = NULL;
2693 char *attr_decoration = NULL;
2694 char *attr_wap_marquee_style = NULL;
2695 char *attr_wap_marquee_dir = NULL;
2696 char *attr_wap_marquee_loop = NULL;
2697 char *attr_color = NULL;
2698 char *attr_bgcolor = NULL;
2699 char *attr_font_size = NULL;
2701 chtml50 = GET_CHTML50(pdoc);
2705 for (attr = qs_get_attr(doc,node);
2707 attr = qs_get_next_attr(doc,attr)) {
2708 char *nm = qs_get_attr_name(doc,attr);
2709 char *val = qs_get_attr_value(doc,attr);
2710 if (STRCASEEQ('a','A', "align", nm)) {
2711 /*----------------------------------------------------------------------*/
2712 /* CHTML 1.0 (W3C version 3.2) */
2713 /*----------------------------------------------------------------------*/
2714 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2715 attr_align = apr_pstrdup(doc->buf.pool, val);
2718 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2719 attr_style = apr_pstrdup(doc->buf.pool, val);
2723 if (IS_CSS_ON(chtml50->entryp)) {
2724 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2726 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2727 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2728 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2729 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2730 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
2731 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2732 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2734 css_property_t *cur;
2735 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2736 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2737 attr_display = apr_pstrdup(doc->pool, cur->value);
2740 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2741 if (STRCASEEQ('b','B',"blink", cur->value)) {
2742 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2745 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2746 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2747 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2749 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2750 char *ss = strchr(cur->value, '#');
2752 ss = strstr(cur->value, "rgb");
2755 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2756 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2759 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2760 attr_color = apr_pstrdup(doc->pool, cur->value);
2761 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2763 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2764 attr_align = apr_pstrdup(doc->pool, cur->value);
2766 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
2767 attr_font_size = apr_pstrdup(doc->pool, cur->value);
2768 if (STRCASEEQ('x','X',"xx-small",attr_font_size)) {
2769 attr_font_size = apr_pstrdup(doc->pool, "1");
2771 else if (STRCASEEQ('x','X',"x-small",attr_font_size)) {
2772 attr_font_size = apr_pstrdup(doc->pool, "2");
2774 else if (STRCASEEQ('s','S',"small",attr_font_size)) {
2775 attr_font_size = apr_pstrdup(doc->pool, "3");
2777 else if (STRCASEEQ('m','M',"medium",attr_font_size)) {
2778 attr_font_size = apr_pstrdup(doc->pool, "4");
2780 else if (STRCASEEQ('l','L',"large",attr_font_size)) {
2781 attr_font_size = apr_pstrdup(doc->pool, "5");
2783 else if (STRCASEEQ('x','X',"x-large",attr_font_size)) {
2784 attr_font_size = apr_pstrdup(doc->pool, "6");
2786 else if (STRCASEEQ('x','X',"xx-large",attr_font_size)) {
2787 attr_font_size = apr_pstrdup(doc->pool, "7");
2791 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2792 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2793 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2794 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2795 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2796 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2799 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2800 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2801 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2803 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2804 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2807 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2808 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2809 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2812 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2818 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
2819 memset(flg, 0, sizeof(*flg));
2826 flg->with_div_flag = 1;
2830 flg->with_div_flag = 1;
2832 if (attr_color || attr_font_size) {
2833 if (! attr_display && attr_color && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff", attr_color))) {
2842 if (attr_font_size) {
2844 W_V(attr_font_size);
2848 flg->with_font_flag = 1;
2851 if (attr_decoration) {
2853 flg->with_blink_flag = 1;
2857 if (attr_wap_marquee_style) {
2858 W_L(" behavior=\"");
2859 W_V(attr_wap_marquee_style);
2862 if (attr_wap_marquee_dir) {
2863 W_L(" direction=\"");
2864 W_V(attr_wap_marquee_dir);
2867 if (attr_wap_marquee_loop) {
2869 W_V(attr_wap_marquee_loop);
2878 flg->with_marquee_flag = 1;
2880 node->userData = flg;
2882 return chtml50->out;
2887 * It is a handler who processes the DIV tag.
2889 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2890 * destination is specified.
2891 * @param node [i] The DIV tag node is specified.
2892 * @return The conversion result is returned.
2895 s_chtml50_end_div_tag(void *pdoc, Node *node)
2897 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2898 Doc *doc = chtml50->doc;
2900 chtml50_flags_t *flg = node->userData;
2901 if (flg && flg->with_marquee_flag) {
2904 if (flg && flg->with_blink_flag) {
2907 if (flg && flg->with_font_flag) {
2910 if (flg && flg->with_div_flag) {
2913 if (IS_CSS_ON(chtml50->entryp)) {
2914 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2916 node->userData = NULL;
2918 return chtml50->out;
2923 * It is a handler who processes the UL tag.
2925 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2926 * destination is specified.
2927 * @param node [i] The UL tag node is specified.
2928 * @return The conversion result is returned.
2931 s_chtml50_start_ul_tag(void *pdoc, Node *node)
2933 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2934 Doc *doc = chtml50->doc;
2936 char *attr_type = NULL;
2937 char *attr_style = NULL;
2938 /*--------------------------------------------------------------------------*/
2939 /* Get Attributes */
2940 /*--------------------------------------------------------------------------*/
2941 for (attr = qs_get_attr(doc,node);
2943 attr = qs_get_next_attr(doc,attr)) {
2944 char *name = qs_get_attr_name(doc,attr);
2945 char *value = qs_get_attr_value(doc,attr);
2946 if (STRCASEEQ('t','T',"type",name)) {
2947 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2951 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2955 if (IS_CSS_ON(chtml50->entryp)) {
2956 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2958 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2959 css_property_t *cur;
2960 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2961 if (STRCASEEQ('d','D',"disc",cur->value)) {
2962 attr_type = apr_pstrdup(doc->pool, "disc");
2964 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2965 attr_type = apr_pstrdup(doc->pool, "circle");
2967 else if (STRCASEEQ('s','S',"square",cur->value)) {
2968 attr_type = apr_pstrdup(doc->pool, "square");
2980 return chtml50->out;
2985 * It is a handler who processes the UL tag.
2987 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2988 * destination is specified.
2989 * @param node [i] The UL tag node is specified.
2990 * @return The conversion result is returned.
2993 s_chtml50_end_ul_tag(void *pdoc, Node *UNUSED(child))
2995 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2996 Doc *doc = chtml50->doc;
2999 if (IS_CSS_ON(chtml50->entryp)) {
3000 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3002 return chtml50->out;
3007 * It is a handler who processes the PRE tag.
3009 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3010 * destination is specified.
3011 * @param node [i] The PRE tag node is specified.
3012 * @return The conversion result is returned.
3015 s_chtml50_start_pre_tag(void *pdoc, Node *node)
3017 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3018 Doc *doc = chtml50->doc;
3020 char *attr_style = NULL;
3022 for (attr = qs_get_attr(doc,node);
3024 attr = qs_get_next_attr(doc,attr)) {
3025 char *nm = qs_get_attr_name(doc,attr);
3026 char *val = qs_get_attr_value(doc,attr);
3027 if (val && STRCASEEQ('s','S',"style", nm)) {
3032 if (IS_CSS_ON(chtml50->entryp)) {
3033 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3036 chtml50->pre_flag++;
3039 return chtml50->out;
3044 * It is a handler who processes the PRE tag.
3046 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3047 * destination is specified.
3048 * @param node [i] The PRE tag node is specified.
3049 * @return The conversion result is returned.
3052 s_chtml50_end_pre_tag(void *pdoc, Node *UNUSED(child))
3054 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3055 Doc *doc = chtml50->doc;
3058 chtml50->pre_flag--;
3059 if (IS_CSS_ON(chtml50->entryp)) {
3060 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3063 return chtml50->out;
3068 * It is a handler who processes the P tag.
3070 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3071 * destination is specified.
3072 * @param node [i] The P tag node is specified.
3073 * @return The conversion result is returned.
3076 s_chtml50_start_p_tag(void *pdoc, Node *node)
3082 char *attr_align = NULL;
3083 char *attr_style = NULL;
3084 char *attr_color = NULL;
3085 char *attr_blink = NULL;
3088 chtml50 = GET_CHTML50(pdoc);
3092 for (attr = qs_get_attr(doc,node);
3094 attr = qs_get_next_attr(doc,attr)) {
3095 char *nm = qs_get_attr_name(doc,attr);
3096 char *val = qs_get_attr_value(doc,attr);
3097 if (STRCASEEQ('a','A',"align", nm)) {
3098 /*----------------------------------------------------------------------*/
3099 /* CHTML 1.0 (W3C version 3.2) */
3100 /*----------------------------------------------------------------------*/
3101 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3102 attr_align = apr_pstrdup(doc->buf.pool, val);
3106 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3107 attr_style = apr_pstrdup(doc->buf.pool, val);
3110 if (IS_CSS_ON(chtml50->entryp)) {
3111 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3113 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3114 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3115 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3116 css_property_t *cur;
3117 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3118 if (STRCASEEQ('l','L',"left",cur->value)) {
3119 attr_align = apr_pstrdup(doc->pool, "left");
3121 else if (STRCASEEQ('c','C',"center",cur->value)) {
3122 attr_align = apr_pstrdup(doc->pool, "center");
3124 else if (STRCASEEQ('r','R',"right",cur->value)) {
3125 attr_align = apr_pstrdup(doc->pool, "right");
3128 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3129 if (cur->value && *cur->value) {
3130 attr_color = apr_pstrdup(doc->pool, cur->value);
3133 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3134 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3135 attr_blink = apr_pstrdup(doc->pool, cur->value);
3148 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
3149 memset(flg, 0, sizeof(*flg));
3151 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3152 W_L("<font color=\"");
3155 flg->with_font_flag = 1;
3159 flg->with_blink_flag = 1;
3161 node->userData = (void *)flg;
3162 return chtml50->out;
3167 * It is a handler who processes the P tag.
3169 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3170 * destination is specified.
3171 * @param node [i] The P tag node is specified.
3172 * @return The conversion result is returned.
3175 s_chtml50_end_p_tag(void *pdoc, Node *node)
3180 chtml50 = GET_CHTML50(pdoc);
3183 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
3184 if (flg->with_font_flag) {
3187 if (flg->with_blink_flag) {
3191 if (IS_CSS_ON(chtml50->entryp)) {
3192 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3195 return chtml50->out;
3200 * It is a handler who processes the OL tag.
3202 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3203 * destination is specified.
3204 * @param node [i] The OL tag node is specified.
3205 * @return The conversion result is returned.
3208 s_chtml50_start_ol_tag(void *pdoc, Node *node)
3214 char *attr_style = NULL;
3215 char *attr_start = NULL;
3216 char *attr_type = NULL;
3218 chtml50 = GET_CHTML50(pdoc);
3222 /*--------------------------------------------------------------------------*/
3223 /* Get Attributes */
3224 /*--------------------------------------------------------------------------*/
3225 for (attr = qs_get_attr(doc,node);
3227 attr = qs_get_next_attr(doc,attr)) {
3228 char *name = qs_get_attr_name(doc,attr);
3229 char *value = qs_get_attr_value(doc,attr);
3230 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3233 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3236 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3240 if (IS_CSS_ON(chtml50->entryp)) {
3241 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3243 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3244 css_property_t *cur;
3245 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3246 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3247 attr_type = apr_pstrdup(doc->pool, "1");
3249 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3250 attr_type = apr_pstrdup(doc->pool, "A");
3252 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3253 attr_type = apr_pstrdup(doc->pool, "a");
3271 return chtml50->out;
3276 * It is a handler who processes the OL tag.
3278 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3279 * destination is specified.
3280 * @param node [i] The OL tag node is specified.
3281 * @return The conversion result is returned.
3284 s_chtml50_end_ol_tag(void *pdoc, Node *UNUSED(node))
3286 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3287 Doc *doc = chtml50->doc;
3290 if (IS_CSS_ON(chtml50->entryp)) {
3291 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3294 return chtml50->out;
3299 * It is a handler who processes the LI tag.
3301 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3302 * destination is specified.
3303 * @param node [i] The LI tag node is specified.
3304 * @return The conversion result is returned.
3307 s_chtml50_start_li_tag(void *pdoc, Node *node)
3309 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3310 Doc *doc = chtml50->doc;
3312 char *attr_type = NULL;
3313 char *attr_value = NULL;
3314 char *attr_style = NULL;
3316 for (attr = qs_get_attr(doc,node);
3318 attr = qs_get_next_attr(doc,attr)) {
3319 char *name = qs_get_attr_name(doc,attr);
3320 char *value = qs_get_attr_value(doc,attr);
3321 if (STRCASEEQ('t','T',"type",name)) {
3322 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3326 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3329 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3333 if (IS_CSS_ON(chtml50->entryp)) {
3334 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3336 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3337 css_property_t *cur;
3338 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3339 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3340 attr_type = apr_pstrdup(doc->pool, "1");
3342 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3343 attr_type = apr_pstrdup(doc->pool, "A");
3345 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3346 attr_type = apr_pstrdup(doc->pool, "a");
3348 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3349 attr_type = apr_pstrdup(doc->pool, "disc");
3351 else if (STRCASEEQ('s','S',"square", cur->value)) {
3352 attr_type = apr_pstrdup(doc->pool, "square");
3354 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3355 attr_type = apr_pstrdup(doc->pool, "circle");
3373 return chtml50->out;
3378 * It is a handler who processes the LI tag.
3380 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3381 * destination is specified.
3382 * @param node [i] The LI tag node is specified.
3383 * @return The conversion result is returned.
3386 s_chtml50_end_li_tag(void *pdoc, Node *UNUSED(child))
3388 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3390 if (IS_CSS_ON(chtml50->entryp)) {
3391 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3394 return chtml50->out;
3399 * It is a handler who processes the H1 tag.
3401 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3402 * destination is specified.
3403 * @param node [i] The H1 tag node is specified.
3404 * @return The conversion result is returned.
3407 s_chtml50_start_h1_tag(void *pdoc, Node *node)
3413 char *attr_style = NULL;
3414 char *attr_align = NULL;
3416 chtml50 = GET_CHTML50(pdoc);
3420 for (attr = qs_get_attr(doc,node);
3422 attr = qs_get_next_attr(doc,attr)) {
3423 char *name = qs_get_attr_name(doc,attr);
3424 char *value = qs_get_attr_value(doc,attr);
3425 if (STRCASEEQ('a','A',"align", name)) {
3426 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3430 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3434 if (IS_CSS_ON(chtml50->entryp)) {
3435 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3437 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3438 css_property_t *cur;
3439 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3440 if (STRCASEEQ('l','L',"left", cur->value)) {
3441 attr_align = apr_pstrdup(doc->pool, "left");
3443 else if (STRCASEEQ('c','C',"center",cur->value)) {
3444 attr_align = apr_pstrdup(doc->pool, "center");
3446 else if (STRCASEEQ('r','R',"right",cur->value)) {
3447 attr_align = apr_pstrdup(doc->pool, "right");
3460 return chtml50->out;
3465 * It is a handler who processes the H1 tag.
3467 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3468 * destination is specified.
3469 * @param node [i] The H1 tag node is specified.
3470 * @return The conversion result is returned.
3473 s_chtml50_end_h1_tag(void *pdoc, Node *UNUSED(child))
3478 chtml50 = GET_CHTML50(pdoc);
3482 if (IS_CSS_ON(chtml50->entryp)) {
3483 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3486 return chtml50->out;
3491 * It is a handler who processes the H2 tag.
3493 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3494 * destination is specified.
3495 * @param node [i] The H2 tag node is specified.
3496 * @return The conversion result is returned.
3499 s_chtml50_start_h2_tag(void *pdoc, Node *node)
3505 char *attr_style = NULL;
3506 char *attr_align = NULL;
3508 chtml50 = GET_CHTML50(pdoc);
3512 for (attr = qs_get_attr(doc,node);
3514 attr = qs_get_next_attr(doc,attr)) {
3515 char *name = qs_get_attr_name(doc,attr);
3516 char *value = qs_get_attr_value(doc,attr);
3517 if (STRCASEEQ('a','A',"align", name)) {
3518 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3522 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3526 if (IS_CSS_ON(chtml50->entryp)) {
3527 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3529 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3530 css_property_t *cur;
3531 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3532 if (STRCASEEQ('l','L',"left", cur->value)) {
3533 attr_align = apr_pstrdup(doc->pool, "left");
3535 else if (STRCASEEQ('c','C',"center",cur->value)) {
3536 attr_align = apr_pstrdup(doc->pool, "center");
3538 else if (STRCASEEQ('r','R',"right",cur->value)) {
3539 attr_align = apr_pstrdup(doc->pool, "right");
3552 return chtml50->out;
3557 * It is a handler who processes the H2 tag.
3559 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3560 * destination is specified.
3561 * @param node [i] The H2 tag node is specified.
3562 * @return The conversion result is returned.
3565 s_chtml50_end_h2_tag(void *pdoc, Node *UNUSED(child))
3567 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3568 Doc *doc = chtml50->doc;
3571 if (IS_CSS_ON(chtml50->entryp)) {
3572 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3575 return chtml50->out;
3580 * It is a handler who processes the H3 tag.
3582 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3583 * destination is specified.
3584 * @param node [i] The H3 tag node is specified.
3585 * @return The conversion result is returned.
3588 s_chtml50_start_h3_tag(void *pdoc, Node *node)
3594 char *attr_style = NULL;
3595 char *attr_align = NULL;
3597 chtml50 = GET_CHTML50(pdoc);
3601 for (attr = qs_get_attr(doc,node);
3603 attr = qs_get_next_attr(doc,attr)) {
3604 char *name = qs_get_attr_name(doc,attr);
3605 char *value = qs_get_attr_value(doc,attr);
3606 if (STRCASEEQ('a','A',"align", name)) {
3607 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3611 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3615 if (IS_CSS_ON(chtml50->entryp)) {
3616 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3618 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3619 css_property_t *cur;
3620 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3621 if (STRCASEEQ('l','L',"left", cur->value)) {
3622 attr_align = apr_pstrdup(doc->pool, "left");
3624 else if (STRCASEEQ('c','C',"center",cur->value)) {
3625 attr_align = apr_pstrdup(doc->pool, "center");
3627 else if (STRCASEEQ('r','R',"right",cur->value)) {
3628 attr_align = apr_pstrdup(doc->pool, "right");
3641 return chtml50->out;
3646 * It is a handler who processes the H3 tag.
3648 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3649 * destination is specified.
3650 * @param node [i] The H3 tag node is specified.
3651 * @return The conversion result is returned.
3654 s_chtml50_end_h3_tag(void *pdoc, Node *UNUSED(child))
3656 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3657 Doc *doc = chtml50->doc;
3660 if (IS_CSS_ON(chtml50->entryp)) {
3661 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3664 return chtml50->out;
3669 * It is a handler who processes the H4 tag.
3671 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3672 * destination is specified.
3673 * @param node [i] The H4 tag node is specified.
3674 * @return The conversion result is returned.
3677 s_chtml50_start_h4_tag(void *pdoc, Node *node)
3683 char *attr_style = NULL;
3684 char *attr_align = NULL;
3686 chtml50 = GET_CHTML50(pdoc);
3690 for (attr = qs_get_attr(doc,node);
3692 attr = qs_get_next_attr(doc,attr)) {
3693 char *name = qs_get_attr_name(doc,attr);
3694 char *value = qs_get_attr_value(doc,attr);
3695 if (STRCASEEQ('a','A',"align", name)) {
3696 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3700 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3704 if (IS_CSS_ON(chtml50->entryp)) {
3705 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3707 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3708 css_property_t *cur;
3709 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3710 if (STRCASEEQ('l','L',"left", cur->value)) {
3711 attr_align = apr_pstrdup(doc->pool, "left");
3713 else if (STRCASEEQ('c','C',"center",cur->value)) {
3714 attr_align = apr_pstrdup(doc->pool, "center");
3716 else if (STRCASEEQ('r','R',"right",cur->value)) {
3717 attr_align = apr_pstrdup(doc->pool, "right");
3730 return chtml50->out;
3735 * It is a handler who processes the H4 tag.
3737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3738 * destination is specified.
3739 * @param node [i] The H4 tag node is specified.
3740 * @return The conversion result is returned.
3743 s_chtml50_end_h4_tag(void *pdoc, Node *UNUSED(child))
3745 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3746 Doc *doc = chtml50->doc;
3749 if (IS_CSS_ON(chtml50->entryp)) {
3750 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3753 return chtml50->out;
3758 * It is a handler who processes the H5 tag.
3760 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3761 * destination is specified.
3762 * @param node [i] The H5 tag node is specified.
3763 * @return The conversion result is returned.
3766 s_chtml50_start_h5_tag(void *pdoc, Node *node)
3772 char *attr_style = NULL;
3773 char *attr_align = NULL;
3775 chtml50 = GET_CHTML50(pdoc);
3779 for (attr = qs_get_attr(doc,node);
3781 attr = qs_get_next_attr(doc,attr)) {
3782 char *name = qs_get_attr_name(doc,attr);
3783 char *value = qs_get_attr_value(doc,attr);
3784 if (STRCASEEQ('a','A',"align", name)) {
3785 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3789 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3793 if (IS_CSS_ON(chtml50->entryp)) {
3794 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3796 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3797 css_property_t *cur;
3798 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3799 if (STRCASEEQ('l','L',"left", cur->value)) {
3800 attr_align = apr_pstrdup(doc->pool, "left");
3802 else if (STRCASEEQ('c','C',"center",cur->value)) {
3803 attr_align = apr_pstrdup(doc->pool, "center");
3805 else if (STRCASEEQ('r','R',"right",cur->value)) {
3806 attr_align = apr_pstrdup(doc->pool, "right");
3819 return chtml50->out;
3824 * It is a handler who processes the H5 tag.
3826 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3827 * destination is specified.
3828 * @param node [i] The H5 tag node is specified.
3829 * @return The conversion result is returned.
3832 s_chtml50_end_h5_tag(void *pdoc, Node *UNUSED(child))
3834 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3835 Doc *doc = chtml50->doc;
3838 if (IS_CSS_ON(chtml50->entryp)) {
3839 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3842 return chtml50->out;
3847 * It is a handler who processes the H6 tag.
3849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3850 * destination is specified.
3851 * @param node [i] The H6 tag node is specified.
3852 * @return The conversion result is returned.
3855 s_chtml50_start_h6_tag(void *pdoc, Node *node)
3861 char *attr_style = NULL;
3862 char *attr_align = NULL;
3864 chtml50 = GET_CHTML50(pdoc);
3868 for (attr = qs_get_attr(doc,node);
3870 attr = qs_get_next_attr(doc,attr)) {
3871 char *name = qs_get_attr_name(doc,attr);
3872 char *value = qs_get_attr_value(doc,attr);
3873 if (STRCASEEQ('a','A',"align", name)) {
3874 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3878 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3882 if (IS_CSS_ON(chtml50->entryp)) {
3883 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3885 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3886 css_property_t *cur;
3887 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3888 if (STRCASEEQ('l','L',"left", cur->value)) {
3889 attr_align = apr_pstrdup(doc->pool, "left");
3891 else if (STRCASEEQ('c','C',"center",cur->value)) {
3892 attr_align = apr_pstrdup(doc->pool, "center");
3894 else if (STRCASEEQ('r','R',"right",cur->value)) {
3895 attr_align = apr_pstrdup(doc->pool, "right");
3908 return chtml50->out;
3913 * It is a handler who processes the H6 tag.
3915 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3916 * destination is specified.
3917 * @param node [i] The H6 tag node is specified.
3918 * @return The conversion result is returned.
3921 s_chtml50_end_h6_tag(void *pdoc, Node *UNUSED(child))
3923 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3924 Doc *doc = chtml50->doc;
3927 if (IS_CSS_ON(chtml50->entryp)) {
3928 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3931 return chtml50->out;
3936 * It is a handler who processes the TEXTARE tag.
3938 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3939 * destination is specified.
3940 * @param node [i] The TEXTAREA tag node is specified.
3941 * @return The conversion result is returned.
3944 s_chtml50_start_textarea_tag(void *pdoc, Node *node)
3950 char *attr_accesskey = NULL;
3951 char *attr_name = NULL;
3952 char *attr_rows = NULL;
3953 char *attr_cols = NULL;
3954 char *attr_istyle = NULL;
3955 char *attr_style = NULL;
3957 chtml50 = GET_CHTML50(pdoc);
3961 chtml50->textarea_flag++;
3963 for (attr = qs_get_attr(doc,node);
3965 attr = qs_get_next_attr(doc,attr)) {
3966 char *name = qs_get_attr_name(doc,attr);
3967 char *value = qs_get_attr_value(doc,attr);
3968 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3969 attr_accesskey = value;
3971 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3972 attr_istyle = value;
3974 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3977 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3980 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3983 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3987 if (IS_CSS_ON(chtml50->entryp)) {
3988 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
3990 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3991 css_property_t *cur;
3992 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3993 if (strcasestr(cur->value, "<ja:n>")) {
3996 else if (strcasestr(cur->value, "<ja:en>")) {
3999 else if (strcasestr(cur->value, "<ja:hk>")) {
4002 else if (strcasestr(cur->value, "<ja:h>")) {
4009 if (attr_accesskey) {
4010 W_L(" accesskey=\"");
4011 W_V(attr_accesskey);
4035 return chtml50->out;
4040 * It is a handler who processes the TEXTAREA tag.
4042 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4043 * destination is specified.
4044 * @param node [i] The TEXTAREA tag node is specified.
4045 * @return The conversion result is returned.
4048 s_chtml50_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4050 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4051 Doc *doc = chtml50->doc;
4054 chtml50->textarea_flag--;
4056 return chtml50->out;
4061 s_chtml50_chxjif_tag(void *pdoc, Node *node)
4068 chtml50 = GET_CHTML50(pdoc);
4072 for (child = qs_get_child_node(doc, node);
4074 child = qs_get_next_node(doc, child)) {
4076 s_chtml50_chxjif_tag(chtml50, child);
4084 s_chtml50_text_tag(void *pdoc, Node *child)
4096 apr_size_t z2h_input_len;
4098 chtml50 = GET_CHTML50(pdoc);
4102 textval = qs_get_node_value(doc,child);
4103 if (strlen(textval) == 0) {
4104 return chtml50->out;
4107 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4108 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4110 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4111 memset(one_byte, 0, sizeof(one_byte));
4114 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4116 int rtn = s_chtml50_search_emoji(chtml50, &textval[ii], &out, child);
4118 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4123 if (is_sjis_kanji(textval[ii])) {
4124 one_byte[0] = textval[ii+0];
4125 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4126 one_byte[0] = textval[ii+1];
4127 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4130 else if (chtml50->pre_flag) {
4131 one_byte[0] = textval[ii+0];
4132 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4134 else if (chtml50->textarea_flag) {
4135 one_byte[0] = textval[ii+0];
4136 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4138 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4139 one_byte[0] = textval[ii+0];
4140 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4143 z2h_input_len = strlen(tdst);
4144 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml50->entryp);
4146 return chtml50->out;
4151 * It is a handler who processes the BLOCKQUOTE tag.
4153 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4154 * destination is specified.
4155 * @param node [i] The BLOCKQUOTE tag node is specified.
4156 * @return The conversion result is returned.
4159 s_chtml50_start_blockquote_tag(void *pdoc, Node *node)
4164 char *attr_style = NULL;
4165 char *attr_color = NULL;
4166 char *attr_size = NULL;
4168 chtml50 = GET_CHTML50(pdoc);
4170 for (attr = qs_get_attr(doc,node);
4172 attr = qs_get_next_attr(doc,attr)) {
4173 char *nm = qs_get_attr_name(doc,attr);
4174 char *val = qs_get_attr_value(doc,attr);
4175 if (val && STRCASEEQ('s','S',"style", nm)) {
4179 if (IS_CSS_ON(chtml50->entryp)) {
4180 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4182 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4183 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4184 css_property_t *cur;
4185 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4186 if (cur->value && *cur->value) {
4187 attr_color = apr_pstrdup(doc->pool, cur->value);
4190 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4191 if (cur->value && *cur->value) {
4192 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4193 attr_size = apr_pstrdup(doc->pool, "1");
4195 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4196 attr_size = apr_pstrdup(doc->pool, "2");
4198 else if (STRCASEEQ('s','S',"small",cur->value)) {
4199 attr_size = apr_pstrdup(doc->pool, "3");
4201 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4202 attr_size = apr_pstrdup(doc->pool, "4");
4204 else if (STRCASEEQ('l','L',"large",cur->value)) {
4205 attr_size = apr_pstrdup(doc->pool, "5");
4207 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4208 attr_size = apr_pstrdup(doc->pool, "6");
4210 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4211 attr_size = apr_pstrdup(doc->pool, "7");
4217 W_L("<blockquote>");
4218 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4219 memset(flg, 0, sizeof(*flg));
4220 if (attr_color || attr_size) {
4223 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4234 flg->with_font_flag = 1;
4236 node->userData = (void *)flg;
4237 return chtml50->out;
4242 * It is a handler who processes the BLOCKQUOTE tag.
4244 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4245 * destination is specified.
4246 * @param node [i] The BLOCKQUOTE tag node is specified.
4247 * @return The conversion result is returned.
4250 s_chtml50_end_blockquote_tag(void *pdoc, Node *node)
4252 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4253 Doc *doc = chtml50->doc;
4254 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4255 if (flg && flg->with_font_flag) {
4258 W_L("</blockquote>");
4259 if (IS_CSS_ON(chtml50->entryp)) {
4260 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4262 return chtml50->out;
4267 * It is a handler who processes the DIR tag.
4269 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4270 * destination is specified.
4271 * @param node [i] The DIR tag node is specified.
4272 * @return The conversion result is returned.
4275 s_chtml50_start_dir_tag(void *pdoc, Node *node)
4277 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4278 Doc *doc = chtml50->doc;
4280 char *attr_style = NULL;
4281 char *attr_color = NULL;
4282 char *attr_type = NULL;
4283 char *attr_size = NULL;
4284 for (attr = qs_get_attr(doc,node);
4286 attr = qs_get_next_attr(doc,attr)) {
4287 char *name = qs_get_attr_name(doc,attr);
4288 char *value = qs_get_attr_value(doc,attr);
4289 if (STRCASEEQ('t','T',"type",name)) {
4290 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4294 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4298 if (IS_CSS_ON(chtml50->entryp)) {
4299 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4301 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4302 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4303 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4304 css_property_t *cur;
4305 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4306 if (cur->value && *cur->value) {
4307 attr_color = apr_pstrdup(doc->pool, cur->value);
4310 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4311 if (cur->value && *cur->value) {
4312 attr_type = apr_pstrdup(doc->pool, cur->value);
4315 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4316 if (cur->value && *cur->value) {
4317 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4318 attr_size = apr_pstrdup(doc->pool, "1");
4320 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4321 attr_size = apr_pstrdup(doc->pool, "2");
4323 else if (STRCASEEQ('s','S',"small",cur->value)) {
4324 attr_size = apr_pstrdup(doc->pool, "3");
4326 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4327 attr_size = apr_pstrdup(doc->pool, "4");
4329 else if (STRCASEEQ('l','L',"large",cur->value)) {
4330 attr_size = apr_pstrdup(doc->pool, "5");
4332 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4333 attr_size = apr_pstrdup(doc->pool, "6");
4335 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4336 attr_size = apr_pstrdup(doc->pool, "7");
4349 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4350 memset(flg, 0, sizeof(*flg));
4351 if (attr_color || attr_size) {
4354 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4365 flg->with_font_flag = 1;
4367 node->userData = (void *)flg;
4368 return chtml50->out;
4373 * It is a handler who processes the DIR tag.
4375 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4376 * destination is specified.
4377 * @param node [i] The DIR tag node is specified.
4378 * @return The conversion result is returned.
4381 s_chtml50_end_dir_tag(void *pdoc, Node *node)
4383 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4384 Doc *doc = chtml50->doc;
4385 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4386 if (flg && flg->with_font_flag) {
4390 if (IS_CSS_ON(chtml50->entryp)) {
4391 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4393 return chtml50->out;
4398 * It is a handler who processes the DL tag.
4400 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4401 * destination is specified.
4402 * @param node [i] The DL tag node is specified.
4403 * @return The conversion result is returned.
4406 s_chtml50_start_dl_tag(void *pdoc, Node *node)
4408 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4409 Doc *doc = chtml50->doc;
4411 char *attr_style = NULL;
4412 char *attr_color = NULL;
4413 char *attr_size = NULL;
4414 for (attr = qs_get_attr(doc,node);
4416 attr = qs_get_next_attr(doc,attr)) {
4417 char *name = qs_get_attr_name(doc,attr);
4418 char *value = qs_get_attr_value(doc,attr);
4419 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4423 if (IS_CSS_ON(chtml50->entryp)) {
4424 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4426 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4427 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4428 css_property_t *cur;
4429 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4430 if (cur->value && *cur->value) {
4431 attr_color = apr_pstrdup(doc->pool, cur->value);
4434 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4435 if (cur->value && *cur->value) {
4436 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4437 attr_size = apr_pstrdup(doc->pool, "1");
4439 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4440 attr_size = apr_pstrdup(doc->pool, "2");
4442 else if (STRCASEEQ('s','S',"small",cur->value)) {
4443 attr_size = apr_pstrdup(doc->pool, "3");
4445 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4446 attr_size = apr_pstrdup(doc->pool, "4");
4448 else if (STRCASEEQ('l','L',"large",cur->value)) {
4449 attr_size = apr_pstrdup(doc->pool, "5");
4451 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4452 attr_size = apr_pstrdup(doc->pool, "6");
4454 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4455 attr_size = apr_pstrdup(doc->pool, "7");
4462 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4463 memset(flg, 0, sizeof(*flg));
4464 if (attr_color || attr_size) {
4467 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4478 flg->with_font_flag = 1;
4480 node->userData = (void *)flg;
4481 return chtml50->out;
4486 * It is a handler who processes the DL tag.
4488 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4489 * destination is specified.
4490 * @param node [i] The DL tag node is specified.
4491 * @return The conversion result is returned.
4494 s_chtml50_end_dl_tag(void *pdoc, Node *node)
4496 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4497 Doc *doc = chtml50->doc;
4498 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4499 if (flg && flg->with_font_flag) {
4503 if (IS_CSS_ON(chtml50->entryp)) {
4504 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4506 return chtml50->out;
4511 * It is a handler who processes the DT tag.
4513 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4514 * destination is specified.
4515 * @param node [i] The DT tag node is specified.
4516 * @return The conversion result is returned.
4519 s_chtml50_start_dt_tag(void *pdoc, Node *node)
4521 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4522 Doc *doc = chtml50->doc;
4524 char *attr_style = NULL;
4525 char *attr_color = NULL;
4526 char *attr_size = NULL;
4527 for (attr = qs_get_attr(doc,node);
4529 attr = qs_get_next_attr(doc,attr)) {
4530 char *name = qs_get_attr_name(doc,attr);
4531 char *value = qs_get_attr_value(doc,attr);
4532 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4536 if (IS_CSS_ON(chtml50->entryp)) {
4537 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4539 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4540 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4541 css_property_t *cur;
4542 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4543 if (cur->value && *cur->value) {
4544 attr_color = apr_pstrdup(doc->pool, cur->value);
4547 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4548 if (cur->value && *cur->value) {
4549 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4550 attr_size = apr_pstrdup(doc->pool, "1");
4552 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4553 attr_size = apr_pstrdup(doc->pool, "2");
4555 else if (STRCASEEQ('s','S',"small",cur->value)) {
4556 attr_size = apr_pstrdup(doc->pool, "3");
4558 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4559 attr_size = apr_pstrdup(doc->pool, "4");
4561 else if (STRCASEEQ('l','L',"large",cur->value)) {
4562 attr_size = apr_pstrdup(doc->pool, "5");
4564 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4565 attr_size = apr_pstrdup(doc->pool, "6");
4567 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4568 attr_size = apr_pstrdup(doc->pool, "7");
4575 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4576 memset(flg, 0, sizeof(*flg));
4577 if (attr_color || attr_size) {
4580 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4591 flg->with_font_flag = 1;
4593 node->userData = (void *)flg;
4594 return chtml50->out;
4599 * It is a handler who processes the DT tag.
4601 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4602 * destination is specified.
4603 * @param node [i] The DT tag node is specified.
4604 * @return The conversion result is returned.
4607 s_chtml50_end_dt_tag(void *pdoc, Node *node)
4609 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4610 Doc *doc = chtml50->doc;
4612 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4613 if (flg && flg->with_font_flag) {
4616 if (IS_CSS_ON(chtml50->entryp)) {
4617 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4620 return chtml50->out;
4625 * It is a handler who processes the DD tag.
4627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4628 * destination is specified.
4629 * @param node [i] The DD tag node is specified.
4630 * @return The conversion result is returned.
4633 s_chtml50_start_dd_tag(void *pdoc, Node *node)
4635 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4636 Doc *doc = chtml50->doc;
4638 char *attr_style = NULL;
4639 char *attr_color = NULL;
4640 char *attr_size = NULL;
4641 for (attr = qs_get_attr(doc,node);
4643 attr = qs_get_next_attr(doc,attr)) {
4644 char *name = qs_get_attr_name(doc,attr);
4645 char *value = qs_get_attr_value(doc,attr);
4646 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4650 if (IS_CSS_ON(chtml50->entryp)) {
4651 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4653 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4654 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4655 css_property_t *cur;
4656 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4657 if (cur->value && *cur->value) {
4658 attr_color = apr_pstrdup(doc->pool, cur->value);
4661 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4662 if (cur->value && *cur->value) {
4663 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4664 attr_size = apr_pstrdup(doc->pool, "1");
4666 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4667 attr_size = apr_pstrdup(doc->pool, "2");
4669 else if (STRCASEEQ('s','S',"small",cur->value)) {
4670 attr_size = apr_pstrdup(doc->pool, "3");
4672 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4673 attr_size = apr_pstrdup(doc->pool, "4");
4675 else if (STRCASEEQ('l','L',"large",cur->value)) {
4676 attr_size = apr_pstrdup(doc->pool, "5");
4678 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4679 attr_size = apr_pstrdup(doc->pool, "6");
4681 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4682 attr_size = apr_pstrdup(doc->pool, "7");
4689 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4690 memset(flg, 0, sizeof(*flg));
4691 if (attr_color || attr_size) {
4694 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4705 flg->with_font_flag = 1;
4707 node->userData = (void *)flg;
4708 return chtml50->out;
4713 * It is a handler who processes the DD tag.
4715 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4716 * destination is specified.
4717 * @param node [i] The DD tag node is specified.
4718 * @return The conversion result is returned.
4721 s_chtml50_end_dd_tag(void *pdoc, Node *node)
4723 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4724 Doc *doc = chtml50->doc;
4726 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4727 if (flg && flg->with_font_flag) {
4730 if (IS_CSS_ON(chtml50->entryp)) {
4731 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4733 return chtml50->out;
4738 * It is a handler who processes the MARQUEE tag.
4740 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4741 * destination is specified.
4742 * @param node [i] The MARQUEE tag node is specified.
4743 * @return The conversion result is returned.
4746 s_chtml50_start_marquee_tag(void *pdoc, Node *node)
4748 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4749 Doc *doc = chtml50->doc;
4751 char *attr_direction = NULL;
4752 char *attr_behavior = NULL;
4753 char *attr_loop = NULL;
4754 char *attr_style = NULL;
4755 char *attr_color = NULL;
4756 char *attr_size = NULL;
4757 char *attr_bgcolor = NULL;
4758 /*--------------------------------------------------------------------------*/
4759 /* Get Attributes */
4760 /*--------------------------------------------------------------------------*/
4761 for (attr = qs_get_attr(doc,node);
4763 attr = qs_get_next_attr(doc,attr)) {
4764 char *name = qs_get_attr_name(doc,attr);
4765 char *value = qs_get_attr_value(doc,attr);
4766 if (STRCASEEQ('d','D',"direction", name)) {
4767 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4768 attr_direction = value;
4771 else if (STRCASEEQ('b','B',"behavior",name)) {
4772 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4773 attr_behavior = value;
4776 else if (STRCASEEQ('l','L',"loop",name)) {
4777 if (value && *value) {
4781 else if (STRCASEEQ('b','B',"bgcolor",name)) {
4782 if (value && *value) {
4783 attr_bgcolor = value;
4786 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4790 if (IS_CSS_ON(chtml50->entryp)) {
4791 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4793 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4794 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4795 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
4796 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4797 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4798 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4799 css_property_t *cur;
4800 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4801 if (cur->value && *cur->value) {
4802 attr_color = apr_pstrdup(doc->pool, cur->value);
4805 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
4806 if (cur->value && *cur->value) {
4807 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4810 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4811 if (cur->value && *cur->value) {
4812 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4815 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4816 if (cur->value && *cur->value) {
4817 attr_loop = apr_pstrdup(doc->pool, cur->value);
4818 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4823 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4824 if (cur->value && *cur->value) {
4825 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4826 attr_direction = "right";
4828 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4829 attr_direction = "left";
4833 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4834 if (cur->value && *cur->value) {
4835 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4836 attr_size = apr_pstrdup(doc->pool, "1");
4838 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4839 attr_size = apr_pstrdup(doc->pool, "2");
4841 else if (STRCASEEQ('s','S',"small",cur->value)) {
4842 attr_size = apr_pstrdup(doc->pool, "3");
4844 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4845 attr_size = apr_pstrdup(doc->pool, "4");
4847 else if (STRCASEEQ('l','L',"large",cur->value)) {
4848 attr_size = apr_pstrdup(doc->pool, "5");
4850 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4851 attr_size = apr_pstrdup(doc->pool, "6");
4853 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4854 attr_size = apr_pstrdup(doc->pool, "7");
4861 if (attr_direction) {
4862 W_L(" direction=\"");
4863 W_V(attr_direction);
4866 if (attr_behavior) {
4867 W_L(" behavior=\"");
4877 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4884 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4885 memset(flg, 0, sizeof(*flg));
4886 if (attr_color || attr_size) {
4889 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4900 flg->with_font_flag = 1;
4902 node->userData = (void *)flg;
4903 return chtml50->out;
4908 * It is a handler who processes the MARQUEE tag.
4910 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4911 * destination is specified.
4912 * @param node [i] The MARQUEE tag node is specified.
4913 * @return The conversion result is returned.
4916 s_chtml50_end_marquee_tag(void *pdoc, Node *node)
4918 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4919 Doc *doc = chtml50->doc;
4921 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4922 if (flg && flg->with_font_flag) {
4926 if (IS_CSS_ON(chtml50->entryp)) {
4927 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4929 return chtml50->out;
4934 * It is a handler who processes the BLINK tag.
4936 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4937 * destination is specified.
4938 * @param node [i] The BLINK tag node is specified.
4939 * @return The conversion result is returned.
4942 s_chtml50_start_blink_tag(void *pdoc, Node *node)
4944 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4945 Doc *doc = chtml50->doc;
4947 char *attr_style = NULL;
4948 char *attr_color = NULL;
4949 char *attr_size = NULL;
4950 for (attr = qs_get_attr(doc,node);
4952 attr = qs_get_next_attr(doc,attr)) {
4953 char *name = qs_get_attr_name(doc,attr);
4954 char *value = qs_get_attr_value(doc,attr);
4955 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4959 if (IS_CSS_ON(chtml50->entryp)) {
4960 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4962 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4963 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4964 css_property_t *cur;
4965 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4966 if (cur->value && *cur->value) {
4967 attr_color = apr_pstrdup(doc->pool, cur->value);
4970 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4971 if (cur->value && *cur->value) {
4972 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4973 attr_size = apr_pstrdup(doc->pool, "1");
4975 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4976 attr_size = apr_pstrdup(doc->pool, "2");
4978 else if (STRCASEEQ('s','S',"small",cur->value)) {
4979 attr_size = apr_pstrdup(doc->pool, "3");
4981 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4982 attr_size = apr_pstrdup(doc->pool, "4");
4984 else if (STRCASEEQ('l','L',"large",cur->value)) {
4985 attr_size = apr_pstrdup(doc->pool, "5");
4987 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4988 attr_size = apr_pstrdup(doc->pool, "6");
4990 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4991 attr_size = apr_pstrdup(doc->pool, "7");
4998 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4999 memset(flg, 0, sizeof(*flg));
5000 if (attr_color || attr_size) {
5003 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5014 flg->with_font_flag = 1;
5016 node->userData = (void *)flg;
5017 return chtml50->out;
5022 * It is a handler who processes the BLINK tag.
5024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5025 * destination is specified.
5026 * @param node [i] The BLINK tag node is specified.
5027 * @return The conversion result is returned.
5030 s_chtml50_end_blink_tag(void *pdoc, Node *node)
5032 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5033 Doc *doc = chtml50->doc;
5035 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5036 if (flg && flg->with_font_flag) {
5040 if (IS_CSS_ON(chtml50->entryp)) {
5041 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5043 return chtml50->out;
5048 * It is a handler who processes the MENU tag.
5050 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5051 * destination is specified.
5052 * @param node [i] The MENU tag node is specified.
5053 * @return The conversion result is returned.
5056 s_chtml50_start_menu_tag(void *pdoc, Node *node)
5058 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5059 Doc *doc = chtml50->doc;
5061 char *attr_style = NULL;
5062 char *attr_color = NULL;
5063 char *attr_type = NULL;
5064 char *attr_size = NULL;
5065 for (attr = qs_get_attr(doc,node);
5067 attr = qs_get_next_attr(doc,attr)) {
5068 char *name = qs_get_attr_name(doc,attr);
5069 char *value = qs_get_attr_value(doc,attr);
5070 if (STRCASEEQ('t','T',"type",name)) {
5071 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5075 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5079 if (IS_CSS_ON(chtml50->entryp)) {
5080 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
5082 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5083 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5084 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5085 css_property_t *cur;
5086 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5087 if (cur->value && *cur->value) {
5088 attr_color = apr_pstrdup(doc->pool, cur->value);
5091 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5092 if (cur->value && *cur->value) {
5093 attr_type = apr_pstrdup(doc->pool, cur->value);
5096 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5097 if (cur->value && *cur->value) {
5098 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5099 attr_size = apr_pstrdup(doc->pool, "1");
5101 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5102 attr_size = apr_pstrdup(doc->pool, "2");
5104 else if (STRCASEEQ('s','S',"small",cur->value)) {
5105 attr_size = apr_pstrdup(doc->pool, "3");
5107 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5108 attr_size = apr_pstrdup(doc->pool, "4");
5110 else if (STRCASEEQ('l','L',"large",cur->value)) {
5111 attr_size = apr_pstrdup(doc->pool, "5");
5113 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5114 attr_size = apr_pstrdup(doc->pool, "6");
5116 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5117 attr_size = apr_pstrdup(doc->pool, "7");
5130 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
5131 memset(flg, 0, sizeof(*flg));
5132 if (attr_color || attr_size) {
5135 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5146 flg->with_font_flag = 1;
5148 node->userData = (void *)flg;
5149 return chtml50->out;
5154 * It is a handler who processes the MENU tag.
5156 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5157 * destination is specified.
5158 * @param node [i] The MENU tag node is specified.
5159 * @return The conversion result is returned.
5162 s_chtml50_end_menu_tag(void *pdoc, Node *node)
5164 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5165 Doc *doc = chtml50->doc;
5166 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5167 if (flg && flg->with_font_flag) {
5171 if (IS_CSS_ON(chtml50->entryp)) {
5172 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5174 return chtml50->out;
5179 * It is a handler who processes the PLAINTEXT tag.
5181 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5182 * destination is specified.
5183 * @param node [i] The PLAINTEXT tag node is specified.
5184 * @return The conversion result is returned.
5187 s_chtml50_start_plaintext_tag(void *pdoc, Node *node)
5189 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5190 Doc *doc = chtml50->doc;
5192 s_chtml50_start_plaintext_tag_inner(pdoc,node);
5193 return chtml50->out;
5197 s_chtml50_start_plaintext_tag_inner(void *pdoc, Node *node)
5199 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5200 Doc *doc = chtml50->doc;
5202 for (child = qs_get_child_node(doc, node);
5204 child = qs_get_next_node(doc, child)) {
5206 s_chtml50_start_plaintext_tag_inner(pdoc, child);
5208 return chtml50->out;
5213 * It is a handler who processes the PLAINTEXT tag.
5215 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5216 * destination is specified.
5217 * @param node [i] The PLAINTEXT tag node is specified.
5218 * @return The conversion result is returned.
5221 s_chtml50_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5223 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5224 return chtml50->out;
5229 * It is handler who processes the New Line Code.
5232 s_chtml50_newline_mark(void *pdoc, Node *UNUSED(node))
5234 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5235 Doc *doc = chtml50->doc;
5237 return chtml50->out;
5242 * It is a handler who processes the LINK tag.
5244 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5245 * destination is specified.
5246 * @param node [i] The LINK tag node is specified.
5247 * @return The conversion result is returned.
5250 s_chtml50_link_tag(void *pdoc, Node *node)
5259 chtml50 = GET_CHTML50(pdoc);
5262 if (! IS_CSS_ON(chtml50->entryp)) {
5263 return chtml50->out;
5266 for (attr = qs_get_attr(doc,node);
5268 attr = qs_get_next_attr(doc,attr)) {
5269 char *name = qs_get_attr_name(doc,attr);
5270 char *value = qs_get_attr_value(doc,attr);
5271 if (STRCASEEQ('r','R',"rel", name)) {
5272 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5276 else if (STRCASEEQ('h','H',"href", name)) {
5277 if (value && *value) {
5281 else if (STRCASEEQ('t','T',"type", name)) {
5282 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5288 if (rel && href && type) {
5289 DBG(doc->r, "start load CSS. url:[%s]", href);
5290 chtml50->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml50->style, href);
5291 DBG(doc->r, "end load CSS. url:[%s]", href);
5294 return chtml50->out;
5298 static css_prop_list_t *
5299 s_chtml50_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5301 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5302 Doc *doc = chtml50->doc;
5303 css_prop_list_t *last_css = NULL;
5304 if (IS_CSS_ON(chtml50->entryp)) {
5305 css_prop_list_t *dup_css;
5306 css_selector_t *selector;
5308 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5309 dup_css = chxj_dup_css_prop_list(doc, last_css);
5310 selector = chxj_css_find_selector(doc, chtml50->style, node);
5312 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5314 chxj_css_push_prop_list(chtml50->css_prop_stack, dup_css);
5315 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5317 if (style_attr_value) {
5318 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));
5320 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5328 static css_prop_list_t *
5329 s_chtml50_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5331 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5332 Doc *doc = chtml50->doc;
5333 css_prop_list_t *last_css = NULL;
5334 if (IS_CSS_ON(chtml50->entryp)) {
5335 css_prop_list_t *dup_css;
5336 css_selector_t *selector;
5338 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5339 dup_css = chxj_dup_css_prop_list(doc, last_css);
5340 selector = chxj_css_find_selector(doc, chtml50->style, node);
5342 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5346 if (style_attr_value) {
5347 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));
5349 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5359 * It is a handler who processes the SPAN tag.
5361 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5362 * destination is specified.
5363 * @param node [i] The SPAN tag node is specified.
5364 * @return The conversion result is returned.
5367 s_chtml50_start_span_tag(void *pdoc, Node *node)
5372 char *attr_style = NULL;
5373 char *attr_color = NULL;
5374 char *attr_size = NULL;
5375 char *attr_align = NULL;
5376 char *attr_blink = NULL;
5377 char *attr_marquee = NULL;
5378 char *attr_marquee_dir = NULL;
5379 char *attr_marquee_style = NULL;
5380 char *attr_marquee_loop = NULL;
5382 chtml50 = GET_CHTML50(pdoc);
5385 for (attr = qs_get_attr(doc,node);
5387 attr = qs_get_next_attr(doc,attr)) {
5388 char *nm = qs_get_attr_name(doc,attr);
5389 char *val = qs_get_attr_value(doc,attr);
5390 if (val && STRCASEEQ('s','S',"style", nm)) {
5394 if (IS_CSS_ON(chtml50->entryp)) {
5395 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
5397 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5398 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5399 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5400 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5401 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5402 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5403 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5404 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5405 css_property_t *cur;
5406 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5407 attr_color = apr_pstrdup(doc->pool, cur->value);
5409 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5410 if (cur->value && *cur->value) {
5411 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5412 attr_size = apr_pstrdup(doc->pool, "1");
5414 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5415 attr_size = apr_pstrdup(doc->pool, "2");
5417 else if (STRCASEEQ('s','S',"small",cur->value)) {
5418 attr_size = apr_pstrdup(doc->pool, "3");
5420 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5421 attr_size = apr_pstrdup(doc->pool, "4");
5423 else if (STRCASEEQ('l','L',"large",cur->value)) {
5424 attr_size = apr_pstrdup(doc->pool, "5");
5426 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5427 attr_size = apr_pstrdup(doc->pool, "6");
5429 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5430 attr_size = apr_pstrdup(doc->pool, "7");
5434 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5435 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5436 attr_blink = apr_pstrdup(doc->pool, cur->value);
5439 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5440 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5441 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5444 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5445 if (cur->value && *cur->value) {
5446 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5447 attr_marquee_dir = "right";
5449 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5450 attr_marquee_dir = "left";
5454 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5455 if (cur->value && *cur->value) {
5456 if ( STRCASEEQ('s','S',"scroll",cur->value)
5457 || STRCASEEQ('s','S',"slide",cur->value)
5458 || STRCASEEQ('a','A',"alternate",cur->value)) {
5459 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5463 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5464 if (cur->value && *cur->value) {
5465 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5466 attr_marquee_loop = "16";
5469 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5473 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5474 if (STRCASEEQ('l','L',"left", cur->value)) {
5475 attr_align = apr_pstrdup(doc->pool, "left");
5477 else if (STRCASEEQ('c','C',"center",cur->value)) {
5478 attr_align = apr_pstrdup(doc->pool, "center");
5480 else if (STRCASEEQ('r','R',"right",cur->value)) {
5481 attr_align = apr_pstrdup(doc->pool, "right");
5486 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5487 chtml50_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5488 memset(flg, 0, sizeof(*flg));
5491 flg->with_blink_flag = 1;
5495 if (attr_marquee_dir) {
5496 W_L(" direction=\"");
5497 W_V(attr_marquee_dir);
5500 if (attr_marquee_style) {
5501 W_L(" behavior=\"");
5502 W_V(attr_marquee_style);
5505 if (attr_marquee_loop) {
5507 W_V(attr_marquee_loop);
5511 flg->with_marquee_flag = 1;
5513 if (attr_color||attr_size) {
5516 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5527 flg->with_font_flag = 1;
5530 W_L("<div align=\"");
5533 flg->with_div_flag = 1;
5535 node->userData = flg;
5538 node->userData = NULL;
5540 return chtml50->out;
5545 * It is a handler who processes the SPAN tag.
5547 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5548 * destination is specified.
5549 * @param node [i] The SPAN tag node is specified.
5550 * @return The conversion result is returned.
5553 s_chtml50_end_span_tag(void *pdoc, Node *node)
5555 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5556 Doc *doc = chtml50->doc;
5558 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5559 if (flg && flg->with_div_flag) {
5562 if (flg && flg->with_font_flag) {
5565 if (flg && flg->with_marquee_flag) {
5568 if (flg && flg->with_blink_flag) {
5571 if (IS_CSS_ON(chtml50->entryp)) {
5572 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5574 return chtml50->out;
5579 * It is a handler who processes the STYLE tag.
5581 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5582 * destination is specified.
5583 * @param node [i] The STYLE tag node is specified.
5584 * @return The conversion result is returned.
5587 s_chtml50_style_tag(void *pdoc, Node *node)
5594 chtml50 = GET_CHTML50(pdoc);
5597 if (! IS_CSS_ON(chtml50->entryp)) {
5598 return chtml50->out;
5601 for (attr = qs_get_attr(doc,node);
5603 attr = qs_get_next_attr(doc,attr)) {
5604 char *name = qs_get_attr_name(doc,attr);
5605 char *value = qs_get_attr_value(doc,attr);
5606 if (STRCASEEQ('t','T',"type", name)) {
5607 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5613 Node *child = qs_get_child_node(doc, node);
5614 if (type && child) {
5615 char *name = qs_get_node_name(doc, child);
5616 if (STRCASEEQ('t','T',"text", name)) {
5617 char *value = qs_get_node_value(doc, child);
5618 DBG(doc->r, "start load CSS. buf:[%s]", value);
5619 chtml50->style = chxj_css_parse_style_value(doc, chtml50->style, value);
5620 DBG(doc->r, "end load CSS. value:[%s]", value);
5623 return chtml50->out;