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);
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,
416 * converts from CHTML5.0 to CHTML3.0.
418 * @param r [i] Requet_rec is appointed.
419 * @param spec [i] The result of the device specification processing which
420 * was done in advance is appointed.
421 * @param src [i] The character string before the converting is appointed.
422 * @return The character string after the converting is returned.
425 chxj_convert_chtml50(
431 chxjconvrule_entry *entryp,
440 DBG(r, "start chxj_convert_chtml50()");
442 /*--------------------------------------------------------------------------*/
444 /*--------------------------------------------------------------------------*/
446 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
448 DBG(r,"i found qrcode xml");
449 DBG(r, "end chxj_convert_chtml50()");
452 DBG(r,"not found qrcode xml");
454 /*--------------------------------------------------------------------------*/
455 /* The CHTML structure is initialized. */
456 /*--------------------------------------------------------------------------*/
457 s_init_chtml50(&chtml50, &doc, r, spec);
459 chtml50.entryp = entryp;
460 chtml50.cookie = cookie;
462 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
464 /*--------------------------------------------------------------------------*/
465 /* The character string of the input is analyzed. */
466 /*--------------------------------------------------------------------------*/
467 qs_init_malloc(&doc);
468 qs_init_root_node(&doc);
470 ss = apr_pcalloc(r->pool, srclen + 1);
471 memset(ss, 0, srclen + 1);
472 memcpy(ss, src, srclen);
475 chxj_dump_out("[src] CHTML -> CHTML4.0", ss, srclen);
477 if (IS_CSS_ON(chtml50.entryp)) {
478 /* current property list */
479 chtml50.css_prop_stack = chxj_new_prop_list_stack(&doc);
482 chxj_buffered_write_init(r->pool, &doc.buf);
484 qs_parse_string(&doc,ss, strlen(ss));
486 /*--------------------------------------------------------------------------*/
487 /* It converts it from CHTML to CHTML. */
488 /*--------------------------------------------------------------------------*/
489 chxj_node_convert(spec,r,(void*)&chtml50, &doc, qs_get_root(&doc), 0);
490 chtml50.out = chxj_buffered_write_flush(chtml50.out, &doc.buf);
491 dst = apr_pstrdup(r->pool, chtml50.out);
492 chxj_buffered_write_terminate(&doc.buf);
494 qs_all_free(&doc,QX_LOGMARK);
497 dst = apr_pstrdup(r->pool,ss);
499 if (strlen(dst) == 0) {
500 dst = apr_psprintf(r->pool, "\n");
503 *dstlen = strlen(dst);
506 chxj_dump_out("[src] CHTML -> CHTML4.0", dst, *dstlen);
509 DBG(r, "end chxj_convert_chtml50()");
515 * The CHTML structure is initialized.
517 * @param chtml50 [i/o] The pointer to the HDML structure that wants to be
518 * initialized is specified.
519 * @param doc [i] The Doc structure that should be set to the initialized
520 * HDML structure is specified.
521 * @param r [i] To use POOL, the pointer to request_rec is specified.
522 * @param spec [i] The pointer to the device_table
525 s_init_chtml50(chtml50_t *chtml50, Doc *doc, request_rec *r, device_table *spec)
527 memset(doc, 0, sizeof(Doc));
528 memset(chtml50, 0, sizeof(chtml50_t));
532 chtml50->spec = spec;
533 chtml50->out = qs_alloc_zero_byte_string(r->pool);
534 chtml50->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
535 chtml50->doc->parse_mode = PARSE_MODE_CHTML;
540 * Corresponding EMOJI to a current character-code is retrieved.
541 * The substitution character string is stored in the rslt pointer if agreeing.
543 * @param chtml50 [i] The pointer to the CHTML structure is specified.
544 * @param txt [i] The character string to want to examine whether it is
545 * EMOJI is specified.
546 * @param rslt [o] The pointer to the pointer that stores the result is
548 * @return When corresponding EMOJI exists, it returns it excluding 0.
551 s_chtml50_search_emoji(chtml50_t *chtml50, char *txt, char **rslt)
558 spec = chtml50->spec;
564 DBG(r,"spec is NULL");
567 for (ee = chtml50->conf->emoji;
570 if (ee->imode == NULL) {
571 DBG(r, "emoji->imode is NULL");
575 if (ee->imode->string != NULL
576 && strlen(ee->imode->string) > 0
577 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
579 if (spec == NULL || spec->emoji_type == NULL) {
580 *rslt = apr_palloc(r->pool, 3);
581 (*rslt)[0] = ee->imode->hex1byte & 0xff;
582 (*rslt)[1] = ee->imode->hex2byte & 0xff;
584 return strlen(ee->imode->string);
596 chxj_chtml50_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
607 chtml50 = &__chtml50;
610 DBG(r, "REQ[%X] start chxj_chtml50_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
611 memset(doc, 0, sizeof(Doc));
612 memset(chtml50, 0, sizeof(chtml50_t));
616 chtml50->spec = spec;
617 chtml50->out = qs_alloc_zero_byte_string(r->pool);
618 chtml50->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
619 chtml50->doc->parse_mode = PARSE_MODE_CHTML;
621 apr_pool_create(&pool, r->pool);
623 chxj_buffered_write_init(pool, &doc->buf);
625 for (ii=0; ii<len; ii++) {
629 rtn = s_chtml50_search_emoji(chtml50, (char *)&src[ii], &out);
636 if (is_sjis_kanji(src[ii])) {
637 two_byte[0] = src[ii+0];
638 two_byte[1] = src[ii+1];
644 one_byte[0] = src[ii+0];
649 chtml50->out = chxj_buffered_write_flush(chtml50->out, &doc->buf);
651 DBG(r, "REQ[%X] end chxj_chtml50_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
657 * It is a handler who processes the HTML tag.
659 * @param pdoc [i/o] The pointer to the CHTML structure at the output
660 * destination is specified.
661 * @param node [i] The HTML tag node is specified.
662 * @return The conversion result is returned.
665 s_chtml50_start_html_tag(void *pdoc, Node *UNUSED(node))
667 chtml50_t *chtml50 = GET_CHTML50(pdoc);
668 Doc *doc = chtml50->doc;
670 /*--------------------------------------------------------------------------*/
672 /*--------------------------------------------------------------------------*/
680 * It is a handler who processes the HTML tag.
682 * @param pdoc [i/o] The pointer to the CHTML structure at the output
683 * destination is specified.
684 * @param node [i] The HTML tag node is specified.
685 * @return The conversion result is returned.
688 s_chtml50_end_html_tag(void *pdoc, Node *UNUSED(child))
690 chtml50_t *chtml50 = GET_CHTML50(pdoc);
691 Doc *doc = chtml50->doc;
700 * It is a handler who processes the META tag.
702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
703 * destination is specified.
704 * @param node [i] The META tag node is specified.
705 * @return The conversion result is returned.
708 s_chtml50_start_meta_tag(void *pdoc, Node *node)
714 int content_type_flag;
717 chtml50 = GET_CHTML50(pdoc);
721 content_type_flag = 0;
725 /*--------------------------------------------------------------------------*/
727 /*--------------------------------------------------------------------------*/
728 for (attr = qs_get_attr(doc,node);
730 attr = qs_get_next_attr(doc,attr)) {
731 char *name = qs_get_attr_name(doc,attr);
732 char *value = qs_get_attr_value(doc,attr);
736 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
737 /*----------------------------------------------------------------------*/
739 /*----------------------------------------------------------------------*/
740 W_L(" http-equiv=\"");
743 if (STRCASEEQ('c','C',"content-type", value))
744 content_type_flag = 1;
746 if (STRCASEEQ('r','R',"refresh", value))
753 if (strcasecmp(name, "content") == 0 && value && *value) {
754 if (content_type_flag) {
758 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
766 buf = apr_pstrdup(r->pool, value);
767 url = strchr(buf, ';');
769 sec = apr_pstrdup(r->pool, buf);
772 url = chxj_encoding_parameter(r, url, 0);
773 url = chxj_add_cookie_parameter(r, url, chtml50->cookie);
804 * It is a handler who processes the META tag.
806 * @param pdoc [i/o] The pointer to the CHTML structure at the output
807 * destination is specified.
808 * @param node [i] The META tag node is specified.
809 * @return The conversion result is returned.
812 s_chtml50_end_meta_tag(void* pdoc, Node* UNUSED(child))
814 chtml50_t *chtml50 = GET_CHTML50(pdoc);
821 * It is a handler who processes the HEAD tag.
823 * @param pdoc [i/o] The pointer to the CHTML structure at the output
824 * destination is specified.
825 * @param node [i] The HEAD tag node is specified.
826 * @return The conversion result is returned.
829 s_chtml50_start_head_tag(void* pdoc, Node* UNUSED(node))
831 chtml50_t *chtml50 = GET_CHTML50(pdoc);
832 Doc *doc = chtml50->doc;
841 * It is a handler who processes the HEAD tag.
843 * @param pdoc [i/o] The pointer to the CHTML structure at the output
844 * destination is specified.
845 * @param node [i] The HEAD tag node is specified.
846 * @return The conversion result is returned.
849 s_chtml50_end_head_tag(void *pdoc, Node *UNUSED(node))
851 chtml50_t *chtml50 = GET_CHTML50(pdoc);
852 Doc *doc = chtml50->doc;
861 * It is a handler who processes the TITLE tag.
863 * @param pdoc [i/o] The pointer to the CHTML structure at the output
864 * destination is specified.
865 * @param node [i] The TITLE tag node is specified.
866 * @return The conversion result is returned.
869 s_chtml50_start_title_tag(void *pdoc, Node *UNUSED(node))
871 chtml50_t *chtml50 = GET_CHTML50(pdoc);
872 Doc *doc = chtml50->doc;
881 * It is a handler who processes the TITLE tag.
883 * @param pdoc [i/o] The pointer to the CHTML structure at the output
884 * destination is specified.
885 * @param node [i] The TITLE tag node is specified.
886 * @return The conversion result is returned.
889 s_chtml50_end_title_tag(void *pdoc, Node *UNUSED(child))
891 chtml50_t *chtml50 = GET_CHTML50(pdoc);
892 Doc *doc = chtml50->doc;
901 * It is a handler who processes the BASE tag.
903 * @param pdoc [i/o] The pointer to the CHTML structure at the output
904 * destination is specified.
905 * @param node [i] The BASE tag node is specified.
906 * @return The conversion result is returned.
909 s_chtml50_start_base_tag(void *pdoc, Node *node)
916 chtml50 = GET_CHTML50(pdoc);
921 /*--------------------------------------------------------------------------*/
923 /*--------------------------------------------------------------------------*/
924 for (attr = qs_get_attr(doc,node);
926 attr = qs_get_next_attr(doc,attr)) {
927 char *name = qs_get_attr_name(doc,attr);
928 char *value = qs_get_attr_value(doc,attr);
929 if (STRCASEEQ('h','H',"href", name)) {
942 * It is a handler who processes the BASE tag.
944 * @param pdoc [i/o] The pointer to the CHTML structure at the output
945 * destination is specified.
946 * @param node [i] The BASE tag node is specified.
947 * @return The conversion result is returned.
950 s_chtml50_end_base_tag(void *pdoc, Node *UNUSED(child))
952 chtml50_t *chtml50 = GET_CHTML50(pdoc);
959 * It is a handler who processes the BODY tag.
961 * @param pdoc [i/o] The pointer to the CHTML structure at the output
962 * destination is specified.
963 * @param node [i] The BODY tag node is specified.
964 * @return The conversion result is returned.
967 s_chtml50_start_body_tag(void *pdoc, Node *node)
973 char *attr_bgcolor = NULL;
974 char *attr_text = NULL;
975 char *attr_link = NULL;
976 char *attr_style = NULL;
977 char *attr_alink = NULL;
978 char *attr_vlink = NULL;
980 chtml50 = GET_CHTML50(pdoc);
984 /*--------------------------------------------------------------------------*/
986 /*--------------------------------------------------------------------------*/
987 for (attr = qs_get_attr(doc,node);
989 attr = qs_get_next_attr(doc,attr)) {
990 char *name = qs_get_attr_name(doc,attr);
991 char *value = qs_get_attr_value(doc,attr);
992 if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
993 /*----------------------------------------------------------------------*/
995 /*----------------------------------------------------------------------*/
996 attr_bgcolor = value;
998 else if (STRCASEEQ('t','T', "text", name) && value && *value) {
999 /*----------------------------------------------------------------------*/
1001 /*----------------------------------------------------------------------*/
1004 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1005 /*----------------------------------------------------------------------*/
1007 /*----------------------------------------------------------------------*/
1010 else if (STRCASEEQ('a','A',"alink", name) && value && *value) {
1011 /*----------------------------------------------------------------------*/
1013 /*----------------------------------------------------------------------*/
1016 else if (STRCASEEQ('v','V',"vlink", name) && value && *value) {
1017 /*----------------------------------------------------------------------*/
1019 /*----------------------------------------------------------------------*/
1022 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1027 if (IS_CSS_ON(chtml50->entryp)) {
1028 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1030 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1031 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1032 css_property_t *cur;
1033 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1034 if (cur->value && *cur->value) {
1035 attr_text = apr_pstrdup(doc->pool, cur->value);
1038 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1039 if (cur->value && *cur->value) {
1040 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1044 if (chtml50->style) {
1045 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml50->style);
1046 css_selector_t *cur_sel;
1047 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1048 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1049 css_property_t *cur;
1050 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1051 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1052 attr_link = apr_pstrdup(doc->pool, cur->value);
1056 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1057 css_property_t *cur;
1058 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1059 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1060 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1064 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
1065 css_property_t *cur;
1066 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1067 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1068 attr_alink = apr_pstrdup(doc->pool, cur->value);
1078 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1084 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1090 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1096 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1102 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1109 return chtml50->out;
1114 * It is a handler who processes the BODY tag.
1116 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1117 * destination is specified.
1118 * @param node [i] The BODY tag node is specified.
1119 * @return The conversion result is returned.
1122 s_chtml50_end_body_tag(void *pdoc, Node *UNUSED(child))
1127 chtml50 = GET_CHTML50(pdoc);
1131 if (IS_CSS_ON(chtml50->entryp)) {
1132 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1135 return chtml50->out;
1140 * It is a handler who processes the A tag.
1142 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1143 * destination is specified.
1144 * @param node [i] The A tag node is specified.
1145 * @return The conversion result is returned.
1148 s_chtml50_start_a_tag(void *pdoc, Node *node)
1154 char *attr_style = NULL;
1156 chtml50 = GET_CHTML50(pdoc);
1161 /*--------------------------------------------------------------------------*/
1162 /* Get Attributes */
1163 /*--------------------------------------------------------------------------*/
1164 for (attr = qs_get_attr(doc,node);
1166 attr = qs_get_next_attr(doc,attr)) {
1167 char *name = qs_get_attr_name(doc,attr);
1168 char *value = qs_get_attr_value(doc,attr);
1169 if (STRCASEEQ('n','N',"name", name)) {
1170 /*----------------------------------------------------------------------*/
1172 /*----------------------------------------------------------------------*/
1177 else if (STRCASEEQ('h','H',"href", name)) {
1178 /*----------------------------------------------------------------------*/
1180 /*----------------------------------------------------------------------*/
1181 value = chxj_encoding_parameter(r, value, 0);
1182 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1183 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
1189 else if (STRCASEEQ('a','A',"accesskey", name)) {
1190 /*----------------------------------------------------------------------*/
1192 /*----------------------------------------------------------------------*/
1193 W_L(" accesskey=\"");
1197 else if (STRCASEEQ('c','C',"cti", name)) {
1198 /*----------------------------------------------------------------------*/
1200 /*----------------------------------------------------------------------*/
1205 else if (STRCASEEQ('i','I',"ijam", name)) {
1206 /*----------------------------------------------------------------------*/
1208 /*----------------------------------------------------------------------*/
1211 else if (STRCASEEQ('u','U',"utn", name)) {
1212 /*----------------------------------------------------------------------*/
1214 /* It is special only for CHTML. */
1215 /*----------------------------------------------------------------------*/
1218 else if (STRCASEEQ('t','T',"telbook", name)) {
1219 /*----------------------------------------------------------------------*/
1221 /*----------------------------------------------------------------------*/
1224 else if (STRCASEEQ('k','K',"kana", name)) {
1225 /*----------------------------------------------------------------------*/
1227 /*----------------------------------------------------------------------*/
1230 else if (STRCASEEQ('e','E',"email", name)) {
1231 /*----------------------------------------------------------------------*/
1233 /*----------------------------------------------------------------------*/
1236 else if (STRCASEEQ('i','I',"ista", name)) {
1237 /*----------------------------------------------------------------------*/
1239 /*----------------------------------------------------------------------*/
1242 else if (STRCASEEQ('i','I',"ilet", name)) {
1243 /*----------------------------------------------------------------------*/
1245 /*----------------------------------------------------------------------*/
1248 else if (STRCASEEQ('i','I',"iswf", name)) {
1249 /*----------------------------------------------------------------------*/
1251 /*----------------------------------------------------------------------*/
1254 else if (STRCASEEQ('i','I',"irst", name)) {
1255 /*----------------------------------------------------------------------*/
1257 /*----------------------------------------------------------------------*/
1260 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1266 if (IS_CSS_ON(chtml50->entryp)) {
1267 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1270 return chtml50->out;
1275 * It is a handler who processes the A tag.
1277 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1278 * destination is specified.
1279 * @param node [i] The A tag node is specified.
1280 * @return The conversion result is returned.
1283 s_chtml50_end_a_tag(void *pdoc, Node *UNUSED(child))
1288 chtml50 = GET_CHTML50(pdoc);
1293 if (IS_CSS_ON(chtml50->entryp)) {
1294 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1297 return chtml50->out;
1302 * It is a handler who processes the BR tag.
1304 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1305 * destination is specified.
1306 * @param node [i] The BR tag node is specified.
1307 * @return The conversion result is returned.
1310 s_chtml50_start_br_tag(void *pdoc, Node *node)
1317 chtml50 = GET_CHTML50(pdoc);
1321 /*--------------------------------------------------------------------------*/
1322 /* Get Attributes */
1323 /*--------------------------------------------------------------------------*/
1324 for (attr = qs_get_attr(doc,node);
1326 attr = qs_get_next_attr(doc,attr)) {
1327 char *name = qs_get_attr_name(doc,attr);
1328 char *value = qs_get_attr_value(doc,attr);
1329 if (STRCASEEQ('c','C',"clear",name)) {
1330 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1338 return chtml50->out;
1343 * It is a handler who processes the BR tag.
1345 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1346 * destination is specified.
1347 * @param node [i] The BR tag node is specified.
1348 * @return The conversion result is returned.
1351 s_chtml50_end_br_tag(void *pdoc, Node *UNUSED(child))
1353 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1355 return chtml50->out;
1360 * It is a handler who processes the TR tag.
1362 * @param chtml50 [i/o] The pointer to the CHTML structure at the output
1363 * destination is specified.
1364 * @param node [i] The TR tag node is specified.
1365 * @return The conversion result is returned.
1368 s_chtml50_start_tr_tag(void *pdoc, Node *UNUSED(node))
1370 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1372 return chtml50->out;
1377 * It is a handler who processes the TR tag.
1379 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1380 * destination is specified.
1381 * @param node [i] The TR tag node is specified.
1382 * @return The conversion result is returned.
1385 s_chtml50_end_tr_tag(void *pdoc, Node *UNUSED(child))
1391 chtml50 = GET_CHTML50(pdoc);
1397 return chtml50->out;
1402 * It is a handler who processes the FONT tag.
1404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1405 * destination is specified.
1406 * @param node [i] The FONT tag node is specified.
1407 * @return The conversion result is returned.
1410 s_chtml50_start_font_tag(void *pdoc, Node *node)
1416 char *attr_color = NULL;
1417 char *attr_size = NULL;
1418 char *attr_style = NULL;
1420 chtml50 = GET_CHTML50(pdoc);
1424 /*--------------------------------------------------------------------------*/
1425 /* Get Attributes */
1426 /*--------------------------------------------------------------------------*/
1427 for (attr = qs_get_attr(doc,node);
1429 attr = qs_get_next_attr(doc,attr)) {
1430 char *name = qs_get_attr_name(doc,attr);
1431 char *value = qs_get_attr_value(doc,attr);
1432 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1433 attr_color = apr_pstrdup(doc->buf.pool, value);
1435 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1436 /*----------------------------------------------------------------------*/
1438 /*----------------------------------------------------------------------*/
1439 attr_size = apr_pstrdup(doc->buf.pool, value);
1440 switch (*attr_size) {
1448 if (*(attr_size + 1) == 0) {
1457 char ch = *(attr_size + 1);
1458 if (ch == '1' || ch == '2' || ch == '3') {
1459 if (*(attr_size + 2) == 0) {
1471 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1475 if (IS_CSS_ON(chtml50->entryp)) {
1476 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1478 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1479 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1480 css_property_t *cur;
1481 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1482 if (cur->value && *cur->value) {
1483 attr_color = apr_pstrdup(doc->pool, cur->value);
1486 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1487 if (cur->value && *cur->value) {
1488 attr_size = apr_pstrdup(doc->pool, cur->value);
1489 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1490 attr_size = apr_pstrdup(doc->pool, "1");
1492 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1493 attr_size = apr_pstrdup(doc->pool, "2");
1495 else if (STRCASEEQ('s','S',"small",attr_size)) {
1496 attr_size = apr_pstrdup(doc->pool, "3");
1498 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1499 attr_size = apr_pstrdup(doc->pool, "4");
1501 else if (STRCASEEQ('l','L',"large",attr_size)) {
1502 attr_size = apr_pstrdup(doc->pool, "5");
1504 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1505 attr_size = apr_pstrdup(doc->pool, "6");
1507 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1508 attr_size = apr_pstrdup(doc->pool, "7");
1515 if (attr_color || attr_size) {
1518 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1529 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1530 flg->with_font_flag = 1;
1531 node->userData = flg;
1534 node->userData = NULL;
1536 return chtml50->out;
1541 * It is a handler who processes the FONT tag.
1543 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1544 * destination is specified.
1545 * @param node [i] The FONT tag node is specified.
1546 * @return The conversion result is returned.
1549 s_chtml50_end_font_tag(void *pdoc, Node *node)
1555 chtml50 = GET_CHTML50(pdoc);
1559 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
1560 if (flg && flg->with_font_flag) {
1563 if (IS_CSS_ON(chtml50->entryp)) {
1564 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1567 return chtml50->out;
1572 * It is a handler who processes the FORM tag.
1574 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1575 * destination is specified.
1576 * @param node [i] The FORM tag node is specified.
1577 * @return The conversion result is returned.
1580 s_chtml50_start_form_tag(void *pdoc, Node *node)
1586 char *attr_action = NULL;
1587 char *attr_method = NULL;
1588 char *attr_style = NULL;
1589 char *attr_color = NULL;
1590 char *attr_align = NULL;
1591 char *attr_utn = NULL;
1592 char *new_hidden_tag = NULL;
1594 chtml50 = GET_CHTML50(pdoc);
1598 /*--------------------------------------------------------------------------*/
1599 /* Get Attributes */
1600 /*--------------------------------------------------------------------------*/
1601 for (attr = qs_get_attr(doc,node);
1603 attr = qs_get_next_attr(doc,attr)) {
1604 char *name = qs_get_attr_name(doc,attr);
1605 char *value = qs_get_attr_value(doc,attr);
1609 if (strcasecmp(name, "action") == 0) {
1610 /*--------------------------------------------------------------------*/
1612 /*--------------------------------------------------------------------*/
1613 attr_action = value;
1619 if (strcasecmp(name, "method") == 0) {
1620 /*--------------------------------------------------------------------*/
1622 /*--------------------------------------------------------------------*/
1623 attr_method = value;
1629 if (strcasecmp(name, "utn") == 0) {
1630 /*--------------------------------------------------------------------*/
1632 /*--------------------------------------------------------------------*/
1639 if (strcasecmp(name, "style") == 0) {
1648 if (IS_CSS_ON(chtml50->entryp)) {
1649 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1651 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1652 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1653 css_property_t *cur;
1654 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1655 if (STRCASEEQ('l','L',"left", cur->value)) {
1656 attr_align = apr_pstrdup(doc->pool, "left");
1658 else if (STRCASEEQ('c','C',"center",cur->value)) {
1659 attr_align = apr_pstrdup(doc->pool, "center");
1661 else if (STRCASEEQ('r','R',"right",cur->value)) {
1662 attr_align = apr_pstrdup(doc->pool, "right");
1665 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1666 attr_color = apr_pstrdup(doc->pool, cur->value);
1671 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1675 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1676 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml50->cookie);
1678 char *new_query_string = NULL;
1679 q = strchr(attr_action, '?');
1681 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);
1682 if (new_hidden_tag || new_query_string) {
1688 if (new_query_string) {
1690 W_V(new_query_string);
1704 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
1705 memset(flg, 0, sizeof(*flg));
1707 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1708 W_L("<font color=\"");
1711 flg->with_font_flag = 1;
1714 W_L("<div align=\"");
1717 flg->with_div_flag = 1;
1719 node->userData = flg;
1720 if (new_hidden_tag) {
1721 W_V(new_hidden_tag);
1724 return chtml50->out;
1729 * It is a handler who processes the FORM tag.
1731 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1732 * destination is specified.
1733 * @param node [i] The FORM tag node is specified.
1734 * @return The conversion result is returned.
1737 s_chtml50_end_form_tag(void *pdoc, Node *node)
1742 chtml50 = GET_CHTML50(pdoc);
1745 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
1746 if (flg && flg->with_div_flag) {
1749 if (flg && flg->with_font_flag) {
1753 if (IS_CSS_ON(chtml50->entryp)) {
1754 chxj_css_pop_prop_list(chtml50->css_prop_stack);
1757 return chtml50->out;
1762 * It is a handler who processes the INPUT tag.
1764 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1765 * destination is specified.
1766 * @param node [i] The INPUT tag node is specified.
1767 * @return The conversion result is returned.
1770 s_chtml50_start_input_tag(void *pdoc, Node *node)
1776 char *attr_accesskey = NULL;
1777 char *attr_max_length = NULL;
1778 char *attr_type = NULL;
1779 char *attr_name = NULL;
1780 char *attr_value = NULL;
1781 char *attr_istyle = NULL;
1782 char *attr_size = NULL;
1783 char *attr_checked = NULL;
1784 char *attr_style = NULL;
1786 chtml50 = GET_CHTML50(pdoc);
1790 /*--------------------------------------------------------------------------*/
1791 /* Get Attributes */
1792 /*--------------------------------------------------------------------------*/
1793 for (attr = qs_get_attr(doc,node);
1795 attr = qs_get_next_attr(doc,attr)) {
1796 char *name = qs_get_attr_name(doc,attr);
1797 char *value = qs_get_attr_value(doc,attr);
1798 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1799 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1800 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1801 STRCASEEQ('p','P',"password",tmp_type) ||
1802 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1803 STRCASEEQ('r','R',"radio", tmp_type) ||
1804 STRCASEEQ('h','H',"hidden", tmp_type) ||
1805 STRCASEEQ('s','S',"submit", tmp_type) ||
1806 STRCASEEQ('r','R',"reset", tmp_type))) {
1807 attr_type = tmp_type;
1810 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1813 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1816 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1817 attr_istyle = value;
1819 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1820 attr_max_length = value;
1822 else if (STRCASEEQ('c','C',"checked", name)) {
1823 attr_checked = value;
1825 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1826 attr_accesskey = value;
1828 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1831 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1836 if (IS_CSS_ON(chtml50->entryp)) {
1837 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
1839 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1840 css_property_t *cur;
1841 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1842 if (strcasestr(cur->value, "<ja:n>")) {
1845 else if (strcasestr(cur->value, "<ja:en>")) {
1848 else if (strcasestr(cur->value, "<ja:hk>")) {
1851 else if (strcasestr(cur->value, "<ja:h>")) {
1875 if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
1876 apr_size_t value_len = strlen(attr_value);
1877 attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml50->entryp);
1881 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1884 if (attr_accesskey) {
1885 W_L(" accesskey=\"");
1886 W_V(attr_accesskey);
1890 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1896 /*--------------------------------------------------------------------------*/
1897 /* The figure is default for the password. */
1898 /*--------------------------------------------------------------------------*/
1899 if (attr_max_length) {
1900 if (chxj_chk_numeric(attr_max_length) != 0) {
1901 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1903 if (attr_istyle && *attr_istyle == '1') {
1904 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1908 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1917 return chtml50->out;
1922 * It is a handler who processes the INPUT tag.
1924 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1925 * destination is specified.
1926 * @param node [i] The INPUT tag node is specified.
1927 * @return The conversion result is returned.
1930 s_chtml50_end_input_tag(void *pdoc, Node *UNUSED(child))
1932 chtml50_t *chtml50 = GET_CHTML50(pdoc);
1934 return chtml50->out;
1939 * It is a handler who processes the CENTER tag.
1941 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1942 * destination is specified.
1943 * @param node [i] The CENTER tag node is specified.
1944 * @return The conversion result is returned.
1947 s_chtml50_start_center_tag(void *pdoc, Node *node)
1952 char *attr_style = NULL;
1953 char *attr_color = NULL;
1954 char *attr_size = NULL;
1956 chtml50 = GET_CHTML50(pdoc);
1959 for (attr = qs_get_attr(doc,node);
1961 attr = qs_get_next_attr(doc,attr)) {
1962 char *name = qs_get_attr_name(doc,attr);
1963 char *value = qs_get_attr_value(doc,attr);
1964 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1968 if (IS_CSS_ON(chtml50->entryp)) {
1969 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
1971 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1972 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1973 css_property_t *cur;
1974 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1975 if (cur->value && *cur->value) {
1976 attr_color = apr_pstrdup(doc->pool, cur->value);
1979 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1980 if (cur->value && *cur->value) {
1981 attr_size = apr_pstrdup(doc->pool, cur->value);
1982 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1983 attr_size = apr_pstrdup(doc->pool, "1");
1985 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1986 attr_size = apr_pstrdup(doc->pool, "2");
1988 else if (STRCASEEQ('s','S',"small",attr_size)) {
1989 attr_size = apr_pstrdup(doc->pool, "3");
1991 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1992 attr_size = apr_pstrdup(doc->pool, "4");
1994 else if (STRCASEEQ('l','L',"large",attr_size)) {
1995 attr_size = apr_pstrdup(doc->pool, "5");
1997 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1998 attr_size = apr_pstrdup(doc->pool, "6");
2000 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2001 attr_size = apr_pstrdup(doc->pool, "7");
2009 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
2010 memset(flg, 0, sizeof(*flg));
2011 if (attr_color || attr_size) {
2014 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2024 flg->with_font_flag = 1;
2027 node->userData = flg;
2029 return chtml50->out;
2034 * It is a handler who processes the CENTER tag.
2036 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2037 * destination is specified.
2038 * @param node [i] The CENTER tag node is specified.
2039 * @return The conversion result is returned.
2042 s_chtml50_end_center_tag(void *pdoc, Node *node)
2047 chtml50 = GET_CHTML50(pdoc);
2050 if (IS_CSS_ON(chtml50->entryp)) {
2051 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2053 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
2054 if (flg && flg->with_font_flag) {
2059 return chtml50->out;
2064 * It is a handler who processes the HR tag.
2066 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2067 * destination is specified.
2068 * @param node [i] The HR tag node is specified.
2069 * @return The conversion result is returned.
2072 s_chtml50_start_hr_tag(void *pdoc, Node *node)
2078 char *attr_align = NULL;
2079 char *attr_size = NULL;
2080 char *attr_width = NULL;
2081 char *attr_noshade = NULL;
2082 char *attr_style = NULL;
2083 char *attr_color = NULL;
2085 chtml50 = GET_CHTML50(pdoc);
2089 for (attr = qs_get_attr(doc,node);
2091 attr = qs_get_next_attr(doc,attr)) {
2092 char *name = qs_get_attr_name (doc,attr);
2093 char *value = qs_get_attr_value(doc,attr);
2097 if (strcasecmp(name, "align") == 0) {
2098 /*--------------------------------------------------------------------*/
2100 /*--------------------------------------------------------------------*/
2101 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2109 if (strcasecmp(name, "size") == 0) {
2110 /*--------------------------------------------------------------------*/
2112 /*--------------------------------------------------------------------*/
2113 if (value && *value) {
2117 else if (strcasecmp(name, "style") == 0) {
2118 if (value && *value) {
2126 if (strcasecmp(name, "width") == 0) {
2127 /*--------------------------------------------------------------------*/
2129 /*--------------------------------------------------------------------*/
2130 if (value && *value) {
2138 if (strcasecmp(name, "noshade") == 0) {
2139 /*--------------------------------------------------------------------*/
2141 /*--------------------------------------------------------------------*/
2142 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2148 if (strcasecmp(name, "color") == 0 && value && *value) {
2149 /*--------------------------------------------------------------------*/
2151 /*--------------------------------------------------------------------*/
2160 if (IS_CSS_ON(chtml50->entryp)) {
2161 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2163 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2164 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2165 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2166 css_property_t *cur;
2167 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2168 if (STRCASEEQ('s','S',"solid",cur->value)) {
2169 attr_noshade = "noshade";
2172 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2173 char *tmp = apr_pstrdup(doc->pool, cur->value);
2174 char *tmpp = strstr(tmp, "px");
2177 attr_size = apr_pstrdup(doc->pool, tmp);
2180 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2181 char *tmp = apr_pstrdup(doc->pool, cur->value);
2182 char *tmpp = strstr(tmp, "px");
2185 attr_width = apr_pstrdup(doc->pool, tmp);
2188 tmpp = strstr(tmp, "%");
2190 attr_width = apr_pstrdup(doc->pool, tmp);
2221 return chtml50->out;
2226 * It is a handler who processes the HR tag.
2228 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2229 * destination is specified.
2230 * @param node [i] The HR tag node is specified.
2231 * @return The conversion result is returned.
2234 s_chtml50_end_hr_tag(void *pdoc, Node *UNUSED(child))
2236 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2238 return chtml50->out;
2243 * It is a handler who processes the IMG tag.
2245 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2246 * destination is specified.
2247 * @param node [i] The IMG tag node is specified.
2248 * @return The conversion result is returned.
2251 s_chtml50_start_img_tag(void *pdoc, Node *node)
2257 char *attr_src = NULL;
2258 char *attr_align = NULL;
2259 char *attr_style = NULL;
2260 char *attr_alt = NULL;
2261 char *attr_width = NULL;
2262 char *attr_height = NULL;
2263 char *attr_hspace = NULL;
2264 char *attr_vspace = NULL;
2265 #ifndef IMG_NOT_CONVERT_FILENAME
2269 chtml50 = GET_CHTML50(pdoc);
2270 #ifndef IMG_NOT_CONVERT_FILENAME
2271 spec = chtml50->spec;
2276 /*--------------------------------------------------------------------------*/
2277 /* Get Attributes */
2278 /*--------------------------------------------------------------------------*/
2279 for (attr = qs_get_attr(doc,node);
2281 attr = qs_get_next_attr(doc,attr)) {
2282 char *name = qs_get_attr_name (doc,attr);
2283 char *value = qs_get_attr_value(doc,attr);
2287 if (strcasecmp(name, "src") == 0) {
2288 /*--------------------------------------------------------------------*/
2290 /*--------------------------------------------------------------------*/
2291 #ifdef IMG_NOT_CONVERT_FILENAME
2292 value = chxj_encoding_parameter(r, value, 0);
2293 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
2294 value = chxj_add_cookie_no_update_parameter(r, value);
2297 value = chxj_img_conv(r,spec,value);
2298 value = chxj_encoding_parameter(r, value, 0);
2299 value = chxj_add_cookie_parameter(r, value, chtml50->cookie);
2300 value = chxj_add_cookie_no_update_parameter(r, value);
2304 else if (strcasecmp(name,"style") == 0 && value && *value) {
2311 if (strcasecmp(name, "align" ) == 0) {
2312 /*--------------------------------------------------------------------*/
2314 /*--------------------------------------------------------------------*/
2315 /*--------------------------------------------------------------------*/
2317 /*--------------------------------------------------------------------*/
2319 if (STRCASEEQ('t','T',"top", value) ||
2320 STRCASEEQ('m','M',"middle",value) ||
2321 STRCASEEQ('b','B',"bottom",value) ||
2322 STRCASEEQ('l','L',"left", value) ||
2323 STRCASEEQ('r','R',"right", value)) {
2326 else if (STRCASEEQ('c','C',"center", value)) {
2327 attr_align = apr_pstrdup(doc->pool, "middle");
2331 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2332 /*--------------------------------------------------------------------*/
2334 /*--------------------------------------------------------------------*/
2341 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2342 /*--------------------------------------------------------------------*/
2344 /*--------------------------------------------------------------------*/
2351 if (strcasecmp(name, "height") == 0 && value && *value) {
2352 /*--------------------------------------------------------------------*/
2354 /*--------------------------------------------------------------------*/
2355 attr_height = value;
2358 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2359 /*--------------------------------------------------------------------*/
2361 /*--------------------------------------------------------------------*/
2362 attr_hspace = value;
2368 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2369 /*--------------------------------------------------------------------*/
2371 /*--------------------------------------------------------------------*/
2372 attr_vspace = value;
2381 if (IS_CSS_ON(chtml50->entryp)) {
2382 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2384 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2385 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2386 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2387 css_property_t *cur;
2388 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2389 attr_height = apr_pstrdup(doc->pool, cur->value);
2391 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2392 attr_width = apr_pstrdup(doc->pool, cur->value);
2394 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2395 attr_align = apr_pstrdup(doc->pool, cur->value);
2437 return chtml50->out;
2442 * It is a handler who processes the IMG tag.
2444 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2445 * destination is specified.
2446 * @param node [i] The IMG tag node is specified.
2447 * @return The conversion result is returned.
2450 s_chtml50_end_img_tag(void *pdoc, Node *UNUSED(child))
2452 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2454 return chtml50->out;
2459 * It is a handler who processes the SELECT tag.
2461 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2462 * destination is specified.
2463 * @param node [i] The SELECT tag node is specified.
2464 * @return The conversion result is returned.
2467 s_chtml50_start_select_tag(void *pdoc, Node *node)
2469 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2470 Doc *doc = chtml50->doc;
2473 char *multiple = NULL;
2475 char *attr_style = NULL;
2478 for (attr = qs_get_attr(doc, node);
2480 attr = qs_get_next_attr(doc,attr)) {
2481 char *nm = qs_get_attr_name(doc,attr);
2482 char *val = qs_get_attr_value(doc,attr);
2483 if (STRCASEEQ('s','S',"size", nm)) {
2484 /*----------------------------------------------------------------------*/
2485 /* CHTML 1.0 version 2.0 */
2486 /*----------------------------------------------------------------------*/
2487 size = apr_pstrdup(doc->buf.pool, val);
2489 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2490 /*----------------------------------------------------------------------*/
2491 /* CHTML 1.0 version 2.0 */
2492 /*----------------------------------------------------------------------*/
2493 attr_style = apr_pstrdup(doc->buf.pool, val);
2495 else if (STRCASEEQ('n','N',"name", nm)) {
2496 /*----------------------------------------------------------------------*/
2497 /* CHTML 1.0 version 2.0 */
2498 /*----------------------------------------------------------------------*/
2499 name = apr_pstrdup(doc->buf.pool, val);
2501 else if (STRCASEEQ('m','M',"multiple", nm)) {
2502 /*----------------------------------------------------------------------*/
2503 /* CHTML 1.0 version 2.0 */
2504 /*----------------------------------------------------------------------*/
2505 multiple = apr_pstrdup(doc->buf.pool, val);
2508 if (size && *size) {
2513 if (name && *name) {
2522 if (IS_CSS_ON(chtml50->entryp)) {
2523 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2526 return chtml50->out;
2531 * It is a handler who processes the SELECT tag.
2533 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2534 * destination is specified.
2535 * @param node [i] The SELECT tag node is specified.
2536 * @return The conversion result is returned.
2539 s_chtml50_end_select_tag(void *pdoc, Node *UNUSED(child))
2541 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2542 Doc *doc = chtml50->doc;
2545 if (IS_CSS_ON(chtml50->entryp)) {
2546 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2549 return chtml50->out;
2554 * It is a handler who processes the OPTION tag.
2556 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2557 * destination is specified.
2558 * @param node [i] The OPTION tag node is specified.
2559 * @return The conversion result is returned.
2562 s_chtml50_start_option_tag(void *pdoc, Node *node)
2570 char *attr_style = NULL;
2572 chtml50 = GET_CHTML50(pdoc);
2579 for (attr = qs_get_attr(doc,node);
2581 attr = qs_get_next_attr(doc,attr)) {
2582 char *nm = qs_get_attr_name(doc,attr);
2583 char *val = qs_get_attr_value(doc,attr);
2584 if (STRCASEEQ('s','S',"selected", nm)) {
2585 /*----------------------------------------------------------------------*/
2586 /* CHTML 1.0 version 2.0 */
2587 /*----------------------------------------------------------------------*/
2588 selected = apr_pstrdup(doc->buf.pool, val);
2590 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2591 /*----------------------------------------------------------------------*/
2592 /* CHTML 1.0 version 2.0 */
2593 /*----------------------------------------------------------------------*/
2594 attr_style = apr_pstrdup(doc->buf.pool, val);
2596 else if (STRCASEEQ('v','V',"value", nm)) {
2597 /*----------------------------------------------------------------------*/
2598 /* CHTML 1.0 version 2.0 */
2599 /*----------------------------------------------------------------------*/
2600 value = apr_pstrdup(doc->buf.pool, val);
2613 if (IS_CSS_ON(chtml50->entryp)) {
2614 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2617 return chtml50->out;
2622 * It is a handler who processes the OPTION tag.
2624 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2625 * destination is specified.
2626 * @param node [i] The OPTION tag node is specified.
2627 * @return The conversion result is returned.
2630 s_chtml50_end_option_tag(void *pdoc, Node *UNUSED(child))
2632 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2635 if (IS_CSS_ON(chtml50->entryp)) {
2636 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2639 return chtml50->out;
2644 * It is a handler who processes the DIV tag.
2646 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2647 * destination is specified.
2648 * @param node [i] The DIV tag node is specified.
2649 * @return The conversion result is returned.
2652 s_chtml50_start_div_tag(void *pdoc, Node *node)
2658 char *attr_style = NULL;
2659 char *attr_align = NULL;
2660 char *attr_display = NULL;
2661 char *attr_decoration = NULL;
2662 char *attr_wap_marquee_style = NULL;
2663 char *attr_wap_marquee_dir = NULL;
2664 char *attr_wap_marquee_loop = NULL;
2665 char *attr_color = NULL;
2666 char *attr_bgcolor = NULL;
2667 char *attr_font_size = NULL;
2669 chtml50 = GET_CHTML50(pdoc);
2673 for (attr = qs_get_attr(doc,node);
2675 attr = qs_get_next_attr(doc,attr)) {
2676 char *nm = qs_get_attr_name(doc,attr);
2677 char *val = qs_get_attr_value(doc,attr);
2678 if (STRCASEEQ('a','A', "align", nm)) {
2679 /*----------------------------------------------------------------------*/
2680 /* CHTML 1.0 (W3C version 3.2) */
2681 /*----------------------------------------------------------------------*/
2682 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2683 attr_align = apr_pstrdup(doc->buf.pool, val);
2686 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2687 attr_style = apr_pstrdup(doc->buf.pool, val);
2691 if (IS_CSS_ON(chtml50->entryp)) {
2692 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
2694 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2695 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2696 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2697 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2698 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
2699 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
2700 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
2702 css_property_t *cur;
2703 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2704 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2705 attr_display = apr_pstrdup(doc->pool, cur->value);
2708 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2709 if (STRCASEEQ('b','B',"blink", cur->value)) {
2710 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2713 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
2714 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2715 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2717 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
2718 char *ss = strchr(cur->value, '#');
2720 ss = strstr(cur->value, "rgb");
2723 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2724 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2727 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2728 attr_color = apr_pstrdup(doc->pool, cur->value);
2729 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2731 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2732 attr_align = apr_pstrdup(doc->pool, cur->value);
2734 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
2735 attr_font_size = apr_pstrdup(doc->pool, cur->value);
2736 if (STRCASEEQ('x','X',"xx-small",attr_font_size)) {
2737 attr_font_size = apr_pstrdup(doc->pool, "1");
2739 else if (STRCASEEQ('x','X',"x-small",attr_font_size)) {
2740 attr_font_size = apr_pstrdup(doc->pool, "2");
2742 else if (STRCASEEQ('s','S',"small",attr_font_size)) {
2743 attr_font_size = apr_pstrdup(doc->pool, "3");
2745 else if (STRCASEEQ('m','M',"medium",attr_font_size)) {
2746 attr_font_size = apr_pstrdup(doc->pool, "4");
2748 else if (STRCASEEQ('l','L',"large",attr_font_size)) {
2749 attr_font_size = apr_pstrdup(doc->pool, "5");
2751 else if (STRCASEEQ('x','X',"x-large",attr_font_size)) {
2752 attr_font_size = apr_pstrdup(doc->pool, "6");
2754 else if (STRCASEEQ('x','X',"xx-large",attr_font_size)) {
2755 attr_font_size = apr_pstrdup(doc->pool, "7");
2759 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2760 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2761 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2762 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2763 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2764 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2767 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2768 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2769 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2771 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2772 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2775 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2776 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2777 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2780 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2786 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
2787 memset(flg, 0, sizeof(*flg));
2794 flg->with_div_flag = 1;
2798 flg->with_div_flag = 1;
2800 if (attr_color || attr_font_size) {
2801 if (! attr_display && attr_color && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff", attr_color))) {
2810 if (attr_font_size) {
2812 W_V(attr_font_size);
2816 flg->with_font_flag = 1;
2819 if (attr_decoration) {
2821 flg->with_blink_flag = 1;
2825 if (attr_wap_marquee_style) {
2826 W_L(" behavior=\"");
2827 W_V(attr_wap_marquee_style);
2830 if (attr_wap_marquee_dir) {
2831 W_L(" direction=\"");
2832 W_V(attr_wap_marquee_dir);
2835 if (attr_wap_marquee_loop) {
2837 W_V(attr_wap_marquee_loop);
2846 flg->with_marquee_flag = 1;
2848 node->userData = flg;
2850 return chtml50->out;
2855 * It is a handler who processes the DIV tag.
2857 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2858 * destination is specified.
2859 * @param node [i] The DIV tag node is specified.
2860 * @return The conversion result is returned.
2863 s_chtml50_end_div_tag(void *pdoc, Node *node)
2865 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2866 Doc *doc = chtml50->doc;
2868 chtml50_flags_t *flg = node->userData;
2869 if (flg && flg->with_marquee_flag) {
2872 if (flg && flg->with_blink_flag) {
2875 if (flg && flg->with_font_flag) {
2878 if (flg && flg->with_div_flag) {
2881 if (IS_CSS_ON(chtml50->entryp)) {
2882 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2884 node->userData = NULL;
2886 return chtml50->out;
2891 * It is a handler who processes the UL tag.
2893 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2894 * destination is specified.
2895 * @param node [i] The UL tag node is specified.
2896 * @return The conversion result is returned.
2899 s_chtml50_start_ul_tag(void *pdoc, Node *node)
2901 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2902 Doc *doc = chtml50->doc;
2904 char *attr_type = NULL;
2905 char *attr_style = NULL;
2906 /*--------------------------------------------------------------------------*/
2907 /* Get Attributes */
2908 /*--------------------------------------------------------------------------*/
2909 for (attr = qs_get_attr(doc,node);
2911 attr = qs_get_next_attr(doc,attr)) {
2912 char *name = qs_get_attr_name(doc,attr);
2913 char *value = qs_get_attr_value(doc,attr);
2914 if (STRCASEEQ('t','T',"type",name)) {
2915 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2919 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2923 if (IS_CSS_ON(chtml50->entryp)) {
2924 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
2926 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2927 css_property_t *cur;
2928 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2929 if (STRCASEEQ('d','D',"disc",cur->value)) {
2930 attr_type = apr_pstrdup(doc->pool, "disc");
2932 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2933 attr_type = apr_pstrdup(doc->pool, "circle");
2935 else if (STRCASEEQ('s','S',"square",cur->value)) {
2936 attr_type = apr_pstrdup(doc->pool, "square");
2948 return chtml50->out;
2953 * It is a handler who processes the UL tag.
2955 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2956 * destination is specified.
2957 * @param node [i] The UL tag node is specified.
2958 * @return The conversion result is returned.
2961 s_chtml50_end_ul_tag(void *pdoc, Node *UNUSED(child))
2963 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2964 Doc *doc = chtml50->doc;
2967 if (IS_CSS_ON(chtml50->entryp)) {
2968 chxj_css_pop_prop_list(chtml50->css_prop_stack);
2970 return chtml50->out;
2975 * It is a handler who processes the PRE tag.
2977 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2978 * destination is specified.
2979 * @param node [i] The PRE tag node is specified.
2980 * @return The conversion result is returned.
2983 s_chtml50_start_pre_tag(void *pdoc, Node *node)
2985 chtml50_t *chtml50 = GET_CHTML50(pdoc);
2986 Doc *doc = chtml50->doc;
2988 char *attr_style = NULL;
2990 for (attr = qs_get_attr(doc,node);
2992 attr = qs_get_next_attr(doc,attr)) {
2993 char *nm = qs_get_attr_name(doc,attr);
2994 char *val = qs_get_attr_value(doc,attr);
2995 if (val && STRCASEEQ('s','S',"style", nm)) {
3000 if (IS_CSS_ON(chtml50->entryp)) {
3001 s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3004 chtml50->pre_flag++;
3007 return chtml50->out;
3012 * It is a handler who processes the PRE tag.
3014 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3015 * destination is specified.
3016 * @param node [i] The PRE tag node is specified.
3017 * @return The conversion result is returned.
3020 s_chtml50_end_pre_tag(void *pdoc, Node *UNUSED(child))
3022 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3023 Doc *doc = chtml50->doc;
3026 chtml50->pre_flag--;
3027 if (IS_CSS_ON(chtml50->entryp)) {
3028 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3031 return chtml50->out;
3036 * It is a handler who processes the P tag.
3038 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3039 * destination is specified.
3040 * @param node [i] The P tag node is specified.
3041 * @return The conversion result is returned.
3044 s_chtml50_start_p_tag(void *pdoc, Node *node)
3050 char *attr_align = NULL;
3051 char *attr_style = NULL;
3052 char *attr_color = NULL;
3053 char *attr_blink = NULL;
3056 chtml50 = GET_CHTML50(pdoc);
3060 for (attr = qs_get_attr(doc,node);
3062 attr = qs_get_next_attr(doc,attr)) {
3063 char *nm = qs_get_attr_name(doc,attr);
3064 char *val = qs_get_attr_value(doc,attr);
3065 if (STRCASEEQ('a','A',"align", nm)) {
3066 /*----------------------------------------------------------------------*/
3067 /* CHTML 1.0 (W3C version 3.2) */
3068 /*----------------------------------------------------------------------*/
3069 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3070 attr_align = apr_pstrdup(doc->buf.pool, val);
3074 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3075 attr_style = apr_pstrdup(doc->buf.pool, val);
3078 if (IS_CSS_ON(chtml50->entryp)) {
3079 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3081 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3082 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3083 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3084 css_property_t *cur;
3085 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3086 if (STRCASEEQ('l','L',"left",cur->value)) {
3087 attr_align = apr_pstrdup(doc->pool, "left");
3089 else if (STRCASEEQ('c','C',"center",cur->value)) {
3090 attr_align = apr_pstrdup(doc->pool, "center");
3092 else if (STRCASEEQ('r','R',"right",cur->value)) {
3093 attr_align = apr_pstrdup(doc->pool, "right");
3096 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3097 if (cur->value && *cur->value) {
3098 attr_color = apr_pstrdup(doc->pool, cur->value);
3101 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3102 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3103 attr_blink = apr_pstrdup(doc->pool, cur->value);
3116 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
3117 memset(flg, 0, sizeof(*flg));
3119 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3120 W_L("<font color=\"");
3123 flg->with_font_flag = 1;
3127 flg->with_blink_flag = 1;
3129 node->userData = (void *)flg;
3130 return chtml50->out;
3135 * It is a handler who processes the P tag.
3137 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3138 * destination is specified.
3139 * @param node [i] The P tag node is specified.
3140 * @return The conversion result is returned.
3143 s_chtml50_end_p_tag(void *pdoc, Node *node)
3148 chtml50 = GET_CHTML50(pdoc);
3151 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
3152 if (flg->with_font_flag) {
3155 if (flg->with_blink_flag) {
3159 if (IS_CSS_ON(chtml50->entryp)) {
3160 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3163 return chtml50->out;
3168 * It is a handler who processes the OL tag.
3170 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3171 * destination is specified.
3172 * @param node [i] The OL tag node is specified.
3173 * @return The conversion result is returned.
3176 s_chtml50_start_ol_tag(void *pdoc, Node *node)
3182 char *attr_style = NULL;
3183 char *attr_start = NULL;
3184 char *attr_type = NULL;
3186 chtml50 = GET_CHTML50(pdoc);
3190 /*--------------------------------------------------------------------------*/
3191 /* Get Attributes */
3192 /*--------------------------------------------------------------------------*/
3193 for (attr = qs_get_attr(doc,node);
3195 attr = qs_get_next_attr(doc,attr)) {
3196 char *name = qs_get_attr_name(doc,attr);
3197 char *value = qs_get_attr_value(doc,attr);
3198 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
3201 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3204 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3208 if (IS_CSS_ON(chtml50->entryp)) {
3209 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3211 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3212 css_property_t *cur;
3213 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3214 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3215 attr_type = apr_pstrdup(doc->pool, "1");
3217 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3218 attr_type = apr_pstrdup(doc->pool, "A");
3220 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3221 attr_type = apr_pstrdup(doc->pool, "a");
3239 return chtml50->out;
3244 * It is a handler who processes the OL tag.
3246 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3247 * destination is specified.
3248 * @param node [i] The OL tag node is specified.
3249 * @return The conversion result is returned.
3252 s_chtml50_end_ol_tag(void *pdoc, Node *UNUSED(node))
3254 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3255 Doc *doc = chtml50->doc;
3258 if (IS_CSS_ON(chtml50->entryp)) {
3259 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3262 return chtml50->out;
3267 * It is a handler who processes the LI tag.
3269 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3270 * destination is specified.
3271 * @param node [i] The LI tag node is specified.
3272 * @return The conversion result is returned.
3275 s_chtml50_start_li_tag(void *pdoc, Node *node)
3277 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3278 Doc *doc = chtml50->doc;
3280 char *attr_type = NULL;
3281 char *attr_value = NULL;
3282 char *attr_style = NULL;
3284 for (attr = qs_get_attr(doc,node);
3286 attr = qs_get_next_attr(doc,attr)) {
3287 char *name = qs_get_attr_name(doc,attr);
3288 char *value = qs_get_attr_value(doc,attr);
3289 if (STRCASEEQ('t','T',"type",name)) {
3290 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3294 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3297 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3301 if (IS_CSS_ON(chtml50->entryp)) {
3302 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3304 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3305 css_property_t *cur;
3306 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3307 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3308 attr_type = apr_pstrdup(doc->pool, "1");
3310 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3311 attr_type = apr_pstrdup(doc->pool, "A");
3313 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3314 attr_type = apr_pstrdup(doc->pool, "a");
3316 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3317 attr_type = apr_pstrdup(doc->pool, "disc");
3319 else if (STRCASEEQ('s','S',"square", cur->value)) {
3320 attr_type = apr_pstrdup(doc->pool, "square");
3322 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3323 attr_type = apr_pstrdup(doc->pool, "circle");
3341 return chtml50->out;
3346 * It is a handler who processes the LI tag.
3348 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3349 * destination is specified.
3350 * @param node [i] The LI tag node is specified.
3351 * @return The conversion result is returned.
3354 s_chtml50_end_li_tag(void *pdoc, Node *UNUSED(child))
3356 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3358 if (IS_CSS_ON(chtml50->entryp)) {
3359 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3362 return chtml50->out;
3367 * It is a handler who processes the H1 tag.
3369 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3370 * destination is specified.
3371 * @param node [i] The H1 tag node is specified.
3372 * @return The conversion result is returned.
3375 s_chtml50_start_h1_tag(void *pdoc, Node *node)
3381 char *attr_style = NULL;
3382 char *attr_align = NULL;
3384 chtml50 = GET_CHTML50(pdoc);
3388 for (attr = qs_get_attr(doc,node);
3390 attr = qs_get_next_attr(doc,attr)) {
3391 char *name = qs_get_attr_name(doc,attr);
3392 char *value = qs_get_attr_value(doc,attr);
3393 if (STRCASEEQ('a','A',"align", name)) {
3394 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3398 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3402 if (IS_CSS_ON(chtml50->entryp)) {
3403 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3405 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3406 css_property_t *cur;
3407 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3408 if (STRCASEEQ('l','L',"left", cur->value)) {
3409 attr_align = apr_pstrdup(doc->pool, "left");
3411 else if (STRCASEEQ('c','C',"center",cur->value)) {
3412 attr_align = apr_pstrdup(doc->pool, "center");
3414 else if (STRCASEEQ('r','R',"right",cur->value)) {
3415 attr_align = apr_pstrdup(doc->pool, "right");
3428 return chtml50->out;
3433 * It is a handler who processes the H1 tag.
3435 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3436 * destination is specified.
3437 * @param node [i] The H1 tag node is specified.
3438 * @return The conversion result is returned.
3441 s_chtml50_end_h1_tag(void *pdoc, Node *UNUSED(child))
3446 chtml50 = GET_CHTML50(pdoc);
3450 if (IS_CSS_ON(chtml50->entryp)) {
3451 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3454 return chtml50->out;
3459 * It is a handler who processes the H2 tag.
3461 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3462 * destination is specified.
3463 * @param node [i] The H2 tag node is specified.
3464 * @return The conversion result is returned.
3467 s_chtml50_start_h2_tag(void *pdoc, Node *node)
3473 char *attr_style = NULL;
3474 char *attr_align = NULL;
3476 chtml50 = GET_CHTML50(pdoc);
3480 for (attr = qs_get_attr(doc,node);
3482 attr = qs_get_next_attr(doc,attr)) {
3483 char *name = qs_get_attr_name(doc,attr);
3484 char *value = qs_get_attr_value(doc,attr);
3485 if (STRCASEEQ('a','A',"align", name)) {
3486 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3490 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3494 if (IS_CSS_ON(chtml50->entryp)) {
3495 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3497 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3498 css_property_t *cur;
3499 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3500 if (STRCASEEQ('l','L',"left", cur->value)) {
3501 attr_align = apr_pstrdup(doc->pool, "left");
3503 else if (STRCASEEQ('c','C',"center",cur->value)) {
3504 attr_align = apr_pstrdup(doc->pool, "center");
3506 else if (STRCASEEQ('r','R',"right",cur->value)) {
3507 attr_align = apr_pstrdup(doc->pool, "right");
3520 return chtml50->out;
3525 * It is a handler who processes the H2 tag.
3527 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3528 * destination is specified.
3529 * @param node [i] The H2 tag node is specified.
3530 * @return The conversion result is returned.
3533 s_chtml50_end_h2_tag(void *pdoc, Node *UNUSED(child))
3535 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3536 Doc *doc = chtml50->doc;
3539 if (IS_CSS_ON(chtml50->entryp)) {
3540 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3543 return chtml50->out;
3548 * It is a handler who processes the H3 tag.
3550 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3551 * destination is specified.
3552 * @param node [i] The H3 tag node is specified.
3553 * @return The conversion result is returned.
3556 s_chtml50_start_h3_tag(void *pdoc, Node *node)
3562 char *attr_style = NULL;
3563 char *attr_align = NULL;
3565 chtml50 = GET_CHTML50(pdoc);
3569 for (attr = qs_get_attr(doc,node);
3571 attr = qs_get_next_attr(doc,attr)) {
3572 char *name = qs_get_attr_name(doc,attr);
3573 char *value = qs_get_attr_value(doc,attr);
3574 if (STRCASEEQ('a','A',"align", name)) {
3575 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3579 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3583 if (IS_CSS_ON(chtml50->entryp)) {
3584 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3586 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3587 css_property_t *cur;
3588 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3589 if (STRCASEEQ('l','L',"left", cur->value)) {
3590 attr_align = apr_pstrdup(doc->pool, "left");
3592 else if (STRCASEEQ('c','C',"center",cur->value)) {
3593 attr_align = apr_pstrdup(doc->pool, "center");
3595 else if (STRCASEEQ('r','R',"right",cur->value)) {
3596 attr_align = apr_pstrdup(doc->pool, "right");
3609 return chtml50->out;
3614 * It is a handler who processes the H3 tag.
3616 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3617 * destination is specified.
3618 * @param node [i] The H3 tag node is specified.
3619 * @return The conversion result is returned.
3622 s_chtml50_end_h3_tag(void *pdoc, Node *UNUSED(child))
3624 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3625 Doc *doc = chtml50->doc;
3628 if (IS_CSS_ON(chtml50->entryp)) {
3629 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3632 return chtml50->out;
3637 * It is a handler who processes the H4 tag.
3639 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3640 * destination is specified.
3641 * @param node [i] The H4 tag node is specified.
3642 * @return The conversion result is returned.
3645 s_chtml50_start_h4_tag(void *pdoc, Node *node)
3651 char *attr_style = NULL;
3652 char *attr_align = NULL;
3654 chtml50 = GET_CHTML50(pdoc);
3658 for (attr = qs_get_attr(doc,node);
3660 attr = qs_get_next_attr(doc,attr)) {
3661 char *name = qs_get_attr_name(doc,attr);
3662 char *value = qs_get_attr_value(doc,attr);
3663 if (STRCASEEQ('a','A',"align", name)) {
3664 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3668 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3672 if (IS_CSS_ON(chtml50->entryp)) {
3673 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3675 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3676 css_property_t *cur;
3677 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3678 if (STRCASEEQ('l','L',"left", cur->value)) {
3679 attr_align = apr_pstrdup(doc->pool, "left");
3681 else if (STRCASEEQ('c','C',"center",cur->value)) {
3682 attr_align = apr_pstrdup(doc->pool, "center");
3684 else if (STRCASEEQ('r','R',"right",cur->value)) {
3685 attr_align = apr_pstrdup(doc->pool, "right");
3698 return chtml50->out;
3703 * It is a handler who processes the H4 tag.
3705 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3706 * destination is specified.
3707 * @param node [i] The H4 tag node is specified.
3708 * @return The conversion result is returned.
3711 s_chtml50_end_h4_tag(void *pdoc, Node *UNUSED(child))
3713 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3714 Doc *doc = chtml50->doc;
3717 if (IS_CSS_ON(chtml50->entryp)) {
3718 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3721 return chtml50->out;
3726 * It is a handler who processes the H5 tag.
3728 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3729 * destination is specified.
3730 * @param node [i] The H5 tag node is specified.
3731 * @return The conversion result is returned.
3734 s_chtml50_start_h5_tag(void *pdoc, Node *node)
3740 char *attr_style = NULL;
3741 char *attr_align = NULL;
3743 chtml50 = GET_CHTML50(pdoc);
3747 for (attr = qs_get_attr(doc,node);
3749 attr = qs_get_next_attr(doc,attr)) {
3750 char *name = qs_get_attr_name(doc,attr);
3751 char *value = qs_get_attr_value(doc,attr);
3752 if (STRCASEEQ('a','A',"align", name)) {
3753 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3757 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3761 if (IS_CSS_ON(chtml50->entryp)) {
3762 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3764 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3765 css_property_t *cur;
3766 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3767 if (STRCASEEQ('l','L',"left", cur->value)) {
3768 attr_align = apr_pstrdup(doc->pool, "left");
3770 else if (STRCASEEQ('c','C',"center",cur->value)) {
3771 attr_align = apr_pstrdup(doc->pool, "center");
3773 else if (STRCASEEQ('r','R',"right",cur->value)) {
3774 attr_align = apr_pstrdup(doc->pool, "right");
3787 return chtml50->out;
3792 * It is a handler who processes the H5 tag.
3794 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3795 * destination is specified.
3796 * @param node [i] The H5 tag node is specified.
3797 * @return The conversion result is returned.
3800 s_chtml50_end_h5_tag(void *pdoc, Node *UNUSED(child))
3802 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3803 Doc *doc = chtml50->doc;
3806 if (IS_CSS_ON(chtml50->entryp)) {
3807 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3810 return chtml50->out;
3815 * It is a handler who processes the H6 tag.
3817 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3818 * destination is specified.
3819 * @param node [i] The H6 tag node is specified.
3820 * @return The conversion result is returned.
3823 s_chtml50_start_h6_tag(void *pdoc, Node *node)
3829 char *attr_style = NULL;
3830 char *attr_align = NULL;
3832 chtml50 = GET_CHTML50(pdoc);
3836 for (attr = qs_get_attr(doc,node);
3838 attr = qs_get_next_attr(doc,attr)) {
3839 char *name = qs_get_attr_name(doc,attr);
3840 char *value = qs_get_attr_value(doc,attr);
3841 if (STRCASEEQ('a','A',"align", name)) {
3842 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3846 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3850 if (IS_CSS_ON(chtml50->entryp)) {
3851 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
3853 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3854 css_property_t *cur;
3855 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3856 if (STRCASEEQ('l','L',"left", cur->value)) {
3857 attr_align = apr_pstrdup(doc->pool, "left");
3859 else if (STRCASEEQ('c','C',"center",cur->value)) {
3860 attr_align = apr_pstrdup(doc->pool, "center");
3862 else if (STRCASEEQ('r','R',"right",cur->value)) {
3863 attr_align = apr_pstrdup(doc->pool, "right");
3876 return chtml50->out;
3881 * It is a handler who processes the H6 tag.
3883 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3884 * destination is specified.
3885 * @param node [i] The H6 tag node is specified.
3886 * @return The conversion result is returned.
3889 s_chtml50_end_h6_tag(void *pdoc, Node *UNUSED(child))
3891 chtml50_t *chtml50 = GET_CHTML50(pdoc);
3892 Doc *doc = chtml50->doc;
3895 if (IS_CSS_ON(chtml50->entryp)) {
3896 chxj_css_pop_prop_list(chtml50->css_prop_stack);
3899 return chtml50->out;
3904 * It is a handler who processes the TEXTARE tag.
3906 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3907 * destination is specified.
3908 * @param node [i] The TEXTAREA tag node is specified.
3909 * @return The conversion result is returned.
3912 s_chtml50_start_textarea_tag(void *pdoc, Node *node)
3918 char *attr_accesskey = NULL;
3919 char *attr_name = NULL;
3920 char *attr_rows = NULL;
3921 char *attr_cols = NULL;
3922 char *attr_istyle = NULL;
3923 char *attr_style = NULL;
3925 chtml50 = GET_CHTML50(pdoc);
3929 chtml50->textarea_flag++;
3931 for (attr = qs_get_attr(doc,node);
3933 attr = qs_get_next_attr(doc,attr)) {
3934 char *name = qs_get_attr_name(doc,attr);
3935 char *value = qs_get_attr_value(doc,attr);
3936 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3937 attr_accesskey = value;
3939 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3940 attr_istyle = value;
3942 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3945 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3948 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3951 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3955 if (IS_CSS_ON(chtml50->entryp)) {
3956 css_prop_list_t *style = s_chtml50_nopush_and_get_now_style(pdoc, node, attr_style);
3958 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3959 css_property_t *cur;
3960 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3961 if (strcasestr(cur->value, "<ja:n>")) {
3964 else if (strcasestr(cur->value, "<ja:en>")) {
3967 else if (strcasestr(cur->value, "<ja:hk>")) {
3970 else if (strcasestr(cur->value, "<ja:h>")) {
3977 if (attr_accesskey) {
3978 W_L(" accesskey=\"");
3979 W_V(attr_accesskey);
4003 return chtml50->out;
4008 * It is a handler who processes the TEXTAREA tag.
4010 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4011 * destination is specified.
4012 * @param node [i] The TEXTAREA tag node is specified.
4013 * @return The conversion result is returned.
4016 s_chtml50_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4018 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4019 Doc *doc = chtml50->doc;
4022 chtml50->textarea_flag--;
4024 return chtml50->out;
4029 s_chtml50_chxjif_tag(void *pdoc, Node *node)
4036 chtml50 = GET_CHTML50(pdoc);
4040 for (child = qs_get_child_node(doc, node);
4042 child = qs_get_next_node(doc, child)) {
4044 s_chtml50_chxjif_tag(chtml50, child);
4052 s_chtml50_text_tag(void *pdoc, Node *child)
4064 apr_size_t z2h_input_len;
4066 chtml50 = GET_CHTML50(pdoc);
4070 textval = qs_get_node_value(doc,child);
4071 if (strlen(textval) == 0) {
4072 return chtml50->out;
4075 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4076 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4078 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4079 memset(one_byte, 0, sizeof(one_byte));
4082 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4084 int rtn = s_chtml50_search_emoji(chtml50, &textval[ii], &out);
4086 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4091 if (is_sjis_kanji(textval[ii])) {
4092 one_byte[0] = textval[ii+0];
4093 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4094 one_byte[0] = textval[ii+1];
4095 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4098 else if (chtml50->pre_flag) {
4099 one_byte[0] = textval[ii+0];
4100 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4102 else if (chtml50->textarea_flag) {
4103 one_byte[0] = textval[ii+0];
4104 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4106 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4107 one_byte[0] = textval[ii+0];
4108 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4111 z2h_input_len = strlen(tdst);
4112 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml50->entryp);
4114 return chtml50->out;
4119 * It is a handler who processes the BLOCKQUOTE tag.
4121 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4122 * destination is specified.
4123 * @param node [i] The BLOCKQUOTE tag node is specified.
4124 * @return The conversion result is returned.
4127 s_chtml50_start_blockquote_tag(void *pdoc, Node *node)
4132 char *attr_style = NULL;
4133 char *attr_color = NULL;
4134 char *attr_size = NULL;
4136 chtml50 = GET_CHTML50(pdoc);
4138 for (attr = qs_get_attr(doc,node);
4140 attr = qs_get_next_attr(doc,attr)) {
4141 char *nm = qs_get_attr_name(doc,attr);
4142 char *val = qs_get_attr_value(doc,attr);
4143 if (val && STRCASEEQ('s','S',"style", nm)) {
4147 if (IS_CSS_ON(chtml50->entryp)) {
4148 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4150 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4151 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4152 css_property_t *cur;
4153 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4154 if (cur->value && *cur->value) {
4155 attr_color = apr_pstrdup(doc->pool, cur->value);
4158 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4159 if (cur->value && *cur->value) {
4160 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4161 attr_size = apr_pstrdup(doc->pool, "1");
4163 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4164 attr_size = apr_pstrdup(doc->pool, "2");
4166 else if (STRCASEEQ('s','S',"small",cur->value)) {
4167 attr_size = apr_pstrdup(doc->pool, "3");
4169 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4170 attr_size = apr_pstrdup(doc->pool, "4");
4172 else if (STRCASEEQ('l','L',"large",cur->value)) {
4173 attr_size = apr_pstrdup(doc->pool, "5");
4175 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4176 attr_size = apr_pstrdup(doc->pool, "6");
4178 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4179 attr_size = apr_pstrdup(doc->pool, "7");
4185 W_L("<blockquote>");
4186 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4187 memset(flg, 0, sizeof(*flg));
4188 if (attr_color || attr_size) {
4191 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4202 flg->with_font_flag = 1;
4204 node->userData = (void *)flg;
4205 return chtml50->out;
4210 * It is a handler who processes the BLOCKQUOTE tag.
4212 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4213 * destination is specified.
4214 * @param node [i] The BLOCKQUOTE tag node is specified.
4215 * @return The conversion result is returned.
4218 s_chtml50_end_blockquote_tag(void *pdoc, Node *node)
4220 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4221 Doc *doc = chtml50->doc;
4222 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4223 if (flg && flg->with_font_flag) {
4226 W_L("</blockquote>");
4227 if (IS_CSS_ON(chtml50->entryp)) {
4228 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4230 return chtml50->out;
4235 * It is a handler who processes the DIR tag.
4237 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4238 * destination is specified.
4239 * @param node [i] The DIR tag node is specified.
4240 * @return The conversion result is returned.
4243 s_chtml50_start_dir_tag(void *pdoc, Node *node)
4245 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4246 Doc *doc = chtml50->doc;
4248 char *attr_style = NULL;
4249 char *attr_color = NULL;
4250 char *attr_type = NULL;
4251 char *attr_size = NULL;
4252 for (attr = qs_get_attr(doc,node);
4254 attr = qs_get_next_attr(doc,attr)) {
4255 char *name = qs_get_attr_name(doc,attr);
4256 char *value = qs_get_attr_value(doc,attr);
4257 if (STRCASEEQ('t','T',"type",name)) {
4258 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4262 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4266 if (IS_CSS_ON(chtml50->entryp)) {
4267 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4269 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4270 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4271 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4272 css_property_t *cur;
4273 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4274 if (cur->value && *cur->value) {
4275 attr_color = apr_pstrdup(doc->pool, cur->value);
4278 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4279 if (cur->value && *cur->value) {
4280 attr_type = apr_pstrdup(doc->pool, cur->value);
4283 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4284 if (cur->value && *cur->value) {
4285 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4286 attr_size = apr_pstrdup(doc->pool, "1");
4288 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4289 attr_size = apr_pstrdup(doc->pool, "2");
4291 else if (STRCASEEQ('s','S',"small",cur->value)) {
4292 attr_size = apr_pstrdup(doc->pool, "3");
4294 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4295 attr_size = apr_pstrdup(doc->pool, "4");
4297 else if (STRCASEEQ('l','L',"large",cur->value)) {
4298 attr_size = apr_pstrdup(doc->pool, "5");
4300 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4301 attr_size = apr_pstrdup(doc->pool, "6");
4303 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4304 attr_size = apr_pstrdup(doc->pool, "7");
4317 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4318 memset(flg, 0, sizeof(*flg));
4319 if (attr_color || attr_size) {
4322 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4333 flg->with_font_flag = 1;
4335 node->userData = (void *)flg;
4336 return chtml50->out;
4341 * It is a handler who processes the DIR tag.
4343 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4344 * destination is specified.
4345 * @param node [i] The DIR tag node is specified.
4346 * @return The conversion result is returned.
4349 s_chtml50_end_dir_tag(void *pdoc, Node *node)
4351 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4352 Doc *doc = chtml50->doc;
4353 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4354 if (flg && flg->with_font_flag) {
4358 if (IS_CSS_ON(chtml50->entryp)) {
4359 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4361 return chtml50->out;
4366 * It is a handler who processes the DL tag.
4368 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4369 * destination is specified.
4370 * @param node [i] The DL tag node is specified.
4371 * @return The conversion result is returned.
4374 s_chtml50_start_dl_tag(void *pdoc, Node *node)
4376 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4377 Doc *doc = chtml50->doc;
4379 char *attr_style = NULL;
4380 char *attr_color = NULL;
4381 char *attr_size = NULL;
4382 for (attr = qs_get_attr(doc,node);
4384 attr = qs_get_next_attr(doc,attr)) {
4385 char *name = qs_get_attr_name(doc,attr);
4386 char *value = qs_get_attr_value(doc,attr);
4387 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4391 if (IS_CSS_ON(chtml50->entryp)) {
4392 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4394 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4395 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4396 css_property_t *cur;
4397 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4398 if (cur->value && *cur->value) {
4399 attr_color = apr_pstrdup(doc->pool, cur->value);
4402 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4403 if (cur->value && *cur->value) {
4404 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4405 attr_size = apr_pstrdup(doc->pool, "1");
4407 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4408 attr_size = apr_pstrdup(doc->pool, "2");
4410 else if (STRCASEEQ('s','S',"small",cur->value)) {
4411 attr_size = apr_pstrdup(doc->pool, "3");
4413 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4414 attr_size = apr_pstrdup(doc->pool, "4");
4416 else if (STRCASEEQ('l','L',"large",cur->value)) {
4417 attr_size = apr_pstrdup(doc->pool, "5");
4419 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4420 attr_size = apr_pstrdup(doc->pool, "6");
4422 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4423 attr_size = apr_pstrdup(doc->pool, "7");
4430 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4431 memset(flg, 0, sizeof(*flg));
4432 if (attr_color || attr_size) {
4435 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4446 flg->with_font_flag = 1;
4448 node->userData = (void *)flg;
4449 return chtml50->out;
4454 * It is a handler who processes the DL tag.
4456 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4457 * destination is specified.
4458 * @param node [i] The DL tag node is specified.
4459 * @return The conversion result is returned.
4462 s_chtml50_end_dl_tag(void *pdoc, Node *node)
4464 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4465 Doc *doc = chtml50->doc;
4466 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4467 if (flg && flg->with_font_flag) {
4471 if (IS_CSS_ON(chtml50->entryp)) {
4472 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4474 return chtml50->out;
4479 * It is a handler who processes the DT tag.
4481 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4482 * destination is specified.
4483 * @param node [i] The DT tag node is specified.
4484 * @return The conversion result is returned.
4487 s_chtml50_start_dt_tag(void *pdoc, Node *node)
4489 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4490 Doc *doc = chtml50->doc;
4492 char *attr_style = NULL;
4493 char *attr_color = NULL;
4494 char *attr_size = NULL;
4495 for (attr = qs_get_attr(doc,node);
4497 attr = qs_get_next_attr(doc,attr)) {
4498 char *name = qs_get_attr_name(doc,attr);
4499 char *value = qs_get_attr_value(doc,attr);
4500 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4504 if (IS_CSS_ON(chtml50->entryp)) {
4505 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4507 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4508 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4509 css_property_t *cur;
4510 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4511 if (cur->value && *cur->value) {
4512 attr_color = apr_pstrdup(doc->pool, cur->value);
4515 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4516 if (cur->value && *cur->value) {
4517 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4518 attr_size = apr_pstrdup(doc->pool, "1");
4520 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4521 attr_size = apr_pstrdup(doc->pool, "2");
4523 else if (STRCASEEQ('s','S',"small",cur->value)) {
4524 attr_size = apr_pstrdup(doc->pool, "3");
4526 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4527 attr_size = apr_pstrdup(doc->pool, "4");
4529 else if (STRCASEEQ('l','L',"large",cur->value)) {
4530 attr_size = apr_pstrdup(doc->pool, "5");
4532 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4533 attr_size = apr_pstrdup(doc->pool, "6");
4535 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4536 attr_size = apr_pstrdup(doc->pool, "7");
4543 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4544 memset(flg, 0, sizeof(*flg));
4545 if (attr_color || attr_size) {
4548 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4559 flg->with_font_flag = 1;
4561 node->userData = (void *)flg;
4562 return chtml50->out;
4567 * It is a handler who processes the DT tag.
4569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4570 * destination is specified.
4571 * @param node [i] The DT tag node is specified.
4572 * @return The conversion result is returned.
4575 s_chtml50_end_dt_tag(void *pdoc, Node *node)
4577 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4578 Doc *doc = chtml50->doc;
4580 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4581 if (flg && flg->with_font_flag) {
4584 if (IS_CSS_ON(chtml50->entryp)) {
4585 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4588 return chtml50->out;
4593 * It is a handler who processes the DD tag.
4595 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4596 * destination is specified.
4597 * @param node [i] The DD tag node is specified.
4598 * @return The conversion result is returned.
4601 s_chtml50_start_dd_tag(void *pdoc, Node *node)
4603 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4604 Doc *doc = chtml50->doc;
4606 char *attr_style = NULL;
4607 char *attr_color = NULL;
4608 char *attr_size = NULL;
4609 for (attr = qs_get_attr(doc,node);
4611 attr = qs_get_next_attr(doc,attr)) {
4612 char *name = qs_get_attr_name(doc,attr);
4613 char *value = qs_get_attr_value(doc,attr);
4614 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4618 if (IS_CSS_ON(chtml50->entryp)) {
4619 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4621 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4622 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4623 css_property_t *cur;
4624 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4625 if (cur->value && *cur->value) {
4626 attr_color = apr_pstrdup(doc->pool, cur->value);
4629 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4630 if (cur->value && *cur->value) {
4631 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4632 attr_size = apr_pstrdup(doc->pool, "1");
4634 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4635 attr_size = apr_pstrdup(doc->pool, "2");
4637 else if (STRCASEEQ('s','S',"small",cur->value)) {
4638 attr_size = apr_pstrdup(doc->pool, "3");
4640 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4641 attr_size = apr_pstrdup(doc->pool, "4");
4643 else if (STRCASEEQ('l','L',"large",cur->value)) {
4644 attr_size = apr_pstrdup(doc->pool, "5");
4646 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4647 attr_size = apr_pstrdup(doc->pool, "6");
4649 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4650 attr_size = apr_pstrdup(doc->pool, "7");
4657 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4658 memset(flg, 0, sizeof(*flg));
4659 if (attr_color || attr_size) {
4662 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4673 flg->with_font_flag = 1;
4675 node->userData = (void *)flg;
4676 return chtml50->out;
4681 * It is a handler who processes the DD tag.
4683 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4684 * destination is specified.
4685 * @param node [i] The DD tag node is specified.
4686 * @return The conversion result is returned.
4689 s_chtml50_end_dd_tag(void *pdoc, Node *node)
4691 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4692 Doc *doc = chtml50->doc;
4694 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4695 if (flg && flg->with_font_flag) {
4698 if (IS_CSS_ON(chtml50->entryp)) {
4699 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4701 return chtml50->out;
4706 * It is a handler who processes the MARQUEE tag.
4708 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4709 * destination is specified.
4710 * @param node [i] The MARQUEE tag node is specified.
4711 * @return The conversion result is returned.
4714 s_chtml50_start_marquee_tag(void *pdoc, Node *node)
4716 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4717 Doc *doc = chtml50->doc;
4719 char *attr_direction = NULL;
4720 char *attr_behavior = NULL;
4721 char *attr_loop = NULL;
4722 char *attr_style = NULL;
4723 char *attr_color = NULL;
4724 char *attr_size = NULL;
4725 char *attr_bgcolor = NULL;
4726 /*--------------------------------------------------------------------------*/
4727 /* Get Attributes */
4728 /*--------------------------------------------------------------------------*/
4729 for (attr = qs_get_attr(doc,node);
4731 attr = qs_get_next_attr(doc,attr)) {
4732 char *name = qs_get_attr_name(doc,attr);
4733 char *value = qs_get_attr_value(doc,attr);
4734 if (STRCASEEQ('d','D',"direction", name)) {
4735 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4736 attr_direction = value;
4739 else if (STRCASEEQ('b','B',"behavior",name)) {
4740 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4741 attr_behavior = value;
4744 else if (STRCASEEQ('l','L',"loop",name)) {
4745 if (value && *value) {
4749 else if (STRCASEEQ('b','B',"bgcolor",name)) {
4750 if (value && *value) {
4751 attr_bgcolor = value;
4754 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4758 if (IS_CSS_ON(chtml50->entryp)) {
4759 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4761 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4762 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4763 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
4764 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4765 css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4766 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4767 css_property_t *cur;
4768 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4769 if (cur->value && *cur->value) {
4770 attr_color = apr_pstrdup(doc->pool, cur->value);
4773 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
4774 if (cur->value && *cur->value) {
4775 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4778 for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
4779 if (cur->value && *cur->value) {
4780 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4783 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4784 if (cur->value && *cur->value) {
4785 attr_loop = apr_pstrdup(doc->pool, cur->value);
4786 if (STRCASEEQ('i','I',"infinite",attr_loop)) {
4791 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4792 if (cur->value && *cur->value) {
4793 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4794 attr_direction = "right";
4796 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4797 attr_direction = "left";
4801 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4802 if (cur->value && *cur->value) {
4803 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4804 attr_size = apr_pstrdup(doc->pool, "1");
4806 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4807 attr_size = apr_pstrdup(doc->pool, "2");
4809 else if (STRCASEEQ('s','S',"small",cur->value)) {
4810 attr_size = apr_pstrdup(doc->pool, "3");
4812 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4813 attr_size = apr_pstrdup(doc->pool, "4");
4815 else if (STRCASEEQ('l','L',"large",cur->value)) {
4816 attr_size = apr_pstrdup(doc->pool, "5");
4818 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4819 attr_size = apr_pstrdup(doc->pool, "6");
4821 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4822 attr_size = apr_pstrdup(doc->pool, "7");
4829 if (attr_direction) {
4830 W_L(" direction=\"");
4831 W_V(attr_direction);
4834 if (attr_behavior) {
4835 W_L(" behavior=\"");
4845 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4852 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4853 memset(flg, 0, sizeof(*flg));
4854 if (attr_color || attr_size) {
4857 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4868 flg->with_font_flag = 1;
4870 node->userData = (void *)flg;
4871 return chtml50->out;
4876 * It is a handler who processes the MARQUEE tag.
4878 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4879 * destination is specified.
4880 * @param node [i] The MARQUEE tag node is specified.
4881 * @return The conversion result is returned.
4884 s_chtml50_end_marquee_tag(void *pdoc, Node *node)
4886 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4887 Doc *doc = chtml50->doc;
4889 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
4890 if (flg && flg->with_font_flag) {
4894 if (IS_CSS_ON(chtml50->entryp)) {
4895 chxj_css_pop_prop_list(chtml50->css_prop_stack);
4897 return chtml50->out;
4902 * It is a handler who processes the BLINK tag.
4904 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4905 * destination is specified.
4906 * @param node [i] The BLINK tag node is specified.
4907 * @return The conversion result is returned.
4910 s_chtml50_start_blink_tag(void *pdoc, Node *node)
4912 chtml50_t *chtml50 = GET_CHTML50(pdoc);
4913 Doc *doc = chtml50->doc;
4915 char *attr_style = NULL;
4916 char *attr_color = NULL;
4917 char *attr_size = NULL;
4918 for (attr = qs_get_attr(doc,node);
4920 attr = qs_get_next_attr(doc,attr)) {
4921 char *name = qs_get_attr_name(doc,attr);
4922 char *value = qs_get_attr_value(doc,attr);
4923 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4927 if (IS_CSS_ON(chtml50->entryp)) {
4928 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
4930 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4931 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4932 css_property_t *cur;
4933 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4934 if (cur->value && *cur->value) {
4935 attr_color = apr_pstrdup(doc->pool, cur->value);
4938 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4939 if (cur->value && *cur->value) {
4940 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4941 attr_size = apr_pstrdup(doc->pool, "1");
4943 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4944 attr_size = apr_pstrdup(doc->pool, "2");
4946 else if (STRCASEEQ('s','S',"small",cur->value)) {
4947 attr_size = apr_pstrdup(doc->pool, "3");
4949 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4950 attr_size = apr_pstrdup(doc->pool, "4");
4952 else if (STRCASEEQ('l','L',"large",cur->value)) {
4953 attr_size = apr_pstrdup(doc->pool, "5");
4955 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4956 attr_size = apr_pstrdup(doc->pool, "6");
4958 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4959 attr_size = apr_pstrdup(doc->pool, "7");
4966 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
4967 memset(flg, 0, sizeof(*flg));
4968 if (attr_color || attr_size) {
4971 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4982 flg->with_font_flag = 1;
4984 node->userData = (void *)flg;
4985 return chtml50->out;
4990 * It is a handler who processes the BLINK tag.
4992 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4993 * destination is specified.
4994 * @param node [i] The BLINK tag node is specified.
4995 * @return The conversion result is returned.
4998 s_chtml50_end_blink_tag(void *pdoc, Node *node)
5000 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5001 Doc *doc = chtml50->doc;
5003 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5004 if (flg && flg->with_font_flag) {
5008 if (IS_CSS_ON(chtml50->entryp)) {
5009 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5011 return chtml50->out;
5016 * It is a handler who processes the MENU tag.
5018 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5019 * destination is specified.
5020 * @param node [i] The MENU tag node is specified.
5021 * @return The conversion result is returned.
5024 s_chtml50_start_menu_tag(void *pdoc, Node *node)
5026 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5027 Doc *doc = chtml50->doc;
5029 char *attr_style = NULL;
5030 char *attr_color = NULL;
5031 char *attr_type = NULL;
5032 char *attr_size = NULL;
5033 for (attr = qs_get_attr(doc,node);
5035 attr = qs_get_next_attr(doc,attr)) {
5036 char *name = qs_get_attr_name(doc,attr);
5037 char *value = qs_get_attr_value(doc,attr);
5038 if (STRCASEEQ('t','T',"type",name)) {
5039 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5043 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5047 if (IS_CSS_ON(chtml50->entryp)) {
5048 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
5050 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5051 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5052 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5053 css_property_t *cur;
5054 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5055 if (cur->value && *cur->value) {
5056 attr_color = apr_pstrdup(doc->pool, cur->value);
5059 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5060 if (cur->value && *cur->value) {
5061 attr_type = apr_pstrdup(doc->pool, cur->value);
5064 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5065 if (cur->value && *cur->value) {
5066 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5067 attr_size = apr_pstrdup(doc->pool, "1");
5069 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5070 attr_size = apr_pstrdup(doc->pool, "2");
5072 else if (STRCASEEQ('s','S',"small",cur->value)) {
5073 attr_size = apr_pstrdup(doc->pool, "3");
5075 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5076 attr_size = apr_pstrdup(doc->pool, "4");
5078 else if (STRCASEEQ('l','L',"large",cur->value)) {
5079 attr_size = apr_pstrdup(doc->pool, "5");
5081 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5082 attr_size = apr_pstrdup(doc->pool, "6");
5084 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5085 attr_size = apr_pstrdup(doc->pool, "7");
5098 chtml50_flags_t *flg = (chtml50_flags_t *)apr_palloc(doc->pool, sizeof(chtml50_flags_t));
5099 memset(flg, 0, sizeof(*flg));
5100 if (attr_color || attr_size) {
5103 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5114 flg->with_font_flag = 1;
5116 node->userData = (void *)flg;
5117 return chtml50->out;
5122 * It is a handler who processes the MENU tag.
5124 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5125 * destination is specified.
5126 * @param node [i] The MENU tag node is specified.
5127 * @return The conversion result is returned.
5130 s_chtml50_end_menu_tag(void *pdoc, Node *node)
5132 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5133 Doc *doc = chtml50->doc;
5134 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5135 if (flg && flg->with_font_flag) {
5139 if (IS_CSS_ON(chtml50->entryp)) {
5140 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5142 return chtml50->out;
5147 * It is a handler who processes the PLAINTEXT tag.
5149 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5150 * destination is specified.
5151 * @param node [i] The PLAINTEXT tag node is specified.
5152 * @return The conversion result is returned.
5155 s_chtml50_start_plaintext_tag(void *pdoc, Node *node)
5157 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5158 Doc *doc = chtml50->doc;
5160 s_chtml50_start_plaintext_tag_inner(pdoc,node);
5161 return chtml50->out;
5165 s_chtml50_start_plaintext_tag_inner(void *pdoc, Node *node)
5167 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5168 Doc *doc = chtml50->doc;
5170 for (child = qs_get_child_node(doc, node);
5172 child = qs_get_next_node(doc, child)) {
5174 s_chtml50_start_plaintext_tag_inner(pdoc, child);
5176 return chtml50->out;
5181 * It is a handler who processes the PLAINTEXT tag.
5183 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5184 * destination is specified.
5185 * @param node [i] The PLAINTEXT tag node is specified.
5186 * @return The conversion result is returned.
5189 s_chtml50_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5191 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5192 return chtml50->out;
5197 * It is handler who processes the New Line Code.
5200 s_chtml50_newline_mark(void *pdoc, Node *UNUSED(node))
5202 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5203 Doc *doc = chtml50->doc;
5205 return chtml50->out;
5210 * It is a handler who processes the LINK tag.
5212 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5213 * destination is specified.
5214 * @param node [i] The LINK tag node is specified.
5215 * @return The conversion result is returned.
5218 s_chtml50_link_tag(void *pdoc, Node *node)
5227 chtml50 = GET_CHTML50(pdoc);
5230 if (! IS_CSS_ON(chtml50->entryp)) {
5231 return chtml50->out;
5234 for (attr = qs_get_attr(doc,node);
5236 attr = qs_get_next_attr(doc,attr)) {
5237 char *name = qs_get_attr_name(doc,attr);
5238 char *value = qs_get_attr_value(doc,attr);
5239 if (STRCASEEQ('r','R',"rel", name)) {
5240 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5244 else if (STRCASEEQ('h','H',"href", name)) {
5245 if (value && *value) {
5249 else if (STRCASEEQ('t','T',"type", name)) {
5250 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5256 if (rel && href && type) {
5257 DBG(doc->r, "start load CSS. url:[%s]", href);
5258 chtml50->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml50->style, href);
5259 DBG(doc->r, "end load CSS. url:[%s]", href);
5262 return chtml50->out;
5266 static css_prop_list_t *
5267 s_chtml50_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5269 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5270 Doc *doc = chtml50->doc;
5271 css_prop_list_t *last_css = NULL;
5272 if (IS_CSS_ON(chtml50->entryp)) {
5273 css_prop_list_t *dup_css;
5274 css_selector_t *selector;
5276 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5277 dup_css = chxj_dup_css_prop_list(doc, last_css);
5278 selector = chxj_css_find_selector(doc, chtml50->style, node);
5280 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5282 chxj_css_push_prop_list(chtml50->css_prop_stack, dup_css);
5283 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5285 if (style_attr_value) {
5286 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));
5288 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5296 static css_prop_list_t *
5297 s_chtml50_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5299 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5300 Doc *doc = chtml50->doc;
5301 css_prop_list_t *last_css = NULL;
5302 if (IS_CSS_ON(chtml50->entryp)) {
5303 css_prop_list_t *dup_css;
5304 css_selector_t *selector;
5306 last_css = chxj_css_get_last_prop_list(chtml50->css_prop_stack);
5307 dup_css = chxj_dup_css_prop_list(doc, last_css);
5308 selector = chxj_css_find_selector(doc, chtml50->style, node);
5310 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5314 if (style_attr_value) {
5315 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));
5317 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5327 * It is a handler who processes the SPAN tag.
5329 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5330 * destination is specified.
5331 * @param node [i] The SPAN tag node is specified.
5332 * @return The conversion result is returned.
5335 s_chtml50_start_span_tag(void *pdoc, Node *node)
5340 char *attr_style = NULL;
5341 char *attr_color = NULL;
5342 char *attr_size = NULL;
5343 char *attr_align = NULL;
5344 char *attr_blink = NULL;
5345 char *attr_marquee = NULL;
5346 char *attr_marquee_dir = NULL;
5347 char *attr_marquee_style = NULL;
5348 char *attr_marquee_loop = NULL;
5350 chtml50 = GET_CHTML50(pdoc);
5353 for (attr = qs_get_attr(doc,node);
5355 attr = qs_get_next_attr(doc,attr)) {
5356 char *nm = qs_get_attr_name(doc,attr);
5357 char *val = qs_get_attr_value(doc,attr);
5358 if (val && STRCASEEQ('s','S',"style", nm)) {
5362 if (IS_CSS_ON(chtml50->entryp)) {
5363 css_prop_list_t *style = s_chtml50_push_and_get_now_style(pdoc, node, attr_style);
5365 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5366 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5367 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5368 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5369 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5370 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5371 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5372 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5373 css_property_t *cur;
5374 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5375 attr_color = apr_pstrdup(doc->pool, cur->value);
5377 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5378 if (cur->value && *cur->value) {
5379 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5380 attr_size = apr_pstrdup(doc->pool, "1");
5382 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5383 attr_size = apr_pstrdup(doc->pool, "2");
5385 else if (STRCASEEQ('s','S',"small",cur->value)) {
5386 attr_size = apr_pstrdup(doc->pool, "3");
5388 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5389 attr_size = apr_pstrdup(doc->pool, "4");
5391 else if (STRCASEEQ('l','L',"large",cur->value)) {
5392 attr_size = apr_pstrdup(doc->pool, "5");
5394 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5395 attr_size = apr_pstrdup(doc->pool, "6");
5397 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5398 attr_size = apr_pstrdup(doc->pool, "7");
5402 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5403 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5404 attr_blink = apr_pstrdup(doc->pool, cur->value);
5407 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5408 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5409 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5412 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5413 if (cur->value && *cur->value) {
5414 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5415 attr_marquee_dir = "right";
5417 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5418 attr_marquee_dir = "left";
5422 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5423 if (cur->value && *cur->value) {
5424 if ( STRCASEEQ('s','S',"scroll",cur->value)
5425 || STRCASEEQ('s','S',"slide",cur->value)
5426 || STRCASEEQ('a','A',"alternate",cur->value)) {
5427 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5431 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5432 if (cur->value && *cur->value) {
5433 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5434 attr_marquee_loop = "16";
5437 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5441 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5442 if (STRCASEEQ('l','L',"left", cur->value)) {
5443 attr_align = apr_pstrdup(doc->pool, "left");
5445 else if (STRCASEEQ('c','C',"center",cur->value)) {
5446 attr_align = apr_pstrdup(doc->pool, "center");
5448 else if (STRCASEEQ('r','R',"right",cur->value)) {
5449 attr_align = apr_pstrdup(doc->pool, "right");
5454 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5455 chtml50_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5456 memset(flg, 0, sizeof(*flg));
5459 flg->with_blink_flag = 1;
5463 if (attr_marquee_dir) {
5464 W_L(" direction=\"");
5465 W_V(attr_marquee_dir);
5468 if (attr_marquee_style) {
5469 W_L(" behavior=\"");
5470 W_V(attr_marquee_style);
5473 if (attr_marquee_loop) {
5475 W_V(attr_marquee_loop);
5479 flg->with_marquee_flag = 1;
5481 if (attr_color||attr_size) {
5484 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5495 flg->with_font_flag = 1;
5498 W_L("<div align=\"");
5501 flg->with_div_flag = 1;
5503 node->userData = flg;
5506 node->userData = NULL;
5508 return chtml50->out;
5513 * It is a handler who processes the SPAN tag.
5515 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5516 * destination is specified.
5517 * @param node [i] The SPAN tag node is specified.
5518 * @return The conversion result is returned.
5521 s_chtml50_end_span_tag(void *pdoc, Node *node)
5523 chtml50_t *chtml50 = GET_CHTML50(pdoc);
5524 Doc *doc = chtml50->doc;
5526 chtml50_flags_t *flg = (chtml50_flags_t *)node->userData;
5527 if (flg && flg->with_div_flag) {
5530 if (flg && flg->with_font_flag) {
5533 if (flg && flg->with_marquee_flag) {
5536 if (flg && flg->with_blink_flag) {
5539 if (IS_CSS_ON(chtml50->entryp)) {
5540 chxj_css_pop_prop_list(chtml50->css_prop_stack);
5542 return chtml50->out;
5547 * It is a handler who processes the STYLE tag.
5549 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5550 * destination is specified.
5551 * @param node [i] The STYLE tag node is specified.
5552 * @return The conversion result is returned.
5555 s_chtml50_style_tag(void *pdoc, Node *node)
5562 chtml50 = GET_CHTML50(pdoc);
5565 if (! IS_CSS_ON(chtml50->entryp)) {
5566 return chtml50->out;
5569 for (attr = qs_get_attr(doc,node);
5571 attr = qs_get_next_attr(doc,attr)) {
5572 char *name = qs_get_attr_name(doc,attr);
5573 char *value = qs_get_attr_value(doc,attr);
5574 if (STRCASEEQ('t','T',"type", name)) {
5575 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5581 Node *child = qs_get_child_node(doc, node);
5582 if (type && child) {
5583 char *name = qs_get_node_name(doc, child);
5584 if (STRCASEEQ('t','T',"text", name)) {
5585 char *value = qs_get_node_value(doc, child);
5586 DBG(doc->r, "start load CSS. buf:[%s]", value);
5587 chtml50->style = chxj_css_parse_style_value(doc, chtml50->style, value);
5588 DBG(doc->r, "end load CSS. value:[%s]", value);
5591 return chtml50->out;