2 * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_conv_z2h.h"
29 #define GET_XHTML(X) ((xhtml_t*)(X))
32 #define W_L(X) do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X) do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X)) \
34 : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
36 #define W_NLCODE() do { char *nlcode = TO_NLCODE(xhtml->conf); W_V(nlcode); } while (0)
38 static char *s_xhtml_1_0_start_html_tag (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_html_tag (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_p_tag (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_p_tag (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_pre_tag (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_pre_tag (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_ul_tag (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_ul_tag (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h1_tag (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h1_tag (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h2_tag (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h2_tag (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h3_tag (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h3_tag (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h4_tag (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h4_tag (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_h5_tag (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_h5_tag (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_h6_tag (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_h6_tag (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_ol_tag (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_ol_tag (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_li_tag (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_li_tag (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_meta_tag (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_meta_tag (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_head_tag (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_head_tag (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_title_tag (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_title_tag (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_base_tag (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_base_tag (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_body_tag (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_body_tag (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_a_tag (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_a_tag (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_br_tag (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_br_tag (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_tr_tag (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_end_tr_tag (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_start_font_tag (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_end_font_tag (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_start_form_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_end_form_tag (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_start_input_tag (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_end_input_tag (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_end_center_tag (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_start_hr_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_end_hr_tag (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_start_img_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_end_img_tag (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_end_select_tag (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_end_option_tag (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_start_div_tag (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_end_div_tag (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_start_textarea_tag (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_end_textarea_tag (void *pdoc, Node *node);
98 static char *s_xhtml_1_0_start_b_tag (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_end_b_tag (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_chxjif_tag (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_start_blockquote_tag (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_end_blockquote_tag (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_start_dir_tag (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_end_dir_tag (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_start_dl_tag (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_end_dl_tag (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_start_dt_tag (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_end_dt_tag (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_start_dd_tag (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_end_dd_tag (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_start_menu_tag (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_end_menu_tag (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_start_plaintext_tag (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_end_plaintext_tag (void *pdoc, Node *node);
116 static char *s_xhtml_1_0_start_blink_tag (void *pdoc, Node *node);
117 static char *s_xhtml_1_0_end_blink_tag (void *pdoc, Node *node);
118 static char *s_xhtml_1_0_start_marquee_tag (void *pdoc, Node *node);
119 static char *s_xhtml_1_0_end_marquee_tag (void *pdoc, Node *node);
120 static char *s_xhtml_1_0_newline_mark (void *pdoc, Node *node);
121 static char *s_xhtml_1_0_link_tag (void *pdoc, Node *node);
122 static char *s_xhtml_1_0_start_span_tag (void *pdoc, Node *node);
123 static char *s_xhtml_1_0_end_span_tag (void *pdoc, Node *node);
124 static char *s_xhtml_1_0_style_tag (void *pdoc, Node *node);
126 static void s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
127 static int s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
128 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
129 static css_prop_list_t *s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
130 static css_prop_list_t *s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
134 tag_handler xhtml_handler[] = {
137 s_xhtml_1_0_start_html_tag,
138 s_xhtml_1_0_end_html_tag,
142 s_xhtml_1_0_start_meta_tag,
143 s_xhtml_1_0_end_meta_tag,
147 s_xhtml_1_0_start_textarea_tag,
148 s_xhtml_1_0_end_textarea_tag,
152 s_xhtml_1_0_start_p_tag,
153 s_xhtml_1_0_end_p_tag,
157 s_xhtml_1_0_start_pre_tag,
158 s_xhtml_1_0_end_pre_tag,
162 s_xhtml_1_0_start_ul_tag,
163 s_xhtml_1_0_end_ul_tag,
167 s_xhtml_1_0_start_li_tag,
168 s_xhtml_1_0_end_li_tag,
172 s_xhtml_1_0_start_ol_tag,
173 s_xhtml_1_0_end_ol_tag,
177 s_xhtml_1_0_start_h1_tag,
178 s_xhtml_1_0_end_h1_tag,
182 s_xhtml_1_0_start_h2_tag,
183 s_xhtml_1_0_end_h2_tag,
187 s_xhtml_1_0_start_h3_tag,
188 s_xhtml_1_0_end_h3_tag,
192 s_xhtml_1_0_start_h4_tag,
193 s_xhtml_1_0_end_h4_tag,
197 s_xhtml_1_0_start_h5_tag,
198 s_xhtml_1_0_end_h5_tag,
202 s_xhtml_1_0_start_h6_tag,
203 s_xhtml_1_0_end_h6_tag,
207 s_xhtml_1_0_start_head_tag,
208 s_xhtml_1_0_end_head_tag,
212 s_xhtml_1_0_start_title_tag,
213 s_xhtml_1_0_end_title_tag,
217 s_xhtml_1_0_start_base_tag,
218 s_xhtml_1_0_end_base_tag,
222 s_xhtml_1_0_start_body_tag,
223 s_xhtml_1_0_end_body_tag,
227 s_xhtml_1_0_start_a_tag,
228 s_xhtml_1_0_end_a_tag,
232 s_xhtml_1_0_start_br_tag,
233 s_xhtml_1_0_end_br_tag,
242 s_xhtml_1_0_start_tr_tag,
243 s_xhtml_1_0_end_tr_tag,
257 s_xhtml_1_0_start_font_tag,
258 s_xhtml_1_0_end_font_tag,
262 s_xhtml_1_0_start_form_tag,
263 s_xhtml_1_0_end_form_tag,
267 s_xhtml_1_0_start_input_tag,
268 s_xhtml_1_0_end_input_tag,
272 s_xhtml_1_0_start_center_tag,
273 s_xhtml_1_0_end_center_tag,
277 s_xhtml_1_0_start_hr_tag,
278 s_xhtml_1_0_end_hr_tag,
282 s_xhtml_1_0_start_img_tag,
283 s_xhtml_1_0_end_img_tag,
287 s_xhtml_1_0_start_select_tag,
288 s_xhtml_1_0_end_select_tag,
292 s_xhtml_1_0_start_option_tag,
293 s_xhtml_1_0_end_option_tag,
297 s_xhtml_1_0_start_div_tag,
298 s_xhtml_1_0_end_div_tag,
302 s_xhtml_1_0_chxjif_tag,
317 s_xhtml_1_0_style_tag,
322 s_xhtml_1_0_start_span_tag,
323 s_xhtml_1_0_end_span_tag,
327 s_xhtml_1_0_text_tag,
337 s_xhtml_1_0_start_b_tag,
338 s_xhtml_1_0_end_b_tag,
347 s_xhtml_1_0_start_dt_tag,
348 s_xhtml_1_0_end_dt_tag,
362 s_xhtml_1_0_start_blockquote_tag,
363 s_xhtml_1_0_end_blockquote_tag,
367 s_xhtml_1_0_start_dir_tag,
368 s_xhtml_1_0_end_dir_tag,
372 s_xhtml_1_0_start_dl_tag,
373 s_xhtml_1_0_end_dl_tag,
377 s_xhtml_1_0_start_dd_tag,
378 s_xhtml_1_0_end_dd_tag,
382 s_xhtml_1_0_start_menu_tag,
383 s_xhtml_1_0_end_menu_tag,
387 s_xhtml_1_0_start_plaintext_tag,
388 s_xhtml_1_0_end_plaintext_tag,
392 s_xhtml_1_0_start_blink_tag,
393 s_xhtml_1_0_end_blink_tag,
397 s_xhtml_1_0_start_marquee_tag,
398 s_xhtml_1_0_end_marquee_tag,
402 s_xhtml_1_0_link_tag,
407 s_xhtml_1_0_newline_mark,
413 * converts from CHTML to XHTML.
415 * @param r [i] Requet_rec is appointed.
416 * @param spec [i] The result of the device specification processing which
417 * was done in advance is appointed.
418 * @param src [i] The character string before the converting is appointed.
419 * @return The character string after the converting is returned.
422 chxj_convert_xhtml_mobile_1_0(
428 chxjconvrule_entry *entryp,
437 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
438 /*--------------------------------------------------------------------------*/
440 /*--------------------------------------------------------------------------*/
442 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
444 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
448 /*--------------------------------------------------------------------------*/
449 /* The XHTML structure is initialized. */
450 /*--------------------------------------------------------------------------*/
451 s_init_xhtml(&xhtml, &doc, r, spec);
453 xhtml.entryp = entryp;
454 xhtml.cookie = cookie;
456 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
458 /*--------------------------------------------------------------------------*/
459 /* The character string of the input is analyzed. */
460 /*--------------------------------------------------------------------------*/
461 qs_init_malloc(&doc);
462 qs_init_root_node(&doc);
464 ss = apr_pcalloc(r->pool, srclen + 1);
465 memset(ss, 0, srclen + 1);
466 memcpy(ss, src, srclen);
468 if (IS_CSS_ON(xhtml.entryp)) {
469 /* current property list */
470 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
473 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
475 qs_parse_string(&doc,ss, strlen(ss));
477 chxj_buffered_write_init(r->pool, &doc.buf);
478 /*--------------------------------------------------------------------------*/
479 /* It converts it from CHTML to XHTML. */
480 /*--------------------------------------------------------------------------*/
481 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
482 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
483 dst = apr_pstrdup(r->pool, xhtml.out);
484 chxj_buffered_write_terminate(&doc.buf);
486 qs_all_free(&doc,QX_LOGMARK);
489 return apr_pstrdup(r->pool,ss);
493 dst = apr_psprintf(r->pool, "\n");
495 *dstlen = strlen(dst);
498 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
501 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
507 * The XHTML structure is initialized.
509 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
510 * initialized is specified.
511 * @param doc [i] The Doc structure that should be set to the initialized
512 * HDML structure is specified.
513 * @param r [i] To use POOL, the pointer to request_rec is specified.
514 * @param spec [i] The pointer to the device_table
517 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
519 memset(doc, 0, sizeof(Doc));
520 memset(xhtml, 0, sizeof(xhtml_t));
525 xhtml->out = qs_alloc_zero_byte_string(r->pool);
526 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
527 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
532 * Corresponding EMOJI to a current character-code is retrieved.
533 * The substitution character string is stored in the rslt pointer if agreeing.
535 * @param xhtml [i] The pointer to the XHTML structure is specified.
536 * @param txt [i] The character string to want to examine whether it is
537 * EMOJI is specified.
538 * @param rslt [o] The pointer to the pointer that stores the result is
540 * @return When corresponding EMOJI exists, it returns it excluding 0.
543 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
556 DBG(r,"spec is NULL");
559 for (ee = xhtml->conf->emoji;
562 unsigned char hex1byte;
563 unsigned char hex2byte;
565 DBG(r,"emoji->imode is NULL");
569 if (ee->imode->string != NULL
570 && strlen(ee->imode->string) > 0
571 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
572 if (spec == NULL || spec->emoji_type == NULL) {
573 *rslt = apr_psprintf(r->pool,
576 return strlen(ee->imode->string);
579 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
580 *rslt = apr_psprintf(r->pool,
583 return strlen(ee->imode->string);
586 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
587 *rslt = apr_psprintf(r->pool,
590 return strlen(ee->imode->string);
593 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
594 *rslt = apr_psprintf(r->pool,
597 return strlen(ee->imode->string);
600 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
601 *rslt = apr_psprintf(r->pool,
604 return strlen(ee->imode->string);
607 *rslt = apr_psprintf(r->pool,
610 return strlen(ee->imode->string);
614 hex1byte = ee->imode->hex1byte & 0xff;
615 hex2byte = ee->imode->hex2byte & 0xff;
617 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
618 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
619 if (spec == NULL || spec->emoji_type == NULL) {
620 *rslt = apr_psprintf(r->pool,
621 "<img localsrc=\"%s\">",
626 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
627 *rslt = apr_psprintf(r->pool,
628 "<img localsrc=\"%s\">",
633 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
634 *rslt = apr_psprintf(r->pool,
635 "<img localsrc=\"%s\">",
640 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
641 *rslt = apr_psprintf(r->pool,
642 "<img localsrc=\"%s\">",
647 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
648 *rslt = apr_psprintf(r->pool,
649 "<img localsrc=\"%s\">",
654 *rslt = apr_psprintf(r->pool,
655 "<img localsrc=\"%s\">",
667 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
681 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
682 memset(doc, 0, sizeof(Doc));
683 memset(xhtml, 0, sizeof(xhtml_t));
688 xhtml->out = qs_alloc_zero_byte_string(r->pool);
689 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
690 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
692 apr_pool_create(&pool, r->pool);
694 chxj_buffered_write_init(pool, &doc->buf);
696 for (ii=0; ii<len; ii++) {
700 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
707 if (is_sjis_kanji(src[ii])) {
708 two_byte[0] = src[ii+0];
709 two_byte[1] = src[ii+1];
715 one_byte[0] = src[ii+0];
720 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
722 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
728 * It is a handler who processes the HTML tag.
730 * @param pdoc [i/o] The pointer to the XHTML structure at the output
731 * destination is specified.
732 * @param node [i] The HTML tag node is specified.
733 * @return The conversion result is returned.
736 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
738 xhtml_t *xhtml = GET_XHTML(pdoc);
739 Doc *doc = xhtml->doc;
741 /*--------------------------------------------------------------------------*/
742 /* Add XML Declare */
743 /*--------------------------------------------------------------------------*/
744 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
746 /*--------------------------------------------------------------------------*/
748 /*--------------------------------------------------------------------------*/
749 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
751 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
753 /*--------------------------------------------------------------------------*/
755 /*--------------------------------------------------------------------------*/
756 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
758 xhtml->start_html_flag = 1;
764 * It is a handler who processes the HTML tag.
766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
767 * destination is specified.
768 * @param node [i] The HTML tag node is specified.
769 * @return The conversion result is returned.
772 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
774 xhtml_t *xhtml = GET_XHTML(pdoc);
775 Doc *doc = xhtml->doc;
782 * It is a handler who processes the META tag.
784 * @param pdoc [i/o] The pointer to the XHTML structure at the output
785 * destination is specified.
786 * @param node [i] The META tag node is specified.
787 * @return The conversion result is returned.
790 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
792 xhtml_t *xhtml = GET_XHTML(pdoc);
794 Doc *doc = xhtml->doc;
795 int content_type_flag = 0;
796 request_rec *r = doc->r;
799 /*--------------------------------------------------------------------------*/
801 /*--------------------------------------------------------------------------*/
802 for (attr = qs_get_attr(doc,node);
804 attr = qs_get_next_attr(doc,attr)) {
805 char *name = qs_get_attr_name(doc,attr);
806 char *value = qs_get_attr_value(doc,attr);
807 if (STRCASEEQ('n','N',"name", name) && value && *value) {
814 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
820 if (STRCASEEQ('c','C', "content-type", value)) {
821 content_type_flag = 1;
824 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
825 if (content_type_flag) {
829 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
847 * It is a handler who processes the META tag.
849 * @param pdoc [i/o] The pointer to the XHTML structure at the output
850 * destination is specified.
851 * @param node [i] The META tag node is specified.
852 * @return The conversion result is returned.
855 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
857 xhtml_t *xhtml = GET_XHTML(pdoc);
864 * It is a handler who processes the HEAD tag.
866 * @param pdoc [i/o] The pointer to the XHTML structure at the output
867 * destination is specified.
868 * @param node [i] The HEAD tag node is specified.
869 * @return The conversion result is returned.
872 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
874 xhtml_t *xhtml = GET_XHTML(pdoc);
875 Doc *doc = xhtml->doc;
883 * It is a handler who processes the HEAD tag.
885 * @param pdoc [i/o] The pointer to the XHTML structure at the output
886 * destination is specified.
887 * @param node [i] The HEAD tag node is specified.
888 * @return The conversion result is returned.
891 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
893 xhtml_t *xhtml = GET_XHTML(pdoc);
894 Doc *doc = xhtml->doc;
902 * It is a handler who processes the TITLE tag.
904 * @param pdoc [i/o] The pointer to the XHTML structure at the output
905 * destination is specified.
906 * @param node [i] The TITLE tag node is specified.
907 * @return The conversion result is returned.
910 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
912 xhtml_t *xhtml = GET_XHTML(pdoc);
913 Doc *doc = xhtml->doc;
921 * It is a handler who processes the TITLE tag.
923 * @param pdoc [i/o] The pointer to the XHTML structure at the output
924 * destination is specified.
925 * @param node [i] The TITLE tag node is specified.
926 * @return The conversion result is returned.
929 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
931 xhtml_t *xhtml = GET_XHTML(pdoc);
932 Doc *doc = xhtml->doc;
941 * It is a handler who processes the BASE tag.
943 * @param pdoc [i/o] The pointer to the XHTML structure at the output
944 * destination is specified.
945 * @param node [i] The BASE tag node is specified.
946 * @return The conversion result is returned.
949 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
951 xhtml_t *xhtml = GET_XHTML(pdoc);
953 Doc *doc = xhtml->doc;
956 /*--------------------------------------------------------------------------*/
958 /*--------------------------------------------------------------------------*/
959 for (attr = qs_get_attr(doc,node);
961 attr = qs_get_next_attr(doc,attr)) {
962 char *name = qs_get_attr_name(doc,attr);
963 char *value = qs_get_attr_value(doc,attr);
964 if (STRCASEEQ('h','H',"href",name)) {
978 * It is a handler who processes the BASE tag.
980 * @param pdoc [i/o] The pointer to the XHTML structure at the output
981 * destination is specified.
982 * @param node [i] The BASE tag node is specified.
983 * @return The conversion result is returned.
986 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
988 xhtml_t *xhtml = GET_XHTML(pdoc);
995 * It is a handler who processes the BODY tag.
997 * @param pdoc [i/o] The pointer to the XHTML structure at the output
998 * destination is specified.
999 * @param node [i] The BODY tag node is specified.
1000 * @return The conversion result is returned.
1003 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1005 xhtml_t *xhtml = GET_XHTML(pdoc);
1006 Doc *doc = xhtml->doc;
1008 char *attr_bgcolor = NULL;
1009 char *attr_text = NULL;
1010 char *attr_link = NULL;
1011 char *attr_style = NULL;
1013 /*--------------------------------------------------------------------------*/
1014 /* Get Attributes */
1015 /*--------------------------------------------------------------------------*/
1016 for (attr = qs_get_attr(doc,node);
1018 attr = qs_get_next_attr(doc,attr)) {
1019 char *name = qs_get_attr_name(doc,attr);
1020 char *value = qs_get_attr_value(doc,attr);
1021 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1022 attr_bgcolor = value;
1024 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1027 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1030 else if (STRCASEEQ('a','A',"alink", name)) {
1033 else if (STRCASEEQ('v','V',"vlink",name)) {
1036 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1041 if (IS_CSS_ON(xhtml->entryp)) {
1042 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1044 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1045 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1046 css_property_t *cur;
1047 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1048 if (cur->value && *cur->value) {
1049 attr_text = apr_pstrdup(doc->pool, cur->value);
1052 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1053 if (cur->value && *cur->value) {
1054 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1059 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1060 css_selector_t *cur_sel;
1061 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1062 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1063 css_property_t *cur;
1064 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1065 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1066 attr_link = apr_pstrdup(doc->pool, cur->value);
1075 if (attr_bgcolor || attr_text) {
1078 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1079 W_L("background-color:");
1084 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1092 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1104 * It is a handler who processes the BODY tag.
1106 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1107 * destination is specified.
1108 * @param node [i] The BODY tag node is specified.
1109 * @return The conversion result is returned.
1112 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1114 xhtml_t *xhtml = GET_XHTML(pdoc);
1115 Doc *doc = xhtml->doc;
1118 if (IS_CSS_ON(xhtml->entryp)) {
1119 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1127 * It is a handler who processes the A tag.
1129 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1130 * destination is specified.
1131 * @param node [i] The A tag node is specified.
1132 * @return The conversion result is returned.
1135 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1137 xhtml_t *xhtml = GET_XHTML(pdoc);
1138 Doc *doc = xhtml->doc;
1139 request_rec *r = doc->r;
1141 char *attr_style = NULL;
1144 /*--------------------------------------------------------------------------*/
1145 /* Get Attributes */
1146 /*--------------------------------------------------------------------------*/
1147 for (attr = qs_get_attr(doc,node);
1149 attr = qs_get_next_attr(doc,attr)) {
1150 char* name = qs_get_attr_name(doc,attr);
1151 char* value = qs_get_attr_value(doc,attr);
1152 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1157 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1158 value = chxj_encoding_parameter(r, value, 1);
1159 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1160 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1166 else if (STRCASEEQ('a','A',"accesskey", name)) {
1167 W_L(" accesskey=\"");
1171 else if (STRCASEEQ('c','C',"cti",name)) {
1174 else if (STRCASEEQ('i','I',"ijam", name)) {
1177 else if (STRCASEEQ('u','U',"utn", name)) {
1180 else if (STRCASEEQ('t','T',"telbook",name)) {
1183 else if (STRCASEEQ('k','K',"kana",name)) {
1186 else if (STRCASEEQ('e','E',"email",name)) {
1189 else if (STRCASEEQ('i','I',"ista",name)) {
1192 else if (STRCASEEQ('i','I',"ilet",name)) {
1195 else if (STRCASEEQ('i','I',"iswf",name)) {
1198 else if (STRCASEEQ('i','I',"irst",name)) {
1201 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1207 if (IS_CSS_ON(xhtml->entryp)) {
1208 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1216 * It is a handler who processes the A tag.
1218 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1219 * destination is specified.
1220 * @param node [i] The A tag node is specified.
1221 * @return The conversion result is returned.
1224 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1226 xhtml_t *xhtml = GET_XHTML(pdoc);
1227 Doc *doc = xhtml->doc;
1231 if (IS_CSS_ON(xhtml->entryp)) {
1232 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1240 * It is a handler who processes the BR tag.
1242 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1243 * destination is specified.
1244 * @param node [i] The BR tag node is specified.
1245 * @return The conversion result is returned.
1248 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1250 xhtml_t *xhtml = GET_XHTML(pdoc);
1251 Doc *doc = xhtml->doc;
1255 /*--------------------------------------------------------------------------*/
1256 /* Get Attributes */
1257 /*--------------------------------------------------------------------------*/
1258 for (attr = qs_get_attr(doc,node);
1260 attr = qs_get_next_attr(doc,attr)) {
1261 char *name = qs_get_attr_name(doc,attr);
1262 char *value = qs_get_attr_value(doc,attr);
1263 if (STRCASEEQ('c','C',"clear",name)) {
1264 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1278 * It is a handler who processes the BR tag.
1280 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1281 * destination is specified.
1282 * @param node [i] The BR tag node is specified.
1283 * @return The conversion result is returned.
1286 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1288 xhtml_t *xhtml = GET_XHTML(pdoc);
1295 * It is a handler who processes the TR tag.
1297 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1298 * destination is specified.
1299 * @param node [i] The TR tag node is specified.
1300 * @return The conversion result is returned.
1303 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1305 xhtml_t *xhtml = GET_XHTML(pdoc);
1306 Doc *doc = xhtml->doc;
1315 * It is a handler who processes the TR tag.
1317 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1318 * destination is specified.
1319 * @param node [i] The TR tag node is specified.
1320 * @return The conversion result is returned.
1323 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1325 xhtml_t *xhtml = GET_XHTML(pdoc);
1332 * It is a handler who processes the FONT tag.
1334 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1335 * destination is specified.
1336 * @param node [i] The FONT tag node is specified.
1337 * @return The conversion result is returned.
1340 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1342 xhtml_t *xhtml = GET_XHTML(pdoc);
1343 Doc *doc = xhtml->doc;
1345 char *attr_color = NULL;
1346 char *attr_size = NULL;
1347 char *attr_style = NULL;
1349 /*--------------------------------------------------------------------------*/
1350 /* Get Attributes */
1351 /*--------------------------------------------------------------------------*/
1352 for (attr = qs_get_attr(doc,node);
1354 attr = qs_get_next_attr(doc,attr)) {
1355 char *name = qs_get_attr_name(doc,attr);
1356 char *value = qs_get_attr_value(doc,attr);
1357 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1358 attr_color = apr_pstrdup(doc->buf.pool, value);
1360 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1361 /*----------------------------------------------------------------------*/
1363 /*----------------------------------------------------------------------*/
1364 attr_size = apr_pstrdup(doc->buf.pool, value);
1366 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1367 attr_style = apr_pstrdup(doc->buf.pool, value);
1370 if (IS_CSS_ON(xhtml->entryp)) {
1371 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1373 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1374 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1375 css_property_t *cur;
1376 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1377 if (cur->value && *cur->value) {
1378 attr_color = apr_pstrdup(doc->pool, cur->value);
1381 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1382 if (cur->value && *cur->value) {
1383 attr_size = apr_pstrdup(doc->pool, cur->value);
1384 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1385 attr_size = apr_pstrdup(doc->pool, "1");
1387 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1388 attr_size = apr_pstrdup(doc->pool, "2");
1390 else if (STRCASEEQ('s','S',"small",attr_size)) {
1391 attr_size = apr_pstrdup(doc->pool, "3");
1393 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1394 attr_size = apr_pstrdup(doc->pool, "4");
1396 else if (STRCASEEQ('l','L',"large",attr_size)) {
1397 attr_size = apr_pstrdup(doc->pool, "5");
1399 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1400 attr_size = apr_pstrdup(doc->pool, "6");
1402 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1403 attr_size = apr_pstrdup(doc->pool, "7");
1410 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1411 memset(flg, 0, sizeof(*flg));
1413 W_L("<font color=\"");
1416 flg->font_color_flag = 1;
1419 flg->font_size_flag = 1;
1420 switch(*attr_size) {
1421 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1422 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1423 case '3': W_L("<span style=\"font-size: small\">"); break;
1424 case '4': W_L("<span style=\"font-size: medium\">"); break;
1425 case '5': W_L("<span style=\"font-size: large\">"); break;
1426 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1427 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1429 if (*(attr_size + 1) == '1') {
1430 W_L("<span style=\"font-size: small\">");
1433 if (*(attr_size + 1) == '2') {
1434 W_L("<span style=\"font-size: x-small\">");
1437 if (*(attr_size + 1) == '3') {
1438 W_L("<span style=\"font-size: xx-small\">");
1441 flg->font_size_flag = 0;
1445 if (*(attr_size + 1) == '1') {
1446 W_L("<span style=\"font-size: large\">");
1449 if (*(attr_size + 1) == '2') {
1450 W_L("<span style=\"font-size: x-large\">");
1453 if (*(attr_size + 1) == '3') {
1454 W_L("<span style=\"font-size: xx-large\">");
1457 flg->font_size_flag = 0;
1461 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1462 flg->font_size_flag = 0;
1465 node->userData = flg;
1472 * It is a handler who processes the FONT tag.
1474 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1475 * destination is specified.
1476 * @param node [i] The FONT tag node is specified.
1477 * @return The conversion result is returned.
1480 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
1482 xhtml_t *xhtml = GET_XHTML(pdoc);
1483 Doc *doc = xhtml->doc;
1485 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1486 if (flg && flg->font_size_flag) {
1489 if (flg && flg->font_color_flag) {
1492 if (IS_CSS_ON(xhtml->entryp)) {
1493 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1500 * It is a handler who processes the FORM tag.
1502 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1503 * destination is specified.
1504 * @param node [i] The FORM tag node is specified.
1505 * @return The conversion result is returned.
1508 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1510 xhtml_t *xhtml = GET_XHTML(pdoc);
1511 Doc *doc = xhtml->doc;
1512 request_rec *r = doc->r;
1514 char *attr_action = NULL;
1515 char *attr_method = NULL;
1516 char *attr_style = NULL;
1517 char *attr_color = NULL;
1518 char *attr_align = NULL;
1519 char *attr_name = NULL;
1520 char *new_hidden_tag = NULL;
1522 /*--------------------------------------------------------------------------*/
1523 /* Get Attributes */
1524 /*--------------------------------------------------------------------------*/
1525 for (attr = qs_get_attr(doc,node);
1527 attr = qs_get_next_attr(doc,attr)) {
1528 char *name = qs_get_attr_name(doc,attr);
1529 char *value = qs_get_attr_value(doc,attr);
1533 if (strcasecmp(name, "action") == 0) {
1534 /*--------------------------------------------------------------------*/
1536 /*--------------------------------------------------------------------*/
1537 attr_action = value;
1543 if (strcasecmp(name, "method") == 0) {
1544 /*--------------------------------------------------------------------*/
1546 /*--------------------------------------------------------------------*/
1547 attr_method = value;
1553 if (strcasecmp(name, "name") == 0) {
1554 /*--------------------------------------------------------------------*/
1556 /*--------------------------------------------------------------------*/
1563 if (strcasecmp(name, "style") == 0) {
1572 if (IS_CSS_ON(xhtml->entryp)) {
1573 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1575 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1576 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1577 css_property_t *cur;
1578 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1579 if (STRCASEEQ('l','L',"left", cur->value)) {
1580 attr_align = apr_pstrdup(doc->pool, "left");
1582 else if (STRCASEEQ('c','C',"center",cur->value)) {
1583 attr_align = apr_pstrdup(doc->pool, "center");
1585 else if (STRCASEEQ('r','R',"right",cur->value)) {
1586 attr_align = apr_pstrdup(doc->pool, "right");
1589 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1590 attr_color = apr_pstrdup(doc->pool, cur->value);
1595 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1599 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1600 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1602 char *old_qs = NULL;
1603 q = strchr(attr_action, '?');
1605 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_FALSE, xhtml->entryp);
1606 if (new_hidden_tag || old_qs) {
1630 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
1631 memset(flg, 0, sizeof(*flg));
1633 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1634 W_L("<font color=\"");
1637 flg->with_font_flag = 1;
1640 W_L("<div align=\"");
1643 flg->with_div_flag = 1;
1645 node->userData = flg;
1646 if (new_hidden_tag) {
1647 W_V(new_hidden_tag);
1654 * It is a handler who processes the FORM tag.
1656 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1657 * destination is specified.
1658 * @param node [i] The FORM tag node is specified.
1659 * @return The conversion result is returned.
1662 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
1664 xhtml_t *xhtml = GET_XHTML(pdoc);
1665 Doc *doc = xhtml->doc;
1667 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1668 if (flg && flg->with_div_flag) {
1671 if (flg && flg->with_font_flag) {
1675 if (IS_CSS_ON(xhtml->entryp)) {
1676 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1684 * It is a handler who processes the INPUT tag.
1686 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1687 * destination is specified.
1688 * @param node [i] The INPUT tag node is specified.
1689 * @return The conversion result is returned.
1692 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1694 xhtml_t *xhtml = GET_XHTML(pdoc);
1695 Doc *doc = xhtml->doc;
1696 request_rec *r = doc->r;
1698 char *attr_max_length = NULL;
1699 char *attr_type = NULL;
1700 char *attr_name = NULL;
1701 char *attr_value = NULL;
1702 char *attr_istyle = NULL;
1703 char *attr_size = NULL;
1704 char *attr_checked = NULL;
1705 char *attr_accesskey = NULL;
1706 char *attr_style = NULL;
1708 /*--------------------------------------------------------------------------*/
1709 /* Get Attributes */
1710 /*--------------------------------------------------------------------------*/
1711 for (attr = qs_get_attr(doc,node);
1713 attr = qs_get_next_attr(doc,attr)) {
1714 char *name = qs_get_attr_name(doc,attr);
1715 char *value = qs_get_attr_value(doc,attr);
1716 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1717 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1718 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1719 STRCASEEQ('p','P',"password",tmp_type) ||
1720 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1721 STRCASEEQ('r','R',"radio", tmp_type) ||
1722 STRCASEEQ('h','H',"hidden", tmp_type) ||
1723 STRCASEEQ('s','S',"submit", tmp_type) ||
1724 STRCASEEQ('r','R',"reset", tmp_type))) {
1725 attr_type = tmp_type;
1728 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1731 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1734 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1735 attr_istyle = value;
1737 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1738 attr_max_length = value;
1740 else if (STRCASEEQ('c','C',"checked", name)) {
1741 attr_checked = value;
1743 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1744 attr_accesskey = value;
1746 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1749 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1754 if (IS_CSS_ON(xhtml->entryp)) {
1755 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1757 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1758 css_property_t *cur;
1759 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1760 if (strcasestr(cur->value, "<ja:n>")) {
1763 else if (strcasestr(cur->value, "<ja:en>")) {
1766 else if (strcasestr(cur->value, "<ja:hk>")) {
1769 else if (strcasestr(cur->value, "<ja:h>")) {
1777 attr_type = qs_trim_string(doc->buf.pool, attr_type);
1778 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
1779 STRCASEEQ('p','P',"password",attr_type) ||
1780 STRCASEEQ('c','C',"checkbox",attr_type) ||
1781 STRCASEEQ('r','R',"radio", attr_type) ||
1782 STRCASEEQ('h','H',"hidden", attr_type) ||
1783 STRCASEEQ('s','S',"submit", attr_type) ||
1784 STRCASEEQ('r','R',"reset", attr_type))) {
1790 if (attr_size && *attr_size) {
1795 if (attr_name && *attr_name) {
1800 if (attr_value && *attr_value) {
1802 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1805 if (attr_accesskey && *attr_accesskey) {
1806 W_L(" accesskey=\"");
1807 W_V(attr_accesskey);
1810 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1811 char *fmt = qs_conv_istyle_to_format(r->pool,attr_istyle);
1812 if (attr_max_length && *attr_max_length) {
1814 for (ii=0; (unsigned int)ii<strlen(attr_max_length); ii++) {
1815 if (attr_max_length[ii] < '0' || attr_max_length[ii] > '9') {
1816 attr_max_length = apr_psprintf(r->pool, "0");
1821 if (strcmp(attr_max_length, "0")) {
1822 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(attr_max_length), fmt);
1834 if (attr_max_length && *attr_max_length) {
1835 if (chxj_chk_numeric(attr_max_length) != 0) {
1836 attr_max_length = apr_psprintf(r->pool, "0");
1838 if (strcmp(attr_max_length, "0")) {
1839 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(attr_max_length));
1844 /*--------------------------------------------------------------------------*/
1845 /* The figure is default for the password. */
1846 /*--------------------------------------------------------------------------*/
1847 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
1848 if (attr_max_length) {
1850 W_V(attr_max_length);
1854 W_L(" FORMAT=\"*N\"");
1858 W_L(" checked=\"checked\"");
1863 /*--------------------------------------------------------------------------*/
1864 /* Get Attributes */
1865 /*--------------------------------------------------------------------------*/
1866 type = qs_get_type_attr(doc, node, doc->buf.pool);
1867 name = qs_get_name_attr(doc, node, doc->buf.pool);
1868 value = qs_get_value_attr(doc,node, doc->buf.pool);
1869 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1870 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1871 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1872 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1873 size = qs_get_size_attr(doc, node, doc->buf.pool);
1876 type = qs_trim_string(doc->buf.pool, type);
1877 if (type && (STRCASEEQ('t','T',"text", type) ||
1878 STRCASEEQ('p','P',"password",type) ||
1879 STRCASEEQ('c','C',"checkbox",type) ||
1880 STRCASEEQ('r','R',"radio", type) ||
1881 STRCASEEQ('h','H',"hidden", type) ||
1882 STRCASEEQ('s','S',"submit", type) ||
1883 STRCASEEQ('r','R',"reset", type))) {
1889 if (size && *size) {
1894 if (name && *name) {
1899 if (value && *value) {
1900 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
1901 apr_size_t value_len = strlen(value);
1902 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
1906 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1909 if (accesskey && *accesskey) {
1910 W_L(" accesskey=\"");
1914 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1915 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
1916 if (max_length && *max_length) {
1918 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1919 if (max_length[ii] < '0' || max_length[ii] > '9') {
1920 max_length = apr_psprintf(r->pool, "0");
1925 if (strcmp(max_length, "0")) {
1926 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1938 if (max_length && *max_length) {
1939 if (chxj_chk_numeric(max_length) != 0) {
1940 max_length = apr_psprintf(r->pool, "0");
1942 if (strcmp(max_length, "0")) {
1943 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1948 /*--------------------------------------------------------------------------*/
1949 /* The figure is default for the password. */
1950 /*--------------------------------------------------------------------------*/
1951 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1958 W_L(" FORMAT=\"*N\"");
1962 W_L(" checked=\"checked\"");
1972 * It is a handler who processes the INPUT tag.
1974 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1975 * destination is specified.
1976 * @param node [i] The INPUT tag node is specified.
1977 * @return The conversion result is returned.
1980 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1982 xhtml_t *xhtml = GET_XHTML(pdoc);
1989 * It is a handler who processes the CENTER tag.
1991 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1992 * destination is specified.
1993 * @param node [i] The CENTER tag node is specified.
1994 * @return The conversion result is returned.
1997 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2002 char *attr_style = NULL;
2003 char *attr_color = NULL;
2004 char *attr_size = NULL;
2006 xhtml = GET_XHTML(pdoc);
2009 for (attr = qs_get_attr(doc,node);
2011 attr = qs_get_next_attr(doc,attr)) {
2012 char *name = qs_get_attr_name(doc,attr);
2013 char *value = qs_get_attr_value(doc,attr);
2014 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2018 if (IS_CSS_ON(xhtml->entryp)) {
2019 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2021 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2022 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2023 css_property_t *cur;
2024 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2025 if (cur->value && *cur->value) {
2026 attr_color = apr_pstrdup(doc->pool, cur->value);
2029 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2030 if (cur->value && *cur->value) {
2031 attr_size = apr_pstrdup(doc->pool, cur->value);
2038 if (attr_size || attr_color) {
2046 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2060 * It is a handler who processes the CENTER tag.
2062 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2063 * destination is specified.
2064 * @param node [i] The CENTER tag node is specified.
2065 * @return The conversion result is returned.
2068 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2070 xhtml_t *xhtml = GET_XHTML(pdoc);
2071 Doc *doc = xhtml->doc;
2074 if (IS_CSS_ON(xhtml->entryp)) {
2075 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2082 * It is a handler who processes the HR tag.
2084 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2085 * destination is specified.
2086 * @param node [i] The HR tag node is specified.
2087 * @return The conversion result is returned.
2090 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2096 char *attr_align = NULL;
2097 char *attr_size = NULL;
2098 char *attr_width = NULL;
2099 char *attr_noshade = NULL;
2100 char *attr_style = NULL;
2101 char *attr_color = NULL;
2103 xhtml = GET_XHTML(pdoc);
2107 for (attr = qs_get_attr(doc,node);
2109 attr = qs_get_next_attr(doc,attr)) {
2110 char *name = qs_get_attr_name (doc,attr);
2111 char *value = qs_get_attr_value(doc,attr);
2115 if (strcasecmp(name, "align") == 0) {
2116 /*--------------------------------------------------------------------*/
2118 /*--------------------------------------------------------------------*/
2119 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2127 if (strcasecmp(name, "size") == 0) {
2128 /*--------------------------------------------------------------------*/
2130 /*--------------------------------------------------------------------*/
2131 if (value && *value) {
2135 else if (strcasecmp(name, "style") == 0) {
2136 if (value && *value) {
2144 if (strcasecmp(name, "width") == 0) {
2145 /*--------------------------------------------------------------------*/
2147 /*--------------------------------------------------------------------*/
2148 if (value && *value) {
2156 if (strcasecmp(name, "noshade") == 0) {
2157 /*--------------------------------------------------------------------*/
2159 /*--------------------------------------------------------------------*/
2160 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2166 if (strcasecmp(name, "color") == 0 && value && *value) {
2167 /*--------------------------------------------------------------------*/
2169 /*--------------------------------------------------------------------*/
2178 if (IS_CSS_ON(xhtml->entryp)) {
2179 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2181 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2182 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2183 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2184 css_property_t *cur;
2185 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2186 if (STRCASEEQ('s','S',"solid",cur->value)) {
2187 attr_noshade = "noshade";
2190 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2191 char *tmp = apr_pstrdup(doc->pool, cur->value);
2192 char *tmpp = strstr(tmp, "px");
2194 attr_size = apr_pstrdup(doc->pool, tmp);
2197 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2198 char *tmp = apr_pstrdup(doc->pool, cur->value);
2199 char *tmpp = strstr(tmp, "px");
2201 attr_width = apr_pstrdup(doc->pool, tmp);
2204 tmpp = strstr(tmp, "%");
2206 attr_width = apr_pstrdup(doc->pool, tmp);
2218 if (attr_size || attr_width || attr_noshade) {
2223 if (!strstr(attr_size, "px")) {
2231 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2237 W_L("border-style:solid;");
2253 * It is a handler who processes the HR tag.
2255 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2256 * destination is specified.
2257 * @param node [i] The HR tag node is specified.
2258 * @return The conversion result is returned.
2261 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2263 xhtml_t *xhtml = GET_XHTML(pdoc);
2270 * It is a handler who processes the PRE tag.
2272 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2273 * destination is specified.
2274 * @param node [i] The PRE tag node is specified.
2275 * @return The conversion result is returned.
2278 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2280 xhtml_t *xhtml = GET_XHTML(pdoc);
2281 Doc *doc = xhtml->doc;
2283 char *attr_style = NULL;
2285 for (attr = qs_get_attr(doc,node);
2287 attr = qs_get_next_attr(doc,attr)) {
2288 char *nm = qs_get_attr_name(doc,attr);
2289 char *val = qs_get_attr_value(doc,attr);
2290 if (val && STRCASEEQ('s','S',"style", nm)) {
2295 if (IS_CSS_ON(xhtml->entryp)) {
2296 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2306 * It is a handler who processes the PRE tag.
2308 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2309 * destination is specified.
2310 * @param node [i] The PRE tag node is specified.
2311 * @return The conversion result is returned.
2314 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2316 xhtml_t *xhtml = GET_XHTML(pdoc);
2317 Doc *doc = xhtml->doc;
2321 if (IS_CSS_ON(xhtml->entryp)) {
2322 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2330 * It is a handler who processes the P tag.
2332 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2333 * destination is specified.
2334 * @param node [i] The P tag node is specified.
2335 * @return The conversion result is returned.
2338 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2340 xhtml_t *xhtml = GET_XHTML(pdoc);
2341 Doc *doc = xhtml->doc;
2343 char *attr_align = NULL;
2344 char *attr_style = NULL;
2345 char *attr_color = NULL;
2346 char *attr_blink = NULL;
2348 for (attr = qs_get_attr(doc,node);
2350 attr = qs_get_next_attr(doc,attr)) {
2351 char *nm = qs_get_attr_name(doc,attr);
2352 char *val = qs_get_attr_value(doc,attr);
2353 if (STRCASEEQ('a','A',"align", nm)) {
2354 /*----------------------------------------------------------------------*/
2355 /* CHTML 1.0 (W3C version 3.2) */
2356 /*----------------------------------------------------------------------*/
2357 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2358 attr_align = apr_pstrdup(doc->buf.pool, val);
2362 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2363 attr_style = apr_pstrdup(doc->buf.pool, val);
2366 if (IS_CSS_ON(xhtml->entryp)) {
2367 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2369 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2370 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2371 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2372 css_property_t *cur;
2373 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2374 if (STRCASEEQ('l','L',"left",cur->value)) {
2375 attr_align = apr_pstrdup(doc->pool, "left");
2377 else if (STRCASEEQ('c','C',"center",cur->value)) {
2378 attr_align = apr_pstrdup(doc->pool, "center");
2380 else if (STRCASEEQ('r','R',"right",cur->value)) {
2381 attr_align = apr_pstrdup(doc->pool, "right");
2384 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2385 if (cur->value && *cur->value) {
2386 attr_color = apr_pstrdup(doc->pool, cur->value);
2389 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2390 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2391 attr_blink = apr_pstrdup(doc->pool, cur->value);
2397 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2405 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2411 W_L("text-decoration:");
2423 * It is a handler who processes the P tag.
2425 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2426 * destination is specified.
2427 * @param node [i] The P tag node is specified.
2428 * @return The conversion result is returned.
2431 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
2433 xhtml_t *xhtml = GET_XHTML(pdoc);
2434 Doc *doc = xhtml->doc;
2437 if (IS_CSS_ON(xhtml->entryp)) {
2438 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2445 * It is a handler who processes the UL tag.
2447 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2448 * destination is specified.
2449 * @param node [i] The UL tag node is specified.
2450 * @return The conversion result is returned.
2453 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
2455 xhtml_t *xhtml = GET_XHTML(pdoc);
2456 Doc *doc = xhtml->doc;
2458 char *attr_type = NULL;
2459 char *attr_style = NULL;
2460 /*--------------------------------------------------------------------------*/
2461 /* Get Attributes */
2462 /*--------------------------------------------------------------------------*/
2463 for (attr = qs_get_attr(doc,node);
2465 attr = qs_get_next_attr(doc,attr)) {
2466 char *name = qs_get_attr_name(doc,attr);
2467 char *value = qs_get_attr_value(doc,attr);
2468 if (STRCASEEQ('t','T',"type",name)) {
2469 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2473 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2477 if (IS_CSS_ON(xhtml->entryp)) {
2478 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2480 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2481 css_property_t *cur;
2482 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2483 if (STRCASEEQ('d','D',"disc",cur->value)) {
2484 attr_type = apr_pstrdup(doc->pool, "disc");
2486 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2487 attr_type = apr_pstrdup(doc->pool, "circle");
2489 else if (STRCASEEQ('s','S',"square",cur->value)) {
2490 attr_type = apr_pstrdup(doc->pool, "square");
2498 W_L("list-style-type:");
2509 * It is a handler who processes the UL tag.
2511 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2512 * destination is specified.
2513 * @param node [i] The UL tag node is specified.
2514 * @return The conversion result is returned.
2517 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
2519 xhtml_t *xhtml = GET_XHTML(pdoc);
2520 Doc *doc = xhtml->doc;
2523 if (IS_CSS_ON(xhtml->entryp)) {
2524 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2531 * It is a handler who processes the H1 tag.
2533 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2534 * destination is specified.
2535 * @param node [i] The H1 tag node is specified.
2536 * @return The conversion result is returned.
2539 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
2541 xhtml_t *xhtml = GET_XHTML(pdoc);
2542 Doc *doc = xhtml->doc;
2544 char *attr_style = NULL;
2545 char *attr_align = NULL;
2547 for (attr = qs_get_attr(doc,node);
2549 attr = qs_get_next_attr(doc,attr)) {
2550 char *name = qs_get_attr_name(doc,attr);
2551 char *value = qs_get_attr_value(doc,attr);
2552 if (STRCASEEQ('a','A',"align", name)) {
2553 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2557 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2561 if (IS_CSS_ON(xhtml->entryp)) {
2562 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2564 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2565 css_property_t *cur;
2566 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2567 if (STRCASEEQ('l','L',"left", cur->value)) {
2568 attr_align = apr_pstrdup(doc->pool, "left");
2570 else if (STRCASEEQ('c','C',"center",cur->value)) {
2571 attr_align = apr_pstrdup(doc->pool, "center");
2573 else if (STRCASEEQ('r','R',"right",cur->value)) {
2574 attr_align = apr_pstrdup(doc->pool, "right");
2594 * It is a handler who processes the H1 tag.
2596 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2597 * destination is specified.
2598 * @param node [i] The H1 tag node is specified.
2599 * @return The conversion result is returned.
2602 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
2604 xhtml_t *xhtml = GET_XHTML(pdoc);
2605 Doc *doc = xhtml->doc;
2608 if (IS_CSS_ON(xhtml->entryp)) {
2609 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2616 * It is a handler who processes the H2 tag.
2618 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2619 * destination is specified.
2620 * @param node [i] The H2 tag node is specified.
2621 * @return The conversion result is returned.
2624 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
2626 xhtml_t *xhtml = GET_XHTML(pdoc);
2627 Doc *doc = xhtml->doc;
2629 char *attr_style = NULL;
2630 char *attr_align = NULL;
2632 for (attr = qs_get_attr(doc,node);
2634 attr = qs_get_next_attr(doc,attr)) {
2635 char *name = qs_get_attr_name(doc,attr);
2636 char *value = qs_get_attr_value(doc,attr);
2637 if (STRCASEEQ('a','A',"align", name)) {
2638 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2642 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2646 if (IS_CSS_ON(xhtml->entryp)) {
2647 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2649 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2650 css_property_t *cur;
2651 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2652 if (STRCASEEQ('l','L',"left", cur->value)) {
2653 attr_align = apr_pstrdup(doc->pool, "left");
2655 else if (STRCASEEQ('c','C',"center",cur->value)) {
2656 attr_align = apr_pstrdup(doc->pool, "center");
2658 else if (STRCASEEQ('r','R',"right",cur->value)) {
2659 attr_align = apr_pstrdup(doc->pool, "right");
2679 * It is a handler who processes the H2 tag.
2681 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2682 * destination is specified.
2683 * @param node [i] The H2 tag node is specified.
2684 * @return The conversion result is returned.
2687 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2689 xhtml_t *xhtml = GET_XHTML(pdoc);
2690 Doc *doc = xhtml->doc;
2693 if (IS_CSS_ON(xhtml->entryp)) {
2694 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2701 * It is a handler who processes the H3 tag.
2703 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2704 * destination is specified.
2705 * @param node [i] The H3 tag node is specified.
2706 * @return The conversion result is returned.
2709 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2711 xhtml_t *xhtml = GET_XHTML(pdoc);
2712 Doc *doc = xhtml->doc;
2714 char *attr_style = NULL;
2715 char *attr_align = NULL;
2717 for (attr = qs_get_attr(doc,node);
2719 attr = qs_get_next_attr(doc,attr)) {
2720 char *name = qs_get_attr_name(doc,attr);
2721 char *value = qs_get_attr_value(doc,attr);
2722 if (STRCASEEQ('a','A',"align", name)) {
2723 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2727 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2731 if (IS_CSS_ON(xhtml->entryp)) {
2732 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2734 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2735 css_property_t *cur;
2736 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2737 if (STRCASEEQ('l','L',"left", cur->value)) {
2738 attr_align = apr_pstrdup(doc->pool, "left");
2740 else if (STRCASEEQ('c','C',"center",cur->value)) {
2741 attr_align = apr_pstrdup(doc->pool, "center");
2743 else if (STRCASEEQ('r','R',"right",cur->value)) {
2744 attr_align = apr_pstrdup(doc->pool, "right");
2764 * It is a handler who processes the H3 tag.
2766 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2767 * destination is specified.
2768 * @param node [i] The H3 tag node is specified.
2769 * @return The conversion result is returned.
2772 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2774 xhtml_t *xhtml = GET_XHTML(pdoc);
2775 Doc *doc = xhtml->doc;
2778 if (IS_CSS_ON(xhtml->entryp)) {
2779 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2787 * It is a handler who processes the H4 tag.
2789 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2790 * destination is specified.
2791 * @param node [i] The H4 tag node is specified.
2792 * @return The conversion result is returned.
2795 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2797 xhtml_t *xhtml = GET_XHTML(pdoc);
2798 Doc *doc = xhtml->doc;
2800 char *attr_style = NULL;
2801 char *attr_align = NULL;
2803 for (attr = qs_get_attr(doc,node);
2805 attr = qs_get_next_attr(doc,attr)) {
2806 char *name = qs_get_attr_name(doc,attr);
2807 char *value = qs_get_attr_value(doc,attr);
2808 if (STRCASEEQ('a','A',"align", name)) {
2809 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2813 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2817 if (IS_CSS_ON(xhtml->entryp)) {
2818 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2820 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2821 css_property_t *cur;
2822 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2823 if (STRCASEEQ('l','L',"left", cur->value)) {
2824 attr_align = apr_pstrdup(doc->pool, "left");
2826 else if (STRCASEEQ('c','C',"center",cur->value)) {
2827 attr_align = apr_pstrdup(doc->pool, "center");
2829 else if (STRCASEEQ('r','R',"right",cur->value)) {
2830 attr_align = apr_pstrdup(doc->pool, "right");
2850 * It is a handler who processes the H4 tag.
2852 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2853 * destination is specified.
2854 * @param node [i] The H4 tag node is specified.
2855 * @return The conversion result is returned.
2858 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
2860 xhtml_t *xhtml = GET_XHTML(pdoc);
2861 Doc *doc = xhtml->doc;
2864 if (IS_CSS_ON(xhtml->entryp)) {
2865 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2873 * It is a handler who processes the H5 tag.
2875 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2876 * destination is specified.
2877 * @param node [i] The H5 tag node is specified.
2878 * @return The conversion result is returned.
2881 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
2883 xhtml_t *xhtml = GET_XHTML(pdoc);
2884 Doc *doc = xhtml->doc;
2886 char *attr_style = NULL;
2887 char *attr_align = NULL;
2889 for (attr = qs_get_attr(doc,node);
2891 attr = qs_get_next_attr(doc,attr)) {
2892 char *name = qs_get_attr_name(doc,attr);
2893 char *value = qs_get_attr_value(doc,attr);
2894 if (STRCASEEQ('a','A',"align", name)) {
2895 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2899 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2903 if (IS_CSS_ON(xhtml->entryp)) {
2904 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2906 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2907 css_property_t *cur;
2908 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2909 if (STRCASEEQ('l','L',"left", cur->value)) {
2910 attr_align = apr_pstrdup(doc->pool, "left");
2912 else if (STRCASEEQ('c','C',"center",cur->value)) {
2913 attr_align = apr_pstrdup(doc->pool, "center");
2915 else if (STRCASEEQ('r','R',"right",cur->value)) {
2916 attr_align = apr_pstrdup(doc->pool, "right");
2936 * It is a handler who processes the H5 tag.
2938 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2939 * destination is specified.
2940 * @param node [i] The H5 tag node is specified.
2941 * @return The conversion result is returned.
2944 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2946 xhtml_t *xhtml = GET_XHTML(pdoc);
2947 Doc *doc = xhtml->doc;
2950 if (IS_CSS_ON(xhtml->entryp)) {
2951 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2959 * It is a handler who processes the H6 tag.
2961 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2962 * destination is specified.
2963 * @param node [i] The H6 tag node is specified.
2964 * @return The conversion result is returned.
2967 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2969 xhtml_t *xhtml = GET_XHTML(pdoc);
2970 Doc *doc = xhtml->doc;
2972 char *attr_style = NULL;
2973 char *attr_align = NULL;
2975 for (attr = qs_get_attr(doc,node);
2977 attr = qs_get_next_attr(doc,attr)) {
2978 char *name = qs_get_attr_name(doc,attr);
2979 char *value = qs_get_attr_value(doc,attr);
2980 if (STRCASEEQ('a','A',"align", name)) {
2981 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2985 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2989 if (IS_CSS_ON(xhtml->entryp)) {
2990 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2992 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2993 css_property_t *cur;
2994 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2995 if (STRCASEEQ('l','L',"left", cur->value)) {
2996 attr_align = apr_pstrdup(doc->pool, "left");
2998 else if (STRCASEEQ('c','C',"center",cur->value)) {
2999 attr_align = apr_pstrdup(doc->pool, "center");
3001 else if (STRCASEEQ('r','R',"right",cur->value)) {
3002 attr_align = apr_pstrdup(doc->pool, "right");
3022 * It is a handler who processes the H6 tag.
3024 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3025 * destination is specified.
3026 * @param node [i] The H6 tag node is specified.
3027 * @return The conversion result is returned.
3030 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3032 xhtml_t *xhtml = GET_XHTML(pdoc);
3033 Doc *doc = xhtml->doc;
3036 if (IS_CSS_ON(xhtml->entryp)) {
3037 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3045 * It is a handler who processes the OL tag.
3047 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3048 * destination is specified.
3049 * @param node [i] The OL tag node is specified.
3050 * @return The conversion result is returned.
3053 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3055 xhtml_t *xhtml = GET_XHTML(pdoc);
3056 Doc *doc = xhtml->doc;
3058 char *attr_style = NULL;
3059 char *attr_start = NULL;
3060 char *attr_type = NULL;
3062 /*--------------------------------------------------------------------------*/
3063 /* Get Attributes */
3064 /*--------------------------------------------------------------------------*/
3065 for (attr = qs_get_attr(doc,node);
3067 attr = qs_get_next_attr(doc,attr)) {
3068 char *name = qs_get_attr_name(doc,attr);
3069 char *value = qs_get_attr_value(doc,attr);
3070 if (STRCASEEQ('t','T',"type",name) && value) {
3071 if (*value == '1') {
3072 attr_type = apr_pstrdup(doc->pool, "decimal");
3074 else if (*value == 'a') {
3075 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3077 else if (*value == 'A') {
3078 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3081 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3084 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3088 if (IS_CSS_ON(xhtml->entryp)) {
3089 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3091 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3092 css_property_t *cur;
3093 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3094 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3095 attr_type = apr_pstrdup(doc->pool, "decimal");
3097 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3098 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3100 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3101 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3109 W_L("list-style-type:");
3126 * It is a handler who processes the OL tag.
3128 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3129 * destination is specified.
3130 * @param node [i] The OL tag node is specified.
3131 * @return The conversion result is returned.
3134 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3136 xhtml_t *xhtml = GET_XHTML(pdoc);
3137 Doc *doc = xhtml->doc;
3140 if (IS_CSS_ON(xhtml->entryp)) {
3141 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3149 * It is a handler who processes the LI tag.
3151 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3152 * destination is specified.
3153 * @param node [i] The LI tag node is specified.
3154 * @return The conversion result is returned.
3157 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3159 xhtml_t *xhtml = GET_XHTML(pdoc);
3160 Doc *doc = xhtml->doc;
3162 char *attr_type = NULL;
3163 char *attr_value = NULL;
3164 char *attr_style = NULL;
3166 for (attr = qs_get_attr(doc,node);
3168 attr = qs_get_next_attr(doc,attr)) {
3169 char *name = qs_get_attr_name(doc,attr);
3170 char *value = qs_get_attr_value(doc,attr);
3171 if (STRCASEEQ('t','T',"type",name)) {
3172 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3173 if (*value == '1') {
3174 attr_type = apr_pstrdup(doc->pool, "decimal");
3176 else if (*value == 'a') {
3177 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3179 else if (*value == 'A') {
3180 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3187 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3190 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3194 if (IS_CSS_ON(xhtml->entryp)) {
3195 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3197 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3198 css_property_t *cur;
3199 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3200 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3201 attr_type = apr_pstrdup(doc->pool, "decimal");
3203 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3204 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3206 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3207 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3209 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3210 attr_type = apr_pstrdup(doc->pool, "disc");
3212 else if (STRCASEEQ('s','S',"square", cur->value)) {
3213 attr_type = apr_pstrdup(doc->pool, "square");
3215 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3216 attr_type = apr_pstrdup(doc->pool, "circle");
3226 W_L("list-style-type:");
3242 ** It is a handler who processes the LI tag.
3244 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3245 * destination is specified.
3246 * @param node [i] The LI tag node is specified.
3247 * @return The conversion result is returned.
3250 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
3252 xhtml_t *xhtml = GET_XHTML(pdoc);
3253 Doc *doc = xhtml->doc;
3256 if (IS_CSS_ON(xhtml->entryp)) {
3257 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3263 * It is a handler who processes the IMG tag.
3265 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3266 * destination is specified.
3267 * @param node [i] The IMG tag node is specified.
3268 * @return The conversion result is returned.
3271 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
3273 xhtml_t *xhtml = GET_XHTML(pdoc);
3274 Doc *doc = xhtml->doc;
3275 request_rec *r = doc->r;
3277 char *attr_src = NULL;
3278 char *attr_alt = NULL;
3279 char *attr_height = NULL;
3280 char *attr_width = NULL;
3281 char *attr_align = NULL;
3282 char *attr_style = NULL;
3283 char *attr_hspace = NULL;
3284 char *attr_vspace = NULL;
3286 #ifndef IMG_NOT_CONVERT_FILENAME
3287 device_table *spec = xhtml->spec;
3290 /*--------------------------------------------------------------------------*/
3291 /* Get Attributes */
3292 /*--------------------------------------------------------------------------*/
3293 for (attr = qs_get_attr(doc,node);
3295 attr = qs_get_next_attr(doc,attr)) {
3296 char *name = qs_get_attr_name(doc,attr);
3297 char *value = qs_get_attr_value(doc,attr);
3299 if (STRCASEEQ('s','S',"src",name)) {
3300 value = chxj_encoding_parameter(r, value, 1);
3301 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
3302 value = chxj_add_cookie_no_update_parameter(r, value);
3303 #ifdef IMG_NOT_CONVERT_FILENAME
3309 attr_src = chxj_img_conv(r,spec,value);
3315 if (STRCASEEQ('a','A',"align",name)) {
3317 if (STRCASEEQ('t','T',"top", value) ||
3318 STRCASEEQ('m','M',"middle",value) ||
3319 STRCASEEQ('b','B',"bottom",value) ||
3320 STRCASEEQ('l','L',"left", value) ||
3321 STRCASEEQ('r','R',"right", value)) {
3324 else if (STRCASEEQ('c','C',"center", value)) {
3325 attr_align = apr_pstrdup(doc->pool, "middle");
3329 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3332 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3335 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3336 attr_height = value;
3338 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3339 attr_hspace = value;
3341 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3342 attr_vspace = value;
3344 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3349 if (IS_CSS_ON(xhtml->entryp)) {
3350 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3352 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3353 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3354 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3355 css_property_t *cur;
3356 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3357 attr_height = apr_pstrdup(doc->pool, cur->value);
3359 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3360 attr_width = apr_pstrdup(doc->pool, cur->value);
3362 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3363 attr_align = apr_pstrdup(doc->pool, cur->value);
3413 * It is a handler who processes the IMG tag.
3415 * @param xhtml [i/o] The pointer to the XHTML structure at the output
3416 * destination is specified.
3417 * @param node [i] The IMG tag node is specified.
3418 * @return The conversion result is returned.
3421 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
3423 xhtml_t *xhtml = GET_XHTML(pdoc);
3430 * It is a handler who processes the SELECT tag.
3432 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3433 * destination is specified.
3434 * @param node [i] The SELECT tag node is specified.
3435 * @return The conversion result is returned.
3438 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
3440 xhtml_t *xhtml = GET_XHTML(pdoc);
3441 Doc *doc = xhtml->doc;
3444 char *multiple = NULL;
3446 char *attr_style = NULL;
3449 for (attr = qs_get_attr(doc,node);
3451 attr = qs_get_next_attr(doc,attr)) {
3452 char *nm = qs_get_attr_name(doc,attr);
3453 char *val = qs_get_attr_value(doc,attr);
3454 if (STRCASEEQ('s','S',"size",nm)) {
3455 /*----------------------------------------------------------------------*/
3456 /* CHTML 1.0 version 2.0 */
3457 /*----------------------------------------------------------------------*/
3458 size = apr_pstrdup(doc->buf.pool, val);
3460 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3461 /*----------------------------------------------------------------------*/
3462 /* CHTML 1.0 version 2.0 */
3463 /*----------------------------------------------------------------------*/
3464 attr_style = apr_pstrdup(doc->buf.pool, val);
3466 else if (STRCASEEQ('n','N',"name",nm)) {
3467 /*----------------------------------------------------------------------*/
3468 /* CHTML 1.0 version 2.0 */
3469 /*----------------------------------------------------------------------*/
3470 name = apr_pstrdup(doc->buf.pool, val);
3472 else if (STRCASEEQ('m','M',"multiple",nm)) {
3473 /*----------------------------------------------------------------------*/
3474 /* CHTML 1.0 version 2.0 */
3475 /*----------------------------------------------------------------------*/
3476 multiple = apr_pstrdup(doc->buf.pool, val);
3479 if (size && *size) {
3484 if (name && *name) {
3490 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
3491 W_L(" multiple=\"true\"");
3494 if (IS_CSS_ON(xhtml->entryp)) {
3495 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3503 * It is a handler who processes the SELECT tag.
3505 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3506 * destination is specified.
3507 * @param node [i] The SELECT tag node is specified.
3508 * @return The conversion result is returned.
3511 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
3513 xhtml_t *xhtml = GET_XHTML(pdoc);
3514 Doc *doc = xhtml->doc;
3517 if (IS_CSS_ON(xhtml->entryp)) {
3518 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3525 * It is a handler who processes the OPTION tag.
3527 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3528 * destination is specified.
3529 * @param node [i] The OPTION tag node is specified.
3530 * @return The conversion result is returned.
3533 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
3535 xhtml_t *xhtml = GET_XHTML(pdoc);
3536 Doc *doc = xhtml->doc;
3538 char *attr_style = NULL;
3540 char *selected = NULL;
3544 for (attr = qs_get_attr(doc,node);
3546 attr = qs_get_next_attr(doc,attr)) {
3547 char *nm = qs_get_attr_name(doc,attr);
3548 char *val = qs_get_attr_value(doc,attr);
3549 if (STRCASEEQ('s','S',"selected",nm)) {
3550 /* CHTML version 2.0 */
3551 selected = apr_pstrdup(doc->buf.pool, val);
3553 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3554 /* CHTML version 2.0 */
3555 attr_style = apr_pstrdup(doc->buf.pool, val);
3557 else if (STRCASEEQ('v','V',"value",nm)) {
3558 /* CHTML version 2.0 */
3559 value = apr_pstrdup(doc->buf.pool, val);
3568 W_L(" selected=\"selected\"");
3571 if (IS_CSS_ON(xhtml->entryp)) {
3572 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3579 * It is a handler who processes the OPTION tag.
3581 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3582 * destination is specified.
3583 * @param node [i] The OPTION tag node is specified.
3584 * @return The conversion result is returned.
3587 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
3589 xhtml_t *xhtml = GET_XHTML(pdoc);
3590 Doc *doc = xhtml->doc;
3593 if (IS_CSS_ON(xhtml->entryp)) {
3594 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3602 * It is a handler who processes the DIV tag.
3604 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3605 * destination is specified.
3606 * @param node [i] The DIV tag node is specified.
3607 * @return The conversion result is returned.
3610 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
3612 xhtml_t *xhtml = GET_XHTML(pdoc);
3613 Doc *doc = xhtml->doc;
3615 char *attr_style = NULL;
3616 char *attr_align = NULL;
3617 char *attr_display = NULL;
3618 char *attr_decoration = NULL;
3619 char *attr_wap_marquee_style = NULL;
3620 char *attr_wap_marquee_dir = NULL;
3621 char *attr_wap_marquee_loop = NULL;
3622 char *attr_color = NULL;
3623 char *attr_bgcolor = NULL;
3624 char *attr_font_size = NULL;
3626 for (attr = qs_get_attr(doc,node);
3628 attr = qs_get_next_attr(doc,attr)) {
3629 char *nm = qs_get_attr_name(doc,attr);
3630 char *val = qs_get_attr_value(doc,attr);
3631 if (STRCASEEQ('a','A',"align",nm)) {
3632 /*----------------------------------------------------------------------*/
3633 /* CHTML 1.0 (W3C version 3.2) */
3634 /*----------------------------------------------------------------------*/
3635 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3636 attr_align = apr_pstrdup(doc->buf.pool, val);
3639 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3640 attr_style = apr_pstrdup(doc->buf.pool, val);
3644 if (IS_CSS_ON(xhtml->entryp)) {
3645 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3647 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3648 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3649 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3650 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3651 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3652 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3653 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3655 css_property_t *cur;
3656 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3657 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3658 attr_display = apr_pstrdup(doc->pool, cur->value);
3661 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3662 if (STRCASEEQ('b','B',"blink", cur->value)) {
3663 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3666 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3667 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3668 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3670 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3671 char *ss = strchr(cur->value, '#');
3673 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3674 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3677 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3678 attr_color = apr_pstrdup(doc->pool, cur->value);
3680 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3681 attr_align = apr_pstrdup(doc->pool, cur->value);
3683 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3684 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3685 || STRCASEEQ('x','X',"x-small",cur->value)
3686 || STRCASEEQ('s','S',"small",cur->value)
3687 || STRCASEEQ('m','M',"medium",cur->value)
3688 || STRCASEEQ('l','L',"large",cur->value)
3689 || STRCASEEQ('x','X',"x-large",cur->value)
3690 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3691 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3695 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3696 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3697 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3698 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3699 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3700 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3703 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3704 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3705 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3707 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3708 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3711 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3712 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3721 || attr_wap_marquee_style
3722 || attr_wap_marquee_dir
3723 || attr_wap_marquee_loop
3726 || attr_font_size) {
3738 if (attr_decoration) {
3739 W_L("text-decoration:");
3740 W_V(attr_decoration);
3743 if (attr_wap_marquee_style) {
3744 W_L("-wap-marquee-style:");
3745 W_V(attr_wap_marquee_style);
3748 if (attr_wap_marquee_dir) {
3749 W_L("-wap-marquee-dir:");
3750 W_V(attr_wap_marquee_dir);
3753 if (attr_wap_marquee_loop) {
3754 W_L("-wap-marquee-loop:");
3755 W_V(attr_wap_marquee_loop);
3764 W_L("background-color:");
3768 if (attr_font_size) {
3770 W_V(attr_font_size);
3781 * It is a handler who processes the DIV tag.
3783 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3784 * destination is specified.
3785 * @param node [i] The DIV tag node is specified.
3786 * @return The conversion result is returned.
3789 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
3791 xhtml_t *xhtml = GET_XHTML(pdoc);
3792 Doc *doc = xhtml->doc;
3794 if (IS_CSS_ON(xhtml->entryp)) {
3795 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3802 * It is a handler who processes the B tag.
3804 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3805 * destination is specified.
3806 * @param node [i] The B tag node is specified.
3807 * @return The conversion result is returned.
3810 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
3812 xhtml_t *xhtml = GET_XHTML(pdoc);
3813 Doc *doc = xhtml->doc;
3815 W_L("<div style=\"font-weight:bold\">");
3821 * It is a handler who processes the B tag.
3823 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3824 * destination is specified.
3825 * @param node [i] The B tag node is specified.
3826 * @return The conversion result is returned.
3829 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
3831 xhtml_t *xhtml = GET_XHTML(pdoc);
3832 Doc *doc = xhtml->doc;
3840 * It is a handler who processes the CHXJ:IF tag.
3842 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3843 * destination is specified.
3844 * @param node [i] The CHXJ:IF tag node is specified.
3847 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
3849 xhtml_t *xhtml = GET_XHTML(pdoc);
3850 Doc *doc = xhtml->doc;
3853 for (child = qs_get_child_node(doc, node);
3855 child = qs_get_next_node(doc, child)) {
3857 s_xhtml_1_0_chxjif_tag(xhtml, child);
3865 * It is a handler who processes the TEXTARE tag.
3867 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3868 * destination is specified.
3869 * @param node [i] The TEXTAREA tag node is specified.
3870 * @return The conversion result is returned.
3873 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
3875 xhtml_t *xhtml = GET_XHTML(pdoc);
3876 Doc *doc = xhtml->doc;
3878 char *attr_accesskey = NULL;
3879 char *attr_name = NULL;
3880 char *attr_rows = NULL;
3881 char *attr_cols = NULL;
3882 char *attr_istyle = NULL;
3883 char *attr_style = NULL;
3885 xhtml->textarea_flag++;
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('n','N',"name",name) && value && *value) {
3894 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
3897 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
3900 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3901 attr_istyle = value;
3903 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
3909 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3910 attr_accesskey = value;
3912 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
3916 if (IS_CSS_ON(xhtml->entryp)) {
3917 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3919 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3920 css_property_t *cur;
3921 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3922 if (strcasestr(cur->value, "<ja:n>")) {
3925 else if (strcasestr(cur->value, "<ja:en>")) {
3928 else if (strcasestr(cur->value, "<ja:hk>")) {
3931 else if (strcasestr(cur->value, "<ja:h>")) {
3938 if (attr_accesskey) {
3939 W_L(" accesskey=\"");
3940 W_V(attr_accesskey);
3959 char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
3970 * It is a handler who processes the TEXTAREA tag.
3972 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3973 * destination is specified.
3974 * @param node [i] The TEXTAREA tag node is specified.
3975 * @return The conversion result is returned.
3978 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3980 xhtml_t *xhtml = GET_XHTML(pdoc);
3981 Doc *doc = xhtml->doc;
3984 xhtml->textarea_flag--;
3990 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
3992 xhtml_t *xhtml = GET_XHTML(pdoc);
3993 Doc *doc = xhtml->doc;
3994 request_rec *r = doc->r;
4001 apr_size_t z2h_input_len;
4003 textval = qs_get_node_value(doc,child);
4004 if (strlen(textval) == 0) {
4008 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4009 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4011 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4012 memset(one_byte, 0, sizeof(one_byte));
4015 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4017 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4019 DBG(r,"[%s][%d]", out, rtn);
4020 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4024 if (is_sjis_kanji(textval[ii])) {
4025 one_byte[0] = textval[ii+0];
4026 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4027 one_byte[0] = textval[ii+1];
4028 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4031 else if (xhtml->pre_flag) {
4032 one_byte[0] = textval[ii+0];
4033 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4035 else if (xhtml->textarea_flag) {
4036 one_byte[0] = textval[ii+0];
4037 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4039 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4040 one_byte[0] = textval[ii+0];
4041 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4044 z2h_input_len = strlen(tdst);
4045 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4053 * It is a handler who processes the BLOCKQUOTE tag.
4055 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4056 * destination is specified.
4057 * @param node [i] The BLOCKQUOTE tag node is specified.
4058 * @return The conversion result is returned.
4061 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4066 char *attr_style = NULL;
4067 char *attr_color = NULL;
4068 char *attr_size = NULL;
4070 xhtml = GET_XHTML(pdoc);
4072 for (attr = qs_get_attr(doc,node);
4074 attr = qs_get_next_attr(doc,attr)) {
4075 char *nm = qs_get_attr_name(doc,attr);
4076 char *val = qs_get_attr_value(doc,attr);
4077 if (val && STRCASEEQ('s','S',"style", nm)) {
4081 if (IS_CSS_ON(xhtml->entryp)) {
4082 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4084 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4085 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4086 css_property_t *cur;
4087 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4088 if (cur->value && *cur->value) {
4089 attr_color = apr_pstrdup(doc->pool, cur->value);
4092 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4093 if (cur->value && *cur->value) {
4094 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4095 attr_size = apr_pstrdup(doc->pool, cur->value);
4097 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4098 attr_size = apr_pstrdup(doc->pool, cur->value);
4100 else if (STRCASEEQ('s','S',"small",cur->value)) {
4101 attr_size = apr_pstrdup(doc->pool, cur->value);
4103 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4104 attr_size = apr_pstrdup(doc->pool, cur->value);
4106 else if (STRCASEEQ('l','L',"large",cur->value)) {
4107 attr_size = apr_pstrdup(doc->pool, cur->value);
4109 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4110 attr_size = apr_pstrdup(doc->pool, cur->value);
4112 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4113 attr_size = apr_pstrdup(doc->pool, cur->value);
4120 if (attr_color || attr_size) {
4123 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4141 * It is a handler who processes the BLOCKQUOTE tag.
4143 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4144 * destination is specified.
4145 * @param node [i] The BLOCKQUOTE tag node is specified.
4146 * @return The conversion result is returned.
4149 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4151 xhtml_t *xhtml = GET_XHTML(pdoc);
4152 Doc *doc = xhtml->doc;
4153 W_L("</blockquote>");
4154 if (IS_CSS_ON(xhtml->entryp)) {
4155 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4162 * It is a handler who processes the DIR tag.
4164 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4165 * destination is specified.
4166 * @param node [i] The DIR tag node is specified.
4167 * @return The conversion result is returned.
4170 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
4172 xhtml_t *xhtml = GET_XHTML(pdoc);
4173 Doc *doc = xhtml->doc;
4175 char *attr_style = NULL;
4176 char *attr_color = NULL;
4177 char *attr_type = NULL;
4178 char *attr_size = NULL;
4179 for (attr = qs_get_attr(doc,node);
4181 attr = qs_get_next_attr(doc,attr)) {
4182 char *name = qs_get_attr_name(doc,attr);
4183 char *value = qs_get_attr_value(doc,attr);
4184 if (STRCASEEQ('t','T',"type",name)) {
4185 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4189 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4193 if (IS_CSS_ON(xhtml->entryp)) {
4194 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4196 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4197 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4198 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4199 css_property_t *cur;
4200 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4201 if (cur->value && *cur->value) {
4202 attr_color = apr_pstrdup(doc->pool, cur->value);
4205 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4206 if (cur->value && *cur->value) {
4207 attr_type = apr_pstrdup(doc->pool, cur->value);
4210 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4211 if (cur->value && *cur->value) {
4212 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4213 attr_size = apr_pstrdup(doc->pool, cur->value);
4215 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4216 attr_size = apr_pstrdup(doc->pool, cur->value);
4218 else if (STRCASEEQ('s','S',"small",cur->value)) {
4219 attr_size = apr_pstrdup(doc->pool, cur->value);
4221 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4222 attr_size = apr_pstrdup(doc->pool, cur->value);
4224 else if (STRCASEEQ('l','L',"large",cur->value)) {
4225 attr_size = apr_pstrdup(doc->pool, cur->value);
4227 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4228 attr_size = apr_pstrdup(doc->pool, cur->value);
4230 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4231 attr_size = apr_pstrdup(doc->pool, cur->value);
4238 if (attr_type || attr_color || attr_size) {
4241 W_L("list-style-type:");
4246 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4264 * It is a handler who processes the DIR tag.
4266 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4267 * destination is specified.
4268 * @param node [i] The DIR tag node is specified.
4269 * @return The conversion result is returned.
4272 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
4274 xhtml_t *xhtml = GET_XHTML(pdoc);
4275 Doc *doc = xhtml->doc;
4277 if (IS_CSS_ON(xhtml->entryp)) {
4278 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4285 * It is a handler who processes the DL tag.
4287 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4288 * destination is specified.
4289 * @param node [i] The DL tag node is specified.
4290 * @return The conversion result is returned.
4293 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
4295 xhtml_t *xhtml = GET_XHTML(pdoc);
4296 Doc *doc = xhtml->doc;
4298 char *attr_style = NULL;
4299 char *attr_color = NULL;
4300 char *attr_size = NULL;
4302 for (attr = qs_get_attr(doc,node);
4304 attr = qs_get_next_attr(doc,attr)) {
4305 char *name = qs_get_attr_name(doc,attr);
4306 char *value = qs_get_attr_value(doc,attr);
4307 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4311 if (IS_CSS_ON(xhtml->entryp)) {
4312 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4314 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4315 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4316 css_property_t *cur;
4317 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4318 if (cur->value && *cur->value) {
4319 attr_color = apr_pstrdup(doc->pool, cur->value);
4322 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4323 if (cur->value && *cur->value) {
4324 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4325 attr_size = apr_pstrdup(doc->pool, cur->value);
4327 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4328 attr_size = apr_pstrdup(doc->pool, cur->value);
4330 else if (STRCASEEQ('s','S',"small",cur->value)) {
4331 attr_size = apr_pstrdup(doc->pool, cur->value);
4333 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4334 attr_size = apr_pstrdup(doc->pool, cur->value);
4336 else if (STRCASEEQ('l','L',"large",cur->value)) {
4337 attr_size = apr_pstrdup(doc->pool, cur->value);
4339 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4340 attr_size = apr_pstrdup(doc->pool, cur->value);
4342 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4343 attr_size = apr_pstrdup(doc->pool, cur->value);
4350 if (attr_color || attr_size) {
4353 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4371 * It is a handler who processes the DL tag.
4373 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4374 * destination is specified.
4375 * @param node [i] The DL tag node is specified.
4376 * @return The conversion result is returned.
4379 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
4381 xhtml_t *xhtml = GET_XHTML(pdoc);
4382 Doc *doc = xhtml->doc;
4384 if (IS_CSS_ON(xhtml->entryp)) {
4385 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4392 * It is a handter who processes the DT tag.
4394 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4395 * destination is specified.
4396 * @param node [i] The DT tag node is specified.
4397 * @return The conversion result is returned.
4400 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
4402 xhtml_t *xhtml = GET_XHTML(pdoc);
4403 Doc *doc = xhtml->doc;
4405 char *attr_style = NULL;
4406 char *attr_color = NULL;
4407 char *attr_size = NULL;
4409 for (attr = qs_get_attr(doc,node);
4411 attr = qs_get_next_attr(doc,attr)) {
4412 char *name = qs_get_attr_name(doc,attr);
4413 char *value = qs_get_attr_value(doc,attr);
4414 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4418 if (IS_CSS_ON(xhtml->entryp)) {
4419 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4421 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4422 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4423 css_property_t *cur;
4424 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4425 if (cur->value && *cur->value) {
4426 attr_color = apr_pstrdup(doc->pool, cur->value);
4429 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4430 if (cur->value && *cur->value) {
4431 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4432 attr_size = apr_pstrdup(doc->pool, cur->value);
4434 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4435 attr_size = apr_pstrdup(doc->pool, cur->value);
4437 else if (STRCASEEQ('s','S',"small",cur->value)) {
4438 attr_size = apr_pstrdup(doc->pool, cur->value);
4440 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4441 attr_size = apr_pstrdup(doc->pool, cur->value);
4443 else if (STRCASEEQ('l','L',"large",cur->value)) {
4444 attr_size = apr_pstrdup(doc->pool, cur->value);
4446 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4447 attr_size = apr_pstrdup(doc->pool, cur->value);
4449 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4450 attr_size = apr_pstrdup(doc->pool, cur->value);
4457 if (attr_color || attr_size) {
4460 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4478 * It is a handter who processes the DT tag.
4480 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4481 * destination is specified.
4482 * @param node [i] The DT tag node is specified.
4483 * @return The conversion result is returned.
4486 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
4488 xhtml_t *xhtml = GET_XHTML(pdoc);
4489 Doc *doc = xhtml->doc;
4491 if (IS_CSS_ON(xhtml->entryp)) {
4492 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4499 * It is a handder who processes the DD tag.
4501 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4502 * destination is specified.
4503 * @param node [i] The DD tag node is specified.
4504 * @return The conversion result is returned.
4507 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
4509 xhtml_t *xhtml = GET_XHTML(pdoc);
4510 Doc *doc = xhtml->doc;
4512 char *attr_style = NULL;
4513 char *attr_color = NULL;
4514 char *attr_size = NULL;
4516 for (attr = qs_get_attr(doc,node);
4518 attr = qs_get_next_attr(doc,attr)) {
4519 char *name = qs_get_attr_name(doc,attr);
4520 char *value = qs_get_attr_value(doc,attr);
4521 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4525 if (IS_CSS_ON(xhtml->entryp)) {
4526 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4528 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4529 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4530 css_property_t *cur;
4531 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4532 if (cur->value && *cur->value) {
4533 attr_color = apr_pstrdup(doc->pool, cur->value);
4536 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4537 if (cur->value && *cur->value) {
4538 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4539 attr_size = apr_pstrdup(doc->pool, cur->value);
4541 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4542 attr_size = apr_pstrdup(doc->pool, cur->value);
4544 else if (STRCASEEQ('s','S',"small",cur->value)) {
4545 attr_size = apr_pstrdup(doc->pool, cur->value);
4547 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4548 attr_size = apr_pstrdup(doc->pool, cur->value);
4550 else if (STRCASEEQ('l','L',"large",cur->value)) {
4551 attr_size = apr_pstrdup(doc->pool, cur->value);
4553 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4554 attr_size = apr_pstrdup(doc->pool, cur->value);
4556 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4557 attr_size = apr_pstrdup(doc->pool, cur->value);
4564 if (attr_color || attr_size) {
4567 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4585 * It is a handler who processes the DD tag.
4587 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4588 * destination is specified.
4589 * @param node [i] The DD tag node is specified.
4590 * @return The conversion result is returned.
4593 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
4595 xhtml_t *xhtml = GET_XHTML(pdoc);
4596 Doc *doc = xhtml->doc;
4598 if (IS_CSS_ON(xhtml->entryp)) {
4599 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4606 * It is a handler who processes the MENU tag.
4608 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4609 * destination is specified.
4610 * @param node [i] The MENU tag node is specified.
4611 * @return The conversion result is returned.
4614 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
4616 xhtml_t *xhtml = GET_XHTML(pdoc);
4617 Doc *doc = xhtml->doc;
4619 char *attr_style = NULL;
4620 char *attr_color = NULL;
4621 char *attr_type = NULL;
4622 char *attr_size = NULL;
4623 for (attr = qs_get_attr(doc,node);
4625 attr = qs_get_next_attr(doc,attr)) {
4626 char *name = qs_get_attr_name(doc,attr);
4627 char *value = qs_get_attr_value(doc,attr);
4628 if (STRCASEEQ('t','T',"type",name)) {
4629 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4633 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4637 if (IS_CSS_ON(xhtml->entryp)) {
4638 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4640 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4641 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4642 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4643 css_property_t *cur;
4644 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4645 if (cur->value && *cur->value) {
4646 attr_color = apr_pstrdup(doc->pool, cur->value);
4649 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4650 if (cur->value && *cur->value) {
4651 attr_type = apr_pstrdup(doc->pool, cur->value);
4654 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4655 if (cur->value && *cur->value) {
4656 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4657 attr_size = apr_pstrdup(doc->pool, cur->value);
4659 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4660 attr_size = apr_pstrdup(doc->pool, cur->value);
4662 else if (STRCASEEQ('s','S',"small",cur->value)) {
4663 attr_size = apr_pstrdup(doc->pool, cur->value);
4665 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4666 attr_size = apr_pstrdup(doc->pool, cur->value);
4668 else if (STRCASEEQ('l','L',"large",cur->value)) {
4669 attr_size = apr_pstrdup(doc->pool, cur->value);
4671 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4672 attr_size = apr_pstrdup(doc->pool, cur->value);
4674 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4675 attr_size = apr_pstrdup(doc->pool, cur->value);
4682 if (attr_type || attr_color || attr_size) {
4685 W_L("list-style-type:");
4690 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4708 * It is a hanmenuer who processes the MENU tag.
4710 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4711 * destination is specified.
4712 * @param node [i] The MENU tag node is specified.
4713 * @return The conversion result is returned.
4716 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
4718 xhtml_t *xhtml = GET_XHTML(pdoc);
4719 Doc *doc = xhtml->doc;
4721 if (IS_CSS_ON(xhtml->entryp)) {
4722 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4729 * It is a handler who processes the PLAINTEXT tag.
4731 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4732 * destination is specified.
4733 * @param node [i] The PLAINTEXT tag node is specified.
4734 * @return The conversion result is returned.
4737 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
4739 xhtml_t *xhtml = GET_XHTML(pdoc);
4740 Doc *doc = xhtml->doc;
4742 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
4747 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
4749 xhtml_t *xhtml = GET_XHTML(pdoc);
4750 Doc *doc = xhtml->doc;
4752 for (child = qs_get_child_node(doc, node);
4754 child = qs_get_next_node(doc, child)) {
4756 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
4763 * It is a handler who processes the PLAINTEXT tag.
4765 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4766 * destination is specified.
4767 * @param node [i] The PLAINTEXT tag node is specified.
4768 * @return The conversion result is returned.
4771 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4773 xhtml_t *xhtml = GET_XHTML(pdoc);
4774 Doc *doc = xhtml->doc;
4775 W_L("</plaintext>");
4781 * It is a handler who processes the BLINK tag.
4783 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4784 * destination is specified.
4785 * @param node [i] The BLINK tag node is specified.
4786 * @return The conversion result is returned.
4789 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
4791 xhtml_t *xhtml = GET_XHTML(pdoc);
4792 Doc *doc = xhtml->doc;
4794 char *attr_style = NULL;
4795 char *attr_color = NULL;
4796 char *attr_size = NULL;
4798 for (attr = qs_get_attr(doc,node);
4800 attr = qs_get_next_attr(doc,attr)) {
4801 char *name = qs_get_attr_name(doc,attr);
4802 char *value = qs_get_attr_value(doc,attr);
4803 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4807 if (IS_CSS_ON(xhtml->entryp)) {
4808 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4810 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4811 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4812 css_property_t *cur;
4813 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4814 if (cur->value && *cur->value) {
4815 attr_color = apr_pstrdup(doc->pool, cur->value);
4818 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4819 if (cur->value && *cur->value) {
4820 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4821 attr_size = apr_pstrdup(doc->pool, cur->value);
4823 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4824 attr_size = apr_pstrdup(doc->pool, cur->value);
4826 else if (STRCASEEQ('s','S',"small",cur->value)) {
4827 attr_size = apr_pstrdup(doc->pool, cur->value);
4829 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4830 attr_size = apr_pstrdup(doc->pool, cur->value);
4832 else if (STRCASEEQ('l','L',"large",cur->value)) {
4833 attr_size = apr_pstrdup(doc->pool, cur->value);
4835 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4836 attr_size = apr_pstrdup(doc->pool, cur->value);
4838 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4839 attr_size = apr_pstrdup(doc->pool, cur->value);
4846 if (attr_color || attr_size) {
4849 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4867 * It is a handler who processes the BLINK tag.
4869 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4870 * destination is specified.
4871 * @param node [i] The BLINK tag node is specified.
4872 * @return The conversion result is returned.
4875 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
4877 xhtml_t *xhtml = GET_XHTML(pdoc);
4878 Doc *doc = xhtml->doc;
4880 if (IS_CSS_ON(xhtml->entryp)) {
4881 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4888 * It is a handler who processes the MARQUEE tag.
4890 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4891 * destination is specified.
4892 * @param node [i] The MARQUEE tag node is specified.
4893 * @return The conversion result is returned.
4896 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
4898 xhtml_t *xhtml = GET_XHTML(pdoc);
4899 Doc *doc = xhtml->doc;
4901 char *attr_direction = NULL;
4902 char *attr_behavior = NULL;
4903 char *attr_loop = NULL;
4904 char *attr_style = NULL;
4905 char *attr_color = NULL;
4906 char *attr_size = NULL;
4907 char *attr_bgcolor = NULL;
4908 /*--------------------------------------------------------------------------*/
4909 /* Get Attributes */
4910 /*--------------------------------------------------------------------------*/
4911 for (attr = qs_get_attr(doc,node);
4913 attr = qs_get_next_attr(doc,attr)) {
4914 char *name = qs_get_attr_name(doc,attr);
4915 char *value = qs_get_attr_value(doc,attr);
4916 if (STRCASEEQ('d','D',"direction", name)) {
4918 if (STRCASEEQ('l','L',"left",value)) {
4919 attr_direction = "rtl";
4921 else if (STRCASEEQ('r','R',"right",value)) {
4922 attr_direction = "ltr";
4926 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
4927 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
4928 attr_behavior = value;
4931 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
4934 else if (STRCASEEQ('b','B',"bgcolor",name)) {
4935 if (value && *value) {
4936 attr_bgcolor = value;
4939 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4943 if (IS_CSS_ON(xhtml->entryp)) {
4944 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4946 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4947 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4948 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
4949 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4950 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4951 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4952 css_property_t *cur;
4953 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4954 if (cur->value && *cur->value) {
4955 attr_color = apr_pstrdup(doc->pool, cur->value);
4958 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
4959 if (cur->value && *cur->value) {
4960 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4963 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
4964 if (cur->value && *cur->value) {
4965 attr_direction = apr_pstrdup(doc->pool, cur->value);
4968 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
4969 if (cur->value && *cur->value) {
4970 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4971 attr_behavior = apr_pstrdup(doc->pool, cur->value);
4975 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
4976 if (cur->value && *cur->value) {
4977 attr_loop = apr_pstrdup(doc->pool, cur->value);
4980 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4981 if (cur->value && *cur->value) {
4982 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4983 attr_size = apr_pstrdup(doc->pool, cur->value);
4985 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4986 attr_size = apr_pstrdup(doc->pool, cur->value);
4988 else if (STRCASEEQ('s','S',"small",cur->value)) {
4989 attr_size = apr_pstrdup(doc->pool, cur->value);
4991 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4992 attr_size = apr_pstrdup(doc->pool, cur->value);
4994 else if (STRCASEEQ('l','L',"large",cur->value)) {
4995 attr_size = apr_pstrdup(doc->pool, cur->value);
4997 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4998 attr_size = apr_pstrdup(doc->pool, cur->value);
5000 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5001 attr_size = apr_pstrdup(doc->pool, cur->value);
5008 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5010 if (attr_direction) {
5011 W_L("-wap-marquee-dir:");
5012 W_V(attr_direction);
5015 if (attr_behavior) {
5016 W_L("-wap-marquee-style:");
5021 W_L("-wap-marquee-loop:");
5026 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5027 W_L("background-color:");
5032 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5051 * It is a handler who processes the MARQUEE tag.
5053 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5054 * destination is specified.
5055 * @param node [i] The MARQUEE tag node is specified.
5056 * @return The conversion result is returned.
5059 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5061 xhtml_t *xhtml = GET_XHTML(pdoc);
5062 Doc *doc = xhtml->doc;
5064 if (IS_CSS_ON(xhtml->entryp)) {
5065 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5072 * It is handler who processes the New Line Code.
5075 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5077 xhtml_t *xhtml = GET_XHTML(pdoc);
5078 Doc *doc = xhtml->doc;
5079 if (xhtml->start_html_flag) {
5087 * It is a handler who processes the LINK tag.
5089 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5090 * destination is specified.
5091 * @param node [i] The LINK tag node is specified.
5092 * @return The conversion result is returned.
5095 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5104 xhtml = GET_XHTML(pdoc);
5107 if (! IS_CSS_ON(xhtml->entryp)) {
5111 for (attr = qs_get_attr(doc,node);
5113 attr = qs_get_next_attr(doc,attr)) {
5114 char *name = qs_get_attr_name(doc,attr);
5115 char *value = qs_get_attr_value(doc,attr);
5116 if (STRCASEEQ('r','R',"rel", name)) {
5117 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5121 else if (STRCASEEQ('h','H',"href", name)) {
5122 if (value && *value) {
5126 else if (STRCASEEQ('t','T',"type", name)) {
5127 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5133 if (rel && href && type) {
5134 DBG(doc->r, "start load CSS. url:[%s]", href);
5135 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
5136 DBG(doc->r, "end load CSS. url:[%s]", href);
5142 static css_prop_list_t *
5143 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5145 xhtml_t *xhtml = GET_XHTML(pdoc);
5146 Doc *doc = xhtml->doc;
5147 css_prop_list_t *last_css = NULL;
5148 if (IS_CSS_ON(xhtml->entryp)) {
5149 css_prop_list_t *dup_css;
5150 css_selector_t *selector;
5152 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5153 dup_css = chxj_dup_css_prop_list(doc, last_css);
5154 selector = chxj_css_find_selector(doc, xhtml->style, node);
5156 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5158 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
5159 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5161 if (style_attr_value) {
5162 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));
5164 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5172 static css_prop_list_t *
5173 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5175 xhtml_t *xhtml = GET_XHTML(pdoc);
5176 Doc *doc = xhtml->doc;
5177 css_prop_list_t *last_css = NULL;
5178 if (IS_CSS_ON(xhtml->entryp)) {
5179 css_prop_list_t *dup_css;
5180 css_selector_t *selector;
5182 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5183 dup_css = chxj_dup_css_prop_list(doc, last_css);
5184 selector = chxj_css_find_selector(doc, xhtml->style, node);
5186 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5190 if (style_attr_value) {
5191 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));
5193 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5202 * It is a handler who processes the SPAN tag.
5204 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5205 * destination is specified.
5206 * @param node [i] The SPAN tag node is specified.
5207 * @return The conversion result is returned.
5210 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
5215 char *attr_style = NULL;
5216 char *attr_color = NULL;
5217 char *attr_size = NULL;
5218 char *attr_align = NULL;
5219 char *attr_blink = NULL;
5220 char *attr_marquee = NULL;
5221 char *attr_marquee_dir = NULL;
5222 char *attr_marquee_style = NULL;
5223 char *attr_marquee_loop = NULL;
5225 xhtml = GET_XHTML(pdoc);
5228 for (attr = qs_get_attr(doc,node);
5230 attr = qs_get_next_attr(doc,attr)) {
5231 char *nm = qs_get_attr_name(doc,attr);
5232 char *val = qs_get_attr_value(doc,attr);
5233 if (val && STRCASEEQ('s','S',"style", nm)) {
5237 if (IS_CSS_ON(xhtml->entryp)) {
5238 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5240 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5241 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5242 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5243 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5244 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5245 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5246 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5247 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5248 css_property_t *cur;
5249 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5250 attr_color = apr_pstrdup(doc->pool, cur->value);
5252 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5253 if (cur->value && *cur->value) {
5254 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5255 || STRCASEEQ('x','X',"x-small", cur->value)
5256 || STRCASEEQ('s','S',"small", cur->value)
5257 || STRCASEEQ('m','M',"medium", cur->value)
5258 || STRCASEEQ('l','L',"large", cur->value)
5259 || STRCASEEQ('x','X',"x-large", cur->value)
5260 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5261 attr_size = apr_pstrdup(doc->pool, cur->value);
5265 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5266 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5267 attr_blink = apr_pstrdup(doc->pool, cur->value);
5270 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5271 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5272 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5275 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5276 if (cur->value && *cur->value) {
5277 if ( STRCASEEQ('l','L',"ltr",cur->value)
5278 || STRCASEEQ('r','R',"rtl",cur->value)) {
5279 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5283 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5284 if (cur->value && *cur->value) {
5285 if ( STRCASEEQ('s','S',"scroll",cur->value)
5286 || STRCASEEQ('s','S',"slide",cur->value)
5287 || STRCASEEQ('a','A',"alternate",cur->value)) {
5288 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5292 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5293 if (cur->value && *cur->value) {
5294 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5297 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5298 if (STRCASEEQ('l','L',"left", cur->value)) {
5299 attr_align = apr_pstrdup(doc->pool, "left");
5301 else if (STRCASEEQ('c','C',"center",cur->value)) {
5302 attr_align = apr_pstrdup(doc->pool, "center");
5304 else if (STRCASEEQ('r','R',"right",cur->value)) {
5305 attr_align = apr_pstrdup(doc->pool, "right");
5312 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5315 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5331 W_L("text-decoration:");
5336 W_L("display:-wap-marquee;");
5337 if (attr_marquee_dir) {
5338 W_L("-wap-marquee-dir:");
5339 W_V(attr_marquee_dir);
5342 if (attr_marquee_style) {
5343 W_L("-wap-marquee-style:");
5344 W_V(attr_marquee_style);
5347 if (attr_marquee_loop) {
5348 W_L("-wap-marquee-loop:");
5349 W_V(attr_marquee_loop);
5361 * It is a handler who processes the SPAN tag.
5363 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5364 * destination is specified.
5365 * @param node [i] The SPAN tag node is specified.
5366 * @return The conversion result is returned.
5369 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
5371 xhtml_t *xhtml = GET_XHTML(pdoc);
5372 Doc *doc = xhtml->doc;
5375 if (IS_CSS_ON(xhtml->entryp)) {
5376 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5383 * It is a handler who processes the STYLE tag.
5385 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5386 * destination is specified.
5387 * @param node [i] The STYLE tag node is specified.
5388 * @return The conversion result is returned.
5391 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
5398 xhtml = GET_XHTML(pdoc);
5401 if (! IS_CSS_ON(xhtml->entryp)) {
5405 for (attr = qs_get_attr(doc,node);
5407 attr = qs_get_next_attr(doc,attr)) {
5408 char *name = qs_get_attr_name(doc,attr);
5409 char *value = qs_get_attr_value(doc,attr);
5410 if (STRCASEEQ('t','T',"type", name)) {
5411 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5417 Node *child = qs_get_child_node(doc, node);
5418 if (type && child) {
5419 char *name = qs_get_node_name(doc, child);
5420 if (STRCASEEQ('t','T',"text", name)) {
5421 char *value = qs_get_node_value(doc, child);
5422 DBG(doc->r, "start load CSS. buf:[%s]", value);
5423 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
5424 DBG(doc->r, "end load CSS. value:[%s]", value);