2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_chtml40.h"
19 #include "chxj_hdml.h"
20 #include "chxj_str_util.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
26 #define GET_CHTML40(X) ((chtml40_t *)(X))
29 #define W_L(X) do { chtml40->out = BUFFERED_WRITE_LITERAL(chtml40->out, &doc->buf, (X)); } while(0)
30 #define W_V(X) do { chtml40->out = (X) ? BUFFERED_WRITE_VALUE(chtml40->out, &doc->buf, (X)) \
31 : BUFFERED_WRITE_LITERAL(chtml40->out, &doc->buf, ""); } while(0)
33 #define W_NLCODE() do { char *nlcode = TO_NLCODE(chtml40->conf); W_V(nlcode); } while (0)
35 static char *s_chtml40_start_html_tag (void *pdoc, Node *node);
36 static char *s_chtml40_end_html_tag (void *pdoc, Node *node);
37 static char *s_chtml40_start_meta_tag (void *pdoc, Node *node);
38 static char *s_chtml40_end_meta_tag (void *pdoc, Node *node);
39 static char *s_chtml40_start_textarea_tag (void *pdoc, Node *node);
40 static char *s_chtml40_end_textarea_tag (void *pdoc, Node *node);
41 static char *s_chtml40_start_p_tag (void *pdoc, Node *node);
42 static char *s_chtml40_end_p_tag (void *pdoc, Node *node);
43 static char *s_chtml40_start_pre_tag (void *pdoc, Node *node);
44 static char *s_chtml40_end_pre_tag (void *pdoc, Node *node);
45 static char *s_chtml40_start_h1_tag (void *pdoc, Node *node);
46 static char *s_chtml40_end_h1_tag (void *pdoc, Node *node);
47 static char *s_chtml40_start_h2_tag (void *pdoc, Node *node);
48 static char *s_chtml40_end_h2_tag (void *pdoc, Node *node);
49 static char *s_chtml40_start_h3_tag (void *pdoc, Node *node);
50 static char *s_chtml40_end_h3_tag (void *pdoc, Node *node);
51 static char *s_chtml40_start_h4_tag (void *pdoc, Node *node);
52 static char *s_chtml40_end_h4_tag (void *pdoc, Node *node);
53 static char *s_chtml40_start_h5_tag (void *pdoc, Node *node);
54 static char *s_chtml40_end_h5_tag (void *pdoc, Node *node);
55 static char *s_chtml40_start_h6_tag (void *pdoc, Node *node);
56 static char *s_chtml40_end_h6_tag (void *pdoc, Node *node);
57 static char *s_chtml40_start_ul_tag (void *pdoc, Node *node);
58 static char *s_chtml40_end_ul_tag (void *pdoc, Node *node);
59 static char *s_chtml40_start_ol_tag (void *pdoc, Node *node);
60 static char *s_chtml40_end_ol_tag (void *pdoc, Node *node);
61 static char *s_chtml40_start_li_tag (void *pdoc, Node *node);
62 static char *s_chtml40_end_li_tag (void *pdoc, Node *node);
63 static char *s_chtml40_start_head_tag (void *pdoc, Node *node);
64 static char *s_chtml40_end_head_tag (void *pdoc, Node *node);
65 static char *s_chtml40_start_title_tag (void *pdoc, Node *node);
66 static char *s_chtml40_end_title_tag (void *pdoc, Node *node);
67 static char *s_chtml40_start_base_tag (void *pdoc, Node *node);
68 static char *s_chtml40_end_base_tag (void *pdoc, Node *node);
69 static char *s_chtml40_start_body_tag (void *pdoc, Node *node);
70 static char *s_chtml40_end_body_tag (void *pdoc, Node *node);
71 static char *s_chtml40_start_a_tag (void *pdoc, Node *node);
72 static char *s_chtml40_end_a_tag (void *pdoc, Node *node);
73 static char *s_chtml40_start_br_tag (void *pdoc, Node *node);
74 static char *s_chtml40_end_br_tag (void *pdoc, Node *node);
75 static char *s_chtml40_start_tr_tag (void *pdoc, Node *node);
76 static char *s_chtml40_end_tr_tag (void *pdoc, Node *node);
77 static char *s_chtml40_start_font_tag (void *pdoc, Node *node);
78 static char *s_chtml40_end_font_tag (void *pdoc, Node *node);
79 static char *s_chtml40_start_form_tag (void *pdoc, Node *node);
80 static char *s_chtml40_end_form_tag (void *pdoc, Node *node);
81 static char *s_chtml40_start_input_tag (void *pdoc, Node *node);
82 static char *s_chtml40_end_input_tag (void *pdoc, Node *node);
83 static char *s_chtml40_start_center_tag (void *pdoc, Node *node);
84 static char *s_chtml40_end_center_tag (void *pdoc, Node *node);
85 static char *s_chtml40_start_hr_tag (void *pdoc, Node *node);
86 static char *s_chtml40_end_hr_tag (void *pdoc, Node *node);
87 static char *s_chtml40_start_img_tag (void *pdoc, Node *node);
88 static char *s_chtml40_end_img_tag (void *pdoc, Node *node);
89 static char *s_chtml40_start_select_tag (void *pdoc, Node *node);
90 static char *s_chtml40_end_select_tag (void *pdoc, Node *node);
91 static char *s_chtml40_start_option_tag (void *pdoc, Node *node);
92 static char *s_chtml40_end_option_tag (void *pdoc, Node *node);
93 static char *s_chtml40_start_div_tag (void *pdoc, Node *node);
94 static char *s_chtml40_end_div_tag (void *pdoc, Node *node);
95 static char *s_chtml40_chxjif_tag (void *pdoc, Node *node);
96 static char *s_chtml40_text_tag (void *pdoc, Node *node);
97 static char *s_chtml40_start_blockquote_tag(void *pdoc, Node *node);
98 static char *s_chtml40_end_blockquote_tag (void *pdoc, Node *node);
99 static char *s_chtml40_start_dir_tag (void *pdoc, Node *node);
100 static char *s_chtml40_end_dir_tag (void *pdoc, Node *node);
101 static char *s_chtml40_start_dl_tag (void *pdoc, Node *node);
102 static char *s_chtml40_end_dl_tag (void *pdoc, Node *node);
103 static char *s_chtml40_start_dt_tag (void *pdoc, Node *node);
104 static char *s_chtml40_end_dt_tag (void *pdoc, Node *node);
105 static char *s_chtml40_start_dd_tag (void *pdoc, Node *node);
106 static char *s_chtml40_end_dd_tag (void *pdoc, Node *node);
107 static char *s_chtml40_start_marquee_tag (void *pdoc, Node *node);
108 static char *s_chtml40_end_marquee_tag (void *pdoc, Node *node);
109 static char *s_chtml40_start_blink_tag (void *pdoc, Node *node);
110 static char *s_chtml40_end_blink_tag (void *pdoc, Node *node);
111 static char *s_chtml40_start_menu_tag (void *pdoc, Node *node);
112 static char *s_chtml40_end_menu_tag (void *pdoc, Node *node);
113 static char *s_chtml40_start_plaintext_tag (void *pdoc, Node *node);
114 static char *s_chtml40_start_plaintext_tag_inner (void *pdoc, Node *node);
115 static char *s_chtml40_end_plaintext_tag (void *pdoc, Node *node);
116 static char *s_chtml40_newline_mark (void *pdoc, Node *node);
117 static char *s_chtml40_link_tag (void *pdoc, Node *node);
119 static void s_init_chtml40(chtml40_t *chtml, Doc *doc, request_rec *r, device_table *spec);
121 static int s_chtml40_search_emoji(chtml40_t *chtml, char *txt, char **rslt);
122 static css_prop_list_t *s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
123 static css_prop_list_t *s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
126 tag_handler chtml40_handler[] = {
129 s_chtml40_start_html_tag,
130 s_chtml40_end_html_tag,
134 s_chtml40_start_meta_tag,
135 s_chtml40_end_meta_tag,
139 s_chtml40_start_textarea_tag,
140 s_chtml40_end_textarea_tag,
144 s_chtml40_start_p_tag,
149 s_chtml40_start_pre_tag,
150 s_chtml40_end_pre_tag,
154 s_chtml40_start_ul_tag,
155 s_chtml40_end_ul_tag,
159 s_chtml40_start_li_tag,
160 s_chtml40_end_li_tag,
164 s_chtml40_start_ol_tag,
165 s_chtml40_end_ol_tag,
169 s_chtml40_start_h1_tag,
170 s_chtml40_end_h1_tag,
174 s_chtml40_start_h2_tag,
175 s_chtml40_end_h2_tag,
179 s_chtml40_start_h3_tag,
180 s_chtml40_end_h3_tag,
184 s_chtml40_start_h4_tag,
185 s_chtml40_end_h4_tag,
189 s_chtml40_start_h5_tag,
190 s_chtml40_end_h5_tag,
194 s_chtml40_start_h6_tag,
195 s_chtml40_end_h6_tag,
199 s_chtml40_start_head_tag,
200 s_chtml40_end_head_tag,
204 s_chtml40_start_title_tag,
205 s_chtml40_end_title_tag,
209 s_chtml40_start_base_tag,
210 s_chtml40_end_base_tag,
214 s_chtml40_start_body_tag,
215 s_chtml40_end_body_tag,
219 s_chtml40_start_a_tag,
224 s_chtml40_start_br_tag,
225 s_chtml40_end_br_tag,
234 s_chtml40_start_tr_tag,
235 s_chtml40_end_tr_tag,
249 s_chtml40_start_font_tag,
250 s_chtml40_end_font_tag,
254 s_chtml40_start_form_tag,
255 s_chtml40_end_form_tag,
259 s_chtml40_start_input_tag,
260 s_chtml40_end_input_tag,
264 s_chtml40_start_center_tag,
265 s_chtml40_end_center_tag,
269 s_chtml40_start_hr_tag,
270 s_chtml40_end_hr_tag,
274 s_chtml40_start_img_tag,
275 s_chtml40_end_img_tag,
279 s_chtml40_start_select_tag,
280 s_chtml40_end_select_tag,
284 s_chtml40_start_option_tag,
285 s_chtml40_end_option_tag,
289 s_chtml40_start_div_tag,
290 s_chtml40_end_div_tag,
294 s_chtml40_chxjif_tag,
339 s_chtml40_start_dt_tag,
340 s_chtml40_end_dt_tag,
354 s_chtml40_start_blockquote_tag,
355 s_chtml40_end_blockquote_tag,
359 s_chtml40_start_dir_tag,
360 s_chtml40_end_dir_tag,
364 s_chtml40_start_dl_tag,
365 s_chtml40_end_dl_tag,
369 s_chtml40_start_dd_tag,
370 s_chtml40_end_dd_tag,
374 s_chtml40_start_menu_tag,
375 s_chtml40_end_menu_tag,
379 s_chtml40_start_plaintext_tag,
380 s_chtml40_end_plaintext_tag,
384 s_chtml40_start_blink_tag,
385 s_chtml40_end_blink_tag,
389 s_chtml40_start_marquee_tag,
390 s_chtml40_end_marquee_tag,
399 s_chtml40_newline_mark,
406 * converts from CHTML5.0 to CHTML3.0.
408 * @param r [i] Requet_rec is appointed.
409 * @param spec [i] The result of the device specification processing which
410 * was done in advance is appointed.
411 * @param src [i] The character string before the converting is appointed.
412 * @return The character string after the converting is returned.
415 chxj_convert_chtml40(
421 chxjconvrule_entry *entryp,
430 DBG(r, "start chxj_convert_chtml40()");
432 /*--------------------------------------------------------------------------*/
434 /*--------------------------------------------------------------------------*/
436 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
438 DBG(r,"i found qrcode xml");
439 DBG(r, "end chxj_convert_chtml40()");
442 DBG(r,"not found qrcode xml");
444 /*--------------------------------------------------------------------------*/
445 /* The CHTML structure is initialized. */
446 /*--------------------------------------------------------------------------*/
447 s_init_chtml40(&chtml40, &doc, r, spec);
449 chtml40.entryp = entryp;
450 chtml40.cookie = cookie;
452 chxj_set_content_type(r, "text/html; charset=Windows-31J");
454 /*--------------------------------------------------------------------------*/
455 /* The character string of the input is analyzed. */
456 /*--------------------------------------------------------------------------*/
457 qs_init_malloc(&doc);
458 qs_init_root_node(&doc);
460 ss = apr_pcalloc(r->pool, srclen + 1);
461 memset(ss, 0, srclen + 1);
462 memcpy(ss, src, srclen);
465 chxj_dump_out("[src] CHTML -> CHTML4.0", ss, srclen);
467 if (IS_CSS_ON(chtml40.entryp)) {
468 /* current property list */
469 chtml40.css_prop_stack = chxj_new_prop_list_stack(&doc);
472 chxj_buffered_write_init(r->pool, &doc.buf);
474 qs_parse_string(&doc,ss, strlen(ss));
476 /*--------------------------------------------------------------------------*/
477 /* It converts it from CHTML to CHTML. */
478 /*--------------------------------------------------------------------------*/
479 chxj_node_convert(spec,r,(void*)&chtml40, &doc, qs_get_root(&doc), 0);
480 chtml40.out = chxj_buffered_write_flush(chtml40.out, &doc.buf);
481 dst = apr_pstrdup(r->pool, chtml40.out);
482 chxj_buffered_write_terminate(&doc.buf);
484 qs_all_free(&doc,QX_LOGMARK);
487 dst = apr_pstrdup(r->pool,ss);
489 if (strlen(dst) == 0) {
490 dst = apr_psprintf(r->pool, "\n");
493 *dstlen = strlen(dst);
496 chxj_dump_out("[src] CHTML -> CHTML4.0", dst, *dstlen);
499 DBG(r, "end chxj_convert_chtml40()");
505 * The CHTML structure is initialized.
507 * @param chtml40 [i/o] The pointer to the HDML structure that wants to be
508 * initialized is specified.
509 * @param doc [i] The Doc structure that should be set to the initialized
510 * HDML structure is specified.
511 * @param r [i] To use POOL, the pointer to request_rec is specified.
512 * @param spec [i] The pointer to the device_table
515 s_init_chtml40(chtml40_t *chtml40, Doc *doc, request_rec *r, device_table *spec)
517 memset(doc, 0, sizeof(Doc));
518 memset(chtml40, 0, sizeof(chtml40_t));
522 chtml40->spec = spec;
523 chtml40->out = qs_alloc_zero_byte_string(r->pool);
524 chtml40->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
525 chtml40->doc->parse_mode = PARSE_MODE_CHTML;
530 * Corresponding EMOJI to a current character-code is retrieved.
531 * The substitution character string is stored in the rslt pointer if agreeing.
533 * @param chtml40 [i] The pointer to the CHTML structure is specified.
534 * @param txt [i] The character string to want to examine whether it is
535 * EMOJI is specified.
536 * @param rslt [o] The pointer to the pointer that stores the result is
538 * @return When corresponding EMOJI exists, it returns it excluding 0.
541 s_chtml40_search_emoji(chtml40_t *chtml40, char *txt, char **rslt)
548 spec = chtml40->spec;
554 DBG(r,"spec is NULL");
557 for (ee = chtml40->conf->emoji;
560 if (ee->imode == NULL) {
561 DBG(r, "emoji->imode is NULL");
565 if (ee->imode->string != NULL
566 && strlen(ee->imode->string) > 0
567 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
569 if (spec == NULL || spec->emoji_type == NULL) {
570 *rslt = apr_palloc(r->pool, 3);
571 (*rslt)[0] = ee->imode->hex1byte & 0xff;
572 (*rslt)[1] = ee->imode->hex2byte & 0xff;
574 return strlen(ee->imode->string);
586 * It is a handler who processes the HTML tag.
588 * @param pdoc [i/o] The pointer to the CHTML structure at the output
589 * destination is specified.
590 * @param node [i] The HTML tag node is specified.
591 * @return The conversion result is returned.
594 s_chtml40_start_html_tag(void *pdoc, Node *UNUSED(node))
596 chtml40_t *chtml40 = GET_CHTML40(pdoc);
597 Doc *doc = chtml40->doc;
599 /*--------------------------------------------------------------------------*/
601 /*--------------------------------------------------------------------------*/
609 * It is a handler who processes the HTML tag.
611 * @param pdoc [i/o] The pointer to the CHTML structure at the output
612 * destination is specified.
613 * @param node [i] The HTML tag node is specified.
614 * @return The conversion result is returned.
617 s_chtml40_end_html_tag(void *pdoc, Node *UNUSED(child))
619 chtml40_t *chtml40 = GET_CHTML40(pdoc);
620 Doc *doc = chtml40->doc;
628 * It is a handler who processes the META tag.
630 * @param pdoc [i/o] The pointer to the CHTML structure at the output
631 * destination is specified.
632 * @param node [i] The META tag node is specified.
633 * @return The conversion result is returned.
636 s_chtml40_start_meta_tag(void *pdoc, Node *node)
642 int content_type_flag;
645 chtml40 = GET_CHTML40(pdoc);
649 content_type_flag = 0;
653 /*--------------------------------------------------------------------------*/
655 /*--------------------------------------------------------------------------*/
656 for (attr = qs_get_attr(doc,node);
658 attr = qs_get_next_attr(doc,attr)) {
659 char *name = qs_get_attr_name(doc,attr);
660 char *value = qs_get_attr_value(doc,attr);
664 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
665 /*----------------------------------------------------------------------*/
667 /*----------------------------------------------------------------------*/
668 W_L(" http-equiv=\"");
671 if (STRCASEEQ('c','C',"content-type", value))
672 content_type_flag = 1;
674 if (STRCASEEQ('r','R',"refresh", value))
681 if (strcasecmp(name, "content") == 0 && value && *value) {
682 if (content_type_flag) {
685 W_L("=\"text/html; charset=Windows-31J\"");
692 buf = apr_pstrdup(r->pool, value);
693 url = strchr(buf, ';');
695 sec = apr_pstrdup(r->pool, buf);
698 url = chxj_encoding_parameter(r, url);
699 url = chxj_add_cookie_parameter(r, url, chtml40->cookie);
729 * It is a handler who processes the META tag.
731 * @param pdoc [i/o] The pointer to the CHTML structure at the output
732 * destination is specified.
733 * @param node [i] The META tag node is specified.
734 * @return The conversion result is returned.
737 s_chtml40_end_meta_tag(void* pdoc, Node* UNUSED(child))
739 chtml40_t *chtml40 = GET_CHTML40(pdoc);
746 * It is a handler who processes the HEAD tag.
748 * @param pdoc [i/o] The pointer to the CHTML structure at the output
749 * destination is specified.
750 * @param node [i] The HEAD tag node is specified.
751 * @return The conversion result is returned.
754 s_chtml40_start_head_tag(void* pdoc, Node* UNUSED(node))
756 chtml40_t *chtml40 = GET_CHTML40(pdoc);
757 Doc *doc = chtml40->doc;
766 * It is a handler who processes the HEAD tag.
768 * @param pdoc [i/o] The pointer to the CHTML structure at the output
769 * destination is specified.
770 * @param node [i] The HEAD tag node is specified.
771 * @return The conversion result is returned.
774 s_chtml40_end_head_tag(void *pdoc, Node *UNUSED(node))
776 chtml40_t *chtml40 = GET_CHTML40(pdoc);
777 Doc *doc = chtml40->doc;
786 * It is a handler who processes the TITLE tag.
788 * @param pdoc [i/o] The pointer to the CHTML structure at the output
789 * destination is specified.
790 * @param node [i] The TITLE tag node is specified.
791 * @return The conversion result is returned.
794 s_chtml40_start_title_tag(void *pdoc, Node *UNUSED(node))
796 chtml40_t *chtml40 = GET_CHTML40(pdoc);
797 Doc *doc = chtml40->doc;
806 * It is a handler who processes the TITLE tag.
808 * @param pdoc [i/o] The pointer to the CHTML structure at the output
809 * destination is specified.
810 * @param node [i] The TITLE tag node is specified.
811 * @return The conversion result is returned.
814 s_chtml40_end_title_tag(void *pdoc, Node *UNUSED(child))
816 chtml40_t *chtml40 = GET_CHTML40(pdoc);
817 Doc *doc = chtml40->doc;
826 * It is a handler who processes the BASE tag.
828 * @param pdoc [i/o] The pointer to the CHTML structure at the output
829 * destination is specified.
830 * @param node [i] The BASE tag node is specified.
831 * @return The conversion result is returned.
834 s_chtml40_start_base_tag(void *pdoc, Node *node)
841 chtml40 = GET_CHTML40(pdoc);
846 /*--------------------------------------------------------------------------*/
848 /*--------------------------------------------------------------------------*/
849 for (attr = qs_get_attr(doc,node);
851 attr = qs_get_next_attr(doc,attr)) {
852 char *name = qs_get_attr_name(doc,attr);
853 char *value = qs_get_attr_value(doc,attr);
854 if (STRCASEEQ('h','H',"href", name)) {
867 * It is a handler who processes the BASE tag.
869 * @param pdoc [i/o] The pointer to the CHTML structure at the output
870 * destination is specified.
871 * @param node [i] The BASE tag node is specified.
872 * @return The conversion result is returned.
875 s_chtml40_end_base_tag(void *pdoc, Node *UNUSED(child))
877 chtml40_t *chtml40 = GET_CHTML40(pdoc);
884 * It is a handler who processes the BODY tag.
886 * @param pdoc [i/o] The pointer to the CHTML structure at the output
887 * destination is specified.
888 * @param node [i] The BODY tag node is specified.
889 * @return The conversion result is returned.
892 s_chtml40_start_body_tag(void *pdoc, Node *node)
898 char *attr_bgcolor = NULL;
899 char *attr_text = NULL;
900 char *attr_link = NULL;
901 char *attr_style = NULL;
902 char *attr_alink = NULL;
903 char *attr_vlink = NULL;
906 chtml40 = GET_CHTML40(pdoc);
910 /*--------------------------------------------------------------------------*/
912 /*--------------------------------------------------------------------------*/
913 for (attr = qs_get_attr(doc,node);
915 attr = qs_get_next_attr(doc,attr)) {
916 char *name = qs_get_attr_name(doc,attr);
917 char *value = qs_get_attr_value(doc,attr);
918 if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
919 /*----------------------------------------------------------------------*/
921 /*----------------------------------------------------------------------*/
922 attr_bgcolor = value;
924 else if (STRCASEEQ('t','T', "text", name) && value && *value) {
925 /*----------------------------------------------------------------------*/
927 /*----------------------------------------------------------------------*/
930 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
931 /*----------------------------------------------------------------------*/
933 /*----------------------------------------------------------------------*/
936 else if (STRCASEEQ('a','A',"alink", name) && value && *value) {
937 /*----------------------------------------------------------------------*/
939 /*----------------------------------------------------------------------*/
942 else if (STRCASEEQ('v','V',"vlink", name) && value && *value) {
943 /*----------------------------------------------------------------------*/
945 /*----------------------------------------------------------------------*/
948 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
953 if (IS_CSS_ON(chtml40->entryp)) {
954 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
956 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
957 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
959 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
960 if (cur->value && *cur->value) {
961 attr_text = apr_pstrdup(doc->pool, cur->value);
964 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
965 if (cur->value && *cur->value) {
966 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
970 if (chtml40->style) {
971 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, chtml40->style);
972 css_selector_t *cur_sel;
973 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
974 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
976 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
977 if (cur->name && strcasecmp(cur->name, "color") == 0) {
978 attr_link = apr_pstrdup(doc->pool, cur->value);
982 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
984 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
985 if (cur->name && strcasecmp(cur->name, "color") == 0) {
986 attr_vlink = apr_pstrdup(doc->pool, cur->value);
990 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
992 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
993 if (cur->name && strcasecmp(cur->name, "color") == 0) {
994 attr_alink = apr_pstrdup(doc->pool, cur->value);
1004 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1010 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1016 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1022 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1028 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1035 return chtml40->out;
1040 * It is a handler who processes the BODY tag.
1042 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1043 * destination is specified.
1044 * @param node [i] The BODY tag node is specified.
1045 * @return The conversion result is returned.
1048 s_chtml40_end_body_tag(void *pdoc, Node *UNUSED(child))
1053 chtml40 = GET_CHTML40(pdoc);
1057 if (IS_CSS_ON(chtml40->entryp)) {
1058 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1061 return chtml40->out;
1066 * It is a handler who processes the A tag.
1068 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1069 * destination is specified.
1070 * @param node [i] The A tag node is specified.
1071 * @return The conversion result is returned.
1074 s_chtml40_start_a_tag(void *pdoc, Node *node)
1080 char *attr_style = NULL;
1082 chtml40 = GET_CHTML40(pdoc);
1087 /*--------------------------------------------------------------------------*/
1088 /* Get Attributes */
1089 /*--------------------------------------------------------------------------*/
1090 for (attr = qs_get_attr(doc,node);
1092 attr = qs_get_next_attr(doc,attr)) {
1093 char *name = qs_get_attr_name(doc,attr);
1094 char *value = qs_get_attr_value(doc,attr);
1095 if (STRCASEEQ('n','N',"name", name)) {
1096 /*----------------------------------------------------------------------*/
1098 /*----------------------------------------------------------------------*/
1103 else if (STRCASEEQ('h','H',"href", name)) {
1104 /*----------------------------------------------------------------------*/
1106 /*----------------------------------------------------------------------*/
1107 value = chxj_encoding_parameter(r, value);
1108 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
1113 else if (STRCASEEQ('a','A',"accesskey", name)) {
1114 /*----------------------------------------------------------------------*/
1116 /*----------------------------------------------------------------------*/
1117 W_L(" accesskey=\"");
1121 else if (STRCASEEQ('c','C',"cti", name)) {
1122 /*----------------------------------------------------------------------*/
1124 /*----------------------------------------------------------------------*/
1129 else if (STRCASEEQ('i','I',"ijam", name)) {
1130 /*----------------------------------------------------------------------*/
1132 /*----------------------------------------------------------------------*/
1135 else if (STRCASEEQ('u','U',"utn", name)) {
1136 /*----------------------------------------------------------------------*/
1138 /* It is special only for CHTML. */
1139 /*----------------------------------------------------------------------*/
1142 else if (STRCASEEQ('t','T',"telbook", name)) {
1143 /*----------------------------------------------------------------------*/
1145 /*----------------------------------------------------------------------*/
1148 else if (STRCASEEQ('k','K',"kana", name)) {
1149 /*----------------------------------------------------------------------*/
1151 /*----------------------------------------------------------------------*/
1154 else if (STRCASEEQ('e','E',"email", name)) {
1155 /*----------------------------------------------------------------------*/
1157 /*----------------------------------------------------------------------*/
1160 else if (STRCASEEQ('i','I',"ista", name)) {
1161 /*----------------------------------------------------------------------*/
1163 /*----------------------------------------------------------------------*/
1166 else if (STRCASEEQ('i','I',"ilet", name)) {
1167 /*----------------------------------------------------------------------*/
1169 /*----------------------------------------------------------------------*/
1172 else if (STRCASEEQ('i','I',"iswf", name)) {
1173 /*----------------------------------------------------------------------*/
1175 /*----------------------------------------------------------------------*/
1178 else if (STRCASEEQ('i','I',"irst", name)) {
1179 /*----------------------------------------------------------------------*/
1181 /*----------------------------------------------------------------------*/
1184 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1190 if (IS_CSS_ON(chtml40->entryp)) {
1191 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1194 return chtml40->out;
1199 * It is a handler who processes the A tag.
1201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1202 * destination is specified.
1203 * @param node [i] The A tag node is specified.
1204 * @return The conversion result is returned.
1207 s_chtml40_end_a_tag(void *pdoc, Node *UNUSED(child))
1212 chtml40 = GET_CHTML40(pdoc);
1217 if (IS_CSS_ON(chtml40->entryp)) {
1218 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1221 return chtml40->out;
1226 * It is a handler who processes the BR tag.
1228 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1229 * destination is specified.
1230 * @param node [i] The BR tag node is specified.
1231 * @return The conversion result is returned.
1234 s_chtml40_start_br_tag(void *pdoc, Node *node)
1241 chtml40 = GET_CHTML40(pdoc);
1245 /*--------------------------------------------------------------------------*/
1246 /* Get Attributes */
1247 /*--------------------------------------------------------------------------*/
1248 for (attr = qs_get_attr(doc,node);
1250 attr = qs_get_next_attr(doc,attr)) {
1251 char *name = qs_get_attr_name(doc,attr);
1252 char *value = qs_get_attr_value(doc,attr);
1253 if (STRCASEEQ('c','C',"clear",name)) {
1254 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1263 return chtml40->out;
1268 * It is a handler who processes the BR tag.
1270 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1271 * destination is specified.
1272 * @param node [i] The BR tag node is specified.
1273 * @return The conversion result is returned.
1276 s_chtml40_end_br_tag(void *pdoc, Node *UNUSED(child))
1278 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1280 return chtml40->out;
1285 * It is a handler who processes the TR tag.
1287 * @param chtml40 [i/o] The pointer to the CHTML structure at the output
1288 * destination is specified.
1289 * @param node [i] The TR tag node is specified.
1290 * @return The conversion result is returned.
1293 s_chtml40_start_tr_tag(void *pdoc, Node *UNUSED(node))
1295 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1297 return chtml40->out;
1302 * It is a handler who processes the TR tag.
1304 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1305 * destination is specified.
1306 * @param node [i] The TR tag node is specified.
1307 * @return The conversion result is returned.
1310 s_chtml40_end_tr_tag(void *pdoc, Node *UNUSED(child))
1316 chtml40 = GET_CHTML40(pdoc);
1322 return chtml40->out;
1327 * It is a handler who processes the FONT tag.
1329 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1330 * destination is specified.
1331 * @param node [i] The FONT tag node is specified.
1332 * @return The conversion result is returned.
1335 s_chtml40_start_font_tag(void *pdoc, Node *node)
1341 char *attr_color = NULL;
1342 char *attr_style = NULL;
1344 chtml40 = GET_CHTML40(pdoc);
1348 /*--------------------------------------------------------------------------*/
1349 /* Get Attributes */
1350 /*--------------------------------------------------------------------------*/
1351 for (attr = qs_get_attr(doc,node);
1353 attr = qs_get_next_attr(doc,attr)) {
1354 char *name = qs_get_attr_name(doc,attr);
1355 char *value = qs_get_attr_value(doc,attr);
1356 if (STRCASEEQ('c','C',"color", name) && value && *value) {
1357 attr_color = apr_pstrdup(doc->buf.pool, value);
1360 else if (STRCASEEQ('s','S',"size", name)) {
1361 /*----------------------------------------------------------------------*/
1363 /*----------------------------------------------------------------------*/
1366 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1370 if (IS_CSS_ON(chtml40->entryp)) {
1371 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1373 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1374 css_property_t *cur;
1375 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1376 if (cur->value && *cur->value) {
1377 attr_color = apr_pstrdup(doc->pool, cur->value);
1383 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1384 W_L("<font color=\"");
1387 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1388 flg->with_font_flag = 1;
1389 node->userData = flg;
1392 node->userData = NULL;
1394 return chtml40->out;
1399 * It is a handler who processes the FONT tag.
1401 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1402 * destination is specified.
1403 * @param node [i] The FONT tag node is specified.
1404 * @return The conversion result is returned.
1407 s_chtml40_end_font_tag(void *pdoc, Node *node)
1413 chtml40 = GET_CHTML40(pdoc);
1417 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1418 if (flg && flg->with_font_flag) {
1421 if (IS_CSS_ON(chtml40->entryp)) {
1422 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1425 return chtml40->out;
1430 * It is a handler who processes the FORM tag.
1432 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1433 * destination is specified.
1434 * @param node [i] The FORM tag node is specified.
1435 * @return The conversion result is returned.
1438 s_chtml40_start_form_tag(void *pdoc, Node *node)
1444 char *attr_action = NULL;
1445 char *attr_method = NULL;
1446 char *attr_style = NULL;
1447 char *attr_color = NULL;
1448 char *attr_align = NULL;
1449 char *attr_utn = NULL;
1450 char *new_hidden_tag = NULL;
1452 chtml40 = GET_CHTML40(pdoc);
1456 /*--------------------------------------------------------------------------*/
1457 /* Get Attributes */
1458 /*--------------------------------------------------------------------------*/
1459 for (attr = qs_get_attr(doc,node);
1461 attr = qs_get_next_attr(doc,attr)) {
1462 char *name = qs_get_attr_name(doc,attr);
1463 char *value = qs_get_attr_value(doc,attr);
1467 if (strcasecmp(name, "action") == 0) {
1468 /*--------------------------------------------------------------------*/
1470 /*--------------------------------------------------------------------*/
1471 attr_action = value;
1477 if (strcasecmp(name, "method") == 0) {
1478 /*--------------------------------------------------------------------*/
1480 /*--------------------------------------------------------------------*/
1481 attr_method = value;
1487 if (strcasecmp(name, "utn") == 0) {
1488 /*--------------------------------------------------------------------*/
1490 /*--------------------------------------------------------------------*/
1497 if (strcasecmp(name, "style") == 0) {
1506 if (IS_CSS_ON(chtml40->entryp)) {
1507 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1509 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1510 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1511 css_property_t *cur;
1512 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1513 if (STRCASEEQ('l','L',"left", cur->value)) {
1514 attr_align = apr_pstrdup(doc->pool, "left");
1516 else if (STRCASEEQ('c','C',"center",cur->value)) {
1517 attr_align = apr_pstrdup(doc->pool, "center");
1519 else if (STRCASEEQ('r','R',"right",cur->value)) {
1520 attr_align = apr_pstrdup(doc->pool, "right");
1523 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1524 attr_color = apr_pstrdup(doc->pool, cur->value);
1530 attr_action = chxj_encoding_parameter(r, attr_action);
1531 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml40->cookie);
1533 q = strchr(attr_action, '?');
1535 new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_action, 0);
1551 if (new_hidden_tag) {
1552 W_V(new_hidden_tag);
1555 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1556 memset(flg, 0, sizeof(*flg));
1558 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1559 W_L("<font color=\"");
1562 flg->with_font_flag = 1;
1565 W_L("<div align=\"");
1568 flg->with_div_flag = 1;
1570 node->userData = flg;
1572 return chtml40->out;
1577 * It is a handler who processes the FORM tag.
1579 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1580 * destination is specified.
1581 * @param node [i] The FORM tag node is specified.
1582 * @return The conversion result is returned.
1585 s_chtml40_end_form_tag(void *pdoc, Node *node)
1590 chtml40 = GET_CHTML40(pdoc);
1593 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1594 if (flg && flg->with_div_flag) {
1597 if (flg && flg->with_font_flag) {
1601 if (IS_CSS_ON(chtml40->entryp)) {
1602 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1605 return chtml40->out;
1610 * It is a handler who processes the INPUT tag.
1612 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1613 * destination is specified.
1614 * @param node [i] The INPUT tag node is specified.
1615 * @return The conversion result is returned.
1618 s_chtml40_start_input_tag(void *pdoc, Node *node)
1624 char *attr_accesskey = NULL;
1625 char *attr_max_length = NULL;
1626 char *attr_type = NULL;
1627 char *attr_name = NULL;
1628 char *attr_value = NULL;
1629 char *attr_istyle = NULL;
1630 char *attr_size = NULL;
1631 char *attr_checked = NULL;
1632 char *attr_style = NULL;
1634 chtml40 = GET_CHTML40(pdoc);
1638 /*--------------------------------------------------------------------------*/
1639 /* Get Attributes */
1640 /*--------------------------------------------------------------------------*/
1641 for (attr = qs_get_attr(doc,node);
1643 attr = qs_get_next_attr(doc,attr)) {
1644 char *name = qs_get_attr_name(doc,attr);
1645 char *value = qs_get_attr_value(doc,attr);
1646 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1647 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1648 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1649 STRCASEEQ('p','P',"password",tmp_type) ||
1650 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1651 STRCASEEQ('r','R',"radio", tmp_type) ||
1652 STRCASEEQ('h','H',"hidden", tmp_type) ||
1653 STRCASEEQ('s','S',"submit", tmp_type) ||
1654 STRCASEEQ('r','R',"reset", tmp_type))) {
1655 attr_type = tmp_type;
1658 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1661 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1664 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1665 attr_istyle = value;
1667 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1668 attr_max_length = value;
1670 else if (STRCASEEQ('c','C',"checked", name)) {
1671 attr_checked = value;
1673 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1674 attr_accesskey = value;
1676 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1679 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1684 if (IS_CSS_ON(chtml40->entryp)) {
1685 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
1687 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1688 css_property_t *cur;
1689 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1690 if (strcasestr(cur->value, "<ja:n>")) {
1693 else if (strcasestr(cur->value, "<ja:en>")) {
1696 else if (strcasestr(cur->value, "<ja:hk>")) {
1699 else if (strcasestr(cur->value, "<ja:h>")) {
1724 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1727 if (attr_accesskey) {
1728 W_L(" accesskey=\"");
1729 W_V(attr_accesskey);
1733 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1739 /*--------------------------------------------------------------------------*/
1740 /* The figure is default for the password. */
1741 /*--------------------------------------------------------------------------*/
1742 if (attr_max_length) {
1743 if (chxj_chk_numeric(attr_max_length) != 0) {
1744 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1746 if (attr_istyle && *attr_istyle == '1') {
1747 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1751 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1760 return chtml40->out;
1765 * It is a handler who processes the INPUT tag.
1767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1768 * destination is specified.
1769 * @param node [i] The INPUT tag node is specified.
1770 * @return The conversion result is returned.
1773 s_chtml40_end_input_tag(void *pdoc, Node *UNUSED(child))
1775 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1777 return chtml40->out;
1782 * It is a handler who processes the CENTER tag.
1784 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1785 * destination is specified.
1786 * @param node [i] The CENTER tag node is specified.
1787 * @return The conversion result is returned.
1790 s_chtml40_start_center_tag(void *pdoc, Node *node)
1795 char *attr_style = NULL;
1796 char *attr_color = NULL;
1798 chtml40 = GET_CHTML40(pdoc);
1801 for (attr = qs_get_attr(doc,node);
1803 attr = qs_get_next_attr(doc,attr)) {
1804 char *name = qs_get_attr_name(doc,attr);
1805 char *value = qs_get_attr_value(doc,attr);
1806 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1810 if (IS_CSS_ON(chtml40->entryp)) {
1811 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1813 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1814 css_property_t *cur;
1815 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1816 if (cur->value && *cur->value) {
1817 attr_color = apr_pstrdup(doc->pool, cur->value);
1824 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1825 memset(flg, 0, sizeof(*flg));
1827 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1828 W_L("<font color=\"");
1831 flg->with_font_flag = 1;
1833 node->userData = flg;
1835 return chtml40->out;
1840 * It is a handler who processes the CENTER tag.
1842 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1843 * destination is specified.
1844 * @param node [i] The CENTER tag node is specified.
1845 * @return The conversion result is returned.
1848 s_chtml40_end_center_tag(void *pdoc, Node *node)
1853 chtml40 = GET_CHTML40(pdoc);
1856 if (IS_CSS_ON(chtml40->entryp)) {
1857 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1859 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1860 if (flg && flg->with_font_flag) {
1865 return chtml40->out;
1870 * It is a handler who processes the HR tag.
1872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1873 * destination is specified.
1874 * @param node [i] The HR tag node is specified.
1875 * @return The conversion result is returned.
1878 s_chtml40_start_hr_tag(void *pdoc, Node *node)
1884 char *attr_align = NULL;
1885 char *attr_size = NULL;
1886 char *attr_width = NULL;
1887 char *attr_noshade = NULL;
1888 char *attr_style = NULL;
1889 char *attr_color = NULL;
1891 chtml40 = GET_CHTML40(pdoc);
1895 for (attr = qs_get_attr(doc,node);
1897 attr = qs_get_next_attr(doc,attr)) {
1898 char *name = qs_get_attr_name (doc,attr);
1899 char *value = qs_get_attr_value(doc,attr);
1903 if (strcasecmp(name, "align") == 0) {
1904 /*--------------------------------------------------------------------*/
1906 /*--------------------------------------------------------------------*/
1907 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1915 if (strcasecmp(name, "size") == 0) {
1916 /*--------------------------------------------------------------------*/
1918 /*--------------------------------------------------------------------*/
1919 if (value && *value) {
1923 else if (strcasecmp(name, "style") == 0) {
1924 if (value && *value) {
1932 if (strcasecmp(name, "width") == 0) {
1933 /*--------------------------------------------------------------------*/
1935 /*--------------------------------------------------------------------*/
1936 if (value && *value) {
1944 if (strcasecmp(name, "noshade") == 0) {
1945 /*--------------------------------------------------------------------*/
1947 /*--------------------------------------------------------------------*/
1948 attr_noshade = apr_pstrdup(doc->pool, "noshade");
1954 if (strcasecmp(name, "color") == 0 && value && *value) {
1955 /*--------------------------------------------------------------------*/
1957 /*--------------------------------------------------------------------*/
1966 if (IS_CSS_ON(chtml40->entryp)) {
1967 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
1969 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
1970 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1971 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1972 css_property_t *cur;
1973 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
1974 if (STRCASEEQ('s','S',"solid",cur->value)) {
1975 attr_noshade = "noshade";
1978 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1979 char *tmp = apr_pstrdup(doc->pool, cur->value);
1980 char *tmpp = strstr(tmp, "px");
1983 attr_size = apr_pstrdup(doc->pool, tmp);
1986 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1987 char *tmp = apr_pstrdup(doc->pool, cur->value);
1988 char *tmpp = strstr(tmp, "px");
1991 attr_width = apr_pstrdup(doc->pool, tmp);
1994 tmpp = strstr(tmp, "%");
1996 attr_width = apr_pstrdup(doc->pool, tmp);
2027 return chtml40->out;
2032 * It is a handler who processes the HR tag.
2034 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2035 * destination is specified.
2036 * @param node [i] The HR tag node is specified.
2037 * @return The conversion result is returned.
2040 s_chtml40_end_hr_tag(void *pdoc, Node *UNUSED(child))
2042 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2044 return chtml40->out;
2049 * It is a handler who processes the IMG tag.
2051 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2052 * destination is specified.
2053 * @param node [i] The IMG tag node is specified.
2054 * @return The conversion result is returned.
2057 s_chtml40_start_img_tag(void *pdoc, Node *node)
2063 char *attr_src = NULL;
2064 char *attr_align = NULL;
2065 char *attr_style = NULL;
2066 char *attr_alt = NULL;
2067 char *attr_width = NULL;
2068 char *attr_height = NULL;
2069 char *attr_hspace = NULL;
2070 char *attr_vspace = NULL;
2071 #ifndef IMG_NOT_CONVERT_FILENAME
2075 chtml40 = GET_CHTML40(pdoc);
2076 #ifndef IMG_NOT_CONVERT_FILENAME
2077 spec = chtml40->spec;
2082 /*--------------------------------------------------------------------------*/
2083 /* Get Attributes */
2084 /*--------------------------------------------------------------------------*/
2085 for (attr = qs_get_attr(doc,node);
2087 attr = qs_get_next_attr(doc,attr)) {
2088 char *name = qs_get_attr_name (doc,attr);
2089 char *value = qs_get_attr_value(doc,attr);
2093 if (strcasecmp(name, "src") == 0) {
2094 /*--------------------------------------------------------------------*/
2096 /*--------------------------------------------------------------------*/
2097 #ifdef IMG_NOT_CONVERT_FILENAME
2098 value = chxj_encoding_parameter(r, value);
2099 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2101 value = apr_psprintf(doc->buf.pool,
2104 (strchr(value, '?')) ? '&' : '?',
2105 CHXJ_COOKIE_NOUPDATE_PARAM);
2109 value = chxj_img_conv(r, spec, value);
2110 value = chxj_encoding_parameter(r, value);
2111 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2113 value = apr_psprintf(doc->buf.pool,
2116 (strchr(value, '?')) ? '&' : '?',
2117 CHXJ_COOKIE_NOUPDATE_PARAM);
2122 else if (strcasecmp(name,"style") == 0 && value && *value) {
2129 if (strcasecmp(name, "align" ) == 0) {
2130 /*--------------------------------------------------------------------*/
2132 /*--------------------------------------------------------------------*/
2133 /*--------------------------------------------------------------------*/
2135 /*--------------------------------------------------------------------*/
2137 if (STRCASEEQ('t','T',"top", value) ||
2138 STRCASEEQ('m','M',"middle",value) ||
2139 STRCASEEQ('b','B',"bottom",value) ||
2140 STRCASEEQ('l','L',"left", value) ||
2141 STRCASEEQ('r','R',"right", value)) {
2144 else if (STRCASEEQ('c','C',"center", value)) {
2145 attr_align = apr_pstrdup(doc->pool, "middle");
2149 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2159 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2160 /*--------------------------------------------------------------------*/
2162 /*--------------------------------------------------------------------*/
2169 if (strcasecmp(name, "height") == 0 && value && *value) {
2170 /*--------------------------------------------------------------------*/
2172 /*--------------------------------------------------------------------*/
2173 attr_height = value;
2176 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2177 /*--------------------------------------------------------------------*/
2179 /*--------------------------------------------------------------------*/
2180 attr_hspace = value;
2186 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2187 /*--------------------------------------------------------------------*/
2189 /*--------------------------------------------------------------------*/
2190 attr_vspace = value;
2199 if (IS_CSS_ON(chtml40->entryp)) {
2200 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2202 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2203 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2204 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2205 css_property_t *cur;
2206 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2207 attr_height = apr_pstrdup(doc->pool, cur->value);
2209 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2210 attr_width = apr_pstrdup(doc->pool, cur->value);
2212 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2213 attr_align = apr_pstrdup(doc->pool, cur->value);
2255 return chtml40->out;
2260 * It is a handler who processes the IMG tag.
2262 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2263 * destination is specified.
2264 * @param node [i] The IMG tag node is specified.
2265 * @return The conversion result is returned.
2268 s_chtml40_end_img_tag(void *pdoc, Node *UNUSED(child))
2270 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2272 return chtml40->out;
2277 * It is a handler who processes the SELECT tag.
2279 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2280 * destination is specified.
2281 * @param node [i] The SELECT tag node is specified.
2282 * @return The conversion result is returned.
2285 s_chtml40_start_select_tag(void *pdoc, Node *node)
2287 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2288 Doc *doc = chtml40->doc;
2291 char *multiple = NULL;
2293 char *attr_style = NULL;
2296 for (attr = qs_get_attr(doc,node);
2298 attr = qs_get_next_attr(doc,attr)) {
2299 char *nm = qs_get_attr_name(doc,attr);
2300 char *val = qs_get_attr_value(doc,attr);
2301 if (STRCASEEQ('s','S',"size", nm)) {
2302 /*----------------------------------------------------------------------*/
2303 /* CHTML 1.0 version 2.0 */
2304 /*----------------------------------------------------------------------*/
2305 size = apr_pstrdup(doc->buf.pool, val);
2307 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2308 /*----------------------------------------------------------------------*/
2309 /* CHTML 1.0 version 2.0 */
2310 /*----------------------------------------------------------------------*/
2311 attr_style = apr_pstrdup(doc->buf.pool, val);
2313 else if (STRCASEEQ('n','N',"name", nm)) {
2314 /*----------------------------------------------------------------------*/
2315 /* CHTML 1.0 version 2.0 */
2316 /*----------------------------------------------------------------------*/
2317 name = apr_pstrdup(doc->buf.pool, val);
2319 else if (STRCASEEQ('m','M',"multiple", nm)) {
2320 /*----------------------------------------------------------------------*/
2321 /* CHTML 1.0 version 2.0 */
2322 /*----------------------------------------------------------------------*/
2323 multiple = apr_pstrdup(doc->buf.pool, val);
2326 if (size && *size) {
2331 if (name && *name) {
2340 if (IS_CSS_ON(chtml40->entryp)) {
2341 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2343 return chtml40->out;
2348 * It is a handler who processes the SELECT tag.
2350 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2351 * destination is specified.
2352 * @param node [i] The SELECT tag node is specified.
2353 * @return The conversion result is returned.
2356 s_chtml40_end_select_tag(void *pdoc, Node *UNUSED(child))
2358 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2359 Doc *doc = chtml40->doc;
2362 if (IS_CSS_ON(chtml40->entryp)) {
2363 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2365 return chtml40->out;
2370 * It is a handler who processes the OPTION tag.
2372 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2373 * destination is specified.
2374 * @param node [i] The OPTION tag node is specified.
2375 * @return The conversion result is returned.
2378 s_chtml40_start_option_tag(void *pdoc, Node *node)
2386 char *attr_style = NULL;
2388 chtml40 = GET_CHTML40(pdoc);
2395 for (attr = qs_get_attr(doc,node);
2397 attr = qs_get_next_attr(doc,attr)) {
2398 char *nm = qs_get_attr_name(doc,attr);
2399 char *val = qs_get_attr_value(doc,attr);
2400 if (STRCASEEQ('s','S',"selected", nm)) {
2401 /*----------------------------------------------------------------------*/
2402 /* CHTML 1.0 version 2.0 */
2403 /*----------------------------------------------------------------------*/
2404 selected = apr_pstrdup(doc->buf.pool, val);
2406 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2407 /*----------------------------------------------------------------------*/
2408 /* CHTML 1.0 version 2.0 */
2409 /*----------------------------------------------------------------------*/
2410 attr_style = apr_pstrdup(doc->buf.pool, val);
2412 else if (STRCASEEQ('v','V',"value", nm)) {
2413 /*----------------------------------------------------------------------*/
2414 /* CHTML 1.0 version 2.0 */
2415 /*----------------------------------------------------------------------*/
2416 value = apr_pstrdup(doc->buf.pool, val);
2419 if (value && *value) {
2429 if (IS_CSS_ON(chtml40->entryp)) {
2430 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2433 return chtml40->out;
2438 * It is a handler who processes the OPTION tag.
2440 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2441 * destination is specified.
2442 * @param node [i] The OPTION tag node is specified.
2443 * @return The conversion result is returned.
2446 s_chtml40_end_option_tag(void *pdoc, Node *UNUSED(child))
2448 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2451 if (IS_CSS_ON(chtml40->entryp)) {
2452 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2455 return chtml40->out;
2460 * It is a handler who processes the DIV tag.
2462 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2463 * destination is specified.
2464 * @param node [i] The DIV tag node is specified.
2465 * @return The conversion result is returned.
2468 s_chtml40_start_div_tag(void *pdoc, Node *node)
2474 char *attr_style = NULL;
2475 char *attr_align = NULL;
2476 char *attr_display = NULL;
2477 char *attr_decoration = NULL;
2478 char *attr_wap_marquee_style = NULL;
2479 char *attr_wap_marquee_dir = NULL;
2480 char *attr_wap_marquee_loop = NULL;
2481 char *attr_color = NULL;
2483 chtml40 = GET_CHTML40(pdoc);
2487 for (attr = qs_get_attr(doc,node);
2489 attr = qs_get_next_attr(doc,attr)) {
2490 char *nm = qs_get_attr_name(doc,attr);
2491 char *val = qs_get_attr_value(doc,attr);
2492 if (STRCASEEQ('a','A', "align", nm)) {
2493 /*----------------------------------------------------------------------*/
2494 /* CHTML 1.0 (W3C version 3.2) */
2495 /*----------------------------------------------------------------------*/
2496 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2497 attr_align = apr_pstrdup(doc->buf.pool, val);
2500 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2501 attr_style = apr_pstrdup(doc->buf.pool, val);
2505 if (IS_CSS_ON(chtml40->entryp)) {
2506 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2508 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
2509 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2510 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2511 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2513 css_property_t *cur;
2514 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
2515 if (strcasecmp("-wap-marquee", cur->value) == 0) {
2516 attr_display = apr_pstrdup(doc->pool, cur->value);
2519 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
2520 if (STRCASEEQ('b','B',"blink", cur->value)) {
2521 attr_decoration = apr_pstrdup(doc->pool, cur->value);
2524 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2525 attr_color = apr_pstrdup(doc->pool, cur->value);
2527 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2528 attr_align = apr_pstrdup(doc->pool, cur->value);
2531 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
2532 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
2533 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
2534 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
2535 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
2536 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
2539 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
2540 if (STRCASEEQ('l','L',"ltr",cur->value)) {
2541 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
2543 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
2544 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
2547 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
2548 if (STRCASEEQ('i','I',"infinite",cur->value)) {
2549 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
2552 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
2558 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
2559 memset(flg, 0, sizeof(*flg));
2566 flg->with_div_flag = 1;
2569 W_L("<font color=\"");
2572 flg->with_font_flag = 1;
2574 if (attr_decoration) {
2576 flg->with_blink_flag = 1;
2580 if (attr_wap_marquee_style) {
2581 W_L(" behavior=\"");
2582 W_V(attr_wap_marquee_style);
2585 if (attr_wap_marquee_dir) {
2586 W_L(" direction=\"");
2587 W_V(attr_wap_marquee_dir);
2590 if (attr_wap_marquee_loop) {
2592 W_V(attr_wap_marquee_loop);
2596 flg->with_marquee_flag = 1;
2598 node->userData = flg;
2600 return chtml40->out;
2605 * It is a handler who processes the DIV tag.
2607 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2608 * destination is specified.
2609 * @param node [i] The DIV tag node is specified.
2610 * @return The conversion result is returned.
2613 s_chtml40_end_div_tag(void *pdoc, Node *node)
2615 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2616 Doc *doc = chtml40->doc;
2618 chtml40_flags_t *flg = node->userData;
2619 if (flg && flg->with_marquee_flag) {
2622 if (flg && flg->with_blink_flag) {
2625 if (flg && flg->with_font_flag) {
2628 if (flg && flg->with_div_flag) {
2631 if (IS_CSS_ON(chtml40->entryp)) {
2632 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2634 node->userData = NULL;
2636 return chtml40->out;
2641 * It is a handler who processes the UL tag.
2643 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2644 * destination is specified.
2645 * @param node [i] The UL tag node is specified.
2646 * @return The conversion result is returned.
2649 s_chtml40_start_ul_tag(void *pdoc, Node *node)
2651 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2652 Doc *doc = chtml40->doc;
2654 char *attr_type = NULL;
2655 char *attr_style = NULL;
2656 /*--------------------------------------------------------------------------*/
2657 /* Get Attributes */
2658 /*--------------------------------------------------------------------------*/
2659 for (attr = qs_get_attr(doc,node);
2661 attr = qs_get_next_attr(doc,attr)) {
2662 char *name = qs_get_attr_name(doc,attr);
2663 char *value = qs_get_attr_value(doc,attr);
2664 if (STRCASEEQ('t','T',"type",name)) {
2665 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2669 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2673 if (IS_CSS_ON(chtml40->entryp)) {
2674 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2676 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2677 css_property_t *cur;
2678 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2679 if (STRCASEEQ('d','D',"disc",cur->value)) {
2680 attr_type = apr_pstrdup(doc->pool, "disc");
2682 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2683 attr_type = apr_pstrdup(doc->pool, "circle");
2685 else if (STRCASEEQ('s','S',"square",cur->value)) {
2686 attr_type = apr_pstrdup(doc->pool, "square");
2699 return chtml40->out;
2704 * It is a handler who processes the UL tag.
2706 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2707 * destination is specified.
2708 * @param node [i] The UL tag node is specified.
2709 * @return The conversion result is returned.
2712 s_chtml40_end_ul_tag(void *pdoc, Node *UNUSED(child))
2714 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2715 Doc *doc = chtml40->doc;
2718 if (IS_CSS_ON(chtml40->entryp)) {
2719 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2722 return chtml40->out;
2727 * It is a handler who processes the PRE tag.
2729 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2730 * destination is specified.
2731 * @param node [i] The PRE tag node is specified.
2732 * @return The conversion result is returned.
2735 s_chtml40_start_pre_tag(void *pdoc, Node *node)
2737 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2738 Doc *doc = chtml40->doc;
2740 char *attr_style = NULL;
2742 for (attr = qs_get_attr(doc,node);
2744 attr = qs_get_next_attr(doc,attr)) {
2745 char *nm = qs_get_attr_name(doc,attr);
2746 char *val = qs_get_attr_value(doc,attr);
2747 if (val && STRCASEEQ('s','S',"style", nm)) {
2752 if (IS_CSS_ON(chtml40->entryp)) {
2753 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2756 chtml40->pre_flag++;
2759 return chtml40->out;
2764 * It is a handler who processes the PRE tag.
2766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2767 * destination is specified.
2768 * @param node [i] The PRE tag node is specified.
2769 * @return The conversion result is returned.
2772 s_chtml40_end_pre_tag(void *pdoc, Node *UNUSED(child))
2774 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2775 Doc *doc = chtml40->doc;
2778 chtml40->pre_flag--;
2779 if (IS_CSS_ON(chtml40->entryp)) {
2780 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2783 return chtml40->out;
2788 * It is a handler who processes the P tag.
2790 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2791 * destination is specified.
2792 * @param node [i] The P tag node is specified.
2793 * @return The conversion result is returned.
2796 s_chtml40_start_p_tag(void *pdoc, Node *node)
2802 char *attr_align = NULL;
2803 char *attr_style = NULL;
2804 char *attr_color = NULL;
2805 char *attr_blink = NULL;
2807 chtml40 = GET_CHTML40(pdoc);
2811 for (attr = qs_get_attr(doc,node);
2813 attr = qs_get_next_attr(doc,attr)) {
2814 char *nm = qs_get_attr_name(doc,attr);
2815 char *val = qs_get_attr_value(doc,attr);
2816 if (STRCASEEQ('a','A',"align", nm)) {
2817 /*----------------------------------------------------------------------*/
2818 /* CHTML 1.0 (W3C version 3.2) */
2819 /*----------------------------------------------------------------------*/
2820 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2821 attr_align = apr_pstrdup(doc->buf.pool, val);
2825 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2826 attr_style = apr_pstrdup(doc->buf.pool, val);
2829 if (IS_CSS_ON(chtml40->entryp)) {
2830 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2832 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2833 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2834 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2835 css_property_t *cur;
2836 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2837 if (STRCASEEQ('l','L',"left",cur->value)) {
2838 attr_align = apr_pstrdup(doc->pool, "left");
2840 else if (STRCASEEQ('c','C',"center",cur->value)) {
2841 attr_align = apr_pstrdup(doc->pool, "center");
2843 else if (STRCASEEQ('r','R',"right",cur->value)) {
2844 attr_align = apr_pstrdup(doc->pool, "right");
2847 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2848 if (cur->value && *cur->value) {
2849 attr_color = apr_pstrdup(doc->pool, cur->value);
2852 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2853 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2854 attr_blink = apr_pstrdup(doc->pool, cur->value);
2867 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
2868 memset(flg, 0, sizeof(*flg));
2870 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2871 W_L("<font color=\"");
2874 flg->with_font_flag = 1;
2878 flg->with_blink_flag = 1;
2880 node->userData = (void *)flg;
2882 return chtml40->out;
2887 * It is a handler who processes the P tag.
2889 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2890 * destination is specified.
2891 * @param node [i] The P tag node is specified.
2892 * @return The conversion result is returned.
2895 s_chtml40_end_p_tag(void *pdoc, Node *node)
2900 chtml40 = GET_CHTML40(pdoc);
2903 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
2904 if (flg->with_font_flag) {
2907 if (flg->with_blink_flag) {
2911 if (IS_CSS_ON(chtml40->entryp)) {
2912 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2915 return chtml40->out;
2920 * It is a handler who processes the OL tag.
2922 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2923 * destination is specified.
2924 * @param node [i] The OL tag node is specified.
2925 * @return The conversion result is returned.
2928 s_chtml40_start_ol_tag(void *pdoc, Node *node)
2934 char *attr_style = NULL;
2935 char *attr_start = NULL;
2936 char *attr_type = NULL;
2938 chtml40 = GET_CHTML40(pdoc);
2942 /*--------------------------------------------------------------------------*/
2943 /* Get Attributes */
2944 /*--------------------------------------------------------------------------*/
2945 for (attr = qs_get_attr(doc,node);
2947 attr = qs_get_next_attr(doc,attr)) {
2948 char *name = qs_get_attr_name(doc,attr);
2949 char *value = qs_get_attr_value(doc,attr);
2950 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2953 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2956 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2960 if (IS_CSS_ON(chtml40->entryp)) {
2961 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2963 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2964 css_property_t *cur;
2965 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2966 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2967 attr_type = apr_pstrdup(doc->pool, "1");
2969 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2970 attr_type = apr_pstrdup(doc->pool, "A");
2972 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2973 attr_type = apr_pstrdup(doc->pool, "a");
2991 return chtml40->out;
2996 * It is a handler who processes the OL tag.
2998 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2999 * destination is specified.
3000 * @param node [i] The OL tag node is specified.
3001 * @return The conversion result is returned.
3004 s_chtml40_end_ol_tag(void *pdoc, Node *UNUSED(node))
3006 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3007 Doc *doc = chtml40->doc;
3010 if (IS_CSS_ON(chtml40->entryp)) {
3011 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3014 return chtml40->out;
3019 * It is a handler who processes the LI tag.
3021 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3022 * destination is specified.
3023 * @param node [i] The LI tag node is specified.
3024 * @return The conversion result is returned.
3027 s_chtml40_start_li_tag(void *pdoc, Node *node)
3029 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3030 Doc *doc = chtml40->doc;
3032 char *attr_type = NULL;
3033 char *attr_value = NULL;
3034 char *attr_style = NULL;
3036 /*--------------------------------------------------------------------------*/
3037 /* Get Attributes */
3038 /*--------------------------------------------------------------------------*/
3039 for (attr = qs_get_attr(doc,node);
3041 attr = qs_get_next_attr(doc,attr)) {
3042 char *name = qs_get_attr_name(doc,attr);
3043 char *value = qs_get_attr_value(doc,attr);
3044 if (STRCASEEQ('t','T',"type",name)) {
3045 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3049 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3052 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3056 if (IS_CSS_ON(chtml40->entryp)) {
3057 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3059 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3060 css_property_t *cur;
3061 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3062 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3063 attr_type = apr_pstrdup(doc->pool, "1");
3065 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3066 attr_type = apr_pstrdup(doc->pool, "A");
3068 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3069 attr_type = apr_pstrdup(doc->pool, "a");
3071 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3072 attr_type = apr_pstrdup(doc->pool, "disc");
3074 else if (STRCASEEQ('s','S',"square", cur->value)) {
3075 attr_type = apr_pstrdup(doc->pool, "square");
3077 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3078 attr_type = apr_pstrdup(doc->pool, "circle");
3096 return chtml40->out;
3101 * It is a handler who processes the LI tag.
3103 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3104 * destination is specified.
3105 * @param node [i] The LI tag node is specified.
3106 * @return The conversion result is returned.
3109 s_chtml40_end_li_tag(void *pdoc, Node *UNUSED(child))
3111 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3113 if (IS_CSS_ON(chtml40->entryp)) {
3114 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3116 return chtml40->out;
3121 * It is a handler who processes the H1 tag.
3123 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3124 * destination is specified.
3125 * @param node [i] The H1 tag node is specified.
3126 * @return The conversion result is returned.
3129 s_chtml40_start_h1_tag(void *pdoc, Node *node)
3135 char *attr_style = NULL;
3136 char *attr_align = NULL;
3138 chtml40 = GET_CHTML40(pdoc);
3142 for (attr = qs_get_attr(doc,node);
3144 attr = qs_get_next_attr(doc,attr)) {
3145 char *name = qs_get_attr_name(doc,attr);
3146 char *value = qs_get_attr_value(doc,attr);
3147 if (STRCASEEQ('a','A',"align", name)) {
3148 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3152 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3156 if (IS_CSS_ON(chtml40->entryp)) {
3157 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3159 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3160 css_property_t *cur;
3161 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3162 if (STRCASEEQ('l','L',"left", cur->value)) {
3163 attr_align = apr_pstrdup(doc->pool, "left");
3165 else if (STRCASEEQ('c','C',"center",cur->value)) {
3166 attr_align = apr_pstrdup(doc->pool, "center");
3168 else if (STRCASEEQ('r','R',"right",cur->value)) {
3169 attr_align = apr_pstrdup(doc->pool, "right");
3182 return chtml40->out;
3187 * It is a handler who processes the H1 tag.
3189 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3190 * destination is specified.
3191 * @param node [i] The H1 tag node is specified.
3192 * @return The conversion result is returned.
3195 s_chtml40_end_h1_tag(void *pdoc, Node *UNUSED(child))
3200 chtml40 = GET_CHTML40(pdoc);
3204 if (IS_CSS_ON(chtml40->entryp)) {
3205 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3208 return chtml40->out;
3213 * It is a handler who processes the H2 tag.
3215 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3216 * destination is specified.
3217 * @param node [i] The H2 tag node is specified.
3218 * @return The conversion result is returned.
3221 s_chtml40_start_h2_tag(void *pdoc, Node *node)
3227 char *attr_style = NULL;
3228 char *attr_align = NULL;
3230 chtml40 = GET_CHTML40(pdoc);
3234 for (attr = qs_get_attr(doc,node);
3236 attr = qs_get_next_attr(doc,attr)) {
3237 char *name = qs_get_attr_name(doc,attr);
3238 char *value = qs_get_attr_value(doc,attr);
3239 if (STRCASEEQ('a','A',"align", name)) {
3240 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3244 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3248 if (IS_CSS_ON(chtml40->entryp)) {
3249 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3251 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3252 css_property_t *cur;
3253 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3254 if (STRCASEEQ('l','L',"left", cur->value)) {
3255 attr_align = apr_pstrdup(doc->pool, "left");
3257 else if (STRCASEEQ('c','C',"center",cur->value)) {
3258 attr_align = apr_pstrdup(doc->pool, "center");
3260 else if (STRCASEEQ('r','R',"right",cur->value)) {
3261 attr_align = apr_pstrdup(doc->pool, "right");
3274 return chtml40->out;
3279 * It is a handler who processes the H2 tag.
3281 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3282 * destination is specified.
3283 * @param node [i] The H2 tag node is specified.
3284 * @return The conversion result is returned.
3287 s_chtml40_end_h2_tag(void *pdoc, Node *UNUSED(child))
3289 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3290 Doc *doc = chtml40->doc;
3293 if (IS_CSS_ON(chtml40->entryp)) {
3294 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3297 return chtml40->out;
3302 * It is a handler who processes the H3 tag.
3304 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3305 * destination is specified.
3306 * @param node [i] The H3 tag node is specified.
3307 * @return The conversion result is returned.
3310 s_chtml40_start_h3_tag(void *pdoc, Node *node)
3316 char *attr_style = NULL;
3317 char *attr_align = NULL;
3319 chtml40 = GET_CHTML40(pdoc);
3323 for (attr = qs_get_attr(doc,node);
3325 attr = qs_get_next_attr(doc,attr)) {
3326 char *name = qs_get_attr_name(doc,attr);
3327 char *value = qs_get_attr_value(doc,attr);
3328 if (STRCASEEQ('a','A',"align", name)) {
3329 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3333 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3337 if (IS_CSS_ON(chtml40->entryp)) {
3338 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3340 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3341 css_property_t *cur;
3342 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3343 if (STRCASEEQ('l','L',"left", cur->value)) {
3344 attr_align = apr_pstrdup(doc->pool, "left");
3346 else if (STRCASEEQ('c','C',"center",cur->value)) {
3347 attr_align = apr_pstrdup(doc->pool, "center");
3349 else if (STRCASEEQ('r','R',"right",cur->value)) {
3350 attr_align = apr_pstrdup(doc->pool, "right");
3363 return chtml40->out;
3368 * It is a handler who processes the H3 tag.
3370 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3371 * destination is specified.
3372 * @param node [i] The H3 tag node is specified.
3373 * @return The conversion result is returned.
3376 s_chtml40_end_h3_tag(void *pdoc, Node *UNUSED(child))
3378 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3379 Doc *doc = chtml40->doc;
3382 if (IS_CSS_ON(chtml40->entryp)) {
3383 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3386 return chtml40->out;
3391 * It is a handler who processes the H4 tag.
3393 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3394 * destination is specified.
3395 * @param node [i] The H4 tag node is specified.
3396 * @return The conversion result is returned.
3399 s_chtml40_start_h4_tag(void *pdoc, Node *node)
3405 char *attr_style = NULL;
3406 char *attr_align = NULL;
3408 chtml40 = GET_CHTML40(pdoc);
3412 for (attr = qs_get_attr(doc,node);
3414 attr = qs_get_next_attr(doc,attr)) {
3415 char *name = qs_get_attr_name(doc,attr);
3416 char *value = qs_get_attr_value(doc,attr);
3417 if (STRCASEEQ('a','A',"align", name)) {
3418 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3422 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3426 if (IS_CSS_ON(chtml40->entryp)) {
3427 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3429 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3430 css_property_t *cur;
3431 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3432 if (STRCASEEQ('l','L',"left", cur->value)) {
3433 attr_align = apr_pstrdup(doc->pool, "left");
3435 else if (STRCASEEQ('c','C',"center",cur->value)) {
3436 attr_align = apr_pstrdup(doc->pool, "center");
3438 else if (STRCASEEQ('r','R',"right",cur->value)) {
3439 attr_align = apr_pstrdup(doc->pool, "right");
3452 return chtml40->out;
3457 * It is a handler who processes the H4 tag.
3459 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3460 * destination is specified.
3461 * @param node [i] The H4 tag node is specified.
3462 * @return The conversion result is returned.
3465 s_chtml40_end_h4_tag(void *pdoc, Node *UNUSED(child))
3467 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3468 Doc *doc = chtml40->doc;
3471 if (IS_CSS_ON(chtml40->entryp)) {
3472 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3475 return chtml40->out;
3480 * It is a handler who processes the H5 tag.
3482 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3483 * destination is specified.
3484 * @param node [i] The H5 tag node is specified.
3485 * @return The conversion result is returned.
3488 s_chtml40_start_h5_tag(void *pdoc, Node *node)
3494 char *attr_style = NULL;
3495 char *attr_align = NULL;
3497 chtml40 = GET_CHTML40(pdoc);
3501 for (attr = qs_get_attr(doc,node);
3503 attr = qs_get_next_attr(doc,attr)) {
3504 char *name = qs_get_attr_name(doc,attr);
3505 char *value = qs_get_attr_value(doc,attr);
3506 if (STRCASEEQ('a','A',"align", name)) {
3507 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3511 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3515 if (IS_CSS_ON(chtml40->entryp)) {
3516 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3518 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3519 css_property_t *cur;
3520 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3521 if (STRCASEEQ('l','L',"left", cur->value)) {
3522 attr_align = apr_pstrdup(doc->pool, "left");
3524 else if (STRCASEEQ('c','C',"center",cur->value)) {
3525 attr_align = apr_pstrdup(doc->pool, "center");
3527 else if (STRCASEEQ('r','R',"right",cur->value)) {
3528 attr_align = apr_pstrdup(doc->pool, "right");
3541 return chtml40->out;
3546 * It is a handler who processes the H5 tag.
3548 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3549 * destination is specified.
3550 * @param node [i] The H5 tag node is specified.
3551 * @return The conversion result is returned.
3554 s_chtml40_end_h5_tag(void *pdoc, Node *UNUSED(child))
3556 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3557 Doc *doc = chtml40->doc;
3560 if (IS_CSS_ON(chtml40->entryp)) {
3561 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3564 return chtml40->out;
3569 * It is a handler who processes the H6 tag.
3571 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3572 * destination is specified.
3573 * @param node [i] The H6 tag node is specified.
3574 * @return The conversion result is returned.
3577 s_chtml40_start_h6_tag(void *pdoc, Node *node)
3583 char *attr_style = NULL;
3584 char *attr_align = NULL;
3586 chtml40 = GET_CHTML40(pdoc);
3590 for (attr = qs_get_attr(doc,node);
3592 attr = qs_get_next_attr(doc,attr)) {
3593 char *name = qs_get_attr_name(doc,attr);
3594 char *value = qs_get_attr_value(doc,attr);
3595 if (STRCASEEQ('a','A',"align", name)) {
3596 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3600 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3604 if (IS_CSS_ON(chtml40->entryp)) {
3605 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3607 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3608 css_property_t *cur;
3609 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3610 if (STRCASEEQ('l','L',"left", cur->value)) {
3611 attr_align = apr_pstrdup(doc->pool, "left");
3613 else if (STRCASEEQ('c','C',"center",cur->value)) {
3614 attr_align = apr_pstrdup(doc->pool, "center");
3616 else if (STRCASEEQ('r','R',"right",cur->value)) {
3617 attr_align = apr_pstrdup(doc->pool, "right");
3630 return chtml40->out;
3635 * It is a handler who processes the H6 tag.
3637 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3638 * destination is specified.
3639 * @param node [i] The H6 tag node is specified.
3640 * @return The conversion result is returned.
3643 s_chtml40_end_h6_tag(void *pdoc, Node *UNUSED(child))
3645 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3646 Doc *doc = chtml40->doc;
3649 if (IS_CSS_ON(chtml40->entryp)) {
3650 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3653 return chtml40->out;
3658 * It is a handler who processes the TEXTARE tag.
3660 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3661 * destination is specified.
3662 * @param node [i] The TEXTAREA tag node is specified.
3663 * @return The conversion result is returned.
3666 s_chtml40_start_textarea_tag(void *pdoc, Node *node)
3672 char *attr_accesskey = NULL;
3673 char *attr_name = NULL;
3674 char *attr_rows = NULL;
3675 char *attr_cols = NULL;
3676 char *attr_istyle = NULL;
3677 char *attr_style = NULL;
3679 chtml40 = GET_CHTML40(pdoc);
3683 chtml40->textarea_flag++;
3685 for (attr = qs_get_attr(doc,node);
3687 attr = qs_get_next_attr(doc,attr)) {
3688 char *name = qs_get_attr_name(doc,attr);
3689 char *value = qs_get_attr_value(doc,attr);
3690 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3691 attr_accesskey = value;
3693 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3694 attr_istyle = value;
3696 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3699 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3702 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3705 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3709 if (IS_CSS_ON(chtml40->entryp)) {
3710 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
3712 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3713 css_property_t *cur;
3714 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3715 if (strcasestr(cur->value, "<ja:n>")) {
3718 else if (strcasestr(cur->value, "<ja:en>")) {
3721 else if (strcasestr(cur->value, "<ja:hk>")) {
3724 else if (strcasestr(cur->value, "<ja:h>")) {
3731 if (attr_accesskey) {
3732 W_L(" accesskey=\"");
3733 W_V(attr_accesskey);
3757 return chtml40->out;
3762 * It is a handler who processes the TEXTAREA tag.
3764 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3765 * destination is specified.
3766 * @param node [i] The TEXTAREA tag node is specified.
3767 * @return The conversion result is returned.
3770 s_chtml40_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3772 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3773 Doc *doc = chtml40->doc;
3776 chtml40->textarea_flag--;
3778 return chtml40->out;
3783 s_chtml40_chxjif_tag(void *pdoc, Node *node)
3790 chtml40 = GET_CHTML40(pdoc);
3794 for (child = qs_get_child_node(doc, node);
3796 child = qs_get_next_node(doc, child)) {
3798 s_chtml40_chxjif_tag(chtml40, child);
3806 s_chtml40_text_tag(void *pdoc, Node *child)
3819 chtml40 = GET_CHTML40(pdoc);
3823 textval = qs_get_node_value(doc,child);
3824 if (strlen(textval) == 0) {
3825 return chtml40->out;
3828 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3829 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3831 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3832 memset(one_byte, 0, sizeof(one_byte));
3835 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3837 int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out);
3839 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3844 if (is_sjis_kanji(textval[ii])) {
3845 one_byte[0] = textval[ii+0];
3846 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3847 one_byte[0] = textval[ii+1];
3848 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3851 else if (chtml40->pre_flag) {
3852 one_byte[0] = textval[ii+0];
3853 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3855 else if (chtml40->textarea_flag) {
3856 one_byte[0] = textval[ii+0];
3857 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3859 else if (textval[ii] != '\r' && textval[ii] != '\n') {
3860 one_byte[0] = textval[ii+0];
3861 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3865 return chtml40->out;
3870 * It is a handler who processes the BLOCKQUOTE tag.
3872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3873 * destination is specified.
3874 * @param node [i] The BLOCKQUOTE tag node is specified.
3875 * @return The conversion result is returned.
3878 s_chtml40_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3880 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3881 Doc *doc = chtml40->doc;
3882 W_L("<blockquote>");
3883 return chtml40->out;
3888 * It is a handler who processes the BLOCKQUOTE tag.
3890 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3891 * destination is specified.
3892 * @param node [i] The BLOCKQUOTE tag node is specified.
3893 * @return The conversion result is returned.
3896 s_chtml40_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3898 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3899 Doc *doc = chtml40->doc;
3900 W_L("</blockquote>");
3901 return chtml40->out;
3906 * It is a handler who processes the DIR tag.
3908 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3909 * destination is specified.
3910 * @param node [i] The DIR tag node is specified.
3911 * @return The conversion result is returned.
3914 s_chtml40_start_dir_tag(void *pdoc, Node *node)
3916 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3917 Doc *doc = chtml40->doc;
3920 for (attr = qs_get_attr(doc,node);
3922 attr = qs_get_next_attr(doc,attr)) {
3923 char *name = qs_get_attr_name(doc,attr);
3924 char *value = qs_get_attr_value(doc,attr);
3925 if (STRCASEEQ('t','T',"type",name)) {
3926 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3934 return chtml40->out;
3939 * It is a handler who processes the DIR tag.
3941 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3942 * destination is specified.
3943 * @param node [i] The DIR tag node is specified.
3944 * @return The conversion result is returned.
3947 s_chtml40_end_dir_tag(void *pdoc, Node *UNUSED(child))
3949 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3950 Doc *doc = chtml40->doc;
3952 return chtml40->out;
3957 * It is a handler who processes the DL tag.
3959 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3960 * destination is specified.
3961 * @param node [i] The DL tag node is specified.
3962 * @return The conversion result is returned.
3965 s_chtml40_start_dl_tag(void *pdoc, Node *UNUSED(child))
3967 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3968 Doc *doc = chtml40->doc;
3970 return chtml40->out;
3975 * It is a handler who processes the DL tag.
3977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3978 * destination is specified.
3979 * @param node [i] The DL tag node is specified.
3980 * @return The conversion result is returned.
3983 s_chtml40_end_dl_tag(void *pdoc, Node *UNUSED(child))
3985 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3986 Doc *doc = chtml40->doc;
3988 return chtml40->out;
3993 * It is a handler who processes the DT tag.
3995 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3996 * destination is specified.
3997 * @param node [i] The DT tag node is specified.
3998 * @return The conversion result is returned.
4001 s_chtml40_start_dt_tag(void *pdoc, Node *node)
4003 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4004 Doc *doc = chtml40->doc;
4006 char *attr_style = NULL;
4008 for (attr = qs_get_attr(doc,node);
4010 attr = qs_get_next_attr(doc,attr)) {
4011 char *nm = qs_get_attr_name(doc,attr);
4012 char *val = qs_get_attr_value(doc,attr);
4013 if (val && STRCASEEQ('s','S',"style", nm)) {
4018 if (IS_CSS_ON(chtml40->entryp)) {
4019 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
4021 return chtml40->out;
4026 * It is a handler who processes the DT tag.
4028 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4029 * destination is specified.
4030 * @param node [i] The DT tag node is specified.
4031 * @return The conversion result is returned.
4034 s_chtml40_end_dt_tag(void *pdoc, Node *UNUSED(child))
4036 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4037 if (IS_CSS_ON(chtml40->entryp)) {
4038 chxj_css_pop_prop_list(chtml40->css_prop_stack);
4040 return chtml40->out;
4045 * It is a handler who processes the DD tag.
4047 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4048 * destination is specified.
4049 * @param node [i] The DD tag node is specified.
4050 * @return The conversion result is returned.
4053 s_chtml40_start_dd_tag(void *pdoc, Node *UNUSED(child))
4055 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4056 Doc *doc = chtml40->doc;
4060 return chtml40->out;
4065 * It is a handler who processes the DD tag.
4067 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4068 * destination is specified.
4069 * @param node [i] The DD tag node is specified.
4070 * @return The conversion result is returned.
4073 s_chtml40_end_dd_tag(void *pdoc, Node *UNUSED(child))
4075 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4077 return chtml40->out;
4082 * It is a handler who processes the MARQUEE tag.
4084 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4085 * destination is specified.
4086 * @param node [i] The MARQUEE tag node is specified.
4087 * @return The conversion result is returned.
4090 s_chtml40_start_marquee_tag(void *pdoc, Node *node)
4092 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4093 Doc *doc = chtml40->doc;
4096 /*--------------------------------------------------------------------------*/
4097 /* Get Attributes */
4098 /*--------------------------------------------------------------------------*/
4099 for (attr = qs_get_attr(doc,node);
4101 attr = qs_get_next_attr(doc,attr)) {
4102 char *name = qs_get_attr_name(doc,attr);
4103 char *value = qs_get_attr_value(doc,attr);
4104 if (STRCASEEQ('d','D',"direction", name)) {
4105 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
4106 W_L(" direction=\"");
4111 else if (STRCASEEQ('b','B',"behavior",name)) {
4112 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
4113 W_L(" behavior=\"");
4118 else if (STRCASEEQ('l','L',"loop",name)) {
4119 if (value && *value) {
4127 return chtml40->out;
4132 * It is a handler who processes the MARQUEE tag.
4134 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4135 * destination is specified.
4136 * @param node [i] The MARQUEE tag node is specified.
4137 * @return The conversion result is returned.
4140 s_chtml40_end_marquee_tag(void *pdoc, Node *UNUSED(child))
4142 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4143 Doc *doc = chtml40->doc;
4145 return chtml40->out;
4150 * It is a handler who processes the BLINK tag.
4152 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4153 * destination is specified.
4154 * @param node [i] The BLINK tag node is specified.
4155 * @return The conversion result is returned.
4158 s_chtml40_start_blink_tag(void *pdoc, Node *UNUSED(child))
4160 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4161 Doc *doc = chtml40->doc;
4163 return chtml40->out;
4168 * It is a handler who processes the BLINK tag.
4170 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4171 * destination is specified.
4172 * @param node [i] The BLINK tag node is specified.
4173 * @return The conversion result is returned.
4176 s_chtml40_end_blink_tag(void *pdoc, Node *UNUSED(child))
4178 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4179 Doc *doc = chtml40->doc;
4181 return chtml40->out;
4186 * It is a handler who processes the MENU tag.
4188 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4189 * destination is specified.
4190 * @param node [i] The MENU tag node is specified.
4191 * @return The conversion result is returned.
4194 s_chtml40_start_menu_tag(void *pdoc, Node *node)
4196 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4197 Doc *doc = chtml40->doc;
4200 /*--------------------------------------------------------------------------*/
4201 /* Get Attributes */
4202 /*--------------------------------------------------------------------------*/
4203 for (attr = qs_get_attr(doc,node);
4205 attr = qs_get_next_attr(doc,attr)) {
4206 char *name = qs_get_attr_name(doc,attr);
4207 char *value = qs_get_attr_value(doc,attr);
4208 if (STRCASEEQ('t','T',"type",name)) {
4209 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4217 return chtml40->out;
4222 * It is a handler who processes the MENU tag.
4224 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4225 * destination is specified.
4226 * @param node [i] The MENU tag node is specified.
4227 * @return The conversion result is returned.
4230 s_chtml40_end_menu_tag(void *pdoc, Node *UNUSED(child))
4232 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4233 Doc *doc = chtml40->doc;
4235 return chtml40->out;
4240 * It is a handler who processes the PLAINTEXT tag.
4242 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4243 * destination is specified.
4244 * @param node [i] The PLAINTEXT tag node is specified.
4245 * @return The conversion result is returned.
4248 s_chtml40_start_plaintext_tag(void *pdoc, Node *node)
4250 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4251 Doc *doc = chtml40->doc;
4253 s_chtml40_start_plaintext_tag_inner(pdoc,node);
4254 return chtml40->out;
4258 s_chtml40_start_plaintext_tag_inner(void *pdoc, Node *node)
4260 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4261 Doc *doc = chtml40->doc;
4263 for (child = qs_get_child_node(doc, node);
4265 child = qs_get_next_node(doc, child)) {
4267 s_chtml40_start_plaintext_tag_inner(pdoc, child);
4269 return chtml40->out;
4274 * It is a handler who processes the PLAINTEXT tag.
4276 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4277 * destination is specified.
4278 * @param node [i] The PLAINTEXT tag node is specified.
4279 * @return The conversion result is returned.
4282 s_chtml40_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4284 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4285 return chtml40->out;
4290 * It is handler who processes the New Line Code.
4293 s_chtml40_newline_mark(void *pdoc, Node *UNUSED(node))
4295 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4296 Doc *doc = chtml40->doc;
4298 return chtml40->out;
4303 * It is a handler who processes the LINK tag.
4305 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4306 * destination is specified.
4307 * @param node [i] The LINK tag node is specified.
4308 * @return The conversion result is returned.
4311 s_chtml40_link_tag(void *pdoc, Node *node)
4320 chtml40 = GET_CHTML40(pdoc);
4323 if (! IS_CSS_ON(chtml40->entryp)) {
4324 return chtml40->out;
4327 for (attr = qs_get_attr(doc,node);
4329 attr = qs_get_next_attr(doc,attr)) {
4330 char *name = qs_get_attr_name(doc,attr);
4331 char *value = qs_get_attr_value(doc,attr);
4332 if (STRCASEEQ('r','R',"rel", name)) {
4333 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4337 else if (STRCASEEQ('h','H',"href", name)) {
4338 if (value && *value) {
4342 else if (STRCASEEQ('t','T',"type", name)) {
4343 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4349 if (rel && href && type) {
4350 DBG(doc->r, "start load CSS. url:[%s]", href);
4351 chtml40->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml40->style, href);
4352 DBG(doc->r, "end load CSS. url:[%s]", href);
4355 return chtml40->out;
4358 static css_prop_list_t *
4359 s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4361 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4362 Doc *doc = chtml40->doc;
4363 css_prop_list_t *last_css = NULL;
4364 if (IS_CSS_ON(chtml40->entryp)) {
4365 css_prop_list_t *dup_css;
4366 css_selector_t *selector;
4368 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4369 dup_css = chxj_dup_css_prop_list(doc, last_css);
4370 selector = chxj_css_find_selector(doc, chtml40->style, node);
4372 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4374 chxj_css_push_prop_list(chtml40->css_prop_stack, dup_css);
4375 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4377 if (style_attr_value) {
4378 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));
4380 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4388 static css_prop_list_t *
4389 s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4391 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4392 Doc *doc = chtml40->doc;
4393 css_prop_list_t *last_css = NULL;
4394 if (IS_CSS_ON(chtml40->entryp)) {
4395 css_prop_list_t *dup_css;
4396 css_selector_t *selector;
4398 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4399 dup_css = chxj_dup_css_prop_list(doc, last_css);
4400 selector = chxj_css_find_selector(doc, chtml40->style, node);
4402 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4406 if (style_attr_value) {
4407 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));
4409 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);