2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_jhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
29 #define GET_JHTML(X) ((jhtml_t *)(X))
32 #define W_L(X) do { jhtml->out = BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { jhtml->out = (X) ? BUFFERED_WRITE_VALUE(jhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jhtml->conf); W_V(nlcode); } while (0)
38 static char *s_jhtml_start_html_tag (void *pdoc, Node *node);
39 static char *s_jhtml_end_html_tag (void *pdoc, Node *node);
40 static char *s_jhtml_start_meta_tag (void *pdoc, Node *node);
41 static char *s_jhtml_end_meta_tag (void *pdoc, Node *node);
42 static char *s_jhtml_start_head_tag (void *pdoc, Node *node);
43 static char *s_jhtml_end_head_tag (void *pdoc, Node *node);
44 static char *s_jhtml_start_title_tag (void *pdoc, Node *node);
45 static char *s_jhtml_end_title_tag (void *pdoc, Node *node);
46 static char *s_jhtml_start_base_tag (void *pdoc, Node *node);
47 static char *s_jhtml_end_base_tag (void *pdoc, Node *node);
48 static char *s_jhtml_start_body_tag (void *pdoc, Node *node);
49 static char *s_jhtml_end_body_tag (void *pdoc, Node *node);
50 static char *s_jhtml_start_a_tag (void *pdoc, Node *node);
51 static char *s_jhtml_end_a_tag (void *pdoc, Node *node);
52 static char *s_jhtml_start_pre_tag (void *pdoc, Node *node);
53 static char *s_jhtml_end_pre_tag (void *pdoc, Node *node);
54 static char *s_jhtml_start_p_tag (void *pdoc, Node *node);
55 static char *s_jhtml_end_p_tag (void *pdoc, Node *node);
56 static char *s_jhtml_start_ul_tag (void *pdoc, Node *node);
57 static char *s_jhtml_end_ul_tag (void *pdoc, Node *node);
58 static char *s_jhtml_start_ol_tag (void *pdoc, Node *node);
59 static char *s_jhtml_end_ol_tag (void *pdoc, Node *node);
60 static char *s_jhtml_start_li_tag (void *pdoc, Node *node);
61 static char *s_jhtml_end_li_tag (void *pdoc, Node *node);
62 static char *s_jhtml_start_br_tag (void *pdoc, Node *node);
63 static char *s_jhtml_end_br_tag (void *pdoc, Node *node);
64 static char *s_jhtml_start_tr_tag (void *pdoc, Node *node);
65 static char *s_jhtml_end_tr_tag (void *pdoc, Node *node);
66 static char *s_jhtml_start_font_tag (void *pdoc, Node *node);
67 static char *s_jhtml_end_font_tag (void *pdoc, Node *node);
68 static char *s_jhtml_start_form_tag (void *pdoc, Node *node);
69 static char *s_jhtml_end_form_tag (void *pdoc, Node *node);
70 static char *s_jhtml_start_input_tag (void *pdoc, Node *node);
71 static char *s_jhtml_end_input_tag (void *pdoc, Node *node);
72 static char *s_jhtml_start_center_tag (void *pdoc, Node *node);
73 static char *s_jhtml_end_center_tag (void *pdoc, Node *node);
74 static char *s_jhtml_start_hr_tag (void *pdoc, Node *node);
75 static char *s_jhtml_end_hr_tag (void *pdoc, Node *node);
76 static char *s_jhtml_start_img_tag (void *pdoc, Node *node);
77 static char *s_jhtml_end_img_tag (void *pdoc, Node *node);
78 static char *s_jhtml_start_select_tag (void *pdoc, Node *node);
79 static char *s_jhtml_end_select_tag (void *pdoc, Node *node);
80 static char *s_jhtml_start_option_tag (void *pdoc, Node *node);
81 static char *s_jhtml_end_option_tag (void *pdoc, Node *node);
82 static char *s_jhtml_start_div_tag (void *pdoc, Node *node);
83 static char *s_jhtml_end_div_tag (void *pdoc, Node *node);
84 static char *s_jhtml_start_textarea_tag (void *pdoc, Node *node);
85 static char *s_jhtml_end_textarea_tag (void *pdoc, Node *node);
86 static char *s_jhtml_start_b_tag (void *pdoc, Node *node);
87 static char *s_jhtml_end_b_tag (void *pdoc, Node *node);
88 static char *s_jhtml_chxjif_tag (void *pdoc, Node *node);
89 static char *s_jhtml_text_tag (void *pdoc, Node *node);
90 static char *s_jhtml_start_blockquote_tag (void *pdoc, Node *node);
91 static char *s_jhtml_end_blockquote_tag (void *pdoc, Node *node);
92 static char *s_jhtml_start_dir_tag (void *pdoc, Node *node);
93 static char *s_jhtml_end_dir_tag (void *pdoc, Node *node);
94 static char *s_jhtml_start_dl_tag (void *pdoc, Node *node);
95 static char *s_jhtml_end_dl_tag (void *pdoc, Node *node);
96 static char *s_jhtml_start_dt_tag (void *pdoc, Node *node);
97 static char *s_jhtml_end_dt_tag (void *pdoc, Node *node);
98 static char *s_jhtml_start_dd_tag (void *pdoc, Node *node);
99 static char *s_jhtml_end_dd_tag (void *pdoc, Node *node);
100 static char *s_jhtml_start_h1_tag (void *pdoc, Node *node);
101 static char *s_jhtml_end_h1_tag (void *pdoc, Node *node);
102 static char *s_jhtml_start_h2_tag (void *pdoc, Node *node);
103 static char *s_jhtml_end_h2_tag (void *pdoc, Node *node);
104 static char *s_jhtml_start_h3_tag (void *pdoc, Node *node);
105 static char *s_jhtml_end_h3_tag (void *pdoc, Node *node);
106 static char *s_jhtml_start_h4_tag (void *pdoc, Node *node);
107 static char *s_jhtml_end_h4_tag (void *pdoc, Node *node);
108 static char *s_jhtml_start_h5_tag (void *pdoc, Node *node);
109 static char *s_jhtml_end_h5_tag (void *pdoc, Node *node);
110 static char *s_jhtml_start_h6_tag (void *pdoc, Node *node);
111 static char *s_jhtml_end_h6_tag (void *pdoc, Node *node);
112 static char *s_jhtml_start_menu_tag (void *pdoc, Node *node);
113 static char *s_jhtml_end_menu_tag (void *pdoc, Node *node);
114 static char *s_jhtml_start_plaintext_tag (void *pdoc, Node *node);
115 static char *s_jhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
116 static char *s_jhtml_end_plaintext_tag (void *pdoc, Node *node);
117 static char *s_jhtml_start_blink_tag (void *pdoc, Node *node);
118 static char *s_jhtml_end_blink_tag (void *pdoc, Node *node);
119 static char *s_jhtml_start_marquee_tag (void *pdoc, Node *node);
120 static char *s_jhtml_end_marquee_tag (void *pdoc, Node *node);
121 static char *s_jhtml_newline_mark (void *pdoc, Node *node);
122 static char *s_jhtml_link_tag (void *pdoc, Node *node);
123 static char *s_jhtml_start_span_tag (void *pdoc, Node *node);
124 static char *s_jhtml_end_span_tag (void *pdoc, Node *node);
125 static char *s_jhtml_style_tag (void *pdoc, Node *node);
127 static void s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec);
129 static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
131 static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
132 static css_prop_list_t *s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
133 static css_prop_list_t *s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
137 tag_handler jhtml_handler[] = {
140 s_jhtml_start_html_tag,
141 s_jhtml_end_html_tag,
145 s_jhtml_start_meta_tag,
146 s_jhtml_end_meta_tag,
150 s_jhtml_start_textarea_tag,
151 s_jhtml_end_textarea_tag,
160 s_jhtml_start_pre_tag,
165 s_jhtml_start_ul_tag,
170 s_jhtml_start_li_tag,
175 s_jhtml_start_ol_tag,
180 s_jhtml_start_h1_tag,
185 s_jhtml_start_h2_tag,
190 s_jhtml_start_h3_tag,
195 s_jhtml_start_h4_tag,
200 s_jhtml_start_h5_tag,
205 s_jhtml_start_h6_tag,
210 s_jhtml_start_head_tag,
211 s_jhtml_end_head_tag,
215 s_jhtml_start_title_tag,
216 s_jhtml_end_title_tag,
220 s_jhtml_start_base_tag,
221 s_jhtml_end_base_tag,
225 s_jhtml_start_body_tag,
226 s_jhtml_end_body_tag,
235 s_jhtml_start_br_tag,
245 s_jhtml_start_tr_tag,
260 s_jhtml_start_font_tag,
261 s_jhtml_end_font_tag,
265 s_jhtml_start_form_tag,
266 s_jhtml_end_form_tag,
270 s_jhtml_start_input_tag,
271 s_jhtml_end_input_tag,
275 s_jhtml_start_center_tag,
276 s_jhtml_end_center_tag,
280 s_jhtml_start_hr_tag,
285 s_jhtml_start_img_tag,
290 s_jhtml_start_select_tag,
291 s_jhtml_end_select_tag,
295 s_jhtml_start_option_tag,
296 s_jhtml_end_option_tag,
300 s_jhtml_start_div_tag,
325 s_jhtml_start_span_tag,
326 s_jhtml_end_span_tag,
350 s_jhtml_start_dt_tag,
365 s_jhtml_start_blockquote_tag,
366 s_jhtml_end_blockquote_tag,
370 s_jhtml_start_dir_tag,
375 s_jhtml_start_dl_tag,
380 s_jhtml_start_dd_tag,
385 s_jhtml_start_menu_tag,
386 s_jhtml_end_menu_tag,
390 s_jhtml_start_plaintext_tag,
391 s_jhtml_end_plaintext_tag,
395 s_jhtml_start_blink_tag,
396 s_jhtml_end_blink_tag,
400 s_jhtml_start_marquee_tag,
401 s_jhtml_end_marquee_tag,
410 s_jhtml_newline_mark,
417 * converts from CHTML5.0 to JHTML.
419 * @param r [i] Requet_rec is appointed.
420 * @param spec [i] The result of the device specification processing which
421 * was done in advance is appointed.
422 * @param src [i] The character string before the converting is appointed.
423 * @return The character string after the converting is returned.
432 chxjconvrule_entry *entryp,
444 /*--------------------------------------------------------------------------*/
446 /*--------------------------------------------------------------------------*/
448 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
450 DBG(r,"I found qrcode xml");
453 DBG(r,"not found qrcode xml");
455 /*--------------------------------------------------------------------------*/
456 /* The CHTML structure is initialized. */
457 /*--------------------------------------------------------------------------*/
458 s_init_jhtml(&jhtml, &doc, r, spec);
460 jhtml.entryp = entryp;
461 jhtml.cookie = cookie;
463 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
465 /*--------------------------------------------------------------------------*/
466 /* The character string of the input is analyzed. */
467 /*--------------------------------------------------------------------------*/
468 qs_init_malloc(&doc);
469 qs_init_root_node(&doc);
471 apr_pool_create(&pool, r->pool);
472 ss = apr_pcalloc(pool, srclen + 1);
474 memset(ss, 0, srclen + 1);
475 memcpy(ss, src, srclen);
478 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
480 if (IS_CSS_ON(jhtml.entryp)) {
481 /* current property list */
482 jhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
485 qs_parse_string(&doc,ss,strlen(ss));
487 chxj_buffered_write_init(r->pool, &doc.buf);
488 /*--------------------------------------------------------------------------*/
489 /* It converts it from CHTML to JHTML. */
490 /*--------------------------------------------------------------------------*/
491 chxj_node_convert(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
492 jhtml.out = chxj_buffered_write_flush(jhtml.out, &doc.buf);
493 dst = apr_pstrdup(pool, jhtml.out);
494 chxj_buffered_write_terminate(&doc.buf);
497 qs_all_free(&doc,QX_LOGMARK);
500 return apr_pstrdup(pool,ss);
503 dst = apr_psprintf(pool, "\n");
505 *dstlen = strlen(dst);
508 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
516 * The CHTML structure is initialized.
518 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
519 * initialized is specified.
520 * @param doc [i] The Doc structure that should be set to the initialized
521 * JHTML structure is specified.
522 * @param r [i] To use POOL, the pointer to request_rec is specified.
523 * @param spec [i] The pointer to the device_table
526 s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec)
528 memset(doc, 0, sizeof(Doc));
529 memset(jhtml, 0, sizeof(jhtml_t));
534 jhtml->out = qs_alloc_zero_byte_string(r->pool);
535 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
536 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
541 * Corresponding EMOJI to a current character-code is retrieved.
542 * The substitution character string is stored in the rslt pointer if agreeing.
544 * @param jhtml [i] The pointer to the CHTML structure is specified.
545 * @param txt [i] The character string to want to examine whether it is
546 * EMOJI is specified.
547 * @param rslt [o] The pointer to the pointer that stores the result is
549 * @return When corresponding EMOJI exists, it returns it excluding 0.
552 s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt)
564 if (! spec) DBG(r,"spec is NULL");
566 for (ee = jhtml->conf->emoji;
570 unsigned char hex1byte;
571 unsigned char hex2byte;
574 DBG(r,"emoji->imode is NULL");
578 hex1byte = ee->imode->hex1byte & 0xff;
579 hex2byte = ee->imode->hex2byte & 0xff;
581 if (ee->imode->string
582 && strlen(ee->imode->string) > 0
583 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
584 if (spec == NULL || spec->emoji_type == NULL) {
585 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
586 return strlen(ee->imode->string);
593 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
594 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
595 if (spec == NULL || spec->emoji_type == NULL) {
596 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
609 chxj_jhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
623 DBG(r, "REQ[%X] start chxj_jhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
624 memset(doc, 0, sizeof(Doc));
625 memset(jhtml, 0, sizeof(jhtml_t));
630 jhtml->out = qs_alloc_zero_byte_string(r->pool);
631 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
632 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
634 apr_pool_create(&pool, r->pool);
636 chxj_buffered_write_init(pool, &doc->buf);
638 for (ii=0; ii<len; ii++) {
642 rtn = s_jhtml_search_emoji(jhtml, (char *)&src[ii], &out);
649 if (is_sjis_kanji(src[ii])) {
650 two_byte[0] = src[ii+0];
651 two_byte[1] = src[ii+1];
657 one_byte[0] = src[ii+0];
662 jhtml->out = chxj_buffered_write_flush(jhtml->out, &doc->buf);
664 DBG(r, "REQ[%X] end chxj_jhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
670 * It is a handler who processes the HTML tag.
672 * @param pdoc [i/o] The pointer to the CHTML structure at the output
673 * destination is specified.
674 * @param node [i] The HTML tag node is specified.
675 * @return The conversion result is returned.
678 s_jhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
685 jhtml = GET_JHTML(pdoc);
688 DBG(r, "start s_jhtml_start_html_tag()");
690 /*--------------------------------------------------------------------------*/
692 /*--------------------------------------------------------------------------*/
695 DBG(r, "end s_jhtml_start_html_tag()");
702 * It is a handler who processes the HTML tag.
704 * @param pdoc [i/o] The pointer to the CHTML structure at the output
705 * destination is specified.
706 * @param node [i] The HTML tag node is specified.
707 * @return The conversion result is returned.
710 s_jhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
712 jhtml_t *jhtml = GET_JHTML(pdoc);
713 Doc *doc = jhtml->doc;
722 * It is a handler who processes the META tag.
724 * @param pdoc [i/o] The pointer to the CHTML structure at the output
725 * destination is specified.
726 * @param node [i] The META tag node is specified.
727 * @return The conversion result is returned.
730 s_jhtml_start_meta_tag(void *pdoc, Node *node)
736 int content_type_flag;
739 jhtml = GET_JHTML(pdoc);
743 content_type_flag = 0;
746 /*--------------------------------------------------------------------------*/
748 /*--------------------------------------------------------------------------*/
749 for (attr = qs_get_attr(doc,node);
751 attr = qs_get_next_attr(doc,attr)) {
752 char *name = qs_get_attr_name(doc,attr);
753 char *value = qs_get_attr_value(doc,attr);
757 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
758 /*----------------------------------------------------------------------*/
760 /*----------------------------------------------------------------------*/
761 W_L(" http-equiv=\"");
764 if (STRCASEEQ('c','C',"content-type",value)) {
765 content_type_flag = 1;
767 if (STRCASEEQ('r','R',"refresh",value)) {
775 if (strcasecmp(name, "content") == 0 && value && *value) {
776 /*----------------------------------------------------------------------*/
778 /*----------------------------------------------------------------------*/
779 if (content_type_flag) {
783 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
792 buf = apr_pstrdup(r->pool, value);
794 url = strchr(buf, ';');
796 sec = apr_pstrdup(r->pool, buf);
799 url = chxj_encoding_parameter(r, url, 0);
800 url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
830 * It is a handler who processes the META tag.
832 * @param pdoc [i/o] The pointer to the CHTML structure at the output
833 * destination is specified.
834 * @param node [i] The META tag node is specified.
835 * @return The conversion result is returned.
838 s_jhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
840 jhtml_t *jhtml = GET_JHTML(pdoc);
847 * It is a handler who processes the HEAD tag.
849 * @param pdoc [i/o] The pointer to the CHTML structure at the output
850 * destination is specified.
851 * @param node [i] The HEAD tag node is specified.
852 * @return The conversion result is returned.
855 s_jhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
861 jhtml = GET_JHTML(pdoc);
871 * It is a handler who processes the HEAD tag.
873 * @param pdoc [i/o] The pointer to the CHTML structure at the output
874 * destination is specified.
875 * @param node [i] The HEAD tag node is specified.
876 * @return The conversion result is returned.
879 s_jhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
885 jhtml = GET_JHTML(pdoc);
895 * It is a handler who processes the TITLE tag.
897 * @param pdoc [i/o] The pointer to the CHTML structure at the output
898 * destination is specified.
899 * @param node [i] The TITLE tag node is specified.
900 * @return The conversion result is returned.
903 s_jhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
909 jhtml = GET_JHTML(pdoc);
919 * It is a handler who processes the TITLE tag.
921 * @param pdoc [i/o] The pointer to the CHTML structure at the output
922 * destination is specified.
923 * @param node [i] The TITLE tag node is specified.
924 * @return The conversion result is returned.
927 s_jhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
933 jhtml = GET_JHTML(pdoc);
943 * It is a handler who processes the BASE tag.
945 * @param pdoc [i/o] The pointer to the CHTML structure at the output
946 * destination is specified.
947 * @param node [i] The BASE tag node is specified.
948 * @return The conversion result is returned.
951 s_jhtml_start_base_tag(void *pdoc, Node *node)
958 jhtml = GET_JHTML(pdoc);
963 /*--------------------------------------------------------------------------*/
965 /*--------------------------------------------------------------------------*/
966 for (attr = qs_get_attr(doc,node);
968 attr = qs_get_next_attr(doc,attr)) {
969 char *name = qs_get_attr_name(doc,attr);
970 char *value = qs_get_attr_value(doc,attr);
971 if (STRCASEEQ('h','H',"href",name)) {
983 * It is a handler who processes the BASE tag.
985 * @param pdoc [i/o] The pointer to the CHTML structure at the output
986 * destination is specified.
987 * @param node [i] The BASE tag node is specified.
988 * @return The conversion result is returned.
991 s_jhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
993 jhtml_t *jhtml = GET_JHTML(pdoc);
999 * It is a handler who processes the BODY tag.
1001 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1002 * destination is specified.
1003 * @param node [i] The BODY tag node is specified.
1004 * @return The conversion result is returned.
1007 s_jhtml_start_body_tag(void *pdoc, Node *node)
1013 char *attr_bgcolor = NULL;
1014 char *attr_text = NULL;
1015 char *attr_link = NULL;
1016 char *attr_style = NULL;
1017 char *attr_vlink = NULL;
1019 jhtml = GET_JHTML(pdoc);
1023 /*--------------------------------------------------------------------------*/
1024 /* Get Attributes */
1025 /*--------------------------------------------------------------------------*/
1026 for (attr = qs_get_attr(doc,node);
1028 attr = qs_get_next_attr(doc,attr)) {
1029 char *name = qs_get_attr_name(doc,attr);
1030 char *value = qs_get_attr_value(doc,attr);
1031 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1032 /*----------------------------------------------------------------------*/
1034 /*----------------------------------------------------------------------*/
1035 attr_bgcolor = value;
1037 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1038 /*----------------------------------------------------------------------*/
1040 /*----------------------------------------------------------------------*/
1043 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1044 /*----------------------------------------------------------------------*/
1046 /*----------------------------------------------------------------------*/
1049 else if (STRCASEEQ('a','A',"alink",name)) {
1050 /*----------------------------------------------------------------------*/
1052 /*----------------------------------------------------------------------*/
1055 else if (STRCASEEQ('v','V',"vlink",name) && value && *value) {
1056 /*----------------------------------------------------------------------*/
1058 /*----------------------------------------------------------------------*/
1061 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1062 /*----------------------------------------------------------------------*/
1064 /*----------------------------------------------------------------------*/
1069 if (IS_CSS_ON(jhtml->entryp)) {
1070 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1072 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1073 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1074 css_property_t *cur;
1075 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1076 if (cur->value && *cur->value) {
1077 attr_text = apr_pstrdup(doc->pool, cur->value);
1080 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1081 if (cur->value && *cur->value) {
1082 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1087 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jhtml->style);
1088 css_selector_t *cur_sel;
1089 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1090 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1091 css_property_t *cur;
1092 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1093 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1094 attr_link = apr_pstrdup(doc->pool, cur->value);
1098 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1099 css_property_t *cur;
1100 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1101 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1102 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1112 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1118 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1124 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1130 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1142 * It is a handler who processes the BODY tag.
1144 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1145 * destination is specified.
1146 * @param node [i] The BODY tag node is specified.
1147 * @return The conversion result is returned.
1150 s_jhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1156 jhtml = GET_JHTML(pdoc);
1161 if (IS_CSS_ON(jhtml->entryp)) {
1162 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1170 * It is a handler who processes the A tag.
1172 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1173 * destination is specified.
1174 * @param node [i] The A tag node is specified.
1175 * @return The conversion result is returned.
1178 s_jhtml_start_a_tag(void *pdoc, Node *node)
1184 char *attr_style = NULL;
1186 jhtml = GET_JHTML(pdoc);
1191 /*--------------------------------------------------------------------------*/
1192 /* Get Attributes */
1193 /*--------------------------------------------------------------------------*/
1194 for (attr = qs_get_attr(doc,node);
1196 attr = qs_get_next_attr(doc,attr)) {
1197 char *name = qs_get_attr_name(doc,attr);
1198 char *value = qs_get_attr_value(doc,attr);
1199 if (STRCASEEQ('n','N',"name",name)) {
1200 /*----------------------------------------------------------------------*/
1202 /*----------------------------------------------------------------------*/
1207 else if (STRCASEEQ('h','H',"href",name)) {
1208 /*----------------------------------------------------------------------*/
1210 /*----------------------------------------------------------------------*/
1211 value = chxj_encoding_parameter(r, value, 0);
1212 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1213 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1214 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
1220 else if (STRCASEEQ('a','A',"accesskey",name)) {
1221 /*----------------------------------------------------------------------*/
1223 /*----------------------------------------------------------------------*/
1224 W_L(" accesskey=\"");
1228 else if (STRCASEEQ('c','C',"cti",name)) {
1229 /*----------------------------------------------------------------------*/
1231 /*----------------------------------------------------------------------*/
1236 else if (STRCASEEQ('i','I',"ijam",name)) {
1237 /*----------------------------------------------------------------------*/
1239 /*----------------------------------------------------------------------*/
1242 else if (STRCASEEQ('u','U',"utn",name)) {
1243 /*----------------------------------------------------------------------*/
1245 /* It is special only for CHTML. */
1246 /*----------------------------------------------------------------------*/
1248 else if (STRCASEEQ('t','T',"telbook",name)) {
1249 /*----------------------------------------------------------------------*/
1251 /*----------------------------------------------------------------------*/
1254 else if (STRCASEEQ('k','K',"kana",name)) {
1255 /*----------------------------------------------------------------------*/
1257 /*----------------------------------------------------------------------*/
1260 else if (STRCASEEQ('e','E',"email",name)) {
1261 /*----------------------------------------------------------------------*/
1263 /*----------------------------------------------------------------------*/
1266 else if (STRCASEEQ('i','I',"ista",name)) {
1267 /*----------------------------------------------------------------------*/
1269 /*----------------------------------------------------------------------*/
1272 else if (STRCASEEQ('i','I',"ilet",name)) {
1273 /*----------------------------------------------------------------------*/
1275 /*----------------------------------------------------------------------*/
1278 else if (STRCASEEQ('i','I',"iswf",name)) {
1279 /*----------------------------------------------------------------------*/
1281 /*----------------------------------------------------------------------*/
1284 else if (STRCASEEQ('i','I',"irst",name)) {
1285 /*----------------------------------------------------------------------*/
1287 /*----------------------------------------------------------------------*/
1290 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1296 if (IS_CSS_ON(jhtml->entryp)) {
1297 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1305 * It is a handler who processes the A tag.
1307 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1308 * destination is specified.
1309 * @param node [i] The A tag node is specified.
1310 * @return The conversion result is returned.
1313 s_jhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1319 jhtml = GET_JHTML(pdoc);
1325 if (IS_CSS_ON(jhtml->entryp)) {
1326 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1334 * It is a handler who processes the BR tag.
1336 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1337 * destination is specified.
1338 * @param node [i] The BR tag node is specified.
1339 * @return The conversion result is returned.
1342 s_jhtml_start_br_tag(void *pdoc, Node *node)
1349 jhtml = GET_JHTML(pdoc);
1354 /*--------------------------------------------------------------------------*/
1355 /* Get Attributes */
1356 /*--------------------------------------------------------------------------*/
1357 for (attr = qs_get_attr(doc,node);
1359 attr = qs_get_next_attr(doc,attr)) {
1360 char *name = qs_get_attr_name(doc,attr);
1361 char *value = qs_get_attr_value(doc,attr);
1362 if (STRCASEEQ('c','C',"clear",name)) {
1363 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1376 * It is a handler who processes the BR tag.
1378 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1379 * destination is specified.
1380 * @param node [i] The BR tag node is specified.
1381 * @return The conversion result is returned.
1384 s_jhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1386 jhtml_t *jhtml = GET_JHTML(pdoc);
1392 * It is a handler who processes the TR tag.
1394 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1395 * destination is specified.
1396 * @param node [i] The TR tag node is specified.
1397 * @return The conversion result is returned.
1400 s_jhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1406 jhtml = GET_JHTML(pdoc);
1416 * It is a handler who processes the TR tag.
1418 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1419 * destination is specified.
1420 * @param node [i] The TR tag node is specified.
1421 * @return The conversion result is returned.
1424 s_jhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1426 jhtml_t *jhtml = GET_JHTML(pdoc);
1432 * It is a handler who processes the FONT tag.
1434 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1435 * destination is specified.
1436 * @param node [i] The FONT tag node is specified.
1437 * @return The conversion result is returned.
1440 s_jhtml_start_font_tag(void *pdoc, Node *node)
1446 char *attr_color = NULL;
1447 char *attr_style = NULL;
1449 jhtml = GET_JHTML(pdoc);
1453 /*--------------------------------------------------------------------------*/
1454 /* Get Attributes */
1455 /*--------------------------------------------------------------------------*/
1456 for (attr = qs_get_attr(doc,node);
1458 attr = qs_get_next_attr(doc,attr)) {
1459 char *name = qs_get_attr_name(doc,attr);
1460 char *value = qs_get_attr_value(doc,attr);
1461 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1462 attr_color = apr_pstrdup(doc->buf.pool, value);
1465 else if (STRCASEEQ('s','S',"size",name)) {
1466 /*----------------------------------------------------------------------*/
1468 /*----------------------------------------------------------------------*/
1471 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1472 attr_style = apr_pstrdup(doc->buf.pool, value);
1475 if (IS_CSS_ON(jhtml->entryp)) {
1476 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1478 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1479 css_property_t *cur;
1480 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1481 if (cur->value && *cur->value) {
1482 attr_color = apr_pstrdup(doc->pool, cur->value);
1488 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1489 W_L("<font color=\"");
1493 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1494 flg->with_font_flag = 1;
1495 node->userData = flg;
1498 node->userData = NULL;
1506 * It is a handler who processes the FONT tag.
1508 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1509 * destination is specified.
1510 * @param node [i] The FONT tag node is specified.
1511 * @return The conversion result is returned.
1514 s_jhtml_end_font_tag(void *pdoc, Node *node)
1520 jhtml = GET_JHTML(pdoc);
1524 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1525 if (flg && flg->with_font_flag) {
1528 if (IS_CSS_ON(jhtml->entryp)) {
1529 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1537 * It is a handler who processes the FORM tag.
1539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1540 * destination is specified.
1541 * @param node [i] The FORM tag node is specified.
1542 * @return The conversion result is returned.
1545 s_jhtml_start_form_tag(void *pdoc, Node *node)
1551 char *attr_action = NULL;
1552 char *attr_method = NULL;
1553 char *attr_style = NULL;
1554 char *attr_color = NULL;
1555 char *attr_align = NULL;
1556 char *new_hidden_tag = NULL;
1558 jhtml = GET_JHTML(pdoc);
1562 /*--------------------------------------------------------------------------*/
1563 /* Get Attributes */
1564 /*--------------------------------------------------------------------------*/
1565 for (attr = qs_get_attr(doc,node);
1567 attr = qs_get_next_attr(doc,attr)) {
1568 char *name = qs_get_attr_name(doc,attr);
1569 char *value = qs_get_attr_value(doc,attr);
1573 if (strcasecmp(name, "action") == 0) {
1574 /*--------------------------------------------------------------------*/
1576 /*--------------------------------------------------------------------*/
1577 attr_action = value;
1583 if (strcasecmp(name, "method") == 0) {
1584 /*--------------------------------------------------------------------*/
1586 /*--------------------------------------------------------------------*/
1587 attr_method = value;
1593 if (strcasecmp(name, "style") == 0) {
1602 if (IS_CSS_ON(jhtml->entryp)) {
1603 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1605 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1606 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1607 css_property_t *cur;
1608 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1609 if (STRCASEEQ('l','L',"left", cur->value)) {
1610 attr_align = apr_pstrdup(doc->pool, "left");
1612 else if (STRCASEEQ('c','C',"center",cur->value)) {
1613 attr_align = apr_pstrdup(doc->pool, "center");
1615 else if (STRCASEEQ('r','R',"right",cur->value)) {
1616 attr_align = apr_pstrdup(doc->pool, "right");
1619 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1620 attr_color = apr_pstrdup(doc->pool, cur->value);
1625 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1629 attr_action = chxj_encoding_parameter(r, attr_action, 0);
1630 attr_action = chxj_add_cookie_parameter(r, attr_action, jhtml->cookie);
1632 char *old_qs = NULL;
1633 q = strchr(attr_action, '?');
1635 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, jhtml->entryp);
1636 if (new_hidden_tag || old_qs) {
1655 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
1656 memset(flg, 0, sizeof(*flg));
1658 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1659 W_L("<font color=\"");
1662 flg->with_font_flag = 1;
1665 W_L("<div align=\"");
1668 flg->with_div_flag = 1;
1670 node->userData = flg;
1671 /*-------------------------------------------------------------------------*/
1672 /* Add cookie parameter */
1673 /*-------------------------------------------------------------------------*/
1674 if (new_hidden_tag) {
1675 W_V(new_hidden_tag);
1682 * It is a handler who processes the FORM tag.
1684 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1685 * destination is specified.
1686 * @param node [i] The FORM tag node is specified.
1687 * @return The conversion result is returned.
1690 s_jhtml_end_form_tag(void *pdoc, Node *node)
1692 jhtml_t *jhtml = GET_JHTML(pdoc);
1693 Doc *doc = jhtml->doc;
1695 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1696 if (flg && flg->with_div_flag) {
1699 if (flg && flg->with_font_flag) {
1703 if (IS_CSS_ON(jhtml->entryp)) {
1704 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1712 * It is a handler who processes the INPUT tag.
1714 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1715 * destination is specified.
1716 * @param node [i] The INPUT tag node is specified.
1717 * @return The conversion result is returned.
1720 s_jhtml_start_input_tag(void *pdoc, Node *node)
1726 char *attr_accesskey = NULL;
1727 char *attr_max_length = NULL;
1728 char *attr_type = NULL;
1729 char *attr_name = NULL;
1730 char *attr_value = NULL;
1731 char *attr_istyle = NULL;
1732 char *attr_size = NULL;
1733 char *attr_checked = NULL;
1734 char *attr_style = NULL;
1736 jhtml = GET_JHTML(pdoc);
1740 /*--------------------------------------------------------------------------*/
1741 /* Get Attributes */
1742 /*--------------------------------------------------------------------------*/
1743 for (attr = qs_get_attr(doc,node);
1745 attr = qs_get_next_attr(doc,attr)) {
1746 char *name = qs_get_attr_name(doc,attr);
1747 char *value = qs_get_attr_value(doc,attr);
1748 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1749 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1750 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1751 STRCASEEQ('p','P',"password",tmp_type) ||
1752 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1753 STRCASEEQ('r','R',"radio", tmp_type) ||
1754 STRCASEEQ('h','H',"hidden", tmp_type) ||
1755 STRCASEEQ('s','S',"submit", tmp_type) ||
1756 STRCASEEQ('r','R',"reset", tmp_type))) {
1757 attr_type = tmp_type;
1760 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1763 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1766 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1767 attr_istyle = value;
1769 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1770 attr_max_length = value;
1772 else if (STRCASEEQ('c','C',"checked", name)) {
1773 attr_checked = value;
1775 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1776 attr_accesskey = value;
1778 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1781 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1786 if (IS_CSS_ON(jhtml->entryp)) {
1787 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
1789 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1790 css_property_t *cur;
1791 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1792 if (strcasestr(cur->value, "<ja:n>")) {
1795 else if (strcasestr(cur->value, "<ja:en>")) {
1798 else if (strcasestr(cur->value, "<ja:hk>")) {
1801 else if (strcasestr(cur->value, "<ja:h>")) {
1821 W_V(chxj_jreserved_to_safe_tag(r, attr_name, jhtml->entryp));
1826 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1829 if (attr_accesskey) {
1830 W_L(" accesskey=\"");
1831 W_V(attr_accesskey);
1834 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1835 /*------------------------------------------------------------------------*/
1837 /*------------------------------------------------------------------------*/
1838 if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jhtml->entryp->pc_flag ) {
1844 char *vv = chxj_istyle_to_mode(doc->buf.pool,attr_istyle);
1850 else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
1855 /*--------------------------------------------------------------------------*/
1856 /* The figure is default for the password. */
1857 /*--------------------------------------------------------------------------*/
1858 if (attr_max_length && *attr_max_length) {
1859 if (chxj_chk_numeric(attr_max_length) == 0) {
1860 W_L(" maxlength=\"");
1861 W_V(attr_max_length);
1875 * It is a handler who processes the INPUT tag.
1877 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1878 * destination is specified.
1879 * @param node [i] The INPUT tag node is specified.
1880 * @return The conversion result is returned.
1883 s_jhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
1885 jhtml_t *jhtml = GET_JHTML(pdoc);
1891 * It is a handler who processes the CENTER tag.
1893 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1894 * destination is specified.
1895 * @param node [i] The CENTER tag node is specified.
1896 * @return The conversion result is returned.
1899 s_jhtml_start_center_tag(void *pdoc, Node *node)
1904 char *attr_style = NULL;
1905 char *attr_color = NULL;
1906 char *attr_size = NULL;
1908 jhtml = GET_JHTML(pdoc);
1911 for (attr = qs_get_attr(doc,node);
1913 attr = qs_get_next_attr(doc,attr)) {
1914 char *name = qs_get_attr_name(doc,attr);
1915 char *value = qs_get_attr_value(doc,attr);
1916 if (STRCASEEQ('s','S',"style",name) && value && *value) {
1920 if (IS_CSS_ON(jhtml->entryp)) {
1921 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
1923 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1924 css_property_t *cur;
1925 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1926 if (cur->value && *cur->value) {
1927 attr_color = apr_pstrdup(doc->pool, cur->value);
1934 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
1935 memset(flg, 0, sizeof(*flg));
1936 if (attr_color || attr_size) {
1939 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1949 flg->with_font_flag = 1;
1952 node->userData = flg;
1956 jhtml_t *jhtml = GET_JHTML(pdoc);
1957 Doc *doc = jhtml->doc;
1965 * It is a handler who processes the CENTER tag.
1967 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1968 * destination is specified.
1969 * @param node [i] The CENTER tag node is specified.
1970 * @return The conversion result is returned.
1973 s_jhtml_end_center_tag(void *pdoc, Node *node)
1979 jhtml = GET_JHTML(pdoc);
1983 if (IS_CSS_ON(jhtml->entryp)) {
1984 chxj_css_pop_prop_list(jhtml->css_prop_stack);
1986 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
1987 if (flg && flg->with_font_flag) {
1996 * It is a handler who processes the li tag.
1998 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1999 * destination is specified.
2000 * @param node [i] The li tag node is specified.
2001 * @return The conversion result is returned.
2004 s_jhtml_start_li_tag(void *pdoc, Node *node)
2010 char *attr_type = NULL;
2011 char *attr_value = NULL;
2012 char *attr_style = NULL;
2014 jhtml = GET_JHTML(pdoc);
2018 for (attr = qs_get_attr(doc,node);
2020 attr = qs_get_next_attr(doc,attr)) {
2021 char *name = qs_get_attr_name(doc,attr);
2022 char *value = qs_get_attr_value(doc,attr);
2023 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2026 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2029 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2033 if (IS_CSS_ON(jhtml->entryp)) {
2034 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2036 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2037 css_property_t *cur;
2038 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2039 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2040 attr_type = apr_pstrdup(doc->pool, "1");
2042 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2043 attr_type = apr_pstrdup(doc->pool, "A");
2045 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2046 attr_type = apr_pstrdup(doc->pool, "a");
2069 * It is a handler who processes the li tag.
2071 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2072 * destination is specified.
2073 * @param node [i] The li tag node is specified.
2074 * @return The conversion result is returned.
2077 s_jhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
2083 jhtml = GET_JHTML(pdoc);
2088 if (IS_CSS_ON(jhtml->entryp)) {
2089 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2096 * It is a handler who processes the OL tag.
2098 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2099 * destination is specified.
2100 * @param node [i] The OL tag node is specified.
2101 * @return The conversion result is returned.
2104 s_jhtml_start_ol_tag(void *pdoc, Node *node)
2110 char *attr_style = NULL;
2111 char *attr_start = NULL;
2112 char *attr_type = NULL;
2114 jhtml = GET_JHTML(pdoc);
2118 /*--------------------------------------------------------------------------*/
2119 /* Get Attributes */
2120 /*--------------------------------------------------------------------------*/
2121 for (attr = qs_get_attr(doc,node);
2123 attr = qs_get_next_attr(doc,attr)) {
2124 char *name = qs_get_attr_name(doc,attr);
2125 char *value = qs_get_attr_value(doc,attr);
2126 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2129 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2132 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2136 if (IS_CSS_ON(jhtml->entryp)) {
2137 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2139 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2140 css_property_t *cur;
2141 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2142 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2143 attr_type = apr_pstrdup(doc->pool, "1");
2145 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2146 attr_type = apr_pstrdup(doc->pool, "A");
2148 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2149 attr_type = apr_pstrdup(doc->pool, "a");
2172 * It is a handler who processes the OL tag.
2174 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2175 * destination is specified.
2176 * @param node [i] The OL tag node is specified.
2177 * @return The conversion result is returned.
2180 s_jhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
2186 jhtml = GET_JHTML(pdoc);
2191 if (IS_CSS_ON(jhtml->entryp)) {
2192 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2199 * It is a handler who processes the P tag.
2201 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2202 * destination is specified.
2203 * @param node [i] The P tag node is specified.
2204 * @return The conversion result is returned.
2207 s_jhtml_start_p_tag(void *pdoc, Node *node)
2213 char *attr_align = NULL;
2214 char *attr_style = NULL;
2215 char *attr_color = NULL;
2216 char *attr_blink = NULL;
2219 jhtml = GET_JHTML(pdoc);
2223 for (attr = qs_get_attr(doc,node);
2225 attr = qs_get_next_attr(doc,attr)) {
2226 char *nm = qs_get_attr_name(doc,attr);
2227 char *val = qs_get_attr_value(doc,attr);
2228 if (STRCASEEQ('a','A',"align", nm)) {
2229 /*----------------------------------------------------------------------*/
2230 /* CHTML 1.0 (W3C version 3.2) */
2231 /*----------------------------------------------------------------------*/
2232 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2233 attr_align = apr_pstrdup(doc->buf.pool, val);
2237 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2238 attr_style = apr_pstrdup(doc->buf.pool, val);
2241 if (IS_CSS_ON(jhtml->entryp)) {
2242 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2244 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2245 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2246 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2247 css_property_t *cur;
2248 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2249 if (STRCASEEQ('l','L',"left",cur->value)) {
2250 attr_align = apr_pstrdup(doc->pool, "left");
2252 else if (STRCASEEQ('c','C',"center",cur->value)) {
2253 attr_align = apr_pstrdup(doc->pool, "center");
2255 else if (STRCASEEQ('r','R',"right",cur->value)) {
2256 attr_align = apr_pstrdup(doc->pool, "right");
2259 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2260 if (cur->value && *cur->value) {
2261 attr_color = apr_pstrdup(doc->pool, cur->value);
2264 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2265 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2266 attr_blink = apr_pstrdup(doc->pool, cur->value);
2279 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
2280 memset(flg, 0, sizeof(*flg));
2282 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2283 W_L("<font color=\"");
2286 flg->with_font_flag = 1;
2290 flg->with_blink_flag = 1;
2292 node->userData = (void *)flg;
2299 * It is a handler who processes the P tag.
2301 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2302 * destination is specified.
2303 * @param node [i] The P tag node is specified.
2304 * @return The conversion result is returned.
2307 s_jhtml_end_p_tag(void *pdoc, Node *node)
2309 jhtml_t *jhtml = GET_JHTML(pdoc);
2310 Doc *doc = jhtml->doc;
2312 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
2313 if (flg->with_font_flag) {
2316 if (flg->with_blink_flag) {
2321 if (IS_CSS_ON(jhtml->entryp)) {
2322 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2330 * It is a handler who processes the PRE tag.
2332 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2333 * destination is specified.
2334 * @param node [i] The PRE tag node is specified.
2335 * @return The conversion result is returned.
2338 s_jhtml_start_pre_tag(void *pdoc, Node *node)
2340 jhtml_t *jhtml = GET_JHTML(pdoc);
2341 Doc *doc = jhtml->doc;
2343 char *attr_style = NULL;
2345 for (attr = qs_get_attr(doc,node);
2347 attr = qs_get_next_attr(doc,attr)) {
2348 char *nm = qs_get_attr_name(doc,attr);
2349 char *val = qs_get_attr_value(doc,attr);
2350 if (val && STRCASEEQ('s','S',"style", nm)) {
2355 if (IS_CSS_ON(jhtml->entryp)) {
2356 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2366 * It is a handler who processes the PRE tag.
2368 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2369 * destination is specified.
2370 * @param node [i] The PRE tag node is specified.
2371 * @return The conversion result is returned.
2374 s_jhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
2376 jhtml_t *jhtml = GET_JHTML(pdoc);
2377 Doc *doc = jhtml->doc;
2381 if (IS_CSS_ON(jhtml->entryp)) {
2382 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2390 * It is a handler who processes the UL tag.
2392 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2393 * destination is specified.
2394 * @param node [i] The UL tag node is specified.
2395 * @return The conversion result is returned.
2398 s_jhtml_start_ul_tag(void *pdoc, Node *node)
2400 jhtml_t *jhtml = GET_JHTML(pdoc);
2401 Doc *doc = jhtml->doc;
2403 char *attr_style = NULL;
2405 for (attr = qs_get_attr(doc,node);
2407 attr = qs_get_next_attr(doc,attr)) {
2408 char *nm = qs_get_attr_name(doc,attr);
2409 char *val = qs_get_attr_value(doc,attr);
2410 if (val && STRCASEEQ('s','S',"style", nm)) {
2415 if (IS_CSS_ON(jhtml->entryp)) {
2416 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2425 * It is a handler who processes the UL tag.
2427 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2428 * destination is specified.
2429 * @param node [i] The UL tag node is specified.
2430 * @return The conversion result is returned.
2433 s_jhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
2435 jhtml_t *jhtml = GET_JHTML(pdoc);
2436 Doc *doc = jhtml->doc;
2439 if (IS_CSS_ON(jhtml->entryp)) {
2440 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2447 * It is a handler who processes the HR tag.
2449 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2450 * destination is specified.
2451 * @param node [i] The HR tag node is specified.
2452 * @return The conversion result is returned.
2455 s_jhtml_start_hr_tag(void *pdoc, Node *node)
2461 char *attr_align = NULL;
2462 char *attr_size = NULL;
2463 char *attr_width = NULL;
2464 char *attr_noshade = NULL;
2465 char *attr_style = NULL;
2466 char *attr_color = NULL;
2468 jhtml = GET_JHTML(pdoc);
2472 for (attr = qs_get_attr(doc,node);
2474 attr = qs_get_next_attr(doc,attr)) {
2475 char *name = qs_get_attr_name (doc,attr);
2476 char *value = qs_get_attr_value(doc,attr);
2480 if (strcasecmp(name, "align") == 0) {
2481 /*--------------------------------------------------------------------*/
2483 /*--------------------------------------------------------------------*/
2484 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2492 if (strcasecmp(name, "size") == 0) {
2493 /*--------------------------------------------------------------------*/
2495 /*--------------------------------------------------------------------*/
2496 if (value && *value) {
2500 else if (strcasecmp(name, "style") == 0) {
2501 if (value && *value) {
2509 if (strcasecmp(name, "width") == 0) {
2510 /*--------------------------------------------------------------------*/
2512 /*--------------------------------------------------------------------*/
2513 if (value && *value) {
2521 if (strcasecmp(name, "noshade") == 0) {
2522 /*--------------------------------------------------------------------*/
2524 /*--------------------------------------------------------------------*/
2525 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2531 if (strcasecmp(name, "color") == 0 && value && *value) {
2532 /*--------------------------------------------------------------------*/
2534 /*--------------------------------------------------------------------*/
2543 if (IS_CSS_ON(jhtml->entryp)) {
2544 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2546 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2547 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2548 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2549 css_property_t *cur;
2550 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2551 if (STRCASEEQ('s','S',"solid",cur->value)) {
2552 attr_noshade = "noshade";
2555 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2556 char *tmp = apr_pstrdup(doc->pool, cur->value);
2557 char *tmpp = strstr(tmp, "px");
2560 attr_size = apr_pstrdup(doc->pool, tmp);
2563 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2564 char *tmp = apr_pstrdup(doc->pool, cur->value);
2565 char *tmpp = strstr(tmp, "px");
2568 attr_width = apr_pstrdup(doc->pool, tmp);
2571 tmpp = strstr(tmp, "%");
2573 attr_width = apr_pstrdup(doc->pool, tmp);
2609 * It is a handler who processes the HR tag.
2611 * @param jhtml [i/o] The pointer to the CHTML structure at the output
2612 * destination is specified.
2613 * @param node [i] The HR tag node is specified.
2614 * @return The conversion result is returned.
2617 s_jhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2619 jhtml_t *jhtml = GET_JHTML(pdoc);
2625 * It is a handler who processes the IMG tag.
2627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2628 * destination is specified.
2629 * @param node [i] The IMG tag node is specified.
2630 * @return The conversion result is returned.
2633 s_jhtml_start_img_tag(void *pdoc, Node *node)
2639 char *attr_src = NULL;
2640 char *attr_align = NULL;
2641 char *attr_style = NULL;
2642 char *attr_alt = NULL;
2643 char *attr_width = NULL;
2644 char *attr_height = NULL;
2645 #ifndef IMG_NOT_CONVERT_FILENAME
2649 jhtml = GET_JHTML(pdoc);
2650 #ifndef IMG_NOT_CONVERT_FILENAME
2656 /*--------------------------------------------------------------------------*/
2657 /* Get Attributes */
2658 /*--------------------------------------------------------------------------*/
2659 for (attr = qs_get_attr(doc,node);
2661 attr = qs_get_next_attr(doc,attr)) {
2662 char *name = qs_get_attr_name (doc,attr);
2663 char *value = qs_get_attr_value(doc,attr);
2667 if (strcasecmp(name, "src") == 0) {
2668 /*--------------------------------------------------------------------*/
2670 /*--------------------------------------------------------------------*/
2671 #ifdef IMG_NOT_CONVERT_FILENAME
2672 value = chxj_encoding_parameter(r, value, 0);
2673 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
2674 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2675 value = chxj_add_cookie_no_update_parameter(r, value);
2678 value = chxj_img_conv(r, spec, value);
2679 value = chxj_encoding_parameter(r, value, 0);
2680 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
2681 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2682 value = chxj_add_cookie_no_update_parameter(r, value);
2686 else if (strcasecmp(name,"style") == 0 && value && *value) {
2693 if (strcasecmp(name, "align" ) == 0) {
2694 /*--------------------------------------------------------------------*/
2696 /*--------------------------------------------------------------------*/
2697 /*--------------------------------------------------------------------*/
2699 /*--------------------------------------------------------------------*/
2701 if (STRCASEEQ('t','T',"top", value) ||
2702 STRCASEEQ('m','M',"middle",value) ||
2703 STRCASEEQ('b','B',"bottom",value) ||
2704 STRCASEEQ('l','L',"left", value) ||
2705 STRCASEEQ('r','R',"right", value)) {
2708 else if (STRCASEEQ('c','C',"center", value)) {
2709 attr_align = apr_pstrdup(doc->pool, "middle");
2713 else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
2714 /*--------------------------------------------------------------------*/
2716 /*--------------------------------------------------------------------*/
2723 if (strcasecmp(name, "width" ) == 0 && value && *value) {
2724 /*--------------------------------------------------------------------*/
2726 /*--------------------------------------------------------------------*/
2733 if (strcasecmp(name, "height") == 0 && value && *value) {
2734 /*--------------------------------------------------------------------*/
2736 /*--------------------------------------------------------------------*/
2737 attr_height = value;
2740 if (strcasecmp(name, "hspace") == 0 && value && *value) {
2741 /*--------------------------------------------------------------------*/
2743 /*--------------------------------------------------------------------*/
2749 if (strcasecmp(name, "vspace") == 0 && value && *value) {
2750 /*--------------------------------------------------------------------*/
2752 /*--------------------------------------------------------------------*/
2761 if (IS_CSS_ON(jhtml->entryp)) {
2762 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
2764 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2765 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2766 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2767 css_property_t *cur;
2768 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2769 attr_height = apr_pstrdup(doc->pool, cur->value);
2771 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2772 attr_width = apr_pstrdup(doc->pool, cur->value);
2774 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2775 attr_align = apr_pstrdup(doc->pool, cur->value);
2812 * It is a handler who processes the IMG tag.
2814 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2815 * destination is specified.
2816 * @param node [i] The IMG tag node is specified.
2817 * @return The conversion result is returned.
2820 s_jhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
2822 jhtml_t *jhtml = GET_JHTML(pdoc);
2828 * It is a handler who processes the SELECT tag.
2830 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2831 * destination is specified.
2832 * @param node [i] The SELECT tag node is specified.
2833 * @return The conversion result is returned.
2836 s_jhtml_start_select_tag(void *pdoc, Node *node)
2838 jhtml_t *jhtml = GET_JHTML(pdoc);
2839 Doc *doc = jhtml->doc;
2843 char *multiple = NULL;
2844 char *attr_style = NULL;
2847 for (attr = qs_get_attr(doc,node);
2849 attr = qs_get_next_attr(doc,attr)) {
2850 char *nm = qs_get_attr_name(doc,attr);
2851 char *val = qs_get_attr_value(doc,attr);
2852 if (STRCASEEQ('s','S',"size",nm)) {
2853 /*----------------------------------------------------------------------*/
2854 /* CHTML 1.0 version 2.0 */
2855 /*----------------------------------------------------------------------*/
2856 size = apr_pstrdup(doc->buf.pool, val);
2858 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2859 /*----------------------------------------------------------------------*/
2860 /* CHTML 1.0 version 2.0 */
2861 /*----------------------------------------------------------------------*/
2862 attr_style = apr_pstrdup(doc->buf.pool, val);
2864 else if (STRCASEEQ('n','N',"name",nm)) {
2865 /*----------------------------------------------------------------------*/
2866 /* CHTML 1.0 version 2.0 */
2867 /*----------------------------------------------------------------------*/
2868 name = apr_pstrdup(doc->buf.pool, val);
2870 else if (STRCASEEQ('m','M',"multiple", nm)) {
2871 /*----------------------------------------------------------------------*/
2872 /* CHTML 1.0 version 2.0 */
2873 /*----------------------------------------------------------------------*/
2874 multiple = apr_pstrdup(doc->buf.pool, val);
2877 if (size && *size) {
2882 if (name && *name) {
2891 if (IS_CSS_ON(jhtml->entryp)) {
2892 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2899 * It is a handler who processes the SELECT tag.
2901 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2902 * destination is specified.
2903 * @param node [i] The SELECT tag node is specified.
2904 * @return The conversion result is returned.
2907 s_jhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
2909 jhtml_t *jhtml = GET_JHTML(pdoc);
2910 Doc *doc = jhtml->doc;
2913 if (IS_CSS_ON(jhtml->entryp)) {
2914 chxj_css_pop_prop_list(jhtml->css_prop_stack);
2920 * It is a handler who processes the OPTION tag.
2922 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2923 * destination is specified.
2924 * @param node [i] The OPTION tag node is specified.
2925 * @return The conversion result is returned.
2928 s_jhtml_start_option_tag(void *pdoc, Node *node)
2930 jhtml_t *jhtml = GET_JHTML(pdoc);
2931 Doc *doc = jhtml->doc;
2934 char *selected = NULL;
2936 char *attr_style = NULL;
2939 for (attr = qs_get_attr(doc,node);
2941 attr = qs_get_next_attr(doc,attr)) {
2942 char *nm = qs_get_attr_name(doc,attr);
2943 char *val = qs_get_attr_value(doc,attr);
2944 if (STRCASEEQ('s','S',"selected",nm)) {
2945 /*----------------------------------------------------------------------*/
2946 /* CHTML 1.0 version 2.0 */
2947 /*----------------------------------------------------------------------*/
2948 selected = apr_pstrdup(doc->buf.pool, val);
2950 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
2951 /*----------------------------------------------------------------------*/
2952 /* CHTML 1.0 version 2.0 */
2953 /*----------------------------------------------------------------------*/
2954 attr_style = apr_pstrdup(doc->buf.pool, val);
2956 else if (STRCASEEQ('v','V',"value",nm)) {
2957 /*----------------------------------------------------------------------*/
2958 /* CHTML 1.0 version 2.0 */
2959 /*----------------------------------------------------------------------*/
2960 value = apr_pstrdup(doc->buf.pool, val);
2973 if (IS_CSS_ON(jhtml->entryp)) {
2974 s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
2982 * It is a handler who processes the OPTION tag.
2984 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2985 * destination is specified.
2986 * @param node [i] The OPTION tag node is specified.
2987 * @return The conversion result is returned.
2990 s_jhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
2992 jhtml_t *jhtml = GET_JHTML(pdoc);
2994 if (IS_CSS_ON(jhtml->entryp)) {
2995 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3002 * It is a handler who processes the DIV tag.
3004 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3005 * destination is specified.
3006 * @param node [i] The DIV tag node is specified.
3007 * @return The conversion result is returned.
3010 s_jhtml_start_div_tag(void *pdoc, Node *node)
3016 char *attr_style = NULL;
3017 char *attr_align = NULL;
3018 char *attr_display = NULL;
3019 char *attr_decoration = NULL;
3020 char *attr_wap_marquee_style = NULL;
3021 char *attr_wap_marquee_dir = NULL;
3022 char *attr_wap_marquee_loop = NULL;
3023 char *attr_color = NULL;
3024 char *attr_bgcolor = NULL;
3025 char *attr_font_size = NULL;
3027 jhtml = GET_JHTML(pdoc);
3031 for (attr = qs_get_attr(doc,node);
3033 attr = qs_get_next_attr(doc,attr)) {
3034 char *nm = qs_get_attr_name(doc,attr);
3035 char *val = qs_get_attr_value(doc,attr);
3036 if (STRCASEEQ('a','A', "align", nm)) {
3037 /*----------------------------------------------------------------------*/
3038 /* CHTML 1.0 (W3C version 3.2) */
3039 /*----------------------------------------------------------------------*/
3040 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3041 attr_align = apr_pstrdup(doc->buf.pool, val);
3044 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3045 attr_style = apr_pstrdup(doc->buf.pool, val);
3049 if (IS_CSS_ON(jhtml->entryp)) {
3050 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3052 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3053 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3054 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3055 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3056 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3057 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3058 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3060 css_property_t *cur;
3061 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3062 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3063 attr_display = apr_pstrdup(doc->pool, cur->value);
3066 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3067 if (STRCASEEQ('b','B',"blink", cur->value)) {
3068 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3071 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3072 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3073 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3075 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3076 char *ss = strchr(cur->value, '#');
3078 ss = strstr(cur->value, "rgb");
3081 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3082 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3085 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3086 attr_color = apr_pstrdup(doc->pool, cur->value);
3088 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3089 attr_align = apr_pstrdup(doc->pool, cur->value);
3091 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3092 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3093 if (STRCASEEQ('x','X',"xx-small",attr_font_size)) {
3094 attr_font_size = apr_pstrdup(doc->pool, "1");
3096 else if (STRCASEEQ('x','X',"x-small",attr_font_size)) {
3097 attr_font_size = apr_pstrdup(doc->pool, "2");
3099 else if (STRCASEEQ('s','S',"small",attr_font_size)) {
3100 attr_font_size = apr_pstrdup(doc->pool, "3");
3102 else if (STRCASEEQ('m','M',"medium",attr_font_size)) {
3103 attr_font_size = apr_pstrdup(doc->pool, "4");
3105 else if (STRCASEEQ('l','L',"large",attr_font_size)) {
3106 attr_font_size = apr_pstrdup(doc->pool, "5");
3108 else if (STRCASEEQ('x','X',"x-large",attr_font_size)) {
3109 attr_font_size = apr_pstrdup(doc->pool, "6");
3111 else if (STRCASEEQ('x','X',"xx-large",attr_font_size)) {
3112 attr_font_size = apr_pstrdup(doc->pool, "7");
3116 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3117 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3118 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3119 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3120 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3121 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3124 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3125 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3126 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "right");
3128 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3129 attr_wap_marquee_dir = apr_pstrdup(doc->pool, "left");
3132 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3133 if (STRCASEEQ('i','I',"infinite",cur->value)) {
3134 attr_wap_marquee_loop = apr_pstrdup(doc->pool, "16");
3137 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3143 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3144 memset(flg, 0, sizeof(*flg));
3151 flg->with_div_flag = 1;
3154 && ! ((STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color)) && attr_bgcolor))
3155 || attr_font_size) {
3162 if (attr_font_size) {
3164 W_V(attr_font_size);
3168 flg->with_font_flag = 1;
3170 if (attr_decoration) {
3172 flg->with_blink_flag = 1;
3176 if (attr_wap_marquee_style) {
3177 W_L(" behavior=\"");
3178 W_V(attr_wap_marquee_style);
3181 if (attr_wap_marquee_dir) {
3182 W_L(" direction=\"");
3183 W_V(attr_wap_marquee_dir);
3186 if (attr_wap_marquee_loop) {
3188 W_V(attr_wap_marquee_loop);
3192 flg->with_marquee_flag = 1;
3194 if (!attr_align && !attr_color && !attr_decoration && !attr_display && !attr_font_size) {
3196 flg->with_div_flag = 1;
3198 node->userData = flg;
3205 * It is a handler who processes the DIV tag.
3207 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3208 * destination is specified.
3209 * @param node [i] The DIV tag node is specified.
3210 * @return The conversion result is returned.
3213 s_jhtml_end_div_tag(void *pdoc, Node *node)
3215 jhtml_t *jhtml = GET_JHTML(pdoc);
3216 Doc *doc = jhtml->doc;
3218 jhtml_flags_t *flg = node->userData;
3219 if (flg && flg->with_marquee_flag) {
3222 if (flg && flg->with_blink_flag) {
3225 if (flg && flg->with_font_flag) {
3228 if (flg && flg->with_div_flag) {
3231 if (IS_CSS_ON(jhtml->entryp)) {
3232 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3234 node->userData = NULL;
3241 chxj_istyle_to_mode(apr_pool_t *p, const char *s)
3247 case '1': return apr_psprintf(p, "hiragana");
3248 case '2': return apr_psprintf(p, "hankakukana");
3249 case '3': return apr_psprintf(p, "alphabet");
3250 case '4': return apr_psprintf(p, "numeric");
3252 tmp = apr_palloc(p, 1);
3254 return apr_pstrdup(p, tmp);
3258 tmp = apr_palloc(p, 1);
3260 return apr_pstrdup(p,tmp);
3265 s_jhtml_chxjif_tag(void *pdoc, Node *node)
3272 jhtml = GET_JHTML(pdoc);
3276 for (child = qs_get_child_node(doc, node);
3278 child = qs_get_next_node(doc, child)) {
3280 s_jhtml_chxjif_tag(jhtml, child);
3287 * It is a handler who processes the TEXTARE tag.
3289 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3290 * destination is specified.
3291 * @param node [i] The TEXTAREA tag node is specified.
3292 * @return The conversion result is returned.
3295 s_jhtml_start_textarea_tag(void *pdoc, Node *node)
3301 char *attr_accesskey = NULL;
3302 char *attr_name = NULL;
3303 char *attr_rows = NULL;
3304 char *attr_cols = NULL;
3305 char *attr_istyle = NULL;
3306 char *attr_style = NULL;
3308 jhtml = GET_JHTML(pdoc);
3312 jhtml->textarea_flag++;
3313 for (attr = qs_get_attr(doc,node);
3315 attr = qs_get_next_attr(doc,attr)) {
3316 char *name = qs_get_attr_name(doc,attr);
3317 char *value = qs_get_attr_value(doc,attr);
3318 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3319 attr_accesskey = value;
3321 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3322 attr_istyle = value;
3324 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
3327 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
3330 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
3333 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3337 if (IS_CSS_ON(jhtml->entryp)) {
3338 css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
3340 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3341 css_property_t *cur;
3342 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3343 if (strcasestr(cur->value, "<ja:n>")) {
3346 else if (strcasestr(cur->value, "<ja:en>")) {
3349 else if (strcasestr(cur->value, "<ja:hk>")) {
3352 else if (strcasestr(cur->value, "<ja:h>")) {
3359 if (attr_accesskey) {
3360 W_L(" accesskey=\"");
3361 W_V(attr_accesskey);
3380 char *vv = chxj_istyle_to_mode(doc->buf.pool,attr_istyle);
3391 * It is a handler who processes the TEXTAREA tag.
3393 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3394 * destination is specified.
3395 * @param node [i] The TEXTAREA tag node is specified.
3396 * @return The conversion result is returned.
3399 s_jhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3405 jhtml = GET_JHTML(pdoc);
3410 jhtml->textarea_flag--;
3417 * It is a handler who processes the B tag.
3419 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3420 * destination is specified.
3421 * @param node [i] The B tag node is specified.
3422 * @return The conversion result is returned.
3425 s_jhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
3431 jhtml = GET_JHTML(pdoc);
3441 * It is a handler who processes the B tag.
3443 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3444 * destination is specified.
3445 * @param node [i] The B tag node is specified.
3446 * @return The conversion result is returned.
3449 s_jhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
3451 jhtml_t* jhtml = GET_JHTML(pdoc);
3452 Doc* doc = jhtml->doc;
3459 s_jhtml_text_tag(void* pdoc, Node* child)
3471 jhtml = GET_JHTML(pdoc);
3474 DBG(r, "start s_jhtml_text_tag()");
3476 textval = qs_get_node_value(doc,child);
3477 if (strlen(textval) == 0) {
3481 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3482 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3484 tdst = qs_alloc_zero_byte_string(r->pool);
3485 memset(one_byte, 0, sizeof(one_byte));
3488 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3490 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
3492 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3497 if (is_sjis_kanji(textval[ii])) {
3498 one_byte[0] = textval[ii+0];
3499 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3500 one_byte[0] = textval[ii+1];
3501 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3505 if (jhtml->pre_flag) {
3506 one_byte[0] = textval[ii+0];
3507 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3510 if (jhtml->textarea_flag) {
3511 one_byte[0] = textval[ii+0];
3512 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3515 if (textval[ii] != '\r' && textval[ii] != '\n') {
3516 one_byte[0] = textval[ii+0];
3517 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3522 DBG(r, "end s_jhtml_text_tag()");
3528 * It is a handler who processes the BLOCKQUOTE tag.
3530 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3531 * destination is specified.
3532 * @param node [i] The BLOCKQUOTE tag node is specified.
3533 * @return The conversion result is returned.
3536 s_jhtml_start_blockquote_tag(void *pdoc, Node *node)
3541 char *attr_style = NULL;
3542 char *attr_color = NULL;
3543 char *attr_size = NULL;
3545 jhtml = GET_JHTML(pdoc);
3547 for (attr = qs_get_attr(doc,node);
3549 attr = qs_get_next_attr(doc,attr)) {
3550 char *nm = qs_get_attr_name(doc,attr);
3551 char *val = qs_get_attr_value(doc,attr);
3552 if (val && STRCASEEQ('s','S',"style", nm)) {
3556 if (IS_CSS_ON(jhtml->entryp)) {
3557 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3559 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3560 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3561 css_property_t *cur;
3562 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3563 if (cur->value && *cur->value) {
3564 attr_color = apr_pstrdup(doc->pool, cur->value);
3567 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3568 if (cur->value && *cur->value) {
3569 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3570 attr_size = apr_pstrdup(doc->pool, "1");
3572 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3573 attr_size = apr_pstrdup(doc->pool, "2");
3575 else if (STRCASEEQ('s','S',"small",cur->value)) {
3576 attr_size = apr_pstrdup(doc->pool, "3");
3578 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3579 attr_size = apr_pstrdup(doc->pool, "4");
3581 else if (STRCASEEQ('l','L',"large",cur->value)) {
3582 attr_size = apr_pstrdup(doc->pool, "5");
3584 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3585 attr_size = apr_pstrdup(doc->pool, "6");
3587 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3588 attr_size = apr_pstrdup(doc->pool, "7");
3594 W_L("<blockquote>");
3595 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3596 memset(flg, 0, sizeof(*flg));
3597 if (attr_color || attr_size) {
3600 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3611 flg->with_font_flag = 1;
3613 node->userData = (void *)flg;
3619 * It is a handler who processes the BLOCKQUOTE tag.
3621 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3622 * destination is specified.
3623 * @param node [i] The BLOCKQUOTE tag node is specified.
3624 * @return The conversion result is returned.
3627 s_jhtml_end_blockquote_tag(void *pdoc, Node *node)
3629 jhtml_t *jhtml = GET_JHTML(pdoc);
3630 Doc *doc = jhtml->doc;
3631 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3632 if (flg && flg->with_font_flag) {
3635 W_L("</blockquote>");
3636 if (IS_CSS_ON(jhtml->entryp)) {
3637 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3644 * It is a handler who processes the DIR tag.
3646 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3647 * destination is specified.
3648 * @param node [i] The DIR tag node is specified.
3649 * @return The conversion result is returned.
3652 s_jhtml_start_dir_tag(void *pdoc, Node *node)
3654 jhtml_t *jhtml = GET_JHTML(pdoc);
3655 Doc *doc = jhtml->doc;
3657 char *attr_style = NULL;
3658 char *attr_color = NULL;
3659 char *attr_size = NULL;
3660 for (attr = qs_get_attr(doc,node);
3662 attr = qs_get_next_attr(doc,attr)) {
3663 char *name = qs_get_attr_name(doc,attr);
3664 char *value = qs_get_attr_value(doc,attr);
3665 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3669 if (IS_CSS_ON(jhtml->entryp)) {
3670 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3672 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3673 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3674 css_property_t *cur;
3675 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3676 if (cur->value && *cur->value) {
3677 attr_color = apr_pstrdup(doc->pool, cur->value);
3680 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3681 if (cur->value && *cur->value) {
3682 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3683 attr_size = apr_pstrdup(doc->pool, "1");
3685 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3686 attr_size = apr_pstrdup(doc->pool, "2");
3688 else if (STRCASEEQ('s','S',"small",cur->value)) {
3689 attr_size = apr_pstrdup(doc->pool, "3");
3691 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3692 attr_size = apr_pstrdup(doc->pool, "4");
3694 else if (STRCASEEQ('l','L',"large",cur->value)) {
3695 attr_size = apr_pstrdup(doc->pool, "5");
3697 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3698 attr_size = apr_pstrdup(doc->pool, "6");
3700 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3701 attr_size = apr_pstrdup(doc->pool, "7");
3708 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3709 memset(flg, 0, sizeof(*flg));
3710 if (attr_color || attr_size) {
3713 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3724 flg->with_font_flag = 1;
3726 node->userData = (void *)flg;
3732 * It is a handler who processes the DIR tag.
3734 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3735 * destination is specified.
3736 * @param node [i] The DIR tag node is specified.
3737 * @return The conversion result is returned.
3740 s_jhtml_end_dir_tag(void *pdoc, Node *node)
3742 jhtml_t *jhtml = GET_JHTML(pdoc);
3743 Doc *doc = jhtml->doc;
3744 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3745 if (flg && flg->with_font_flag) {
3749 if (IS_CSS_ON(jhtml->entryp)) {
3750 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3757 * It is a handler who processes the DL tag.
3759 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3760 * destination is specified.
3761 * @param node [i] The DL tag node is specified.
3762 * @return The conversion result is returned.
3765 s_jhtml_start_dl_tag(void *pdoc, Node *node)
3767 jhtml_t *jhtml = GET_JHTML(pdoc);
3768 Doc *doc = jhtml->doc;
3770 char *attr_style = NULL;
3771 char *attr_color = NULL;
3772 char *attr_size = NULL;
3773 for (attr = qs_get_attr(doc,node);
3775 attr = qs_get_next_attr(doc,attr)) {
3776 char *name = qs_get_attr_name(doc,attr);
3777 char *value = qs_get_attr_value(doc,attr);
3778 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3782 if (IS_CSS_ON(jhtml->entryp)) {
3783 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3785 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3786 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3787 css_property_t *cur;
3788 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3789 if (cur->value && *cur->value) {
3790 attr_color = apr_pstrdup(doc->pool, cur->value);
3793 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3794 if (cur->value && *cur->value) {
3795 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3796 attr_size = apr_pstrdup(doc->pool, "1");
3798 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3799 attr_size = apr_pstrdup(doc->pool, "2");
3801 else if (STRCASEEQ('s','S',"small",cur->value)) {
3802 attr_size = apr_pstrdup(doc->pool, "3");
3804 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3805 attr_size = apr_pstrdup(doc->pool, "4");
3807 else if (STRCASEEQ('l','L',"large",cur->value)) {
3808 attr_size = apr_pstrdup(doc->pool, "5");
3810 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3811 attr_size = apr_pstrdup(doc->pool, "6");
3813 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3814 attr_size = apr_pstrdup(doc->pool, "7");
3821 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3822 memset(flg, 0, sizeof(*flg));
3823 if (attr_color || attr_size) {
3826 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3837 flg->with_font_flag = 1;
3839 node->userData = (void *)flg;
3845 * It is a handler who processes the DL tag.
3847 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3848 * destination is specified.
3849 * @param node [i] The DL tag node is specified.
3850 * @return The conversion result is returned.
3853 s_jhtml_end_dl_tag(void *pdoc, Node *node)
3855 jhtml_t *jhtml = GET_JHTML(pdoc);
3856 Doc *doc = jhtml->doc;
3857 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3858 if (flg && flg->with_font_flag) {
3862 if (IS_CSS_ON(jhtml->entryp)) {
3863 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3870 * It is a handler who processes the DT tag.
3872 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3873 * destination is specified.
3874 * @param node [i] The DT tag node is specified.
3875 * @return The conversion result is returned.
3878 s_jhtml_start_dt_tag(void *pdoc, Node *node)
3880 jhtml_t *jhtml = GET_JHTML(pdoc);
3881 Doc *doc = jhtml->doc;
3883 char *attr_style = NULL;
3884 char *attr_color = NULL;
3885 char *attr_size = NULL;
3886 for (attr = qs_get_attr(doc,node);
3888 attr = qs_get_next_attr(doc,attr)) {
3889 char *name = qs_get_attr_name(doc,attr);
3890 char *value = qs_get_attr_value(doc,attr);
3891 if (STRCASEEQ('s','S',"style", name) && value && *value) {
3895 if (IS_CSS_ON(jhtml->entryp)) {
3896 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
3898 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3899 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3900 css_property_t *cur;
3901 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3902 if (cur->value && *cur->value) {
3903 attr_color = apr_pstrdup(doc->pool, cur->value);
3906 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3907 if (cur->value && *cur->value) {
3908 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
3909 attr_size = apr_pstrdup(doc->pool, "1");
3911 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
3912 attr_size = apr_pstrdup(doc->pool, "2");
3914 else if (STRCASEEQ('s','S',"small",cur->value)) {
3915 attr_size = apr_pstrdup(doc->pool, "3");
3917 else if (STRCASEEQ('m','M',"medium",cur->value)) {
3918 attr_size = apr_pstrdup(doc->pool, "4");
3920 else if (STRCASEEQ('l','L',"large",cur->value)) {
3921 attr_size = apr_pstrdup(doc->pool, "5");
3923 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
3924 attr_size = apr_pstrdup(doc->pool, "6");
3926 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
3927 attr_size = apr_pstrdup(doc->pool, "7");
3934 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
3935 memset(flg, 0, sizeof(*flg));
3936 if (attr_color || attr_size) {
3939 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3950 flg->with_font_flag = 1;
3952 node->userData = (void *)flg;
3958 * It is a handler who processes the DT tag.
3960 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3961 * destination is specified.
3962 * @param node [i] The DT tag node is specified.
3963 * @return The conversion result is returned.
3966 s_jhtml_end_dt_tag(void *pdoc, Node *node)
3968 jhtml_t *jhtml = GET_JHTML(pdoc);
3969 Doc *doc = jhtml->doc;
3970 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
3971 if (flg && flg->with_font_flag) {
3974 if (IS_CSS_ON(jhtml->entryp)) {
3975 chxj_css_pop_prop_list(jhtml->css_prop_stack);
3982 * It is a handler who processes the DD tag.
3984 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3985 * destination is specified.
3986 * @param node [i] The DD tag node is specified.
3987 * @return The conversion result is returned.
3990 s_jhtml_start_dd_tag(void *pdoc, Node *node)
3992 jhtml_t *jhtml = GET_JHTML(pdoc);
3993 Doc *doc = jhtml->doc;
3995 char *attr_style = NULL;
3996 char *attr_color = NULL;
3997 char *attr_size = NULL;
3998 for (attr = qs_get_attr(doc,node);
4000 attr = qs_get_next_attr(doc,attr)) {
4001 char *name = qs_get_attr_name(doc,attr);
4002 char *value = qs_get_attr_value(doc,attr);
4003 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4007 if (IS_CSS_ON(jhtml->entryp)) {
4008 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4010 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4011 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4012 css_property_t *cur;
4013 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4014 if (cur->value && *cur->value) {
4015 attr_color = apr_pstrdup(doc->pool, cur->value);
4018 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4019 if (cur->value && *cur->value) {
4020 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4021 attr_size = apr_pstrdup(doc->pool, "1");
4023 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4024 attr_size = apr_pstrdup(doc->pool, "2");
4026 else if (STRCASEEQ('s','S',"small",cur->value)) {
4027 attr_size = apr_pstrdup(doc->pool, "3");
4029 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4030 attr_size = apr_pstrdup(doc->pool, "4");
4032 else if (STRCASEEQ('l','L',"large",cur->value)) {
4033 attr_size = apr_pstrdup(doc->pool, "5");
4035 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4036 attr_size = apr_pstrdup(doc->pool, "6");
4038 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4039 attr_size = apr_pstrdup(doc->pool, "7");
4046 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4047 memset(flg, 0, sizeof(*flg));
4048 if (attr_color || attr_size) {
4051 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4062 flg->with_font_flag = 1;
4064 node->userData = (void *)flg;
4070 * It is a handler who processes the DD tag.
4072 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4073 * destination is specified.
4074 * @param node [i] The DD tag node is specified.
4075 * @return The conversion result is returned.
4078 s_jhtml_end_dd_tag(void *pdoc, Node *node)
4080 jhtml_t *jhtml = GET_JHTML(pdoc);
4081 Doc *doc = jhtml->doc;
4082 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4083 if (flg && flg->with_font_flag) {
4086 if (IS_CSS_ON(jhtml->entryp)) {
4087 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4094 * It is a handler who processes the H1 tag.
4096 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4097 * destination is specified.
4098 * @param node [i] The H1 tag node is specified.
4099 * @return The conversion result is returned.
4102 s_jhtml_start_h1_tag(void *pdoc, Node *node)
4108 char *attr_style = NULL;
4109 char *attr_align = NULL;
4111 jhtml = GET_JHTML(pdoc);
4115 for (attr = qs_get_attr(doc,node);
4117 attr = qs_get_next_attr(doc,attr)) {
4118 char *name = qs_get_attr_name(doc,attr);
4119 char *value = qs_get_attr_value(doc,attr);
4120 if (STRCASEEQ('a','A',"align", name)) {
4121 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4125 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4129 if (IS_CSS_ON(jhtml->entryp)) {
4130 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4132 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4133 css_property_t *cur;
4134 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4135 if (STRCASEEQ('l','L',"left", cur->value)) {
4136 attr_align = apr_pstrdup(doc->pool, "left");
4138 else if (STRCASEEQ('c','C',"center",cur->value)) {
4139 attr_align = apr_pstrdup(doc->pool, "center");
4141 else if (STRCASEEQ('r','R',"right",cur->value)) {
4142 attr_align = apr_pstrdup(doc->pool, "right");
4148 W_L("<div align=\"");
4151 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4152 memset(flg, 0, sizeof(*flg));
4153 flg->with_div_align_flag = 1;
4154 node->userData = (void *)flg;
4157 node->userData = NULL;
4165 * It is a handler who processes the H1 tag.
4167 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4168 * destination is specified.
4169 * @param node [i] The H1 tag node is specified.
4170 * @return The conversion result is returned.
4173 s_jhtml_end_h1_tag(void *pdoc, Node *node)
4179 jhtml = GET_JHTML(pdoc);
4183 jhtml_flags_t *flg = node->userData;
4184 if (flg && flg->with_div_align_flag) {
4186 node->userData = NULL;
4188 if (IS_CSS_ON(jhtml->entryp)) {
4189 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4196 * It is a handler who processes the H2 tag.
4198 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4199 * destination is specified.
4200 * @param node [i] The H1 tag node is specified.
4201 * @return The conversion result is returned.
4204 s_jhtml_start_h2_tag(void *pdoc, Node *node)
4210 char *attr_style = NULL;
4211 char *attr_align = NULL;
4213 jhtml = GET_JHTML(pdoc);
4217 for (attr = qs_get_attr(doc,node);
4219 attr = qs_get_next_attr(doc,attr)) {
4220 char *name = qs_get_attr_name(doc,attr);
4221 char *value = qs_get_attr_value(doc,attr);
4222 if (STRCASEEQ('a','A',"align", name)) {
4223 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4227 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4231 if (IS_CSS_ON(jhtml->entryp)) {
4232 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4234 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4235 css_property_t *cur;
4236 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4237 if (STRCASEEQ('l','L',"left", cur->value)) {
4238 attr_align = apr_pstrdup(doc->pool, "left");
4240 else if (STRCASEEQ('c','C',"center",cur->value)) {
4241 attr_align = apr_pstrdup(doc->pool, "center");
4243 else if (STRCASEEQ('r','R',"right",cur->value)) {
4244 attr_align = apr_pstrdup(doc->pool, "right");
4250 W_L("<div align=\"");
4253 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4254 memset(flg, 0, sizeof(*flg));
4255 flg->with_div_align_flag = 1;
4256 node->userData = (void *)flg;
4259 node->userData = NULL;
4267 * It is a handler who processes the H2 tag.
4269 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4270 * destination is specified.
4271 * @param node [i] The H1 tag node is specified.
4272 * @return The conversion result is returned.
4275 s_jhtml_end_h2_tag(void *pdoc, Node *node)
4281 jhtml = GET_JHTML(pdoc);
4285 jhtml_flags_t *flg = node->userData;
4286 if (flg && flg->with_div_align_flag) {
4288 node->userData = NULL;
4290 if (IS_CSS_ON(jhtml->entryp)) {
4291 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4298 * It is a handler who processes the H3 tag.
4300 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4301 * destination is specified.
4302 * @param node [i] The H1 tag node is specified.
4303 * @return The conversion result is returned.
4306 s_jhtml_start_h3_tag(void *pdoc, Node *node)
4312 char *attr_style = NULL;
4313 char *attr_align = NULL;
4315 jhtml = GET_JHTML(pdoc);
4319 for (attr = qs_get_attr(doc,node);
4321 attr = qs_get_next_attr(doc,attr)) {
4322 char *name = qs_get_attr_name(doc,attr);
4323 char *value = qs_get_attr_value(doc,attr);
4324 if (STRCASEEQ('a','A',"align", name)) {
4325 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4329 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4333 if (IS_CSS_ON(jhtml->entryp)) {
4334 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4336 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4337 css_property_t *cur;
4338 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4339 if (STRCASEEQ('l','L',"left", cur->value)) {
4340 attr_align = apr_pstrdup(doc->pool, "left");
4342 else if (STRCASEEQ('c','C',"center",cur->value)) {
4343 attr_align = apr_pstrdup(doc->pool, "center");
4345 else if (STRCASEEQ('r','R',"right",cur->value)) {
4346 attr_align = apr_pstrdup(doc->pool, "right");
4352 W_L("<div align=\"");
4355 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4356 memset(flg, 0, sizeof(*flg));
4357 flg->with_div_align_flag = 1;
4358 node->userData = (void *)flg;
4361 node->userData = NULL;
4369 * It is a handler who processes the H3 tag.
4371 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4372 * destination is specified.
4373 * @param node [i] The H1 tag node is specified.
4374 * @return The conversion result is returned.
4377 s_jhtml_end_h3_tag(void *pdoc, Node *node)
4383 jhtml = GET_JHTML(pdoc);
4387 jhtml_flags_t *flg = node->userData;
4388 if (flg && flg->with_div_align_flag) {
4390 node->userData = NULL;
4392 if (IS_CSS_ON(jhtml->entryp)) {
4393 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4401 * It is a handler who processes the H4 tag.
4403 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4404 * destination is specified.
4405 * @param node [i] The H1 tag node is specified.
4406 * @return The conversion result is returned.
4409 s_jhtml_start_h4_tag(void *pdoc, Node *node)
4415 char *attr_style = NULL;
4416 char *attr_align = NULL;
4418 jhtml = GET_JHTML(pdoc);
4422 for (attr = qs_get_attr(doc,node);
4424 attr = qs_get_next_attr(doc,attr)) {
4425 char *name = qs_get_attr_name(doc,attr);
4426 char *value = qs_get_attr_value(doc,attr);
4427 if (STRCASEEQ('a','A',"align", name)) {
4428 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4432 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4436 if (IS_CSS_ON(jhtml->entryp)) {
4437 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4439 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4440 css_property_t *cur;
4441 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4442 if (STRCASEEQ('l','L',"left", cur->value)) {
4443 attr_align = apr_pstrdup(doc->pool, "left");
4445 else if (STRCASEEQ('c','C',"center",cur->value)) {
4446 attr_align = apr_pstrdup(doc->pool, "center");
4448 else if (STRCASEEQ('r','R',"right",cur->value)) {
4449 attr_align = apr_pstrdup(doc->pool, "right");
4455 W_L("<div align=\"");
4458 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4459 memset(flg, 0, sizeof(*flg));
4460 flg->with_div_align_flag = 1;
4461 node->userData = (void *)flg;
4464 node->userData = NULL;
4471 * It is a handler who processes the H4 tag.
4473 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4474 * destination is specified.
4475 * @param node [i] The H1 tag node is specified.
4476 * @return The conversion result is returned.
4479 s_jhtml_end_h4_tag(void *pdoc, Node *node)
4485 jhtml = GET_JHTML(pdoc);
4489 jhtml_flags_t *flg = node->userData;
4490 if (flg && flg->with_div_align_flag) {
4492 node->userData = NULL;
4494 if (IS_CSS_ON(jhtml->entryp)) {
4495 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4502 * It is a handler who processes the H5 tag.
4504 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4505 * destination is specified.
4506 * @param node [i] The H1 tag node is specified.
4507 * @return The conversion result is returned.
4510 s_jhtml_start_h5_tag(void *pdoc, Node *node)
4516 char *attr_style = NULL;
4517 char *attr_align = NULL;
4519 jhtml = GET_JHTML(pdoc);
4523 for (attr = qs_get_attr(doc,node);
4525 attr = qs_get_next_attr(doc,attr)) {
4526 char *name = qs_get_attr_name(doc,attr);
4527 char *value = qs_get_attr_value(doc,attr);
4528 if (STRCASEEQ('a','A',"align", name)) {
4529 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4533 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4537 if (IS_CSS_ON(jhtml->entryp)) {
4538 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4540 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4541 css_property_t *cur;
4542 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4543 if (STRCASEEQ('l','L',"left", cur->value)) {
4544 attr_align = apr_pstrdup(doc->pool, "left");
4546 else if (STRCASEEQ('c','C',"center",cur->value)) {
4547 attr_align = apr_pstrdup(doc->pool, "center");
4549 else if (STRCASEEQ('r','R',"right",cur->value)) {
4550 attr_align = apr_pstrdup(doc->pool, "right");
4556 W_L("<div align=\"");
4559 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4560 memset(flg, 0, sizeof(*flg));
4561 flg->with_div_align_flag = 1;
4562 node->userData = (void *)flg;
4565 node->userData = NULL;
4572 * It is a handler who processes the H5 tag.
4574 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4575 * destination is specified.
4576 * @param node [i] The H1 tag node is specified.
4577 * @return The conversion result is returned.
4580 s_jhtml_end_h5_tag(void *pdoc, Node *node)
4586 jhtml = GET_JHTML(pdoc);
4590 jhtml_flags_t *flg = node->userData;
4591 if (flg && flg->with_div_align_flag) {
4593 node->userData = NULL;
4595 if (IS_CSS_ON(jhtml->entryp)) {
4596 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4604 * It is a handler who processes the H6 tag.
4606 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4607 * destination is specified.
4608 * @param node [i] The H1 tag node is specified.
4609 * @return The conversion result is returned.
4612 s_jhtml_start_h6_tag(void *pdoc, Node *node)
4618 char *attr_style = NULL;
4619 char *attr_align = NULL;
4621 jhtml = GET_JHTML(pdoc);
4625 for (attr = qs_get_attr(doc,node);
4627 attr = qs_get_next_attr(doc,attr)) {
4628 char *name = qs_get_attr_name(doc,attr);
4629 char *value = qs_get_attr_value(doc,attr);
4630 if (STRCASEEQ('a','A',"align", name)) {
4631 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
4635 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4639 if (IS_CSS_ON(jhtml->entryp)) {
4640 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4642 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
4643 css_property_t *cur;
4644 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4645 if (STRCASEEQ('l','L',"left", cur->value)) {
4646 attr_align = apr_pstrdup(doc->pool, "left");
4648 else if (STRCASEEQ('c','C',"center",cur->value)) {
4649 attr_align = apr_pstrdup(doc->pool, "center");
4651 else if (STRCASEEQ('r','R',"right",cur->value)) {
4652 attr_align = apr_pstrdup(doc->pool, "right");
4658 W_L("<div align=\"");
4661 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
4662 memset(flg, 0, sizeof(*flg));
4663 flg->with_div_align_flag = 1;
4664 node->userData = (void *)flg;
4667 node->userData = NULL;
4675 * It is a handler who processes the H6 tag.
4677 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4678 * destination is specified.
4679 * @param node [i] The H1 tag node is specified.
4680 * @return The conversion result is returned.
4683 s_jhtml_end_h6_tag(void *pdoc, Node *node)
4689 jhtml = GET_JHTML(pdoc);
4693 jhtml_flags_t *flg = node->userData;
4694 if (flg && flg->with_div_align_flag) {
4696 node->userData = NULL;
4698 if (IS_CSS_ON(jhtml->entryp)) {
4699 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4707 * It is a handler who processes the MENU tag.
4709 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4710 * destination is specified.
4711 * @param node [i] The MENU tag node is specified.
4712 * @return The conversion result is returned.
4715 s_jhtml_start_menu_tag(void *pdoc, Node *node)
4717 jhtml_t *jhtml = GET_JHTML(pdoc);
4718 Doc *doc = jhtml->doc;
4720 char *attr_style = NULL;
4721 char *attr_color = NULL;
4722 char *attr_size = NULL;
4723 for (attr = qs_get_attr(doc,node);
4725 attr = qs_get_next_attr(doc,attr)) {
4726 char *name = qs_get_attr_name(doc,attr);
4727 char *value = qs_get_attr_value(doc,attr);
4728 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4732 if (IS_CSS_ON(jhtml->entryp)) {
4733 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4735 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4736 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4737 css_property_t *cur;
4738 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4739 if (cur->value && *cur->value) {
4740 attr_color = apr_pstrdup(doc->pool, cur->value);
4743 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4744 if (cur->value && *cur->value) {
4745 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4746 attr_size = apr_pstrdup(doc->pool, "1");
4748 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4749 attr_size = apr_pstrdup(doc->pool, "2");
4751 else if (STRCASEEQ('s','S',"small",cur->value)) {
4752 attr_size = apr_pstrdup(doc->pool, "3");
4754 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4755 attr_size = apr_pstrdup(doc->pool, "4");
4757 else if (STRCASEEQ('l','L',"large",cur->value)) {
4758 attr_size = apr_pstrdup(doc->pool, "5");
4760 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4761 attr_size = apr_pstrdup(doc->pool, "6");
4763 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4764 attr_size = apr_pstrdup(doc->pool, "7");
4771 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4772 memset(flg, 0, sizeof(*flg));
4773 if (attr_color || attr_size) {
4776 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4787 flg->with_font_flag = 1;
4789 node->userData = (void *)flg;
4795 * It is a handler who processes the MENU tag.
4797 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4798 * destination is specified.
4799 * @param node [i] The MENU tag node is specified.
4800 * @return The conversion result is returned.
4803 s_jhtml_end_menu_tag(void *pdoc, Node *node)
4805 jhtml_t *jhtml = GET_JHTML(pdoc);
4806 Doc *doc = jhtml->doc;
4807 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4808 if (flg && flg->with_font_flag) {
4812 if (IS_CSS_ON(jhtml->entryp)) {
4813 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4820 * It is a handler who processes the PLAINTEXT tag.
4822 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4823 * destination is specified.
4824 * @param node [i] The PLAINTEXT tag node is specified.
4825 * @return The conversion result is returned.
4828 s_jhtml_start_plaintext_tag(void *pdoc, Node *node)
4833 jhtml = GET_JHTML(pdoc);
4836 s_jhtml_start_plaintext_tag_inner(pdoc,node);
4841 s_jhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
4846 jhtml = GET_JHTML(pdoc);
4848 for (child = qs_get_child_node(doc, node);
4850 child = qs_get_next_node(doc, child)) {
4852 s_jhtml_start_plaintext_tag_inner(pdoc, child);
4859 * It is a handler who processes the PLAINTEXT tag.
4861 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4862 * destination is specified.
4863 * @param node [i] The PLAINTEXT tag node is specified.
4864 * @return The conversion result is returned.
4867 s_jhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4869 jhtml_t *jhtml = GET_JHTML(pdoc);
4875 * It is a handler who processes the BLINK tag.
4877 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4878 * destination is specified.
4879 * @param node [i] The BLINK tag node is specified.
4880 * @return The conversion result is returned.
4883 s_jhtml_start_blink_tag(void *pdoc, Node *node)
4885 jhtml_t *jhtml = GET_JHTML(pdoc);
4886 Doc *doc = jhtml->doc;
4888 char *attr_style = NULL;
4889 char *attr_color = NULL;
4890 char *attr_size = NULL;
4891 for (attr = qs_get_attr(doc,node);
4893 attr = qs_get_next_attr(doc,attr)) {
4894 char *name = qs_get_attr_name(doc,attr);
4895 char *value = qs_get_attr_value(doc,attr);
4896 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4900 if (IS_CSS_ON(jhtml->entryp)) {
4901 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
4903 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4904 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4905 css_property_t *cur;
4906 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4907 if (cur->value && *cur->value) {
4908 attr_color = apr_pstrdup(doc->pool, cur->value);
4911 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4912 if (cur->value && *cur->value) {
4913 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4914 attr_size = apr_pstrdup(doc->pool, "1");
4916 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4917 attr_size = apr_pstrdup(doc->pool, "2");
4919 else if (STRCASEEQ('s','S',"small",cur->value)) {
4920 attr_size = apr_pstrdup(doc->pool, "3");
4922 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4923 attr_size = apr_pstrdup(doc->pool, "4");
4925 else if (STRCASEEQ('l','L',"large",cur->value)) {
4926 attr_size = apr_pstrdup(doc->pool, "5");
4928 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4929 attr_size = apr_pstrdup(doc->pool, "6");
4931 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4932 attr_size = apr_pstrdup(doc->pool, "7");
4939 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
4940 memset(flg, 0, sizeof(*flg));
4941 if (attr_color || attr_size) {
4944 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4955 flg->with_font_flag = 1;
4957 node->userData = (void *)flg;
4963 * It is a handler who processes the BLINK tag.
4965 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4966 * destination is specified.
4967 * @param node [i] The BLINK tag node is specified.
4968 * @return The conversion result is returned.
4971 s_jhtml_end_blink_tag(void *pdoc, Node *node)
4973 jhtml_t *jhtml = GET_JHTML(pdoc);
4974 Doc *doc = jhtml->doc;
4975 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
4976 if (flg && flg->with_font_flag) {
4980 if (IS_CSS_ON(jhtml->entryp)) {
4981 chxj_css_pop_prop_list(jhtml->css_prop_stack);
4988 * It is a handler who processes the MARQUEE tag.
4990 * @param pdoc [i/o] The pointer to the JHTML structure at the output
4991 * destination is specified.
4992 * @param node [i] The MARQUEE tag node is specified.
4993 * @return The conversion result is returned.
4996 s_jhtml_start_marquee_tag(void *pdoc, Node *node)
4998 jhtml_t *jhtml = GET_JHTML(pdoc);
4999 Doc *doc = jhtml->doc;
5001 char *attr_direction = NULL;
5002 char *attr_style = NULL;
5003 char *attr_color = NULL;
5004 char *attr_size = NULL;
5005 /*--------------------------------------------------------------------------*/
5006 /* Get Attributes */
5007 /*--------------------------------------------------------------------------*/
5008 for (attr = qs_get_attr(doc,node);
5010 attr = qs_get_next_attr(doc,attr)) {
5011 char *name = qs_get_attr_name(doc,attr);
5012 char *value = qs_get_attr_value(doc,attr);
5013 if (STRCASEEQ('d','D',"direction", name)) {
5014 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
5015 attr_direction = value;
5018 else if (STRCASEEQ('b','B',"behavior",name)) {
5021 else if (STRCASEEQ('l','L',"loop",name)) {
5024 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5028 if (IS_CSS_ON(jhtml->entryp)) {
5029 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
5031 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5032 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5033 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5034 css_property_t *cur;
5035 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5036 if (cur->value && *cur->value) {
5037 attr_color = apr_pstrdup(doc->pool, cur->value);
5040 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5041 if (cur->value && *cur->value) {
5042 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5043 attr_size = apr_pstrdup(doc->pool, "1");
5045 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5046 attr_size = apr_pstrdup(doc->pool, "2");
5048 else if (STRCASEEQ('s','S',"small",cur->value)) {
5049 attr_size = apr_pstrdup(doc->pool, "3");
5051 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5052 attr_size = apr_pstrdup(doc->pool, "4");
5054 else if (STRCASEEQ('l','L',"large",cur->value)) {
5055 attr_size = apr_pstrdup(doc->pool, "5");
5057 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5058 attr_size = apr_pstrdup(doc->pool, "6");
5060 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5061 attr_size = apr_pstrdup(doc->pool, "7");
5065 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5066 if (cur->value && *cur->value) {
5067 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5068 attr_direction = "right";
5070 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5071 attr_direction = "left";
5078 if (attr_direction) {
5079 W_L(" direction=\"");
5080 W_V(attr_direction);
5085 jhtml_flags_t *flg = (jhtml_flags_t *)apr_palloc(doc->pool, sizeof(jhtml_flags_t));
5086 memset(flg, 0, sizeof(*flg));
5087 if (attr_color || attr_size) {
5090 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5101 flg->with_font_flag = 1;
5103 node->userData = (void *)flg;
5109 * It is a handler who processes the MARQUEE tag.
5111 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5112 * destination is specified.
5113 * @param node [i] The MARQUEE tag node is specified.
5114 * @return The conversion result is returned.
5117 s_jhtml_end_marquee_tag(void *pdoc, Node *node)
5119 jhtml_t *jhtml = GET_JHTML(pdoc);
5120 Doc *doc = jhtml->doc;
5122 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5123 if (flg && flg->with_font_flag) {
5127 if (IS_CSS_ON(jhtml->entryp)) {
5128 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5135 * It is handler who processes the New Line Code.
5138 s_jhtml_newline_mark(void *pdoc, Node *UNUSED(node))
5140 jhtml_t *jhtml = GET_JHTML(pdoc);
5141 Doc *doc = jhtml->doc;
5148 * It is a handler who processes the LINK tag.
5150 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5151 * destination is specified.
5152 * @param node [i] The LINK tag node is specified.
5153 * @return The conversion result is returned.
5156 s_jhtml_link_tag(void *pdoc, Node *node)
5165 jhtml = GET_JHTML(pdoc);
5168 if (! IS_CSS_ON(jhtml->entryp)) {
5172 for (attr = qs_get_attr(doc,node);
5174 attr = qs_get_next_attr(doc,attr)) {
5175 char *name = qs_get_attr_name(doc,attr);
5176 char *value = qs_get_attr_value(doc,attr);
5177 if (STRCASEEQ('r','R',"rel", name)) {
5178 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5182 else if (STRCASEEQ('h','H',"href", name)) {
5183 if (value && *value) {
5187 else if (STRCASEEQ('t','T',"type", name)) {
5188 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5194 if (rel && href && type) {
5195 DBG(doc->r, "start load CSS. url:[%s]", href);
5196 jhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jhtml->style, href);
5197 DBG(doc->r, "end load CSS. url:[%s]", href);
5204 static css_prop_list_t *
5205 s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5207 jhtml_t *jhtml = GET_JHTML(pdoc);
5208 Doc *doc = jhtml->doc;
5209 css_prop_list_t *last_css = NULL;
5210 if (IS_CSS_ON(jhtml->entryp)) {
5211 css_prop_list_t *dup_css;
5212 css_selector_t *selector;
5214 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5215 dup_css = chxj_dup_css_prop_list(doc, last_css);
5216 selector = chxj_css_find_selector(doc, jhtml->style, node);
5218 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5220 chxj_css_push_prop_list(jhtml->css_prop_stack, dup_css);
5221 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5223 if (style_attr_value) {
5224 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));
5226 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5234 static css_prop_list_t *
5235 s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5237 jhtml_t *jhtml = GET_JHTML(pdoc);
5238 Doc *doc = jhtml->doc;
5239 css_prop_list_t *last_css = NULL;
5240 if (IS_CSS_ON(jhtml->entryp)) {
5241 css_prop_list_t *dup_css;
5242 css_selector_t *selector;
5244 last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
5245 dup_css = chxj_dup_css_prop_list(doc, last_css);
5246 selector = chxj_css_find_selector(doc, jhtml->style, node);
5248 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5252 if (style_attr_value) {
5253 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));
5255 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5264 * It is a handler who processes the SPAN tag.
5266 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5267 * destination is specified.
5268 * @param node [i] The SPAN tag node is specified.
5269 * @return The conversion result is returned.
5272 s_jhtml_start_span_tag(void *pdoc, Node *node)
5277 char *attr_style = NULL;
5278 char *attr_color = NULL;
5279 char *attr_size = NULL;
5280 char *attr_align = NULL;
5281 char *attr_blink = NULL;
5282 char *attr_marquee = NULL;
5283 char *attr_marquee_dir = NULL;
5284 char *attr_marquee_style = NULL;
5285 char *attr_marquee_loop = NULL;
5287 jhtml = GET_JHTML(pdoc);
5290 for (attr = qs_get_attr(doc,node);
5292 attr = qs_get_next_attr(doc,attr)) {
5293 char *nm = qs_get_attr_name(doc,attr);
5294 char *val = qs_get_attr_value(doc,attr);
5295 if (val && STRCASEEQ('s','S',"style", nm)) {
5299 if (IS_CSS_ON(jhtml->entryp)) {
5300 css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
5302 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5303 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5304 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5305 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5306 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5307 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5308 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5309 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5310 css_property_t *cur;
5311 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5312 attr_color = apr_pstrdup(doc->pool, cur->value);
5314 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5315 if (cur->value && *cur->value) {
5316 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5317 attr_size = apr_pstrdup(doc->pool, "1");
5319 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5320 attr_size = apr_pstrdup(doc->pool, "2");
5322 else if (STRCASEEQ('s','S',"small",cur->value)) {
5323 attr_size = apr_pstrdup(doc->pool, "3");
5325 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5326 attr_size = apr_pstrdup(doc->pool, "4");
5328 else if (STRCASEEQ('l','L',"large",cur->value)) {
5329 attr_size = apr_pstrdup(doc->pool, "5");
5331 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5332 attr_size = apr_pstrdup(doc->pool, "6");
5334 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5335 attr_size = apr_pstrdup(doc->pool, "7");
5339 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5340 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5341 attr_blink = apr_pstrdup(doc->pool, cur->value);
5344 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5345 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5346 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5349 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5350 if (cur->value && *cur->value) {
5351 if (STRCASEEQ('l','L',"ltr",cur->value)) {
5352 attr_marquee_dir = "right";
5354 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
5355 attr_marquee_dir = "left";
5359 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5360 if (cur->value && *cur->value) {
5361 if ( STRCASEEQ('s','S',"scroll",cur->value)
5362 || STRCASEEQ('s','S',"slide",cur->value)
5363 || STRCASEEQ('a','A',"alternate",cur->value)) {
5364 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5368 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5369 if (cur->value && *cur->value) {
5370 if (STRCASEEQ('i','I',"infinite",cur->value)) {
5371 attr_marquee_loop = "16";
5374 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5378 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5379 if (STRCASEEQ('l','L',"left", cur->value)) {
5380 attr_align = apr_pstrdup(doc->pool, "left");
5382 else if (STRCASEEQ('c','C',"center",cur->value)) {
5383 attr_align = apr_pstrdup(doc->pool, "center");
5385 else if (STRCASEEQ('r','R',"right",cur->value)) {
5386 attr_align = apr_pstrdup(doc->pool, "right");
5391 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5392 jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
5393 memset(flg, 0, sizeof(*flg));
5396 flg->with_blink_flag = 1;
5400 if (attr_marquee_dir) {
5401 W_L(" direction=\"");
5402 W_V(attr_marquee_dir);
5405 if (attr_marquee_style) {
5406 W_L(" behavior=\"");
5407 W_V(attr_marquee_style);
5410 if (attr_marquee_loop) {
5412 W_V(attr_marquee_loop);
5416 flg->with_marquee_flag = 1;
5418 if (attr_color||attr_size) {
5421 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5432 flg->with_font_flag = 1;
5435 W_L("<div align=\"");
5438 flg->with_div_flag = 1;
5440 node->userData = flg;
5443 node->userData = NULL;
5450 * It is a handler who processes the SPAN tag.
5452 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5453 * destination is specified.
5454 * @param node [i] The SPAN tag node is specified.
5455 * @return The conversion result is returned.
5458 s_jhtml_end_span_tag(void *pdoc, Node *node)
5460 jhtml_t *jhtml = GET_JHTML(pdoc);
5461 Doc *doc = jhtml->doc;
5463 jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
5464 if (flg && flg->with_div_flag) {
5467 if (flg && flg->with_font_flag) {
5470 if (flg && flg->with_marquee_flag) {
5473 if (flg && flg->with_blink_flag) {
5476 if (IS_CSS_ON(jhtml->entryp)) {
5477 chxj_css_pop_prop_list(jhtml->css_prop_stack);
5484 * It is a handler who processes the STYLE tag.
5486 * @param pdoc [i/o] The pointer to the JHTML structure at the output
5487 * destination is specified.
5488 * @param node [i] The STYLE tag node is specified.
5489 * @return The conversion result is returned.
5492 s_jhtml_style_tag(void *pdoc, Node *node)
5499 jhtml = GET_JHTML(pdoc);
5502 if (! IS_CSS_ON(jhtml->entryp)) {
5506 for (attr = qs_get_attr(doc,node);
5508 attr = qs_get_next_attr(doc,attr)) {
5509 char *name = qs_get_attr_name(doc,attr);
5510 char *value = qs_get_attr_value(doc,attr);
5511 if (STRCASEEQ('t','T',"type", name)) {
5512 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5518 Node *child = qs_get_child_node(doc, node);
5519 if (type && child) {
5520 char *name = qs_get_node_name(doc, child);
5521 if (STRCASEEQ('t','T',"text", name)) {
5522 char *value = qs_get_node_value(doc, child);
5523 DBG(doc->r, "start load CSS. buf:[%s]", value);
5524 jhtml->style = chxj_css_parse_style_value(doc, jhtml->style, value);
5525 DBG(doc->r, "end load CSS. value:[%s]", value);