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,
307 s_xhtml_1_0_chxjif_tag,
322 s_xhtml_1_0_style_tag,
327 s_xhtml_1_0_start_span_tag,
328 s_xhtml_1_0_end_span_tag,
332 s_xhtml_1_0_text_tag,
342 s_xhtml_1_0_start_b_tag,
343 s_xhtml_1_0_end_b_tag,
352 s_xhtml_1_0_start_dt_tag,
353 s_xhtml_1_0_end_dt_tag,
367 s_xhtml_1_0_start_blockquote_tag,
368 s_xhtml_1_0_end_blockquote_tag,
372 s_xhtml_1_0_start_dir_tag,
373 s_xhtml_1_0_end_dir_tag,
377 s_xhtml_1_0_start_dl_tag,
378 s_xhtml_1_0_end_dl_tag,
382 s_xhtml_1_0_start_dd_tag,
383 s_xhtml_1_0_end_dd_tag,
387 s_xhtml_1_0_start_menu_tag,
388 s_xhtml_1_0_end_menu_tag,
392 s_xhtml_1_0_start_plaintext_tag,
393 s_xhtml_1_0_end_plaintext_tag,
397 s_xhtml_1_0_start_blink_tag,
398 s_xhtml_1_0_end_blink_tag,
402 s_xhtml_1_0_start_marquee_tag,
403 s_xhtml_1_0_end_marquee_tag,
407 s_xhtml_1_0_link_tag,
412 s_xhtml_1_0_newline_mark,
418 * converts from CHTML to XHTML.
420 * @param r [i] Requet_rec is appointed.
421 * @param spec [i] The result of the device specification processing which
422 * was done in advance is appointed.
423 * @param src [i] The character string before the converting is appointed.
424 * @return The character string after the converting is returned.
427 chxj_convert_xhtml_mobile_1_0(
433 chxjconvrule_entry *entryp,
442 DBG(r,"start chxj_convert_xhtml_mobile_1_0()");
443 /*--------------------------------------------------------------------------*/
445 /*--------------------------------------------------------------------------*/
447 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
449 DBG(r,"end chxj_convert_xhtml_mobile_1_0() (found qrcode.xml)");
453 /*--------------------------------------------------------------------------*/
454 /* The XHTML structure is initialized. */
455 /*--------------------------------------------------------------------------*/
456 s_init_xhtml(&xhtml, &doc, r, spec);
458 xhtml.entryp = entryp;
459 xhtml.cookie = cookie;
461 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
463 /*--------------------------------------------------------------------------*/
464 /* The character string of the input is analyzed. */
465 /*--------------------------------------------------------------------------*/
466 qs_init_malloc(&doc);
467 qs_init_root_node(&doc);
469 ss = apr_pcalloc(r->pool, srclen + 1);
470 memset(ss, 0, srclen + 1);
471 memcpy(ss, src, srclen);
473 if (IS_CSS_ON(xhtml.entryp)) {
474 /* current property list */
475 xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
478 chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
480 qs_parse_string(&doc,ss, strlen(ss));
482 chxj_buffered_write_init(r->pool, &doc.buf);
483 /*--------------------------------------------------------------------------*/
484 /* It converts it from CHTML to XHTML. */
485 /*--------------------------------------------------------------------------*/
486 chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
487 xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
488 dst = apr_pstrdup(r->pool, xhtml.out);
489 chxj_buffered_write_terminate(&doc.buf);
491 qs_all_free(&doc,QX_LOGMARK);
494 return apr_pstrdup(r->pool,ss);
498 dst = apr_psprintf(r->pool, "\n");
500 *dstlen = strlen(dst);
503 chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
506 DBG(r,"end chxj_convert_xhtml_mobile_1_0()");
512 * The XHTML structure is initialized.
514 * @param xhtml [i/o] The pointer to the HDML structure that wants to be
515 * initialized is specified.
516 * @param doc [i] The Doc structure that should be set to the initialized
517 * HDML structure is specified.
518 * @param r [i] To use POOL, the pointer to request_rec is specified.
519 * @param spec [i] The pointer to the device_table
522 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
524 memset(doc, 0, sizeof(Doc));
525 memset(xhtml, 0, sizeof(xhtml_t));
530 xhtml->out = qs_alloc_zero_byte_string(r->pool);
531 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
532 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
537 * Corresponding EMOJI to a current character-code is retrieved.
538 * The substitution character string is stored in the rslt pointer if agreeing.
540 * @param xhtml [i] The pointer to the XHTML structure is specified.
541 * @param txt [i] The character string to want to examine whether it is
542 * EMOJI is specified.
543 * @param rslt [o] The pointer to the pointer that stores the result is
545 * @return When corresponding EMOJI exists, it returns it excluding 0.
548 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
561 DBG(r,"spec is NULL");
564 for (ee = xhtml->conf->emoji;
567 unsigned char hex1byte;
568 unsigned char hex2byte;
570 DBG(r,"emoji->imode is NULL");
574 if (ee->imode->string != NULL
575 && strlen(ee->imode->string) > 0
576 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
577 if (spec == NULL || spec->emoji_type == NULL) {
578 *rslt = apr_psprintf(r->pool,
581 return strlen(ee->imode->string);
584 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
585 *rslt = apr_psprintf(r->pool,
588 return strlen(ee->imode->string);
591 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
592 *rslt = apr_psprintf(r->pool,
595 return strlen(ee->imode->string);
598 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
599 *rslt = apr_psprintf(r->pool,
602 return strlen(ee->imode->string);
605 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
606 *rslt = apr_psprintf(r->pool,
609 return strlen(ee->imode->string);
612 *rslt = apr_psprintf(r->pool,
615 return strlen(ee->imode->string);
619 hex1byte = ee->imode->hex1byte & 0xff;
620 hex2byte = ee->imode->hex2byte & 0xff;
622 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
623 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
624 if (spec == NULL || spec->emoji_type == NULL) {
625 *rslt = apr_psprintf(r->pool,
626 "<img localsrc=\"%s\">",
631 if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
632 *rslt = apr_psprintf(r->pool,
633 "<img localsrc=\"%s\">",
638 if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
639 *rslt = apr_psprintf(r->pool,
640 "<img localsrc=\"%s\">",
645 if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
646 *rslt = apr_psprintf(r->pool,
647 "<img localsrc=\"%s\">",
652 if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
653 *rslt = apr_psprintf(r->pool,
654 "<img localsrc=\"%s\">",
659 *rslt = apr_psprintf(r->pool,
660 "<img localsrc=\"%s\">",
672 chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
686 DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
687 memset(doc, 0, sizeof(Doc));
688 memset(xhtml, 0, sizeof(xhtml_t));
693 xhtml->out = qs_alloc_zero_byte_string(r->pool);
694 xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
695 xhtml->doc->parse_mode = PARSE_MODE_CHTML;
697 apr_pool_create(&pool, r->pool);
699 chxj_buffered_write_init(pool, &doc->buf);
701 for (ii=0; ii<len; ii++) {
705 rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
712 if (is_sjis_kanji(src[ii])) {
713 two_byte[0] = src[ii+0];
714 two_byte[1] = src[ii+1];
720 one_byte[0] = src[ii+0];
725 xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
727 DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
733 * It is a handler who processes the HTML tag.
735 * @param pdoc [i/o] The pointer to the XHTML structure at the output
736 * destination is specified.
737 * @param node [i] The HTML tag node is specified.
738 * @return The conversion result is returned.
741 s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
743 xhtml_t *xhtml = GET_XHTML(pdoc);
744 Doc *doc = xhtml->doc;
746 /*--------------------------------------------------------------------------*/
747 /* Add XML Declare */
748 /*--------------------------------------------------------------------------*/
749 W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
751 /*--------------------------------------------------------------------------*/
753 /*--------------------------------------------------------------------------*/
754 W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
756 W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
758 /*--------------------------------------------------------------------------*/
760 /*--------------------------------------------------------------------------*/
761 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
763 xhtml->start_html_flag = 1;
769 * It is a handler who processes the HTML tag.
771 * @param pdoc [i/o] The pointer to the XHTML structure at the output
772 * destination is specified.
773 * @param node [i] The HTML tag node is specified.
774 * @return The conversion result is returned.
777 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
779 xhtml_t *xhtml = GET_XHTML(pdoc);
780 Doc *doc = xhtml->doc;
787 * It is a handler who processes the META tag.
789 * @param pdoc [i/o] The pointer to the XHTML structure at the output
790 * destination is specified.
791 * @param node [i] The META tag node is specified.
792 * @return The conversion result is returned.
795 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
797 xhtml_t *xhtml = GET_XHTML(pdoc);
799 Doc *doc = xhtml->doc;
800 int content_type_flag = 0;
801 request_rec *r = doc->r;
804 /*--------------------------------------------------------------------------*/
806 /*--------------------------------------------------------------------------*/
807 for (attr = qs_get_attr(doc,node);
809 attr = qs_get_next_attr(doc,attr)) {
810 char *name = qs_get_attr_name(doc,attr);
811 char *value = qs_get_attr_value(doc,attr);
812 if (STRCASEEQ('n','N',"name", name) && value && *value) {
819 else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
825 if (STRCASEEQ('c','C', "content-type", value)) {
826 content_type_flag = 1;
829 else if (STRCASEEQ('c','C',"content", name) && value && *value) {
830 if (content_type_flag) {
834 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
852 * It is a handler who processes the META tag.
854 * @param pdoc [i/o] The pointer to the XHTML structure at the output
855 * destination is specified.
856 * @param node [i] The META tag node is specified.
857 * @return The conversion result is returned.
860 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child))
862 xhtml_t *xhtml = GET_XHTML(pdoc);
869 * It is a handler who processes the HEAD tag.
871 * @param pdoc [i/o] The pointer to the XHTML structure at the output
872 * destination is specified.
873 * @param node [i] The HEAD tag node is specified.
874 * @return The conversion result is returned.
877 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
879 xhtml_t *xhtml = GET_XHTML(pdoc);
880 Doc *doc = xhtml->doc;
888 * It is a handler who processes the HEAD tag.
890 * @param pdoc [i/o] The pointer to the XHTML structure at the output
891 * destination is specified.
892 * @param node [i] The HEAD tag node is specified.
893 * @return The conversion result is returned.
896 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
898 xhtml_t *xhtml = GET_XHTML(pdoc);
899 Doc *doc = xhtml->doc;
907 * It is a handler who processes the TITLE tag.
909 * @param pdoc [i/o] The pointer to the XHTML structure at the output
910 * destination is specified.
911 * @param node [i] The TITLE tag node is specified.
912 * @return The conversion result is returned.
915 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node))
917 xhtml_t *xhtml = GET_XHTML(pdoc);
918 Doc *doc = xhtml->doc;
926 * It is a handler who processes the TITLE tag.
928 * @param pdoc [i/o] The pointer to the XHTML structure at the output
929 * destination is specified.
930 * @param node [i] The TITLE tag node is specified.
931 * @return The conversion result is returned.
934 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
936 xhtml_t *xhtml = GET_XHTML(pdoc);
937 Doc *doc = xhtml->doc;
946 * It is a handler who processes the BASE tag.
948 * @param pdoc [i/o] The pointer to the XHTML structure at the output
949 * destination is specified.
950 * @param node [i] The BASE tag node is specified.
951 * @return The conversion result is returned.
954 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
956 xhtml_t *xhtml = GET_XHTML(pdoc);
958 Doc *doc = xhtml->doc;
961 /*--------------------------------------------------------------------------*/
963 /*--------------------------------------------------------------------------*/
964 for (attr = qs_get_attr(doc,node);
966 attr = qs_get_next_attr(doc,attr)) {
967 char *name = qs_get_attr_name(doc,attr);
968 char *value = qs_get_attr_value(doc,attr);
969 if (STRCASEEQ('h','H',"href",name)) {
983 * It is a handler who processes the BASE tag.
985 * @param pdoc [i/o] The pointer to the XHTML structure at the output
986 * destination is specified.
987 * @param node [i] The BASE tag node is specified.
988 * @return The conversion result is returned.
991 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
993 xhtml_t *xhtml = GET_XHTML(pdoc);
1000 * It is a handler who processes the BODY tag.
1002 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1003 * destination is specified.
1004 * @param node [i] The BODY tag node is specified.
1005 * @return The conversion result is returned.
1008 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
1010 xhtml_t *xhtml = GET_XHTML(pdoc);
1011 Doc *doc = xhtml->doc;
1013 char *attr_bgcolor = NULL;
1014 char *attr_text = NULL;
1015 char *attr_link = NULL;
1016 char *attr_style = NULL;
1018 /*--------------------------------------------------------------------------*/
1019 /* Get Attributes */
1020 /*--------------------------------------------------------------------------*/
1021 for (attr = qs_get_attr(doc,node);
1023 attr = qs_get_next_attr(doc,attr)) {
1024 char *name = qs_get_attr_name(doc,attr);
1025 char *value = qs_get_attr_value(doc,attr);
1026 if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
1027 attr_bgcolor = value;
1029 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1032 else if (STRCASEEQ('l','L',"link", name) && value && *value) {
1035 else if (STRCASEEQ('a','A',"alink", name)) {
1038 else if (STRCASEEQ('v','V',"vlink",name)) {
1041 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1046 if (IS_CSS_ON(xhtml->entryp)) {
1047 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1049 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1050 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1051 css_property_t *cur;
1052 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1053 if (cur->value && *cur->value) {
1054 attr_text = apr_pstrdup(doc->pool, cur->value);
1057 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1058 if (cur->value && *cur->value) {
1059 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1064 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
1065 css_selector_t *cur_sel;
1066 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1067 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1068 css_property_t *cur;
1069 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1070 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1071 attr_link = apr_pstrdup(doc->pool, cur->value);
1080 if (attr_bgcolor || attr_text) {
1083 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1084 W_L("background-color:");
1089 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1097 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1109 * It is a handler who processes the BODY tag.
1111 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1112 * destination is specified.
1113 * @param node [i] The BODY tag node is specified.
1114 * @return The conversion result is returned.
1117 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
1119 xhtml_t *xhtml = GET_XHTML(pdoc);
1120 Doc *doc = xhtml->doc;
1123 if (IS_CSS_ON(xhtml->entryp)) {
1124 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1132 * It is a handler who processes the A tag.
1134 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1135 * destination is specified.
1136 * @param node [i] The A tag node is specified.
1137 * @return The conversion result is returned.
1140 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
1142 xhtml_t *xhtml = GET_XHTML(pdoc);
1143 Doc *doc = xhtml->doc;
1144 request_rec *r = doc->r;
1146 char *attr_style = NULL;
1149 /*--------------------------------------------------------------------------*/
1150 /* Get Attributes */
1151 /*--------------------------------------------------------------------------*/
1152 for (attr = qs_get_attr(doc,node);
1154 attr = qs_get_next_attr(doc,attr)) {
1155 char* name = qs_get_attr_name(doc,attr);
1156 char* value = qs_get_attr_value(doc,attr);
1157 if (STRCASEEQ('n','N',"name",name) && value && *value) {
1162 else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1163 value = chxj_encoding_parameter(r, value, 1);
1164 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1165 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
1171 else if (STRCASEEQ('a','A',"accesskey", name)) {
1172 W_L(" accesskey=\"");
1176 else if (STRCASEEQ('c','C',"cti",name)) {
1179 else if (STRCASEEQ('i','I',"ijam", name)) {
1182 else if (STRCASEEQ('u','U',"utn", name)) {
1185 else if (STRCASEEQ('t','T',"telbook",name)) {
1188 else if (STRCASEEQ('k','K',"kana",name)) {
1191 else if (STRCASEEQ('e','E',"email",name)) {
1194 else if (STRCASEEQ('i','I',"ista",name)) {
1197 else if (STRCASEEQ('i','I',"ilet",name)) {
1200 else if (STRCASEEQ('i','I',"iswf",name)) {
1203 else if (STRCASEEQ('i','I',"irst",name)) {
1206 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1212 if (IS_CSS_ON(xhtml->entryp)) {
1213 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1221 * It is a handler who processes the A tag.
1223 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1224 * destination is specified.
1225 * @param node [i] The A tag node is specified.
1226 * @return The conversion result is returned.
1229 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
1231 xhtml_t *xhtml = GET_XHTML(pdoc);
1232 Doc *doc = xhtml->doc;
1236 if (IS_CSS_ON(xhtml->entryp)) {
1237 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1245 * It is a handler who processes the BR tag.
1247 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1248 * destination is specified.
1249 * @param node [i] The BR tag node is specified.
1250 * @return The conversion result is returned.
1253 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
1255 xhtml_t *xhtml = GET_XHTML(pdoc);
1256 Doc *doc = xhtml->doc;
1260 /*--------------------------------------------------------------------------*/
1261 /* Get Attributes */
1262 /*--------------------------------------------------------------------------*/
1263 for (attr = qs_get_attr(doc,node);
1265 attr = qs_get_next_attr(doc,attr)) {
1266 char *name = qs_get_attr_name(doc,attr);
1267 char *value = qs_get_attr_value(doc,attr);
1268 if (STRCASEEQ('c','C',"clear",name)) {
1269 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1283 * It is a handler who processes the BR tag.
1285 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1286 * destination is specified.
1287 * @param node [i] The BR tag node is specified.
1288 * @return The conversion result is returned.
1291 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1293 xhtml_t *xhtml = GET_XHTML(pdoc);
1300 * It is a handler who processes the TR tag.
1302 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1303 * destination is specified.
1304 * @param node [i] The TR tag node is specified.
1305 * @return The conversion result is returned.
1308 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1310 xhtml_t *xhtml = GET_XHTML(pdoc);
1311 Doc *doc = xhtml->doc;
1320 * It is a handler who processes the TR tag.
1322 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1323 * destination is specified.
1324 * @param node [i] The TR tag node is specified.
1325 * @return The conversion result is returned.
1328 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1330 xhtml_t *xhtml = GET_XHTML(pdoc);
1337 * It is a handler who processes the FONT tag.
1339 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1340 * destination is specified.
1341 * @param node [i] The FONT tag node is specified.
1342 * @return The conversion result is returned.
1345 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1347 xhtml_t *xhtml = GET_XHTML(pdoc);
1348 Doc *doc = xhtml->doc;
1350 char *attr_color = NULL;
1351 char *attr_size = NULL;
1352 char *attr_style = NULL;
1354 /*--------------------------------------------------------------------------*/
1355 /* Get Attributes */
1356 /*--------------------------------------------------------------------------*/
1357 for (attr = qs_get_attr(doc,node);
1359 attr = qs_get_next_attr(doc,attr)) {
1360 char *name = qs_get_attr_name(doc,attr);
1361 char *value = qs_get_attr_value(doc,attr);
1362 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1363 attr_color = apr_pstrdup(doc->buf.pool, value);
1365 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1366 /*----------------------------------------------------------------------*/
1368 /*----------------------------------------------------------------------*/
1369 attr_size = apr_pstrdup(doc->buf.pool, value);
1371 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1372 attr_style = apr_pstrdup(doc->buf.pool, value);
1375 if (IS_CSS_ON(xhtml->entryp)) {
1376 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1378 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1379 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1380 css_property_t *cur;
1381 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1382 if (cur->value && *cur->value) {
1383 attr_color = apr_pstrdup(doc->pool, cur->value);
1386 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1387 if (cur->value && *cur->value) {
1388 attr_size = apr_pstrdup(doc->pool, cur->value);
1389 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1390 attr_size = apr_pstrdup(doc->pool, "1");
1392 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1393 attr_size = apr_pstrdup(doc->pool, "2");
1395 else if (STRCASEEQ('s','S',"small",attr_size)) {
1396 attr_size = apr_pstrdup(doc->pool, "3");
1398 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1399 attr_size = apr_pstrdup(doc->pool, "4");
1401 else if (STRCASEEQ('l','L',"large",attr_size)) {
1402 attr_size = apr_pstrdup(doc->pool, "5");
1404 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1405 attr_size = apr_pstrdup(doc->pool, "6");
1407 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1408 attr_size = apr_pstrdup(doc->pool, "7");
1415 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1416 memset(flg, 0, sizeof(*flg));
1418 W_L("<font color=\"");
1421 flg->font_color_flag = 1;
1424 flg->font_size_flag = 1;
1425 switch(*attr_size) {
1426 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1427 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1428 case '3': W_L("<span style=\"font-size: small\">"); break;
1429 case '4': W_L("<span style=\"font-size: medium\">"); break;
1430 case '5': W_L("<span style=\"font-size: large\">"); break;
1431 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1432 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1434 if (*(attr_size + 1) == '1') {
1435 W_L("<span style=\"font-size: small\">");
1438 if (*(attr_size + 1) == '2') {
1439 W_L("<span style=\"font-size: x-small\">");
1442 if (*(attr_size + 1) == '3') {
1443 W_L("<span style=\"font-size: xx-small\">");
1446 flg->font_size_flag = 0;
1450 if (*(attr_size + 1) == '1') {
1451 W_L("<span style=\"font-size: large\">");
1454 if (*(attr_size + 1) == '2') {
1455 W_L("<span style=\"font-size: x-large\">");
1458 if (*(attr_size + 1) == '3') {
1459 W_L("<span style=\"font-size: xx-large\">");
1462 flg->font_size_flag = 0;
1466 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1467 flg->font_size_flag = 0;
1470 node->userData = flg;
1477 * It is a handler who processes the FONT tag.
1479 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1480 * destination is specified.
1481 * @param node [i] The FONT tag node is specified.
1482 * @return The conversion result is returned.
1485 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
1487 xhtml_t *xhtml = GET_XHTML(pdoc);
1488 Doc *doc = xhtml->doc;
1490 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1491 if (flg && flg->font_size_flag) {
1494 if (flg && flg->font_color_flag) {
1497 if (IS_CSS_ON(xhtml->entryp)) {
1498 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1505 * It is a handler who processes the FORM tag.
1507 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1508 * destination is specified.
1509 * @param node [i] The FORM tag node is specified.
1510 * @return The conversion result is returned.
1513 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1515 xhtml_t *xhtml = GET_XHTML(pdoc);
1516 Doc *doc = xhtml->doc;
1517 request_rec *r = doc->r;
1519 char *attr_action = NULL;
1520 char *attr_method = NULL;
1521 char *attr_style = NULL;
1522 char *attr_color = NULL;
1523 char *attr_align = NULL;
1524 char *attr_name = NULL;
1525 char *new_hidden_tag = NULL;
1527 /*--------------------------------------------------------------------------*/
1528 /* Get Attributes */
1529 /*--------------------------------------------------------------------------*/
1530 for (attr = qs_get_attr(doc,node);
1532 attr = qs_get_next_attr(doc,attr)) {
1533 char *name = qs_get_attr_name(doc,attr);
1534 char *value = qs_get_attr_value(doc,attr);
1538 if (strcasecmp(name, "action") == 0) {
1539 /*--------------------------------------------------------------------*/
1541 /*--------------------------------------------------------------------*/
1542 attr_action = value;
1548 if (strcasecmp(name, "method") == 0) {
1549 /*--------------------------------------------------------------------*/
1551 /*--------------------------------------------------------------------*/
1552 attr_method = value;
1558 if (strcasecmp(name, "name") == 0) {
1559 /*--------------------------------------------------------------------*/
1561 /*--------------------------------------------------------------------*/
1568 if (strcasecmp(name, "style") == 0) {
1577 if (IS_CSS_ON(xhtml->entryp)) {
1578 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1580 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1581 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1582 css_property_t *cur;
1583 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1584 if (STRCASEEQ('l','L',"left", cur->value)) {
1585 attr_align = apr_pstrdup(doc->pool, "left");
1587 else if (STRCASEEQ('c','C',"center",cur->value)) {
1588 attr_align = apr_pstrdup(doc->pool, "center");
1590 else if (STRCASEEQ('r','R',"right",cur->value)) {
1591 attr_align = apr_pstrdup(doc->pool, "right");
1594 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1595 attr_color = apr_pstrdup(doc->pool, cur->value);
1600 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1604 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1605 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1607 char *old_qs = NULL;
1608 q = strchr(attr_action, '?');
1610 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);
1611 if (new_hidden_tag || old_qs) {
1635 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
1636 memset(flg, 0, sizeof(*flg));
1638 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1639 W_L("<font color=\"");
1642 flg->with_font_flag = 1;
1645 W_L("<div align=\"");
1648 flg->with_div_flag = 1;
1650 node->userData = flg;
1651 if (new_hidden_tag) {
1652 W_V(new_hidden_tag);
1659 * It is a handler who processes the FORM tag.
1661 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1662 * destination is specified.
1663 * @param node [i] The FORM tag node is specified.
1664 * @return The conversion result is returned.
1667 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
1669 xhtml_t *xhtml = GET_XHTML(pdoc);
1670 Doc *doc = xhtml->doc;
1672 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1673 if (flg && flg->with_div_flag) {
1676 if (flg && flg->with_font_flag) {
1680 if (IS_CSS_ON(xhtml->entryp)) {
1681 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1689 * It is a handler who processes the INPUT tag.
1691 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1692 * destination is specified.
1693 * @param node [i] The INPUT tag node is specified.
1694 * @return The conversion result is returned.
1697 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1699 xhtml_t *xhtml = GET_XHTML(pdoc);
1700 Doc *doc = xhtml->doc;
1701 request_rec *r = doc->r;
1703 char *attr_max_length = NULL;
1704 char *attr_type = NULL;
1705 char *attr_name = NULL;
1706 char *attr_value = NULL;
1707 char *attr_istyle = NULL;
1708 char *attr_size = NULL;
1709 char *attr_checked = NULL;
1710 char *attr_accesskey = NULL;
1711 char *attr_style = NULL;
1713 /*--------------------------------------------------------------------------*/
1714 /* Get Attributes */
1715 /*--------------------------------------------------------------------------*/
1716 for (attr = qs_get_attr(doc,node);
1718 attr = qs_get_next_attr(doc,attr)) {
1719 char *name = qs_get_attr_name(doc,attr);
1720 char *value = qs_get_attr_value(doc,attr);
1721 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1722 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1723 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1724 STRCASEEQ('p','P',"password",tmp_type) ||
1725 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1726 STRCASEEQ('r','R',"radio", tmp_type) ||
1727 STRCASEEQ('h','H',"hidden", tmp_type) ||
1728 STRCASEEQ('s','S',"submit", tmp_type) ||
1729 STRCASEEQ('r','R',"reset", tmp_type))) {
1730 attr_type = tmp_type;
1733 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1736 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1739 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1740 attr_istyle = value;
1742 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1743 attr_max_length = value;
1745 else if (STRCASEEQ('c','C',"checked", name)) {
1746 attr_checked = value;
1748 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1749 attr_accesskey = value;
1751 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1754 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1759 if (IS_CSS_ON(xhtml->entryp)) {
1760 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1762 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1763 css_property_t *cur;
1764 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1765 if (strcasestr(cur->value, "<ja:n>")) {
1768 else if (strcasestr(cur->value, "<ja:en>")) {
1771 else if (strcasestr(cur->value, "<ja:hk>")) {
1774 else if (strcasestr(cur->value, "<ja:h>")) {
1782 attr_type = qs_trim_string(doc->buf.pool, attr_type);
1783 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
1784 STRCASEEQ('p','P',"password",attr_type) ||
1785 STRCASEEQ('c','C',"checkbox",attr_type) ||
1786 STRCASEEQ('r','R',"radio", attr_type) ||
1787 STRCASEEQ('h','H',"hidden", attr_type) ||
1788 STRCASEEQ('s','S',"submit", attr_type) ||
1789 STRCASEEQ('r','R',"reset", attr_type))) {
1795 if (attr_size && *attr_size) {
1800 if (attr_name && *attr_name) {
1805 if (attr_value && *attr_value) {
1807 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1810 if (attr_accesskey && *attr_accesskey) {
1811 W_L(" accesskey=\"");
1812 W_V(attr_accesskey);
1815 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1816 char *fmt = qs_conv_istyle_to_format(r->pool,attr_istyle);
1817 if (attr_max_length && *attr_max_length) {
1819 for (ii=0; (unsigned int)ii<strlen(attr_max_length); ii++) {
1820 if (attr_max_length[ii] < '0' || attr_max_length[ii] > '9') {
1821 attr_max_length = apr_psprintf(r->pool, "0");
1826 if (strcmp(attr_max_length, "0")) {
1827 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(attr_max_length), fmt);
1839 if (attr_max_length && *attr_max_length) {
1840 if (chxj_chk_numeric(attr_max_length) != 0) {
1841 attr_max_length = apr_psprintf(r->pool, "0");
1843 if (strcmp(attr_max_length, "0")) {
1844 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(attr_max_length));
1849 /*--------------------------------------------------------------------------*/
1850 /* The figure is default for the password. */
1851 /*--------------------------------------------------------------------------*/
1852 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
1853 if (attr_max_length) {
1855 W_V(attr_max_length);
1859 W_L(" FORMAT=\"*N\"");
1863 W_L(" checked=\"checked\"");
1868 /*--------------------------------------------------------------------------*/
1869 /* Get Attributes */
1870 /*--------------------------------------------------------------------------*/
1871 type = qs_get_type_attr(doc, node, doc->buf.pool);
1872 name = qs_get_name_attr(doc, node, doc->buf.pool);
1873 value = qs_get_value_attr(doc,node, doc->buf.pool);
1874 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1875 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1876 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1877 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1878 size = qs_get_size_attr(doc, node, doc->buf.pool);
1881 type = qs_trim_string(doc->buf.pool, type);
1882 if (type && (STRCASEEQ('t','T',"text", type) ||
1883 STRCASEEQ('p','P',"password",type) ||
1884 STRCASEEQ('c','C',"checkbox",type) ||
1885 STRCASEEQ('r','R',"radio", type) ||
1886 STRCASEEQ('h','H',"hidden", type) ||
1887 STRCASEEQ('s','S',"submit", type) ||
1888 STRCASEEQ('r','R',"reset", type))) {
1894 if (size && *size) {
1899 if (name && *name) {
1904 if (value && *value) {
1905 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
1906 apr_size_t value_len = strlen(value);
1907 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
1911 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1914 if (accesskey && *accesskey) {
1915 W_L(" accesskey=\"");
1919 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1920 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
1921 if (max_length && *max_length) {
1923 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1924 if (max_length[ii] < '0' || max_length[ii] > '9') {
1925 max_length = apr_psprintf(r->pool, "0");
1930 if (strcmp(max_length, "0")) {
1931 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1943 if (max_length && *max_length) {
1944 if (chxj_chk_numeric(max_length) != 0) {
1945 max_length = apr_psprintf(r->pool, "0");
1947 if (strcmp(max_length, "0")) {
1948 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1953 /*--------------------------------------------------------------------------*/
1954 /* The figure is default for the password. */
1955 /*--------------------------------------------------------------------------*/
1956 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1963 W_L(" FORMAT=\"*N\"");
1967 W_L(" checked=\"checked\"");
1977 * It is a handler who processes the INPUT tag.
1979 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1980 * destination is specified.
1981 * @param node [i] The INPUT tag node is specified.
1982 * @return The conversion result is returned.
1985 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
1987 xhtml_t *xhtml = GET_XHTML(pdoc);
1994 * It is a handler who processes the CENTER tag.
1996 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1997 * destination is specified.
1998 * @param node [i] The CENTER tag node is specified.
1999 * @return The conversion result is returned.
2002 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2007 char *attr_style = NULL;
2008 char *attr_color = NULL;
2009 char *attr_size = NULL;
2011 xhtml = GET_XHTML(pdoc);
2014 for (attr = qs_get_attr(doc,node);
2016 attr = qs_get_next_attr(doc,attr)) {
2017 char *name = qs_get_attr_name(doc,attr);
2018 char *value = qs_get_attr_value(doc,attr);
2019 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2023 if (IS_CSS_ON(xhtml->entryp)) {
2024 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2026 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2027 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2028 css_property_t *cur;
2029 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2030 if (cur->value && *cur->value) {
2031 attr_color = apr_pstrdup(doc->pool, cur->value);
2034 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2035 if (cur->value && *cur->value) {
2036 attr_size = apr_pstrdup(doc->pool, cur->value);
2043 if (attr_size || attr_color) {
2051 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2065 * It is a handler who processes the CENTER tag.
2067 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2068 * destination is specified.
2069 * @param node [i] The CENTER tag node is specified.
2070 * @return The conversion result is returned.
2073 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2075 xhtml_t *xhtml = GET_XHTML(pdoc);
2076 Doc *doc = xhtml->doc;
2079 if (IS_CSS_ON(xhtml->entryp)) {
2080 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2087 * It is a handler who processes the HR tag.
2089 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2090 * destination is specified.
2091 * @param node [i] The HR tag node is specified.
2092 * @return The conversion result is returned.
2095 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2101 char *attr_align = NULL;
2102 char *attr_size = NULL;
2103 char *attr_width = NULL;
2104 char *attr_noshade = NULL;
2105 char *attr_style = NULL;
2106 char *attr_color = NULL;
2108 xhtml = GET_XHTML(pdoc);
2112 for (attr = qs_get_attr(doc,node);
2114 attr = qs_get_next_attr(doc,attr)) {
2115 char *name = qs_get_attr_name (doc,attr);
2116 char *value = qs_get_attr_value(doc,attr);
2120 if (strcasecmp(name, "align") == 0) {
2121 /*--------------------------------------------------------------------*/
2123 /*--------------------------------------------------------------------*/
2124 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2132 if (strcasecmp(name, "size") == 0) {
2133 /*--------------------------------------------------------------------*/
2135 /*--------------------------------------------------------------------*/
2136 if (value && *value) {
2140 else if (strcasecmp(name, "style") == 0) {
2141 if (value && *value) {
2149 if (strcasecmp(name, "width") == 0) {
2150 /*--------------------------------------------------------------------*/
2152 /*--------------------------------------------------------------------*/
2153 if (value && *value) {
2161 if (strcasecmp(name, "noshade") == 0) {
2162 /*--------------------------------------------------------------------*/
2164 /*--------------------------------------------------------------------*/
2165 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2171 if (strcasecmp(name, "color") == 0 && value && *value) {
2172 /*--------------------------------------------------------------------*/
2174 /*--------------------------------------------------------------------*/
2183 if (IS_CSS_ON(xhtml->entryp)) {
2184 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2186 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2187 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2188 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2189 css_property_t *cur;
2190 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2191 if (STRCASEEQ('s','S',"solid",cur->value)) {
2192 attr_noshade = "noshade";
2195 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2196 char *tmp = apr_pstrdup(doc->pool, cur->value);
2197 char *tmpp = strstr(tmp, "px");
2199 attr_size = apr_pstrdup(doc->pool, tmp);
2202 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2203 char *tmp = apr_pstrdup(doc->pool, cur->value);
2204 char *tmpp = strstr(tmp, "px");
2206 attr_width = apr_pstrdup(doc->pool, tmp);
2209 tmpp = strstr(tmp, "%");
2211 attr_width = apr_pstrdup(doc->pool, tmp);
2223 if (attr_size || attr_width || attr_noshade) {
2228 if (!strstr(attr_size, "px")) {
2236 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2242 W_L("border-style:solid;");
2258 * It is a handler who processes the HR tag.
2260 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2261 * destination is specified.
2262 * @param node [i] The HR tag node is specified.
2263 * @return The conversion result is returned.
2266 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2268 xhtml_t *xhtml = GET_XHTML(pdoc);
2275 * It is a handler who processes the PRE tag.
2277 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2278 * destination is specified.
2279 * @param node [i] The PRE tag node is specified.
2280 * @return The conversion result is returned.
2283 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2285 xhtml_t *xhtml = GET_XHTML(pdoc);
2286 Doc *doc = xhtml->doc;
2288 char *attr_style = NULL;
2290 for (attr = qs_get_attr(doc,node);
2292 attr = qs_get_next_attr(doc,attr)) {
2293 char *nm = qs_get_attr_name(doc,attr);
2294 char *val = qs_get_attr_value(doc,attr);
2295 if (val && STRCASEEQ('s','S',"style", nm)) {
2300 if (IS_CSS_ON(xhtml->entryp)) {
2301 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2311 * It is a handler who processes the PRE tag.
2313 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2314 * destination is specified.
2315 * @param node [i] The PRE tag node is specified.
2316 * @return The conversion result is returned.
2319 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2321 xhtml_t *xhtml = GET_XHTML(pdoc);
2322 Doc *doc = xhtml->doc;
2326 if (IS_CSS_ON(xhtml->entryp)) {
2327 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2335 * It is a handler who processes the P tag.
2337 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2338 * destination is specified.
2339 * @param node [i] The P tag node is specified.
2340 * @return The conversion result is returned.
2343 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2345 xhtml_t *xhtml = GET_XHTML(pdoc);
2346 Doc *doc = xhtml->doc;
2348 char *attr_align = NULL;
2349 char *attr_style = NULL;
2350 char *attr_color = NULL;
2351 char *attr_blink = NULL;
2353 for (attr = qs_get_attr(doc,node);
2355 attr = qs_get_next_attr(doc,attr)) {
2356 char *nm = qs_get_attr_name(doc,attr);
2357 char *val = qs_get_attr_value(doc,attr);
2358 if (STRCASEEQ('a','A',"align", nm)) {
2359 /*----------------------------------------------------------------------*/
2360 /* CHTML 1.0 (W3C version 3.2) */
2361 /*----------------------------------------------------------------------*/
2362 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2363 attr_align = apr_pstrdup(doc->buf.pool, val);
2367 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2368 attr_style = apr_pstrdup(doc->buf.pool, val);
2371 if (IS_CSS_ON(xhtml->entryp)) {
2372 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2374 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2375 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2376 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2377 css_property_t *cur;
2378 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2379 if (STRCASEEQ('l','L',"left",cur->value)) {
2380 attr_align = apr_pstrdup(doc->pool, "left");
2382 else if (STRCASEEQ('c','C',"center",cur->value)) {
2383 attr_align = apr_pstrdup(doc->pool, "center");
2385 else if (STRCASEEQ('r','R',"right",cur->value)) {
2386 attr_align = apr_pstrdup(doc->pool, "right");
2389 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2390 if (cur->value && *cur->value) {
2391 attr_color = apr_pstrdup(doc->pool, cur->value);
2394 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2395 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2396 attr_blink = apr_pstrdup(doc->pool, cur->value);
2402 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
2410 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2416 W_L("text-decoration:");
2428 * It is a handler who processes the P tag.
2430 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2431 * destination is specified.
2432 * @param node [i] The P tag node is specified.
2433 * @return The conversion result is returned.
2436 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
2438 xhtml_t *xhtml = GET_XHTML(pdoc);
2439 Doc *doc = xhtml->doc;
2442 if (IS_CSS_ON(xhtml->entryp)) {
2443 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2450 * It is a handler who processes the UL tag.
2452 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2453 * destination is specified.
2454 * @param node [i] The UL tag node is specified.
2455 * @return The conversion result is returned.
2458 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
2460 xhtml_t *xhtml = GET_XHTML(pdoc);
2461 Doc *doc = xhtml->doc;
2463 char *attr_type = NULL;
2464 char *attr_style = NULL;
2465 /*--------------------------------------------------------------------------*/
2466 /* Get Attributes */
2467 /*--------------------------------------------------------------------------*/
2468 for (attr = qs_get_attr(doc,node);
2470 attr = qs_get_next_attr(doc,attr)) {
2471 char *name = qs_get_attr_name(doc,attr);
2472 char *value = qs_get_attr_value(doc,attr);
2473 if (STRCASEEQ('t','T',"type",name)) {
2474 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2478 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2482 if (IS_CSS_ON(xhtml->entryp)) {
2483 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2485 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2486 css_property_t *cur;
2487 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2488 if (STRCASEEQ('d','D',"disc",cur->value)) {
2489 attr_type = apr_pstrdup(doc->pool, "disc");
2491 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2492 attr_type = apr_pstrdup(doc->pool, "circle");
2494 else if (STRCASEEQ('s','S',"square",cur->value)) {
2495 attr_type = apr_pstrdup(doc->pool, "square");
2503 W_L("list-style-type:");
2514 * It is a handler who processes the UL tag.
2516 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2517 * destination is specified.
2518 * @param node [i] The UL tag node is specified.
2519 * @return The conversion result is returned.
2522 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
2524 xhtml_t *xhtml = GET_XHTML(pdoc);
2525 Doc *doc = xhtml->doc;
2528 if (IS_CSS_ON(xhtml->entryp)) {
2529 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2536 * It is a handler who processes the H1 tag.
2538 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2539 * destination is specified.
2540 * @param node [i] The H1 tag node is specified.
2541 * @return The conversion result is returned.
2544 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
2546 xhtml_t *xhtml = GET_XHTML(pdoc);
2547 Doc *doc = xhtml->doc;
2549 char *attr_style = NULL;
2550 char *attr_align = NULL;
2552 for (attr = qs_get_attr(doc,node);
2554 attr = qs_get_next_attr(doc,attr)) {
2555 char *name = qs_get_attr_name(doc,attr);
2556 char *value = qs_get_attr_value(doc,attr);
2557 if (STRCASEEQ('a','A',"align", name)) {
2558 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2562 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2566 if (IS_CSS_ON(xhtml->entryp)) {
2567 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2569 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2570 css_property_t *cur;
2571 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2572 if (STRCASEEQ('l','L',"left", cur->value)) {
2573 attr_align = apr_pstrdup(doc->pool, "left");
2575 else if (STRCASEEQ('c','C',"center",cur->value)) {
2576 attr_align = apr_pstrdup(doc->pool, "center");
2578 else if (STRCASEEQ('r','R',"right",cur->value)) {
2579 attr_align = apr_pstrdup(doc->pool, "right");
2599 * It is a handler who processes the H1 tag.
2601 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2602 * destination is specified.
2603 * @param node [i] The H1 tag node is specified.
2604 * @return The conversion result is returned.
2607 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
2609 xhtml_t *xhtml = GET_XHTML(pdoc);
2610 Doc *doc = xhtml->doc;
2613 if (IS_CSS_ON(xhtml->entryp)) {
2614 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2621 * It is a handler who processes the H2 tag.
2623 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2624 * destination is specified.
2625 * @param node [i] The H2 tag node is specified.
2626 * @return The conversion result is returned.
2629 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
2631 xhtml_t *xhtml = GET_XHTML(pdoc);
2632 Doc *doc = xhtml->doc;
2634 char *attr_style = NULL;
2635 char *attr_align = NULL;
2637 for (attr = qs_get_attr(doc,node);
2639 attr = qs_get_next_attr(doc,attr)) {
2640 char *name = qs_get_attr_name(doc,attr);
2641 char *value = qs_get_attr_value(doc,attr);
2642 if (STRCASEEQ('a','A',"align", name)) {
2643 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2647 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2651 if (IS_CSS_ON(xhtml->entryp)) {
2652 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2654 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2655 css_property_t *cur;
2656 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2657 if (STRCASEEQ('l','L',"left", cur->value)) {
2658 attr_align = apr_pstrdup(doc->pool, "left");
2660 else if (STRCASEEQ('c','C',"center",cur->value)) {
2661 attr_align = apr_pstrdup(doc->pool, "center");
2663 else if (STRCASEEQ('r','R',"right",cur->value)) {
2664 attr_align = apr_pstrdup(doc->pool, "right");
2684 * It is a handler who processes the H2 tag.
2686 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2687 * destination is specified.
2688 * @param node [i] The H2 tag node is specified.
2689 * @return The conversion result is returned.
2692 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2694 xhtml_t *xhtml = GET_XHTML(pdoc);
2695 Doc *doc = xhtml->doc;
2698 if (IS_CSS_ON(xhtml->entryp)) {
2699 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2706 * It is a handler who processes the H3 tag.
2708 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2709 * destination is specified.
2710 * @param node [i] The H3 tag node is specified.
2711 * @return The conversion result is returned.
2714 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2716 xhtml_t *xhtml = GET_XHTML(pdoc);
2717 Doc *doc = xhtml->doc;
2719 char *attr_style = NULL;
2720 char *attr_align = NULL;
2722 for (attr = qs_get_attr(doc,node);
2724 attr = qs_get_next_attr(doc,attr)) {
2725 char *name = qs_get_attr_name(doc,attr);
2726 char *value = qs_get_attr_value(doc,attr);
2727 if (STRCASEEQ('a','A',"align", name)) {
2728 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2732 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2736 if (IS_CSS_ON(xhtml->entryp)) {
2737 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2739 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2740 css_property_t *cur;
2741 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2742 if (STRCASEEQ('l','L',"left", cur->value)) {
2743 attr_align = apr_pstrdup(doc->pool, "left");
2745 else if (STRCASEEQ('c','C',"center",cur->value)) {
2746 attr_align = apr_pstrdup(doc->pool, "center");
2748 else if (STRCASEEQ('r','R',"right",cur->value)) {
2749 attr_align = apr_pstrdup(doc->pool, "right");
2769 * It is a handler who processes the H3 tag.
2771 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2772 * destination is specified.
2773 * @param node [i] The H3 tag node is specified.
2774 * @return The conversion result is returned.
2777 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2779 xhtml_t *xhtml = GET_XHTML(pdoc);
2780 Doc *doc = xhtml->doc;
2783 if (IS_CSS_ON(xhtml->entryp)) {
2784 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2792 * It is a handler who processes the H4 tag.
2794 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2795 * destination is specified.
2796 * @param node [i] The H4 tag node is specified.
2797 * @return The conversion result is returned.
2800 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2802 xhtml_t *xhtml = GET_XHTML(pdoc);
2803 Doc *doc = xhtml->doc;
2805 char *attr_style = NULL;
2806 char *attr_align = NULL;
2808 for (attr = qs_get_attr(doc,node);
2810 attr = qs_get_next_attr(doc,attr)) {
2811 char *name = qs_get_attr_name(doc,attr);
2812 char *value = qs_get_attr_value(doc,attr);
2813 if (STRCASEEQ('a','A',"align", name)) {
2814 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2818 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2822 if (IS_CSS_ON(xhtml->entryp)) {
2823 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2825 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2826 css_property_t *cur;
2827 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2828 if (STRCASEEQ('l','L',"left", cur->value)) {
2829 attr_align = apr_pstrdup(doc->pool, "left");
2831 else if (STRCASEEQ('c','C',"center",cur->value)) {
2832 attr_align = apr_pstrdup(doc->pool, "center");
2834 else if (STRCASEEQ('r','R',"right",cur->value)) {
2835 attr_align = apr_pstrdup(doc->pool, "right");
2855 * It is a handler who processes the H4 tag.
2857 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2858 * destination is specified.
2859 * @param node [i] The H4 tag node is specified.
2860 * @return The conversion result is returned.
2863 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
2865 xhtml_t *xhtml = GET_XHTML(pdoc);
2866 Doc *doc = xhtml->doc;
2869 if (IS_CSS_ON(xhtml->entryp)) {
2870 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2878 * It is a handler who processes the H5 tag.
2880 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2881 * destination is specified.
2882 * @param node [i] The H5 tag node is specified.
2883 * @return The conversion result is returned.
2886 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
2888 xhtml_t *xhtml = GET_XHTML(pdoc);
2889 Doc *doc = xhtml->doc;
2891 char *attr_style = NULL;
2892 char *attr_align = NULL;
2894 for (attr = qs_get_attr(doc,node);
2896 attr = qs_get_next_attr(doc,attr)) {
2897 char *name = qs_get_attr_name(doc,attr);
2898 char *value = qs_get_attr_value(doc,attr);
2899 if (STRCASEEQ('a','A',"align", name)) {
2900 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2904 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2908 if (IS_CSS_ON(xhtml->entryp)) {
2909 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2911 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2912 css_property_t *cur;
2913 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2914 if (STRCASEEQ('l','L',"left", cur->value)) {
2915 attr_align = apr_pstrdup(doc->pool, "left");
2917 else if (STRCASEEQ('c','C',"center",cur->value)) {
2918 attr_align = apr_pstrdup(doc->pool, "center");
2920 else if (STRCASEEQ('r','R',"right",cur->value)) {
2921 attr_align = apr_pstrdup(doc->pool, "right");
2941 * It is a handler who processes the H5 tag.
2943 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2944 * destination is specified.
2945 * @param node [i] The H5 tag node is specified.
2946 * @return The conversion result is returned.
2949 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
2951 xhtml_t *xhtml = GET_XHTML(pdoc);
2952 Doc *doc = xhtml->doc;
2955 if (IS_CSS_ON(xhtml->entryp)) {
2956 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2964 * It is a handler who processes the H6 tag.
2966 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2967 * destination is specified.
2968 * @param node [i] The H6 tag node is specified.
2969 * @return The conversion result is returned.
2972 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2974 xhtml_t *xhtml = GET_XHTML(pdoc);
2975 Doc *doc = xhtml->doc;
2977 char *attr_style = NULL;
2978 char *attr_align = NULL;
2980 for (attr = qs_get_attr(doc,node);
2982 attr = qs_get_next_attr(doc,attr)) {
2983 char *name = qs_get_attr_name(doc,attr);
2984 char *value = qs_get_attr_value(doc,attr);
2985 if (STRCASEEQ('a','A',"align", name)) {
2986 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2990 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2994 if (IS_CSS_ON(xhtml->entryp)) {
2995 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2997 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2998 css_property_t *cur;
2999 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3000 if (STRCASEEQ('l','L',"left", cur->value)) {
3001 attr_align = apr_pstrdup(doc->pool, "left");
3003 else if (STRCASEEQ('c','C',"center",cur->value)) {
3004 attr_align = apr_pstrdup(doc->pool, "center");
3006 else if (STRCASEEQ('r','R',"right",cur->value)) {
3007 attr_align = apr_pstrdup(doc->pool, "right");
3027 * It is a handler who processes the H6 tag.
3029 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3030 * destination is specified.
3031 * @param node [i] The H6 tag node is specified.
3032 * @return The conversion result is returned.
3035 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3037 xhtml_t *xhtml = GET_XHTML(pdoc);
3038 Doc *doc = xhtml->doc;
3041 if (IS_CSS_ON(xhtml->entryp)) {
3042 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3050 * It is a handler who processes the OL tag.
3052 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3053 * destination is specified.
3054 * @param node [i] The OL tag node is specified.
3055 * @return The conversion result is returned.
3058 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3060 xhtml_t *xhtml = GET_XHTML(pdoc);
3061 Doc *doc = xhtml->doc;
3063 char *attr_style = NULL;
3064 char *attr_start = NULL;
3065 char *attr_type = NULL;
3067 /*--------------------------------------------------------------------------*/
3068 /* Get Attributes */
3069 /*--------------------------------------------------------------------------*/
3070 for (attr = qs_get_attr(doc,node);
3072 attr = qs_get_next_attr(doc,attr)) {
3073 char *name = qs_get_attr_name(doc,attr);
3074 char *value = qs_get_attr_value(doc,attr);
3075 if (STRCASEEQ('t','T',"type",name) && value) {
3076 if (*value == '1') {
3077 attr_type = apr_pstrdup(doc->pool, "decimal");
3079 else if (*value == 'a') {
3080 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3082 else if (*value == 'A') {
3083 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3086 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3089 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3093 if (IS_CSS_ON(xhtml->entryp)) {
3094 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3096 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3097 css_property_t *cur;
3098 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3099 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3100 attr_type = apr_pstrdup(doc->pool, "decimal");
3102 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3103 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3105 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3106 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3114 W_L("list-style-type:");
3131 * It is a handler who processes the OL tag.
3133 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3134 * destination is specified.
3135 * @param node [i] The OL tag node is specified.
3136 * @return The conversion result is returned.
3139 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3141 xhtml_t *xhtml = GET_XHTML(pdoc);
3142 Doc *doc = xhtml->doc;
3145 if (IS_CSS_ON(xhtml->entryp)) {
3146 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3154 * It is a handler who processes the LI tag.
3156 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3157 * destination is specified.
3158 * @param node [i] The LI tag node is specified.
3159 * @return The conversion result is returned.
3162 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3164 xhtml_t *xhtml = GET_XHTML(pdoc);
3165 Doc *doc = xhtml->doc;
3167 char *attr_type = NULL;
3168 char *attr_value = NULL;
3169 char *attr_style = NULL;
3171 for (attr = qs_get_attr(doc,node);
3173 attr = qs_get_next_attr(doc,attr)) {
3174 char *name = qs_get_attr_name(doc,attr);
3175 char *value = qs_get_attr_value(doc,attr);
3176 if (STRCASEEQ('t','T',"type",name)) {
3177 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3178 if (*value == '1') {
3179 attr_type = apr_pstrdup(doc->pool, "decimal");
3181 else if (*value == 'a') {
3182 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3184 else if (*value == 'A') {
3185 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3192 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3195 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3199 if (IS_CSS_ON(xhtml->entryp)) {
3200 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3202 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3203 css_property_t *cur;
3204 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3205 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3206 attr_type = apr_pstrdup(doc->pool, "decimal");
3208 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3209 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3211 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3212 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3214 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3215 attr_type = apr_pstrdup(doc->pool, "disc");
3217 else if (STRCASEEQ('s','S',"square", cur->value)) {
3218 attr_type = apr_pstrdup(doc->pool, "square");
3220 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3221 attr_type = apr_pstrdup(doc->pool, "circle");
3231 W_L("list-style-type:");
3247 ** It is a handler who processes the LI tag.
3249 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3250 * destination is specified.
3251 * @param node [i] The LI tag node is specified.
3252 * @return The conversion result is returned.
3255 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
3257 xhtml_t *xhtml = GET_XHTML(pdoc);
3258 Doc *doc = xhtml->doc;
3261 if (IS_CSS_ON(xhtml->entryp)) {
3262 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3268 * It is a handler who processes the IMG tag.
3270 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3271 * destination is specified.
3272 * @param node [i] The IMG tag node is specified.
3273 * @return The conversion result is returned.
3276 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
3278 xhtml_t *xhtml = GET_XHTML(pdoc);
3279 Doc *doc = xhtml->doc;
3280 request_rec *r = doc->r;
3282 char *attr_src = NULL;
3283 char *attr_alt = NULL;
3284 char *attr_height = NULL;
3285 char *attr_width = NULL;
3286 char *attr_align = NULL;
3287 char *attr_style = NULL;
3288 char *attr_hspace = NULL;
3289 char *attr_vspace = NULL;
3291 #ifndef IMG_NOT_CONVERT_FILENAME
3292 device_table *spec = xhtml->spec;
3295 /*--------------------------------------------------------------------------*/
3296 /* Get Attributes */
3297 /*--------------------------------------------------------------------------*/
3298 for (attr = qs_get_attr(doc,node);
3300 attr = qs_get_next_attr(doc,attr)) {
3301 char *name = qs_get_attr_name(doc,attr);
3302 char *value = qs_get_attr_value(doc,attr);
3304 if (STRCASEEQ('s','S',"src",name)) {
3305 value = chxj_encoding_parameter(r, value, 1);
3306 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
3307 value = chxj_add_cookie_no_update_parameter(r, value);
3308 #ifdef IMG_NOT_CONVERT_FILENAME
3314 attr_src = chxj_img_conv(r,spec,value);
3320 if (STRCASEEQ('a','A',"align",name)) {
3322 if (STRCASEEQ('t','T',"top", value) ||
3323 STRCASEEQ('m','M',"middle",value) ||
3324 STRCASEEQ('b','B',"bottom",value) ||
3325 STRCASEEQ('l','L',"left", value) ||
3326 STRCASEEQ('r','R',"right", value)) {
3329 else if (STRCASEEQ('c','C',"center", value)) {
3330 attr_align = apr_pstrdup(doc->pool, "middle");
3334 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3337 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3340 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3341 attr_height = value;
3343 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3344 attr_hspace = value;
3346 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3347 attr_vspace = value;
3349 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3354 if (IS_CSS_ON(xhtml->entryp)) {
3355 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3357 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3358 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3359 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3360 css_property_t *cur;
3361 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3362 attr_height = apr_pstrdup(doc->pool, cur->value);
3364 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3365 attr_width = apr_pstrdup(doc->pool, cur->value);
3367 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3368 attr_align = apr_pstrdup(doc->pool, cur->value);
3418 * It is a handler who processes the IMG tag.
3420 * @param xhtml [i/o] The pointer to the XHTML structure at the output
3421 * destination is specified.
3422 * @param node [i] The IMG tag node is specified.
3423 * @return The conversion result is returned.
3426 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
3428 xhtml_t *xhtml = GET_XHTML(pdoc);
3435 * It is a handler who processes the SELECT tag.
3437 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3438 * destination is specified.
3439 * @param node [i] The SELECT tag node is specified.
3440 * @return The conversion result is returned.
3443 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
3445 xhtml_t *xhtml = GET_XHTML(pdoc);
3446 Doc *doc = xhtml->doc;
3449 char *multiple = NULL;
3451 char *attr_style = NULL;
3454 for (attr = qs_get_attr(doc,node);
3456 attr = qs_get_next_attr(doc,attr)) {
3457 char *nm = qs_get_attr_name(doc,attr);
3458 char *val = qs_get_attr_value(doc,attr);
3459 if (STRCASEEQ('s','S',"size",nm)) {
3460 /*----------------------------------------------------------------------*/
3461 /* CHTML 1.0 version 2.0 */
3462 /*----------------------------------------------------------------------*/
3463 size = apr_pstrdup(doc->buf.pool, val);
3465 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3466 /*----------------------------------------------------------------------*/
3467 /* CHTML 1.0 version 2.0 */
3468 /*----------------------------------------------------------------------*/
3469 attr_style = apr_pstrdup(doc->buf.pool, val);
3471 else if (STRCASEEQ('n','N',"name",nm)) {
3472 /*----------------------------------------------------------------------*/
3473 /* CHTML 1.0 version 2.0 */
3474 /*----------------------------------------------------------------------*/
3475 name = apr_pstrdup(doc->buf.pool, val);
3477 else if (STRCASEEQ('m','M',"multiple",nm)) {
3478 /*----------------------------------------------------------------------*/
3479 /* CHTML 1.0 version 2.0 */
3480 /*----------------------------------------------------------------------*/
3481 multiple = apr_pstrdup(doc->buf.pool, val);
3484 if (size && *size) {
3489 if (name && *name) {
3495 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
3496 W_L(" multiple=\"true\"");
3499 if (IS_CSS_ON(xhtml->entryp)) {
3500 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3508 * It is a handler who processes the SELECT tag.
3510 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3511 * destination is specified.
3512 * @param node [i] The SELECT tag node is specified.
3513 * @return The conversion result is returned.
3516 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
3518 xhtml_t *xhtml = GET_XHTML(pdoc);
3519 Doc *doc = xhtml->doc;
3522 if (IS_CSS_ON(xhtml->entryp)) {
3523 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3530 * It is a handler who processes the OPTION tag.
3532 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3533 * destination is specified.
3534 * @param node [i] The OPTION tag node is specified.
3535 * @return The conversion result is returned.
3538 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
3540 xhtml_t *xhtml = GET_XHTML(pdoc);
3541 Doc *doc = xhtml->doc;
3543 char *attr_style = NULL;
3545 char *selected = NULL;
3549 for (attr = qs_get_attr(doc,node);
3551 attr = qs_get_next_attr(doc,attr)) {
3552 char *nm = qs_get_attr_name(doc,attr);
3553 char *val = qs_get_attr_value(doc,attr);
3554 if (STRCASEEQ('s','S',"selected",nm)) {
3555 /* CHTML version 2.0 */
3556 selected = apr_pstrdup(doc->buf.pool, val);
3558 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3559 /* CHTML version 2.0 */
3560 attr_style = apr_pstrdup(doc->buf.pool, val);
3562 else if (STRCASEEQ('v','V',"value",nm)) {
3563 /* CHTML version 2.0 */
3564 value = apr_pstrdup(doc->buf.pool, val);
3573 W_L(" selected=\"selected\"");
3576 if (IS_CSS_ON(xhtml->entryp)) {
3577 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3584 * It is a handler who processes the OPTION tag.
3586 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3587 * destination is specified.
3588 * @param node [i] The OPTION tag node is specified.
3589 * @return The conversion result is returned.
3592 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
3594 xhtml_t *xhtml = GET_XHTML(pdoc);
3595 Doc *doc = xhtml->doc;
3598 if (IS_CSS_ON(xhtml->entryp)) {
3599 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3607 * It is a handler who processes the DIV tag.
3609 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3610 * destination is specified.
3611 * @param node [i] The DIV tag node is specified.
3612 * @return The conversion result is returned.
3615 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
3617 xhtml_t *xhtml = GET_XHTML(pdoc);
3618 Doc *doc = xhtml->doc;
3620 char *attr_style = NULL;
3621 char *attr_align = NULL;
3622 char *attr_display = NULL;
3623 char *attr_decoration = NULL;
3624 char *attr_wap_marquee_style = NULL;
3625 char *attr_wap_marquee_dir = NULL;
3626 char *attr_wap_marquee_loop = NULL;
3627 char *attr_color = NULL;
3628 char *attr_bgcolor = NULL;
3629 char *attr_font_size = NULL;
3631 for (attr = qs_get_attr(doc,node);
3633 attr = qs_get_next_attr(doc,attr)) {
3634 char *nm = qs_get_attr_name(doc,attr);
3635 char *val = qs_get_attr_value(doc,attr);
3636 if (STRCASEEQ('a','A',"align",nm)) {
3637 /*----------------------------------------------------------------------*/
3638 /* CHTML 1.0 (W3C version 3.2) */
3639 /*----------------------------------------------------------------------*/
3640 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3641 attr_align = apr_pstrdup(doc->buf.pool, val);
3644 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3645 attr_style = apr_pstrdup(doc->buf.pool, val);
3649 if (IS_CSS_ON(xhtml->entryp)) {
3650 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3652 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3653 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3654 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3655 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3656 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3657 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3658 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3660 css_property_t *cur;
3661 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3662 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3663 attr_display = apr_pstrdup(doc->pool, cur->value);
3666 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3667 if (STRCASEEQ('b','B',"blink", cur->value)) {
3668 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3671 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3672 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3673 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3675 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3676 char *ss = strchr(cur->value, '#');
3678 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3679 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3682 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3683 attr_color = apr_pstrdup(doc->pool, cur->value);
3685 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3686 attr_align = apr_pstrdup(doc->pool, cur->value);
3688 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3689 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3690 || STRCASEEQ('x','X',"x-small",cur->value)
3691 || STRCASEEQ('s','S',"small",cur->value)
3692 || STRCASEEQ('m','M',"medium",cur->value)
3693 || STRCASEEQ('l','L',"large",cur->value)
3694 || STRCASEEQ('x','X',"x-large",cur->value)
3695 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3696 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3700 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3701 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3702 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3703 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3704 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3705 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3708 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3709 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3710 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3712 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3713 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3716 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
3717 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
3726 || attr_wap_marquee_style
3727 || attr_wap_marquee_dir
3728 || attr_wap_marquee_loop
3731 || attr_font_size) {
3743 if (attr_decoration) {
3744 W_L("text-decoration:");
3745 W_V(attr_decoration);
3748 if (attr_wap_marquee_style) {
3749 W_L("-wap-marquee-style:");
3750 W_V(attr_wap_marquee_style);
3753 if (attr_wap_marquee_dir) {
3754 W_L("-wap-marquee-dir:");
3755 W_V(attr_wap_marquee_dir);
3758 if (attr_wap_marquee_loop) {
3759 W_L("-wap-marquee-loop:");
3760 W_V(attr_wap_marquee_loop);
3769 W_L("background-color:");
3773 if (attr_font_size) {
3775 W_V(attr_font_size);
3786 * It is a handler who processes the DIV tag.
3788 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3789 * destination is specified.
3790 * @param node [i] The DIV tag node is specified.
3791 * @return The conversion result is returned.
3794 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
3796 xhtml_t *xhtml = GET_XHTML(pdoc);
3797 Doc *doc = xhtml->doc;
3799 if (IS_CSS_ON(xhtml->entryp)) {
3800 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3807 * It is a handler who processes the B tag.
3809 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3810 * destination is specified.
3811 * @param node [i] The B tag node is specified.
3812 * @return The conversion result is returned.
3815 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
3817 xhtml_t *xhtml = GET_XHTML(pdoc);
3818 Doc *doc = xhtml->doc;
3820 W_L("<div style=\"font-weight:bold\">");
3826 * It is a handler who processes the B tag.
3828 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3829 * destination is specified.
3830 * @param node [i] The B tag node is specified.
3831 * @return The conversion result is returned.
3834 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
3836 xhtml_t *xhtml = GET_XHTML(pdoc);
3837 Doc *doc = xhtml->doc;
3845 * It is a handler who processes the CHXJ:IF tag.
3847 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3848 * destination is specified.
3849 * @param node [i] The CHXJ:IF tag node is specified.
3852 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
3854 xhtml_t *xhtml = GET_XHTML(pdoc);
3855 Doc *doc = xhtml->doc;
3858 for (child = qs_get_child_node(doc, node);
3860 child = qs_get_next_node(doc, child)) {
3862 s_xhtml_1_0_chxjif_tag(xhtml, child);
3870 * It is a handler who processes the TEXTARE tag.
3872 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3873 * destination is specified.
3874 * @param node [i] The TEXTAREA tag node is specified.
3875 * @return The conversion result is returned.
3878 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
3880 xhtml_t *xhtml = GET_XHTML(pdoc);
3881 Doc *doc = xhtml->doc;
3883 char *attr_accesskey = NULL;
3884 char *attr_name = NULL;
3885 char *attr_rows = NULL;
3886 char *attr_cols = NULL;
3887 char *attr_istyle = NULL;
3888 char *attr_style = NULL;
3890 xhtml->textarea_flag++;
3891 for (attr = qs_get_attr(doc,node);
3893 attr = qs_get_next_attr(doc,attr)) {
3894 char *name = qs_get_attr_name(doc,attr);
3895 char *value = qs_get_attr_value(doc,attr);
3896 if (STRCASEEQ('n','N',"name",name) && value && *value) {
3899 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
3902 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
3905 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
3906 attr_istyle = value;
3908 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
3914 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
3915 attr_accesskey = value;
3917 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
3921 if (IS_CSS_ON(xhtml->entryp)) {
3922 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3924 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3925 css_property_t *cur;
3926 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3927 if (strcasestr(cur->value, "<ja:n>")) {
3930 else if (strcasestr(cur->value, "<ja:en>")) {
3933 else if (strcasestr(cur->value, "<ja:hk>")) {
3936 else if (strcasestr(cur->value, "<ja:h>")) {
3943 if (attr_accesskey) {
3944 W_L(" accesskey=\"");
3945 W_V(attr_accesskey);
3964 char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
3975 * It is a handler who processes the TEXTAREA tag.
3977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
3978 * destination is specified.
3979 * @param node [i] The TEXTAREA tag node is specified.
3980 * @return The conversion result is returned.
3983 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
3985 xhtml_t *xhtml = GET_XHTML(pdoc);
3986 Doc *doc = xhtml->doc;
3989 xhtml->textarea_flag--;
3995 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
3997 xhtml_t *xhtml = GET_XHTML(pdoc);
3998 Doc *doc = xhtml->doc;
3999 request_rec *r = doc->r;
4006 apr_size_t z2h_input_len;
4008 textval = qs_get_node_value(doc,child);
4009 if (strlen(textval) == 0) {
4013 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4014 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4016 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4017 memset(one_byte, 0, sizeof(one_byte));
4020 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4022 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4024 DBG(r,"[%s][%d]", out, rtn);
4025 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4029 if (is_sjis_kanji(textval[ii])) {
4030 one_byte[0] = textval[ii+0];
4031 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4032 one_byte[0] = textval[ii+1];
4033 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4036 else if (xhtml->pre_flag) {
4037 one_byte[0] = textval[ii+0];
4038 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4040 else if (xhtml->textarea_flag) {
4041 one_byte[0] = textval[ii+0];
4042 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4044 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4045 one_byte[0] = textval[ii+0];
4046 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4049 z2h_input_len = strlen(tdst);
4050 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4058 * It is a handler who processes the BLOCKQUOTE tag.
4060 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4061 * destination is specified.
4062 * @param node [i] The BLOCKQUOTE tag node is specified.
4063 * @return The conversion result is returned.
4066 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4071 char *attr_style = NULL;
4072 char *attr_color = NULL;
4073 char *attr_size = NULL;
4075 xhtml = GET_XHTML(pdoc);
4077 for (attr = qs_get_attr(doc,node);
4079 attr = qs_get_next_attr(doc,attr)) {
4080 char *nm = qs_get_attr_name(doc,attr);
4081 char *val = qs_get_attr_value(doc,attr);
4082 if (val && STRCASEEQ('s','S',"style", nm)) {
4086 if (IS_CSS_ON(xhtml->entryp)) {
4087 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4089 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4090 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4091 css_property_t *cur;
4092 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4093 if (cur->value && *cur->value) {
4094 attr_color = apr_pstrdup(doc->pool, cur->value);
4097 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4098 if (cur->value && *cur->value) {
4099 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4100 attr_size = apr_pstrdup(doc->pool, cur->value);
4102 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4103 attr_size = apr_pstrdup(doc->pool, cur->value);
4105 else if (STRCASEEQ('s','S',"small",cur->value)) {
4106 attr_size = apr_pstrdup(doc->pool, cur->value);
4108 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4109 attr_size = apr_pstrdup(doc->pool, cur->value);
4111 else if (STRCASEEQ('l','L',"large",cur->value)) {
4112 attr_size = apr_pstrdup(doc->pool, cur->value);
4114 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4115 attr_size = apr_pstrdup(doc->pool, cur->value);
4117 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4118 attr_size = apr_pstrdup(doc->pool, cur->value);
4125 if (attr_color || attr_size) {
4128 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4146 * It is a handler who processes the BLOCKQUOTE tag.
4148 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4149 * destination is specified.
4150 * @param node [i] The BLOCKQUOTE tag node is specified.
4151 * @return The conversion result is returned.
4154 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4156 xhtml_t *xhtml = GET_XHTML(pdoc);
4157 Doc *doc = xhtml->doc;
4158 W_L("</blockquote>");
4159 if (IS_CSS_ON(xhtml->entryp)) {
4160 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4167 * It is a handler who processes the DIR tag.
4169 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4170 * destination is specified.
4171 * @param node [i] The DIR tag node is specified.
4172 * @return The conversion result is returned.
4175 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
4177 xhtml_t *xhtml = GET_XHTML(pdoc);
4178 Doc *doc = xhtml->doc;
4180 char *attr_style = NULL;
4181 char *attr_color = NULL;
4182 char *attr_type = NULL;
4183 char *attr_size = NULL;
4184 for (attr = qs_get_attr(doc,node);
4186 attr = qs_get_next_attr(doc,attr)) {
4187 char *name = qs_get_attr_name(doc,attr);
4188 char *value = qs_get_attr_value(doc,attr);
4189 if (STRCASEEQ('t','T',"type",name)) {
4190 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4194 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4198 if (IS_CSS_ON(xhtml->entryp)) {
4199 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4201 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4202 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4203 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4204 css_property_t *cur;
4205 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4206 if (cur->value && *cur->value) {
4207 attr_color = apr_pstrdup(doc->pool, cur->value);
4210 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4211 if (cur->value && *cur->value) {
4212 attr_type = apr_pstrdup(doc->pool, cur->value);
4215 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4216 if (cur->value && *cur->value) {
4217 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4218 attr_size = apr_pstrdup(doc->pool, cur->value);
4220 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4221 attr_size = apr_pstrdup(doc->pool, cur->value);
4223 else if (STRCASEEQ('s','S',"small",cur->value)) {
4224 attr_size = apr_pstrdup(doc->pool, cur->value);
4226 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4227 attr_size = apr_pstrdup(doc->pool, cur->value);
4229 else if (STRCASEEQ('l','L',"large",cur->value)) {
4230 attr_size = apr_pstrdup(doc->pool, cur->value);
4232 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4233 attr_size = apr_pstrdup(doc->pool, cur->value);
4235 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4236 attr_size = apr_pstrdup(doc->pool, cur->value);
4243 if (attr_type || attr_color || attr_size) {
4246 W_L("list-style-type:");
4251 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4264 if (attr_type || attr_color || attr_size) {
4267 W_L("list-style-type:");
4272 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4290 * It is a handler who processes the DIR tag.
4292 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4293 * destination is specified.
4294 * @param node [i] The DIR tag node is specified.
4295 * @return The conversion result is returned.
4298 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
4300 xhtml_t *xhtml = GET_XHTML(pdoc);
4301 Doc *doc = xhtml->doc;
4303 if (IS_CSS_ON(xhtml->entryp)) {
4304 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4311 * It is a handler who processes the DL tag.
4313 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4314 * destination is specified.
4315 * @param node [i] The DL tag node is specified.
4316 * @return The conversion result is returned.
4319 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
4321 xhtml_t *xhtml = GET_XHTML(pdoc);
4322 Doc *doc = xhtml->doc;
4324 char *attr_style = NULL;
4325 char *attr_color = NULL;
4326 char *attr_size = NULL;
4328 for (attr = qs_get_attr(doc,node);
4330 attr = qs_get_next_attr(doc,attr)) {
4331 char *name = qs_get_attr_name(doc,attr);
4332 char *value = qs_get_attr_value(doc,attr);
4333 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4337 if (IS_CSS_ON(xhtml->entryp)) {
4338 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4340 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4341 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4342 css_property_t *cur;
4343 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4344 if (cur->value && *cur->value) {
4345 attr_color = apr_pstrdup(doc->pool, cur->value);
4348 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4349 if (cur->value && *cur->value) {
4350 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4351 attr_size = apr_pstrdup(doc->pool, cur->value);
4353 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4354 attr_size = apr_pstrdup(doc->pool, cur->value);
4356 else if (STRCASEEQ('s','S',"small",cur->value)) {
4357 attr_size = apr_pstrdup(doc->pool, cur->value);
4359 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4360 attr_size = apr_pstrdup(doc->pool, cur->value);
4362 else if (STRCASEEQ('l','L',"large",cur->value)) {
4363 attr_size = apr_pstrdup(doc->pool, cur->value);
4365 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4366 attr_size = apr_pstrdup(doc->pool, cur->value);
4368 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4369 attr_size = apr_pstrdup(doc->pool, cur->value);
4376 if (attr_color || attr_size) {
4379 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4397 * It is a handler who processes the DL tag.
4399 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4400 * destination is specified.
4401 * @param node [i] The DL tag node is specified.
4402 * @return The conversion result is returned.
4405 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
4407 xhtml_t *xhtml = GET_XHTML(pdoc);
4408 Doc *doc = xhtml->doc;
4410 if (IS_CSS_ON(xhtml->entryp)) {
4411 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4418 * It is a handter who processes the DT tag.
4420 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4421 * destination is specified.
4422 * @param node [i] The DT tag node is specified.
4423 * @return The conversion result is returned.
4426 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
4428 xhtml_t *xhtml = GET_XHTML(pdoc);
4429 Doc *doc = xhtml->doc;
4431 char *attr_style = NULL;
4432 char *attr_color = NULL;
4433 char *attr_size = NULL;
4435 for (attr = qs_get_attr(doc,node);
4437 attr = qs_get_next_attr(doc,attr)) {
4438 char *name = qs_get_attr_name(doc,attr);
4439 char *value = qs_get_attr_value(doc,attr);
4440 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4444 if (IS_CSS_ON(xhtml->entryp)) {
4445 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4447 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4448 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4449 css_property_t *cur;
4450 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4451 if (cur->value && *cur->value) {
4452 attr_color = apr_pstrdup(doc->pool, cur->value);
4455 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4456 if (cur->value && *cur->value) {
4457 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4458 attr_size = apr_pstrdup(doc->pool, cur->value);
4460 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4461 attr_size = apr_pstrdup(doc->pool, cur->value);
4463 else if (STRCASEEQ('s','S',"small",cur->value)) {
4464 attr_size = apr_pstrdup(doc->pool, cur->value);
4466 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4467 attr_size = apr_pstrdup(doc->pool, cur->value);
4469 else if (STRCASEEQ('l','L',"large",cur->value)) {
4470 attr_size = apr_pstrdup(doc->pool, cur->value);
4472 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4473 attr_size = apr_pstrdup(doc->pool, cur->value);
4475 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4476 attr_size = apr_pstrdup(doc->pool, cur->value);
4483 if (attr_color || attr_size) {
4486 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4504 * It is a handter who processes the DT tag.
4506 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4507 * destination is specified.
4508 * @param node [i] The DT tag node is specified.
4509 * @return The conversion result is returned.
4512 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
4514 xhtml_t *xhtml = GET_XHTML(pdoc);
4515 Doc *doc = xhtml->doc;
4517 if (IS_CSS_ON(xhtml->entryp)) {
4518 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4525 * It is a handder who processes the DD tag.
4527 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4528 * destination is specified.
4529 * @param node [i] The DD tag node is specified.
4530 * @return The conversion result is returned.
4533 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
4535 xhtml_t *xhtml = GET_XHTML(pdoc);
4536 Doc *doc = xhtml->doc;
4538 char *attr_style = NULL;
4539 char *attr_color = NULL;
4540 char *attr_size = NULL;
4542 for (attr = qs_get_attr(doc,node);
4544 attr = qs_get_next_attr(doc,attr)) {
4545 char *name = qs_get_attr_name(doc,attr);
4546 char *value = qs_get_attr_value(doc,attr);
4547 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4551 if (IS_CSS_ON(xhtml->entryp)) {
4552 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4554 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4555 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4556 css_property_t *cur;
4557 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4558 if (cur->value && *cur->value) {
4559 attr_color = apr_pstrdup(doc->pool, cur->value);
4562 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4563 if (cur->value && *cur->value) {
4564 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4565 attr_size = apr_pstrdup(doc->pool, cur->value);
4567 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4568 attr_size = apr_pstrdup(doc->pool, cur->value);
4570 else if (STRCASEEQ('s','S',"small",cur->value)) {
4571 attr_size = apr_pstrdup(doc->pool, cur->value);
4573 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4574 attr_size = apr_pstrdup(doc->pool, cur->value);
4576 else if (STRCASEEQ('l','L',"large",cur->value)) {
4577 attr_size = apr_pstrdup(doc->pool, cur->value);
4579 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4580 attr_size = apr_pstrdup(doc->pool, cur->value);
4582 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4583 attr_size = apr_pstrdup(doc->pool, cur->value);
4590 if (attr_color || attr_size) {
4593 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4611 * It is a handler who processes the DD tag.
4613 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4614 * destination is specified.
4615 * @param node [i] The DD tag node is specified.
4616 * @return The conversion result is returned.
4619 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
4621 xhtml_t *xhtml = GET_XHTML(pdoc);
4622 Doc *doc = xhtml->doc;
4624 if (IS_CSS_ON(xhtml->entryp)) {
4625 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4632 * It is a handler who processes the MENU tag.
4634 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4635 * destination is specified.
4636 * @param node [i] The MENU tag node is specified.
4637 * @return The conversion result is returned.
4640 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
4642 xhtml_t *xhtml = GET_XHTML(pdoc);
4643 Doc *doc = xhtml->doc;
4645 char *attr_style = NULL;
4646 char *attr_color = NULL;
4647 char *attr_type = NULL;
4648 char *attr_size = NULL;
4649 for (attr = qs_get_attr(doc,node);
4651 attr = qs_get_next_attr(doc,attr)) {
4652 char *name = qs_get_attr_name(doc,attr);
4653 char *value = qs_get_attr_value(doc,attr);
4654 if (STRCASEEQ('t','T',"type",name)) {
4655 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4659 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4663 if (IS_CSS_ON(xhtml->entryp)) {
4664 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4666 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4667 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4668 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4669 css_property_t *cur;
4670 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4671 if (cur->value && *cur->value) {
4672 attr_color = apr_pstrdup(doc->pool, cur->value);
4675 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4676 if (cur->value && *cur->value) {
4677 attr_type = apr_pstrdup(doc->pool, cur->value);
4680 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4681 if (cur->value && *cur->value) {
4682 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4683 attr_size = apr_pstrdup(doc->pool, cur->value);
4685 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4686 attr_size = apr_pstrdup(doc->pool, cur->value);
4688 else if (STRCASEEQ('s','S',"small",cur->value)) {
4689 attr_size = apr_pstrdup(doc->pool, cur->value);
4691 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4692 attr_size = apr_pstrdup(doc->pool, cur->value);
4694 else if (STRCASEEQ('l','L',"large",cur->value)) {
4695 attr_size = apr_pstrdup(doc->pool, cur->value);
4697 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4698 attr_size = apr_pstrdup(doc->pool, cur->value);
4700 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4701 attr_size = apr_pstrdup(doc->pool, cur->value);
4705 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4706 if (cur->value && *cur->value) {
4707 attr_type = apr_pstrdup(doc->pool, cur->value);
4710 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4711 if (cur->value && *cur->value) {
4712 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4713 attr_size = apr_pstrdup(doc->pool, cur->value);
4715 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4716 attr_size = apr_pstrdup(doc->pool, cur->value);
4718 else if (STRCASEEQ('s','S',"small",cur->value)) {
4719 attr_size = apr_pstrdup(doc->pool, cur->value);
4721 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4722 attr_size = apr_pstrdup(doc->pool, cur->value);
4724 else if (STRCASEEQ('l','L',"large",cur->value)) {
4725 attr_size = apr_pstrdup(doc->pool, cur->value);
4727 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4728 attr_size = apr_pstrdup(doc->pool, cur->value);
4730 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4731 attr_size = apr_pstrdup(doc->pool, cur->value);
4738 if (attr_type || attr_color || attr_size) {
4741 W_L("list-style-type:");
4746 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4759 if (attr_type || attr_color || attr_size) {
4762 W_L("list-style-type:");
4767 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4785 * It is a hanmenuer who processes the MENU tag.
4787 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4788 * destination is specified.
4789 * @param node [i] The MENU tag node is specified.
4790 * @return The conversion result is returned.
4793 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
4795 xhtml_t *xhtml = GET_XHTML(pdoc);
4796 Doc *doc = xhtml->doc;
4798 if (IS_CSS_ON(xhtml->entryp)) {
4799 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4806 * It is a handler who processes the PLAINTEXT tag.
4808 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4809 * destination is specified.
4810 * @param node [i] The PLAINTEXT tag node is specified.
4811 * @return The conversion result is returned.
4814 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
4816 xhtml_t *xhtml = GET_XHTML(pdoc);
4817 Doc *doc = xhtml->doc;
4819 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
4824 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
4826 xhtml_t *xhtml = GET_XHTML(pdoc);
4827 Doc *doc = xhtml->doc;
4829 for (child = qs_get_child_node(doc, node);
4831 child = qs_get_next_node(doc, child)) {
4833 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
4840 * It is a handler who processes the PLAINTEXT tag.
4842 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4843 * destination is specified.
4844 * @param node [i] The PLAINTEXT tag node is specified.
4845 * @return The conversion result is returned.
4848 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
4850 xhtml_t *xhtml = GET_XHTML(pdoc);
4851 Doc *doc = xhtml->doc;
4852 W_L("</plaintext>");
4858 * It is a handler who processes the BLINK tag.
4860 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4861 * destination is specified.
4862 * @param node [i] The BLINK tag node is specified.
4863 * @return The conversion result is returned.
4866 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
4868 xhtml_t *xhtml = GET_XHTML(pdoc);
4869 Doc *doc = xhtml->doc;
4871 char *attr_style = NULL;
4872 char *attr_color = NULL;
4873 char *attr_size = NULL;
4875 for (attr = qs_get_attr(doc,node);
4877 attr = qs_get_next_attr(doc,attr)) {
4878 char *name = qs_get_attr_name(doc,attr);
4879 char *value = qs_get_attr_value(doc,attr);
4880 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4884 if (IS_CSS_ON(xhtml->entryp)) {
4885 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4887 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4888 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4889 css_property_t *cur;
4890 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4891 if (cur->value && *cur->value) {
4892 attr_color = apr_pstrdup(doc->pool, cur->value);
4895 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4896 if (cur->value && *cur->value) {
4897 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4898 attr_size = apr_pstrdup(doc->pool, cur->value);
4900 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4901 attr_size = apr_pstrdup(doc->pool, cur->value);
4903 else if (STRCASEEQ('s','S',"small",cur->value)) {
4904 attr_size = apr_pstrdup(doc->pool, cur->value);
4906 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4907 attr_size = apr_pstrdup(doc->pool, cur->value);
4909 else if (STRCASEEQ('l','L',"large",cur->value)) {
4910 attr_size = apr_pstrdup(doc->pool, cur->value);
4912 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4913 attr_size = apr_pstrdup(doc->pool, cur->value);
4915 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4916 attr_size = apr_pstrdup(doc->pool, cur->value);
4923 if (attr_color || attr_size) {
4926 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4944 * It is a handler who processes the BLINK tag.
4946 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4947 * destination is specified.
4948 * @param node [i] The BLINK tag node is specified.
4949 * @return The conversion result is returned.
4952 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
4954 xhtml_t *xhtml = GET_XHTML(pdoc);
4955 Doc *doc = xhtml->doc;
4957 if (IS_CSS_ON(xhtml->entryp)) {
4958 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4965 * It is a handler who processes the MARQUEE tag.
4967 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4968 * destination is specified.
4969 * @param node [i] The MARQUEE tag node is specified.
4970 * @return The conversion result is returned.
4973 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
4975 xhtml_t *xhtml = GET_XHTML(pdoc);
4976 Doc *doc = xhtml->doc;
4978 char *attr_direction = NULL;
4979 char *attr_behavior = NULL;
4980 char *attr_loop = NULL;
4981 char *attr_style = NULL;
4982 char *attr_color = NULL;
4983 char *attr_size = NULL;
4984 char *attr_bgcolor = NULL;
4985 /*--------------------------------------------------------------------------*/
4986 /* Get Attributes */
4987 /*--------------------------------------------------------------------------*/
4988 for (attr = qs_get_attr(doc,node);
4990 attr = qs_get_next_attr(doc,attr)) {
4991 char *name = qs_get_attr_name(doc,attr);
4992 char *value = qs_get_attr_value(doc,attr);
4993 if (STRCASEEQ('d','D',"direction", name)) {
4995 if (STRCASEEQ('l','L',"left",value)) {
4996 attr_direction = "rtl";
4998 else if (STRCASEEQ('r','R',"right",value)) {
4999 attr_direction = "ltr";
5003 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
5004 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
5005 attr_behavior = value;
5008 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
5011 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5012 if (value && *value) {
5013 attr_bgcolor = value;
5016 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5020 if (IS_CSS_ON(xhtml->entryp)) {
5021 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5023 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5024 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5025 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5026 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5027 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5028 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5029 css_property_t *cur;
5030 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5031 if (cur->value && *cur->value) {
5032 attr_color = apr_pstrdup(doc->pool, cur->value);
5035 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5036 if (cur->value && *cur->value) {
5037 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5040 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5041 if (cur->value && *cur->value) {
5042 attr_direction = apr_pstrdup(doc->pool, cur->value);
5045 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
5046 if (cur->value && *cur->value) {
5047 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
5048 attr_behavior = apr_pstrdup(doc->pool, cur->value);
5052 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
5053 if (cur->value && *cur->value) {
5054 attr_loop = apr_pstrdup(doc->pool, cur->value);
5057 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5058 if (cur->value && *cur->value) {
5059 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5060 attr_size = apr_pstrdup(doc->pool, cur->value);
5062 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5063 attr_size = apr_pstrdup(doc->pool, cur->value);
5065 else if (STRCASEEQ('s','S',"small",cur->value)) {
5066 attr_size = apr_pstrdup(doc->pool, cur->value);
5068 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5069 attr_size = apr_pstrdup(doc->pool, cur->value);
5071 else if (STRCASEEQ('l','L',"large",cur->value)) {
5072 attr_size = apr_pstrdup(doc->pool, cur->value);
5074 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5075 attr_size = apr_pstrdup(doc->pool, cur->value);
5077 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5078 attr_size = apr_pstrdup(doc->pool, cur->value);
5085 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5087 if (attr_direction) {
5088 W_L("-wap-marquee-dir:");
5089 W_V(attr_direction);
5092 if (attr_behavior) {
5093 W_L("-wap-marquee-style:");
5098 W_L("-wap-marquee-loop:");
5103 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5104 W_L("background-color:");
5109 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5122 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5124 if (attr_direction) {
5125 W_L("-wap-marquee-dir:");
5126 W_V(attr_direction);
5129 if (attr_behavior) {
5130 W_L("-wap-marquee-style:");
5135 W_L("-wap-marquee-loop:");
5140 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5141 W_L("background-color:");
5146 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5165 * It is a handler who processes the MARQUEE tag.
5167 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5168 * destination is specified.
5169 * @param node [i] The MARQUEE tag node is specified.
5170 * @return The conversion result is returned.
5173 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5175 xhtml_t *xhtml = GET_XHTML(pdoc);
5176 Doc *doc = xhtml->doc;
5178 if (IS_CSS_ON(xhtml->entryp)) {
5179 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5186 * It is handler who processes the New Line Code.
5189 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5191 xhtml_t *xhtml = GET_XHTML(pdoc);
5192 Doc *doc = xhtml->doc;
5193 if (xhtml->start_html_flag) {
5201 * It is a handler who processes the LINK tag.
5203 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5204 * destination is specified.
5205 * @param node [i] The LINK tag node is specified.
5206 * @return The conversion result is returned.
5209 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5218 xhtml = GET_XHTML(pdoc);
5221 if (! IS_CSS_ON(xhtml->entryp)) {
5225 for (attr = qs_get_attr(doc,node);
5227 attr = qs_get_next_attr(doc,attr)) {
5228 char *name = qs_get_attr_name(doc,attr);
5229 char *value = qs_get_attr_value(doc,attr);
5230 if (STRCASEEQ('r','R',"rel", name)) {
5231 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5235 else if (STRCASEEQ('h','H',"href", name)) {
5236 if (value && *value) {
5240 else if (STRCASEEQ('t','T',"type", name)) {
5241 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5247 if (rel && href && type) {
5248 DBG(doc->r, "start load CSS. url:[%s]", href);
5249 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
5250 DBG(doc->r, "end load CSS. url:[%s]", href);
5256 static css_prop_list_t *
5257 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5259 xhtml_t *xhtml = GET_XHTML(pdoc);
5260 Doc *doc = xhtml->doc;
5261 css_prop_list_t *last_css = NULL;
5262 if (IS_CSS_ON(xhtml->entryp)) {
5263 css_prop_list_t *dup_css;
5264 css_selector_t *selector;
5266 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5267 dup_css = chxj_dup_css_prop_list(doc, last_css);
5268 selector = chxj_css_find_selector(doc, xhtml->style, node);
5270 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5272 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
5273 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5275 if (style_attr_value) {
5276 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));
5278 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5286 static css_prop_list_t *
5287 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5289 xhtml_t *xhtml = GET_XHTML(pdoc);
5290 Doc *doc = xhtml->doc;
5291 css_prop_list_t *last_css = NULL;
5292 if (IS_CSS_ON(xhtml->entryp)) {
5293 css_prop_list_t *dup_css;
5294 css_selector_t *selector;
5296 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5297 dup_css = chxj_dup_css_prop_list(doc, last_css);
5298 selector = chxj_css_find_selector(doc, xhtml->style, node);
5300 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5304 if (style_attr_value) {
5305 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));
5307 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5316 * It is a handler who processes the SPAN tag.
5318 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5319 * destination is specified.
5320 * @param node [i] The SPAN tag node is specified.
5321 * @return The conversion result is returned.
5324 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
5329 char *attr_style = NULL;
5330 char *attr_color = NULL;
5331 char *attr_size = NULL;
5332 char *attr_align = NULL;
5333 char *attr_blink = NULL;
5334 char *attr_marquee = NULL;
5335 char *attr_marquee_dir = NULL;
5336 char *attr_marquee_style = NULL;
5337 char *attr_marquee_loop = NULL;
5339 xhtml = GET_XHTML(pdoc);
5342 for (attr = qs_get_attr(doc,node);
5344 attr = qs_get_next_attr(doc,attr)) {
5345 char *nm = qs_get_attr_name(doc,attr);
5346 char *val = qs_get_attr_value(doc,attr);
5347 if (val && STRCASEEQ('s','S',"style", nm)) {
5351 if (IS_CSS_ON(xhtml->entryp)) {
5352 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5354 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5355 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5356 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5357 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5358 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5359 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5360 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5361 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5362 css_property_t *cur;
5363 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5364 attr_color = apr_pstrdup(doc->pool, cur->value);
5366 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5367 if (cur->value && *cur->value) {
5368 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5369 || STRCASEEQ('x','X',"x-small", cur->value)
5370 || STRCASEEQ('s','S',"small", cur->value)
5371 || STRCASEEQ('m','M',"medium", cur->value)
5372 || STRCASEEQ('l','L',"large", cur->value)
5373 || STRCASEEQ('x','X',"x-large", cur->value)
5374 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5375 attr_size = apr_pstrdup(doc->pool, cur->value);
5379 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5380 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5381 attr_blink = apr_pstrdup(doc->pool, cur->value);
5384 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5385 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5386 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5389 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5390 if (cur->value && *cur->value) {
5391 if ( STRCASEEQ('l','L',"ltr",cur->value)
5392 || STRCASEEQ('r','R',"rtl",cur->value)) {
5393 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5397 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5398 if (cur->value && *cur->value) {
5399 if ( STRCASEEQ('s','S',"scroll",cur->value)
5400 || STRCASEEQ('s','S',"slide",cur->value)
5401 || STRCASEEQ('a','A',"alternate",cur->value)) {
5402 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5406 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5407 if (cur->value && *cur->value) {
5408 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5411 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5412 if (STRCASEEQ('l','L',"left", cur->value)) {
5413 attr_align = apr_pstrdup(doc->pool, "left");
5415 else if (STRCASEEQ('c','C',"center",cur->value)) {
5416 attr_align = apr_pstrdup(doc->pool, "center");
5418 else if (STRCASEEQ('r','R',"right",cur->value)) {
5419 attr_align = apr_pstrdup(doc->pool, "right");
5426 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
5429 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5445 W_L("text-decoration:");
5450 W_L("display:-wap-marquee;");
5451 if (attr_marquee_dir) {
5452 W_L("-wap-marquee-dir:");
5453 W_V(attr_marquee_dir);
5456 if (attr_marquee_style) {
5457 W_L("-wap-marquee-style:");
5458 W_V(attr_marquee_style);
5461 if (attr_marquee_loop) {
5462 W_L("-wap-marquee-loop:");
5463 W_V(attr_marquee_loop);
5475 * It is a handler who processes the SPAN tag.
5477 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5478 * destination is specified.
5479 * @param node [i] The SPAN tag node is specified.
5480 * @return The conversion result is returned.
5483 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
5485 xhtml_t *xhtml = GET_XHTML(pdoc);
5486 Doc *doc = xhtml->doc;
5489 if (IS_CSS_ON(xhtml->entryp)) {
5490 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5497 * It is a handler who processes the STYLE tag.
5499 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5500 * destination is specified.
5501 * @param node [i] The STYLE tag node is specified.
5502 * @return The conversion result is returned.
5505 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
5512 xhtml = GET_XHTML(pdoc);
5515 if (! IS_CSS_ON(xhtml->entryp)) {
5519 for (attr = qs_get_attr(doc,node);
5521 attr = qs_get_next_attr(doc,attr)) {
5522 char *name = qs_get_attr_name(doc,attr);
5523 char *value = qs_get_attr_value(doc,attr);
5524 if (STRCASEEQ('t','T',"type", name)) {
5525 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5531 Node *child = qs_get_child_node(doc, node);
5532 if (type && child) {
5533 char *name = qs_get_node_name(doc, child);
5534 if (STRCASEEQ('t','T',"text", name)) {
5535 char *value = qs_get_node_value(doc, child);
5536 DBG(doc->r, "start load CSS. buf:[%s]", value);
5537 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
5538 DBG(doc->r, "end load CSS. value:[%s]", value);