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;
1451 chtml40 = GET_CHTML40(pdoc);
1455 /*--------------------------------------------------------------------------*/
1456 /* Get Attributes */
1457 /*--------------------------------------------------------------------------*/
1458 for (attr = qs_get_attr(doc,node);
1460 attr = qs_get_next_attr(doc,attr)) {
1461 char *name = qs_get_attr_name(doc,attr);
1462 char *value = qs_get_attr_value(doc,attr);
1466 if (strcasecmp(name, "action") == 0) {
1467 /*--------------------------------------------------------------------*/
1469 /*--------------------------------------------------------------------*/
1470 attr_action = value;
1476 if (strcasecmp(name, "method") == 0) {
1477 /*--------------------------------------------------------------------*/
1479 /*--------------------------------------------------------------------*/
1480 attr_method = value;
1486 if (strcasecmp(name, "utn") == 0) {
1487 /*--------------------------------------------------------------------*/
1489 /*--------------------------------------------------------------------*/
1496 if (strcasecmp(name, "style") == 0) {
1505 if (IS_CSS_ON(chtml40->entryp)) {
1506 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1508 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1509 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1510 css_property_t *cur;
1511 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1512 if (STRCASEEQ('l','L',"left", cur->value)) {
1513 attr_align = apr_pstrdup(doc->pool, "left");
1515 else if (STRCASEEQ('c','C',"center",cur->value)) {
1516 attr_align = apr_pstrdup(doc->pool, "center");
1518 else if (STRCASEEQ('r','R',"right",cur->value)) {
1519 attr_align = apr_pstrdup(doc->pool, "right");
1522 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1523 attr_color = apr_pstrdup(doc->pool, cur->value);
1529 attr_action = chxj_encoding_parameter(r, attr_action);
1530 attr_action = chxj_add_cookie_parameter(r, attr_action, chtml40->cookie);
1545 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1546 memset(flg, 0, sizeof(*flg));
1548 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1549 W_L("<font color=\"");
1552 flg->with_font_flag = 1;
1555 W_L("<div align=\"");
1558 flg->with_div_flag = 1;
1560 node->userData = flg;
1562 return chtml40->out;
1567 * It is a handler who processes the FORM tag.
1569 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1570 * destination is specified.
1571 * @param node [i] The FORM tag node is specified.
1572 * @return The conversion result is returned.
1575 s_chtml40_end_form_tag(void *pdoc, Node *node)
1580 chtml40 = GET_CHTML40(pdoc);
1583 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1584 if (flg && flg->with_div_flag) {
1587 if (flg && flg->with_font_flag) {
1591 if (IS_CSS_ON(chtml40->entryp)) {
1592 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1595 return chtml40->out;
1600 * It is a handler who processes the INPUT tag.
1602 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1603 * destination is specified.
1604 * @param node [i] The INPUT tag node is specified.
1605 * @return The conversion result is returned.
1608 s_chtml40_start_input_tag(void *pdoc, Node *node)
1614 char *attr_accesskey = NULL;
1615 char *attr_max_length = NULL;
1616 char *attr_type = NULL;
1617 char *attr_name = NULL;
1618 char *attr_value = NULL;
1619 char *attr_istyle = NULL;
1620 char *attr_size = NULL;
1621 char *attr_checked = NULL;
1622 char *attr_style = NULL;
1624 chtml40 = GET_CHTML40(pdoc);
1628 /*--------------------------------------------------------------------------*/
1629 /* Get Attributes */
1630 /*--------------------------------------------------------------------------*/
1631 for (attr = qs_get_attr(doc,node);
1633 attr = qs_get_next_attr(doc,attr)) {
1634 char *name = qs_get_attr_name(doc,attr);
1635 char *value = qs_get_attr_value(doc,attr);
1636 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1637 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1638 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1639 STRCASEEQ('p','P',"password",tmp_type) ||
1640 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1641 STRCASEEQ('r','R',"radio", tmp_type) ||
1642 STRCASEEQ('h','H',"hidden", tmp_type) ||
1643 STRCASEEQ('s','S',"submit", tmp_type) ||
1644 STRCASEEQ('r','R',"reset", tmp_type))) {
1645 attr_type = tmp_type;
1648 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1651 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1654 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1655 attr_istyle = value;
1657 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1658 attr_max_length = value;
1660 else if (STRCASEEQ('c','C',"checked", name)) {
1661 attr_checked = value;
1663 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1664 attr_accesskey = value;
1666 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1669 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1674 if (IS_CSS_ON(chtml40->entryp)) {
1675 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
1677 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1678 css_property_t *cur;
1679 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1680 if (strcasestr(cur->value, "<ja:n>")) {
1683 else if (strcasestr(cur->value, "<ja:en>")) {
1686 else if (strcasestr(cur->value, "<ja:hk>")) {
1689 else if (strcasestr(cur->value, "<ja:h>")) {
1714 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1717 if (attr_accesskey) {
1718 W_L(" accesskey=\"");
1719 W_V(attr_accesskey);
1723 if (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4') {
1729 /*--------------------------------------------------------------------------*/
1730 /* The figure is default for the password. */
1731 /*--------------------------------------------------------------------------*/
1732 if (attr_max_length) {
1733 if (chxj_chk_numeric(attr_max_length) != 0) {
1734 attr_max_length = apr_psprintf(doc->buf.pool, "0");
1736 if (attr_istyle && *attr_istyle == '1') {
1737 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length) * 2);
1741 char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(attr_max_length));
1750 return chtml40->out;
1755 * It is a handler who processes the INPUT tag.
1757 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1758 * destination is specified.
1759 * @param node [i] The INPUT tag node is specified.
1760 * @return The conversion result is returned.
1763 s_chtml40_end_input_tag(void *pdoc, Node *UNUSED(child))
1765 chtml40_t *chtml40 = GET_CHTML40(pdoc);
1767 return chtml40->out;
1772 * It is a handler who processes the CENTER tag.
1774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1775 * destination is specified.
1776 * @param node [i] The CENTER tag node is specified.
1777 * @return The conversion result is returned.
1780 s_chtml40_start_center_tag(void *pdoc, Node *node)
1785 char *attr_style = NULL;
1786 char *attr_color = NULL;
1788 chtml40 = GET_CHTML40(pdoc);
1791 for (attr = qs_get_attr(doc,node);
1793 attr = qs_get_next_attr(doc,attr)) {
1794 char *name = qs_get_attr_name(doc,attr);
1795 char *value = qs_get_attr_value(doc,attr);
1796 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1800 if (IS_CSS_ON(chtml40->entryp)) {
1801 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
1803 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1804 css_property_t *cur;
1805 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1806 if (cur->value && *cur->value) {
1807 attr_color = apr_pstrdup(doc->pool, cur->value);
1814 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
1815 memset(flg, 0, sizeof(*flg));
1817 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1818 W_L("<font color=\"");
1821 flg->with_font_flag = 1;
1823 node->userData = flg;
1825 return chtml40->out;
1830 * It is a handler who processes the CENTER tag.
1832 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1833 * destination is specified.
1834 * @param node [i] The CENTER tag node is specified.
1835 * @return The conversion result is returned.
1838 s_chtml40_end_center_tag(void *pdoc, Node *node)
1843 chtml40 = GET_CHTML40(pdoc);
1846 if (IS_CSS_ON(chtml40->entryp)) {
1847 chxj_css_pop_prop_list(chtml40->css_prop_stack);
1849 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
1850 if (flg && flg->with_font_flag) {
1855 return chtml40->out;
1860 * It is a handler who processes the HR tag.
1862 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1863 * destination is specified.
1864 * @param node [i] The HR tag node is specified.
1865 * @return The conversion result is returned.
1868 s_chtml40_start_hr_tag(void *pdoc, Node *node)
1874 char *attr_align = NULL;
1875 char *attr_size = NULL;
1876 char *attr_width = NULL;
1877 char *attr_noshade = NULL;
1878 char *attr_style = NULL;
1879 char *attr_color = NULL;
1881 chtml40 = GET_CHTML40(pdoc);
1885 for (attr = qs_get_attr(doc,node);
1887 attr = qs_get_next_attr(doc,attr)) {
1888 char *name = qs_get_attr_name (doc,attr);
1889 char *value = qs_get_attr_value(doc,attr);
1893 if (strcasecmp(name, "align") == 0) {
1894 /*--------------------------------------------------------------------*/
1896 /*--------------------------------------------------------------------*/
1897 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1905 if (strcasecmp(name, "size") == 0) {
1906 /*--------------------------------------------------------------------*/
1908 /*--------------------------------------------------------------------*/
1909 if (value && *value) {
1913 else if (strcasecmp(name, "style") == 0) {
1914 if (value && *value) {
1922 if (strcasecmp(name, "width") == 0) {
1923 /*--------------------------------------------------------------------*/
1925 /*--------------------------------------------------------------------*/
1926 if (value && *value) {
1934 if (strcasecmp(name, "noshade") == 0) {
1935 /*--------------------------------------------------------------------*/
1937 /*--------------------------------------------------------------------*/
1938 attr_noshade = apr_pstrdup(doc->pool, "noshade");
1944 if (strcasecmp(name, "color") == 0 && value && *value) {
1945 /*--------------------------------------------------------------------*/
1947 /*--------------------------------------------------------------------*/
1956 if (IS_CSS_ON(chtml40->entryp)) {
1957 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
1959 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
1960 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1961 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1962 css_property_t *cur;
1963 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
1964 if (STRCASEEQ('s','S',"solid",cur->value)) {
1965 attr_noshade = "noshade";
1968 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1969 char *tmp = apr_pstrdup(doc->pool, cur->value);
1970 char *tmpp = strstr(tmp, "px");
1973 attr_size = apr_pstrdup(doc->pool, tmp);
1976 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1977 char *tmp = apr_pstrdup(doc->pool, cur->value);
1978 char *tmpp = strstr(tmp, "px");
1981 attr_width = apr_pstrdup(doc->pool, tmp);
1984 tmpp = strstr(tmp, "%");
1986 attr_width = apr_pstrdup(doc->pool, tmp);
2017 return chtml40->out;
2022 * It is a handler who processes the HR tag.
2024 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2025 * destination is specified.
2026 * @param node [i] The HR tag node is specified.
2027 * @return The conversion result is returned.
2030 s_chtml40_end_hr_tag(void *pdoc, Node *UNUSED(child))
2032 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2034 return chtml40->out;
2039 * It is a handler who processes the IMG tag.
2041 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2042 * destination is specified.
2043 * @param node [i] The IMG tag node is specified.
2044 * @return The conversion result is returned.
2047 s_chtml40_start_img_tag(void *pdoc, Node *node)
2053 char *attr_src = NULL;
2054 char *attr_align = NULL;
2055 char *attr_style = NULL;
2056 char *attr_alt = NULL;
2057 char *attr_width = NULL;
2058 char *attr_height = NULL;
2059 char *attr_hspace = NULL;
2060 char *attr_vspace = NULL;
2061 #ifndef IMG_NOT_CONVERT_FILENAME
2065 chtml40 = GET_CHTML40(pdoc);
2066 #ifndef IMG_NOT_CONVERT_FILENAME
2067 spec = chtml40->spec;
2072 /*--------------------------------------------------------------------------*/
2073 /* Get Attributes */
2074 /*--------------------------------------------------------------------------*/
2075 for (attr = qs_get_attr(doc,node);
2077 attr = qs_get_next_attr(doc,attr)) {
2078 char *name = qs_get_attr_name (doc,attr);
2079 char *value = qs_get_attr_value(doc,attr);
2083 if (strcasecmp(name, "src") == 0) {
2084 /*--------------------------------------------------------------------*/
2086 /*--------------------------------------------------------------------*/
2087 #ifdef IMG_NOT_CONVERT_FILENAME
2088 value = chxj_encoding_parameter(r, value);
2089 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2091 value = apr_psprintf(doc->buf.pool,
2094 (strchr(value, '?')) ? '&' : '?',
2095 CHXJ_COOKIE_NOUPDATE_PARAM);
2099 value = chxj_img_conv(r, spec, value);
2100 value = chxj_encoding_parameter(r, value);
2101 value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
2103 value = apr_psprintf(doc->buf.pool,
2106 (strchr(value, '?')) ? '&' : '?',
2107 CHXJ_COOKIE_NOUPDATE_PARAM);
2112 else if (strcasecmp(name,"style") == 0 && value && *value) {
2119 if (strcasecmp(name, "align" ) == 0) {
2120 /*--------------------------------------------------------------------*/
2122 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2125 /*--------------------------------------------------------------------*/
2127 if (STRCASEEQ('t','T',"top", value) ||
2128 STRCASEEQ('m','M',"middle",value) ||
2129 STRCASEEQ('b','B',"bottom",value) ||
2130 STRCASEEQ('l','L',"left", value) ||
2131 STRCASEEQ('r','R',"right", value)) {
2134 else if (STRCASEEQ('c','C',"center", value)) {
2135 attr_align = apr_pstrdup(doc->pool, "middle");
2139 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2140 /*--------------------------------------------------------------------*/
2142 /*--------------------------------------------------------------------*/
2149 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2159 if (strcasecmp(name, "height") == 0 && value && *value) {
2160 /*--------------------------------------------------------------------*/
2162 /*--------------------------------------------------------------------*/
2163 attr_height = value;
2166 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2167 /*--------------------------------------------------------------------*/
2169 /*--------------------------------------------------------------------*/
2170 attr_hspace = value;
2176 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2177 /*--------------------------------------------------------------------*/
2179 /*--------------------------------------------------------------------*/
2180 attr_vspace = value;
2189 if (IS_CSS_ON(chtml40->entryp)) {
2190 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
2192 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2193 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2194 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2195 css_property_t *cur;
2196 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2197 attr_height = apr_pstrdup(doc->pool, cur->value);
2199 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2200 attr_width = apr_pstrdup(doc->pool, cur->value);
2202 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2203 attr_align = apr_pstrdup(doc->pool, cur->value);
2245 return chtml40->out;
2250 * It is a handler who processes the IMG tag.
2252 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2253 * destination is specified.
2254 * @param node [i] The IMG tag node is specified.
2255 * @return The conversion result is returned.
2258 s_chtml40_end_img_tag(void *pdoc, Node *UNUSED(child))
2260 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2262 return chtml40->out;
2267 * It is a handler who processes the SELECT tag.
2269 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2270 * destination is specified.
2271 * @param node [i] The SELECT tag node is specified.
2272 * @return The conversion result is returned.
2275 s_chtml40_start_select_tag(void *pdoc, Node *child)
2277 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2278 Doc *doc = chtml40->doc;
2281 char *multiple = NULL;
2285 for (attr = qs_get_attr(doc,child);
2287 attr = qs_get_next_attr(doc,attr)) {
2288 char *nm = qs_get_attr_name(doc,attr);
2289 char *val = qs_get_attr_value(doc,attr);
2290 if (STRCASEEQ('s','S',"size", nm)) {
2291 /*----------------------------------------------------------------------*/
2292 /* CHTML 1.0 version 2.0 */
2293 /*----------------------------------------------------------------------*/
2294 size = apr_pstrdup(doc->buf.pool, val);
2296 else if (STRCASEEQ('n','N',"name", nm)) {
2297 /*----------------------------------------------------------------------*/
2298 /* CHTML 1.0 version 2.0 */
2299 /*----------------------------------------------------------------------*/
2300 name = apr_pstrdup(doc->buf.pool, val);
2302 else if (STRCASEEQ('m','M',"multiple", nm)) {
2303 /*----------------------------------------------------------------------*/
2304 /* CHTML 1.0 version 2.0 */
2305 /*----------------------------------------------------------------------*/
2306 multiple = apr_pstrdup(doc->buf.pool, val);
2309 if (size && *size) {
2314 if (name && *name) {
2323 return chtml40->out;
2328 * It is a handler who processes the SELECT tag.
2330 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2331 * destination is specified.
2332 * @param node [i] The SELECT tag node is specified.
2333 * @return The conversion result is returned.
2336 s_chtml40_end_select_tag(void *pdoc, Node *UNUSED(child))
2338 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2339 Doc *doc = chtml40->doc;
2342 return chtml40->out;
2347 * It is a handler who processes the OPTION tag.
2349 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2350 * destination is specified.
2351 * @param node [i] The OPTION tag node is specified.
2352 * @return The conversion result is returned.
2355 s_chtml40_start_option_tag(void *pdoc, Node *child)
2364 chtml40 = GET_CHTML40(pdoc);
2371 for (attr = qs_get_attr(doc,child);
2373 attr = qs_get_next_attr(doc,attr)) {
2374 char *nm = qs_get_attr_name(doc,attr);
2375 char *val = qs_get_attr_value(doc,attr);
2376 if (STRCASEEQ('s','S',"selected", nm)) {
2377 /*----------------------------------------------------------------------*/
2378 /* CHTML 1.0 version 2.0 */
2379 /*----------------------------------------------------------------------*/
2380 selected = apr_pstrdup(doc->buf.pool, val);
2382 else if (STRCASEEQ('v','V',"value", nm)) {
2383 /*----------------------------------------------------------------------*/
2384 /* CHTML 1.0 version 2.0 */
2385 /*----------------------------------------------------------------------*/
2386 value = apr_pstrdup(doc->buf.pool, val);
2389 if (value && *value) {
2398 return chtml40->out;
2403 * It is a handler who processes the OPTION tag.
2405 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2406 * destination is specified.
2407 * @param node [i] The OPTION tag node is specified.
2408 * @return The conversion result is returned.
2411 s_chtml40_end_option_tag(void *pdoc, Node *UNUSED(child))
2413 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2417 return chtml40->out;
2422 * It is a handler who processes the DIV tag.
2424 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2425 * destination is specified.
2426 * @param node [i] The DIV tag node is specified.
2427 * @return The conversion result is returned.
2430 s_chtml40_start_div_tag(void *pdoc, Node *child)
2438 chtml40 = GET_CHTML40(pdoc);
2444 for (attr = qs_get_attr(doc,child);
2446 attr = qs_get_next_attr(doc,attr)) {
2447 char *nm = qs_get_attr_name(doc,attr);
2448 char *val = qs_get_attr_value(doc,attr);
2449 if (STRCASEEQ('a','A',"align", nm)) {
2450 /*----------------------------------------------------------------------*/
2451 /* CHTML 1.0 (W3C version 3.2) */
2452 /*----------------------------------------------------------------------*/
2453 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2454 align = apr_pstrdup(doc->buf.pool, val);
2464 return chtml40->out;
2469 * It is a handler who processes the DIV tag.
2471 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2472 * destination is specified.
2473 * @param node [i] The DIV tag node is specified.
2474 * @return The conversion result is returned.
2477 s_chtml40_end_div_tag(void *pdoc, Node *UNUSED(node))
2479 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2480 Doc *doc = chtml40->doc;
2484 return chtml40->out;
2489 * It is a handler who processes the UL tag.
2491 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2492 * destination is specified.
2493 * @param node [i] The UL tag node is specified.
2494 * @return The conversion result is returned.
2497 s_chtml40_start_ul_tag(void *pdoc, Node *node)
2499 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2500 Doc *doc = chtml40->doc;
2502 char *attr_type = NULL;
2503 char *attr_style = NULL;
2504 /*--------------------------------------------------------------------------*/
2505 /* Get Attributes */
2506 /*--------------------------------------------------------------------------*/
2507 for (attr = qs_get_attr(doc,node);
2509 attr = qs_get_next_attr(doc,attr)) {
2510 char *name = qs_get_attr_name(doc,attr);
2511 char *value = qs_get_attr_value(doc,attr);
2512 if (STRCASEEQ('t','T',"type",name)) {
2513 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2517 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2521 if (IS_CSS_ON(chtml40->entryp)) {
2522 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2524 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2525 css_property_t *cur;
2526 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2527 if (STRCASEEQ('d','D',"disc",cur->value)) {
2528 attr_type = apr_pstrdup(doc->pool, "disc");
2530 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2531 attr_type = apr_pstrdup(doc->pool, "circle");
2533 else if (STRCASEEQ('s','S',"square",cur->value)) {
2534 attr_type = apr_pstrdup(doc->pool, "square");
2547 return chtml40->out;
2552 * It is a handler who processes the UL tag.
2554 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2555 * destination is specified.
2556 * @param node [i] The UL tag node is specified.
2557 * @return The conversion result is returned.
2560 s_chtml40_end_ul_tag(void *pdoc, Node *UNUSED(child))
2562 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2563 Doc *doc = chtml40->doc;
2566 if (IS_CSS_ON(chtml40->entryp)) {
2567 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2570 return chtml40->out;
2575 * It is a handler who processes the PRE tag.
2577 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2578 * destination is specified.
2579 * @param node [i] The PRE tag node is specified.
2580 * @return The conversion result is returned.
2583 s_chtml40_start_pre_tag(void *pdoc, Node *node)
2585 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2586 Doc *doc = chtml40->doc;
2588 char *attr_style = NULL;
2590 for (attr = qs_get_attr(doc,node);
2592 attr = qs_get_next_attr(doc,attr)) {
2593 char *nm = qs_get_attr_name(doc,attr);
2594 char *val = qs_get_attr_value(doc,attr);
2595 if (val && STRCASEEQ('s','S',"style", nm)) {
2600 if (IS_CSS_ON(chtml40->entryp)) {
2601 s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2604 chtml40->pre_flag++;
2607 return chtml40->out;
2612 * It is a handler who processes the PRE tag.
2614 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2615 * destination is specified.
2616 * @param node [i] The PRE tag node is specified.
2617 * @return The conversion result is returned.
2620 s_chtml40_end_pre_tag(void *pdoc, Node *UNUSED(child))
2622 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2623 Doc *doc = chtml40->doc;
2626 chtml40->pre_flag--;
2627 if (IS_CSS_ON(chtml40->entryp)) {
2628 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2631 return chtml40->out;
2636 * It is a handler who processes the P tag.
2638 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2639 * destination is specified.
2640 * @param node [i] The P tag node is specified.
2641 * @return The conversion result is returned.
2644 s_chtml40_start_p_tag(void *pdoc, Node *node)
2650 char *attr_align = NULL;
2651 char *attr_style = NULL;
2652 char *attr_color = NULL;
2653 char *attr_blink = NULL;
2655 chtml40 = GET_CHTML40(pdoc);
2659 for (attr = qs_get_attr(doc,node);
2661 attr = qs_get_next_attr(doc,attr)) {
2662 char *nm = qs_get_attr_name(doc,attr);
2663 char *val = qs_get_attr_value(doc,attr);
2664 if (STRCASEEQ('a','A',"align", nm)) {
2665 /*----------------------------------------------------------------------*/
2666 /* CHTML 1.0 (W3C version 3.2) */
2667 /*----------------------------------------------------------------------*/
2668 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2669 attr_align = apr_pstrdup(doc->buf.pool, val);
2673 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2674 attr_style = apr_pstrdup(doc->buf.pool, val);
2677 if (IS_CSS_ON(chtml40->entryp)) {
2678 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2680 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2681 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2682 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2683 css_property_t *cur;
2684 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2685 if (STRCASEEQ('l','L',"left",cur->value)) {
2686 attr_align = apr_pstrdup(doc->pool, "left");
2688 else if (STRCASEEQ('c','C',"center",cur->value)) {
2689 attr_align = apr_pstrdup(doc->pool, "center");
2691 else if (STRCASEEQ('r','R',"right",cur->value)) {
2692 attr_align = apr_pstrdup(doc->pool, "right");
2695 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2696 if (cur->value && *cur->value) {
2697 attr_color = apr_pstrdup(doc->pool, cur->value);
2700 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2701 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2702 attr_blink = apr_pstrdup(doc->pool, cur->value);
2715 chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
2716 memset(flg, 0, sizeof(*flg));
2718 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2719 W_L("<font color=\"");
2722 flg->with_font_flag = 1;
2726 flg->with_blink_flag = 1;
2728 node->userData = (void *)flg;
2730 return chtml40->out;
2735 * It is a handler who processes the P tag.
2737 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2738 * destination is specified.
2739 * @param node [i] The P tag node is specified.
2740 * @return The conversion result is returned.
2743 s_chtml40_end_p_tag(void *pdoc, Node *node)
2748 chtml40 = GET_CHTML40(pdoc);
2751 chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
2752 if (flg->with_font_flag) {
2755 if (flg->with_blink_flag) {
2759 if (IS_CSS_ON(chtml40->entryp)) {
2760 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2763 return chtml40->out;
2768 * It is a handler who processes the OL tag.
2770 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2771 * destination is specified.
2772 * @param node [i] The OL tag node is specified.
2773 * @return The conversion result is returned.
2776 s_chtml40_start_ol_tag(void *pdoc, Node *node)
2782 char *attr_style = NULL;
2783 char *attr_start = NULL;
2784 char *attr_type = NULL;
2786 chtml40 = GET_CHTML40(pdoc);
2790 /*--------------------------------------------------------------------------*/
2791 /* Get Attributes */
2792 /*--------------------------------------------------------------------------*/
2793 for (attr = qs_get_attr(doc,node);
2795 attr = qs_get_next_attr(doc,attr)) {
2796 char *name = qs_get_attr_name(doc,attr);
2797 char *value = qs_get_attr_value(doc,attr);
2798 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2801 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2804 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2808 if (IS_CSS_ON(chtml40->entryp)) {
2809 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2811 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2812 css_property_t *cur;
2813 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2814 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2815 attr_type = apr_pstrdup(doc->pool, "1");
2817 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2818 attr_type = apr_pstrdup(doc->pool, "A");
2820 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2821 attr_type = apr_pstrdup(doc->pool, "a");
2839 return chtml40->out;
2844 * It is a handler who processes the OL tag.
2846 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2847 * destination is specified.
2848 * @param node [i] The OL tag node is specified.
2849 * @return The conversion result is returned.
2852 s_chtml40_end_ol_tag(void *pdoc, Node *UNUSED(node))
2854 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2855 Doc *doc = chtml40->doc;
2858 if (IS_CSS_ON(chtml40->entryp)) {
2859 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2862 return chtml40->out;
2867 * It is a handler who processes the LI tag.
2869 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2870 * destination is specified.
2871 * @param node [i] The LI tag node is specified.
2872 * @return The conversion result is returned.
2875 s_chtml40_start_li_tag(void *pdoc, Node *node)
2877 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2878 Doc *doc = chtml40->doc;
2880 char *attr_type = NULL;
2881 char *attr_value = NULL;
2882 char *attr_style = NULL;
2884 /*--------------------------------------------------------------------------*/
2885 /* Get Attributes */
2886 /*--------------------------------------------------------------------------*/
2887 for (attr = qs_get_attr(doc,node);
2889 attr = qs_get_next_attr(doc,attr)) {
2890 char *name = qs_get_attr_name(doc,attr);
2891 char *value = qs_get_attr_value(doc,attr);
2892 if (STRCASEEQ('t','T',"type",name)) {
2893 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2897 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2900 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2904 if (IS_CSS_ON(chtml40->entryp)) {
2905 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
2907 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2908 css_property_t *cur;
2909 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2910 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2911 attr_type = apr_pstrdup(doc->pool, "1");
2913 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2914 attr_type = apr_pstrdup(doc->pool, "A");
2916 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2917 attr_type = apr_pstrdup(doc->pool, "a");
2919 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2920 attr_type = apr_pstrdup(doc->pool, "disc");
2922 else if (STRCASEEQ('s','S',"square", cur->value)) {
2923 attr_type = apr_pstrdup(doc->pool, "square");
2925 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2926 attr_type = apr_pstrdup(doc->pool, "circle");
2944 return chtml40->out;
2949 * It is a handler who processes the LI tag.
2951 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2952 * destination is specified.
2953 * @param node [i] The LI tag node is specified.
2954 * @return The conversion result is returned.
2957 s_chtml40_end_li_tag(void *pdoc, Node *UNUSED(child))
2959 chtml40_t *chtml40 = GET_CHTML40(pdoc);
2961 if (IS_CSS_ON(chtml40->entryp)) {
2962 chxj_css_pop_prop_list(chtml40->css_prop_stack);
2964 return chtml40->out;
2969 * It is a handler who processes the H1 tag.
2971 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2972 * destination is specified.
2973 * @param node [i] The H1 tag node is specified.
2974 * @return The conversion result is returned.
2977 s_chtml40_start_h1_tag(void *pdoc, Node *node)
2983 char *attr_style = NULL;
2984 char *attr_align = NULL;
2986 chtml40 = GET_CHTML40(pdoc);
2990 for (attr = qs_get_attr(doc,node);
2992 attr = qs_get_next_attr(doc,attr)) {
2993 char *name = qs_get_attr_name(doc,attr);
2994 char *value = qs_get_attr_value(doc,attr);
2995 if (STRCASEEQ('a','A',"align", name)) {
2996 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3000 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3004 if (IS_CSS_ON(chtml40->entryp)) {
3005 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3007 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3008 css_property_t *cur;
3009 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3010 if (STRCASEEQ('l','L',"left", cur->value)) {
3011 attr_align = apr_pstrdup(doc->pool, "left");
3013 else if (STRCASEEQ('c','C',"center",cur->value)) {
3014 attr_align = apr_pstrdup(doc->pool, "center");
3016 else if (STRCASEEQ('r','R',"right",cur->value)) {
3017 attr_align = apr_pstrdup(doc->pool, "right");
3030 return chtml40->out;
3035 * It is a handler who processes the H1 tag.
3037 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3038 * destination is specified.
3039 * @param node [i] The H1 tag node is specified.
3040 * @return The conversion result is returned.
3043 s_chtml40_end_h1_tag(void *pdoc, Node *UNUSED(child))
3048 chtml40 = GET_CHTML40(pdoc);
3052 if (IS_CSS_ON(chtml40->entryp)) {
3053 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3056 return chtml40->out;
3061 * It is a handler who processes the H2 tag.
3063 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3064 * destination is specified.
3065 * @param node [i] The H2 tag node is specified.
3066 * @return The conversion result is returned.
3069 s_chtml40_start_h2_tag(void *pdoc, Node *node)
3075 char *attr_style = NULL;
3076 char *attr_align = NULL;
3078 chtml40 = GET_CHTML40(pdoc);
3082 for (attr = qs_get_attr(doc,node);
3084 attr = qs_get_next_attr(doc,attr)) {
3085 char *name = qs_get_attr_name(doc,attr);
3086 char *value = qs_get_attr_value(doc,attr);
3087 if (STRCASEEQ('a','A',"align", name)) {
3088 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3092 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3096 if (IS_CSS_ON(chtml40->entryp)) {
3097 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3099 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3100 css_property_t *cur;
3101 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3102 if (STRCASEEQ('l','L',"left", cur->value)) {
3103 attr_align = apr_pstrdup(doc->pool, "left");
3105 else if (STRCASEEQ('c','C',"center",cur->value)) {
3106 attr_align = apr_pstrdup(doc->pool, "center");
3108 else if (STRCASEEQ('r','R',"right",cur->value)) {
3109 attr_align = apr_pstrdup(doc->pool, "right");
3122 return chtml40->out;
3127 * It is a handler who processes the H2 tag.
3129 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3130 * destination is specified.
3131 * @param node [i] The H2 tag node is specified.
3132 * @return The conversion result is returned.
3135 s_chtml40_end_h2_tag(void *pdoc, Node *UNUSED(child))
3137 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3138 Doc *doc = chtml40->doc;
3141 if (IS_CSS_ON(chtml40->entryp)) {
3142 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3145 return chtml40->out;
3150 * It is a handler who processes the H3 tag.
3152 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3153 * destination is specified.
3154 * @param node [i] The H3 tag node is specified.
3155 * @return The conversion result is returned.
3158 s_chtml40_start_h3_tag(void *pdoc, Node *node)
3164 char *attr_style = NULL;
3165 char *attr_align = NULL;
3167 chtml40 = GET_CHTML40(pdoc);
3171 for (attr = qs_get_attr(doc,node);
3173 attr = qs_get_next_attr(doc,attr)) {
3174 char *name = qs_get_attr_name(doc,attr);
3175 char *value = qs_get_attr_value(doc,attr);
3176 if (STRCASEEQ('a','A',"align", name)) {
3177 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3181 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3185 if (IS_CSS_ON(chtml40->entryp)) {
3186 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3188 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3189 css_property_t *cur;
3190 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3191 if (STRCASEEQ('l','L',"left", cur->value)) {
3192 attr_align = apr_pstrdup(doc->pool, "left");
3194 else if (STRCASEEQ('c','C',"center",cur->value)) {
3195 attr_align = apr_pstrdup(doc->pool, "center");
3197 else if (STRCASEEQ('r','R',"right",cur->value)) {
3198 attr_align = apr_pstrdup(doc->pool, "right");
3211 return chtml40->out;
3216 * It is a handler who processes the H3 tag.
3218 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3219 * destination is specified.
3220 * @param node [i] The H3 tag node is specified.
3221 * @return The conversion result is returned.
3224 s_chtml40_end_h3_tag(void *pdoc, Node *UNUSED(child))
3226 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3227 Doc *doc = chtml40->doc;
3230 if (IS_CSS_ON(chtml40->entryp)) {
3231 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3234 return chtml40->out;
3239 * It is a handler who processes the H4 tag.
3241 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3242 * destination is specified.
3243 * @param node [i] The H4 tag node is specified.
3244 * @return The conversion result is returned.
3247 s_chtml40_start_h4_tag(void *pdoc, Node *node)
3253 char *attr_style = NULL;
3254 char *attr_align = NULL;
3256 chtml40 = GET_CHTML40(pdoc);
3260 for (attr = qs_get_attr(doc,node);
3262 attr = qs_get_next_attr(doc,attr)) {
3263 char *name = qs_get_attr_name(doc,attr);
3264 char *value = qs_get_attr_value(doc,attr);
3265 if (STRCASEEQ('a','A',"align", name)) {
3266 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3270 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3274 if (IS_CSS_ON(chtml40->entryp)) {
3275 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3277 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3278 css_property_t *cur;
3279 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3280 if (STRCASEEQ('l','L',"left", cur->value)) {
3281 attr_align = apr_pstrdup(doc->pool, "left");
3283 else if (STRCASEEQ('c','C',"center",cur->value)) {
3284 attr_align = apr_pstrdup(doc->pool, "center");
3286 else if (STRCASEEQ('r','R',"right",cur->value)) {
3287 attr_align = apr_pstrdup(doc->pool, "right");
3300 return chtml40->out;
3305 * It is a handler who processes the H4 tag.
3307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3308 * destination is specified.
3309 * @param node [i] The H4 tag node is specified.
3310 * @return The conversion result is returned.
3313 s_chtml40_end_h4_tag(void *pdoc, Node *UNUSED(child))
3315 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3316 Doc *doc = chtml40->doc;
3319 if (IS_CSS_ON(chtml40->entryp)) {
3320 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3323 return chtml40->out;
3328 * It is a handler who processes the H5 tag.
3330 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3331 * destination is specified.
3332 * @param node [i] The H5 tag node is specified.
3333 * @return The conversion result is returned.
3336 s_chtml40_start_h5_tag(void *pdoc, Node *node)
3342 char *attr_style = NULL;
3343 char *attr_align = NULL;
3345 chtml40 = GET_CHTML40(pdoc);
3349 for (attr = qs_get_attr(doc,node);
3351 attr = qs_get_next_attr(doc,attr)) {
3352 char *name = qs_get_attr_name(doc,attr);
3353 char *value = qs_get_attr_value(doc,attr);
3354 if (STRCASEEQ('a','A',"align", name)) {
3355 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3359 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3363 if (IS_CSS_ON(chtml40->entryp)) {
3364 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3366 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3367 css_property_t *cur;
3368 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3369 if (STRCASEEQ('l','L',"left", cur->value)) {
3370 attr_align = apr_pstrdup(doc->pool, "left");
3372 else if (STRCASEEQ('c','C',"center",cur->value)) {
3373 attr_align = apr_pstrdup(doc->pool, "center");
3375 else if (STRCASEEQ('r','R',"right",cur->value)) {
3376 attr_align = apr_pstrdup(doc->pool, "right");
3389 return chtml40->out;
3394 * It is a handler who processes the H5 tag.
3396 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3397 * destination is specified.
3398 * @param node [i] The H5 tag node is specified.
3399 * @return The conversion result is returned.
3402 s_chtml40_end_h5_tag(void *pdoc, Node *UNUSED(child))
3404 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3405 Doc *doc = chtml40->doc;
3408 if (IS_CSS_ON(chtml40->entryp)) {
3409 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3412 return chtml40->out;
3417 * It is a handler who processes the H6 tag.
3419 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3420 * destination is specified.
3421 * @param node [i] The H6 tag node is specified.
3422 * @return The conversion result is returned.
3425 s_chtml40_start_h6_tag(void *pdoc, Node *node)
3431 char *attr_style = NULL;
3432 char *attr_align = NULL;
3434 chtml40 = GET_CHTML40(pdoc);
3438 for (attr = qs_get_attr(doc,node);
3440 attr = qs_get_next_attr(doc,attr)) {
3441 char *name = qs_get_attr_name(doc,attr);
3442 char *value = qs_get_attr_value(doc,attr);
3443 if (STRCASEEQ('a','A',"align", name)) {
3444 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3448 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3452 if (IS_CSS_ON(chtml40->entryp)) {
3453 css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
3455 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3456 css_property_t *cur;
3457 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3458 if (STRCASEEQ('l','L',"left", cur->value)) {
3459 attr_align = apr_pstrdup(doc->pool, "left");
3461 else if (STRCASEEQ('c','C',"center",cur->value)) {
3462 attr_align = apr_pstrdup(doc->pool, "center");
3464 else if (STRCASEEQ('r','R',"right",cur->value)) {
3465 attr_align = apr_pstrdup(doc->pool, "right");
3478 return chtml40->out;
3483 * It is a handler who processes the H6 tag.
3485 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3486 * destination is specified.
3487 * @param node [i] The H6 tag node is specified.
3488 * @return The conversion result is returned.
3491 s_chtml40_end_h6_tag(void *pdoc, Node *UNUSED(child))
3493 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3494 Doc *doc = chtml40->doc;
3497 if (IS_CSS_ON(chtml40->entryp)) {
3498 chxj_css_pop_prop_list(chtml40->css_prop_stack);
3501 return chtml40->out;
3506 * It is a handler who processes the TEXTARE tag.
3508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3509 * destination is specified.
3510 * @param node [i] The TEXTAREA tag node is specified.
3511 * @return The conversion result is returned.
3514 s_chtml40_start_textarea_tag(void *pdoc, Node *node)
3520 char *attr_accesskey = NULL;
3521 char *attr_name = NULL;
3522 char *attr_rows = NULL;
3523 char *attr_cols = NULL;
3524 char *attr_istyle = NULL;
3525 char *attr_style = NULL;
3527 chtml40 = GET_CHTML40(pdoc);
3531 chtml40->textarea_flag++;
3533 for (attr = qs_get_attr(doc,node);
3535 attr = qs_get_next_attr(doc,attr)) {
3536 char *name = qs_get_attr_name(doc,attr);
3537 char *value = qs_get_attr_value(doc,attr);
3538 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3539 attr_accesskey = value;
3541 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3542 attr_istyle = value;
3544 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3547 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3550 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3553 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3557 if (IS_CSS_ON(chtml40->entryp)) {
3558 css_prop_list_t *style = s_chtml40_nopush_and_get_now_style(pdoc, node, attr_style);
3560 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3561 css_property_t *cur;
3562 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3563 if (strcasestr(cur->value, "<ja:n>")) {
3566 else if (strcasestr(cur->value, "<ja:en>")) {
3569 else if (strcasestr(cur->value, "<ja:hk>")) {
3572 else if (strcasestr(cur->value, "<ja:h>")) {
3579 if (attr_accesskey) {
3580 W_L(" accesskey=\"");
3581 W_V(attr_accesskey);
3605 return chtml40->out;
3610 * It is a handler who processes the TEXTAREA tag.
3612 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3613 * destination is specified.
3614 * @param node [i] The TEXTAREA tag node is specified.
3615 * @return The conversion result is returned.
3618 s_chtml40_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3620 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3621 Doc *doc = chtml40->doc;
3624 chtml40->textarea_flag--;
3626 return chtml40->out;
3631 s_chtml40_chxjif_tag(void *pdoc, Node *node)
3638 chtml40 = GET_CHTML40(pdoc);
3642 for (child = qs_get_child_node(doc, node);
3644 child = qs_get_next_node(doc, child)) {
3646 s_chtml40_chxjif_tag(chtml40, child);
3654 s_chtml40_text_tag(void *pdoc, Node *child)
3667 chtml40 = GET_CHTML40(pdoc);
3671 textval = qs_get_node_value(doc,child);
3672 if (strlen(textval) == 0) {
3673 return chtml40->out;
3676 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3677 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3679 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
3680 memset(one_byte, 0, sizeof(one_byte));
3683 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3685 int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out);
3687 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3692 if (is_sjis_kanji(textval[ii])) {
3693 one_byte[0] = textval[ii+0];
3694 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3695 one_byte[0] = textval[ii+1];
3696 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3699 else if (chtml40->pre_flag) {
3700 one_byte[0] = textval[ii+0];
3701 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3703 else if (chtml40->textarea_flag) {
3704 one_byte[0] = textval[ii+0];
3705 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3707 else if (textval[ii] != '\r' && textval[ii] != '\n') {
3708 one_byte[0] = textval[ii+0];
3709 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3713 return chtml40->out;
3718 * It is a handler who processes the BLOCKQUOTE tag.
3720 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3721 * destination is specified.
3722 * @param node [i] The BLOCKQUOTE tag node is specified.
3723 * @return The conversion result is returned.
3726 s_chtml40_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3728 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3729 Doc *doc = chtml40->doc;
3730 W_L("<blockquote>");
3731 return chtml40->out;
3736 * It is a handler who processes the BLOCKQUOTE tag.
3738 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3739 * destination is specified.
3740 * @param node [i] The BLOCKQUOTE tag node is specified.
3741 * @return The conversion result is returned.
3744 s_chtml40_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3746 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3747 Doc *doc = chtml40->doc;
3748 W_L("</blockquote>");
3749 return chtml40->out;
3754 * It is a handler who processes the DIR tag.
3756 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3757 * destination is specified.
3758 * @param node [i] The DIR tag node is specified.
3759 * @return The conversion result is returned.
3762 s_chtml40_start_dir_tag(void *pdoc, Node *node)
3764 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3765 Doc *doc = chtml40->doc;
3768 for (attr = qs_get_attr(doc,node);
3770 attr = qs_get_next_attr(doc,attr)) {
3771 char *name = qs_get_attr_name(doc,attr);
3772 char *value = qs_get_attr_value(doc,attr);
3773 if (STRCASEEQ('t','T',"type",name)) {
3774 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3782 return chtml40->out;
3787 * It is a handler who processes the DIR tag.
3789 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3790 * destination is specified.
3791 * @param node [i] The DIR tag node is specified.
3792 * @return The conversion result is returned.
3795 s_chtml40_end_dir_tag(void *pdoc, Node *UNUSED(child))
3797 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3798 Doc *doc = chtml40->doc;
3800 return chtml40->out;
3805 * It is a handler who processes the DL tag.
3807 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3808 * destination is specified.
3809 * @param node [i] The DL tag node is specified.
3810 * @return The conversion result is returned.
3813 s_chtml40_start_dl_tag(void *pdoc, Node *UNUSED(child))
3815 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3816 Doc *doc = chtml40->doc;
3818 return chtml40->out;
3823 * It is a handler who processes the DL tag.
3825 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3826 * destination is specified.
3827 * @param node [i] The DL tag node is specified.
3828 * @return The conversion result is returned.
3831 s_chtml40_end_dl_tag(void *pdoc, Node *UNUSED(child))
3833 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3834 Doc *doc = chtml40->doc;
3836 return chtml40->out;
3841 * It is a handler who processes the DT tag.
3843 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3844 * destination is specified.
3845 * @param node [i] The DT tag node is specified.
3846 * @return The conversion result is returned.
3849 s_chtml40_start_dt_tag(void *pdoc, Node *UNUSED(child))
3851 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3852 Doc *doc = chtml40->doc;
3854 return chtml40->out;
3859 * It is a handler who processes the DT tag.
3861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3862 * destination is specified.
3863 * @param node [i] The DT tag node is specified.
3864 * @return The conversion result is returned.
3867 s_chtml40_end_dt_tag(void *pdoc, Node *UNUSED(child))
3869 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3871 return chtml40->out;
3876 * It is a handler who processes the DD tag.
3878 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3879 * destination is specified.
3880 * @param node [i] The DD tag node is specified.
3881 * @return The conversion result is returned.
3884 s_chtml40_start_dd_tag(void *pdoc, Node *UNUSED(child))
3886 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3887 Doc *doc = chtml40->doc;
3891 return chtml40->out;
3896 * It is a handler who processes the DD tag.
3898 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3899 * destination is specified.
3900 * @param node [i] The DD tag node is specified.
3901 * @return The conversion result is returned.
3904 s_chtml40_end_dd_tag(void *pdoc, Node *UNUSED(child))
3906 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3908 return chtml40->out;
3913 * It is a handler who processes the MARQUEE tag.
3915 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3916 * destination is specified.
3917 * @param node [i] The MARQUEE tag node is specified.
3918 * @return The conversion result is returned.
3921 s_chtml40_start_marquee_tag(void *pdoc, Node *node)
3923 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3924 Doc *doc = chtml40->doc;
3927 /*--------------------------------------------------------------------------*/
3928 /* Get Attributes */
3929 /*--------------------------------------------------------------------------*/
3930 for (attr = qs_get_attr(doc,node);
3932 attr = qs_get_next_attr(doc,attr)) {
3933 char *name = qs_get_attr_name(doc,attr);
3934 char *value = qs_get_attr_value(doc,attr);
3935 if (STRCASEEQ('d','D',"direction", name)) {
3936 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3937 W_L(" direction=\"");
3942 else if (STRCASEEQ('b','B',"behavior",name)) {
3943 if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
3944 W_L(" behavior=\"");
3949 else if (STRCASEEQ('l','L',"loop",name)) {
3950 if (value && *value) {
3958 return chtml40->out;
3963 * It is a handler who processes the MARQUEE tag.
3965 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3966 * destination is specified.
3967 * @param node [i] The MARQUEE tag node is specified.
3968 * @return The conversion result is returned.
3971 s_chtml40_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3973 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3974 Doc *doc = chtml40->doc;
3976 return chtml40->out;
3981 * It is a handler who processes the BLINK tag.
3983 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3984 * destination is specified.
3985 * @param node [i] The BLINK tag node is specified.
3986 * @return The conversion result is returned.
3989 s_chtml40_start_blink_tag(void *pdoc, Node *UNUSED(child))
3991 chtml40_t *chtml40 = GET_CHTML40(pdoc);
3992 Doc *doc = chtml40->doc;
3994 return chtml40->out;
3999 * It is a handler who processes the BLINK tag.
4001 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4002 * destination is specified.
4003 * @param node [i] The BLINK tag node is specified.
4004 * @return The conversion result is returned.
4007 s_chtml40_end_blink_tag(void *pdoc, Node *UNUSED(child))
4009 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4010 Doc *doc = chtml40->doc;
4012 return chtml40->out;
4017 * It is a handler who processes the MENU tag.
4019 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4020 * destination is specified.
4021 * @param node [i] The MENU tag node is specified.
4022 * @return The conversion result is returned.
4025 s_chtml40_start_menu_tag(void *pdoc, Node *node)
4027 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4028 Doc *doc = chtml40->doc;
4031 /*--------------------------------------------------------------------------*/
4032 /* Get Attributes */
4033 /*--------------------------------------------------------------------------*/
4034 for (attr = qs_get_attr(doc,node);
4036 attr = qs_get_next_attr(doc,attr)) {
4037 char *name = qs_get_attr_name(doc,attr);
4038 char *value = qs_get_attr_value(doc,attr);
4039 if (STRCASEEQ('t','T',"type",name)) {
4040 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4048 return chtml40->out;
4053 * It is a handler who processes the MENU tag.
4055 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4056 * destination is specified.
4057 * @param node [i] The MENU tag node is specified.
4058 * @return The conversion result is returned.
4061 s_chtml40_end_menu_tag(void *pdoc, Node *UNUSED(child))
4063 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4064 Doc *doc = chtml40->doc;
4066 return chtml40->out;
4071 * It is a handler who processes the PLAINTEXT tag.
4073 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4074 * destination is specified.
4075 * @param node [i] The PLAINTEXT tag node is specified.
4076 * @return The conversion result is returned.
4079 s_chtml40_start_plaintext_tag(void *pdoc, Node *node)
4081 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4082 Doc *doc = chtml40->doc;
4084 s_chtml40_start_plaintext_tag_inner(pdoc,node);
4085 return chtml40->out;
4089 s_chtml40_start_plaintext_tag_inner(void *pdoc, Node *node)
4091 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4092 Doc *doc = chtml40->doc;
4094 for (child = qs_get_child_node(doc, node);
4096 child = qs_get_next_node(doc, child)) {
4098 s_chtml40_start_plaintext_tag_inner(pdoc, child);
4100 return chtml40->out;
4105 * It is a handler who processes the PLAINTEXT tag.
4107 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4108 * destination is specified.
4109 * @param node [i] The PLAINTEXT tag node is specified.
4110 * @return The conversion result is returned.
4113 s_chtml40_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4115 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4116 return chtml40->out;
4121 * It is handler who processes the New Line Code.
4124 s_chtml40_newline_mark(void *pdoc, Node *UNUSED(node))
4126 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4127 Doc *doc = chtml40->doc;
4129 return chtml40->out;
4134 * It is a handler who processes the LINK tag.
4136 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4137 * destination is specified.
4138 * @param node [i] The LINK tag node is specified.
4139 * @return The conversion result is returned.
4142 s_chtml40_link_tag(void *pdoc, Node *node)
4151 chtml40 = GET_CHTML40(pdoc);
4154 if (! IS_CSS_ON(chtml40->entryp)) {
4155 return chtml40->out;
4158 for (attr = qs_get_attr(doc,node);
4160 attr = qs_get_next_attr(doc,attr)) {
4161 char *name = qs_get_attr_name(doc,attr);
4162 char *value = qs_get_attr_value(doc,attr);
4163 if (STRCASEEQ('r','R',"rel", name)) {
4164 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
4168 else if (STRCASEEQ('h','H',"href", name)) {
4169 if (value && *value) {
4173 else if (STRCASEEQ('t','T',"type", name)) {
4174 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
4180 if (rel && href && type) {
4181 DBG(doc->r, "start load CSS. url:[%s]", href);
4182 chtml40->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml40->style, href);
4183 DBG(doc->r, "end load CSS. url:[%s]", href);
4186 return chtml40->out;
4189 static css_prop_list_t *
4190 s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4192 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4193 Doc *doc = chtml40->doc;
4194 css_prop_list_t *last_css = NULL;
4195 if (IS_CSS_ON(chtml40->entryp)) {
4196 css_prop_list_t *dup_css;
4197 css_selector_t *selector;
4199 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4200 dup_css = chxj_dup_css_prop_list(doc, last_css);
4201 selector = chxj_css_find_selector(doc, chtml40->style, node);
4203 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4205 chxj_css_push_prop_list(chtml40->css_prop_stack, dup_css);
4206 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4208 if (style_attr_value) {
4209 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));
4211 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
4219 static css_prop_list_t *
4220 s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
4222 chtml40_t *chtml40 = GET_CHTML40(pdoc);
4223 Doc *doc = chtml40->doc;
4224 css_prop_list_t *last_css = NULL;
4225 if (IS_CSS_ON(chtml40->entryp)) {
4226 css_prop_list_t *dup_css;
4227 css_selector_t *selector;
4229 last_css = chxj_css_get_last_prop_list(chtml40->css_prop_stack);
4230 dup_css = chxj_dup_css_prop_list(doc, last_css);
4231 selector = chxj_css_find_selector(doc, chtml40->style, node);
4233 chxj_css_prop_list_merge_property(doc, dup_css, selector);
4237 if (style_attr_value) {
4238 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));
4240 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);